diff options
author | Thomas Watson | 2011-10-10 19:38:07 +0000 |
---|---|---|
committer | Thomas Watson | 2011-10-12 20:51:30 +0000 |
commit | 4e14248e6a74bfe2fc5e77b4f6647f65820b0f7f (patch) | |
tree | 0d0262bbaec79a3acc6d039751760bf9e1b6bf4e | |
parent | c39d1f3fc70a9d265876bd36d50ac23b9a750d48 (diff) | |
download | rt.equinox.bundles-4e14248e6a74bfe2fc5e77b4f6647f65820b0f7f.tar.gz rt.equinox.bundles-4e14248e6a74bfe2fc5e77b4f6647f65820b0f7f.tar.xz rt.equinox.bundles-4e14248e6a74bfe2fc5e77b4f6647f65820b0f7f.zip |
Fix resolver to allow multiple hosts
2 files changed, 51 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.resolver.tests/src/org/eclipse/equinox/resolver/tests/ResolverTest.java b/bundles/org.eclipse.equinox.resolver.tests/src/org/eclipse/equinox/resolver/tests/ResolverTest.java index f5fabd7c1..58e375035 100644 --- a/bundles/org.eclipse.equinox.resolver.tests/src/org/eclipse/equinox/resolver/tests/ResolverTest.java +++ b/bundles/org.eclipse.equinox.resolver.tests/src/org/eclipse/equinox/resolver/tests/ResolverTest.java @@ -241,7 +241,7 @@ public class ResolverTest extends TestCase { dumpResults(result); } - public void testResolverServiceFragmentHost() throws BundleException { + public void testResolverServiceFragmentHost1() throws BundleException { StateObjectFactory factory = platformAdmin.getFactory(); int id = 0; List<BundleDescription> revisions = new ArrayList<BundleDescription>(); @@ -293,6 +293,53 @@ public class ResolverTest extends TestCase { dumpResults(result); } + public void testResolverServiceFragmentHost2() throws BundleException { + StateObjectFactory factory = platformAdmin.getFactory(); + int id = 0; + List<BundleDescription> revisions = new ArrayList<BundleDescription>(); + Hashtable<String, String> manifest = new Hashtable<String, String>(); + manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); + manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); + manifest.put(Constants.BUNDLE_VERSION, "1.0"); + manifest.put(Constants.IMPORT_PACKAGE, "b.frag, b; v=1"); + BundleDescription a = factory.createBundleDescription(null, manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), id++); + revisions.add(a); + + manifest.clear(); + manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); + manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); + manifest.put(Constants.BUNDLE_VERSION, "1.0"); + manifest.put(Constants.EXPORT_PACKAGE, "b; version=1.0; v=1"); + BundleDescription b1 = factory.createBundleDescription(null, manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), id++); + revisions.add(b1); + + manifest.clear(); + manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); + manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); + manifest.put(Constants.BUNDLE_VERSION, "2.0"); + manifest.put(Constants.EXPORT_PACKAGE, "b; version=1.0; v=2"); + BundleDescription b2 = factory.createBundleDescription(null, manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), id++); + revisions.add(b2); + + + manifest.clear(); + manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); + manifest.put(Constants.BUNDLE_SYMBOLICNAME, "BFrag"); + manifest.put(Constants.BUNDLE_VERSION, "1.0"); + manifest.put(Constants.FRAGMENT_HOST, "B; multiple-hosts:=true"); + manifest.put(Constants.EXPORT_PACKAGE, "b.frag; uses:=b"); + BundleDescription bFrag = factory.createBundleDescription(null, manifest, manifest.get(Constants.BUNDLE_SYMBOLICNAME), id++); + revisions.add(bFrag); + + + Map<String, Map<String, List<BaseDescription>>> repository = getRepository(revisions); + Map<Resource, List<Wire>> result = resolver.resolve(new TestEnvironment(null, repository), Arrays.asList(a), null); + + Map<Resource, List<Wire>> expectedWiring = getWiring(revisions); + compareWirings(expectedWiring, result); + dumpResults(result); + } + public void testResolverServiceRequireBundle() throws BundleException { StateObjectFactory factory = platformAdmin.getFactory(); int id = 0; diff --git a/bundles/org.eclipse.equinox.resolver/src/org/eclipse/equinox/internal/resolver/EquinoxResolver.java b/bundles/org.eclipse.equinox.resolver/src/org/eclipse/equinox/internal/resolver/EquinoxResolver.java index 96c153e6c..c5116f8bd 100644 --- a/bundles/org.eclipse.equinox.resolver/src/org/eclipse/equinox/internal/resolver/EquinoxResolver.java +++ b/bundles/org.eclipse.equinox.resolver/src/org/eclipse/equinox/internal/resolver/EquinoxResolver.java @@ -24,6 +24,9 @@ public class EquinoxResolver implements Resolver { public Map<Resource, List<Wire>> resolve(Environment environment, Collection<? extends Resource> mandatoryResources, Collection<? extends Resource> optionalResources) throws ResolutionException { State state = factory.createState(true); + Hashtable<String, Object> platformProperties = new Hashtable<String, Object>(); + platformProperties.put("osgi.support.multipleHosts", "true"); //$NON-NLS-1$ //$NON-NLS-2$ + state.setPlatformProperties(platformProperties); EquinoxResolverHook resolverHook = new EquinoxResolverHook(state, environment); state.setResolverHookFactory(resolverHook); return resolverHook.resolve(mandatoryResources, optionalResources); |