Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2016-01-21 19:29:04 +0000
committerThomas Watson2016-01-21 19:45:43 +0000
commita48c2a720f024dce6cd92b96c26c746442a10d87 (patch)
treeeb1e56640d98ca87b51391e7385c9cfbe4827af1
parentf2fb5df887dadb01a071a46da8fb3e9958622306 (diff)
downloadrt.equinox.framework-a48c2a720f024dce6cd92b96c26c746442a10d87.tar.gz
rt.equinox.framework-a48c2a720f024dce6cd92b96c26c746442a10d87.tar.xz
rt.equinox.framework-a48c2a720f024dce6cd92b96c26c746442a10d87.zip
Bug 483799 - Fragments with the 'system.bundle' host are not attached on
incremental refresh - add a testcase Change-Id: Ib97698223726a5950140db09d9fd7d749c0a83b3 Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java36
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/containerTests/system.bundle.MF2
2 files changed, 37 insertions, 1 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 c13f2f9e6..b0e211022 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
@@ -11,6 +11,7 @@
package org.eclipse.osgi.tests.container;
import static java.util.jar.Attributes.Name.MANIFEST_VERSION;
+import static org.junit.Assert.assertEquals;
import java.io.*;
import java.util.*;
@@ -2157,6 +2158,41 @@ public class TestModuleContainer extends AbstractTest {
Assert.assertEquals("Wrong number of host packages.", originalPackageCnt, packages.size());
}
+ @Test
+ public void testSystemBundleOnDemandFragments() throws BundleException, IOException {
+ DummyContainerAdaptor adaptor = createDummyAdaptor();
+ ModuleContainer container = adaptor.getContainer();
+
+ // install the system.bundle
+ Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, Constants.SYSTEM_BUNDLE_SYMBOLICNAME, null, null, container);
+
+ // install an equinox fragment
+ Map<String, String> equinoxFragManifest = new HashMap<String, String>();
+ equinoxFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
+ equinoxFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "equinoxFrag");
+ equinoxFragManifest.put(Constants.FRAGMENT_HOST, "org.eclipse.osgi");
+ Module equinoxFrag = installDummyModule(equinoxFragManifest, "equinoxFrag", container);
+
+ // install a system.bundle fragment
+ Map<String, String> systemFragManifest = new HashMap<String, String>();
+ systemFragManifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
+ systemFragManifest.put(Constants.BUNDLE_SYMBOLICNAME, "systemFrag");
+ systemFragManifest.put(Constants.FRAGMENT_HOST, "system.bundle");
+ Module systemFrag = installDummyModule(systemFragManifest, "systemFrag", container);
+
+ ResolutionReport report = container.resolve(Arrays.asList(systemBundle), true);
+ Assert.assertNull("Failed to resolve system.bundle.", report.getResolutionException());
+
+ List<ModuleWire> hostWires = systemBundle.getCurrentRevision().getWiring().getProvidedModuleWires(HostNamespace.HOST_NAMESPACE);
+ assertEquals("Wrong number of fragments.", 2, hostWires.size());
+ Set<ModuleRevision> fragmentRevisions = new HashSet(Arrays.asList(equinoxFrag.getCurrentRevision(), systemFrag.getCurrentRevision()));
+ for (ModuleWire hostWire : hostWires) {
+ if (!fragmentRevisions.remove(hostWire.getRequirer())) {
+ Assert.fail("Unexpected fragment revision: " + hostWire.getRequirer());
+ }
+ }
+ }
+
private static void assertWires(List<ModuleWire> required, List<ModuleWire>... provided) {
for (ModuleWire requiredWire : required) {
for (List<ModuleWire> providedList : provided) {
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/system.bundle.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/system.bundle.MF
index 9869479f1..715ac4ee2 100644
--- a/bundles/org.eclipse.osgi.tests/test_files/containerTests/system.bundle.MF
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/system.bundle.MF
@@ -1,5 +1,5 @@
Bundle-ManifestVersion: 2
-Bundle-SymbolicName: system.bundle
+Bundle-SymbolicName: org.eclipse.osgi
Bundle-Version: 5.0.0
Export-Package: org.osgi.framework; version=1.7,
org.osgi.framework.wiring; version=1.1

Back to the top