Package de.odysseus.el.tree

Examples of de.odysseus.el.tree.Bindings


    assertTrue(parseNode("${foo}").isLeftValue());
  }

  public void testGetType() {
    Tree tree = null;
    Bindings bindings = null;

    tree = parse("${var_long_1}");
    bindings = tree.bind(null, context.getVariableMapper());
    assertEquals(null, getNode(tree).getType(bindings, context));
View Full Code Here


    assertEquals(null, getNode(tree).getType(bindings, context));
  }

  public void testIsReadOnly() {
    Tree tree = null;
    Bindings bindings = null;
   
    tree = parse("${var_long_1}");
    bindings = tree.bind(null, context.getVariableMapper());
    assertTrue(getNode(tree).isReadOnly(bindings, context));
View Full Code Here

    assertTrue(getNode(tree).isReadOnly(bindings, context));
  }

  public void testSetValue() {
    Tree tree = null;
    Bindings bindings = null;

    tree = parse("${bad}");
    bindings = tree.bind(null, context.getVariableMapper());
    getNode(tree).setValue(bindings, context, "good");
    assertEquals("good", getNode(tree).getValue(bindings, context, null));
View Full Code Here

    try { getNode(tree).setValue(bindings, context, "bar"); fail(); } catch (ELException e) {}
  }

  public void testGetValue() {
    Tree tree = null;
    Bindings bindings = null;

    tree = parse("${bad}");
    bindings = tree.bind(null, context.getVariableMapper());
    try { getNode(tree).getValue(bindings, context, null); fail(); } catch (ELException e) {}
   
View Full Code Here

    assertEquals("1", getNode(tree).getValue(bindings, context, String.class));
  }
 
  public void testInvoke() {
    Tree tree = null;
    Bindings bindings = null;

    tree = parse("${bad}");
    bindings = tree.bind(null, context.getVariableMapper());
    try { getNode(tree).invoke(bindings, context, long.class, new Class[0], null); fail(); } catch (ELException e) {}
   
View Full Code Here

    try { getNode(tree).invoke(bindings, context, long.class, new Class[0], new Object[]{""}); fail(); } catch (ELException e) {}
  }

  public void testGetMethodInfo() {
    Tree tree = null;
    Bindings bindings = null;
    MethodInfo info = null;

    tree = parse("${bad}");
    bindings = tree.bind(null, context.getVariableMapper());
    try { getNode(tree).getMethodInfo(bindings, context, long.class, new Class[0]); fail(); } catch (ELException e) {}
View Full Code Here

    context.setVariable("v0", new ObjectValueExpression(TypeConverter.DEFAULT, 0, long.class));
    context.setVariable("v1", new ObjectValueExpression(TypeConverter.DEFAULT, 1, long.class));
  }

  public void testBindFunctions() throws Exception {
    Bindings bindings = null;
   
    bindings = parse("${ns:f0()}").bind(context.getFunctionMapper(), null);
    assertSame(context.getFunctionMapper().resolveFunction("ns", "f0"), bindings.getFunction(0));
    try { bindings.getFunction(1); fail(); } catch (Exception e) {}
   
    bindings = parse("${ns:f1(1)}").bind(context.getFunctionMapper(), null);
    assertSame(context.getFunctionMapper().resolveFunction("ns", "f1"), bindings.getFunction(0));
    try { bindings.getFunction(1); fail(); } catch (Exception e) {}

    bindings = parse("${ns:f0()+ns:f1(1)}").bind(context.getFunctionMapper(), null);
    assertSame(context.getFunctionMapper().resolveFunction("ns", "f0"), bindings.getFunction(0));
    assertSame(context.getFunctionMapper().resolveFunction("ns", "f1"), bindings.getFunction(1));
    try { bindings.getFunction(2); fail(); } catch (Exception e) {}

    // the same for default namespace functions g0(), g1()
    bindings = parse("${g0()}").bind(context.getFunctionMapper(), null);
    assertSame(context.getFunctionMapper().resolveFunction("", "g0"), bindings.getFunction(0));
    try { bindings.getFunction(1); fail(); } catch (Exception e) {}
   
    bindings = parse("${g1(1)}").bind(context.getFunctionMapper(), null);
    assertSame(context.getFunctionMapper().resolveFunction("", "g1"), bindings.getFunction(0));
    try { bindings.getFunction(1); fail(); } catch (Exception e) {}

    bindings = parse("${g0()+g1(1)}").bind(context.getFunctionMapper(), null);
    assertSame(context.getFunctionMapper().resolveFunction("", "g0"), bindings.getFunction(0));
    assertSame(context.getFunctionMapper().resolveFunction("", "g1"), bindings.getFunction(1));
    try { bindings.getFunction(2); fail(); } catch (Exception e) {}

    try { parse("${foo()}").bind(context.getFunctionMapper(), null); fail(); } catch (Exception e) {}
    try { parse("${g1()}").bind(context.getFunctionMapper(), null); fail(); } catch (Exception e) {}
    try { parse("${g1(1,2)}").bind(context.getFunctionMapper(), null); fail(); } catch (Exception e) {}
  }
View Full Code Here

    try { parse("${g1()}").bind(context.getFunctionMapper(), null); fail(); } catch (Exception e) {}
    try { parse("${g1(1,2)}").bind(context.getFunctionMapper(), null); fail(); } catch (Exception e) {}
  }

  public void testBindVariables() throws Exception {
    Bindings bindings = null;
       
    bindings = parse("${v0}").bind(null, context.getVariableMapper());
    assertSame(context.getVariableMapper().resolveVariable("v0"), bindings.getVariable(0));
    try { bindings.getVariable(1); fail(); } catch (Exception e) {}

    bindings = parse("${v1}").bind(null, context.getVariableMapper());
    assertSame(context.getVariableMapper().resolveVariable("v1"), bindings.getVariable(0));
    try { bindings.getVariable(1); fail(); } catch (Exception e) {}

    bindings = parse("${v0+v1}").bind(null, context.getVariableMapper());
    assertSame(context.getVariableMapper().resolveVariable("v0"), bindings.getVariable(0));
    assertSame(context.getVariableMapper().resolveVariable("v1"), bindings.getVariable(1));
    try { bindings.getVariable(2); fail(); } catch (Exception e) {}

    bindings = parse("${foo}").bind(null, context.getVariableMapper());
    assertNull(bindings.getVariable(0));
    try { bindings.getVariable(1); fail(); } catch (Exception e) {}
  }
View Full Code Here

    assertNull(bindings.getVariable(0));
    try { bindings.getVariable(1); fail(); } catch (Exception e) {}
  }

  public void testBindFunctionsAndVariables() throws Exception {
    Bindings bindings = parse("${ns:f0()+v0+g1(1)+v1+foo}").bind(context.getFunctionMapper(), context.getVariableMapper());
    assertSame(context.getFunctionMapper().resolveFunction("ns", "f0"), bindings.getFunction(0));
    assertSame(context.getFunctionMapper().resolveFunction("", "g1"), bindings.getFunction(1));
    try { bindings.getFunction(2); fail(); } catch (Exception e) {}
    assertSame(context.getVariableMapper().resolveVariable("v0"), bindings.getVariable(0));
    assertSame(context.getVariableMapper().resolveVariable("v1"), bindings.getVariable(1));
    assertNull(bindings.getVariable(2));
    try { bindings.getVariable(3); fail(); } catch (Exception e) {}
  }
View Full Code Here

    context.setVariable("var_property_long_1", new TreeValueExpression(new TreeStore(BUILDER, null), null, context.getVariableMapper(), null, "${property_long_1}", long.class))
  }

  public void testEval() {
    Tree tree = null;
    Bindings bindings = null;

    tree = parse("${bad}");
    bindings = tree.bind(null, context.getVariableMapper());
    try { getNode(tree).eval(bindings, context); fail(); } catch (ELException e) {}
   
View Full Code Here

TOP

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

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.