use of biz.aQute.resolve.ResolverValidator in project bnd by bndtools.
the class ResolveCommand method _validate.
public void _validate(ValidateOptions options) throws Exception {
ResourceBuilder system = new ResourceBuilder();
system.addEE(options.ee(EE.JavaSE_1_8));
if (options.core() != null)
system.addManifest(options.core().getManifest());
if (options.packages() != null)
system.addExportPackages(options.packages());
if (options.capabilities() != null)
system.addProvideCapabilities(options.capabilities());
if (options.system() != null) {
File f = IO.getFile(options.system());
if (!f.isFile()) {
error("Specified system file but not found: %s", f);
return;
}
Domain domain = Domain.domain(f);
system.addManifest(domain);
}
List<String> args = options._arguments();
File index = getFile(args.remove(0));
logger.debug("validating {}", index);
ResolverValidator validator = new ResolverValidator(bnd);
validator.use(bnd);
validator.addRepository(index.toURI());
validator.setSystem(system.build());
List<Resolution> result = validator.validate();
Set<Requirement> done = new HashSet<>();
for (Resolution res : result) {
if (options.all()) {
bnd.out.format("%s %-60s%n", res.succeeded ? "OK" : "**", res.resource, res.message == null ? "" : res.message);
}
if (!res.succeeded) {
for (Requirement req : res.missing) {
if (done.contains(req))
continue;
bnd.out.format(" missing %s%n", req);
done.add(req);
}
if (options.all()) {
for (Requirement req : res.repos) {
bnd.out.format(" repos %s%n", req);
}
for (Requirement req : res.system) {
bnd.out.format(" system %s%n", req);
}
for (Requirement req : res.optionals) {
bnd.out.format(" optional %s%n", req);
}
}
}
}
bnd.getInfo(validator);
}
use of biz.aQute.resolve.ResolverValidator in project bnd by bndtools.
the class HugeRepositoryTest method testHugeWithSpecificResourcesAndDuplication.
public void testHugeWithSpecificResourcesAndDuplication() throws Exception {
try (ResolverValidator validator = new ResolverValidator()) {
ResourceBuilder resourceBuilder = new ResourceBuilder();
resourceBuilder.addEE(EE.JavaSE_1_7);
resourceBuilder.addManifest(OSGI_CORE.R6_0_0.getManifest());
validator.setSystem(resourceBuilder.build());
validator.setTrace(true);
validator.addRepository(IO.getFile("testdata/collaboration-1.0-index.xml.gz").toURI());
validator.addRepository(IO.getFile("testdata/forms-and-workflow-1.0-index.xml.gz").toURI());
validator.addRepository(IO.getFile("testdata/foundation-1.0-index.xml.gz").toURI());
validator.addRepository(IO.getFile("testdata/target.platform.index.xml.gz").toURI());
validator.addRepository(IO.getFile("testdata/web-experience-1.0-index.xml.gz").toURI());
List<Resource> resources = XMLResourceParser.getResources(IO.getFile("testdata/foundation-1.0-index.xml.gz").toURI());
List<Resolution> resolutions = validator.validate(resources);
assertTrue(validator.check());
assertEquals(resources.size(), resolutions.size());
}
}
use of biz.aQute.resolve.ResolverValidator in project bnd by bndtools.
the class HugeRepositoryTest method testHugeWithSpecificResources.
public void testHugeWithSpecificResources() throws Exception {
try (ResolverValidator validator = new ResolverValidator()) {
ResourceBuilder system = new ResourceBuilder();
system.addEE(EE.JavaSE_1_7);
system.addManifest(OSGI_CORE.R6_0_0.getManifest());
validator.setSystem(system.build());
validator.setTrace(true);
validator.addRepository(IO.getFile("testdata/collaboration-1.0-index.xml.gz").toURI());
validator.addRepository(IO.getFile("testdata/forms-and-workflow-1.0-index.xml.gz").toURI());
validator.addRepository(IO.getFile("testdata/foundation-1.0-index.xml.gz").toURI());
validator.addRepository(IO.getFile("testdata/target.platform.index.xml.gz").toURI());
List<Resource> resources = XMLResourceParser.getResources(IO.getFile("testdata/web-experience-1.0-index.xml.gz").toURI());
List<Resolution> resolutions = validator.validate(resources);
assertTrue(validator.check());
assertEquals(resources.size(), resolutions.size());
}
}
Aggregations