Search in sources :

Example 1 with URLResource

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"));
}
Also used : URLResource(aQute.bnd.osgi.URLResource) HashMap(java.util.HashMap) Resource(aQute.bnd.osgi.Resource) URLResource(aQute.bnd.osgi.URLResource)

Example 2 with URLResource

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"));
}
Also used : URLResource(aQute.bnd.osgi.URLResource) HashMap(java.util.HashMap) Resource(aQute.bnd.osgi.Resource) URLResource(aQute.bnd.osgi.URLResource)

Example 3 with URLResource

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"));
}
Also used : URLResource(aQute.bnd.osgi.URLResource) HashMap(java.util.HashMap) Resource(aQute.bnd.osgi.Resource) URLResource(aQute.bnd.osgi.URLResource)

Example 4 with URLResource

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"));
}
Also used : URLResource(aQute.bnd.osgi.URLResource) HashMap(java.util.HashMap) Resource(aQute.bnd.osgi.Resource) URLResource(aQute.bnd.osgi.URLResource)

Example 5 with URLResource

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"));
}
Also used : URLResource(aQute.bnd.osgi.URLResource) HashMap(java.util.HashMap) Resource(aQute.bnd.osgi.Resource) URLResource(aQute.bnd.osgi.URLResource)

Aggregations

URLResource (aQute.bnd.osgi.URLResource)10 Resource (aQute.bnd.osgi.Resource)7 HashMap (java.util.HashMap)7 FileResource (aQute.bnd.osgi.FileResource)3 File (java.io.File)3 EmbeddedResource (aQute.bnd.osgi.EmbeddedResource)2 Jar (aQute.bnd.osgi.Jar)2 ArrayList (java.util.ArrayList)2 Manifest (java.util.jar.Manifest)2 Container (aQute.bnd.build.Container)1 Attrs (aQute.bnd.header.Attrs)1 Parameters (aQute.bnd.header.Parameters)1 Analyzer (aQute.bnd.osgi.Analyzer)1 Builder (aQute.bnd.osgi.Builder)1 Clazz (aQute.bnd.osgi.Clazz)1 Instructions (aQute.bnd.osgi.Instructions)1 LauncherConstants (aQute.launcher.constants.LauncherConstants)1 UTF8Properties (aQute.lib.utf8properties.UTF8Properties)1 EmbeddedActivator (aQute.remote.embedded.activator.EmbeddedActivator)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1