use of aQute.bnd.header.Parameters in project bnd by bndtools.
the class ContractTest method testSimple.
public void testSimple() throws Exception {
Jar bjar = getContractExporter("test", "2.5", "${exports}");
Builder a = newBuilder();
a.setTrace(true);
a.addClasspath(bjar);
a.setProperty(Constants.CONTRACT, "*");
a.setImportPackage("org.osgi.service.cm,*");
a.setProperty("Export-Package", "test.refer");
Jar ajar = a.build();
assertTrue(a.check());
Domain domain = Domain.domain(ajar.getManifest());
Parameters rc = domain.getRequireCapability();
rc.remove("osgi.ee");
System.out.println(rc);
assertEquals(1, rc.size());
Packages ps = a.getImports();
assertTrue(ps.containsFQN("org.osgi.service.cm"));
Attrs attrs = ps.getByFQN("org.osgi.service.cm");
assertNotNull(attrs);
assertNull(attrs.getVersion());
}
use of aQute.bnd.header.Parameters in project bnd by bndtools.
the class ContractTest method testWarningVersion.
/**
* Test the warnings that we have no no version
*
* @throws Exception
*/
public void testWarningVersion() throws Exception {
Jar bjara = getContractExporter("abc", (String[]) null, "${exports}");
Builder a = newBuilder();
a.setTrace(true);
a.addClasspath(bjara);
a.setProperty(Constants.CONTRACT, "*");
a.setImportPackage("test.packageinfo,*");
a.setProperty("Export-Package", "test.refer");
Jar ajar = a.build();
assertTrue(a.check("Contract \\[name=abc;version=0.0.0;from=biz.aQute.bndlib.tests] does not declare a version"));
Domain domain = Domain.domain(ajar.getManifest());
Parameters p = domain.getRequireCapability();
p.remove("osgi.ee");
assertEquals(0, p.size());
}
use of aQute.bnd.header.Parameters in project bnd by bndtools.
the class ContractTest method testMultiple.
public void testMultiple() throws Exception {
Jar bjar = getContractExporter("abc", new String[] { "2.5", "2.6", "3.0", "3.1" }, "${exports}");
Builder a = newBuilder();
a.setTrace(true);
a.addClasspath(bjar);
a.setProperty(Constants.CONTRACT, "*");
a.setImportPackage("org.osgi.service.cm,*");
a.setProperty("Export-Package", "test.refer");
Jar ajar = a.build();
assertTrue(a.check());
Domain domain = Domain.domain(ajar.getManifest());
Parameters rc = domain.getRequireCapability();
rc.remove("osgi.ee");
System.out.println(rc);
assertEquals(1, rc.size());
assertNotNull(rc);
assertEquals(1, rc.size());
Attrs attrs = rc.get("osgi.contract");
assertEquals("(&(osgi.contract=abc)(version=3.1.0))", attrs.get("filter:"));
}
use of aQute.bnd.header.Parameters in project bnd by bndtools.
the class UsesTest method checkUses.
private static void checkUses(String export, String uses) throws IOException, Exception {
Builder a = new Builder();
a.addClasspath(new File("bin"));
a.setExportPackage(export);
a.setProperty("build", "123");
Jar jar = a.build();
assertTrue(a.check());
Manifest m = jar.getManifest();
m.write(System.err);
Domain d = Domain.domain(m);
Parameters parameters = d.getExportPackage();
Attrs attrs = parameters.get(export);
assertNotNull(attrs);
assertEquals(uses, attrs.get("uses:"));
}
use of aQute.bnd.header.Parameters in project bnd by bndtools.
the class ResourceTest method testImportExportService.
public void testImportExportService() throws Exception {
ResourceBuilder rb = new ResourceBuilder();
rb.addImportServices(new Parameters(is));
rb.addExportServices(new Parameters(es));
Resource build = rb.build();
assertConfigAdminServices(build);
}
Aggregations