コード例 #1
0
 @Test
 public void testResolveSingletonInDifferentRegions() throws BundleException {
   region(REGION_A).addBundle(bundle(BUNDLE_X));
   BundleCapability collision = bundleCapability(BUNDLE_X);
   List<BundleCapability> collisionCandidates = new ArrayList<BundleCapability>();
   collisionCandidates.add(collision);
   collisionCandidates.add(bundleCapability(BUNDLE_B));
   collisionCandidates.add(bundleCapability(BUNDLE_C));
   collisionCandidates.add(bundleCapability(BUNDLE_D));
   this.resolverHook.filterSingletonCollisions(bundleCapability(BUNDLE_A), collisionCandidates);
   assertEquals("Wrong number of collitions", 1, collisionCandidates.size());
   collisionCandidates.contains(collision);
 }
コード例 #2
0
 @Test
 public void testResolveSingletonConnectedRegions()
     throws BundleException, InvalidSyntaxException {
   RegionFilter filter = createBundleFilter(BUNDLE_B, BUNDLE_VERSION);
   region(REGION_A).connectRegion(region(REGION_B), filter);
   region(REGION_A).addBundle(bundle(BUNDLE_X));
   BundleCapability collisionX = bundleCapability(BUNDLE_X);
   BundleCapability collisionB = bundleCapability(BUNDLE_B);
   List<BundleCapability> collisionCandidates = new ArrayList<BundleCapability>();
   collisionCandidates.add(collisionX);
   collisionCandidates.add(collisionB);
   collisionCandidates.add(bundleCapability(BUNDLE_C));
   collisionCandidates.add(bundleCapability(BUNDLE_D));
   this.resolverHook.filterSingletonCollisions(bundleCapability(BUNDLE_A), collisionCandidates);
   assertEquals("Wrong number of collitions", 2, collisionCandidates.size());
   collisionCandidates.contains(collisionX);
   collisionCandidates.contains(collisionB);
 }