Search in sources :

Example 6 with ComponentWorkbench

use of org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench in project felix by apache.

the class ComponentVisitorTestCase method testPublicFactoryDeprecationSupport.

public void testPublicFactoryDeprecationSupport() throws Exception {
    Reporter reporter = mock(Reporter.class);
    ComponentWorkbench workbench = new ComponentWorkbench(null, clazz());
    ComponentVisitor visitor = new ComponentVisitor(workbench, reporter);
    visitor.visit("public_factory", "false");
    visitor.visitEnd();
    Element root = workbench.getRoot();
    assertNotNull(root);
    assertEquals("false", root.getAttribute("public"));
}
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 7 with ComponentWorkbench

use of org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench in project felix by apache.

the class HandlerDeclarationVisitorTestCase method setUp.

@Override
public void setUp() throws Exception {
    reporter = mock(Reporter.class);
    workbench = new ComponentWorkbench(null, node());
    workbench.setRoot(new Element("container", null));
    visitor = new HandlerDeclarationVisitor(workbench, builder(), reporter);
}
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 ComponentWorkbench

use of org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench in project felix by apache.

the class MethodBindVisitorTestCase method testNoIdentifierAndNoSpecificationProvided.

public void testNoIdentifierAndNoSpecificationProvided() throws Exception {
    Reporter reporter = mock(Reporter.class);
    ComponentWorkbench workbench = new ComponentWorkbench(null, type());
    MethodNode node = new MethodNode();
    node.name = "notify";
    node.desc = "()V";
    MethodBindVisitor visitor = new MethodBindVisitor(workbench, Action.BIND, node, reporter);
    visitor.visitEnd();
    verify(reporter).error(anyString(), anyVararg());
}
Also used : MethodNode(org.objectweb.asm.tree.MethodNode) Reporter(org.apache.felix.ipojo.manipulator.Reporter) ComponentWorkbench(org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench)

Example 9 with ComponentWorkbench

use of org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench in project felix by apache.

the class MethodBindVisitorTestCase method testNoIdentifierButSpecificationAsAttributeProvided.

public void testNoIdentifierButSpecificationAsAttributeProvided() throws Exception {
    Reporter reporter = mock(Reporter.class);
    ComponentWorkbench workbench = new ComponentWorkbench(null, type());
    MethodNode node = new MethodNode();
    node.name = "notify";
    node.desc = "()V";
    MethodBindVisitor visitor = new MethodBindVisitor(workbench, Action.BIND, node, reporter);
    visitor.visit("specification", "my.Service");
    visitor.visitEnd();
    assertNotNull(workbench.getIds().get("my.Service"));
}
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)9 ComponentWorkbench (org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench)9 Element (org.apache.felix.ipojo.metadata.Element)6 MethodNode (org.objectweb.asm.tree.MethodNode)4 MethodBindVisitor (org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.MethodBindVisitor)1 ParameterBindVisitor (org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.ParameterBindVisitor)1 GenericVisitorFactory (org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory)1 AnnotationVisitorFactory (org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory)1 BindingContext (org.apache.felix.ipojo.manipulator.spi.BindingContext)1 AnnotationVisitor (org.objectweb.asm.AnnotationVisitor)1