use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BNDAnnotationTest method testTypeVersusDetailed.
public void testTypeVersusDetailed() throws Exception {
Builder b = builder("*.TypeVersusDetailed");
Document doc = doc(b, "xcomp");
print(doc, "");
assertAttribute(doc, "bind2", "component/reference[1]/@bind");
assertAttribute(doc, "dynamic", "component/reference[1]/@policy");
assertAttribute(doc, "0..n", "component/reference[1]/@cardinality");
assertAttribute(doc, "bind", "component/reference[2]/@bind");
assertAttribute(doc, "dynamic", "component/reference[2]/@policy");
assertAttribute(doc, "0..n", "component/reference[2]/@cardinality");
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BNDAnnotationTest method testAnnotationsStrangeBindMethods.
public void testAnnotationsStrangeBindMethods() throws Exception {
Builder b = builder("*MyComponent2");
Document doc = doc(b, "acomp");
assertEquals("addLogMultiple", xpath.evaluate("//@bind", doc));
assertEquals("", xpath.evaluate("//@unbind", doc));
assertAttribute(doc, "logMultiple", "scr:component/reference[1]/@name");
assertAttribute(doc, "addLogMultiple", "scr:component/reference[1]/@bind");
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BNDAnnotationTest method testConfigurationPolicy.
public void testConfigurationPolicy() throws Exception {
Builder b = builder("*.ConfigurationPolicyTest");
Document doc = doc(b, "cpcomp");
assertEquals("java.io.Serializable", doc.getElementsByTagName("provide").item(0).getAttributes().getNamedItem("interface").getTextContent());
assertEquals("org.osgi.service.event.EventAdmin", doc.getElementsByTagName("provide").item(1).getAttributes().getNamedItem("interface").getTextContent());
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BNDAnnotationTest method testMixedBndStandard.
public void testMixedBndStandard() throws Exception {
Builder b = builder("*MixedBndStd", 5, 0);
List<String> errors = new ArrayList<String>(b.getErrors());
Collections.sort(errors);
assertEquals("The DS component mixed-bnd-std uses bnd annotations to declare it as a component, but also uses the standard DS annotation: org.osgi.service.component.annotations.Activate on method start with signature ()V. It is an error to mix these two types of annotations", errors.get(0));
assertEquals("The DS component mixed-bnd-std uses bnd annotations to declare it as a component, but also uses the standard DS annotation: org.osgi.service.component.annotations.Deactivate on method stop with signature ()V. It is an error to mix these two types of annotations", errors.get(1));
assertEquals("The DS component mixed-bnd-std uses bnd annotations to declare it as a component, but also uses the standard DS annotation: org.osgi.service.component.annotations.Modified on method update with signature (Ljava/util/Map;)V. It is an error to mix these two types of annotations", errors.get(2));
assertEquals("The DS component mixed-bnd-std uses bnd annotations to declare it as a component, but also uses the standard DS annotation: org.osgi.service.component.annotations.Reference on field ea. It is an error to mix these two types of annotations", errors.get(3));
assertEquals("The DS component mixed-bnd-std uses bnd annotations to declare it as a component, but also uses the standard DS annotation: org.osgi.service.component.annotations.Reference on method setLog with signature (Lorg/osgi/service/log/LogService;)V. It is an error to mix these two types of annotations", errors.get(4));
}
use of aQute.bnd.osgi.Builder in project bnd by bndtools.
the class BNDAnnotationTest method testBrokenName.
public void testBrokenName() throws Exception {
Builder b = builder("*Broken*", 0, 2);
Jar build = b.getJar();
assertTrue(b.check("Invalid component name"));
Domain m = Domain.domain(build.getManifest());
Parameters parameters = m.getParameters("Service-Component");
assertEquals(2, parameters.size());
System.out.println(parameters);
assertTrue(parameters.keySet().contains("OSGI-INF/Hello-World-Bnd---------$.xml"));
assertTrue(parameters.keySet().contains("OSGI-INF/Hello-World.xml"));
}
Aggregations