Examples of parseExpression()


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

    private final Expression expression;
    private final MessageExpressionMethods methods;

    public MessagePartitionResolver(String expression, EvaluationContext evaluationContext) {
      ExpressionParser parser = new SpelExpressionParser();
      this.expression = parser.parseExpression(expression);
      this.methods = new MessageExpressionMethods(evaluationContext);
      log.info("Using expression=[" + this.expression.getExpressionString() + "]");
    }

    public MessagePartitionResolver(Expression expression, EvaluationContext evaluationContext) {
View Full Code Here

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

    MessagePartitionKeyMethodResolver resolver = new MessagePartitionKeyMethodResolver();
    MessagePartitionKeyPropertyAccessor accessor = new MessagePartitionKeyPropertyAccessor();
    context.addMethodResolver(resolver);
    context.addPropertyAccessor(accessor);

    assertThat(parser.parseExpression("dateFormat('yyyy/MM')").getValue(context, message, String.class), is(nowYYYYMM));
    assertThat(parser.parseExpression("dateFormat('yyyy/MM', headers[timestamp])").getValue(context, message, String.class), is(nowYYYYMM));
    assertThat(parser.parseExpression("dateFormat('yyyy/MM', timestamp)").getValue(context, message, String.class), is(nowYYYYMM));
    assertThat(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())").getValue(context, message, String.class), is(nowYYYYMM));
    assertThat(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))").getValue(context, message, String.class), is(nowYYYYMM));
    assertThat(parser.parseExpression("path('yyyy', 'MM')").getValue(context, message, String.class), is("yyyy/MM"));
View Full Code Here

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

    MessagePartitionKeyPropertyAccessor accessor = new MessagePartitionKeyPropertyAccessor();
    context.addMethodResolver(resolver);
    context.addPropertyAccessor(accessor);

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

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

    context.addMethodResolver(resolver);
    context.addPropertyAccessor(accessor);

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

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

    context.addPropertyAccessor(accessor);

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

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

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

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

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

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

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

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

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

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

    assertThat(parser.parseExpression("dateFormat('yyyy/MM', T(java.lang.System).currentTimeMillis())").getValue(context, message, String.class), is(nowYYYYMM));
    assertThat(parser.parseExpression("path(dateFormat('yyyy'),dateFormat('MM'))").getValue(context, message, String.class), is(nowYYYYMM));
    assertThat(parser.parseExpression("path('yyyy', 'MM')").getValue(context, message, String.class), is("yyyy/MM"));
    assertThat(parser.parseExpression("path('yyyy', 'MM', payload.substring(0,3))").getValue(context, message, String.class), is("yyyy/MM/jee"));
    assertThat(parser.parseExpression("dateFormat('yyyy') + '/' + dateFormat('MM')").getValue(context, message, String.class), is(nowYYYYMM));
    assertThat(parser.parseExpression("headerkey").getValue(context, message, String.class), is("headervalue"));
    assertThat(parser.parseExpression("path(dateFormat('yyyy'), headerkey)").getValue(context, message, String.class), is(nowYYYY + "/headervalue"));
    assertThat(parser.parseExpression("headers.timestamp").getValue(context, message, Long.class), greaterThan(0l));
    assertThat(parser.parseExpression("headers[timestamp]").getValue(context, message, Long.class), greaterThan(0l));
    assertThat(parser.parseExpression("payload").getValue(context, message, String.class), is("jee"));
  }
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.