ApplicationRepository implements BundleRepository { public BundleSuggestion suggestBundleToUse(DeploymentContent content) { BundleInfo bundleInfo = null; if ((app.getBundleInfo() != null) && (!app.getBundleInfo().isEmpty())) { for (BundleInfo bi : app.getBundleInfo()) { if (bi.getSymbolicName().equals(content.getContentName()) && (bi.getVersion().equals(content.getVersion().getExactVersion()))) { bundleInfo = bi; break; } } } if (bundleInfo != null) { return new BundleSuggestionImpl(bundleInfo); } else { return null; } } ApplicationRepository(AriesApplication app); int getCost(); BundleSuggestion suggestBundleToUse(DeploymentContent content);  }
@Test public void testBundleNotInApp() { AriesApplication app = Skeleton.newMock(AriesApplication.class); BundleInfo bi = Skeleton.newMock(BundleInfo.class); Skeleton.getSkeleton(bi).setReturnValue(new MethodCall(BundleInfo.class, "getSymbolicName"), "test.bundle"); Skeleton.getSkeleton(bi).setReturnValue(new MethodCall(BundleInfo.class, "getVersion"), new Version("1.0.0")); Skeleton.getSkeleton(app).setReturnValue( new MethodCall(AriesApplication.class, "getBundleInfo"), new HashSet<BundleInfo>()); ApplicationRepository rep = new ApplicationRepository(app); BundleSuggestion sug = rep.suggestBundleToUse(new DeploymentContentImpl("test.bundle", new Version("2.0.0"))); assertNull("We have apparently found a bundle that is not in the application in the ApplicationRepository", sug); }