Examples of FluentParserContext


Examples of org.springframework.binding.expression.support.FluentParserContext

    StaticApplicationContext ac = new StaticApplicationContext();
    ac.getStaticMessageSource().addMessage("foo", Locale.FRANCE, "bar");
    ac.refresh();
    context.getRootFlow().setApplicationContext(ac);
    context.getMockExternalContext().setLocale(Locale.FRANCE);
    Expression exp = parser.parseExpression("resourceBundle.foo", new FluentParserContext()
        .evaluate(RequestContext.class));
    assertEquals("bar", exp.getValue(context));
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

    }
  }

  public void testParseTemplateSimpleLiteral() {
    String exp = "flag";
    Expression e = parser.parseExpression(exp, new FluentParserContext().template());
    assertNotNull(e);
    assertEquals("flag", e.getValue(bean));
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

    assertNotNull(e);
    assertEquals("flag", e.getValue(bean));
  }

  public void testParseTemplateEmpty() {
    Expression e = parser.parseExpression("", new FluentParserContext().template());
    assertNotNull(e);
    assertEquals("", e.getValue(bean));
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

    assertEquals("", e.getValue(bean));
  }

  public void testParseTemplateComposite() {
    String exp = "hello ${flag} ${flag} ${flag}";
    Expression e = parser.parseExpression(exp, new FluentParserContext().template());
    assertNotNull(e);
    String str = (String) e.getValue(bean);
    assertEquals("hello false false false", str);
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

  }

  public void testTemplateEnclosedCompositeNotSupported() {
    String exp = "${hello ${flag} ${flag} ${flag}}";
    try {
      parser.parseExpression(exp, new FluentParserContext().template());
      fail("Should've failed - not intended use");
    } catch (ParserException e) {
    }
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

    }
  }

  public void testSyntaxError1() {
    try {
      parser.parseExpression("${", new FluentParserContext().template());
      fail();
    } catch (ParserException e) {
    }
    try {
      String exp = "hello ${flag} ${abcd defg";
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

    }
  }

  public void testSyntaxError2() {
    try {
      parser.parseExpression("${}", new FluentParserContext().template());
      fail("Should've failed - not intended use");
    } catch (ParserException e) {
    }
    try {
      String exp = "hello ${flag} ${}";
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

  }

  public void testCollectionConstructionSyntax() {
    // lists
    parser.parseExpression("name in {null, \"Untitled\"}", null);
    parser.parseExpression("${name in {null, \"Untitled\"}}", new FluentParserContext().template());

    // native arrays
    parser.parseExpression("new int[] {1, 2, 3}", null);
    parser.parseExpression("${new int[] {1, 2, 3}}", new FluentParserContext().template());

    // maps
    parser.parseExpression("#{ 'foo' : 'foo value', 'bar' : 'bar value' }", null);
    parser
        .parseExpression("${#{ 'foo' : 'foo value', 'bar' : 'bar value' }}", new FluentParserContext()
            .template());
    parser.parseExpression("#@java.util.LinkedHashMap@{ 'foo' : 'foo value', 'bar' : 'bar value' }", null);
    parser.parseExpression("${#@java.util.LinkedHashMap@{ 'foo' : 'foo value', 'bar' : 'bar value' }}",
        new FluentParserContext().template());

    // complex examples
    parser.parseExpression("b,#{1:2}", null);
    parser.parseExpression("${b,#{1:2}}", new FluentParserContext().template());
    parser.parseExpression("a${b,#{1:2},e}f${g,#{3:4},j}k", new FluentParserContext().template());
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

    parser.parseExpression("${b,#{1:2}}", new FluentParserContext().template());
    parser.parseExpression("a${b,#{1:2},e}f${g,#{3:4},j}k", new FluentParserContext().template());
  }

  public void testVariables() {
    Expression exp = parser.parseExpression("#var", new FluentParserContext().variable(new ExpressionVariable(
        "var", "flag")));
    assertEquals(false, ((Boolean) exp.getValue(bean)).booleanValue());
  }
View Full Code Here

Examples of org.springframework.binding.expression.support.FluentParserContext

        "var", "flag")));
    assertEquals(false, ((Boolean) exp.getValue(bean)).booleanValue());
  }

  public void testVariablesWithCoersion() {
    Expression exp = parser.parseExpression("#var", new FluentParserContext().variable(new ExpressionVariable(
        "var", "number", new FluentParserContext().expectResult(Long.class))));
    assertEquals(new Long(0), exp.getValue(bean));
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.