use of aQute.bnd.osgi.URLResource in project felix by apache.
the class BndJarResourceStoreTestCase method testAnalysisWithOnlyEmbedComponents.
public void testAnalysisWithOnlyEmbedComponents() throws Exception {
PojoizationPlugin plugin = new PojoizationPlugin();
Map<String, String> props = new HashMap<String, String>();
props.put("include-embed-bundles", "true");
Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST.MF"));
doReturn(dot).when(analyzer).getJar();
doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
analyzer.setClasspath(new Jar[] { embed });
plugin.setReporter(reporter);
plugin.setProperties(props);
plugin.analyzeJar(analyzer);
assertContains("instance { $component=\"org.apache.felix.ipojo.IPOJOURLHandler\" }", analyzer.getProperty("IPOJO-Components"));
}
use of aQute.bnd.osgi.URLResource in project felix by apache.
the class BndJarResourceStoreTestCase method testAnalysisWithBothLocalAndEmbedComponents.
public void testAnalysisWithBothLocalAndEmbedComponents() throws Exception {
PojoizationPlugin plugin = new PojoizationPlugin();
Map<String, String> props = new HashMap<String, String>();
props.put("include-embed-bundles", "true");
Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST.MF"));
Resource resource2 = new URLResource(getClass().getResource("/metadata-components-only.xml"));
doReturn(dot).when(analyzer).getJar();
doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
doReturn(resource2).when(dot).getResource(eq("META-INF/metadata.xml"));
analyzer.setClasspath(new Jar[] { embed });
plugin.setReporter(reporter);
plugin.setProperties(props);
plugin.analyzeJar(analyzer);
assertContains("instance { $component=\"org.apache.felix.ipojo.IPOJOURLHandler\" }", analyzer.getProperty("IPOJO-Components"));
assertContains("component { $class=\"com.acme.Thermometer\" }", analyzer.getProperty("IPOJO-Components"));
}
use of aQute.bnd.osgi.URLResource in project felix by apache.
the class PojoizationPluginTestCase method testAnalysisWithComponentsAndInstancesMetadataXml.
public void testAnalysisWithComponentsAndInstancesMetadataXml() throws Exception {
PojoizationPlugin plugin = new PojoizationPlugin();
Map<String, String> props = new HashMap<String, String>();
Resource resource = new URLResource(getClass().getResource("/metadata-components-and-instances.xml"));
doReturn(jar).when(analyzer).getJar();
doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));
plugin.setReporter(reporter);
plugin.setProperties(props);
plugin.analyzeJar(analyzer);
assertEquals("component { $class=\"com.acme.Thermometer\" }" + "instance { $component=\"com.acme.Thermometer\" }" + "instance { $component=\"com.acme.Thermometer\" }", analyzer.getProperty("IPOJO-Components"));
}
use of aQute.bnd.osgi.URLResource in project felix by apache.
the class PojoizationPluginTestCase method testAnalysisWithComponentOnlyMetadataXml.
public void testAnalysisWithComponentOnlyMetadataXml() throws Exception {
PojoizationPlugin plugin = new PojoizationPlugin();
Map<String, String> props = new HashMap<String, String>();
Resource resource = new URLResource(getClass().getResource("/metadata-components-only.xml"));
doReturn(jar).when(analyzer).getJar();
doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));
plugin.setReporter(reporter);
plugin.setProperties(props);
plugin.analyzeJar(analyzer);
assertEquals("component { $class=\"com.acme.Thermometer\" }", analyzer.getProperty("IPOJO-Components"));
}
use of aQute.bnd.osgi.URLResource in project felix by apache.
the class PojoizationPluginTestCase method testAnalysisWithInstanceOnlyMetadataXml.
public void testAnalysisWithInstanceOnlyMetadataXml() throws Exception {
PojoizationPlugin plugin = new PojoizationPlugin();
Map<String, String> props = new HashMap<String, String>();
Resource resource = new URLResource(getClass().getResource("/metadata-instances-only.xml"));
doReturn(jar).when(analyzer).getJar();
doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml"));
plugin.setReporter(reporter);
plugin.setProperties(props);
plugin.analyzeJar(analyzer);
assertEquals("instance { $component=\"com.acme.Thermometer\" }", analyzer.getProperty("IPOJO-Components"));
}
Aggregations