use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class PropertyTest method testConstructorParameter.
public void testConstructorParameter() {
Property prop = new Property().setConstructorParameter(1);
Element elem = prop.getElement();
assertEquals("1", elem.getAttribute("constructor-parameter"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class ServiceTest method testRegistrationCallbacks.
public void testRegistrationCallbacks() {
Service svc = new Service().setPostRegistrationCallback("registration").setPostUnregistrationCallback("unregistration");
Element elem = svc.getElement();
assertEquals("registration", elem.getAttribute("post-registration"));
assertEquals("unregistration", elem.getAttribute("post-unregistration"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class ServiceTest method testServiceController.
public void testServiceController() {
Service svc = new Service().setServiceController("m_controller", true);
Element elem = svc.getElement();
assertTrue(elem.getElements("controller").length == 1);
Element controller = elem.getElements("controller")[0];
assertEquals("m_controller", controller.getAttribute("field"));
assertEquals("true", controller.getAttribute("value"));
svc = new Service().setServiceController("m_controller", false);
elem = svc.getElement();
assertTrue(elem.getElements("controller").length == 1);
controller = elem.getElements("controller")[0];
assertEquals("m_controller", controller.getAttribute("field"));
assertEquals("false", controller.getAttribute("value"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class ExportedServiceTest method testAggregate.
// <comp:provides action="export"
// specification="org.apache.felix.ipojo.test.composite.service.BazService"
// aggregate="true" />
/**
* Tests aggregate export.
*/
public void testAggregate() {
ExportedService svc = new ExportedService().setSpecification("org.apache.felix.ipojo.test.composite.service.BazService").setAggregate(true);
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String agg = elem.getAttribute("aggregate");
assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.BazService", spec);
assertEquals("aggregate", "true", agg);
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class ExportedServiceTest method testOptionalAndAggregate.
// <comp:provides action="export"
// specification="org.apache.felix.ipojo.test.composite.service.BazService"
// aggregate="true" optional="true" />
/**
* Tests optional and aggregate export.
*/
public void testOptionalAndAggregate() {
ExportedService svc = new ExportedService().setSpecification("org.apache.felix.ipojo.test.composite.service.FooService").setOptional(true).setAggregate(true);
Element elem = svc.getElement();
String spec = elem.getAttribute("specification");
String opt = elem.getAttribute("optional");
String agg = elem.getAttribute("aggregate");
assertEquals("spec", "org.apache.felix.ipojo.test.composite.service.FooService", spec);
assertEquals("optional", "true", opt);
assertEquals("aggregate", "true", agg);
}
Aggregations