Search in sources :

Example 6 with InputParameter

use of org.apache.camel.component.sql.stored.template.ast.InputParameter in project camel by apache.

the class ParserTest method nestedSimpleExpression.

@Test
public void nestedSimpleExpression() {
    Exchange exchange = createExchangeWithBody(1);
    exchange.getIn().setHeader("foo", 1);
    exchange.getIn().setHeader("bar", 3);
    Template template = parser.parseTemplate("ADDNUMBERS2(INTEGER ${header.foo},INTEGER ${header.bar})");
    assertEquals(1, ((InputParameter) template.getParameterList().get(0)).getValueExtractor().eval(exchange, null));
    assertEquals(3, ((InputParameter) template.getParameterList().get(1)).getValueExtractor().eval(exchange, null));
}
Also used : Exchange(org.apache.camel.Exchange) InputParameter(org.apache.camel.component.sql.stored.template.ast.InputParameter) Template(org.apache.camel.component.sql.stored.template.ast.Template) Test(org.junit.Test)

Aggregations

InputParameter (org.apache.camel.component.sql.stored.template.ast.InputParameter)6 HashMap (java.util.HashMap)3 Template (org.apache.camel.component.sql.stored.template.ast.Template)3 Test (org.junit.Test)3 Exchange (org.apache.camel.Exchange)2 ArrayList (java.util.ArrayList)1 OutParameter (org.apache.camel.component.sql.stored.template.ast.OutParameter)1 SqlParameter (org.springframework.jdbc.core.SqlParameter)1