Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2015-10-02 10:25:24 -0400
committerThomas Watson2015-10-02 10:32:24 -0400
commit898d143780c6887641a5b324bf1ff9c0cedb804e (patch)
tree24f05e857d07c338db7d48612e9eb6cca782b3e1
parent6cda4953aa1b8a1dcaa8aaa1798aba67755a1157 (diff)
downloadrt.equinox.framework-898d143780c6887641a5b324bf1ff9c0cedb804e.tar.gz
rt.equinox.framework-898d143780c6887641a5b324bf1ff9c0cedb804e.tar.xz
rt.equinox.framework-898d143780c6887641a5b324bf1ff9c0cedb804e.zip
Add a testcase for a fragment that introduces a uses constraint conflict with the host export packageI20151006-0800
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java28
-rwxr-xr-xbundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n1.MF6
-rwxr-xr-xbundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n2.MF6
-rwxr-xr-xbundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n2.frag.MF6
-rwxr-xr-xbundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n3.MF7
5 files changed, 50 insertions, 3 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 b420fe27c..c7208bd4d 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
@@ -756,11 +756,11 @@ public class TestModuleContainer extends AbstractTest {
List<DummyModuleEvent> actual = database.getModuleEvents();
List<DummyModuleEvent> expected = new ArrayList<DummyModuleEvent>(Arrays.asList(new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED),
- new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED),
+ new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED),
- new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED),
+ new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UPDATED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED),
- new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED)));
+ new DummyModuleEvent(c4, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c6, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c7, ModuleEvent.UNRESOLVED, State.INSTALLED), new DummyModuleEvent(c4, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c6, ModuleEvent.RESOLVED, State.RESOLVED), new DummyModuleEvent(c7, ModuleEvent.RESOLVED, State.RESOLVED)));
assertEvents(expected, actual, false);
// uninstall c4
@@ -1726,6 +1726,28 @@ public class TestModuleContainer extends AbstractTest {
}
@Test
+ public void testUses6FragConflicts() throws BundleException, IOException {
+ DummyContainerAdaptor adaptor = createDummyAdaptor();
+ ModuleContainer container = adaptor.getContainer();
+
+ Module systemBundle = installDummyModule("system.bundle.MF", Constants.SYSTEM_BUNDLE_LOCATION, container);
+
+ container.resolve(Arrays.asList(systemBundle), true);
+ Module uses_n1 = installDummyModule("uses.n1.MF", "n1", container);
+ installDummyModule("uses.n2.MF", "n2", container);
+ Module uses_n2_frag = installDummyModule("uses.n2.frag.MF", "n2.frag", container);
+ Module uses_n3 = installDummyModule("uses.n3.MF", "n3", container);
+ ResolutionReport report = container.resolve(null, false);
+ Assert.assertNull("resolution report has a resolution exception.", report.getResolutionException());
+
+ Assert.assertEquals("n1 should resolve.", State.RESOLVED, uses_n1.getState());
+ // TODO The following should be true, but on the current resolver in Mars the host is thrown away also
+ //Assert.assertEquals("n2 should resolve.", State.RESOLVED, uses_n2.getState());
+ Assert.assertEquals("n2.frag should not resolve.", State.INSTALLED, uses_n2_frag.getState());
+ Assert.assertEquals("n3 should resolve.", State.RESOLVED, uses_n3.getState());
+ }
+
+ @Test
public void testOptionalSubstituted() throws BundleException, IOException {
DummyContainerAdaptor adaptor = createDummyAdaptor();
ModuleContainer container = adaptor.getContainer();
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n1.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n1.MF
new file mode 100755
index 000000000..427f6dfe7
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n1.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.n1
+Bundle-Version: 1.0
+Export-Package:
+ uses.n; version="1.0"
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n2.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n2.MF
new file mode 100755
index 000000000..559d806a6
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n2.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.n2
+Bundle-Version: 1.0
+Export-Package:
+ uses.n; version="2.0"
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n2.frag.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n2.frag.MF
new file mode 100755
index 000000000..bd4a20c9c
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n2.frag.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.n2.frag
+Bundle-Version: 1.0
+Fragment-Host: uses.n2
+Require-Bundle: uses.n3
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n3.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n3.MF
new file mode 100755
index 000000000..29edf9dc4
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.n3.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.n3
+Bundle-Version: 1.0
+Export-Package:
+ uses.n.a; version="1.0"; uses:="uses.n"
+Import-Package: uses.n; version="[1.0,2.0)"

Back to the top