use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class AnnotationMetadataProviderTestCase method testGetMetadatas.
public void testGetMetadatas() throws Exception {
MiniStore store = new MiniStore(AnnotatedComponent.class, FakeAnnotation.class);
Reporter reporter = mock(Reporter.class);
AnnotationMetadataProvider provider = new AnnotationMetadataProvider(store, reporter);
List<Element> meta = provider.getMetadatas();
assertEquals(1, meta.size());
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class CompositeMetadataProviderTestCase method newComponentElement.
private Element newComponentElement(String type) {
Element main = new Element("component", null);
main.addAttribute(new Attribute("name", type));
return main;
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class CompositeMetadataProviderTestCase method newInstanceElement.
private Element newInstanceElement(String type, String name) {
Element main = new Element("instance", null);
main.addAttribute(new Attribute("component", type));
main.addAttribute(new Attribute("name", name));
return main;
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class CompositeMetadataProviderTestCase method testGetMetadatasWithInstances.
public void testGetMetadatasWithInstances() throws Exception {
CompositeMetadataProvider provider = new CompositeMetadataProvider(reporter);
provider.addMetadataProvider(delegate1);
provider.addMetadataProvider(delegate2);
Element returned = newInstanceElement("type1", "name1");
when(delegate1.getMetadatas()).thenReturn(Collections.singletonList(returned));
// Try with a duplicate instance name
Element returned2 = newInstanceElement("type1", "name2");
when(delegate2.getMetadatas()).thenReturn(Collections.singletonList(returned2));
List<Element> meta = provider.getMetadatas();
assertEquals(2, meta.size());
}
use of org.apache.felix.ipojo.metadata.Element in project felix by apache.
the class FileMetadataProviderTestCase method testGetMetadatasFromFile.
public void testGetMetadatasFromFile() throws Exception {
File metadata = new File(new File("target", "test-classes"), "metadata.xml");
Reporter reporter = mock(Reporter.class);
FileMetadataProvider provider = new FileMetadataProvider(metadata, reporter);
provider.setValidateUsingLocalSchemas(true);
List<Element> meta = provider.getMetadatas();
assertEquals(3, meta.size());
}
Aggregations