public void testSimpleContext() throws PureException {
    String sText = "${#ifNull(@p:name, \"why\", @p:name)}";
    ScriptBlock script = ScriptReader.readBlock(sText);

    SimpleContext context = new SimpleContext();
    context.setVariable("p:name", null);

    String sResult = Executer.execute(script, context);
    assertEquals(sResult, "why");

    context.setVariable("p:name", "daniel");
    sResult = Executer.execute(script, context);
    assertEquals(sResult, "daniel");
  }
Exemplo n.º 2
0
 public void windowClosing(WindowEvent e) {
   if (Executer.getListenerCount() > 0) doCommand("Quit");
   else {
     quit();
     windowClosed = true;
   }
 }
 @SuppressWarnings("unchecked")
 public static synchronized void execute(
     IDataBase dataBase, Composite composite, Executer executer) {
   List list = dataBase.find(composite.getClass());
   for (Object object : list) {
     executer.execute(object);
   }
 }
  public void testParent() throws Exception {
    String sText = "${#ifNull(@p:name, \"why\", @p:name)}";
    ScriptBlock script = ScriptReader.readBlock(sText);

    SimpleContext parent = new SimpleContext();
    parent.setVariable("p:name", "daniel");

    SimpleContext context = new SimpleContext(parent);
    String sResult = Executer.execute(script, context);
    assertEquals("daniel", sResult);
  }