Search in sources :

Example 11 with Reporter

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

the class StreamMetadataProviderTestCase method testWithEmptyMetadataXml.

public void testWithEmptyMetadataXml() throws Exception {
    File metadata = new File(new File("target", "test-classes"), "empty-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(0, meta.size());
    verify(reporter).warn(anyString());
}
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 12 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter 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 13 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter 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 14 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter 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 15 with Reporter

use of org.apache.felix.ipojo.manipulator.Reporter 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)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