diff options
author | Thomas Watson | 2008-01-28 15:12:11 +0000 |
---|---|---|
committer | Thomas Watson | 2008-01-28 15:12:11 +0000 |
commit | 4f6e6d73401b6d91eff5bb07c2c5f511ec4a0ebd (patch) | |
tree | 8d12fc97278248a305500439096b10b88ae6d59e /bundles/org.eclipse.osgi.tests | |
parent | 21adfd63257ebbd991aa2df5cb3b29eae2942cb1 (diff) | |
download | rt.equinox.framework-4f6e6d73401b6d91eff5bb07c2c5f511ec4a0ebd.tar.gz rt.equinox.framework-4f6e6d73401b6d91eff5bb07c2c5f511ec4a0ebd.tar.xz rt.equinox.framework-4f6e6d73401b6d91eff5bb07c2c5f511ec4a0ebd.zip |
Bug 181832 Console's "diag" command should try to display the ID of the "Missing required bundle"v20080128
Diffstat (limited to 'bundles/org.eclipse.osgi.tests')
-rw-r--r-- | bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java index e44372d79..5d167a1ad 100644 --- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java +++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/PlatformAdminBundleTests.java @@ -393,6 +393,38 @@ public class PlatformAdminBundleTests extends AbstractBundleTests { } catch (IllegalArgumentException e) { // expected } + } + + public void testUnresolvedLeaves01() throws Exception { + Bundle chainTestA = installer.installBundle("chain.test.a"); + Bundle chainTestB = installer.installBundle("chain.test.b"); + Bundle chainTestC = installer.installBundle("chain.test.c"); + Bundle[] allBundles = new Bundle[] {chainTestA, chainTestB, chainTestC}; + PlatformAdmin pa = installer.getPlatformAdmin(); + State systemState = pa.getState(false); + BundleDescription testADesc = systemState.getBundle(chainTestA.getBundleId()); + BundleDescription testBDesc = systemState.getBundle(chainTestB.getBundleId()); + BundleDescription testCDesc = systemState.getBundle(chainTestC.getBundleId()); + assertNotNull("testADesc null!!", testADesc); + assertNotNull("testBDesc null!!", testBDesc); + assertNotNull("testCDesc null!!", testCDesc); + + installer.resolveBundles(allBundles); + assertFalse("testADesc is resolved!!", testADesc.isResolved()); + assertFalse("testBDesc is resolved!!", testBDesc.isResolved()); + assertFalse("testCDesc is resolved!!", testCDesc.isResolved()); + + // ok finally we can start testing!! + VersionConstraint[] unsatifiedLeaves = pa.getStateHelper().getUnsatisfiedLeaves(new BundleDescription[] {testADesc}); + assertNotNull("Unsatified constraints is null!!", unsatifiedLeaves); + assertEquals("Wrong number of constraints!!", 2, unsatifiedLeaves.length); + for (int i = 0; i < unsatifiedLeaves.length; i++) { + assertTrue("Constraint type is not import package: " + unsatifiedLeaves[i], unsatifiedLeaves[i] instanceof ImportPackageSpecification); + assertEquals("Package name is wrong: " + i, "chain.test.d", unsatifiedLeaves[i].getName()); + if (unsatifiedLeaves[i].getBundle() != testBDesc && unsatifiedLeaves[i].getBundle() != testCDesc) + fail("Wrong bundle for the constraint: " + unsatifiedLeaves[i].getBundle()); + } } + } |