Package de.odysseus.el.tree

Examples of de.odysseus.el.tree.Tree


    assertEquals(canonical, tree.getRoot().getStructuralId(null));
    return verifyEvalExpression(canonical, expression1);
  }

  static Tree verifyCompositeExpression(String canonical) {
    Tree tree = parse(canonical);
    assertFalse(tree.getRoot().isLiteralText());
    assertEquals(canonical, tree.getRoot().getStructuralId(null));
    return tree;
  }
View Full Code Here


    verifyLiteralExpression("\"foo\"");
    verifyLiteralExpression("'foo'");
  }

  Tree verifyBinary(AstBinary.Operator op, String canonical) {
    Tree tree = verifyEvalExpression(canonical);
    assertTrue((tree.getRoot()).getChild(0) instanceof AstBinary);
    assertEquals(op, ((AstBinary)tree.getRoot().getChild(0)).getOperator());
    return tree;
  }
View Full Code Here

    context.getELResolver().setValue(context, null, "var111s", new String[]{"1","1","1"});
  }

  public void testVarargs() {
    Builder builder = new Builder(Feature.VARARGS);
    Tree tree = null;

    tree = builder.build("${vararg:f()}");
    assertEquals(foovar(), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = builder.build("${vararg:f(1)}");
    assertEquals(foovar(1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = builder.build("${vararg:f(1,1)}");
    assertEquals(foovar(1,1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = builder.build("${vararg:f(null)}");
    assertEquals(foovar(0), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = builder.build("${vararg:f(var111)}");
    assertEquals(foovar(1,1,1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), context));

    tree = builder.build("${vararg:f(var111s)}");
    assertEquals(foovar(1,1,1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), context));
  }
View Full Code Here

    tree = builder.build("${vararg:f(var111s)}");
    assertEquals(foovar(1,1,1), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), context));
  }

  public void testEval() {
    Tree tree = null;

    tree = parse("${ns:f0()}");
    assertEquals(foo(), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = parse("${ns:f1(42)}");
    assertEquals(bar(42), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = parse("${ns:f2(21,21)}");
    assertEquals(foobar(21,21), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = parse("${g0()}");
    assertEquals(foo(), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = parse("${g1(42)}");
    assertEquals(bar(42), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));

    tree = parse("${g2(21,21)}");
    assertEquals(foobar(21,21), getNode(tree).eval(tree.bind(context.getFunctionMapper(), null), null));
  }
View Full Code Here

  public void testSetValue() {
    try { parseNode("${f()}").setValue(null, null, null); fail(); } catch (ELException e) {}
  }

  public void testGetValue() {
    Tree tree = null;

    tree = parse("${ns:f0()}");

    assertEquals(foo(), getNode(tree).getValue(tree.bind(context.getFunctionMapper(), null), null, null));
    assertEquals("" + foo(), getNode(tree).getValue(tree.bind(context.getFunctionMapper(), null), null, String.class));
  }
View Full Code Here

TOP

Related Classes of de.odysseus.el.tree.Tree

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.