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());
}
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"));
}
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"));
}
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"));
}
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"));
}
Aggregations