Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2015-12-07 22:21:24 +0000
committerThomas Watson2015-12-07 22:21:24 +0000
commit37b7520f05fa9ce47db5376224a89384438fa150 (patch)
tree5c977295ae29bdf2ac49ecaaa85fc0f961c4abbf /bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container
parent0f8805c61ad64f8af27d5c5dee050460726b2f94 (diff)
downloadrt.equinox.framework-37b7520f05fa9ce47db5376224a89384438fa150.tar.gz
rt.equinox.framework-37b7520f05fa9ce47db5376224a89384438fa150.tar.xz
rt.equinox.framework-37b7520f05fa9ce47db5376224a89384438fa150.zip
Bug 483849 - Wires to capabilities provided by dynamically attached fragments are not recorded correctly in the host wiringI20151209-2300I20151209-2000I20151209-0800I20151208-2000I20151208-0800I20151207-2000
Diffstat (limited to 'bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container')
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java
index c7208bd4d..5af409b98 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java
@@ -1987,6 +1987,45 @@ public class TestModuleContainer extends AbstractTest {
}
+ @Test
+ public void testBug483849() throws BundleException, IOException {
+ DummyContainerAdaptor adaptor = createDummyAdaptor();
+ ModuleContainer container = adaptor.getContainer();
+
+ // install and resolve host bundle
+ Module host = installDummyModule("bug483849.host.MF", "host", container);
+ ResolutionReport report = container.resolve(Arrays.asList(host), true);
+ Assert.assertNull("Failed to resolve host.", report.getResolutionException());
+
+ // install and dynamically attach a fragment that exports a package and resolve an importer
+ Module frag = installDummyModule("bug483849.frag.MF", "frag", container);
+ Module importer = installDummyModule("bug483849.importer.MF", "importer", container);
+ report = container.resolve(Arrays.asList(frag, importer), true);
+ Assert.assertNull("Failed to resolve test fragment and importer.", report.getResolutionException());
+ // get the count of package exports
+ ModuleWiring wiring = host.getCurrentRevision().getWiring();
+ int originalPackageCnt = wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE).size();
+
+ // update the host to generate a new revision
+ Map<String, String> updateManifest = getManifest("bug483849.host.MF");
+ ModuleRevisionBuilder updateBuilder = OSGiManifestBuilderFactory.createBuilder(updateManifest);
+ container.update(host, updateBuilder, null);
+ // refresh host which should force the importer to re-resolve to the new revision
+ report = container.refresh(Collections.singleton(host));
+
+ ModuleWiring importerWiring = importer.getCurrentRevision().getWiring();
+ Assert.assertNotNull("No wiring for importer.", importerWiring);
+ List<ModuleWire> importerPackageWires = importerWiring.getRequiredModuleWires(PackageNamespace.PACKAGE_NAMESPACE);
+ Assert.assertEquals("Wrong number of importer package Wires.", 1, importerPackageWires.size());
+
+ Assert.assertEquals("Wrong provider wiring.", host.getCurrentRevision().getWiring(), importerPackageWires.iterator().next().getProviderWiring());
+ Assert.assertEquals("Wrong provider revision.", host.getCurrentRevision(), importerPackageWires.iterator().next().getProviderWiring().getRevision());
+
+ wiring = host.getCurrentRevision().getWiring();
+ List<BundleCapability> packages = wiring.getCapabilities(PackageNamespace.PACKAGE_NAMESPACE);
+ Assert.assertEquals("Wrong number of host packages.", originalPackageCnt, packages.size());
+ }
+
private static void assertWires(List<ModuleWire> required, List<ModuleWire>... provided) {
for (ModuleWire requiredWire : required) {
for (List<ModuleWire> providedList : provided) {

Back to the top