Search in sources :

Example 21 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class ProjectTest method testBumpIncludeFile.

public void testBumpIncludeFile() throws Exception {
    Workspace ws = getWorkspace("testresources/ws");
    Project project = ws.getProject("bump-included");
    project.setTrace(true);
    Version old = new Version(project.getProperty("Bundle-Version"));
    assertEquals(new Version(1, 0, 0), old);
    project.bump("=+0");
    Processor processor = new Processor();
    processor.setProperties(project.getFile("include.txt"));
    Version newv = new Version(processor.getProperty("Bundle-Version"));
    System.err.println("New version " + newv);
    assertEquals(1, newv.getMajor());
    assertEquals(1, newv.getMinor());
    assertEquals(0, newv.getMicro());
}
Also used : Project(aQute.bnd.build.Project) Processor(aQute.bnd.osgi.Processor) Version(aQute.bnd.version.Version) Workspace(aQute.bnd.build.Workspace)

Example 22 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class ProjectTest method testClasspath.

public void testClasspath() throws Exception {
    File project = new File("").getAbsoluteFile();
    File workspace = project.getParentFile();
    Processor processor = new Processor();
    EclipseClasspath p = new EclipseClasspath(processor, workspace, project);
    System.err.println(p.getDependents());
    System.err.println(p.getClasspath());
    System.err.println(p.getSourcepath());
    System.err.println(p.getOutput());
}
Also used : Processor(aQute.bnd.osgi.Processor) EclipseClasspath(aQute.bnd.osgi.eclipse.EclipseClasspath) File(java.io.File)

Example 23 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class PluginTest method testPluginInheritance.

public void testPluginInheritance() throws IOException {
    Processor top = new Processor();
    Processor middle = new Processor(top);
    Processor bottom = new Processor(middle);
    top.setProperty("-plugin.top", Foo.class.getName() + ";l=top");
    middle.setProperty("-plugin.middle", Foo.class.getName() + ";l=middle");
    assertEquals(1, top.getPlugins(Foo.class).size());
    assertEquals(2, middle.getPlugins(Foo.class).size());
    assertEquals(2, bottom.getPlugins(Foo.class).size());
    assertEquals(top.getPlugin(Foo.class), bottom.getPlugin(Foo.class));
    assertTrue(top.check());
    assertTrue(middle.check());
    assertTrue(bottom.check());
}
Also used : Processor(aQute.bnd.osgi.Processor)

Example 24 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class ProcessorTest method testUnknownOsname.

public void testUnknownOsname() throws Exception {
    try (Processor p = new Processor()) {
        assertNative("osname=Beos;osversion=2.3;processor=FOO;processor=BLA", "(&(osgi.native.osname~=beos))");
        fail("Expected failure because we use an unknown name");
    } catch (IllegalArgumentException e) {
    // ok
    }
}
Also used : Processor(aQute.bnd.osgi.Processor)

Example 25 with Processor

use of aQute.bnd.osgi.Processor in project bnd by bndtools.

the class ProcessorTest method testUriMacro.

public void testUriMacro() throws Exception {
    try (Processor p = new Processor()) {
        String baseURI = p.getBaseURI().toString();
        String otherURI = new URI("file:/some/dir/").toString();
        p.setProperty("uri1", "${uri;dist/bundles}");
        p.setProperty("uri2", "${uri;/dist/bundles}");
        p.setProperty("uri3", "${uri;file:dist/bundles}");
        p.setProperty("uri4", "${uri;file:/dist/bundles}");
        p.setProperty("uri5", "${uri;dist/bundles;" + otherURI + "}");
        p.setProperty("uri6", "${uri;/dist/bundles;" + otherURI + "}");
        p.setProperty("uri7", "${uri;file:dist/bundles;" + otherURI + "}");
        p.setProperty("uri8", "${uri;file:/dist/bundles;" + otherURI + "}");
        p.setProperty("uri9", "${uri;http://foo.com/dist/bundles}");
        p.setProperty("uri10", "${uri;http://foo.com/dist/bundles;" + otherURI + "}");
        p.setProperty("uri11", "${uri;.}");
        String uri1 = p.getProperty("uri1");
        String uri2 = p.getProperty("uri2");
        String uri3 = p.getProperty("uri3");
        String uri4 = p.getProperty("uri4");
        String uri5 = p.getProperty("uri5");
        String uri6 = p.getProperty("uri6");
        String uri7 = p.getProperty("uri7");
        String uri8 = p.getProperty("uri8");
        String uri9 = p.getProperty("uri9");
        String uri10 = p.getProperty("uri10");
        String uri11 = p.getProperty("uri11");
        assertEquals(baseURI + "dist/bundles", uri1);
        assertEquals("file:/dist/bundles", uri2);
        assertEquals(baseURI + "dist/bundles", uri3);
        assertEquals("file:/dist/bundles", uri4);
        assertEquals(otherURI + "dist/bundles", uri5);
        assertEquals("file:/dist/bundles", uri6);
        assertEquals(otherURI + "dist/bundles", uri7);
        assertEquals("file:/dist/bundles", uri8);
        assertEquals("http://foo.com/dist/bundles", uri9);
        assertEquals("http://foo.com/dist/bundles", uri10);
        assertEquals(baseURI, uri11);
        assertTrue(p.check());
    }
}
Also used : Processor(aQute.bnd.osgi.Processor) URI(java.net.URI)

Aggregations

Processor (aQute.bnd.osgi.Processor)185 HashMap (java.util.HashMap)43 File (java.io.File)37 Macro (aQute.bnd.osgi.Macro)29 Workspace (aQute.bnd.build.Workspace)27 Jar (aQute.bnd.osgi.Jar)17 HttpClient (aQute.bnd.http.HttpClient)14 Baseline (aQute.bnd.differ.Baseline)12 DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)12 BundleInfo (aQute.bnd.differ.Baseline.BundleInfo)10 IOException (java.io.IOException)10 Resource (org.osgi.resource.Resource)10 Info (aQute.bnd.differ.Baseline.Info)8 Version (aQute.bnd.version.Version)8 ArrayList (java.util.ArrayList)8 List (java.util.List)7 ProgressPlugin (aQute.bnd.service.progress.ProgressPlugin)6 Collection (java.util.Collection)6 Properties (java.util.Properties)6 Parameters (aQute.bnd.header.Parameters)5