Package org.apache.camel.builder

Examples of org.apache.camel.builder.ExpressionClause


    }

    @Override
    protected void configureChild(ProcessorDefinition output) {
        if (expression != null && expression instanceof ExpressionClause) {
            ExpressionClause clause = (ExpressionClause) expression;
            if (clause.getExpressionType() != null) {
                // if using the Java DSL then the expression may have been set using the
                // ExpressionClause which is a fancy builder to define expressions and predicates
                // using fluent builders in the DSL. However we need afterwards a callback to
                // reset the expression to the expression type the ExpressionClause did build for us
                expression = clause.getExpressionType();
                // set the correlation expression from the expression type, as the model definition
                // would then be accurate
                correlationExpression = new ExpressionSubElementDefinition();
                correlationExpression.setExpressionType(clause.getExpressionType());
            }
        }
    }
View Full Code Here


        if (expression != null && expression.getExpressionValue() != null) {
            exp = expression.getExpressionValue();
        }

        if (exp instanceof ExpressionClause) {
            ExpressionClause clause = (ExpressionClause) exp;
            if (clause.getExpressionType() != null) {
                // if using the Java DSL then the expression may have been set using the
                // ExpressionClause which is a fancy builder to define expressions and predicates
                // using fluent builders in the DSL. However we need afterwards a callback to
                // reset the expression to the expression type the ExpressionClause did build for us
                expression = clause.getExpressionType();
            }
        }
    }
View Full Code Here

        if (whenClauses == null || whenClauses.isEmpty()) {
            return;
        }
        for (WhenDefinition when : whenClauses) {
            if (when.getExpression() instanceof ExpressionClause) {
                ExpressionClause clause = (ExpressionClause) when.getExpression();
                if (clause.getExpressionType() != null) {
                    // if using the Java DSL then the expression may have been set using the
                    // ExpressionClause which is a fancy builder to define expressions and predicates
                    // using fluent builders in the DSL. However we need afterwards a callback to
                    // reset the expression to the expression type the ExpressionClause did build for us
                    when.setExpression(clause.getExpressionType());
                }
            }
        }
    }
View Full Code Here

    }

    @Override
    protected void configureChild(ProcessorDefinition output) {
        if (expression != null && expression instanceof ExpressionClause) {
            ExpressionClause clause = (ExpressionClause) expression;
            if (clause.getExpressionType() != null) {
                // if using the Java DSL then the expression may have been set using the
                // ExpressionClause which is a fancy builder to define expressions and predicates
                // using fluent builders in the DSL. However we need afterwards a callback to
                // reset the expression to the expression type the ExpressionClause did build for us
                expression = clause.getExpressionType();
                // set the correlation expression from the expression type, as the model definition
                // would then be accurate
                correlationExpression = new ExpressionSubElementDefinition();
                correlationExpression.setExpressionType(clause.getExpressionType());
            }
        }
    }
View Full Code Here

        if (expression.getExpressionValue() != null) {
            exp = expression.getExpressionValue();
        }

        if (exp instanceof ExpressionClause) {
            ExpressionClause clause = (ExpressionClause) exp;
            if (clause.getExpressionType() != null) {
                // if using the Java DSL then the expression may have been set using the
                // ExpressionClause which is a fancy builder to define expressions and predicates
                // using fluent builders in the DSL. However we need afterwards a callback to
                // reset the expression to the expression type the ExpressionClause did build for us
                expression = clause.getExpressionType();
            }
        }
    }
View Full Code Here

    /**
     * Adds an expectation that the given body value are received by this endpoint
     */
    public ExpressionClause expectedBodyReceived() {
        final ExpressionClause clause = new ExpressionClause<MockEndpoint>(this);

        expectedMessageCount(1);

        expects(new Runnable() {
            public void run() {
                Exchange exchange = getReceivedExchanges().get(0);
                assertTrue("No exchange received for counter: " + 0, exchange != null);

                Object actualBody = exchange.getIn().getBody();
                Object expectedBody = clause.evaluate(exchange, Object.class);

                assertEquals("Body of message: " + 0, expectedBody, actualBody);
            }
        });

View Full Code Here

    /**
     * Adds an expectation that messages received should have ascending values
     * of the given expression such as a user generated counter value
     */
    public ExpressionClause expectsAscending() {
        final ExpressionClause clause = new ExpressionClause<MockEndpoint>(this);
        expects(new Runnable() {
            public void run() {
                assertMessagesAscending(clause.getExpressionValue());
            }
        });
        return clause;
    }
View Full Code Here

    /**
     * Adds an expectation that messages received should have descending values
     * of the given expression such as a user generated counter value
     */
    public ExpressionClause expectsDescending() {
        final ExpressionClause clause = new ExpressionClause<MockEndpoint>(this);
        expects(new Runnable() {
            public void run() {
                assertMessagesDescending(clause.getExpressionValue());
            }
        });
        return clause;
    }
View Full Code Here

    /**
     * Adds an expectation that no duplicate messages should be received using
     * the expression to determine the message ID
     */
    public ExpressionClause expectsNoDuplicates() {
        final ExpressionClause clause = new ExpressionClause<MockEndpoint>(this);
        expects(new Runnable() {
            public void run() {
                assertNoDuplicates(clause.getExpressionValue());
            }
        });
        return clause;
    }
View Full Code Here

    /**
     * Adds an expectation that the given body value are received by this endpoint
     */
    public ExpressionClause expectedBodyReceived() {
        final ExpressionClause clause = new ExpressionClause<MockEndpoint>(this);

        expectedMessageCount(1);

        expects(new Runnable() {
            public void run() {
                Exchange exchange = getReceivedExchanges().get(0);
                assertTrue("No exchange received for counter: " + 0, exchange != null);

                Object actualBody = exchange.getIn().getBody();
                Object expectedBody = clause.evaluate(exchange, Object.class);

                assertEquals("Body of message: " + 0, expectedBody, actualBody);
            }
        });

View Full Code Here

TOP

Related Classes of org.apache.camel.builder.ExpressionClause

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.