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"));
}
}
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"));
}
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());
}
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"));
}
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());
}
Aggregations