Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2014-04-17 12:12:17 -0400
committerThomas Watson2014-04-17 12:33:28 -0400
commit660c78161150f4fe6ed6c11469d9e225b7fab6ec (patch)
treeb9e4b38a401abaf7060444ab970549ad3e6b56cb
parentf0d437ad53ad0c0cab0b27d1c8299078deb03bd6 (diff)
downloadrt.equinox.framework-660c78161150f4fe6ed6c11469d9e225b7fab6ec.tar.gz
rt.equinox.framework-660c78161150f4fe6ed6c11469d9e225b7fab6ec.tar.xz
rt.equinox.framework-660c78161150f4fe6ed6c11469d9e225b7fab6ec.zip
Bug 433023 - Resolver does not allow optional reqs to resolve if they
introduce class space inconsistencies - Add a new testcase
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/container/TestModuleContainer.java40
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.importer.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.reqCap.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.requirer.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.l.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.m.conflict1.MF5
-rw-r--r--bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.m.conflict2.MF5
7 files changed, 75 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 9835303d2..0e3c98230 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
@@ -1524,6 +1524,46 @@ public class TestModuleContainer extends AbstractTest {
}
}
+ /**
+ * Test optional constraints
+ * @throws BundleException
+ * @throws IOException
+ */
+ @Test
+ public void testUses5Importer() throws BundleException, IOException {
+ doTestUses5("uses.k.importer.MF");
+ }
+
+ @Test
+ public void testUses5ReqCap() throws BundleException, IOException {
+ doTestUses5("uses.k.reqCap.MF");
+ }
+
+ @Test
+ public void testUses5Requirer() throws BundleException, IOException {
+ doTestUses5("uses.k.requirer.MF");
+ }
+
+ public void doTestUses5(String kManifest) 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_k = installDummyModule(kManifest, "k", container);
+ Module uses_l = installDummyModule("uses.l.MF", "l", container);
+ Module uses_m_conflict1 = installDummyModule("uses.m.conflict1.MF", "m.conflict1", container);
+ Module uses_m_conflict2 = installDummyModule("uses.m.conflict2.MF", "m.conflict2", container);
+
+ container.resolve(null, false);
+
+ Assert.assertEquals("k should resolve.", State.RESOLVED, uses_k.getState());
+ Assert.assertEquals("l should resolve.", State.RESOLVED, uses_l.getState());
+ Assert.assertEquals("m.conflict1 should resolve.", State.RESOLVED, uses_m_conflict1.getState());
+ Assert.assertEquals("m.conflict2 should resolve.", State.RESOLVED, uses_m_conflict2.getState());
+ }
+
@Test
public void testMultiCardinalityUses() throws BundleException, IOException {
DummyContainerAdaptor adaptor = createDummyAdaptor();
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.importer.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.importer.MF
new file mode 100644
index 000000000..852b3e432
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.importer.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.k.importer
+Bundle-Version: 1.0
+Require-Bundle: uses.l
+Import-Package: uses.conflict; conflict=1; resolution:=optional
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.reqCap.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.reqCap.MF
new file mode 100644
index 000000000..6ae78f7a6
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.reqCap.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.k.reqCap
+Bundle-Version: 1.0
+Require-Capability: uses.l; filter:="(&(uses.l=test))"; resolution:=optional
+Import-Package: uses.conflict; conflict=1
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.requirer.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.requirer.MF
new file mode 100644
index 000000000..6d9f23435
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.k.requirer.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.k.requirer
+Bundle-Version: 1.0
+Require-Bundle: uses.l; resolution:=optional
+Import-Package: uses.conflict; conflict=1
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.l.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.l.MF
new file mode 100644
index 000000000..485790bf1
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.l.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.l
+Bundle-Version: 1.0
+Provide-Capability: uses.l; uses.l=test; uses:=uses.l
+Export-Package: uses.l; uses:=uses.conflict
+Import-Package: uses.conflict; conflict=2; resolution:=optional
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.m.conflict1.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.m.conflict1.MF
new file mode 100644
index 000000000..a9ce84537
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.m.conflict1.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.m.conflict1
+Bundle-Version: 1.0
+Export-Package: uses.conflict; conflict=1
diff --git a/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.m.conflict2.MF b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.m.conflict2.MF
new file mode 100644
index 000000000..a57ec5a73
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/test_files/containerTests/uses.m.conflict2.MF
@@ -0,0 +1,5 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: uses.m.conflict2
+Bundle-Version: 1.0
+Export-Package: uses.conflict; conflict=2

Back to the top