Package org.springframework.expression.spel.standard

Examples of org.springframework.expression.spel.standard.SpelExpressionParser.parseExpression()


    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


    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"));
  }

  @Test
View Full Code Here

    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"));
  }

  @Test
  public void testWrapper() {
View Full Code Here

    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"));
  }

  @Test
  public void testWrapper() {
    Map<String, Object> headers = new HashMap<String, Object>();
View Full Code Here

    Message<String> dateMessage = MessageBuilder.withPayload(new SimpleDateFormat(defaultFormat).format(new Date())).build();

    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"));
View Full Code Here

    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"));
View Full Code Here

    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

        SpringStepContext stepContext=new SpringStepContext(flowArgs,local);
        ExpressionParser parser = new SpelExpressionParser();
        List<String> stepArgs=new ArrayList<>();
       
        for(String that:argDefinitions) {
            Expression e=parser.parseExpression(that);
            StandardEvaluationContext c=new StandardEvaluationContext(stepContext);
            stepContext.assignVariables(c);
            String value = e.getValue(c,String.class);
            logger.trace("parsing ["+that+"] with result +["+value+"]");
            stepArgs.add(value);
View Full Code Here

        HashMap<String, Object> output = new HashMap<>(local);
        SpringStepContext stepContext=new SpringStepContext(flowArgs,local);
        ExpressionParser parser = new SpelExpressionParser();
       
        for(Assignment that:assignments) {
            Expression e=parser.parseExpression(that.getExpression());
            StandardEvaluationContext c=new StandardEvaluationContext(stepContext);
            stepContext.assignVariables(c);
            Object value = e.getValue(c);
            logger.trace("parsing ["+that+"] with result +["+value+"]");
            if (output.containsKey(that.getAssignTo())) {
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.