Package aQute.bnd.osgi

Examples of aQute.bnd.osgi.URLResource


        // Set the Main-Class
        Manifest manifest = new Manifest();
        manifest.getMainAttributes().putValue("Main-Class", "launch");
        launcherJar.setManifest(manifest);
        launcherJar.putResource("launch.class", new URLResource(ExecutableJarExportWizard.class.getResource("launch.clazz")));

        try {
            launcherJar.write(new File(folder, "launch.jar"));
        } catch (Exception e) {
            status.add(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Error generating launch JAR.", e));
View Full Code Here


        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);
View Full Code Here

    public void testAnalysisWithExcludedEmbedComponents() throws Exception {
        PojoizationPlugin plugin = new PojoizationPlugin();

        Map<String, String> props = new HashMap<String, String>();

        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);
View Full Code Here

        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});
View Full Code Here

        Map<String, String> props = new HashMap<String, String>();
        props.put("include-embed-bundles", "true");
        String path = EmptyComponent.class.getName().replace('.', '/').concat(".class");

        Resource resource2 = new URLResource(getClass().getResource("/metadata-test-component.xml"));
        doReturn(dot).when(analyzer).getJar();
        doReturn(resource2).when(dot).getResource(eq("META-INF/metadata.xml"));

        Collection<Clazz> classes = new ArrayList<Clazz>();
        Resource typeResource = new URLResource(getClass().getResource("EmptyComponent.class"));
        Clazz clazz = new Clazz(analyzer, path, typeResource);
        clazz.parseClassFile();
        classes.add(clazz);
        doReturn(classes).when(analyzer).getClasses(Matchers.<String[]>anyVararg());

        Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST-EMPTY.MF"));
        doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF"));
        doReturn(typeResource).when(embed).getResource(path);
        doReturn("aaa").when(embed).getBsn();

        analyzer.setClasspath(new Jar[] {embed});
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

    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);
View Full Code Here

    protected static Resource toResource(Object value) {
        if (value instanceof File) {
            return new FileResource((File) value);
        } else if (value instanceof URL) {
            return new URLResource((URL) value);
        } else {
            throw new IllegalArgumentException("Cannot convert value " + value + " into a Resource. Expected File or URL");
        }
    }
View Full Code Here

TOP

Related Classes of aQute.bnd.osgi.URLResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.