use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class DependencyTest method testFilter.
public void testFilter() {
Dependency dep = new Dependency().setField("field").setFilter("(my.prop=1)");
Element elem = dep.getElement();
assertEquals(null, elem.getAttribute("constructor-parameter"));
assertEquals("field", elem.getAttribute("field"));
assertEquals("(my.prop=1)", elem.getAttribute("filter"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class DependencyTest method testField.
public void testField() {
Dependency dep = new Dependency().setField("field");
Element elem = dep.getElement();
assertEquals(null, elem.getAttribute("constructor-parameter"));
assertEquals("field", elem.getAttribute("field"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class DependencyTest method testNullable.
public void testNullable() {
Dependency dep = new Dependency().setField("field").setOptional(true).setNullable(false);
Element elem = dep.getElement();
assertEquals(null, elem.getAttribute("constructor-parameter"));
assertEquals("field", elem.getAttribute("field"));
assertEquals("true", elem.getAttribute("optional"));
assertEquals("false", elem.getAttribute("nullable"));
dep = new Dependency().setField("field").setOptional(true).setNullable(true);
elem = dep.getElement();
assertEquals(null, elem.getAttribute("constructor-parameter"));
assertEquals("field", elem.getAttribute("field"));
assertEquals("true", elem.getAttribute("optional"));
// Default value.
assertEquals(null, elem.getAttribute("nullable"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class DependencyTest method testComparator.
public void testComparator() {
Dependency dep = new Dependency().setField("field").setComparator("my.Comparator");
Element elem = dep.getElement();
assertEquals(null, elem.getAttribute("constructor-parameter"));
assertEquals("field", elem.getAttribute("field"));
assertEquals("my.Comparator", elem.getAttribute("comparator"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class DependencyTest method testConstructorParameter.
public void testConstructorParameter() {
Dependency dep = new Dependency().setConstructorParameter(1);
Element elem = dep.getElement();
assertEquals("1", elem.getAttribute("constructor-parameter"));
}
Aggregations