Search in sources :

Example 96 with Element

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

Example 97 with Element

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

Example 98 with Element

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

Example 99 with Element

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

Example 100 with Element

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);
}
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