Search in sources :

Example 76 with Processor

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

the class MacroTest method testNonStringValue.

public void testNonStringValue() throws Exception {
    try (Processor b = new Processor()) {
        // getProperty will return null for non-String value
        b.getProperties().put("tst", new StringBuilder("foo"));
        b.getProperties().put("num", 2);
        String tst = b.getProperty("tst");
        assertNull(tst);
        String num = b.getProperty("num");
        assertNull(num);
        assertTrue(b.check("Key 'tst' has a non-String value", "Key 'num' has a non-String value"));
    }
}
Also used : Processor(aQute.bnd.osgi.Processor)

Example 77 with Processor

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

the class MacroTest method testFuntionMacrosAndReplace.

/**
	 * Combine
	 */
public void testFuntionMacrosAndReplace() throws Exception {
    Processor processor = new Processor();
    processor.setProperty("libs", "/lib/a.jar, /lib/b.jar");
    processor.setProperty("foo", "--${1}--");
    processor.setProperty("xlibs", "${replace;${libs};/lib/(.*).jar;$0=${foo;$1}}");
    assertEquals("/lib/a.jar=--a--, /lib/b.jar=--b--", processor.getProperty("xlibs"));
}
Also used : Processor(aQute.bnd.osgi.Processor)

Example 78 with Processor

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

the class MacroTest method testRangeWithExplicitTarget.

public void testRangeWithExplicitTarget() throws IOException {
    Processor p = new Processor();
    assertEquals("${range;[===,+===);${@}}", p.getReplacer().process("${range;[===,+===);${@}}"));
    assertTrue(p.check());
}
Also used : Processor(aQute.bnd.osgi.Processor)

Example 79 with Processor

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

the class MacroTest method testSuper.

/**
	 * Testing an example with nesting that was supposd not to work
	 */
public static void testSuper() {
    Processor top = new Processor();
    Processor middle = new Processor(top);
    Processor bottom = new Processor(middle);
    top.setProperty("a", "top.a");
    top.setProperty("b", "top.b");
    top.setProperty("c", "top.c");
    top.setProperty("Bundle-Version", "0.0.0");
    middle.setProperty("a", "middle.a");
    middle.setProperty("b", "${^a}");
    middle.setProperty("c", "-${^c}-");
    middle.setProperty("Bundle-Version", "${^Bundle-Version}");
    assertEquals("middle.a", bottom.getProperty("a"));
    assertEquals("top.a", bottom.getProperty("b"));
    assertEquals("-top.c-", bottom.getProperty("c"));
    assertEquals("0.0.0", bottom.getProperty("Bundle-Version"));
}
Also used : Processor(aQute.bnd.osgi.Processor)

Example 80 with Processor

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

the class MacroTest method testRangeWithSetExplicitTarget.

public void testRangeWithSetExplicitTarget() throws IOException {
    Processor p = new Processor();
    p.setProperty("@", "1.2.3");
    assertEquals("[1.2.3,2.2.3)", p.getReplacer().process("${range;[===,+===);${@}}"));
    assertTrue(p.check());
}
Also used : Processor(aQute.bnd.osgi.Processor)

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