Search in sources :

Example 36 with Processor

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;
}
Also used : Pattern(java.util.regex.Pattern) Processor(aQute.bnd.osgi.Processor) FileLine(aQute.bnd.osgi.Processor.FileLine)

Example 37 with Processor

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 + "}"));
}
Also used : Processor(aQute.bnd.osgi.Processor) Macro(aQute.bnd.osgi.Macro)

Example 38 with Processor

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));
}
Also used : Processor(aQute.bnd.osgi.Processor)

Example 39 with Processor

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"));
}
Also used : Processor(aQute.bnd.osgi.Processor) Macro(aQute.bnd.osgi.Macro)

Example 40 with Processor

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}"));
}
Also used : Processor(aQute.bnd.osgi.Processor) Macro(aQute.bnd.osgi.Macro)

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