public void testUnresolved() throws ResolutionException { Repository repo = ws.getPlugin(Repository.class); BndEditModel model = new BndEditModel(); model.setRunFw("org.apache.felix.framework"); List<Requirement> requires = new ArrayList<Requirement>(); CapReqBuilder capReq = CapReqBuilder.createBundleRequirement("org.apache.felix.webconsole", "[4,5)"); requires.add(capReq.buildSyntheticRequirement()); Map<Requirement, Collection<Capability>> shell = repo.findProviders(requires); assertNotNull(shell); assertEquals(1, shell.size()); model.setRunRequires(requires); BndrunResolveContext context = new BndrunResolveContext(model, ws, log); Resolver resolver = new BndResolver(new org.apache.felix.resolver.Logger(4)); try { Map<Resource, List<Wire>> resolved = resolver.resolve(context); fail("Resolve did not fail"); } catch (ResolutionException e) { assertEquals(1, e.getUnresolvedRequirements().size()); ResolutionException augmented = ResolveProcess.augment(context, e); assertEquals(2, augmented.getUnresolvedRequirements().size()); } }
public void testSimpleResolve() { Repository repo = ws.getPlugin(Repository.class); BndEditModel model = new BndEditModel(); model.setRunFw("org.apache.felix.framework"); List<Requirement> requires = new ArrayList<Requirement>(); CapReqBuilder capReq = CapReqBuilder.createBundleRequirement("org.apache.felix.gogo.shell", "[0,1)"); requires.add(capReq.buildSyntheticRequirement()); Map<Requirement, Collection<Capability>> shell = repo.findProviders(requires); assertNotNull(shell); assertEquals(1, shell.size()); model.setRunRequires(requires); BndrunResolveContext context = new BndrunResolveContext(model, ws, log); Resolver resolver = new BndResolver(new org.apache.felix.resolver.Logger(4)); try { Map<Resource, List<Wire>> resolved = resolver.resolve(context); Set<Resource> resources = resolved.keySet(); Resource resource = getResource(resources, "org.apache.felix.gogo.runtime", "0.12"); assertNotNull(resource); } catch (ResolutionException e) { fail("Resolve failed"); } }
public void testScr() { Repository repo = ws.getPlugin(Repository.class); BndEditModel model = new BndEditModel(); model.setRunFw("org.apache.felix.framework"); List<Requirement> requires = new ArrayList<Requirement>(); CapReqBuilder capReq = CapReqBuilder.createSimpleRequirement("osgi.extender", "osgi.component", "[1.1,2)"); requires.add(capReq.buildSyntheticRequirement()); Map<Requirement, Collection<Capability>> shell = repo.findProviders(requires); assertNotNull(shell); assertEquals(1, shell.size()); }