Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2008-02-12 16:20:17 +0000
committerThomas Watson2008-02-12 16:20:17 +0000
commit24bf22274a62fa2b11318d82bad1d215a4725986 (patch)
tree3365d5f428dc240f535c82e24df9d3d91a7afedf
parenta908375cbcfc3e4870da6b0f033c114f0c3fc8b1 (diff)
downloadrt.equinox.framework-24bf22274a62fa2b11318d82bad1d215a4725986.tar.gz
rt.equinox.framework-24bf22274a62fa2b11318d82bad1d215a4725986.tar.xz
rt.equinox.framework-24bf22274a62fa2b11318d82bad1d215a4725986.zip
Bug 217724 Substitutable exports and require-bundle
-rw-r--r--bundles/org.eclipse.osgi.tests/.classpath18
-rw-r--r--bundles/org.eclipse.osgi.tests/build.properties56
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a.frag/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a.frag/substitutes/q/AFq.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/META-INF/MANIFEST.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/substitutes/x/Ax.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/substitutes/y/Ay.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b.frag/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b.frag/substitutes/q/BFq.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/META-INF/MANIFEST.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/substitutes/x/Bx.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/substitutes/y/By.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.c/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.d/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.e/META-INF/MANIFEST.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.e/substitutes/z/Ez.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.f/META-INF/MANIFEST.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.f/substitutes/z/Fz.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.g/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.h/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/META-INF/MANIFEST.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/substitutes/x/Ix.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/substitutes/y/Iy.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/META-INF/MANIFEST.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/substitutes/x/Jx.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/substitutes/y/Jy.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/META-INF/MANIFEST.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/substitutes/x/Kx.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/substitutes/y/Ky.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/META-INF/MANIFEST.MF7
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/substitutes/x/Lx.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/substitutes/y/Ly.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/substitutes/x/Mx.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/substitutes/y/My.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/META-INF/MANIFEST.MF8
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/substitutes/x/Nx.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/substitutes/y/Ny.java15
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.p/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/bundles_src/substitutes.q/META-INF/MANIFEST.MF6
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java32
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java3
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SubstituteExportsBundleTests.java572
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_007.java150
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_004.java230
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_005.java230
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_007.java225
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_009.java192
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_002.java170
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_004.java262
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_005.java170
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_008.java183
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestReprovide_001.java190
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AllTests.java3
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/R4ResolverTest.java24
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java53
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java2671
-rw-r--r--bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/BundleDescription.java9
-rw-r--r--bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/ExportPackageDescription.java4
-rw-r--r--bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java19
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java31
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java64
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java13
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java4
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java21
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java36
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java4
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java103
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java13
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionSupplier.java14
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java14
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java12
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java11
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java26
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java15
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java48
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties1
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java1
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java3
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java13
-rw-r--r--bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java12
81 files changed, 4011 insertions, 2338 deletions
diff --git a/bundles/org.eclipse.osgi.tests/.classpath b/bundles/org.eclipse.osgi.tests/.classpath
index a7e6832b7..8fdeb6bd9 100644
--- a/bundles/org.eclipse.osgi.tests/.classpath
+++ b/bundles/org.eclipse.osgi.tests/.classpath
@@ -53,6 +53,24 @@
<classpathentry kind="src" output="bundle_tests/test.fragment3" path="bundles_src/test.fragment3"/>
<classpathentry kind="src" output="bundle_tests/test.fragment4" path="bundles_src/test.fragment4"/>
<classpathentry kind="src" output="bundle_tests/test.fragment5" path="bundles_src/test.fragment5"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.a" path="bundles_src/substitutes.a"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.a.frag" path="bundles_src/substitutes.a.frag"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.b" path="bundles_src/substitutes.b"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.b.frag" path="bundles_src/substitutes.b.frag"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.c" path="bundles_src/substitutes.c"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.d" path="bundles_src/substitutes.d"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.e" path="bundles_src/substitutes.e"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.f" path="bundles_src/substitutes.f"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.g" path="bundles_src/substitutes.g"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.h" path="bundles_src/substitutes.h"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.i" path="bundles_src/substitutes.i"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.j" path="bundles_src/substitutes.j"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.k" path="bundles_src/substitutes.k"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.l" path="bundles_src/substitutes.l"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.m" path="bundles_src/substitutes.m"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.n" path="bundles_src/substitutes.n"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.p" path="bundles_src/substitutes.p"/>
+ <classpathentry kind="src" output="bundle_tests/substitutes.q" path="bundles_src/substitutes.q"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
diff --git a/bundles/org.eclipse.osgi.tests/build.properties b/bundles/org.eclipse.osgi.tests/build.properties
index 299697d4f..99bf6cd8f 100644
--- a/bundles/org.eclipse.osgi.tests/build.properties
+++ b/bundles/org.eclipse.osgi.tests/build.properties
@@ -121,6 +121,42 @@ source.bundle_tests/test.fragment4.jar = bundles_src/test.fragment4/
manifest.bundle_tests/test.fragment4.jar = META-INF/MANIFEST.MF
source.bundle_tests/test.fragment5.jar = bundles_src/test.fragment5/
manifest.bundle_tests/test.fragment5.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.a.jar = bundles_src/substitutes.a/
+manifest.bundle_tests/substitutes.a.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.a.frag.jar = bundles_src/substitutes.a.frag/
+manifest.bundle_tests/substitutes.a.frag.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.b.jar = bundles_src/substitutes.b/
+manifest.bundle_tests/substitutes.b.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.b.frag.jar = bundles_src/substitutes.b.frag/
+manifest.bundle_tests/substitutes.b.frag.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.c.jar = bundles_src/substitutes.c/
+manifest.bundle_tests/substitutes.c.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.d.jar = bundles_src/substitutes.d/
+manifest.bundle_tests/substitutes.d.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.e.jar = bundles_src/substitutes.e/
+manifest.bundle_tests/substitutes.e.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.f.jar = bundles_src/substitutes.f/
+manifest.bundle_tests/substitutes.f.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.g.jar = bundles_src/substitutes.g/
+manifest.bundle_tests/substitutes.g.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.h.jar = bundles_src/substitutes.h/
+manifest.bundle_tests/substitutes.h.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.i.jar = bundles_src/substitutes.i/
+manifest.bundle_tests/substitutes.i.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.j.jar = bundles_src/substitutes.j/
+manifest.bundle_tests/substitutes.j.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.k.jar = bundles_src/substitutes.k/
+manifest.bundle_tests/substitutes.k.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.l.jar = bundles_src/substitutes.l/
+manifest.bundle_tests/substitutes.l.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.m.jar = bundles_src/substitutes.m/
+manifest.bundle_tests/substitutes.m.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.n.jar = bundles_src/substitutes.n/
+manifest.bundle_tests/substitutes.n.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.p.jar = bundles_src/substitutes.p/
+manifest.bundle_tests/substitutes.p.jar = META-INF/MANIFEST.MF
+source.bundle_tests/substitutes.q.jar = bundles_src/substitutes.q/
+manifest.bundle_tests/substitutes.q.jar = META-INF/MANIFEST.MF
jars.compile.order = osgitests.jar,\
bundle_tests/test.jar,\
@@ -174,4 +210,22 @@ jars.compile.order = osgitests.jar,\
bundle_tests/test.fragment2.jar,\
bundle_tests/test.fragment3.jar,\
bundle_tests/test.fragment4.jar,\
- bundle_tests/test.fragment5.jar
+ bundle_tests/test.fragment5.jar,\
+ bundle_tests/substitutes.a.jar,\
+ bundle_tests/substitutes.a.frag.jar,\
+ bundle_tests/substitutes.b.jar,\
+ bundle_tests/substitutes.b.frag.jar,\
+ bundle_tests/substitutes.c.jar,\
+ bundle_tests/substitutes.d.jar,\
+ bundle_tests/substitutes.e.jar,\
+ bundle_tests/substitutes.f.jar,\
+ bundle_tests/substitutes.g.jar,\
+ bundle_tests/substitutes.h.jar,\
+ bundle_tests/substitutes.i.jar,\
+ bundle_tests/substitutes.j.jar,\
+ bundle_tests/substitutes.k.jar,\
+ bundle_tests/substitutes.l.jar,\
+ bundle_tests/substitutes.m.jar,\
+ bundle_tests/substitutes.n.jar,\
+ bundle_tests/substitutes.p.jar,\
+ bundle_tests/substitutes.q.jar
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a.frag/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a.frag/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..74b3da446
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a.frag/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.a.frag
+Bundle-SymbolicName: substitutes.a.frag
+Bundle-Version: 1.0.0
+Fragment-Host: substitutes.a
+Export-Package: substitutes.q; version=1.0
+Import-Package: substitutes.q; version="[1.0,2.0)"
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a.frag/substitutes/q/AFq.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a.frag/substitutes/q/AFq.java
new file mode 100644
index 000000000..cd6837c54
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a.frag/substitutes/q/AFq.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.q;
+
+public class AFq {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..0ec6eb6af
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.a
+Bundle-SymbolicName: substitutes.a
+Bundle-Version: 1.0.0
+Export-Package: substitutes.x; substitutes.y; version=1.0
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/substitutes/x/Ax.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/substitutes/x/Ax.java
new file mode 100644
index 000000000..b1c6e9092
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/substitutes/x/Ax.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.x;
+
+public class Ax {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/substitutes/y/Ay.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/substitutes/y/Ay.java
new file mode 100644
index 000000000..261bb8182
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.a/substitutes/y/Ay.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.y;
+
+public class Ay {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b.frag/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b.frag/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..ab318b1c0
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b.frag/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.b.frag
+Bundle-SymbolicName: substitutes.b.frag
+Bundle-Version: 1.0.0
+Fragment-Host: substitutes.b
+Export-Package: substitutes.q; version=1.0
+Import-Package: substitutes.q; version="[1.0,2.0)"
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b.frag/substitutes/q/BFq.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b.frag/substitutes/q/BFq.java
new file mode 100644
index 000000000..6b1e3f0e3
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b.frag/substitutes/q/BFq.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.q;
+
+public class BFq {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..b1b37b378
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.b
+Bundle-SymbolicName: substitutes.b
+Bundle-Version: 1.0.0
+Export-Package: substitutes.x; substitutes.y; version=1.0
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/substitutes/x/Bx.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/substitutes/x/Bx.java
new file mode 100644
index 000000000..a4d2f0bca
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/substitutes/x/Bx.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.x;
+
+public class Bx {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/substitutes/y/By.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/substitutes/y/By.java
new file mode 100644
index 000000000..3266e8c54
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.b/substitutes/y/By.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.y;
+
+public class By {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.c/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.c/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..b8fb60f64
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.c/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.c
+Bundle-SymbolicName: substitutes.c
+Bundle-Version: 1.0.0
+Require-Bundle: substitutes.a
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.d/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.d/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..19e1bfca1
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.d/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.d
+Bundle-SymbolicName: substitutes.d
+Bundle-Version: 1.0.0
+Require-Bundle: substitutes.b
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.e/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.e/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..fd7e3a71d
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.e/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.e
+Bundle-SymbolicName: substitutes.e
+Bundle-Version: 1.0.0
+Export-Package: substitutes.z
+Require-Bundle: substitutes.a; visibility:=reexport
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.e/substitutes/z/Ez.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.e/substitutes/z/Ez.java
new file mode 100644
index 000000000..9ab36bbe6
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.e/substitutes/z/Ez.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.z;
+
+public class Ez {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.f/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.f/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..79ff9b773
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.f/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.f
+Bundle-SymbolicName: substitutes.f
+Bundle-Version: 1.0.0
+Export-Package: substitutes.z
+Require-Bundle: substitutes.b; visibility:=reexport
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.f/substitutes/z/Fz.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.f/substitutes/z/Fz.java
new file mode 100644
index 000000000..c3032d8c1
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.f/substitutes/z/Fz.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.z;
+
+public class Fz {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.g/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.g/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..23c78afa3
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.g/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.g
+Bundle-SymbolicName: substitutes.g
+Bundle-Version: 1.0.0
+Require-Bundle: substitutes.e
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.h/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.h/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..3e156bc5f
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.h/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.h
+Bundle-SymbolicName: substitutes.h
+Bundle-Version: 1.0.0
+Require-Bundle: substitutes.f
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..5e8f3eaae
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.i
+Bundle-SymbolicName: substitutes.i
+Bundle-Version: 1.0.0
+Export-Package: substitutes.x; substitutes.y; version=1.0; mandatory:=a; a=split
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"; a=split
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/substitutes/x/Ix.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/substitutes/x/Ix.java
new file mode 100644
index 000000000..a4d6067d0
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/substitutes/x/Ix.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.x;
+
+public class Ix {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/substitutes/y/Iy.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/substitutes/y/Iy.java
new file mode 100644
index 000000000..207d65cc3
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.i/substitutes/y/Iy.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.y;
+
+public class Iy {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..e920cdf1a
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.j
+Bundle-SymbolicName: substitutes.j
+Bundle-Version: 1.0.0
+Export-Package: substitutes.x; substitutes.y; version=1.0; mandatory:=a; a=split
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"; a=split
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/substitutes/x/Jx.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/substitutes/x/Jx.java
new file mode 100644
index 000000000..845753283
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/substitutes/x/Jx.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.x;
+
+public class Jx {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/substitutes/y/Jy.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/substitutes/y/Jy.java
new file mode 100644
index 000000000..f8d49009e
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.j/substitutes/y/Jy.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.y;
+
+public class Jy {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..489a273e0
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.k
+Bundle-SymbolicName: substitutes.k
+Bundle-Version: 1.0.0
+Export-Package: substitutes.x; substitutes.y; version=1.0; mandatory:=b; b=split
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"; b=split
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/substitutes/x/Kx.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/substitutes/x/Kx.java
new file mode 100644
index 000000000..19e6bc7f6
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/substitutes/x/Kx.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.x;
+
+public class Kx {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/substitutes/y/Ky.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/substitutes/y/Ky.java
new file mode 100644
index 000000000..a3d88a7d5
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.k/substitutes/y/Ky.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.y;
+
+public class Ky {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..272a12a87
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/META-INF/MANIFEST.MF
@@ -0,0 +1,7 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.l
+Bundle-SymbolicName: substitutes.l
+Bundle-Version: 1.0.0
+Export-Package: substitutes.x; substitutes.y; version=1.0; mandatory:=b; b=split
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"; b=split
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/substitutes/x/Lx.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/substitutes/x/Lx.java
new file mode 100644
index 000000000..70134596e
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/substitutes/x/Lx.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.x;
+
+public class Lx {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/substitutes/y/Ly.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/substitutes/y/Ly.java
new file mode 100644
index 000000000..4bbfcfe6c
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.l/substitutes/y/Ly.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.y;
+
+public class Ly {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..524ed25cb
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.m
+Bundle-SymbolicName: substitutes.m
+Bundle-Version: 1.0.0
+Require-Bundle: substitutes.i, substitutes.k
+Export-Package: substitutes.x; substitutes.y; version=1.0
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/substitutes/x/Mx.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/substitutes/x/Mx.java
new file mode 100644
index 000000000..0bf131f4c
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/substitutes/x/Mx.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.x;
+
+public class Mx {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/substitutes/y/My.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/substitutes/y/My.java
new file mode 100644
index 000000000..ed9b601e8
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.m/substitutes/y/My.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.y;
+
+public class My {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..2a5b558ec
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/META-INF/MANIFEST.MF
@@ -0,0 +1,8 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.n
+Bundle-SymbolicName: substitutes.n
+Bundle-Version: 1.0.0
+Require-Bundle: substitutes.j, substitutes.l
+Export-Package: substitutes.x; substitutes.y; version=1.0
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/substitutes/x/Nx.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/substitutes/x/Nx.java
new file mode 100644
index 000000000..319a35e1a
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/substitutes/x/Nx.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.x;
+
+public class Nx {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/substitutes/y/Ny.java b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/substitutes/y/Ny.java
new file mode 100644
index 000000000..238a9c998
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.n/substitutes/y/Ny.java
@@ -0,0 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package substitutes.y;
+
+public class Ny {
+
+}
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.p/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.p/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..6b6bad04d
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.p/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.p
+Bundle-SymbolicName: substitutes.p
+Bundle-Version: 1.0.0
+Import-Package: substitutes.x; substitutes.y; version="[1.0, 2.0)"
diff --git a/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.q/META-INF/MANIFEST.MF b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.q/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..711bb90bb
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/bundles_src/substitutes.q/META-INF/MANIFEST.MF
@@ -0,0 +1,6 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: substitutes.q
+Bundle-SymbolicName: substitutes.q
+Bundle-Version: 1.0.0
+Require-Bundle: substitutes.n
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java
index 475c3b674..c9caed10a 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleInstaller.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -137,9 +137,9 @@ public class BundleInstaller {
return result;
}
- synchronized public void refreshPackages(Bundle[] refresh) {
+ synchronized public Bundle[] refreshPackages(Bundle[] refresh) {
if (bundles == null)
- return;
+ return null;
PackageAdmin pa = (PackageAdmin) packageAdmin.getService();
final boolean[] flag = new boolean[] {false};
FrameworkListener listener = new FrameworkListener() {
@@ -152,17 +152,27 @@ public class BundleInstaller {
}
};
context.addFrameworkListener(listener);
- pa.refreshPackages(refresh);
- synchronized (flag) {
- while (!flag[0]) {
- try {
- flag.wait(5000);
- } catch (InterruptedException e) {
- // do nothing
+ final HashSet refreshed = new HashSet();
+ context.addBundleListener(new SynchronousBundleListener() {
+ public void bundleChanged(BundleEvent event) {
+ refreshed.add(event.getBundle());
+ }
+ });
+ try {
+ pa.refreshPackages(refresh);
+ synchronized (flag) {
+ while (!flag[0]) {
+ try {
+ flag.wait(5000);
+ } catch (InterruptedException e) {
+ // do nothing
+ }
}
}
+ } finally {
+ context.removeFrameworkListener(listener);
}
- context.removeFrameworkListener(listener);
+ return (Bundle[]) refreshed.toArray(new Bundle[refreshed.size()]);
}
synchronized public boolean resolveBundles(Bundle[] resolve) {
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java
index 84f365958..61d6756b3 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/BundleTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -16,6 +16,7 @@ import junit.framework.TestSuite;
public class BundleTests {
public static Test suite() {
TestSuite suite = new TestSuite(BundleTests.class.getName());
+ suite.addTest(SubstituteExportsBundleTests.suite());
suite.addTest(PackageAdminBundleTests.suite());
suite.addTest(PlatformAdminBundleTests.suite());
suite.addTest(ExtensionBundleTests.suite());
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SubstituteExportsBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SubstituteExportsBundleTests.java
new file mode 100644
index 000000000..9d26cea44
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SubstituteExportsBundleTests.java
@@ -0,0 +1,572 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osgi.tests.bundles;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.service.packageadmin.ExportedPackage;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class SubstituteExportsBundleTests extends AbstractBundleTests {
+ public static Test suite() {
+ return new TestSuite(SubstituteExportsBundleTests.class);
+ }
+
+ public void testSubstituteExports01x() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ Bundle c = installer.installBundle("substitutes.c"); //$NON-NLS-1$
+ Bundle d = installer.installBundle("substitutes.d"); //$NON-NLS-1$
+
+ String className = "substitutes.x.Ax"; //$NON-NLS-1$
+ Class ax = null;
+ Class bx = null;
+ Class cx = null;
+ Class dx = null;
+ try {
+ ax = a.loadClass(className);
+ bx = b.loadClass(className);
+ cx = c.loadClass(className);
+ dx = d.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ fail("Unexpected exception", e); //$NON-NLS-1$
+ }
+ assertEquals("class from b is wrong", ax, bx); //$NON-NLS-1$
+ assertEquals("class from c is wrong", ax, cx); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, dx); //$NON-NLS-1$
+ }
+
+ public void testSubstituteExports01y() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ Bundle c = installer.installBundle("substitutes.c"); //$NON-NLS-1$
+ Bundle d = installer.installBundle("substitutes.d"); //$NON-NLS-1$
+
+ String className = "substitutes.y.Ay"; //$NON-NLS-1$
+ Class ax = null;
+ Class bx = null;
+ Class cx = null;
+ Class dx = null;
+ try {
+ ax = a.loadClass(className);
+ bx = b.loadClass(className);
+ cx = c.loadClass(className);
+ dx = d.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ fail("Unexpected exception", e); //$NON-NLS-1$
+ }
+ assertEquals("class from b is wrong", ax, bx); //$NON-NLS-1$
+ assertEquals("class from c is wrong", ax, cx); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, dx); //$NON-NLS-1$
+ }
+
+ public void testSubstituteExports02() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ Bundle e = installer.installBundle("substitutes.e"); //$NON-NLS-1$
+ Bundle f = installer.installBundle("substitutes.f"); //$NON-NLS-1$
+
+ String className = "substitutes.x.Ax"; //$NON-NLS-1$
+ Class ax = null;
+ Class bx = null;
+ Class ex = null;
+ Class fx = null;
+ try {
+ ax = a.loadClass(className);
+ bx = b.loadClass(className);
+ ex = e.loadClass(className);
+ fx = f.loadClass(className);
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+ assertEquals("class from b is wrong", ax, bx); //$NON-NLS-1$
+ assertEquals("class from c is wrong", ax, ex); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, fx); //$NON-NLS-1$
+ }
+
+ public void testSubstituteExports03() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ Bundle e = installer.installBundle("substitutes.e"); //$NON-NLS-1$
+ Bundle f = installer.installBundle("substitutes.f"); //$NON-NLS-1$
+ Bundle g = installer.installBundle("substitutes.g"); //$NON-NLS-1$
+ Bundle h = installer.installBundle("substitutes.h"); //$NON-NLS-1$
+
+ String className = "substitutes.x.Ax"; //$NON-NLS-1$
+ Class ax = null;
+ Class bx = null;
+ Class ex = null;
+ Class fx = null;
+ Class gx = null;
+ Class hx = null;
+ try {
+ ax = a.loadClass(className);
+ bx = b.loadClass(className);
+ ex = e.loadClass(className);
+ fx = f.loadClass(className);
+ gx = g.loadClass(className);
+ hx = h.loadClass(className);
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+ assertEquals("class from b is wrong", ax, bx); //$NON-NLS-1$
+ assertEquals("class from c is wrong", ax, ex); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, fx); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, gx); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, hx); //$NON-NLS-1$
+ }
+
+ public void testSubstituteExports04() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ installer.installBundle("substitutes.a.frag"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ installer.installBundle("substitutes.b.frag"); //$NON-NLS-1$
+ Bundle c = installer.installBundle("substitutes.c"); //$NON-NLS-1$
+ Bundle d = installer.installBundle("substitutes.d"); //$NON-NLS-1$
+
+ String className = "substitutes.x.Ax"; //$NON-NLS-1$
+ Class ax = null;
+ Class bx = null;
+ Class cx = null;
+ Class dx = null;
+ try {
+ ax = a.loadClass(className);
+ bx = b.loadClass(className);
+ cx = c.loadClass(className);
+ dx = d.loadClass(className);
+ } catch (ClassNotFoundException e) {
+ fail("Unexpected exception", e); //$NON-NLS-1$
+ }
+ assertEquals("class from b is wrong", ax, bx); //$NON-NLS-1$
+ assertEquals("class from c is wrong", ax, cx); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, dx); //$NON-NLS-1$
+
+ String className2 = "substitutes.q.AFq"; //$NON-NLS-1$
+ Class aq = null;
+ Class bq = null;
+ Class cq = null;
+ Class dq = null;
+ try {
+ aq = a.loadClass(className2);
+ bq = b.loadClass(className2);
+ cq = c.loadClass(className2);
+ dq = d.loadClass(className2);
+ } catch (ClassNotFoundException e) {
+ fail("Unexpected exception", e); //$NON-NLS-1$
+ }
+ assertEquals("class from b is wrong", aq, bq); //$NON-NLS-1$
+ assertEquals("class from c is wrong", aq, cq); //$NON-NLS-1$
+ assertEquals("class from d is wrong", aq, dq); //$NON-NLS-1$
+ }
+
+ public void testSubstituteExports05() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ installer.installBundle("substitutes.a.frag"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ installer.installBundle("substitutes.b.frag"); //$NON-NLS-1$
+ Bundle e = installer.installBundle("substitutes.e"); //$NON-NLS-1$
+ Bundle f = installer.installBundle("substitutes.f"); //$NON-NLS-1$
+ Bundle g = installer.installBundle("substitutes.g"); //$NON-NLS-1$
+ Bundle h = installer.installBundle("substitutes.h"); //$NON-NLS-1$
+
+ String className = "substitutes.x.Ax"; //$NON-NLS-1$
+ Class ax = null;
+ Class bx = null;
+ Class ex = null;
+ Class fx = null;
+ Class gx = null;
+ Class hx = null;
+ try {
+ ax = a.loadClass(className);
+ bx = b.loadClass(className);
+ ex = e.loadClass(className);
+ fx = f.loadClass(className);
+ gx = g.loadClass(className);
+ hx = h.loadClass(className);
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+ assertEquals("class from b is wrong", ax, bx); //$NON-NLS-1$
+ assertEquals("class from c is wrong", ax, ex); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, fx); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, gx); //$NON-NLS-1$
+ assertEquals("class from d is wrong", ax, hx); //$NON-NLS-1$
+
+ String className2 = "substitutes.q.AFq"; //$NON-NLS-1$
+ Class aq = null;
+ Class bq = null;
+ Class eq = null;
+ Class fq = null;
+ Class gq = null;
+ Class hq = null;
+ try {
+ aq = a.loadClass(className2);
+ bq = b.loadClass(className2);
+ eq = e.loadClass(className2);
+ fq = f.loadClass(className2);
+ gq = g.loadClass(className2);
+ hq = h.loadClass(className2);
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+ assertEquals("class from b is wrong", aq, bq); //$NON-NLS-1$
+ assertEquals("class from c is wrong", aq, eq); //$NON-NLS-1$
+ assertEquals("class from d is wrong", aq, fq); //$NON-NLS-1$
+ assertEquals("class from d is wrong", aq, gq); //$NON-NLS-1$
+ assertEquals("class from d is wrong", aq, hq); //$NON-NLS-1$
+ }
+
+ public void testSubstituteExports06() throws BundleException {
+ Bundle iBundle = installer.installBundle("substitutes.i"); //$NON-NLS-1$
+ Bundle jBundle = installer.installBundle("substitutes.j"); //$NON-NLS-1$
+ Bundle kBundle = installer.installBundle("substitutes.k"); //$NON-NLS-1$
+ Bundle lBundle = installer.installBundle("substitutes.l"); //$NON-NLS-1$
+ Bundle mBundle = installer.installBundle("substitutes.m"); //$NON-NLS-1$
+ Bundle nBundle = installer.installBundle("substitutes.n"); //$NON-NLS-1$
+ Bundle pBundle = installer.installBundle("substitutes.p"); //$NON-NLS-1$
+ Bundle qBundle = installer.installBundle("substitutes.q"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {iBundle, jBundle, kBundle, lBundle, mBundle, nBundle, pBundle, qBundle};
+
+ String classNameIx = "substitutes.x.Ix"; //$NON-NLS-1$
+ String classNameKx = "substitutes.x.Kx"; //$NON-NLS-1$
+ String classNameMx = "substitutes.x.Mx"; //$NON-NLS-1$
+ String classNameIy = "substitutes.y.Iy"; //$NON-NLS-1$
+ String classNameKy = "substitutes.y.Ky"; //$NON-NLS-1$
+ String classNameMy = "substitutes.y.My"; //$NON-NLS-1$
+
+ try {
+ Class iX = iBundle.loadClass(classNameIx);
+ assertEquals("jBundle has different copy of iX", iX, jBundle.loadClass(classNameIx)); //$NON-NLS-1$
+ assertEquals("mBundle has different copy of iX", iX, mBundle.loadClass(classNameIx)); //$NON-NLS-1$
+ assertEquals("nBundle has different copy of iX", iX, nBundle.loadClass(classNameIx)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of iX", iX, pBundle.loadClass(classNameIx)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of iX", iX, qBundle.loadClass(classNameIx)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+ try {
+ Class iY = iBundle.loadClass(classNameIy);
+ assertEquals("jBundle has different copy of iY", iY, jBundle.loadClass(classNameIy)); //$NON-NLS-1$
+ assertEquals("mBundle has different copy of iY", iY, mBundle.loadClass(classNameIy)); //$NON-NLS-1$
+ assertEquals("nBundle has different copy of iY", iY, nBundle.loadClass(classNameIy)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of iY", iY, pBundle.loadClass(classNameIy)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of iY", iY, qBundle.loadClass(classNameIy)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ try {
+ Class kX = kBundle.loadClass(classNameKx);
+ assertEquals("lBundle has different copy of Kx", kX, lBundle.loadClass(classNameKx)); //$NON-NLS-1$
+ assertEquals("mBundle has different copy of Kx", kX, mBundle.loadClass(classNameKx)); //$NON-NLS-1$
+ assertEquals("nBundle has different copy of Kx", kX, nBundle.loadClass(classNameKx)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of Kx", kX, pBundle.loadClass(classNameKx)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of Kx", kX, qBundle.loadClass(classNameKx)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ try {
+ Class kY = kBundle.loadClass(classNameKy);
+ assertEquals("lBundle has different copy of Ky", kY, lBundle.loadClass(classNameKy)); //$NON-NLS-1$
+ assertEquals("mBundle has different copy of Ky", kY, mBundle.loadClass(classNameKy)); //$NON-NLS-1$
+ assertEquals("nBundle has different copy of Ky", kY, nBundle.loadClass(classNameKy)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of Ky", kY, pBundle.loadClass(classNameKy)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of Ky", kY, qBundle.loadClass(classNameKy)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ try {
+ Class mX = mBundle.loadClass(classNameMx);
+ assertEquals("nBundle has different copy of mX", mX, nBundle.loadClass(classNameMx)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of mX", mX, pBundle.loadClass(classNameMx)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of mX", mX, qBundle.loadClass(classNameMx)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ try {
+ Class mY = mBundle.loadClass(classNameMy);
+ assertEquals("nBundle has different copy of mY", mY, nBundle.loadClass(classNameMy)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of mY", mY, pBundle.loadClass(classNameMy)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of mY", mY, qBundle.loadClass(classNameMy)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ String[] unexpectedClasseNames = new String[] {"substitutes.x.Jx", "substitutes.x.Lx", "substitutes.x.Nx", "substitutes.y.Jy", "substitutes.y.Ly", "substitutes.y.Ny"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ for (int i = 0; i < unexpectedClasseNames.length; i++) {
+ for (int j = 0; j < allBundles.length; j++) {
+ try {
+ Class found = allBundles[j].loadClass(unexpectedClasseNames[i]);
+ fail("Found class " + found + " in bundle " + allBundles[j]); //$NON-NLS-1$//$NON-NLS-2$
+ } catch (ClassNotFoundException cnfe) {
+ // expected
+ }
+ }
+ }
+ }
+
+ public void testSubstituteExports07() throws BundleException {
+ // same as previous split test but bundles are installed in opposite order to force the opposite classes to load
+ Bundle jBundle = installer.installBundle("substitutes.j"); //$NON-NLS-1$
+ Bundle iBundle = installer.installBundle("substitutes.i"); //$NON-NLS-1$
+ Bundle lBundle = installer.installBundle("substitutes.l"); //$NON-NLS-1$
+ Bundle kBundle = installer.installBundle("substitutes.k"); //$NON-NLS-1$
+ Bundle nBundle = installer.installBundle("substitutes.n"); //$NON-NLS-1$
+ Bundle mBundle = installer.installBundle("substitutes.m"); //$NON-NLS-1$
+ Bundle qBundle = installer.installBundle("substitutes.q"); //$NON-NLS-1$
+ Bundle pBundle = installer.installBundle("substitutes.p"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {iBundle, jBundle, kBundle, lBundle, mBundle, nBundle, pBundle, qBundle};
+
+ String classNameJx = "substitutes.x.Jx"; //$NON-NLS-1$
+ String classNameLx = "substitutes.x.Lx"; //$NON-NLS-1$
+ String classNameNx = "substitutes.x.Nx"; //$NON-NLS-1$
+ String classNameJy = "substitutes.y.Jy"; //$NON-NLS-1$
+ String classNameLy = "substitutes.y.Ly"; //$NON-NLS-1$
+ String classNameNy = "substitutes.y.Ny"; //$NON-NLS-1$
+
+ try {
+ Class jX = jBundle.loadClass(classNameJx);
+ assertEquals("iBundle has different copy of Jx", jX, iBundle.loadClass(classNameJx)); //$NON-NLS-1$
+ assertEquals("mBundle has different copy of Jx", jX, mBundle.loadClass(classNameJx)); //$NON-NLS-1$
+ assertEquals("nBundle has different copy of Jx", jX, nBundle.loadClass(classNameJx)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of Jx", jX, pBundle.loadClass(classNameJx)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of Jx", jX, qBundle.loadClass(classNameJx)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+ try {
+ Class jY = jBundle.loadClass(classNameJy);
+ assertEquals("jBundle has different copy of Jy", jY, iBundle.loadClass(classNameJy)); //$NON-NLS-1$
+ assertEquals("mBundle has different copy of Jy", jY, mBundle.loadClass(classNameJy)); //$NON-NLS-1$
+ assertEquals("nBundle has different copy of Jy", jY, nBundle.loadClass(classNameJy)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of Jy", jY, pBundle.loadClass(classNameJy)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of Jy", jY, qBundle.loadClass(classNameJy)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ try {
+ Class lX = lBundle.loadClass(classNameLx);
+ assertEquals("lBundle has different copy of Lx", lX, kBundle.loadClass(classNameLx)); //$NON-NLS-1$
+ assertEquals("mBundle has different copy of Lx", lX, mBundle.loadClass(classNameLx)); //$NON-NLS-1$
+ assertEquals("nBundle has different copy of Lx", lX, nBundle.loadClass(classNameLx)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of Lx", lX, pBundle.loadClass(classNameLx)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of Lx", lX, qBundle.loadClass(classNameLx)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ try {
+ Class lY = lBundle.loadClass(classNameLy);
+ assertEquals("lBundle has different copy of Ly", lY, kBundle.loadClass(classNameLy)); //$NON-NLS-1$
+ assertEquals("mBundle has different copy of Ly", lY, mBundle.loadClass(classNameLy)); //$NON-NLS-1$
+ assertEquals("nBundle has different copy of Ly", lY, nBundle.loadClass(classNameLy)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of Ly", lY, pBundle.loadClass(classNameLy)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of Ly", lY, qBundle.loadClass(classNameLy)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ try {
+ Class nX = nBundle.loadClass(classNameNx);
+ assertEquals("nBundle has different copy of Nx", nX, mBundle.loadClass(classNameNx)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of Nx", nX, pBundle.loadClass(classNameNx)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of Nx", nX, qBundle.loadClass(classNameNx)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ try {
+ Class nY = nBundle.loadClass(classNameNy);
+ assertEquals("nBundle has different copy of Ny", nY, mBundle.loadClass(classNameNy)); //$NON-NLS-1$
+ assertEquals("pBundle has different copy of Ny", nY, pBundle.loadClass(classNameNy)); //$NON-NLS-1$
+ assertEquals("qBundle has different copy of Ny", nY, qBundle.loadClass(classNameNy)); //$NON-NLS-1$
+ } catch (ClassNotFoundException cnfe) {
+ fail("Unexpected exception", cnfe); //$NON-NLS-1$
+ }
+
+ String[] unexpectedClasseNames = new String[] {"substitutes.x.Ix", "substitutes.x.Kx", "substitutes.x.Mx", "substitutes.y.Iy", "substitutes.y.Ky", "substitutes.y.My"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
+ for (int i = 0; i < unexpectedClasseNames.length; i++) {
+ for (int j = 0; j < allBundles.length; j++) {
+ try {
+ Class found = allBundles[j].loadClass(unexpectedClasseNames[i]);
+ fail("Found class " + found + " in bundle " + allBundles[j]); //$NON-NLS-1$//$NON-NLS-2$
+ } catch (ClassNotFoundException cnfe) {
+ // expected
+ }
+ }
+ }
+ }
+
+ public void testSubstituteExports08() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ Bundle c = installer.installBundle("substitutes.c"); //$NON-NLS-1$
+ Bundle d = installer.installBundle("substitutes.d"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {a, b, c, d};
+ doRefreshTest(allBundles, a);
+ }
+
+ public void testSubstituteExports09() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ Bundle e = installer.installBundle("substitutes.e"); //$NON-NLS-1$
+ Bundle f = installer.installBundle("substitutes.f"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {a, b, e, f};
+ doRefreshTest(allBundles, a);
+ }
+
+ public void testSubstituteExports10() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ Bundle e = installer.installBundle("substitutes.e"); //$NON-NLS-1$
+ Bundle f = installer.installBundle("substitutes.f"); //$NON-NLS-1$
+ Bundle g = installer.installBundle("substitutes.g"); //$NON-NLS-1$
+ Bundle h = installer.installBundle("substitutes.h"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {a, b, e, f, g, h};
+ doRefreshTest(allBundles, a);
+ }
+
+ public void testSubstituteExports11() throws BundleException {
+ Bundle iBundle = installer.installBundle("substitutes.i"); //$NON-NLS-1$
+ Bundle jBundle = installer.installBundle("substitutes.j"); //$NON-NLS-1$
+ installer.installBundle("substitutes.k"); //$NON-NLS-1$
+ installer.installBundle("substitutes.l"); //$NON-NLS-1$
+ Bundle mBundle = installer.installBundle("substitutes.m"); //$NON-NLS-1$
+ Bundle nBundle = installer.installBundle("substitutes.n"); //$NON-NLS-1$
+ Bundle pBundle = installer.installBundle("substitutes.p"); //$NON-NLS-1$
+ Bundle qBundle = installer.installBundle("substitutes.q"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {iBundle, jBundle, mBundle, nBundle, pBundle, qBundle}; // k and l do not depend on i
+ doRefreshTest(allBundles, iBundle);
+ }
+
+ public void testSubstituteExports12() throws BundleException {
+ Bundle jBundle = installer.installBundle("substitutes.j"); //$NON-NLS-1$
+ Bundle iBundle = installer.installBundle("substitutes.i"); //$NON-NLS-1$
+ installer.installBundle("substitutes.l"); //$NON-NLS-1$
+ installer.installBundle("substitutes.k"); //$NON-NLS-1$
+ Bundle nBundle = installer.installBundle("substitutes.n"); //$NON-NLS-1$
+ Bundle mBundle = installer.installBundle("substitutes.m"); //$NON-NLS-1$
+ Bundle qBundle = installer.installBundle("substitutes.q"); //$NON-NLS-1$
+ Bundle pBundle = installer.installBundle("substitutes.p"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {iBundle, jBundle, mBundle, nBundle, pBundle, qBundle}; // k and l do not depend on j
+ doRefreshTest(allBundles, jBundle);
+ }
+
+ private void doRefreshTest(Bundle[] allBundles, Bundle toRefresh) {
+ installer.resolveBundles(allBundles);
+ Bundle[] refreshed = installer.refreshPackages(new Bundle[] {toRefresh});
+ for (int i = 0; i < allBundles.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < refreshed.length && !found; j++)
+ found = allBundles[i] == refreshed[j];
+ if (!found)
+ fail("bundle did not get refreshed: " + allBundles[i]); //$NON-NLS-1$
+ }
+ assertEquals("Wrong number of bundles refreshed", allBundles.length, refreshed.length); //$NON-NLS-1$
+ }
+
+ public void testSubstituteExports13() throws BundleException {
+ Bundle a = installer.installBundle("substitutes.a"); //$NON-NLS-1$
+ Bundle b = installer.installBundle("substitutes.b"); //$NON-NLS-1$
+ Bundle c = installer.installBundle("substitutes.c"); //$NON-NLS-1$
+ Bundle d = installer.installBundle("substitutes.d"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {a, b, c, d};
+ assertTrue("Bundles are not resolved", installer.resolveBundles(allBundles)); //$NON-NLS-1$
+
+ PackageAdmin pa = installer.getPackageAdmin();
+
+ ExportedPackage[] xPackages = pa.getExportedPackages("substitutes.x"); //$NON-NLS-1$
+ assertNotNull("xPackages is null", xPackages); //$NON-NLS-1$
+ assertEquals("xPackages wrong number", 1, xPackages.length); //$NON-NLS-1$
+ assertEquals("Wrong exporter", a, xPackages[0].getExportingBundle()); //$NON-NLS-1$
+ Bundle[] xImporters = xPackages[0].getImportingBundles();
+ assertNotNull("xImporters is null", xImporters); //$NON-NLS-1$
+ assertEquals("Wrong number of xImporters", 3, xImporters.length); //$NON-NLS-1$
+
+ ExportedPackage[] yPackages = pa.getExportedPackages("substitutes.y"); //$NON-NLS-1$
+ assertNotNull("yPackages is null", yPackages); //$NON-NLS-1$
+ assertEquals("yPackages wrong number", 1, yPackages.length); //$NON-NLS-1$
+ assertEquals("Wrong exporter", a, yPackages[0].getExportingBundle()); //$NON-NLS-1$
+ Bundle[] yImporters = yPackages[0].getImportingBundles();
+ assertNotNull("yImporters is null", yImporters); //$NON-NLS-1$
+ assertEquals("Wrong number of yImporters", 3, yImporters.length); //$NON-NLS-1$
+
+ Bundle[] expectedImporters = new Bundle[] {b, c, d};
+ for (int i = 0; i < expectedImporters.length; i++) {
+ contains("xPackages importers does not contain", xImporters, expectedImporters[i]); //$NON-NLS-1$
+ contains("yPackages importers does not contain", yImporters, expectedImporters[i]); //$NON-NLS-1$
+ }
+ }
+
+ public void testSubstituteExports14() throws BundleException {
+ Bundle iBundle = installer.installBundle("substitutes.i"); //$NON-NLS-1$
+ Bundle jBundle = installer.installBundle("substitutes.j"); //$NON-NLS-1$
+ Bundle kBundle = installer.installBundle("substitutes.k"); //$NON-NLS-1$
+ Bundle lBundle = installer.installBundle("substitutes.l"); //$NON-NLS-1$
+ Bundle mBundle = installer.installBundle("substitutes.m"); //$NON-NLS-1$
+ Bundle nBundle = installer.installBundle("substitutes.n"); //$NON-NLS-1$
+ Bundle pBundle = installer.installBundle("substitutes.p"); //$NON-NLS-1$
+ Bundle qBundle = installer.installBundle("substitutes.q"); //$NON-NLS-1$
+ Bundle[] allBundles = new Bundle[] {iBundle, jBundle, kBundle, lBundle, mBundle, nBundle, pBundle, qBundle}; // k and l do not depend on i
+ assertTrue("Bundles are not resolved", installer.resolveBundles(allBundles)); //$NON-NLS-1$
+
+ PackageAdmin pa = installer.getPackageAdmin();
+
+ ExportedPackage[] xPackages = pa.getExportedPackages("substitutes.x"); //$NON-NLS-1$
+ assertNotNull("xPackages is null", xPackages); //$NON-NLS-1$
+ assertEquals("xPackages wrong number", 3, xPackages.length); //$NON-NLS-1$
+
+ ExportedPackage[] yPackages = pa.getExportedPackages("substitutes.y"); //$NON-NLS-1$
+ assertNotNull("yPackages is null", yPackages); //$NON-NLS-1$
+ assertEquals("yPackages wrong number", 3, yPackages.length); //$NON-NLS-1$
+
+ Bundle[] expectedExporters = new Bundle[] {iBundle, kBundle, mBundle};
+ for (int i = 0; i < expectedExporters.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < xPackages.length && !found; j++) {
+ found = expectedExporters[i] == xPackages[j].getExportingBundle();
+ if (found) {
+ Bundle[] importingBundles = xPackages[j].getImportingBundles();
+ Bundle[] expectedImporters = null;
+ String message = null;
+ if (expectedExporters[i] == iBundle) {
+ expectedImporters = new Bundle[] {jBundle, mBundle, nBundle, pBundle, qBundle};
+ message = "iBundle "; //$NON-NLS-1$
+ } else if (expectedExporters[i] == kBundle) {
+ expectedImporters = new Bundle[] {lBundle, mBundle, nBundle, pBundle, qBundle};
+ message = "kBundle "; //$NON-NLS-1$
+ } else if (expectedExporters[i] == mBundle) {
+ expectedImporters = new Bundle[] {nBundle, pBundle, qBundle};
+ message = "mBundle "; //$NON-NLS-1$
+ }
+ assertEquals(message, expectedImporters.length, importingBundles.length);
+ for (int k = 0; k < expectedImporters.length; k++)
+ contains(message, importingBundles, expectedImporters[k]);
+ }
+ }
+ }
+
+ }
+
+ private void contains(String message, Bundle[] bundles, Bundle b) {
+ boolean found = false;
+ for (int i = 0; i < bundles.length && !found; i++)
+ found = bundles[i] == b;
+ if (!found)
+ fail(message + b);
+ }
+}
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_007.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_007.java
deleted file mode 100644
index 953bdc3fb..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestDynamic_007.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestDynamic_007 extends AbstractStateTest {
- public TestDynamic_007(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
-
-
- public void testTest_001() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
-
- // Dynamics
- ExportPackageDescription exp = state.linkDynamicImport(bundle_1, "p");
- assertNotNull("Package [p] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [p] is wired incorrectly ", exp.getExporter(), bundle_2);
-
- } // end of method
-
-
- public void checkWiringState_1() {
- } // end method
-
- public void checkWiringState_2() {
- BundleDescription[] requires = bundle_2.getResolvedRequires();
- assertNotNull("requires array is unexpectedly null", requires);
- assertTrue("requires array is unexpectedly empty", requires.length > 0);
- for (int i = 0; i < requires.length; i++) {
- String exportPackageName = requires[i].getName();
- assertNotNull("require name is null", exportPackageName);
- if (exportPackageName.equals("C")) {
- assertNotNull("Require [C] is not wired when it should be ", requires[i]);
- assertEquals("Require [C] is wired incorrectly ", requires[i], bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- } // end method
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("DynamicImport-Package", "p; bundle-symbolic-name=B");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Require-Bundle", "C; reprovide=true");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Export-Package", "p");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_004.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_004.java
deleted file mode 100644
index 17dfb2021..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_004.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestGrouping_004 extends AbstractStateTest {
- public TestGrouping_004(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
- BundleDescription bundle_5 = null;
-
-
- public void testTest_003() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- bundle_5 = create_bundle_5(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- ExportPackageDescription[] exports = bundle_1.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", exp.getExporter(), bundle_2);
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", exp.getExporter(), bundle_2);
- } else if (exportPackageName.equals("z")) {
- assertNotNull("Package [z] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [z] is wired incorrectly ", exp.getExporter(), bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_2() {
- ExportPackageDescription[] exports = bundle_2.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", exp.getExporter(), bundle_3);
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", exp.getExporter(), bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- ExportPackageDescription[] exports = bundle_3.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", exp.getExporter(), bundle_4);
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", exp.getExporter(), bundle_4);
- }
- } // end for
- } // end method
-
- public void checkWiringState_4() {
- } // end method
-
- public void checkWiringState_5() {
- } // end method
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- checkWiringState_5();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_5);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_5.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("Import-Package", "x, y, z; bundle-symbolic-name=C");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Reexport-Package", "x, y");
- dictionary_2.put("Import-Package", "x; y; bundle-symbolic-name=C");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Export-Package", "z; uses:=\"x,y\"");
- dictionary_3.put("Reexport-Package", "x; y");
- dictionary_3.put("Import-Package", "x; y; bundle-symbolic-name=D");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "D");
- dictionary_4.put("Export-Package", "x; y; uses:=\"x,y\"");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_5(StateObjectFactory sof) {
- java.util.Dictionary dictionary_5 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_5.put("Bundle-ManifestVersion", "2");
- dictionary_5.put("Bundle-SymbolicName", "E");
- dictionary_5.put("Export-Package", "z; version=2.0");
- try {
- bundle = sof.createBundleDescription(dictionary_5, "bundle_5", 5);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_005.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_005.java
deleted file mode 100644
index 7d9093eae..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_005.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestGrouping_005 extends AbstractStateTest {
- public TestGrouping_005(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
- BundleDescription bundle_5 = null;
-
-
- public void testTest_003() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- bundle_5 = create_bundle_5(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- ExportPackageDescription[] exports = bundle_1.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", exp.getExporter(), bundle_2);
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", exp.getExporter(), bundle_2);
- } else if (exportPackageName.equals("z")) {
- assertNotNull("Package [z] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [z] is wired incorrectly ", exp.getExporter(), bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_2() {
- ExportPackageDescription[] exports = bundle_2.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", exp.getExporter(), bundle_3);
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", exp.getExporter(), bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- ExportPackageDescription[] exports = bundle_3.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", exp.getExporter(), bundle_4);
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", exp.getExporter(), bundle_4);
- }
- } // end for
- } // end method
-
- public void checkWiringState_4() {
- } // end method
-
- public void checkWiringState_5() {
- } // end method
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- checkWiringState_5();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_5);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_5.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("Import-Package", "x, y, z; bundle-symbolic-name=C");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Reexport-Package", "x, y");
- dictionary_2.put("Import-Package", "x; y; bundle-symbolic-name=C");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Export-Package", "z; uses:=\"x,y\"");
- dictionary_3.put("Reexport-Package", "x, y");
- dictionary_3.put("Import-Package", "x; y; bundle-symbolic-name=D");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "D");
- dictionary_4.put("Export-Package", "x; y; uses:=\"x,y\"");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_5(StateObjectFactory sof) {
- java.util.Dictionary dictionary_5 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_5.put("Bundle-ManifestVersion", "2");
- dictionary_5.put("Bundle-SymbolicName", "E");
- dictionary_5.put("Export-Package", "z; version=2.0");
- try {
- bundle = sof.createBundleDescription(dictionary_5, "bundle_5", 5);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_007.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_007.java
deleted file mode 100644
index e38fd43f1..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_007.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestGrouping_007 extends AbstractStateTest {
- public TestGrouping_007(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
- BundleDescription bundle_5 = null;
-
-
- public void testTest_003() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- bundle_5 = create_bundle_5(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- ExportPackageDescription[] exports = bundle_1.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", exp.getExporter(), bundle_2);
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", exp.getExporter(), bundle_2);
- } else if (exportPackageName.equals("z")) {
- assertNotNull("Package [z] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [z] is wired incorrectly ", exp.getExporter(), bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_2() {
- BundleDescription[] requires = bundle_2.getResolvedRequires();
- assertNotNull("requires array is unexpectedly null", requires);
- assertTrue("requires array is unexpectedly empty", requires.length > 0);
- for (int i = 0; i<requires.length; i++) {
- String requiresName = requires[i].getName();
- assertNotNull("package name is null", requiresName);
- if(requiresName.equals("C")) {
- assertNotNull("Require [C] is not wired when it should be ", requires[i]);
- assertEquals("Require [C] is wired incorrectly ", requires[i], bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- ExportPackageDescription[] exports = bundle_3.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", exp.getExporter(), bundle_4);
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", exp.getExporter(), bundle_4);
- }
- } // end for
- } // end method
-
- public void checkWiringState_4() {
- } // end method
-
- public void checkWiringState_5() {
- } // end method
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- checkWiringState_5();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_5);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_5.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("Import-Package", "x; y; bundle-symbolic-name=B, z; bundle-symbolic-name=C");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Require-Bundle", "C; reprovide=true");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Export-Package", "z; uses:=\"x,y\"");
- dictionary_3.put("Reexport-Package", "x; y");
- dictionary_3.put("Import-Package", "x; y; bundle-symbolic-name=D");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "D");
- dictionary_4.put("Export-Package", "x; y; uses:=\"x,y\"");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_5(StateObjectFactory sof) {
- java.util.Dictionary dictionary_5 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_5.put("Bundle-ManifestVersion", "2");
- dictionary_5.put("Bundle-SymbolicName", "E");
- dictionary_5.put("Export-Package", "z; version=2.0");
- try {
- bundle = sof.createBundleDescription(dictionary_5, "bundle_5", 5);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_009.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_009.java
deleted file mode 100644
index 3a275ea37..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestGrouping_009.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.osgi.framework.BundleException;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-
-
-public class TestGrouping_009 extends AbstractStateTest {
- public TestGrouping_009(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
-
-
- public void testTest_003() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- ExportPackageDescription[] exports = bundle_1.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", bundle_4, exp.getExporter());
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", bundle_4, exp.getExporter());
- } else if (exportPackageName.equals("p")) {
- assertNotNull("Package [p] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [p] is wired incorrectly ", bundle_2, exp.getExporter());
- }
- } // end for
- } // end method
-
- public void checkWiringState_2() {
- ExportPackageDescription[] exports = bundle_2.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("x")) {
- assertNotNull("Package [x] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [x] is wired incorrectly ", bundle_1, exp.getExporter());
- } else if (exportPackageName.equals("y")) {
- assertNotNull("Package [y] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [y] is wired incorrectly ", bundle_1, exp.getExporter());
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- } // end method
-
- public void checkWiringState_4() {
- } // end method
-
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("Import-Package", "p, x, y");
- dictionary_1.put("Reexport-Package", "x, y");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Export-Package", "p");
- dictionary_2.put("Import-Package", "x, y");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Export-Package", "y; version=2");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "D");
- dictionary_4.put("Export-Package", "x; y; uses:=\"x,y\"");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_002.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_002.java
deleted file mode 100644
index 5a632d764..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_002.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestPropagation_002 extends AbstractStateTest {
- public TestPropagation_002(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
-
-
- public void testTest_002() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- } // end method
-
- public void checkWiringState_2() {
- ExportPackageDescription[] exports = bundle_2.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("p")) {
- assertNotNull("Package [p] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [p] is wired incorrectly ", exp.getExporter(), bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- } // end method
-
- public void checkWiringState_4() {
- } // end method
-
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("Import-Package", "p, q");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Reexport-Package", "p");
- dictionary_2.put("Import-Package", "p; bundle-symbolic-name=C");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Export-Package", "p; q; uses:=\"p,q\"");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "D");
- dictionary_4.put("Export-Package", "q; version=2.0");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_004.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_004.java
deleted file mode 100644
index 6268a835d..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_004.java
+++ /dev/null
@@ -1,262 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestPropagation_004 extends AbstractStateTest {
- public TestPropagation_004(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
- BundleDescription bundle_5 = null;
- BundleDescription bundle_6 = null;
-
-
- public void testTest_002() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- bundle_5 = create_bundle_5(sof);
- bundle_6 = create_bundle_6(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- ExportPackageDescription[] exports = bundle_1.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("p")) {
- assertNotNull("Package [p] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [p] is wired incorrectly ", exp.getExporter(), bundle_2);
- } else if (exportPackageName.equals("q")) {
- assertNotNull("Package [q] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [q] is wired incorrectly ", exp.getExporter(), bundle_6);
- } else if (exportPackageName.equals("s")) {
- assertNotNull("Package [s] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [s] is wired incorrectly ", exp.getExporter(), bundle_2);
- }
- } // end for
- } // end method
-
- public void checkWiringState_2() {
- BundleDescription[] requires = bundle_2.getResolvedRequires();
- assertNotNull("requires array is unexpectedly null", requires);
- assertTrue("requires array is unexpectedly empty", requires.length > 0);
- for (int i = 0; i<requires.length; i++) {
- String requiresName = requires[i].getName();
- assertNotNull("package name is null", requiresName);
- if(requiresName.equals("C")) {
- assertNotNull("Require [C] is not wired when it should be ", requires[i]);
- assertEquals("Require [C] is wired incorrectly ", requires[i], bundle_3);
- } else if(requiresName.equals("D")) {
- assertNotNull("Require [D] is not wired when it should be ", requires[i]);
- assertEquals("Require [D] is wired incorrectly ", requires[i], bundle_4);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- ExportPackageDescription[] exports = bundle_3.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("q")) {
- assertNotNull("Package [q] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [q] is wired incorrectly ", exp.getExporter(), bundle_5);
- }
- } // end for
- } // end method
-
- public void checkWiringState_4() {
- ExportPackageDescription[] exports = bundle_4.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("q")) {
- assertNotNull("Package [q] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [q] is wired incorrectly ", exp.getExporter(), bundle_6);
- }
- } // end for
- } // end method
-
- public void checkWiringState_5() {
- } // end method
-
- public void checkWiringState_6() {
- } // end method
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- checkWiringState_5();
- checkWiringState_6();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_5);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_6);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_5.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_6.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("Import-Package", "p, q, s; bundle-symbolic-name=B");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Require-Bundle", "C, D; visibility:=reexport");
- dictionary_2.put("Export-Package", "p; uses:=s");
- //dictionary_2.put("Reexport-Package", "s; uses:=p");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Export-Package", "r; uses:=q");
- dictionary_3.put("Import-Package", "q; bundle-symbolic-name=E");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "D");
- dictionary_4.put("Export-Package", "s; uses:=q");
- dictionary_4.put("Import-Package", "q; bundle-symbolic-name=F");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_5(StateObjectFactory sof) {
- java.util.Dictionary dictionary_5 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_5.put("Bundle-ManifestVersion", "2");
- dictionary_5.put("Bundle-SymbolicName", "E");
- dictionary_5.put("Export-Package", "q");
- try {
- bundle = sof.createBundleDescription(dictionary_5, "bundle_5", 5);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_6(StateObjectFactory sof) {
- java.util.Dictionary dictionary_6 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_6.put("Bundle-ManifestVersion", "2");
- dictionary_6.put("Bundle-SymbolicName", "F");
- dictionary_6.put("Export-Package", "q");
- try {
- bundle = sof.createBundleDescription(dictionary_6, "bundle_6", 6);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_005.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_005.java
deleted file mode 100644
index 729f4fe1a..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestPropagation_005.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestPropagation_005 extends AbstractStateTest {
- public TestPropagation_005(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
-
-
- public void testTest_003() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- } // end method
-
- public void checkWiringState_2() {
- ExportPackageDescription[] exports = bundle_2.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("p")) {
- assertNotNull("Package [p] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [p] is wired incorrectly ", exp.getExporter(), bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- } // end method
-
- public void checkWiringState_4() {
- } // end method
-
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", !bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("Require-Bundle", "B, D");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Reexport-Package", "p");
- dictionary_2.put("Import-Package", "p; bundle-symbolic-name=C");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Export-Package", "p; q; uses:=\"p,q\"");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "D");
- dictionary_4.put("Export-Package", "q; version=2.0");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_008.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_008.java
deleted file mode 100644
index f06d16a0a..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestRFC79_008.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestRFC79_008 extends AbstractStateTest {
- public TestRFC79_008(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
-
-
- public void testTest_008() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- ExportPackageDescription[] exports = bundle_1.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if(exportPackageName.equals("p")) {
- assertNotNull("Package [p] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [p] is wired incorrectly ", exp.getExporter(), bundle_2);
- }
- } // end for
- } // end method
-
- public void checkWiringState_2() {
- BundleDescription[] requires = bundle_2.getResolvedRequires();
- assertNotNull("requires array is unexpectedly null", requires);
- assertTrue("requires array is unexpectedly empty", requires.length > 0);
- for (int i = 0; i<requires.length; i++) {
- String requiresName = requires[i].getName();
- assertNotNull("package name is null", requiresName);
- if(requiresName.equals("Y")) {
- assertNotNull("Require [Y] is not wired when it should be ", requires[i]);
- assertEquals("Require [Y] is wired incorrectly ", requires[i], bundle_3);
- } else if(requiresName.equals("Z")) {
- assertNotNull("Require [Z] is not wired when it should be ", requires[i]);
- assertEquals("Require [Z] is wired incorrectly ", requires[i], bundle_4);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- } // end method
-
- public void checkWiringState_4() {
- } // end method
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "Ci");
- dictionary_1.put("Import-Package", "p; foo=bar");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "X");
- dictionary_2.put("Reexport-Package", "p; foo=bar");
- dictionary_2.put("Require-Bundle", "Y, Z");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "Y");
- dictionary_3.put("Export-Package", "p");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "Z");
- dictionary_4.put("Export-Package", "p");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestReprovide_001.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestReprovide_001.java
deleted file mode 100644
index ee7a34690..000000000
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/resolver/TestReprovide_001.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.osgi.tests.resolver;
-
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.ExportPackageDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.osgi.service.resolver.StateObjectFactory;
-import org.eclipse.osgi.tests.services.resolver.AbstractStateTest;
-import org.osgi.framework.BundleException;
-
-
-public class TestReprovide_001 extends AbstractStateTest {
- public TestReprovide_001(String testName) {
- super(testName);
- }
-
- BundleDescription bundle_1 = null;
- BundleDescription bundle_2 = null;
- BundleDescription bundle_3 = null;
- BundleDescription bundle_4 = null;
-
-
- public void testTest_001() {
- State state = buildEmptyState();
- StateObjectFactory sof = platformAdmin.getFactory();
-
- bundle_1 = create_bundle_1(sof);
- bundle_2 = create_bundle_2(sof);
- bundle_3 = create_bundle_3(sof);
- bundle_4 = create_bundle_4(sof);
- //***************************************************
- // stage a
- // expect to pass =true
- //***************************************************
- addBundlesToState_a(state);
- //***************************************************
- try {
- state.resolve();
- } catch (Throwable t) {
- fail("unexpected exception class=" + t.getClass().getName()
- + " message=" + t.getMessage());
- return;
- }
- checkBundlesResolved_a();
- checkWiring_a();
- } // end of method
-
-
- public void checkWiringState_1() {
- ExportPackageDescription[] exports = bundle_1.getResolvedImports();
- assertNotNull("export array is unexpectedly null", exports);
- assertTrue("export array is unexpectedly empty", exports.length > 0);
- for (int i = 0; i < exports.length; i++) {
- ExportPackageDescription exp = exports[i];
- String exportPackageName = exp.getName();
- assertNotNull("package name is null", exportPackageName);
- if (exportPackageName.equals("p")) {
- assertNotNull("Package [p] is not wired when it should be ", exp.getExporter());
- assertEquals("Package [p] is wired incorrectly ", exp.getExporter(), bundle_2);
- }
- } // end for
- } // end method
-
- public void checkWiringState_2() {
- BundleDescription[] requires = bundle_2.getResolvedRequires();
- assertNotNull("requires array is unexpectedly null", requires);
- assertTrue("requires array is unexpectedly empty", requires.length > 0);
- for (int i = 0; i<requires.length; i++) {
- String requiresName = requires[i].getName();
- assertNotNull("package name is null", requiresName);
- if(requiresName.equals("C")) {
- assertNotNull("Require [C] is not wired when it should be ", requires[i]);
- assertEquals("Require [C] is wired incorrectly ", requires[i], bundle_3);
- }
- } // end for
- } // end method
-
- public void checkWiringState_3() {
- BundleDescription[] requires = bundle_3.getResolvedRequires();
- assertNotNull("requires array is unexpectedly null", requires);
- assertTrue("requires array is unexpectedly empty", requires.length > 0);
- for (int i = 0; i<requires.length; i++) {
- String requiresName = requires[i].getName();
- assertNotNull("package name is null", requiresName);
- if(requiresName.equals("D")) {
- assertNotNull("Require [D] is not wired when it should be ", requires[i]);
- assertEquals("Require [D] is wired incorrectly ", requires[i], bundle_4);
- }
- } // end for
- } // end method
-
- public void checkWiringState_4() {
- } // end method
-
-
- public void checkWiring_a() {
- checkWiringState_1();
- checkWiringState_2();
- checkWiringState_3();
- checkWiringState_4();
- } // end method
-
-
- public void addBundlesToState_a(State state) {
- boolean added = false;
- added = state.addBundle(bundle_1);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_2);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_3);
- assertTrue("failed to add bundle ", added);
- added = state.addBundle(bundle_4);
- assertTrue("failed to add bundle ", added);
- } // end method
-
-
- public void checkBundlesResolved_a() {
- assertTrue("unexpected bundle resolution state", bundle_1.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_2.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_3.isResolved());
- assertTrue("unexpected bundle resolution state", bundle_4.isResolved());
- } // end method
-
-
- public BundleDescription create_bundle_1(StateObjectFactory sof) {
- java.util.Dictionary dictionary_1 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_1.put("Bundle-ManifestVersion", "2");
- dictionary_1.put("Bundle-SymbolicName", "A");
- dictionary_1.put("Import-Package", "p; bundle-symbolic-name=B");
- try {
- bundle = sof.createBundleDescription(dictionary_1, "bundle_1", 1);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_2(StateObjectFactory sof) {
- java.util.Dictionary dictionary_2 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_2.put("Bundle-ManifestVersion", "2");
- dictionary_2.put("Bundle-SymbolicName", "B");
- dictionary_2.put("Require-Bundle", "C; reprovide=true");
- try {
- bundle = sof.createBundleDescription(dictionary_2, "bundle_2", 2);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_3(StateObjectFactory sof) {
- java.util.Dictionary dictionary_3 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_3.put("Bundle-ManifestVersion", "2");
- dictionary_3.put("Bundle-SymbolicName", "C");
- dictionary_3.put("Require-Bundle", "D; reprovide=true");
- try {
- bundle = sof.createBundleDescription(dictionary_3, "bundle_3", 3);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
- public BundleDescription create_bundle_4(StateObjectFactory sof) {
- java.util.Dictionary dictionary_4 = new java.util.Properties();
- BundleDescription bundle = null;
- dictionary_4.put("Bundle-ManifestVersion", "2");
- dictionary_4.put("Bundle-SymbolicName", "D");
- dictionary_4.put("Export-Package", "p");
- try {
- bundle = sof.createBundleDescription(dictionary_4, "bundle_4", 4);
- } catch (BundleException be) {
- fail(be.getMessage());
- }
- return bundle;
- } // end of method
-
-} // end of testcase
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AllTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AllTests.java
index 5246b03da..6c1181185 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AllTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/AllTests.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -24,6 +24,7 @@ public class AllTests extends TestCase {
public static Test suite() {
TestSuite suite = new TestSuite(AllTests.class.getName());
+ suite.addTest(SubstitutableExportsTest.suite());
suite.addTest(DisabledInfoTest.suite());
suite.addTest(PlatformAdminTest.suite());
suite.addTest(StateResolverTest.suite());
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/R4ResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/R4ResolverTest.java
index f0795dbe4..26d5a3e04 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/R4ResolverTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/R4ResolverTest.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2005 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,19 +10,15 @@
*******************************************************************************/
package org.eclipse.osgi.tests.services.resolver;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
+import junit.framework.*;
import org.eclipse.osgi.tests.resolver.*;
-
public class R4ResolverTest extends TestCase {
public R4ResolverTest(String testName) {
super(testName);
}
-
+
public static Test suite() {
TestSuite suite = new TestSuite(R4ResolverTest.class.getName());
suite.addTest(new TestSuite(TestAttributes_001.class));
@@ -39,25 +35,16 @@ public class R4ResolverTest extends TestCase {
suite.addTest(new TestSuite(TestDynamic_004.class));
suite.addTest(new TestSuite(TestDynamic_005.class));
suite.addTest(new TestSuite(TestDynamic_006.class));
- suite.addTest(new TestSuite(TestDynamic_007.class));
suite.addTest(new TestSuite(TestGenerated_001.class));
suite.addTest(new TestSuite(TestGrouping_001.class));
suite.addTest(new TestSuite(TestGrouping_002.class));
suite.addTest(new TestSuite(TestGrouping_003.class));
- suite.addTest(new TestSuite(TestGrouping_004.class));
- suite.addTest(new TestSuite(TestGrouping_005.class));
suite.addTest(new TestSuite(TestGrouping_006.class));
- suite.addTest(new TestSuite(TestGrouping_007.class));
suite.addTest(new TestSuite(TestGrouping_008.class));
- suite.addTest(new TestSuite(TestGrouping_009.class));
suite.addTest(new TestSuite(TestOptional_001.class));
suite.addTest(new TestSuite(TestOptional_002.class));
suite.addTest(new TestSuite(TestPropagation_001.class));
- suite.addTest(new TestSuite(TestPropagation_002.class));
suite.addTest(new TestSuite(TestPropagation_003.class));
- suite.addTest(new TestSuite(TestPropagation_004.class));
- suite.addTest(new TestSuite(TestPropagation_005.class));
- suite.addTest(new TestSuite(TestReprovide_001.class));
suite.addTest(new TestSuite(TestRFC79_001.class));
suite.addTest(new TestSuite(TestRFC79_002.class));
suite.addTest(new TestSuite(TestRFC79_003.class));
@@ -65,13 +52,10 @@ public class R4ResolverTest extends TestCase {
suite.addTest(new TestSuite(TestRFC79_005.class));
suite.addTest(new TestSuite(TestRFC79_006.class));
suite.addTest(new TestSuite(TestRFC79_007.class));
- suite.addTest(new TestSuite(TestRFC79_008.class));
suite.addTest(new TestSuite(TestVersion_001.class));
suite.addTest(new TestSuite(TestVersion_002.class));
suite.addTest(new TestSuite(TestVersion_003.class));
return suite;
}
-
-}
-
+}
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java
index 306a27bce..e5ea2f76b 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java
@@ -2497,59 +2497,6 @@ public class StateResolverTest extends AbstractStateTest {
assertEquals("1.4", a1, aFrag2.getHost().getSupplier());
}
- public void testReexportPackage() throws BundleException {
- State state = buildEmptyState();
- Hashtable manifest = new Hashtable();
- manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A1");
- manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
- manifest.put(Constants.EXPORT_PACKAGE, "a");
- manifest.put(Constants.REQUIRE_BUNDLE, "C1; visibility:=reexport");
- BundleDescription a1_100 = state.getFactory().createBundleDescription(state, manifest, "a1_100", 0);
-
- manifest = new Hashtable();
- manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B1");
- manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
- manifest.put(Constants.EXPORT_PACKAGE, "b");
- manifest.put(Constants.IMPORT_PACKAGE, "a; bundle-symbolic-name=C1, c; d; bundle-symbolic-name=A1");
- BundleDescription b1_100 = state.getFactory().createBundleDescription(state, manifest, "b1_100", 1);
-
- manifest = new Hashtable();
- manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C1");
- manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
- manifest.put(Constants.EXPORT_PACKAGE, "c");
- manifest.put(Constants.REQUIRE_BUNDLE, "A1; visibility:=reexport, D1; visibility:=reexport");
- BundleDescription c1_100 = state.getFactory().createBundleDescription(state, manifest, "c1_100", 2);
-
- manifest = new Hashtable();
- manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2");
- manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D1");
- manifest.put(Constants.BUNDLE_VERSION, "1.0.0");
- manifest.put(Constants.EXPORT_PACKAGE, "d");
- manifest.put(Constants.REQUIRE_BUNDLE, "A1; visibility:=reexport");
- BundleDescription d1_100 = state.getFactory().createBundleDescription(state, manifest, "d1_100", 3);
-
- state.addBundle(a1_100);
- state.addBundle(b1_100);
- state.addBundle(c1_100);
- state.addBundle(d1_100);
- state.resolve();
-
- assertTrue("0.1", a1_100.isResolved());
- assertTrue("0.2", b1_100.isResolved());
- assertTrue("0.3", c1_100.isResolved());
- assertTrue("0.4", d1_100.isResolved());
-
- // this assumes getResolvedImports will return the imports in the same order they are specified in the Import-Package header
- ExportPackageDescription[] b1ResolvedImports = b1_100.getResolvedImports();
- assertEquals("1.1", 3, b1ResolvedImports.length);
- assertEquals("1.2", b1ResolvedImports[0].getExporter(), c1_100);
- assertEquals("1.3", b1ResolvedImports[1].getExporter(), a1_100);
- assertEquals("1.4", b1ResolvedImports[2].getExporter(), a1_100);
- }
-
public void testPlatformProperties01() throws BundleException {
State state = buildEmptyState();
int bundleID = 0;
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java
new file mode 100644
index 000000000..7f287f2d9
--- /dev/null
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/SubstitutableExportsTest.java
@@ -0,0 +1,2671 @@
+/*******************************************************************************
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osgi.tests.services.resolver;
+
+import java.util.Hashtable;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import org.eclipse.osgi.service.resolver.*;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+
+public class SubstitutableExportsTest extends AbstractStateTest {
+ public static Test suite() {
+ return new TestSuite(SubstitutableExportsTest.class);
+ }
+
+ public SubstitutableExportsTest(String name) {
+ super(name);
+ }
+
+ private State getSubstituteBasicState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages
+ // D, E, F all requiring A, B, C respectively to access x, y packages
+ // all should get packages x and y from A
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(a);
+ state.addBundle(b);
+ state.addBundle(c);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ return state;
+ }
+
+ private State getSubstituteUsesState() throws BundleException {
+ // Same as basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause
+ // D, E, F all requiring A, B, C respectively to access x, y packages
+ // all should get packages x and y from A
+ // bundle G cannot resolve because of uses conflict with x package from Z
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; version=0.5; bundle=Z"); //$NON-NLS-1$
+ BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; bundle=Z"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(z);
+ state.addBundle(a);
+ state.addBundle(b);
+ state.addBundle(c);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ return state;
+ }
+
+ private State getSubstituteUsesCycleState() throws BundleException {
+ // Same as basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause + cycle
+ // D, E, F all requiring A, B, C respectively to access x, y packages
+ // all should get packages x and y from A and package z from G
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; z; version=0.5"); //$NON-NLS-1$
+ BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=1.0"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=1.0"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=1.0"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=x"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=x"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(z);
+ state.addBundle(a);
+ state.addBundle(b);
+ state.addBundle(c);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ state.addBundle(h);
+ return state;
+ }
+
+ private State getSubstituteBasicFragState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages
+ // Each have a fragment that exports and imports z package
+ // D, E, F all requiring A, B, C respectively to access x, y, z packages
+ // all should get packages x, y and z from A + fragment
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "AFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "BFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "B"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "CFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "C"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(a);
+ state.addBundle(aFrag);
+ state.addBundle(b);
+ state.addBundle(bFrag);
+ state.addBundle(c);
+ state.addBundle(cFrag);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ return state;
+ }
+
+ private State getSubstituteUsesFragState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause
+ // Each have a fragment that exports and imports z package
+ // D, E, F all requiring A, B, C respectively to access x, y, z packages
+ // all should get packages x, y and z from A + fragment
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; version=0.5; bundle=Z"); //$NON-NLS-1$
+ BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "AFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "BFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "B"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "CFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "C"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; bundle=Z"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(z);
+ state.addBundle(a);
+ state.addBundle(aFrag);
+ state.addBundle(b);
+ state.addBundle(bFrag);
+ state.addBundle(c);
+ state.addBundle(cFrag);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ return state;
+ }
+
+ private State getSubstituteUsesFragCycleState() throws BundleException {
+ // Same as basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause + cycle + frags
+ // D, E, F all requiring A, B, C respectively to access x, y packages
+ // all should get packages x and y from A and package z from G
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; z; version=2.0"); //$NON-NLS-1$
+ BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,q\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=\"[1.0,2.0)\", q"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "AFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,q\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=\"[1.0,2.0)\", q"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "BFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "B"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,q\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=\"[1.0,2.0)\", q"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "CFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "C"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "q; version=1.0; uses:=x"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "q; version=1.0"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "q; version=1.0; uses:=x"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "q; version=1.0"); //$NON-NLS-1$
+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "q; x; version=1.0"); //$NON-NLS-1$
+ BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(z);
+ state.addBundle(a);
+ state.addBundle(aFrag);
+ state.addBundle(b);
+ state.addBundle(bFrag);
+ state.addBundle(c);
+ state.addBundle(cFrag);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ state.addBundle(h);
+ state.addBundle(i);
+ return state;
+ }
+
+ private State getSubstituteBasicReexportState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages
+ // D, E, F all requiring A, B, C respectively to access x, y packages are reexporting
+ // G, H, I all requiring D, E, F repectively to access x, y packages
+ // all should get packages x and y from A
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$
+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$
+ BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(a);
+ state.addBundle(b);
+ state.addBundle(c);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ state.addBundle(h);
+ state.addBundle(i);
+ return state;
+ }
+
+ private State getSubstituteUsesReexportState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages + "uses" clause
+ // D, E, F all requiring A, B, C respectively to access x, y packages are reexporting
+ // G, H, I all requiring D, E, F repectively to access x, y packages
+ // all should get packages x and y from A
+ // J cannot resolve because of uses conflicy with package x from Z
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; version=0.5; bundle=Z"); //$NON-NLS-1$
+ BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$
+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$
+ BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "J"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; bundle=Z"); //$NON-NLS-1$
+ BundleDescription j = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(z);
+ state.addBundle(a);
+ state.addBundle(b);
+ state.addBundle(c);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ state.addBundle(h);
+ state.addBundle(i);
+ state.addBundle(j);
+ return state;
+ }
+
+ private State getSubstituteUsesReexportCycleState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages + uses clause + cycle
+ // D, E, F all requiring A, B, C respectively to access x, y packages are reexporting
+ // G, H, I all requiring D, E, F repectively to access x, y packages
+ // all should get packages x and y from A
+ // J cannot resolve because of uses conflicy with package x from Z
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Z"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; z; version=2.0"); //$NON-NLS-1$
+ BundleDescription z = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,z\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; z; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C; visibility:=reexport"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$
+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$
+ BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "J"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0; uses=\"x,y\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription j = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(z);
+ state.addBundle(a);
+ state.addBundle(b);
+ state.addBundle(c);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ state.addBundle(h);
+ state.addBundle(i);
+ state.addBundle(j);
+ return state;
+ }
+
+ private State getSubstituteUnresolvedFragState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages
+ // Each have a fragment that exports and imports z package and an extra unresolved import of q
+ // D, E, F all requiring A, B, C respectively to access x, y. z should not be accessible
+ // all should get packages x, y.
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "AFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "A"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; q; version=1.0"); //$NON-NLS-1$
+ BundleDescription aFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "BFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "B"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z; q; version=1.0"); //$NON-NLS-1$
+ BundleDescription bFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "CFrag"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.FRAGMENT_HOST, "C"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "z; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "z, q; version=1.0"); //$NON-NLS-1$
+ BundleDescription cFrag = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(a);
+ state.addBundle(aFrag);
+ state.addBundle(b);
+ state.addBundle(bFrag);
+ state.addBundle(c);
+ state.addBundle(cFrag);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ return state;
+ }
+
+ private State getSubstituteSplitState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages
+ // D, E, F all requiring A, B, C respectively to access x, y packages and export more content (split)
+ // all should get packages x and y from A
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split"); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split"); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split"); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$
+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$
+ BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "J"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$
+ BundleDescription j = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(a);
+ state.addBundle(b);
+ state.addBundle(c);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ state.addBundle(h);
+ state.addBundle(i);
+ state.addBundle(j);
+ return state;
+ }
+
+ private State getSubstituteSplitUsesState() throws BundleException {
+ // Basic substitutable export test with A, B, C all exporting and importing x,y packages + uses
+ // D, E, F all requiring A, B, C respectively to access x, y packages and add more content (split)
+ // all should get packages x and y from A
+ State state = buildEmptyState();
+ Hashtable manifest = new Hashtable();
+ long bundleID = 0;
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split; uses:=\"x,y,q\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split, q; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split; uses:=\"x,y,q\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split, q; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; split=split; mandatory:=split; uses:=\"x,y,q\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0; split=split, q; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,r\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0, r; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "A"); //$NON-NLS-1$
+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,r\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0, r; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "B"); //$NON-NLS-1$
+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "x; y; version=1.0; uses:=\"x,y,r\""); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0, r; version=\"[1.0,2.0)\""); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "C"); //$NON-NLS-1$
+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x; y; version=1.0"); //$NON-NLS-1$
+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "D"); //$NON-NLS-1$
+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "I"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "E"); //$NON-NLS-1$
+ BundleDescription i = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "J"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$
+ BundleDescription j = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "K"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "q; r; version=2.0"); //$NON-NLS-1$
+ BundleDescription k = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "L"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "q; r; version=1.0"); //$NON-NLS-1$
+ BundleDescription l = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "M"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "x, y, q, r"); //$NON-NLS-1$
+ BundleDescription m = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "N"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.IMPORT_PACKAGE, "q, r"); //$NON-NLS-1$
+ manifest.put(Constants.REQUIRE_BUNDLE, "F"); //$NON-NLS-1$
+ BundleDescription n = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), bundleID++);
+
+ state.addBundle(a);
+ state.addBundle(b);
+ state.addBundle(c);
+ state.addBundle(d);
+ state.addBundle(e);
+ state.addBundle(f);
+ state.addBundle(g);
+ state.addBundle(h);
+ state.addBundle(i);
+ state.addBundle(j);
+ state.addBundle(k);
+ state.addBundle(l);
+ state.addBundle(m);
+ state.addBundle(n);
+ return state;
+ }
+
+ public void testSubstitutableExports001() throws BundleException {
+ State state = getSubstituteBasicState();
+ state.resolve();
+ BundleDescription a = state.getBundle(0);
+ BundleDescription b = state.getBundle(1);
+ BundleDescription c = state.getBundle(2);
+ BundleDescription d = state.getBundle(3);
+ BundleDescription e = state.getBundle(4);
+ BundleDescription f = state.getBundle(5);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 2, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 2, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 2, fVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("aVisible not correct", aExports, a.getExportPackages()); //$NON-NLS-1$
+ assertEquals("bVisible not correct", aExports, bVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aExports, cVisible); //$NON-NLS-1$
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports002() throws BundleException {
+ State state = getSubstituteUsesState();
+ state.resolve();
+ BundleDescription a = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription c = state.getBundle(3);
+ BundleDescription d = state.getBundle(4);
+ BundleDescription e = state.getBundle(5);
+ BundleDescription f = state.getBundle(6);
+ BundleDescription g = state.getBundle(7);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertFalse("1.6", g.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 2, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 2, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 2, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 0, gVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("aVisible not correct", aExports, a.getExportPackages()); //$NON-NLS-1$
+ assertEquals("bVisible not correct", aExports, bVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aExports, cVisible); //$NON-NLS-1$
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports003() throws BundleException {
+ State state = getSubstituteUsesCycleState();
+ state.resolve();
+ BundleDescription a = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription c = state.getBundle(3);
+ BundleDescription d = state.getBundle(4);
+ BundleDescription e = state.getBundle(5);
+ BundleDescription f = state.getBundle(6);
+ BundleDescription g = state.getBundle(7);
+ BundleDescription h = state.getBundle(8);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertTrue("1.6", g.isResolved()); //$NON-NLS-1$
+ assertTrue("1.7", h.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+ ExportPackageDescription[] hVisible = state.getStateHelper().getVisiblePackages(h);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 1, aVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 3, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 3, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 3, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 3, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 3, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 2, gVisible.length); //$NON-NLS-1$
+ assertEquals("hVisible wrong number", 3, hVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExported = a.getSelectedExports();
+ ExportPackageDescription[] gExported = g.getSelectedExports();
+ ExportPackageDescription[] expected = new ExportPackageDescription[aExported.length + gExported.length];
+ System.arraycopy(aExported, 0, expected, 0, aExported.length);
+ System.arraycopy(gExported, 0, expected, aExported.length, gExported.length);
+ for (int i = 0; i < expected.length; i++) {
+ if (i == 2)
+ assertContains("aVisible not correct", aVisible, expected[i]); //$NON-NLS-1$
+ assertContains("bVisible not correct", bVisible, expected[i]); //$NON-NLS-1$
+ assertContains("cVisible not correct", cVisible, expected[i]); //$NON-NLS-1$
+ assertContains("dVisible not correct", dVisible, expected[i]); //$NON-NLS-1$
+ assertContains("eVisible not correct", eVisible, expected[i]); //$NON-NLS-1$
+ assertContains("fVisible not correct", fVisible, expected[i]); //$NON-NLS-1$
+ if (i == 0 || i == 1)
+ assertContains("gVisible not correct", gVisible, expected[i]); //$NON-NLS-1$
+ assertContains("hVisible not correct", hVisible, expected[i]); //$NON-NLS-1$
+ }
+ }
+
+ public void testSubstitutableExports004() throws BundleException {
+ State state = getSubstituteBasicFragState();
+ state.resolve();
+
+ BundleDescription a = state.getBundle(0);
+ BundleDescription aFrag = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription bFrag = state.getBundle(3);
+ BundleDescription c = state.getBundle(4);
+ BundleDescription cFrag = state.getBundle(5);
+ BundleDescription d = state.getBundle(6);
+ BundleDescription e = state.getBundle(7);
+ BundleDescription f = state.getBundle(8);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.0.1", aFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1.1", bFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2.1", cFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] aFragVisible = state.getStateHelper().getVisiblePackages(aFrag);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] bFragVisible = state.getStateHelper().getVisiblePackages(bFrag);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] cFragVisible = state.getStateHelper().getVisiblePackages(cFrag);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("aFragVisible is null", aFragVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("bFragVisible is null", bFragVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("cFragVisible is null", cFragVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("aFragVisible wrong number", 0, aFragVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("bFragVisible wrong number", 1, bFragVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("cFragVisible wrong number", 1, cFragVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 3, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 3, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 3, fVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("a has wrong number of exports", 3, aExports.length); //$NON-NLS-1$
+ ExportPackageDescription[] aDeclaredExports = a.getExportPackages();
+ ExportPackageDescription[] aFragExports = new ExportPackageDescription[] {aExports[2]};
+ assertEquals("bVisible not correct", aDeclaredExports, bVisible); //$NON-NLS-1$
+ assertEquals("bFragVisible not correct", aFragExports, bFragVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aDeclaredExports, cVisible); //$NON-NLS-1$
+ assertEquals("cFragVisible not correct", aFragExports, cFragVisible); //$NON-NLS-1$
+
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports005() throws BundleException {
+ State state = getSubstituteUsesFragState();
+ state.resolve();
+
+ // BundleDescription z = state.getBundle(0);
+ BundleDescription a = state.getBundle(1);
+ BundleDescription aFrag = state.getBundle(2);
+ BundleDescription b = state.getBundle(3);
+ BundleDescription bFrag = state.getBundle(4);
+ BundleDescription c = state.getBundle(5);
+ BundleDescription cFrag = state.getBundle(6);
+ BundleDescription d = state.getBundle(7);
+ BundleDescription e = state.getBundle(8);
+ BundleDescription f = state.getBundle(9);
+ BundleDescription g = state.getBundle(10);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.0.1", aFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1.1", bFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2.1", cFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertFalse("1.6", g.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] aFragVisible = state.getStateHelper().getVisiblePackages(aFrag);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] bFragVisible = state.getStateHelper().getVisiblePackages(bFrag);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] cFragVisible = state.getStateHelper().getVisiblePackages(cFrag);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("aFragVisible is null", aFragVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("bFragVisible is null", bFragVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("cFragVisible is null", cFragVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("aFragVisible wrong number", 0, aFragVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("bFragVisible wrong number", 1, bFragVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("cFragVisible wrong number", 1, cFragVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 3, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 3, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 3, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 0, gVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("a has wrong number of exports", 3, aExports.length); //$NON-NLS-1$
+ ExportPackageDescription[] aDeclaredExports = a.getExportPackages();
+ ExportPackageDescription[] aFragExports = new ExportPackageDescription[] {aExports[2]};
+ assertEquals("bVisible not correct", aDeclaredExports, bVisible); //$NON-NLS-1$
+ assertEquals("bFragVisible not correct", aFragExports, bFragVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aDeclaredExports, cVisible); //$NON-NLS-1$
+ assertEquals("cFragVisible not correct", aFragExports, cFragVisible); //$NON-NLS-1$
+
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports006() throws BundleException {
+ State state = getSubstituteUsesFragCycleState();
+ state.resolve();
+
+ // BundleDescription z = state.getBundle(0);
+ BundleDescription a = state.getBundle(1);
+ BundleDescription aFrag = state.getBundle(2);
+ BundleDescription b = state.getBundle(3);
+ BundleDescription bFrag = state.getBundle(4);
+ BundleDescription c = state.getBundle(5);
+ BundleDescription cFrag = state.getBundle(6);
+ BundleDescription d = state.getBundle(7);
+ BundleDescription e = state.getBundle(8);
+ BundleDescription f = state.getBundle(9);
+ BundleDescription g = state.getBundle(10);
+ BundleDescription h = state.getBundle(11);
+ BundleDescription i = state.getBundle(12);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.0.1", aFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1.1", bFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2.1", cFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertTrue("1.6", g.isResolved()); //$NON-NLS-1$
+ assertTrue("1.7", h.isResolved()); //$NON-NLS-1$
+ assertTrue("1.7", i.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] aFragVisible = state.getStateHelper().getVisiblePackages(aFrag);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] bFragVisible = state.getStateHelper().getVisiblePackages(bFrag);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] cFragVisible = state.getStateHelper().getVisiblePackages(cFrag);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+ ExportPackageDescription[] hVisible = state.getStateHelper().getVisiblePackages(h);
+ ExportPackageDescription[] iVisible = state.getStateHelper().getVisiblePackages(i);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("aFragVisible is null", aFragVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("bFragVisible is null", bFragVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("cFragVisible is null", cFragVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", hVisible); //$NON-NLS-1$
+ assertNotNull("iVisible is null", iVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 1, aVisible.length); //$NON-NLS-1$
+ assertEquals("aFragVisible wrong number", 0, aFragVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 3, bVisible.length); //$NON-NLS-1$
+ assertEquals("bFragVisible wrong number", 1, bFragVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 3, cVisible.length); //$NON-NLS-1$
+ assertEquals("cFragVisible wrong number", 1, cFragVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 3, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 3, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 3, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 3, gVisible.length); //$NON-NLS-1$
+ assertEquals("hVisible wrong number", 4, hVisible.length); //$NON-NLS-1$
+ assertEquals("iVisible wrong number", 4, iVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+
+ assertEquals("a has wrong number of exports", 3, aExports.length); //$NON-NLS-1$
+ ExportPackageDescription[] aDeclaredExports = a.getExportPackages();
+ ExportPackageDescription[] bcExpectedVisible = new ExportPackageDescription[aDeclaredExports.length + 1];
+ System.arraycopy(aDeclaredExports, 0, bcExpectedVisible, 0, aDeclaredExports.length);
+ bcExpectedVisible[2] = g.getSelectedExports()[0];
+ ExportPackageDescription[] aFragExports = new ExportPackageDescription[] {aExports[2]};
+ assertEquals("aVisible not correct", g.getSelectedExports(), aVisible); //$NON-NLS-1$
+ assertEquals("bVisible not correct", bcExpectedVisible, bVisible); //$NON-NLS-1$
+ assertEquals("bFragVisible not correct", aFragExports, bFragVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", bcExpectedVisible, cVisible); //$NON-NLS-1$
+ assertEquals("cFragVisible not correct", aFragExports, cFragVisible); //$NON-NLS-1$
+
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+
+ ExportPackageDescription[] gExports = g.getSelectedExports();
+ assertEquals("g has wrong number of exports", 1, gExports.length); //$NON-NLS-1$
+ ExportPackageDescription[] expectedHIVisible = new ExportPackageDescription[] {gExports[0], aExports[0], aExports[1], aExports[2]};
+ assertEquals("gVisible not correct", aExports, gVisible); //$NON-NLS-1$
+ assertEquals("hVisible not correct", expectedHIVisible, hVisible); //$NON-NLS-1$
+ assertEquals("iVisible not correct", expectedHIVisible, iVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports007() throws BundleException {
+ State state = getSubstituteBasicReexportState();
+ state.resolve();
+
+ BundleDescription a = state.getBundle(0);
+ BundleDescription b = state.getBundle(1);
+ BundleDescription c = state.getBundle(2);
+ BundleDescription d = state.getBundle(3);
+ BundleDescription e = state.getBundle(4);
+ BundleDescription f = state.getBundle(5);
+ BundleDescription g = state.getBundle(5);
+ BundleDescription h = state.getBundle(5);
+ BundleDescription i = state.getBundle(5);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", g.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", h.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", i.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+ ExportPackageDescription[] hVisible = state.getStateHelper().getVisiblePackages(h);
+ ExportPackageDescription[] iVisible = state.getStateHelper().getVisiblePackages(i);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+ assertNotNull("hVisible is null", hVisible); //$NON-NLS-1$
+ assertNotNull("iVisible is null", iVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 2, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 2, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 2, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 2, gVisible.length); //$NON-NLS-1$
+ assertEquals("hVisible wrong number", 2, hVisible.length); //$NON-NLS-1$
+ assertEquals("iVisible wrong number", 2, iVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("bVisible not correct", aExports, bVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aExports, cVisible); //$NON-NLS-1$
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ assertEquals("gVisible not correct", aExports, gVisible); //$NON-NLS-1$
+ assertEquals("hVisible not correct", aExports, hVisible); //$NON-NLS-1$
+ assertEquals("iVisible not correct", aExports, iVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports008() throws BundleException {
+ State state = getSubstituteUsesReexportState();
+ state.resolve();
+
+ BundleDescription a = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription c = state.getBundle(3);
+ BundleDescription d = state.getBundle(4);
+ BundleDescription e = state.getBundle(5);
+ BundleDescription f = state.getBundle(6);
+ BundleDescription g = state.getBundle(7);
+ BundleDescription h = state.getBundle(8);
+ BundleDescription i = state.getBundle(9);
+ BundleDescription j = state.getBundle(10);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertTrue("1.6", g.isResolved()); //$NON-NLS-1$
+ assertTrue("1.7", h.isResolved()); //$NON-NLS-1$
+ assertTrue("1.8", i.isResolved()); //$NON-NLS-1$
+ assertFalse("1.9", j.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+ ExportPackageDescription[] hVisible = state.getStateHelper().getVisiblePackages(h);
+ ExportPackageDescription[] iVisible = state.getStateHelper().getVisiblePackages(i);
+ ExportPackageDescription[] jVisible = state.getStateHelper().getVisiblePackages(j);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+ assertNotNull("hVisible is null", hVisible); //$NON-NLS-1$
+ assertNotNull("iVisible is null", iVisible); //$NON-NLS-1$
+ assertNotNull("jVisible is null", jVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 2, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 2, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 2, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 2, gVisible.length); //$NON-NLS-1$
+ assertEquals("hVisible wrong number", 2, hVisible.length); //$NON-NLS-1$
+ assertEquals("iVisible wrong number", 2, iVisible.length); //$NON-NLS-1$
+ assertEquals("jVisible wrong number", 0, jVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("bVisible not correct", aExports, bVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aExports, cVisible); //$NON-NLS-1$
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ assertEquals("gVisible not correct", aExports, gVisible); //$NON-NLS-1$
+ assertEquals("hVisible not correct", aExports, hVisible); //$NON-NLS-1$
+ assertEquals("iVisible not correct", aExports, iVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports009() throws BundleException {
+ State state = getSubstituteUsesReexportCycleState();
+ state.resolve();
+ BundleDescription a = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription c = state.getBundle(3);
+ BundleDescription d = state.getBundle(4);
+ BundleDescription e = state.getBundle(5);
+ BundleDescription f = state.getBundle(6);
+ BundleDescription g = state.getBundle(7);
+ BundleDescription h = state.getBundle(8);
+ BundleDescription i = state.getBundle(9);
+ BundleDescription j = state.getBundle(10);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertTrue("1.6", g.isResolved()); //$NON-NLS-1$
+ assertTrue("1.7", h.isResolved()); //$NON-NLS-1$
+ assertTrue("1.8", i.isResolved()); //$NON-NLS-1$
+ assertTrue("1.9", j.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+ ExportPackageDescription[] hVisible = state.getStateHelper().getVisiblePackages(h);
+ ExportPackageDescription[] iVisible = state.getStateHelper().getVisiblePackages(i);
+ ExportPackageDescription[] jVisible = state.getStateHelper().getVisiblePackages(j);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+ assertNotNull("hVisible is null", hVisible); //$NON-NLS-1$
+ assertNotNull("iVisible is null", iVisible); //$NON-NLS-1$
+ assertNotNull("jVisible is null", jVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 1, aVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 3, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 3, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 2, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 2, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 2, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 2, gVisible.length); //$NON-NLS-1$
+ assertEquals("hVisible wrong number", 2, hVisible.length); //$NON-NLS-1$
+ assertEquals("iVisible wrong number", 2, iVisible.length); //$NON-NLS-1$
+ assertEquals("jVisible wrong number", 2, jVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("aExports count wrong", 2, aExports.length); //$NON-NLS-1$
+ ExportPackageDescription[] jExports = j.getSelectedExports();
+ assertEquals("aExports count wrong", 1, jExports.length); //$NON-NLS-1$
+ ExportPackageDescription[] bcExpected = new ExportPackageDescription[] {aExports[0], aExports[1], jExports[0]};
+ assertEquals("aVisible not correct", jExports, aVisible); //$NON-NLS-1$
+ assertEquals("bVisible not correct", bcExpected, bVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", bcExpected, cVisible); //$NON-NLS-1$
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ assertEquals("gVisible not correct", aExports, gVisible); //$NON-NLS-1$
+ assertEquals("hVisible not correct", aExports, hVisible); //$NON-NLS-1$
+ assertEquals("iVisible not correct", aExports, iVisible); //$NON-NLS-1$
+ assertEquals("jVisible not correct", aExports, jVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports010() throws BundleException {
+ State state = getSubstituteBasicState();
+ state.resolve();
+ BundleDescription a = state.getBundle(0);
+ BundleDescription b = state.getBundle(1);
+ BundleDescription c = state.getBundle(2);
+ BundleDescription d = state.getBundle(3);
+ BundleDescription e = state.getBundle(4);
+ BundleDescription f = state.getBundle(5);
+
+ BundleDescription[] allBundles = new BundleDescription[] {a, b, c, d, e, f};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 6, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int i = 0; i < allBundles.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < bundleDeltas.length && !found; j++) {
+ assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$
+ found = bundleDeltas[j].getBundle() == allBundles[i];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allBundles[i]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {f});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports011() throws BundleException {
+ State state = getSubstituteUsesState();
+ state.resolve();
+ BundleDescription z = state.getBundle(0);
+ BundleDescription a = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription c = state.getBundle(3);
+ BundleDescription d = state.getBundle(4);
+ BundleDescription e = state.getBundle(5);
+ BundleDescription f = state.getBundle(6);
+
+ BundleDescription[] allRefreshBundles = new BundleDescription[] {a, b, c, d, e, f};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 6, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int i = 0; i < allRefreshBundles.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < bundleDeltas.length && !found; j++) {
+ assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$
+ found = bundleDeltas[j].getBundle() == allRefreshBundles[i];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[i]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {f});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+
+ stateDelta = state.resolve(new BundleDescription[] {z});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports012() throws BundleException {
+ State state = getSubstituteUsesCycleState();
+ state.resolve();
+ BundleDescription a = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription c = state.getBundle(3);
+ BundleDescription d = state.getBundle(4);
+ BundleDescription e = state.getBundle(5);
+ BundleDescription f = state.getBundle(6);
+ BundleDescription g = state.getBundle(7);
+ BundleDescription h = state.getBundle(8);
+
+ BundleDescription[] allRefreshBundles = new BundleDescription[] {a, b, c, d, e, f, g, h};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 8, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int i = 0; i < allRefreshBundles.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < bundleDeltas.length && !found; j++) {
+ assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$
+ found = bundleDeltas[j].getBundle() == allRefreshBundles[i];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[i]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {f});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+
+ stateDelta = state.resolve(new BundleDescription[] {c});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 8, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int i = 0; i < allRefreshBundles.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < bundleDeltas.length && !found; j++) {
+ assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$
+ found = bundleDeltas[j].getBundle() == allRefreshBundles[i];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[i]); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public void testSubstitutableExports013() throws BundleException {
+ State state = getSubstituteBasicFragState();
+ state.resolve();
+
+ BundleDescription a = state.getBundle(0);
+ BundleDescription aFrag = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription bFrag = state.getBundle(3);
+ BundleDescription c = state.getBundle(4);
+ BundleDescription cFrag = state.getBundle(5);
+ BundleDescription d = state.getBundle(6);
+ BundleDescription e = state.getBundle(7);
+ BundleDescription f = state.getBundle(8);
+
+ BundleDescription[] allBundles = new BundleDescription[] {a, aFrag, b, bFrag, c, cFrag, d, e, f};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 9, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int i = 0; i < allBundles.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < bundleDeltas.length && !found; j++) {
+ assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$
+ found = bundleDeltas[j].getBundle() == allBundles[i];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allBundles[i]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {f});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+
+ stateDelta = state.resolve(new BundleDescription[] {c});
+ bundleDeltas = stateDelta.getChanges();
+ BundleDescription[] expectedRefresh = new BundleDescription[] {c, cFrag, f};
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 3, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int i = 0; i < expectedRefresh.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < bundleDeltas.length && !found; j++) {
+ assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$
+ found = bundleDeltas[j].getBundle() == expectedRefresh[i];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + expectedRefresh[i]); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public void testSubstitutableExports014() throws BundleException {
+ State state = getSubstituteUsesFragState();
+ state.resolve();
+
+ BundleDescription z = state.getBundle(0);
+ BundleDescription a = state.getBundle(1);
+ BundleDescription aFrag = state.getBundle(2);
+ BundleDescription b = state.getBundle(3);
+ BundleDescription bFrag = state.getBundle(4);
+ BundleDescription c = state.getBundle(5);
+ BundleDescription cFrag = state.getBundle(6);
+ BundleDescription d = state.getBundle(7);
+ BundleDescription e = state.getBundle(8);
+ BundleDescription f = state.getBundle(9);
+ //BundleDescription g = state.getBundle(10);
+
+ BundleDescription[] allRefreshBundles = new BundleDescription[] {a, aFrag, b, bFrag, c, cFrag, d, e, f};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int i = 0; i < allRefreshBundles.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < bundleDeltas.length && !found; j++) {
+ assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$
+ found = bundleDeltas[j].getBundle() == allRefreshBundles[i];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[i]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {f});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+
+ stateDelta = state.resolve(new BundleDescription[] {z});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+
+ stateDelta = state.resolve(new BundleDescription[] {c});
+ bundleDeltas = stateDelta.getChanges();
+ BundleDescription[] expectedRefresh = new BundleDescription[] {c, cFrag, f};
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 3, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int i = 0; i < expectedRefresh.length; i++) {
+ boolean found = false;
+ for (int j = 0; j < bundleDeltas.length && !found; j++) {
+ assertEquals("unexpected delta type " + bundleDeltas[j], BundleDelta.RESOLVED, bundleDeltas[j].getType()); //$NON-NLS-1$
+ found = bundleDeltas[j].getBundle() == expectedRefresh[i];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + expectedRefresh[i]); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public void testSubstitutableExports015() throws BundleException {
+ State state = getSubstituteUsesFragCycleState();
+ state.resolve();
+ // BundleDescription z = state.getBundle(0);
+ BundleDescription a = state.getBundle(1);
+ BundleDescription aFrag = state.getBundle(2);
+ BundleDescription b = state.getBundle(3);
+ BundleDescription bFrag = state.getBundle(4);
+ BundleDescription c = state.getBundle(5);
+ BundleDescription cFrag = state.getBundle(6);
+ BundleDescription d = state.getBundle(7);
+ BundleDescription e = state.getBundle(8);
+ BundleDescription f = state.getBundle(9);
+ BundleDescription g = state.getBundle(10);
+ BundleDescription h = state.getBundle(11);
+ BundleDescription i = state.getBundle(12);
+
+ BundleDescription[] allRefreshBundles = new BundleDescription[] {a, aFrag, b, bFrag, c, cFrag, d, e, f, g, h, i};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int j = 0; j < allRefreshBundles.length; j++) {
+ boolean found = false;
+ for (int k = 0; k < bundleDeltas.length && !found; k++) {
+ assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, bundleDeltas[k].getType()); //$NON-NLS-1$
+ found = bundleDeltas[k].getBundle() == allRefreshBundles[j];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[j]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {f});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+
+ stateDelta = state.resolve(new BundleDescription[] {c});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int j = 0; j < allRefreshBundles.length; j++) {
+ boolean found = false;
+ for (int k = 0; k < bundleDeltas.length && !found; k++) {
+ assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, bundleDeltas[k].getType()); //$NON-NLS-1$
+ found = bundleDeltas[k].getBundle() == allRefreshBundles[j];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[j]); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public void testSubstitutableExports016() throws BundleException {
+ State state = getSubstituteBasicReexportState();
+ state.resolve();
+ BundleDescription a = state.getBundle(0);
+ BundleDescription b = state.getBundle(1);
+ BundleDescription c = state.getBundle(2);
+ BundleDescription d = state.getBundle(3);
+ BundleDescription e = state.getBundle(4);
+ BundleDescription f = state.getBundle(5);
+ BundleDescription g = state.getBundle(6);
+ BundleDescription h = state.getBundle(7);
+ BundleDescription i = state.getBundle(8);
+
+ BundleDescription[] allBundles = new BundleDescription[] {a, b, c, d, e, f, g, h, i};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", allBundles.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int j = 0; j < allBundles.length; j++) {
+ boolean found = false;
+ for (int k = 0; k < bundleDeltas.length && !found; k++) {
+ assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, bundleDeltas[k].getType()); //$NON-NLS-1$
+ found = bundleDeltas[k].getBundle() == allBundles[j];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allBundles[j]); //$NON-NLS-1$
+ }
+ }
+
+ stateDelta = state.resolve(new BundleDescription[] {f});
+ bundleDeltas = stateDelta.getChanges();
+ BundleDescription[] expectedRefresh = new BundleDescription[] {f, i};
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", expectedRefresh.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int j = 0; j < expectedRefresh.length; j++) {
+ boolean found = false;
+ for (int k = 0; k < bundleDeltas.length && !found; k++) {
+ assertEquals("unexpected delta type " + bundleDeltas[k], BundleDelta.RESOLVED, bundleDeltas[k].getType()); //$NON-NLS-1$
+ found = bundleDeltas[k].getBundle() == expectedRefresh[j];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + expectedRefresh[j]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {i});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports017() throws BundleException {
+ State state = getSubstituteUsesReexportState();
+ state.resolve();
+ BundleDescription z = state.getBundle(0);
+ BundleDescription a = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription c = state.getBundle(3);
+ BundleDescription d = state.getBundle(4);
+ BundleDescription e = state.getBundle(5);
+ BundleDescription f = state.getBundle(6);
+ BundleDescription g = state.getBundle(7);
+ BundleDescription h = state.getBundle(8);
+ BundleDescription i = state.getBundle(9);
+ //BundleDescription j = state.getBundle(10);
+
+ BundleDescription[] allRefreshBundles = new BundleDescription[] {a, b, c, d, e, f, g, h, i};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int l = 0; l < allRefreshBundles.length; l++) {
+ boolean found = false;
+ for (int m = 0; m < bundleDeltas.length && !found; m++) {
+ assertEquals("unexpected delta type " + bundleDeltas[m], BundleDelta.RESOLVED, bundleDeltas[m].getType()); //$NON-NLS-1$
+ found = bundleDeltas[m].getBundle() == allRefreshBundles[l];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[l]); //$NON-NLS-1$
+ }
+ }
+
+ stateDelta = state.resolve(new BundleDescription[] {f});
+ bundleDeltas = stateDelta.getChanges();
+ BundleDescription[] expectedRefresh = new BundleDescription[] {f, i};
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", expectedRefresh.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int l = 0; l < expectedRefresh.length; l++) {
+ boolean found = false;
+ for (int m = 0; m < bundleDeltas.length && !found; m++) {
+ assertEquals("unexpected delta type " + bundleDeltas[m], BundleDelta.RESOLVED, bundleDeltas[m].getType()); //$NON-NLS-1$
+ found = bundleDeltas[m].getBundle() == expectedRefresh[l];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + expectedRefresh[l]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {i});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+
+ stateDelta = state.resolve(new BundleDescription[] {z});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports018() throws BundleException {
+ State state = getSubstituteUsesReexportCycleState();
+ state.resolve();
+ BundleDescription a = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription c = state.getBundle(3);
+ BundleDescription d = state.getBundle(4);
+ BundleDescription e = state.getBundle(5);
+ BundleDescription f = state.getBundle(6);
+ BundleDescription g = state.getBundle(7);
+ BundleDescription h = state.getBundle(8);
+ BundleDescription i = state.getBundle(9);
+ BundleDescription j = state.getBundle(10);
+
+ BundleDescription[] allRefreshBundles = new BundleDescription[] {a, b, c, d, e, f, g, h, i, j};
+ StateDelta stateDelta = state.resolve(new BundleDescription[] {a});
+ BundleDelta[] bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int k = 0; k < allRefreshBundles.length; k++) {
+ boolean found = false;
+ for (int l = 0; l < bundleDeltas.length && !found; l++) {
+ assertEquals("unexpected delta type " + bundleDeltas[l], BundleDelta.RESOLVED, bundleDeltas[l].getType()); //$NON-NLS-1$
+ found = bundleDeltas[l].getBundle() == allRefreshBundles[k];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[k]); //$NON-NLS-1$
+ }
+ }
+ stateDelta = state.resolve(new BundleDescription[] {i});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", 1, bundleDeltas.length); //$NON-NLS-1$
+
+ stateDelta = state.resolve(new BundleDescription[] {c});
+ bundleDeltas = stateDelta.getChanges();
+ assertNotNull("bundleDeltas is null", bundleDeltas); //$NON-NLS-1$
+ assertEquals("bunldeDeltas wrong number", allRefreshBundles.length, bundleDeltas.length); //$NON-NLS-1$
+
+ for (int k = 0; k < allRefreshBundles.length; k++) {
+ boolean found = false;
+ for (int l = 0; l < bundleDeltas.length && !found; l++) {
+ assertEquals("unexpected delta type " + bundleDeltas[l], BundleDelta.RESOLVED, bundleDeltas[l].getType()); //$NON-NLS-1$
+ found = bundleDeltas[l].getBundle() == allRefreshBundles[k];
+ }
+ if (!found) {
+ fail("Did not find RESOLVED BundleDelta for " + allRefreshBundles[k]); //$NON-NLS-1$
+ }
+ }
+ }
+
+ public void testSubstitutableExports019() throws BundleException {
+ State state = getSubstituteUnresolvedFragState();
+ state.resolve();
+
+ BundleDescription a = state.getBundle(0);
+ BundleDescription aFrag = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription bFrag = state.getBundle(3);
+ BundleDescription c = state.getBundle(4);
+ BundleDescription cFrag = state.getBundle(5);
+ BundleDescription d = state.getBundle(6);
+ BundleDescription e = state.getBundle(7);
+ BundleDescription f = state.getBundle(8);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertFalse("1.0.1", aFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertFalse("1.1.1", bFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertFalse("1.2.1", cFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] aFragVisible = state.getStateHelper().getVisiblePackages(aFrag);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] bFragVisible = state.getStateHelper().getVisiblePackages(bFrag);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] cFragVisible = state.getStateHelper().getVisiblePackages(cFrag);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("aFragVisible is null", aFragVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("bFragVisible is null", bFragVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("cFragVisible is null", cFragVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("aFragVisible wrong number", 0, aFragVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("bFragVisible wrong number", 0, bFragVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("cFragVisible wrong number", 0, cFragVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 2, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 2, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 2, fVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("a has wrong number of exports", 2, aExports.length); //$NON-NLS-1$
+
+ assertEquals("bVisible not correct", aExports, bVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aExports, cVisible); //$NON-NLS-1$
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports020() throws BundleException {
+ State state = getSubstituteUnresolvedFragState();
+ state.resolve();
+
+ BundleDescription a = state.getBundle(0);
+ BundleDescription aFrag = state.getBundle(1);
+ BundleDescription b = state.getBundle(2);
+ BundleDescription bFrag = state.getBundle(3);
+ BundleDescription c = state.getBundle(4);
+ BundleDescription cFrag = state.getBundle(5);
+ BundleDescription d = state.getBundle(6);
+ BundleDescription e = state.getBundle(7);
+ BundleDescription f = state.getBundle(8);
+
+ // add a bundle to resolve the fragments import of q
+ Hashtable manifest = new Hashtable();
+ manifest.clear();
+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "Q"); //$NON-NLS-1$
+ manifest.put(Constants.BUNDLE_VERSION, "1.0.0"); //$NON-NLS-1$
+ manifest.put(Constants.EXPORT_PACKAGE, "q; version=1.0"); //$NON-NLS-1$
+ BundleDescription q = state.getFactory().createBundleDescription(state, manifest, (String) manifest.get(Constants.BUNDLE_SYMBOLICNAME) + (String) manifest.get(Constants.BUNDLE_VERSION), f.getBundleId() + 1);
+ state.addBundle(q);
+ state.resolve(new BundleDescription[] {a});
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.0.1", aFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1.1", bFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2.1", cFrag.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] aFragVisible = state.getStateHelper().getVisiblePackages(aFrag);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] bFragVisible = state.getStateHelper().getVisiblePackages(bFrag);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] cFragVisible = state.getStateHelper().getVisiblePackages(cFrag);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("aFragVisible is null", aFragVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("bFragVisible is null", bFragVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("cFragVisible is null", cFragVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("aFragVisible wrong number", 1, aFragVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("bFragVisible wrong number", 2, bFragVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("cFragVisible wrong number", 2, cFragVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 3, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 3, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 3, fVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("a has wrong number of exports", 3, aExports.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aDeclaredExports = a.getExportPackages();
+ ExportPackageDescription[] aFragExpected = new ExportPackageDescription[] {aExports[2], q.getExportPackages()[0]};
+ assertEquals("aFragVisible not correct", q.getSelectedExports(), aFragVisible); //$NON-NLS-1$
+ assertEquals("bVisible not correct", aDeclaredExports, bVisible); //$NON-NLS-1$
+ assertEquals("bFragVisible not correct", aFragExpected, bFragVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aDeclaredExports, cVisible); //$NON-NLS-1$
+ assertEquals("cFragVisible not correct", aFragExpected, cFragVisible); //$NON-NLS-1$
+
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", aExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", aExports, fVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports021() throws BundleException {
+ State state = getSubstituteBasicState();
+ state.resolve();
+ BundleDescription a = state.getBundle(0);
+ BundleDescription b = state.getBundle(1);
+ BundleDescription c = state.getBundle(2);
+ BundleDescription d = state.getBundle(3);
+ BundleDescription e = state.getBundle(4);
+ BundleDescription f = state.getBundle(5);
+
+ state.removeBundle(a);
+ state.resolve(new BundleDescription[] {a});
+ assertFalse("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertFalse("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+
+ assertEquals("bVisible wrong number", 0, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 0, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 2, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 2, fVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] bExports = b.getSelectedExports();
+ assertEquals("cVisible not correct", bExports, cVisible); //$NON-NLS-1$
+ assertEquals("eVisible not correct", bExports, eVisible); //$NON-NLS-1$
+ assertEquals("fVisible not correct", bExports, fVisible); //$NON-NLS-1$
+ }
+
+ public void testSubstitutableExports022() throws BundleException {
+ State state = getSubstituteSplitState();
+ state.resolve();
+ BundleDescription a = state.getBundle(0);
+ BundleDescription b = state.getBundle(1);
+ BundleDescription c = state.getBundle(2);
+ BundleDescription d = state.getBundle(3);
+ BundleDescription e = state.getBundle(4);
+ BundleDescription f = state.getBundle(5);
+ BundleDescription g = state.getBundle(6);
+ BundleDescription h = state.getBundle(7);
+ BundleDescription i = state.getBundle(8);
+ BundleDescription j = state.getBundle(9);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertTrue("1.6", g.isResolved()); //$NON-NLS-1$
+ assertTrue("1.7", h.isResolved()); //$NON-NLS-1$
+ assertTrue("1.8", i.isResolved()); //$NON-NLS-1$
+ assertTrue("1.9", j.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+ ExportPackageDescription[] hVisible = state.getStateHelper().getVisiblePackages(h);
+ ExportPackageDescription[] iVisible = state.getStateHelper().getVisiblePackages(i);
+ ExportPackageDescription[] jVisible = state.getStateHelper().getVisiblePackages(j);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+ assertNotNull("hVisible is null", hVisible); //$NON-NLS-1$
+ assertNotNull("iVisible is null", iVisible); //$NON-NLS-1$
+ assertNotNull("jVisible is null", jVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 0, aVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 2, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 2, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 2, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 4, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 4, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 4, gVisible.length); //$NON-NLS-1$
+ assertEquals("hVisible wrong number", 4, hVisible.length); //$NON-NLS-1$
+ assertEquals("iVisible wrong number", 4, iVisible.length); //$NON-NLS-1$
+ assertEquals("jVisible wrong number", 4, jVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("aVisible not correct", aExports, a.getExportPackages()); //$NON-NLS-1$
+ assertEquals("bVisible not correct", aExports, bVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", aExports, cVisible); //$NON-NLS-1$
+ assertEquals("dVisible not correct", aExports, dVisible); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExported = a.getSelectedExports();
+ ExportPackageDescription[] dExported = d.getSelectedExports();
+ ExportPackageDescription[] expected = new ExportPackageDescription[aExported.length + dExported.length];
+ System.arraycopy(aExported, 0, expected, 0, aExported.length);
+ System.arraycopy(dExported, 0, expected, aExported.length, dExported.length);
+ for (int index = 0; index < expected.length; index++) {
+ assertContains("eVisible not correct", eVisible, expected[index]); //$NON-NLS-1$
+ assertContains("fVisible not correct", fVisible, expected[index]); //$NON-NLS-1$
+ assertContains("gVisible not correct", gVisible, expected[index]); //$NON-NLS-1$
+ assertContains("hVisible not correct", hVisible, expected[index]); //$NON-NLS-1$
+ assertContains("iVisible not correct", iVisible, expected[index]); //$NON-NLS-1$
+ assertContains("jVisible not correct", jVisible, expected[index]); //$NON-NLS-1$
+ }
+ }
+
+ public void testSubstitutableExports023() throws BundleException {
+ State state = getSubstituteSplitUsesState();
+ state.resolve();
+ BundleDescription a = state.getBundle(0);
+ BundleDescription b = state.getBundle(1);
+ BundleDescription c = state.getBundle(2);
+ BundleDescription d = state.getBundle(3);
+ BundleDescription e = state.getBundle(4);
+ BundleDescription f = state.getBundle(5);
+ BundleDescription g = state.getBundle(6);
+ BundleDescription h = state.getBundle(7);
+ BundleDescription i = state.getBundle(8);
+ BundleDescription j = state.getBundle(9);
+ BundleDescription k = state.getBundle(10);
+ BundleDescription l = state.getBundle(11);
+ BundleDescription m = state.getBundle(12);
+ BundleDescription n = state.getBundle(13);
+
+ assertTrue("1.0", a.isResolved()); //$NON-NLS-1$
+ assertTrue("1.1", b.isResolved()); //$NON-NLS-1$
+ assertTrue("1.2", c.isResolved()); //$NON-NLS-1$
+ assertTrue("1.3", d.isResolved()); //$NON-NLS-1$
+ assertTrue("1.4", e.isResolved()); //$NON-NLS-1$
+ assertTrue("1.5", f.isResolved()); //$NON-NLS-1$
+ assertTrue("1.6", g.isResolved()); //$NON-NLS-1$
+ assertTrue("1.7", h.isResolved()); //$NON-NLS-1$
+ assertTrue("1.8", i.isResolved()); //$NON-NLS-1$
+ assertTrue("1.9", j.isResolved()); //$NON-NLS-1$
+ assertTrue("1.9", k.isResolved()); //$NON-NLS-1$
+ assertTrue("1.9", l.isResolved()); //$NON-NLS-1$
+ assertTrue("1.9", j.isResolved()); //$NON-NLS-1$
+ assertTrue("1.9", n.isResolved()); //$NON-NLS-1$
+
+ ExportPackageDescription[] aVisible = state.getStateHelper().getVisiblePackages(a);
+ ExportPackageDescription[] bVisible = state.getStateHelper().getVisiblePackages(b);
+ ExportPackageDescription[] cVisible = state.getStateHelper().getVisiblePackages(c);
+ ExportPackageDescription[] dVisible = state.getStateHelper().getVisiblePackages(d);
+ ExportPackageDescription[] eVisible = state.getStateHelper().getVisiblePackages(e);
+ ExportPackageDescription[] fVisible = state.getStateHelper().getVisiblePackages(f);
+ ExportPackageDescription[] gVisible = state.getStateHelper().getVisiblePackages(g);
+ ExportPackageDescription[] hVisible = state.getStateHelper().getVisiblePackages(h);
+ ExportPackageDescription[] iVisible = state.getStateHelper().getVisiblePackages(i);
+ ExportPackageDescription[] jVisible = state.getStateHelper().getVisiblePackages(j);
+ ExportPackageDescription[] kVisible = state.getStateHelper().getVisiblePackages(k);
+ ExportPackageDescription[] lVisible = state.getStateHelper().getVisiblePackages(l);
+ ExportPackageDescription[] mVisible = state.getStateHelper().getVisiblePackages(m);
+ ExportPackageDescription[] nVisible = state.getStateHelper().getVisiblePackages(n);
+
+ assertNotNull("aVisible is null", aVisible); //$NON-NLS-1$
+ assertNotNull("bVisible is null", bVisible); //$NON-NLS-1$
+ assertNotNull("cVisible is null", cVisible); //$NON-NLS-1$
+ assertNotNull("dVisible is null", dVisible); //$NON-NLS-1$
+ assertNotNull("eVisible is null", eVisible); //$NON-NLS-1$
+ assertNotNull("fVisible is null", fVisible); //$NON-NLS-1$
+ assertNotNull("gVisible is null", gVisible); //$NON-NLS-1$
+ assertNotNull("hVisible is null", hVisible); //$NON-NLS-1$
+ assertNotNull("iVisible is null", iVisible); //$NON-NLS-1$
+ assertNotNull("jVisible is null", jVisible); //$NON-NLS-1$
+ assertNotNull("kVisible is null", kVisible); //$NON-NLS-1$
+ assertNotNull("lVisible is null", lVisible); //$NON-NLS-1$
+ assertNotNull("mVisible is null", mVisible); //$NON-NLS-1$
+ assertNotNull("nVisible is null", nVisible); //$NON-NLS-1$
+
+ assertEquals("aVisible wrong number", 1, aVisible.length); //$NON-NLS-1$
+ assertEquals("bVisible wrong number", 3, bVisible.length); //$NON-NLS-1$
+ assertEquals("cVisible wrong number", 3, cVisible.length); //$NON-NLS-1$
+ assertEquals("dVisible wrong number", 3, dVisible.length); //$NON-NLS-1$
+ assertEquals("eVisible wrong number", 5, eVisible.length); //$NON-NLS-1$
+ assertEquals("fVisible wrong number", 5, fVisible.length); //$NON-NLS-1$
+ assertEquals("gVisible wrong number", 4, gVisible.length); //$NON-NLS-1$
+ assertEquals("hVisible wrong number", 4, hVisible.length); //$NON-NLS-1$
+ assertEquals("iVisible wrong number", 4, iVisible.length); //$NON-NLS-1$
+ assertEquals("jVisible wrong number", 4, jVisible.length); //$NON-NLS-1$
+ assertEquals("kVisible wrong number", 0, kVisible.length); //$NON-NLS-1$
+ assertEquals("lVisible wrong number", 0, lVisible.length); //$NON-NLS-1$
+ assertEquals("mVisible wrong number", 6, mVisible.length); //$NON-NLS-1$
+ assertEquals("nVisible wrong number", 6, nVisible.length); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExports = a.getSelectedExports();
+ assertEquals("aExports wrong number", 2, aExports.length); //$NON-NLS-1$
+ ExportPackageDescription[] bcExpected = new ExportPackageDescription[] {aExports[0], aExports[1], l.getSelectedExports()[0]};
+ ExportPackageDescription[] aExpected = new ExportPackageDescription[] {l.getSelectedExports()[0]};
+ assertEquals("aVisible not correct", aExpected, aVisible); //$NON-NLS-1$
+ assertEquals("bVisible not correct", bcExpected, bVisible); //$NON-NLS-1$
+ assertEquals("cVisible not correct", bcExpected, cVisible); //$NON-NLS-1$
+
+ ExportPackageDescription[] dExpected = new ExportPackageDescription[] {l.getSelectedExports()[1], aExports[0], aExports[1]};
+ assertEquals("dVisible not correct", dExpected, dVisible); //$NON-NLS-1$
+
+ ExportPackageDescription[] aExported = a.getSelectedExports();
+ ExportPackageDescription[] dExported = d.getSelectedExports();
+ ExportPackageDescription[] efExpected = new ExportPackageDescription[aExported.length + dExported.length + 1];
+ System.arraycopy(aExported, 0, efExpected, 0, aExported.length);
+ System.arraycopy(dExported, 0, efExpected, aExported.length, dExported.length);
+ efExpected[aExported.length + dExported.length] = l.getSelectedExports()[1];
+ for (int index = 0; index < efExpected.length; index++) {
+ assertContains("eVisible not correct", eVisible, efExpected[index]); //$NON-NLS-1$
+ assertContains("fVisible not correct", fVisible, efExpected[index]); //$NON-NLS-1$
+ }
+
+ ExportPackageDescription[] ghijExpected = new ExportPackageDescription[aExported.length + dExported.length];
+ System.arraycopy(aExported, 0, ghijExpected, 0, aExported.length);
+ System.arraycopy(dExported, 0, ghijExpected, aExported.length, dExported.length);
+ for (int index = 0; index < ghijExpected.length; index++) {
+ assertContains("gVisible not correct", gVisible, ghijExpected[index]); //$NON-NLS-1$
+ assertContains("hVisible not correct", hVisible, ghijExpected[index]); //$NON-NLS-1$
+ assertContains("iVisible not correct", iVisible, ghijExpected[index]); //$NON-NLS-1$
+ assertContains("jVisible not correct", jVisible, ghijExpected[index]); //$NON-NLS-1$
+ }
+
+ ExportPackageDescription[] lExported = l.getSelectedExports();
+ ExportPackageDescription[] mnExpected = new ExportPackageDescription[aExported.length + dExported.length + lExported.length];
+ System.arraycopy(aExported, 0, mnExpected, 0, aExported.length);
+ System.arraycopy(dExported, 0, mnExpected, aExported.length, dExported.length);
+ System.arraycopy(lExported, 0, mnExpected, aExported.length + dExported.length, lExported.length);
+ for (int index = 0; index < mnExpected.length; index++) {
+ assertContains("mVisible not correct", mVisible, mnExpected[index]); //$NON-NLS-1$
+ assertContains("nVisible not correct", nVisible, mnExpected[index]); //$NON-NLS-1$
+ }
+ }
+}
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/BundleDescription.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/BundleDescription.java
index 1074c316c..449361c1f 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/BundleDescription.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/BundleDescription.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -236,4 +236,11 @@ public interface BundleDescription extends BaseDescription {
* @return the native code specification.
*/
public NativeCodeSpecification getNativeCodeSpecification();
+
+ /**
+ * Returns that satisfy imported packages for this bundle description
+ * and substitute one of the exports for this bundle description
+ * @return all substituted exports for this bundle description
+ */
+ public ExportPackageDescription[] getSubstitutedExports();
}
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/ExportPackageDescription.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/ExportPackageDescription.java
index bbd01b650..789aac403 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/ExportPackageDescription.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/ExportPackageDescription.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -27,6 +27,8 @@ public interface ExportPackageDescription extends BaseDescription {
* A ExportPackageDescription is not a root package the exporting bundle
* is re-exporting the package using the Reexport-Package header.
* @return true if the export package is a root package; false otherwise
+ * @deprecated all export package descriptions are roots. The Reexport-Package header
+ * never became API.
*/
public boolean isRoot();
diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java
index 304244ed8..2fb96de0c 100644
--- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java
+++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java
@@ -187,10 +187,29 @@ public interface State {
* @param resolvedRequires the BundleDescriptions that resolve the required bundles for this bundle, can be <code>null</code>
* @param resolvedImports the exported packages that resolve the imports for this bundle, can be <code>null</code>
* @throws IllegalStateException if this is not done during a call to <code>resolve</code>
+ * @deprecated use {@link #resolveBundle(BundleDescription, boolean, BundleDescription[], ExportPackageDescription[], ExportPackageDescription[], BundleDescription[], ExportPackageDescription[])}
*/
public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports);
/**
+ * Sets whether or not the given bundle is selected in this state.
+ * <p>
+ * This method is intended to be used by resolvers in the process of
+ * determining which constraints are satisfied by which components.
+ * </p>
+ *
+ * @param bundle the bundle to update
+ * @param status whether or not the given bundle is resolved, if false the other parameters are ignored
+ * @param hosts the host for the resolve fragment, can be <code>null</code>
+ * @param selectedExports the selected exported packages for this resolved bundle, can be <code>null</code>
+ * @param substitutedExports the exported packages that resolve imports for this bundle and substitute exports, can be <code>null</code>
+ * @param resolvedRequires the BundleDescriptions that resolve the required bundles for this bundle, can be <code>null</code>
+ * @param resolvedImports the exported packages that resolve the imports for this bundle, can be <code>null</code>
+ * @throws IllegalStateException if this is not done during a call to <code>resolve</code>
+ */
+ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports);
+
+ /**
* Sets the given removal pending bundle to removal complete for this state.
* <p>
* This method is intended to be used by resolvers in the process of
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java
index 16ea525f4..b6f39854d 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoader.java
@@ -68,6 +68,7 @@ public class BundleLoader implements ClassLoaderDelegate {
final private PolicyHandler policy;
/* List of package names that are exported by this BundleLoader */
final private Collection exportedPackages;
+ final private Collection substitutedPackages;
/* List of required bundle BundleLoaderProxy objects */
final BundleLoaderProxy[] requiredBundles;
/* List of indexes into the requiredBundles list of reexported bundles */
@@ -191,6 +192,16 @@ public class BundleLoader implements ClassLoaderDelegate {
} else {
exportedPackages = null;
}
+
+ ExportPackageDescription substituted[] = description.getSubstitutedExports();
+ if (substituted.length > 0) {
+ substitutedPackages = substituted.length > 10 ? (Collection) new HashSet(substituted.length) : new ArrayList(substituted.length);
+ for (int i = 0; i < substituted.length; i++)
+ substitutedPackages.add(substituted[i].getName());
+ } else {
+ substitutedPackages = null;
+ }
+
//This is the fastest way to access to the description for fragments since the hostdescription.getFragments() is slow
org.osgi.framework.Bundle[] fragmentObjects = bundle.getFragments();
BundleDescription[] fragments = new BundleDescription[fragmentObjects == null ? 0 : fragmentObjects.length];
@@ -217,11 +228,14 @@ public class BundleLoader implements ClassLoaderDelegate {
private synchronized KeyedHashSet getImportedSources() {
if ((loaderFlags & FLAG_IMPORTSINIT) != 0)
return importedSources;
- ExportPackageDescription[] packages = proxy.getBundleDescription().getResolvedImports();
+ BundleDescription bundleDesc = proxy.getBundleDescription();
+ ExportPackageDescription[] packages = bundleDesc.getResolvedImports();
if (packages != null && packages.length > 0) {
if (importedSources == null)
importedSources = new KeyedHashSet(packages.length, false);
for (int i = 0; i < packages.length; i++) {
+ if (packages[i].getExporter() == bundleDesc)
+ continue; // ignore imports resolved to this bundle
PackageSource source = createExportPackageSource(packages[i]);
if (source != null)
importedSources.add(source);
@@ -886,6 +900,10 @@ public class BundleLoader implements ClassLoaderDelegate {
PackageSource local = null;
if (isExportedPackage(packageName))
local = proxy.getPackageSource(packageName);
+ else if (isSubstitutedExport(packageName)) {
+ result.add(findImportedSource(packageName));
+ return; // should not continue to required bundles in this case
+ }
// Must search required bundles that are exported first.
if (requiredBundles != null) {
int size = reexportTable == null ? 0 : reexportTable.length;
@@ -904,17 +922,18 @@ public class BundleLoader implements ClassLoaderDelegate {
}
// now add the locally provided package.
- if (local != null && local.isFriend(symbolicName)) {
- if (local instanceof BundleLoaderProxy.ReexportPackageSource)
- local = new SingleSourcePackage(packageName, proxy);
+ if (local != null && local.isFriend(symbolicName))
result.add(local);
- }
}
final boolean isExportedPackage(String name) {
return exportedPackages == null ? false : exportedPackages.contains(name);
}
+ final boolean isSubstitutedExport(String name) {
+ return substitutedPackages == null ? false : substitutedPackages.contains(name);
+ }
+
private void addDynamicImportPackage(ImportPackageSpecification[] packages) {
if (packages == null)
return;
@@ -1094,8 +1113,6 @@ public class BundleLoader implements ClassLoaderDelegate {
return result;
// if the package is exported then we need to get the local source
PackageSource localSource = proxy.getPackageSource(pkgName);
- if (localSource instanceof BundleLoaderProxy.ReexportPackageSource)
- localSource = new SingleSourcePackage(pkgName, proxy);
if (result == null)
return localSource;
if (localSource == null)
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java
index 8842dfb8b..0ef397985 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleLoaderProxy.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,10 +10,7 @@
*******************************************************************************/
package org.eclipse.osgi.framework.internal.core;
-import java.io.IOException;
-import java.net.URL;
import java.util.ArrayList;
-import java.util.Enumeration;
import org.eclipse.osgi.framework.util.KeyedHashSet;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
@@ -174,8 +171,6 @@ public class BundleLoaderProxy implements RequiredBundle {
}
boolean forceSourceCreation(ExportPackageDescription export) {
- if (!export.isRoot())
- return true;
boolean strict = Constants.STRICT_MODE.equals(bundle.framework.adaptor.getState().getPlatformProperties()[0].get(Constants.OSGI_RESOLVER_MODE));
return (export.getDirective(Constants.INCLUDE_DIRECTIVE) != null) || (export.getDirective(Constants.EXCLUDE_DIRECTIVE) != null) || (strict && export.getDirective(Constants.FRIENDS_DIRECTIVE) != null);
}
@@ -188,22 +183,18 @@ public class BundleLoaderProxy implements RequiredBundle {
// (i.e. it will be created lazily)
PackageSource createPackageSource(ExportPackageDescription export, boolean storeSource) {
PackageSource pkgSource = null;
- // check to see if it is a reexport
- if (!export.isRoot()) {
- pkgSource = new ReexportPackageSource(export.getName());
- } else {
- // check to see if it is a filtered export
- String includes = (String) export.getDirective(Constants.INCLUDE_DIRECTIVE);
- String excludes = (String) export.getDirective(Constants.EXCLUDE_DIRECTIVE);
- String[] friends = (String[]) export.getDirective(Constants.FRIENDS_DIRECTIVE);
- if (friends != null) {
- boolean strict = Constants.STRICT_MODE.equals(bundle.framework.adaptor.getState().getPlatformProperties()[0].get(Constants.OSGI_RESOLVER_MODE));
- if (!strict)
- friends = null; // do not pay attention to friends if not in strict mode
- }
- if (includes != null || excludes != null || friends != null) {
- pkgSource = new FilteredSourcePackage(export.getName(), this, includes, excludes, friends);
- }
+
+ // check to see if it is a filtered export
+ String includes = (String) export.getDirective(Constants.INCLUDE_DIRECTIVE);
+ String excludes = (String) export.getDirective(Constants.EXCLUDE_DIRECTIVE);
+ String[] friends = (String[]) export.getDirective(Constants.FRIENDS_DIRECTIVE);
+ if (friends != null) {
+ boolean strict = Constants.STRICT_MODE.equals(bundle.framework.adaptor.getState().getPlatformProperties()[0].get(Constants.OSGI_RESOLVER_MODE));
+ if (!strict)
+ friends = null; // do not pay attention to friends if not in strict mode
+ }
+ if (includes != null || excludes != null || friends != null) {
+ pkgSource = new FilteredSourcePackage(export.getName(), this, includes, excludes, friends);
}
if (storeSource) {
@@ -228,33 +219,4 @@ public class BundleLoaderProxy implements RequiredBundle {
return pkgSource;
}
-
- class ReexportPackageSource extends PackageSource {
- public ReexportPackageSource(String id) {
- super(id);
- }
-
- public synchronized SingleSourcePackage[] getSuppliers() {
- PackageSource source = getBundleLoader().getPackageSource(id);
- if (source == null)
- return null;
- return source.getSuppliers();
- }
-
- public Class loadClass(String name) {
- try {
- return getBundleLoader().findClass(name, false);
- } catch (ClassNotFoundException e) {
- return null;
- }
- }
-
- public URL getResource(String name) {
- return getBundleLoader().findResource(name, false);
- }
-
- public Enumeration getResources(String name) throws IOException {
- return getBundleLoader().findResources(name);
- }
- }
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java
index 486e59c41..553a0fc18 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java
@@ -240,19 +240,6 @@ public class Constants implements org.osgi.framework.Constants {
public final static String REGISTERED_POLICY = "Eclipse-RegisterBuddy"; //$NON-NLS-1$
- /**
- * Manifest header (named &quot;Reexport-Package&quot;) identifying the
- * names of the packages that the bundle offers to the Framework for
- * reexport.
- *
- * <p>
- * The attribute value may be retrieved from the <code>Dictionary</code>
- * object returned by the <code>Bundle.getHeaders</code> method.
- *
- * @deprecated
- */
- public final static String REEXPORT_PACKAGE = "Reexport-Package"; //$NON-NLS-1$
-
static public final String INTERNAL_HANDLER_PKGS = "equinox.interal.handler.pkgs"; //$NON-NLS-1$
// TODO rename it to Eclipse-PluginClass
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
index 30de6c080..e3187acf8 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -89,8 +89,6 @@ public class PackageAdminImpl implements PackageAdmin {
synchronized (framework.bundles) {
ExportPackageDescription[] allDescriptions = framework.adaptor.getState().getExportedPackages();
for (int i = 0; i < allDescriptions.length; i++) {
- if (!allDescriptions[i].isRoot())
- continue;
ExportedPackageImpl exportedPackage = createExportedPackage(allDescriptions[i]);
if (exportedPackage == null)
continue;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
index e8a6abb16..a0522d09f 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/GroupingChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2004, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
@@ -61,9 +61,10 @@ public class GroupingChecker {
// check that the packages exported by the matching bundle are consistent
ResolverExport[] matchingExports = matchingBundle.getExportPackages();
for (int i = 0; i < matchingExports.length; i++) {
- if (matchingExports[i].isDropped())
- continue;
- results = isConsistentInternal(requiringBundle, matchingExports[i], dynamicImport, results);
+ ResolverExport matchingExport = matchingExports[i];
+ if (matchingExports[i].getSubstitute() != null)
+ matchingExport = (ResolverExport) matchingExports[i].getSubstitute();
+ results = isConsistentInternal(requiringBundle, matchingExport, dynamicImport, results);
}
// check that the packages from reexported bundles are consistent
BundleConstraint[] supplierRequires = matchingBundle.getRequires();
@@ -266,24 +267,24 @@ public class GroupingChecker {
public ArrayList isConsistentClassSpace(ResolverBundle importingBundle, ArrayList visited, ArrayList results) {
if (roots == null)
return results;
+ if (visited == null)
+ visited = new ArrayList(1);
+ if (visited.contains(this))
+ return results;
+ visited.add(this);
int size = roots.length;
for (int i = 0; i < size; i++) {
ResolverExport root = roots[i];
String[] uses = root.getUsesDirective();
if (uses == null)
continue;
- if (visited == null)
- visited = new ArrayList(1);
- if (visited.contains(this))
- return results;
- visited.add(this);
for (int j = 0; j < uses.length; j++) {
if (uses[j].equals(root.getName()))
continue;
PackageRoots thisUsedRoots = getPackageRoots(root.getExporter(), uses[j], null);
PackageRoots importingUsedRoots = getPackageRoots(importingBundle, uses[j], null);
if (thisUsedRoots == importingUsedRoots)
- return results;
+ continue;
if (thisUsedRoots != nullPackageRoots && importingUsedRoots != nullPackageRoots)
if (!(subSet(thisUsedRoots.roots, importingUsedRoots.roots) || subSet(importingUsedRoots.roots, thisUsedRoots.roots))) {
if (results == null)
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
index 0b3968e45..977f2ffa1 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverBundle.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -131,6 +131,10 @@ public class ResolverBundle extends VersionSupplier implements Comparable {
GenericConstraint[] allGenericRequires = getGenericRequires();
for (int i = 0; i < allGenericRequires.length; i++)
allGenericRequires[i].setMatchingCapability(null);
+
+ ResolverExport[] allExports = getExportPackages();
+ for (int i = 0; i < allExports.length; i++)
+ allExports[i].setSubstitute(null);
}
boolean isResolved() {
@@ -184,19 +188,27 @@ public class ResolverBundle extends VersionSupplier implements Comparable {
}
ResolverExport[] getSelectedExports() {
- ResolverExport[] allExports = getExportPackages();
+ return getExports(true);
+ }
+
+ ResolverExport[] getSubstitutedExports() {
+ return getExports(false);
+ }
+
+ private ResolverExport[] getExports(boolean selected) {
+ ResolverExport[] results = getExportPackages();
int removedExports = 0;
- for (int i = 0; i < allExports.length; i++)
- if (allExports[i].isDropped())
+ for (int i = 0; i < results.length; i++)
+ if (selected ? results[i].getSubstitute() != null : results[i].getSubstitute() == null)
removedExports++;
if (removedExports == 0)
- return allExports;
- ResolverExport[] selectedExports = new ResolverExport[allExports.length - removedExports];
+ return results;
+ ResolverExport[] selectedExports = new ResolverExport[results.length - removedExports];
int index = 0;
- for (int i = 0; i < allExports.length; i++) {
- if (allExports[i].isDropped())
+ for (int i = 0; i < results.length; i++) {
+ if (selected ? results[i].getSubstitute() != null : results[i].getSubstitute() == null)
continue;
- selectedExports[index] = allExports[i];
+ selectedExports[index] = results[i];
index++;
}
return selectedExports;
@@ -490,7 +502,11 @@ public class ResolverBundle extends VersionSupplier implements Comparable {
}
}
}
- return removedExports == null ? new ResolverExport[0] : (ResolverExport[]) removedExports.toArray(new ResolverExport[removedExports.size()]);
+ ResolverExport[] results = removedExports == null ? new ResolverExport[0] : (ResolverExport[]) removedExports.toArray(new ResolverExport[removedExports.size()]);
+ for (int i = 0; i < results.length; i++)
+ // TODO this is a hack; need to figure out how to indicate that a fragment export is no longer attached
+ results[i].setSubstitute(results[i]);
+ return results;
}
private boolean hasUnresolvedConstraint(ResolverConstraint reason, ResolverBundle detachedFragment, ResolverBundle remainingFragment, ResolverImport[] oldImports, BundleConstraint[] oldRequires, ArrayList additionalImports, ArrayList additionalRequires) {
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java
index d50635357..49713ee0f 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverConstraint.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others. All rights reserved. This
+ * Copyright (c) 2005, 2008 IBM Corporation and others. All rights reserved. This
* program and the accompanying materials are made available under the terms of
* the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@@ -44,7 +44,7 @@ public abstract class ResolverConstraint {
boolean isSatisfiedBy(VersionSupplier vs) {
if (!bundle.getResolver().getPermissionChecker().checkPermission(constraint, vs.getBaseDescription()))
return false;
- return !vs.getResolverBundle().isUninstalled() && constraint.isSatisfiedBy(vs.getBaseDescription());
+ return vs.getSubstitute() == null && !vs.getResolverBundle().isUninstalled() && constraint.isSatisfiedBy(vs.getBaseDescription());
}
// returns the companion VersionConstraint object from the State
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
index a8384c7ec..61d541260 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java
@@ -211,15 +211,6 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
}
}
imp.addPossibleSupplier(matchingExport);
- // Check if we wired to a reprovided package (in which case the ResolverExport doesn't exist)
- if (matchingExport == null && exporter != null) {
- ResolverExport reprovidedExport = new ResolverExport(exporter, importSupplier);
- if (exporter.getExport(imp.getName()) == null) {
- exporter.addExport(reprovidedExport);
- resolverExports.put(reprovidedExport.getName(), reprovidedExport);
- }
- imp.addPossibleSupplier(reprovidedExport);
- }
// If we still have a null wire and it's not optional, then we have an error
if (imp.getSelectedSupplier() == null && !imp.isOptional()) {
System.err.println("Could not find matching export for " + imp.getVersionConstraint()); //$NON-NLS-1$
@@ -483,7 +474,7 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
resolvedOptional = true;
}
if (resolvedOptional) {
- state.resolveBundle(bundle.getBundle(), false, null, null, null, null);
+ state.resolveBundle(bundle.getBundle(), false, null, null, null, null, null);
stateResolveConstraints(bundle);
stateResolveBundle(bundle);
}
@@ -917,7 +908,7 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
// check for dropped exports
while (imports[j].getSelectedSupplier() != null) {
ResolverExport importSupplier = (ResolverExport) imports[j].getSelectedSupplier();
- if (importSupplier.isDropped())
+ if (importSupplier.getSubstitute() != null)
imports[j].selectNextSupplier();
else
break;
@@ -1273,8 +1264,6 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
int originalState = export.getExporter().getState();
if (imp.isDynamic() && originalState != ResolverBundle.RESOLVED)
continue; // Must not attempt to resolve an exporter when dynamic
- if (imp.getBundle() == export.getExporter() && !export.getExportPackageDescription().isRoot())
- continue; // Can't wire to our own re-export
if (imp.getSelectedSupplier() != null && ((ResolverExport) imp.getSelectedSupplier()).getExporter() == imp.getBundle())
break; // We wired to ourselves; nobody else matters
export.getExporter().addRef(imp.getBundle());
@@ -1284,22 +1273,21 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
if (imp.getBundle() != export.getExporter()) {
// Save the exports of this package from the importer in case we need to add them back
importerExps = imp.getBundle().getExports(imp.getName());
- for (int j = 0; j < importerExps.length; j++) {
- if (importerExps[j].getExportPackageDescription().isRoot() && !export.getExportPackageDescription().isRoot())
- continue exportsloop; // to prevent imports from getting wired to re-exports if we offer a root export
- if (importerExps[j].getExportPackageDescription().isRoot()) // do not drop reexports when import wins
- resolverExports.remove(importerExps[j]); // Import wins, remove export
- }
+ for (int j = 0; j < importerExps.length; j++)
+ if (importerExps[j].getSubstitute() == null)
+ importerExps[j].setSubstitute(export); // Import wins, drop export
// if in dev mode then allow a constraint to resolve to an unresolved bundle
- if ((originalState != ResolverBundle.RESOLVED && !resolveBundle(export.getExporter(), cycle) && !developmentMode) || export.isDropped()) {
+ if ((originalState != ResolverBundle.RESOLVED && !resolveBundle(export.getExporter(), cycle) && !developmentMode) || export.getSubstitute() != null) {
// remove the possible supplier
imp.removePossibleSupplier(export);
// add back the exports of this package from the importer
- for (int j = 0; j < importerExps.length; j++)
- resolverExports.put(importerExps[j].getName(), importerExps[j]);
+ if (imp.getSelectedSupplier() == null)
+ for (int j = 0; j < importerExps.length; j++)
+ if (importerExps[j].getSubstitute() == export)
+ importerExps[j].setSubstitute(null);
continue; // Bundle hasn't resolved || export has not been selected and is unavailable
}
- } else if (export.isDropped())
+ } else if (export.getSubstitute() != null)
continue; // we already found a possible import that satisifies us; our export is dropped
// Record any cyclic dependencies
@@ -1320,66 +1308,11 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
if (result)
return true;
- if (resolveImportReprovide(imp, cycle))
- return true;
if (imp.isOptional())
return true; // If the import is optional then just return true
return false;
}
- // Check if the import can be resolved to a re-exported package (has no export object to match to)
- private boolean resolveImportReprovide(ResolverImport imp, ArrayList cycle) {
- String bsn = ((ImportPackageSpecification) imp.getVersionConstraint()).getBundleSymbolicName();
- // If no symbolic name specified then just return (since this is a
- // re-export an import not specifying a bsn will wire to the root)
- if (bsn == null)
- return false;
- if (DEBUG_IMPORTS)
- ResolverImpl.log("Checking reprovides: " + imp.getName()); //$NON-NLS-1$
- // Find bundle with specified bsn
- Object[] bundles = resolverBundles.get(bsn);
- for (int i = 0; i < bundles.length; i++)
- if (resolveBundle((ResolverBundle) bundles[i], cycle))
- if (resolveImportReprovide0(imp, (ResolverBundle) bundles[i], (ResolverBundle) bundles[i], cycle, new ArrayList(5)))
- return true;
- return false;
- }
-
- private boolean resolveImportReprovide0(ResolverImport imp, ResolverBundle reexporter, ResolverBundle rb, ArrayList cycle, ArrayList visited) {
- if (visited.contains(rb))
- return false; // make sure we don't endless recurse cycles
- visited.add(rb);
- BundleConstraint[] requires = rb.getRequires();
- for (int i = 0; i < requires.length; i++) {
- if (!((BundleSpecification) requires[i].getVersionConstraint()).isExported())
- continue; // Skip require if it doesn't re-export the packages
- // Check exports to see if we've found the root
- if (requires[i].getSelectedSupplier() == null)
- continue;
- ResolverExport[] exports = ((ResolverBundle) requires[i].getSelectedSupplier()).getExports(imp.getName());
- for (int j = 0; j < exports.length; j++) {
- Map directives = exports[j].getExportPackageDescription().getDirectives();
- directives.remove(Constants.USES_DIRECTIVE);
- ExportPackageDescription epd = state.getFactory().createExportPackageDescription(exports[j].getName(), exports[j].getVersion(), directives, exports[j].getExportPackageDescription().getAttributes(), false, reexporter.getBundle());
- if (imp.getVersionConstraint().isSatisfiedBy(epd)) {
- // Create reexport and add to bundle and resolverExports
- if (DEBUG_IMPORTS)
- ResolverImpl.log(" - Creating re-export for reprovide: " + reexporter + ":" + epd.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ResolverExport re = new ResolverExport(reexporter, epd);
- reexporter.addExport(re);
- resolverExports.put(re.getName(), re);
- // Resolve import
- imp.addPossibleSupplier(re);
- return true;
- }
- }
- // Check requires of matching bundle (recurse down the chain)
- if (resolveImportReprovide0(imp, reexporter, (ResolverBundle) requires[i].getSelectedSupplier(), cycle, visited))
- return true;
- }
- return false;
- }
-
// Move a bundle to UNRESOLVED
private void setBundleUnresolved(ResolverBundle bundle, boolean removed, boolean keepFragsAttached) {
if (bundle.getState() == ResolverBundle.UNRESOLVED && !developmentMode)
@@ -1487,6 +1420,14 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
}
ExportPackageDescription[] selectedExportsArray = (ExportPackageDescription[]) selectedExports.toArray(new ExportPackageDescription[selectedExports.size()]);
+ // Gather substitute exports
+ ResolverExport[] substituted = rb.getSubstitutedExports();
+ ArrayList substitutedExports = new ArrayList(substituted.length);
+ for (int i = 0; i < substituted.length; i++) {
+ substitutedExports.add(substituted[i].getExportPackageDescription());
+ }
+ ExportPackageDescription[] substitutedExportsArray = (ExportPackageDescription[]) substitutedExports.toArray(new ExportPackageDescription[substitutedExports.size()]);
+
// Gather exports that have been wired to
ResolverImport[] imports = rb.getImportPackages();
ArrayList exportsWiredTo = new ArrayList(imports.length);
@@ -1516,14 +1457,14 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
ExportPackageDescription[] hostExportsArray = new ExportPackageDescription[hostExports.length];
for (int j = 0; j < hostExports.length; j++)
hostExportsArray[j] = hostExports[j].getExportPackageDescription();
- state.resolveBundle(hostBundles[i], true, null, hostExportsArray, hostBundles[i].getResolvedRequires(), hostBundles[i].getResolvedImports());
+ state.resolveBundle(hostBundles[i], true, null, hostExportsArray, hostBundles[i].getSubstitutedExports(), hostBundles[i].getResolvedRequires(), hostBundles[i].getResolvedImports());
}
}
}
}
// Resolve the bundle in the state
- state.resolveBundle(rb.getBundle(), rb.isResolved(), hostBundles, selectedExportsArray, bundlesWiredToArray, exportsWiredToArray);
+ state.resolveBundle(rb.getBundle(), rb.isResolved(), hostBundles, selectedExportsArray, substitutedExportsArray, bundlesWiredToArray, exportsWiredToArray);
}
// Resolve dynamic import
@@ -1675,7 +1616,7 @@ public class ResolverImpl implements org.eclipse.osgi.service.resolver.Resolver
setBundleUnresolved(bundle, removed, false);
// Get bundles dependent on 'bundle'
BundleDescription[] dependents = bundle.getBundle().getDependents();
- state.resolveBundle(bundle.getBundle(), false, null, null, null, null);
+ state.resolveBundle(bundle.getBundle(), false, null, null, null, null, null);
// Unresolve dependents of 'bundle'
for (int i = 0; i < dependents.length; i++)
unresolveBundle((ResolverBundle) bundleMapping.get(dependents[i]), false);
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java
index a94f9ab2a..142461eb2 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java
@@ -30,11 +30,6 @@ public class VersionHashMap extends MappedList implements Comparator {
put(versionSuppliers[i].getName(), versionSuppliers[i]);
}
- public void put(Object key, Object value) {
- super.put(key, value);
- ((VersionSupplier) value).setDropped(false);
- }
-
public boolean contains(VersionSupplier vs) {
return contains(vs, false) != null;
}
@@ -46,7 +41,6 @@ public class VersionHashMap extends MappedList implements Comparator {
for (int i = 0; i < existing.length; i++)
if (existing[i] == vs) {
if (remove) {
- vs.setDropped(true);
if (existing.length == 1) {
internal.remove(vs.getName());
return vs;
@@ -71,13 +65,6 @@ public class VersionHashMap extends MappedList implements Comparator {
remove(versionSuppliers[i]);
}
- public Object[] remove(Object key) {
- Object[] results = super.remove(key);
- for (int i = 0; i < results.length; i++)
- ((VersionSupplier) results[i]).setDropped(true);
- return results;
- }
-
// Once we have resolved bundles, we need to make sure that version suppliers
// from the resolved bundles are ahead of those from unresolved bundles
void reorder() {
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionSupplier.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionSupplier.java
index 777afdb86..d4c8a2ed8 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionSupplier.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionSupplier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -18,8 +18,8 @@ import org.osgi.framework.Version;
* A companion to BaseDescription from the state used while resolving.
*/
public abstract class VersionSupplier {
- BaseDescription base;
- boolean dropped = false;
+ protected BaseDescription base;
+ private VersionSupplier substitute;
VersionSupplier(BaseDescription base) {
this.base = base;
@@ -38,14 +38,14 @@ public abstract class VersionSupplier {
}
// returns true if this version supplier has been dropped and is no longer available as a wire
- boolean isDropped() {
- return dropped;
+ VersionSupplier getSubstitute() {
+ return substitute;
}
// sets the dropped status. This should only be called by the VersionHashMap
// when VersionSuppliers are removed
- void setDropped(boolean dropped) {
- this.dropped = dropped;
+ void setSubstitute(VersionSupplier substitute) {
+ this.substitute = substitute;
}
/*
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
index 4b89dabb7..41a0dc94f 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java
@@ -172,6 +172,13 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
return lazyData.selectedExports;
}
+ public ExportPackageDescription[] getSubstitutedExports() {
+ fullyLoad();
+ if (lazyData.substitutedExports == null)
+ return EMPTY_EXPORTS;
+ return lazyData.substitutedExports;
+ }
+
public BundleDescription[] getResolvedRequires() {
fullyLoad();
if (lazyData.resolvedRequires == null)
@@ -317,6 +324,11 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
}
}
+ protected void setSubstitutedExports(ExportPackageDescription[] substitutedExports) {
+ checkLazyData();
+ lazyData.substitutedExports = substitutedExports;
+ }
+
protected void setResolvedImports(ExportPackageDescription[] resolvedImports) {
checkLazyData();
lazyData.resolvedImports = resolvedImports;
@@ -570,7 +582,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle
ExportPackageDescription[] selectedExports;
BundleDescription[] resolvedRequires;
ExportPackageDescription[] resolvedImports;
-
+ ExportPackageDescription[] substitutedExports;
String[] executionEnvironments;
HashMap dynamicStamps;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java
index 76c6ee821..d7f98fd6a 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ExportPackageDescriptionImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,7 +11,8 @@
package org.eclipse.osgi.internal.resolver;
-import java.util.*;
+import java.util.HashMap;
+import java.util.Map;
import org.eclipse.osgi.framework.internal.core.Constants;
import org.eclipse.osgi.service.resolver.BundleDescription;
import org.eclipse.osgi.service.resolver.ExportPackageDescription;
@@ -28,7 +29,6 @@ public class ExportPackageDescriptionImpl extends BaseDescriptionImpl implements
private String[] mandatory;
private Boolean internal = Boolean.FALSE;
private int equinox_ee = -1;
- private boolean root;
private int tableIndex;
public Map getDirectives() {
@@ -111,7 +111,7 @@ public class ExportPackageDescriptionImpl extends BaseDescriptionImpl implements
}
public boolean isRoot() {
- return root;
+ return true;
}
protected void setAttributes(Map attributes) {
@@ -122,10 +122,6 @@ public class ExportPackageDescriptionImpl extends BaseDescriptionImpl implements
this.exporter = exporter;
}
- protected void setRoot(boolean root) {
- this.root = root;
- }
-
public String toString() {
return "Export-Package: " + getName() + "; version=\"" + getVersion() + "\""; //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java
index 5b39faadc..c06c8320f 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ReadOnlyState.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -111,7 +111,14 @@ public class ReadOnlyState implements State {
throw new UnsupportedOperationException();
}
- public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] host, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolveImports) {
+ /**
+ * @deprecated
+ */
+ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] host, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolveImports) {
throw new UnsupportedOperationException();
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
index 1202922ee..1047f3b20 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java
@@ -24,7 +24,7 @@ import org.osgi.framework.*;
*/
class StateBuilder {
static final String[] DEFINED_MATCHING_ATTRS = {Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE, Constants.BUNDLE_VERSION_ATTRIBUTE, Constants.PACKAGE_SPECIFICATION_VERSION, Constants.VERSION_ATTRIBUTE};
- static final String[] DEFINED_OSGI_VALIDATE_HEADERS = {Constants.IMPORT_PACKAGE, Constants.DYNAMICIMPORT_PACKAGE, Constants.EXPORT_PACKAGE, Constants.FRAGMENT_HOST, Constants.BUNDLE_SYMBOLICNAME, Constants.REEXPORT_PACKAGE, Constants.REQUIRE_BUNDLE};
+ static final String[] DEFINED_OSGI_VALIDATE_HEADERS = {Constants.IMPORT_PACKAGE, Constants.DYNAMICIMPORT_PACKAGE, Constants.EXPORT_PACKAGE, Constants.FRAGMENT_HOST, Constants.BUNDLE_SYMBOLICNAME, Constants.REQUIRE_BUNDLE};
static final String GENERIC_REQUIRE = "Eclipse-GenericRequire"; //$NON-NLS-1$
static final String GENERIC_CAPABILITY = "Eclipse-GenericCapability"; //$NON-NLS-1$
@@ -87,11 +87,10 @@ class StateBuilder {
if (host != null)
result.setHost(createHostSpecification(host[0]));
ManifestElement[] exports = ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, (String) manifest.get(Constants.EXPORT_PACKAGE));
- ManifestElement[] reexports = ManifestElement.parseHeader(Constants.REEXPORT_PACKAGE, (String) manifest.get(Constants.REEXPORT_PACKAGE));
ManifestElement[] provides = ManifestElement.parseHeader(Constants.PROVIDE_PACKAGE, (String) manifest.get(Constants.PROVIDE_PACKAGE)); // TODO this is null for now until the framwork is updated to handle the new re-export semantics
boolean strict = state != null && state.inStrictMode();
ArrayList providedExports = new ArrayList(provides == null ? 0 : provides.length);
- result.setExportPackages(createExportPackages(exports, reexports, provides, providedExports, manifestVersion, strict));
+ result.setExportPackages(createExportPackages(exports, provides, providedExports, manifestVersion, strict));
ManifestElement[] imports = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE, (String) manifest.get(Constants.IMPORT_PACKAGE));
ManifestElement[] dynamicImports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE, (String) manifest.get(Constants.DYNAMICIMPORT_PACKAGE));
result.setImportPackages(createImportPackages(result.getExportPackages(), providedExports, imports, dynamicImports, manifestVersion));
@@ -182,8 +181,6 @@ class StateBuilder {
if (header != null) {
ManifestElement[] elements = ManifestElement.parseHeader(DEFINED_OSGI_VALIDATE_HEADERS[i], header);
checkForDuplicateDirectives(elements);
- if (DEFINED_OSGI_VALIDATE_HEADERS[i] == Constants.REEXPORT_PACKAGE)
- checkForUsesDirective(elements);
if (DEFINED_OSGI_VALIDATE_HEADERS[i] == Constants.IMPORT_PACKAGE)
checkImportExportSyntax(elements, false, false, jreBundle);
if (DEFINED_OSGI_VALIDATE_HEADERS[i] == Constants.DYNAMICIMPORT_PACKAGE)
@@ -287,23 +284,20 @@ class StateBuilder {
return result;
}
- static ExportPackageDescription[] createExportPackages(ManifestElement[] exported, ManifestElement[] reexported, ManifestElement[] provides, ArrayList providedExports, int manifestVersion, boolean strict) throws BundleException {
- int numExports = (exported == null ? 0 : exported.length) + (reexported == null ? 0 : reexported.length) + (provides == null ? 0 : provides.length);
+ static ExportPackageDescription[] createExportPackages(ManifestElement[] exported, ManifestElement[] provides, ArrayList providedExports, int manifestVersion, boolean strict) throws BundleException {
+ int numExports = (exported == null ? 0 : exported.length) + (provides == null ? 0 : provides.length);
if (numExports == 0)
return null;
ArrayList allExports = new ArrayList(numExports);
if (exported != null)
for (int i = 0; i < exported.length; i++)
- addExportPackages(exported[i], allExports, manifestVersion, false, strict);
- if (reexported != null)
- for (int i = 0; i < reexported.length; i++)
- addExportPackages(reexported[i], allExports, manifestVersion, true, strict);
+ addExportPackages(exported[i], allExports, manifestVersion, strict);
if (provides != null)
addProvidePackages(provides, allExports, providedExports);
return (ExportPackageDescription[]) allExports.toArray(new ExportPackageDescription[allExports.size()]);
}
- private static void addExportPackages(ManifestElement exportPackage, ArrayList allExports, int manifestVersion, boolean reexported, boolean strict) throws BundleException {
+ private static void addExportPackages(ManifestElement exportPackage, ArrayList allExports, int manifestVersion, boolean strict) throws BundleException {
String[] exportNames = exportPackage.getValueComponents();
for (int i = 0; i < exportNames.length; i++) {
// if we are in strict mode and the package is marked as internal, skip it.
@@ -323,7 +317,6 @@ class StateBuilder {
result.setDirective(Constants.INTERNAL_DIRECTIVE, Boolean.valueOf(exportPackage.getDirective(Constants.INTERNAL_DIRECTIVE)));
result.setDirective(Constants.MANDATORY_DIRECTIVE, ManifestElement.getArrayFromList(exportPackage.getDirective(Constants.MANDATORY_DIRECTIVE)));
result.setAttributes(getAttributes(exportPackage, DEFINED_MATCHING_ATTRS));
- result.setRoot(!reexported);
allExports.add(result);
}
}
@@ -340,7 +333,6 @@ class StateBuilder {
if (!duplicate) {
ExportPackageDescriptionImpl result = new ExportPackageDescriptionImpl();
result.setName(provides[i].getValue());
- result.setRoot(true);
allExports.add(result);
}
providedExports.add(provides[i].getValue());
@@ -577,12 +569,6 @@ class StateBuilder {
}
}
- private static void checkForUsesDirective(ManifestElement[] elements) throws BundleException {
- for (int i = 0; i < elements.length; i++)
- if (elements[i].getDirective(Constants.USES_DIRECTIVE) != null)
- throw new BundleException(NLS.bind(StateMsg.HEADER_REEXPORT_USES, Constants.USES_DIRECTIVE, Constants.REEXPORT_PACKAGE));
- }
-
private static void checkExtensionBundle(ManifestElement[] elements) throws BundleException {
if (elements.length == 0 || elements[0].getDirective(Constants.EXTENSION_DIRECTIVE) == null)
return;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
index 39a18343b..53aea0764 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateHelperImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2006 IBM Corporation and others.
+ * Copyright (c) 2004, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -282,6 +282,7 @@ public class StateHelperImpl implements StateHelper {
boolean strict = false;
if (state != null)
strict = state.inStrictMode();
+ BundleDescription host = (BundleDescription) (bundle.getHost() == null ? bundle : bundle.getHost().getSupplier());
ArrayList orderedPkgList = new ArrayList(); // list of all ExportPackageDescriptions that are visible (ArrayList is used to keep order)
Set pkgSet = new HashSet();
Set importList = new HashSet(); // list of package names which are directly imported
@@ -289,7 +290,7 @@ public class StateHelperImpl implements StateHelper {
ImportPackageSpecification[] imports = bundle.getImportPackages();
for (int i = 0; i < imports.length; i++) {
ExportPackageDescription pkgSupplier = (ExportPackageDescription) imports[i].getSupplier();
- if (pkgSupplier == null)
+ if (pkgSupplier == null || pkgSupplier.getExporter() == host) // do not return the bundle'sr own imports
continue;
if (!isSystemExport(pkgSupplier, options) && !pkgSet.contains(pkgSupplier)) {
orderedPkgList.add(pkgSupplier);
@@ -325,6 +326,16 @@ public class StateHelperImpl implements StateHelper {
return; // prevent duplicate entries and infinate loops incase of cycles
visited.add(requiredBundle);
// add all the exported packages from the required bundle; take x-friends into account.
+ ExportPackageDescription[] substitutedExports = requiredBundle.getSubstitutedExports();
+ for (int i = 0; i < substitutedExports.length; i++) {
+ ExportPackageDescription[] imports = requiredBundle.getResolvedImports();
+ for (int j = 0; j < imports.length; j++) {
+ if (substitutedExports[i].getName().equals(imports[j].getName()) && !pkgSet.contains(imports[j])) {
+ getPackages(imports[j].getSupplier(), symbolicName, importList, orderedPkgList, pkgSet, visited, strict, pkgNames, options);
+ return; // should not continue to local exports or required bundles
+ }
+ }
+ }
ExportPackageDescription[] exports = requiredBundle.getSelectedExports();
HashSet exportNames = new HashSet(exports.length); // set is used to improve performance of duplicate check.
for (int i = 0; i < exports.length; i++)
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
index a83c99c6a..9838191e9 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java
@@ -126,7 +126,7 @@ public abstract class StateImpl implements State {
try {
resolving = true;
resolverErrors.remove(existing);
- resolveBundle(existing, false, null, null, null, null);
+ resolveBundle(existing, false, null, null, null, null, null);
} finally {
resolving = false;
}
@@ -166,7 +166,7 @@ public abstract class StateImpl implements State {
try {
resolving = true;
resolverErrors.remove(toRemove);
- resolveBundle(toRemove, false, null, null, null, null);
+ resolveBundle(toRemove, false, null, null, null, null, null);
} finally {
resolving = false;
}
@@ -268,7 +268,11 @@ public abstract class StateImpl implements State {
((VersionConstraintImpl) constraint).setSupplier(supplier);
}
- public synchronized void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) {
+ public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) {
+ resolveBundle(bundle, status, hosts, selectedExports, null, resolvedRequires, resolvedImports);
+ }
+
+ public synchronized void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) {
if (!resolving)
throw new IllegalStateException(); // TODO need error message here!
BundleDescriptionImpl modifiable = (BundleDescriptionImpl) bundle;
@@ -291,7 +295,7 @@ public abstract class StateImpl implements State {
if (selectedExports == null || resolvedRequires == null || resolvedImports == null)
unresolveConstraints(modifiable);
else
- resolveConstraints(modifiable, hosts, selectedExports, resolvedRequires, resolvedImports);
+ resolveConstraints(modifiable, hosts, selectedExports, substitutedExports, resolvedRequires, resolvedImports);
}
public synchronized void removeBundleComplete(BundleDescription bundle) {
@@ -301,19 +305,22 @@ public abstract class StateImpl implements State {
removalPendings.remove(bundle);
}
- private void resolveConstraints(BundleDescriptionImpl bundle, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) {
+ private void resolveConstraints(BundleDescriptionImpl bundle, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, ExportPackageDescription[] substitutedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) {
HostSpecificationImpl hostSpec = (HostSpecificationImpl) bundle.getHost();
if (hostSpec != null) {
if (hosts != null) {
hostSpec.setHosts(hosts);
- for (int i = 0; i < hosts.length; i++)
+ for (int i = 0; i < hosts.length; i++) {
((BundleDescriptionImpl) hosts[i]).addDependency(bundle, true);
+ checkHostForSubstitutedExports((BundleDescriptionImpl) hosts[i], bundle);
+ }
}
}
bundle.setSelectedExports(selectedExports);
bundle.setResolvedRequires(resolvedRequires);
bundle.setResolvedImports(resolvedImports);
+ bundle.setSubstitutedExports(substitutedExports);
bundle.addDependencies(hosts, true);
bundle.addDependencies(resolvedRequires, true);
@@ -332,6 +339,30 @@ public abstract class StateImpl implements State {
}
}
+ private void checkHostForSubstitutedExports(BundleDescriptionImpl host, BundleDescriptionImpl fragment) {
+ // TODO need to handle this case where a fragment has its own export substituted
+ // there are issues here because the order in which fragments are resolved is not always the same ...
+ }
+
+ // private void checkForSubstitutedExports(BundleDescriptionImpl bundle, ExportPackageDescription[] selectedExports) {
+ // ExportPackageDescription[] existingSubstitutes = bundle.getSubstitutedExports();
+ // ExportPackageDescription[] declaredExports = bundle.getExportPackages();
+ // ArrayList substitutes = new ArrayList();
+ // for (int i = 0; i < declaredExports.length; i++) {
+ // boolean selected = false;
+ // for (int j = 0; !selected && j < selectedExports.length; j++)
+ // selected = declaredExports[i] == selectedExports[j];
+ // if (!selected)
+ // substitutes.add(declaredExports[i]);
+ // }
+ // if (substitutes.size() > 0) {
+ // substitutes.ensureCapacity(substitutes.size() + existingSubstitutes.length);
+ // for (int i = 0; i < existingSubstitutes.length; i++)
+ // substitutes.add(0, existingSubstitutes[i]);
+ // bundle.setSubstitutedExports((ExportPackageDescription[]) substitutes.toArray(new ExportPackageDescription[substitutes.size()]));
+ // }
+ // }
+
private void unresolveConstraints(BundleDescriptionImpl bundle) {
HostSpecificationImpl host = (HostSpecificationImpl) bundle.getHost();
if (host != null)
@@ -340,6 +371,7 @@ public abstract class StateImpl implements State {
bundle.setSelectedExports(null);
bundle.setResolvedImports(null);
bundle.setResolvedRequires(null);
+ bundle.setSubstitutedExports(null);
// remove suppliers for generics
GenericSpecification[] genericRequires = bundle.getGenericRequires();
@@ -433,7 +465,7 @@ public abstract class StateImpl implements State {
if (resolvedBundles.isEmpty())
return;
for (int i = 0; i < bundles.length; i++) {
- resolveBundle(bundles[i], false, null, null, null, null);
+ resolveBundle(bundles[i], false, null, null, null, null, null);
}
resolvedBundles.clear();
}
@@ -655,7 +687,7 @@ public abstract class StateImpl implements State {
if (elements == null)
continue;
// we can pass false for strict mode here because we never want to mark the system exports as internal.
- ExportPackageDescription[] systemExports = StateBuilder.createExportPackages(elements, null, null, null, 2, false);
+ ExportPackageDescription[] systemExports = StateBuilder.createExportPackages(elements, null, null, 2, false);
Integer profInx = new Integer(i);
for (int j = 0; j < systemExports.length; j++) {
((ExportPackageDescriptionImpl) systemExports[j]).setDirective(ExportPackageDescriptionImpl.EQUINOX_EE, profInx);
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties
index 6c17d2f96..15cae023a 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMessages.properties
@@ -21,7 +21,6 @@ HEADER_PACKAGE_JAVA=Cannot specify java.* packages in Import/Export headers \"{0
HEADER_VERSION_ERROR=The attributes \"{0}\" and \"{1}\" must match
HEADER_EXPORT_ATTR_ERROR=Specifying \"{0}\" in the \"{1}\" header is not permitted
HEADER_DIRECTIVE_DUPLICATES=Duplicate directives are not permitted \"{0}\"
-HEADER_REEXPORT_USES=Cannot specify the \"{0}\" directive on the header \"{1}\"
HEADER_EXTENSION_ERROR=Extension bundle is not a fragment to the system bundle \"{0}\"
RES_ERROR_DISABLEDBUNDLE=The bundle is disabled: {0}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java
index 32ab014f9..199f55e59 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateMsg.java
@@ -26,7 +26,6 @@ public class StateMsg extends NLS {
public static String HEADER_VERSION_ERROR;
public static String HEADER_EXPORT_ATTR_ERROR;
public static String HEADER_DIRECTIVE_DUPLICATES;
- public static String HEADER_REEXPORT_USES;
public static String HEADER_EXTENSION_ERROR;
public static String RES_ERROR_DISABLEDBUNDLE;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java
index 566249c57..7d2dcb55a 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateObjectFactoryImpl.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -231,7 +231,6 @@ public class StateObjectFactoryImpl implements StateObjectFactory {
exportPackage.setVersion(version);
exportPackage.setDirectives(directives);
exportPackage.setAttributes(attributes);
- exportPackage.setRoot(root);
exportPackage.setExporter(exporter);
return exportPackage;
}
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
index 8b42020c4..8358aef59 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -40,7 +40,7 @@ class StateReader {
private int numBundles;
private boolean accessedFlag = false;
- public static final byte STATE_CACHE_VERSION = 28;
+ public static final byte STATE_CACHE_VERSION = 30;
public static final byte NULL = 0;
public static final byte OBJECT = 1;
public static final byte INDEX = 2;
@@ -283,6 +283,14 @@ class StateReader {
result.setSelectedExports(selected);
}
+ int substitutedCount = in.readInt();
+ if (substitutedCount > 0) {
+ ExportPackageDescription[] selected = new ExportPackageDescription[substitutedCount];
+ for (int i = 0; i < selected.length; i++)
+ selected[i] = readExportPackageDesc(in);
+ result.setSubstitutedExports(selected);
+ }
+
int resolvedCount = in.readInt();
if (resolvedCount > 0) {
ExportPackageDescription[] resolved = new ExportPackageDescription[resolvedCount];
@@ -363,7 +371,6 @@ class StateReader {
exportPackageDesc.setTableIndex(tableIndex);
readBaseDescription(exportPackageDesc, in);
exportPackageDesc.setExporter(readBundleDescription(in));
- exportPackageDesc.setRoot(in.readBoolean());
exportPackageDesc.setAttributes(readMap(in));
exportPackageDesc.setDirectives(readMap(in));
return exportPackageDesc;
diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
index a8bdb1394..dfb2f1980 100644
--- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
+++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2007 IBM Corporation and others.
+ * Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -246,6 +246,15 @@ class StateWriter {
writeExportPackageDesc((ExportPackageDescriptionImpl) selectedExports[i], out);
}
+ ExportPackageDescription[] substitutedExports = bundle.getSubstitutedExports();
+ if (substitutedExports == null) {
+ out.writeInt(0);
+ } else {
+ out.writeInt(substitutedExports.length);
+ for (int i = 0; i < substitutedExports.length; i++)
+ writeExportPackageDesc((ExportPackageDescriptionImpl) substitutedExports[i], out);
+ }
+
ExportPackageDescription[] resolvedImports = bundle.getResolvedImports();
if (resolvedImports == null) {
out.writeInt(0);
@@ -323,7 +332,6 @@ class StateWriter {
return;
writeBaseDescription(exportPackageDesc, out);
writeBundleDescription(exportPackageDesc.getExporter(), out, false);
- out.writeBoolean(exportPackageDesc.isRoot());
writeMap(out, exportPackageDesc.getAttributes());
writeMap(out, exportPackageDesc.getDirectives());
}

Back to the top