Package org.springframework.expression

Examples of org.springframework.expression.ExpressionParser.parseExpression()


    ExpressionParser parser = new SpelExpressionParser();

    MessageExpressionMethods methods = new MessageExpressionMethods();
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', headers[timestamp])"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', timestamp)"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
View Full Code Here


    MessageExpressionMethods methods = new MessageExpressionMethods();
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', headers[timestamp])"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', timestamp)"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
View Full Code Here

    MessageExpressionMethods methods = new MessageExpressionMethods();
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', headers[timestamp])"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', timestamp)"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'), headerkey)"), message, String.class), is(nowYYYY + "/headervalue"));
View Full Code Here

    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', headers[timestamp])"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', timestamp)"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'), headerkey)"), message, String.class), is(nowYYYY + "/headervalue"));
    assertThat(methods.getValue(parser.parseExpression("headers.timestamp"), message, Long.class), greaterThan(0l));
View Full Code Here

    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', headers[timestamp])"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', timestamp)"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'), headerkey)"), message, String.class), is(nowYYYY + "/headervalue"));
    assertThat(methods.getValue(parser.parseExpression("headers.timestamp"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("headers[timestamp]"), message, Long.class), greaterThan(0l));
View Full Code Here

    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', timestamp)"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'), headerkey)"), message, String.class), is(nowYYYY + "/headervalue"));
    assertThat(methods.getValue(parser.parseExpression("headers.timestamp"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("headers[timestamp]"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("payload"), message, String.class), is("jee"));
View Full Code Here

    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'), headerkey)"), message, String.class), is(nowYYYY + "/headervalue"));
    assertThat(methods.getValue(parser.parseExpression("headers.timestamp"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("headers[timestamp]"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("payload"), message, String.class), is("jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', '" + stringDateDefaultFormat + "')"), message, String.class), is(nowYYYYMM));
View Full Code Here

    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'), headerkey)"), message, String.class), is(nowYYYY + "/headervalue"));
    assertThat(methods.getValue(parser.parseExpression("headers.timestamp"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("headers[timestamp]"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("payload"), message, String.class), is("jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', '" + stringDateDefaultFormat + "')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', '" + stringDateCustomFormat + "', '" + customDateFormat + "')"), message, String.class), is(nowYYYYMM));
View Full Code Here

    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM')"), message, String.class), is("yyyy/MM"));
    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'), headerkey)"), message, String.class), is(nowYYYY + "/headervalue"));
    assertThat(methods.getValue(parser.parseExpression("headers.timestamp"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("headers[timestamp]"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("payload"), message, String.class), is("jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', '" + stringDateDefaultFormat + "')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', '" + stringDateCustomFormat + "', '" + customDateFormat + "')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', payload.substring(0,10))"), dateMessage, String.class), is(nowYYYYMM));
View Full Code Here

    assertThat(methods.getValue(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))"), message, String.class), is("yyyy/MM/jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("headerkey"), message, String.class), is("headervalue"));
    assertThat(methods.getValue(parser.parseExpression("path(dateFormat('yyyy'), headerkey)"), message, String.class), is(nowYYYY + "/headervalue"));
    assertThat(methods.getValue(parser.parseExpression("headers.timestamp"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("headers[timestamp]"), message, Long.class), greaterThan(0l));
    assertThat(methods.getValue(parser.parseExpression("payload"), message, String.class), is("jee"));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', '" + stringDateDefaultFormat + "')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', '" + stringDateCustomFormat + "', '" + customDateFormat + "')"), message, String.class), is(nowYYYYMM));
    assertThat(methods.getValue(parser.parseExpression("dateFormat('yyyy/MM', payload.substring(0,10))"), dateMessage, String.class), is(nowYYYYMM));
  }
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.