use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class FileMetadataProviderTestCase method testGetMetadatasFromDirectory.
public void testGetMetadatasFromDirectory() throws Exception {
File metadata = new File("target", "test-classes");
Reporter reporter = mock(Reporter.class);
FileMetadataProvider provider = new FileMetadataProvider(metadata, reporter);
provider.setValidateUsingLocalSchemas(true);
List<Element> meta = provider.getMetadatas();
assertEquals(3, meta.size());
}
use of org.apache.felix.ipojo.metadata.Element 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.metadata.Element in project felix by apache.
the class ComponentWorkbenchTestCase method testBuildWithNoTopLevelElements.
public void testBuildWithNoTopLevelElements() throws Exception {
ComponentWorkbench workbench = new ComponentWorkbench(null, node());
Element built = workbench.build();
assertNull(built);
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class ComponentWorkbenchTestCase method testElementsAreHierarchicallyPlaced.
public void testElementsAreHierarchicallyPlaced() throws Exception {
Element root = new Element("root", null);
Element child = new Element("child", null);
ComponentWorkbench workbench = new ComponentWorkbench(null, node());
workbench.setRoot(root);
workbench.getElements().put(child, null);
Element built = workbench.build();
assertEquals("root", built.getName());
assertNull(built.getNameSpace());
assertEquals(0, built.getAttributes().length);
assertEquals(1, built.getElements().length);
Element builtChild = built.getElements("child")[0];
assertEquals("child", builtChild.getName());
assertNull(builtChild.getNameSpace());
assertEquals(0, builtChild.getAttributes().length);
assertEquals(0, builtChild.getElements().length);
}
use of org.apache.felix.ipojo.metadata.Element 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"));
}
Aggregations