use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class LocationTest method find.
private boolean find(Processor p, String what, String file, int line) throws Exception {
Pattern pattern = Pattern.compile("^" + what, Pattern.MULTILINE);
Processor.FileLine fl = p.getHeader(pattern);
assertNotNull(fl);
assertTrue(fl.file.getAbsolutePath().replace(File.separatorChar, '/').endsWith(file));
assertEquals(line, fl.line);
return true;
}
use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testTstamp.
public static void testTstamp() {
String aug152008 = "1218810097322";
Processor p = new Processor();
Macro m = new Macro(p);
assertEquals("200808151421", m.process("${tstamp;yyyyMMddHHmm;UTC;" + aug152008 + "}"));
assertEquals("200808151521", m.process("${tstamp;yyyyMMddHHmm;GMT+01;" + aug152008 + "}"));
assertEquals("2008", m.process("${tstamp;yyyy;UTC;" + aug152008 + "}"));
// Why Tokyo? Japan doesn't use daylight savings, so the test shouldn't
// break when clocks change.
assertEquals("200808152321", m.process("${tstamp;yyyyMMddHHmm;Asia/Tokyo;" + aug152008 + "}"));
}
use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testTstampConsistent.
/*
* #761 Tstamp consistent
*/
public void testTstampConsistent() throws Exception {
Processor top = new Processor();
Processor base = new Processor(top);
base.setProperty("time", "${tstamp;S}");
String start = base.getProperty("time");
Thread.sleep(10);
String end = base.getProperty("time");
assertFalse(start.equals(end));
top.setProperty("_@tstamp", end);
start = base.getProperty("time");
assertTrue(start.equals(end));
Thread.sleep(10);
end = base.getProperty("time");
assertTrue(start.equals(end));
}
use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testWc.
/**
* Test the wc function
*/
public static void testWc() {
Processor p = new Processor();
Macro macro = new Macro(p);
String a = macro.process("${lsr;src/test;*.java}");
assertTrue(a.contains("MacroTest.java"));
assertTrue(a.contains("ManifestTest.java"));
assertFalse(a.contains("bnd.info"));
assertFalse(a.contains("com.acme"));
assertFalse(a.contains("src/test/MacroTest.java"));
assertFalse(a.contains("src/test/ManifestTest.java"));
String b = macro.process("${lsa;src/test;*.java}");
assertTrue(b.contains("src/test/MacroTest.java"));
assertTrue(b.contains("src/test/ManifestTest.java"));
}
use of aQute.bnd.osgi.Processor in project bnd by bndtools.
the class MacroTest method testSystemAllowFail.
/**
* Verify system-allow-fail command
*/
public static void testSystemAllowFail() throws Exception {
Processor p = new Processor();
Macro macro = new Macro(p);
assertEquals("", macro.process("${system-allow-fail;mostidioticcommandthatwillsurelyfail}"));
}
Aggregations