use of org.osgi.service.resolver.Resolver in project bnd by bndtools.
the class ResolveTest method testSimpleResolve.
/**
* This is a basic test of resolving. This test is paired with
* {@link #testResolveWithDistro()}. If you change the resources, make sure
* this is done in the same way. The {@link #testResolveWithDistro()} has a
* negative check while this one checks positive.
*/
public void testSimpleResolve() {
MockRegistry registry = new MockRegistry();
registry.addPlugin(createRepo(IO.getFile("testdata/repo3.index.xml")));
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());
model.setRunRequires(requires);
BndrunResolveContext context = new BndrunResolveContext(model, registry, log);
Resolver resolver = new BndResolver(new ResolverLogger(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.10");
assertNotNull(resource);
} catch (ResolutionException e) {
fail("Resolve failed");
}
}
Aggregations