use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class ManagedTypeTestCase method element.
private Element element(String type, String classname) {
Element root = new Element(type, null);
root.addAttribute(new Attribute("classname", classname));
return root;
}
use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class ProvidedServiceHandlerTest method testServiceDetectionSuperSuperClass.
public void testServiceDetectionSuperSuperClass() throws ConfigurationException {
String classname = "org.apache.felix.ipojo.handlers.providedservice.ComponentTestWithAnotherSuperClass";
Element metadata = new Element("component", "");
Element manipulation = new Element("manipulation", "");
metadata.addAttribute(new Attribute("classname", classname));
Element provides = new Element("provides", "");
provides.addAttribute(new Attribute("specifications", "java.beans.FeatureDescriptor"));
metadata.addElement(provides);
metadata.addElement(manipulation);
manipulation.addAttribute(new Attribute("classname", classname));
manipulation.addAttribute(new Attribute("super", "java.beans.MethodDescriptor"));
Mockito.when(factory.getPojoMetadata()).thenReturn(new PojoMetadata(metadata));
Mockito.when(factory.getClassName()).thenReturn(classname);
handler.initializeComponentFactory(desc, metadata);
System.out.println(metadata);
}
use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class MethodMetadataTest method testComputationForArraysUsingPrimitiveFromElement.
public void testComputationForArraysUsingPrimitiveFromElement() {
Element metadata1 = new Element("method", null);
metadata1.addAttribute(new Attribute("name", "withOneArray"));
metadata1.addAttribute(new Attribute("arguments", "{int[]}"));
Element metadata2 = new Element("method", null);
metadata2.addAttribute(new Attribute("name", "withOneArray"));
metadata2.addAttribute(new Attribute("arguments", "{int[][]}"));
Element metadata3 = new Element("method", null);
metadata3.addAttribute(new Attribute("name", "withOneArray"));
metadata3.addAttribute(new Attribute("arguments", "{int[][][]}"));
MethodMetadata methodMetadata1 = new MethodMetadata(metadata1);
Assert.assertEquals("withOneArray$int__", methodMetadata1.getMethodIdentifier());
MethodMetadata methodMetadata2 = new MethodMetadata(metadata2);
Assert.assertEquals("withOneArray$int____", methodMetadata2.getMethodIdentifier());
MethodMetadata methodMetadata3 = new MethodMetadata(metadata3);
Assert.assertEquals("withOneArray$int______", methodMetadata3.getMethodIdentifier());
}
use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class MethodMetadataTest method testComputationForArraysUsingObjectsFromElement.
public void testComputationForArraysUsingObjectsFromElement() {
Element metadata1 = new Element("method", null);
metadata1.addAttribute(new Attribute("name", "withOneArray"));
metadata1.addAttribute(new Attribute("arguments", "{java.lang.String[]}"));
Element metadata2 = new Element("method", null);
metadata2.addAttribute(new Attribute("name", "withOneArray"));
metadata2.addAttribute(new Attribute("arguments", "{java.lang.String[][]}"));
Element metadata3 = new Element("method", null);
metadata3.addAttribute(new Attribute("name", "withOneArray"));
metadata3.addAttribute(new Attribute("arguments", "{java.lang.String[][][]}"));
MethodMetadata methodMetadata1 = new MethodMetadata(metadata1);
Assert.assertEquals("withOneArray$java_lang_String__", methodMetadata1.getMethodIdentifier());
MethodMetadata methodMetadata2 = new MethodMetadata(metadata2);
Assert.assertEquals("withOneArray$java_lang_String____", methodMetadata2.getMethodIdentifier());
MethodMetadata methodMetadata3 = new MethodMetadata(metadata3);
Assert.assertEquals("withOneArray$java_lang_String______", methodMetadata3.getMethodIdentifier());
}
use of org.apache.felix.ipojo.metadata.Attribute in project felix by apache.
the class DependencyHandlerDescription method computeServiceReferenceDescription.
private void computeServiceReferenceDescription(ServiceReference ref, Element use) {
use.addAttribute(new Attribute(Constants.SERVICE_ID, ref.getProperty(Constants.SERVICE_ID).toString()));
String instance = (String) ref.getProperty(Factory.INSTANCE_NAME_PROPERTY);
if (instance != null) {
use.addAttribute(new Attribute(Factory.INSTANCE_NAME_PROPERTY, instance));
}
}
Aggregations