use of org.apache.felix.ipojo.metadata.Element 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.metadata.Element 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.metadata.Element in project felix by apache.
the class HandlerDeclarationVisitorTestCase method testAttributeConversionWithNoNamespace.
public void testAttributeConversionWithNoNamespace() throws Exception {
visitor.visit(null, "<ns:testing xmlns:ns='org.apache.felix.ipojo.testing' name='Guillaume'/>");
visitor.visitEnd();
Element produced = workbench.build();
Element testing = produced.getElements("testing", "org.apache.felix.ipojo.testing")[0];
assertEquals(0, testing.getElements().length);
assertEquals(1, testing.getAttributes().length);
assertEquals("Guillaume", testing.getAttribute("name"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class HandlerDeclarationVisitorTestCase method testElementConversionWithNamespace.
public void testElementConversionWithNamespace() throws Exception {
visitor.visit(null, "<ns:testing xmlns:ns='org.apache.felix.ipojo.testing'/>");
visitor.visitEnd();
Element produced = workbench.build();
Element testing = produced.getElements("testing", "org.apache.felix.ipojo.testing")[0];
assertEquals(0, testing.getElements().length);
assertEquals(0, testing.getAttributes().length);
assertNotNull(produced.getElements("org.apache.felix.ipojo.testing:testing"));
assertNull(produced.getElements("testing"));
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class HandlerDeclarationVisitorTestCase method testAttributeConversionWithNamespace.
public void testAttributeConversionWithNamespace() throws Exception {
visitor.visit(null, "<ns:testing xmlns:ns='org.apache.felix.ipojo.testing' ns:name='Guillaume'/>");
visitor.visitEnd();
Element produced = workbench.build();
Element testing = produced.getElements("testing", "org.apache.felix.ipojo.testing")[0];
assertEquals(0, testing.getElements().length);
assertEquals(1, testing.getAttributes().length);
assertEquals("Guillaume", testing.getAttribute("name", "org.apache.felix.ipojo.testing"));
assertEquals("Guillaume", testing.getAttribute("org.apache.felix.ipojo.testing:name"));
}
Aggregations