Search in sources :

Example 86 with Attribute

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

the class ManipulatedMetadataFilterTestCase method testFilterInstanceManagerSetter.

public void testFilterInstanceManagerSetter() throws Exception {
    Element main = new Element("test", null);
    main.addAttribute(new Attribute("name", "_setInstanceManager"));
    Assert.assertTrue(filter.accept(main));
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 87 with Attribute

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

the class ManipulatedMetadataFilterTestCase method testFilterInstanceManagerValue.

public void testFilterInstanceManagerValue() throws Exception {
    Element main = new Element("test", null);
    main.addAttribute(new Attribute("name", InstanceManager.class.getName()));
    Assert.assertTrue(filter.accept(main));
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 88 with Attribute

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

the class ManipulatedMetadataFilterTestCase method testFilterPrefixedMethod.

public void testFilterPrefixedMethod() throws Exception {
    Element main = new Element("test", null);
    main.addAttribute(new Attribute("name", ClassManipulator.PREFIX + "PropertyName"));
    Assert.assertTrue(filter.accept(main));
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 89 with Attribute

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

the class CheckFieldConsistencyResultVisitorTestCase method newManipulationElement.

private Element newManipulationElement(boolean complete) {
    Element manipulation = new Element("manipulation", null);
    if (complete) {
        Element field = new Element("field", null);
        field.addAttribute(new Attribute("name", "property"));
        manipulation.addElement(field);
    }
    return manipulation;
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Example 90 with Attribute

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

the class Service method getElement.

/**
 * Gets the provided service element.
 * @return the 'provides' element.
 */
public Element getElement() {
    ensureValidity();
    Element element = new Element("provides", "");
    if (m_specifications != null) {
        element.addAttribute(new Attribute("specifications", getSpecificationsArray()));
    }
    element.addAttribute(new Attribute("strategy", getStringStrategy()));
    for (int i = 0; i < m_properties.size(); i++) {
        element.addElement(((ServiceProperty) m_properties.get(i)).getElement());
    }
    if (m_controller != null) {
        Element ctrl = new Element("controller", "");
        ctrl.addAttribute(new Attribute("field", m_controller));
        ctrl.addAttribute(new Attribute("value", String.valueOf(m_controllerValue)));
        element.addElement(ctrl);
    }
    if (m_postRegistrationCallback != null) {
        element.addAttribute(new Attribute("post-registration", m_postRegistrationCallback));
    }
    if (m_postUnregistrationCallback != null) {
        element.addAttribute(new Attribute("post-unregistration", m_postUnregistrationCallback));
    }
    return element;
}
Also used : Attribute(org.apache.felix.ipojo.metadata.Attribute) Element(org.apache.felix.ipojo.metadata.Element)

Aggregations

Attribute (org.apache.felix.ipojo.metadata.Attribute)125 Element (org.apache.felix.ipojo.metadata.Element)109 Test (org.junit.Test)9 PojoMetadata (org.apache.felix.ipojo.parser.PojoMetadata)6 Iterator (java.util.Iterator)4 Enumeration (java.util.Enumeration)3 Map (java.util.Map)3 Set (java.util.Set)3 ServiceReference (org.osgi.framework.ServiceReference)3 List (java.util.List)2 Entry (java.util.Map.Entry)2 PropertyDescription (org.apache.felix.ipojo.architecture.PropertyDescription)2 FieldMetadata (org.apache.felix.ipojo.parser.FieldMetadata)2 MethodMetadata (org.apache.felix.ipojo.parser.MethodMetadata)2 Type (org.objectweb.asm.Type)2 Member (java.lang.reflect.Member)1 ArrayList (java.util.ArrayList)1 Properties (java.util.Properties)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ExecutorService (java.util.concurrent.ExecutorService)1