Package org.apache.camel

Examples of org.apache.camel.Expression


                send.start();
                send.process(exchange);
            }
        };
               
        Expression corr = header("id");
        AggregationStrategy as = new BodyInAggregatingStrategy();

        AggregateProcessor ap = new AggregateProcessor(context, done, corr, as, executorService, true);
        ap.setEagerCheckCompletion(true);
        ap.setCompletionPredicate(body().isEqualTo("END"));
View Full Code Here


        MockEndpoint mock = getMockEndpoint("mock:result");
        mock.expectedBodiesReceived("B+END", "A+END");
        mock.expectedPropertyReceived(Exchange.AGGREGATED_COMPLETED_BY, "forceCompletion");

        Processor done = new SendProcessor(context.getEndpoint("mock:result"));
        Expression corr = header("id");
        AggregationStrategy as = new BodyInAggregatingStrategy();

        AggregateProcessor ap = new AggregateProcessor(context, done, corr, as, executorService, true);
        ap.setCompletionSize(10);
        ap.start();
View Full Code Here

        return "recipientList[" + getExpression() + "]";
    }

    @Override
    public Processor createProcessor(RouteContext routeContext) throws Exception {
        final Expression expression = getExpression().createExpression(routeContext);

        RecipientList answer;
        if (delimiter != null) {
            answer = new RecipientList(routeContext.getCamelContext(), expression, delimiter);
        } else {
View Full Code Here

        assertTrue(predicate.matches(exchange));

        predicate = SimpleLanguage.predicate("${header.bar} == 124");
        assertFalse(predicate.matches(exchange));

        Expression expression = SimpleLanguage.expression("${body}");
        assertEquals("<hello id='m123'>world!</hello>", expression.evaluate(exchange, String.class));

        expression = SimpleLanguage.simple("${body}");
        assertEquals("<hello id='m123'>world!</hello>", expression.evaluate(exchange, String.class));
        expression = SimpleLanguage.simple("${body}", String.class);
        assertEquals("<hello id='m123'>world!</hello>", expression.evaluate(exchange, String.class));

        expression = SimpleLanguage.simple("${header.bar} == 123", boolean.class);
        assertEquals(Boolean.TRUE, expression.evaluate(exchange, Object.class));
        expression = SimpleLanguage.simple("${header.bar} == 124", boolean.class);
        assertEquals(Boolean.FALSE, expression.evaluate(exchange, Object.class));
        expression = SimpleLanguage.simple("${header.bar} == 123", Boolean.class);
        assertEquals(Boolean.TRUE, expression.evaluate(exchange, Object.class));
        expression = SimpleLanguage.simple("${header.bar} == 124", Boolean.class);
        assertEquals(Boolean.FALSE, expression.evaluate(exchange, Object.class));
    }
View Full Code Here

            assertEquals("expression must be specified", e.getMessage());
        }
    }

    public void testBodyExpression() throws Exception {
        Expression exp = SimpleLanguage.simple("${body}");
        assertNotNull(exp);
    }
View Full Code Here

        Expression exp = SimpleLanguage.simple("${body}");
        assertNotNull(exp);
    }

    public void testBodyExpressionUsingAlternativeStartToken() throws Exception {
        Expression exp = SimpleLanguage.simple("$simple{body}");
        assertNotNull(exp);
    }
View Full Code Here

        assertNotNull(exp);
    }

    public void testBodyExpressionNotStringType() throws Exception {
        exchange.getIn().setBody(123);
        Expression exp = SimpleLanguage.simple("${body}");
        assertNotNull(exp);
        Object val = exp.evaluate(exchange, Object.class);
        assertIsInstanceOf(Integer.class, val);
        assertEquals(123, val);
    }
View Full Code Here

        return "simple";
    }

    protected void assertExpressionResultInstanceOf(String expressionText, Class<?> expectedType) {
        Language language = assertResolveLanguage(getLanguageName());
        Expression expression = language.createExpression(expressionText);
        assertNotNull("Cannot assert type when no type is provided", expectedType);
        assertNotNull("No Expression could be created for text: " + expressionText + " language: " + language, expression);
        Object answer = expression.evaluate(exchange, Object.class);
        assertIsInstanceOf(expectedType, answer);
    }
View Full Code Here

        return "setProperty";
    }

    @Override
    public Processor createProcessor(RouteContext routeContext) throws Exception {
        Expression expr = getExpression().createExpression(routeContext);
        return ProcessorBuilder.setProperty(getPropertyName(), expr);
    }
View Full Code Here

    }

    @Override
    public Processor createProcessor(RouteContext routeContext) throws Exception {
        Processor childProcessor = routeContext.createProcessor(this);
        Expression processAtExpression = createAbsoluteTimeDelayExpression(routeContext);
        return new Delayer(childProcessor, processAtExpression, delay);
    }
View Full Code Here

TOP

Related Classes of org.apache.camel.Expression

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.