Search in sources :

Example 91 with Element

use of org.apache.felix.ipojo.metadata.Element in project felix by apache.

the class DependencyTest method testId.

public void testId() {
    Dependency dep = new Dependency().setField("field").setId("foo");
    Element elem = dep.getElement();
    assertEquals(null, elem.getAttribute("constructor-parameter"));
    assertEquals("field", elem.getAttribute("field"));
    assertEquals("foo", elem.getAttribute("id"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Example 92 with Element

use of org.apache.felix.ipojo.metadata.Element in project felix by apache.

the class DependencyTest method testOptional.

public void testOptional() {
    Dependency dep = new Dependency().setField("field").setOptional(true);
    Element elem = dep.getElement();
    assertEquals(null, elem.getAttribute("constructor-parameter"));
    assertEquals("field", elem.getAttribute("field"));
    assertEquals("true", elem.getAttribute("optional"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Example 93 with Element

use of org.apache.felix.ipojo.metadata.Element in project felix by apache.

the class DependencyTest method testAggregate.

public void testAggregate() {
    Dependency dep = new Dependency().setField("field").setAggregate(true);
    Element elem = dep.getElement();
    assertEquals(null, elem.getAttribute("constructor-parameter"));
    assertEquals("field", elem.getAttribute("field"));
    assertEquals("true", elem.getAttribute("aggregate"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Example 94 with Element

use of org.apache.felix.ipojo.metadata.Element in project felix by apache.

the class PropertyTest method testMandatoryPropertyWithValue.

public void testMandatoryPropertyWithValue() {
    Property prop = new Property().setField("field").setMandatory(true).setName("prop").setValue("foo").setImmutable(true);
    Element elem = prop.getElement();
    assertEquals(null, elem.getAttribute("constructor-parameter"));
    assertEquals("field", elem.getAttribute("field"));
    assertEquals("prop", elem.getAttribute("name"));
    assertEquals("foo", elem.getAttribute("value"));
    assertEquals("true", elem.getAttribute("mandatory"));
    assertEquals("true", elem.getAttribute("immutable"));
}
Also used : Element(org.apache.felix.ipojo.metadata.Element)

Example 95 with Element

use of org.apache.felix.ipojo.metadata.Element in project felix by apache.

the class PropertyTest method testField.

public void testField() {
    Property prop = new Property().setField("field");
    Element elem = prop.getElement();
    assertEquals(null, elem.getAttribute("constructor-parameter"));
    assertEquals("field", elem.getAttribute("field"));
}
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