Search in sources :

Example 6 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter in project felix by apache.

the class StreamMetadataProviderTestCase method testGetMetadatas.

public void testGetMetadatas() throws Exception {
    File metadata = new File(new File("target", "test-classes"), "metadata.xml");
    FileInputStream fis = new FileInputStream(metadata);
    Reporter reporter = mock(Reporter.class);
    StreamMetadataProvider provider = new StreamMetadataProvider(fis, reporter);
    provider.setValidateUsingLocalSchemas(true);
    List<Element> meta = provider.getMetadatas();
    assertEquals(3, meta.size());
}
Also used : Reporter(org.apache.felix.ipojo.manipulator.Reporter) Element(org.apache.felix.ipojo.metadata.Element) File(java.io.File) FileInputStream(java.io.FileInputStream)

Example 7 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter in project felix by apache.

the class ComponentVisitorTestCase method testFactoryMethodDeprecationSupport.

public void testFactoryMethodDeprecationSupport() throws Exception {
    Reporter reporter = mock(Reporter.class);
    ComponentWorkbench workbench = new ComponentWorkbench(null, clazz());
    ComponentVisitor visitor = new ComponentVisitor(workbench, reporter);
    visitor.visit("factory_method", "create");
    visitor.visitEnd();
    Element root = workbench.getRoot();
    assertNotNull(root);
    assertEquals("create", root.getAttribute("factory-method"));
}
Also used : Reporter(org.apache.felix.ipojo.manipulator.Reporter) Element(org.apache.felix.ipojo.metadata.Element) ComponentWorkbench(org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench)

Example 8 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter in project felix by apache.

the class ComponentVisitorTestCase method testNameAttribute.

public void testNameAttribute() throws Exception {
    Reporter reporter = mock(Reporter.class);
    ComponentWorkbench workbench = new ComponentWorkbench(null, clazz());
    ComponentVisitor visitor = new ComponentVisitor(workbench, reporter);
    visitor.visit("name", "changed");
    visitor.visitEnd();
    Element root = workbench.getRoot();
    assertNotNull(root);
    assertEquals("changed", root.getAttribute("name"));
}
Also used : Reporter(org.apache.felix.ipojo.manipulator.Reporter) Element(org.apache.felix.ipojo.metadata.Element) ComponentWorkbench(org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench)

Example 9 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter in project felix by apache.

the class ComponentVisitorTestCase method testDefaultNameIsClassname.

public void testDefaultNameIsClassname() throws Exception {
    Reporter reporter = mock(Reporter.class);
    ComponentWorkbench workbench = new ComponentWorkbench(null, clazz());
    ComponentVisitor visitor = new ComponentVisitor(workbench, reporter);
    visitor.visitEnd();
    Element root = workbench.getRoot();
    assertNotNull(root);
    assertEquals("my.Component", root.getAttribute("name"));
}
Also used : Reporter(org.apache.felix.ipojo.manipulator.Reporter) Element(org.apache.felix.ipojo.metadata.Element) ComponentWorkbench(org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench)

Example 10 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter in project felix by apache.

the class MethodBindVisitorTestCase method testIdentifierProvided.

public void testIdentifierProvided() throws Exception {
    Reporter reporter = mock(Reporter.class);
    ComponentWorkbench workbench = new ComponentWorkbench(null, type());
    MethodNode node = new MethodNode();
    node.name = "myMethod";
    MethodBindVisitor visitor = new MethodBindVisitor(workbench, Action.BIND, node, reporter);
    visitor.visit("id", "my-identifier");
    visitor.visitEnd();
    assertNotNull(workbench.getIds().get("my-identifier"));
}
Also used : MethodNode(org.objectweb.asm.tree.MethodNode) Reporter(org.apache.felix.ipojo.manipulator.Reporter) ComponentWorkbench(org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench)

Aggregations

Reporter (org.apache.felix.ipojo.manipulator.Reporter)17 Element (org.apache.felix.ipojo.metadata.Element)12 ComponentWorkbench (org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench)9 File (java.io.File)7 MethodNode (org.objectweb.asm.tree.MethodNode)4 FileInputStream (java.io.FileInputStream)2 Pojoization (org.apache.felix.ipojo.manipulator.Pojoization)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 MalformedURLException (java.net.MalformedURLException)1 URL (java.net.URL)1 LinkedHashSet (java.util.LinkedHashSet)1 JarFile (java.util.jar.JarFile)1 ResourceStore (org.apache.felix.ipojo.manipulator.ResourceStore)1 AnnotationMetadataProvider (org.apache.felix.ipojo.manipulator.metadata.AnnotationMetadataProvider)1 CompositeMetadataProvider (org.apache.felix.ipojo.manipulator.metadata.CompositeMetadataProvider)1 FileMetadataProvider (org.apache.felix.ipojo.manipulator.metadata.FileMetadataProvider)1 MethodBindVisitor (org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.MethodBindVisitor)1 ParameterBindVisitor (org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.ParameterBindVisitor)1