Пример #1
0
  public void testExample() {

    Oddjob oddjob = new Oddjob();
    oddjob.setConfiguration(
        new XMLConfiguration(
            "org/oddjob/values/types/TokenizerExample.xml", getClass().getClassLoader()));

    ConsoleCapture console = new ConsoleCapture();
    try (ConsoleCapture.Close close = console.captureConsole()) {

      oddjob.run();
    }

    assertEquals(ParentState.COMPLETE, oddjob.lastStateEvent().getState());

    console.dump(logger);

    String[] lines = console.getLines();

    assertEquals("I'm 1", lines[0].trim());
    assertEquals("I'm 2", lines[1].trim());
    assertEquals("I'm 3", lines[2].trim());
    assertEquals("I'm 4", lines[3].trim());

    assertEquals(12, lines.length);

    oddjob.destroy();
  }
Пример #2
0
  public void testSimpleExample() throws ArooaPropertyException, ArooaConversionException {

    File file = new File(getClass().getResource("GroovyExpressionSimple.xml").getFile());

    Oddjob oddjob = new Oddjob();
    oddjob.setFile(file);

    oddjob.run();

    assertEquals(ParentState.COMPLETE, oddjob.lastStateEvent().getState());

    OddjobLookup lookup = new OddjobLookup(oddjob);

    assertEquals(new Integer(4), lookup.lookup("vars.result", Integer.class));
    assertEquals("4", lookup.lookup("echo.text"));

    oddjob.destroy();
  }