Search in sources :

Example 86 with Element

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"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Example 87 with Element

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"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Example 88 with Element

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"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Example 89 with Element

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"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Example 90 with Element

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"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Aggregations

Element (org.apache.felix.ipojo.metadata.Element)400 Test (org.junit.Test)126 Attribute (org.apache.felix.ipojo.metadata.Attribute)109 ConfigurationException (org.apache.felix.ipojo.ConfigurationException)22 ParseException (org.apache.felix.ipojo.parser.ParseException)14 PojoMetadata (org.apache.felix.ipojo.parser.PojoMetadata)14 ArrayList (java.util.ArrayList)13 Reporter (org.apache.felix.ipojo.manipulator.Reporter)12 FieldMetadata (org.apache.felix.ipojo.parser.FieldMetadata)12 Dictionary (java.util.Dictionary)10 Properties (java.util.Properties)10 MethodMetadata (org.apache.felix.ipojo.parser.MethodMetadata)10 BaseTest (org.ow2.chameleon.testing.helpers.BaseTest)10 PropertyDescription (org.apache.felix.ipojo.architecture.PropertyDescription)9 IOException (java.io.IOException)8 List (java.util.List)8 Before (org.junit.Before)7 Enumeration (java.util.Enumeration)6 ComponentWorkbench (org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench)6 FooService (org.apache.felix.ipojo.runtime.core.services.FooService)6