You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2015/10/09 18:18:46 UTC
[1/4] camel git commit: When elsql supports functions
Repository: camel
Updated Branches:
refs/heads/camel-2.16.x 252bee8ed -> c1e0f30c4
refs/heads/master e205f90e5 -> 77644c086
When elsql supports functions
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/db1651df
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/db1651df
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/db1651df
Branch: refs/heads/master
Commit: db1651df62a3d9683b4a5204c808e534c7c07323
Parents: e205f90
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Oct 7 18:19:06 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Oct 9 18:16:15 2015 +0200
----------------------------------------------------------------------
components/camel-elsql/pom.xml | 2 +-
.../component/elsql/ElsqlSqlMapSource.java | 6 ++
.../elsql/ElSqlProducerBodySimpleTest.java | 88 ++++++++++++++++++++
.../apache/camel/component/elsql/Project.java | 48 +++++++++++
.../src/test/resources/elsql/projects.elsql | 5 ++
5 files changed, 148 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/db1651df/components/camel-elsql/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-elsql/pom.xml b/components/camel-elsql/pom.xml
index 1fcf3b0..b883e1d 100644
--- a/components/camel-elsql/pom.xml
+++ b/components/camel-elsql/pom.xml
@@ -56,7 +56,7 @@
<dependency>
<groupId>com.opengamma</groupId>
<artifactId>elsql</artifactId>
- <version>${elsql-version}</version>
+ <version>1.1.1-SNAPSHOT</version>
</dependency>
<!-- test dependencies -->
http://git-wip-us.apache.org/repos/asf/camel/blob/db1651df/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java b/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java
index 725022e..eb489af 100644
--- a/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java
+++ b/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java
@@ -20,6 +20,7 @@ import java.util.Collections;
import java.util.Map;
import org.apache.camel.Exchange;
+import org.apache.camel.language.simple.SimpleLanguage;
import org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource;
/**
@@ -48,6 +49,8 @@ public class ElsqlSqlMapSource extends AbstractSqlParameterSource {
public boolean hasValue(String paramName) {
if ("body".equals(paramName)) {
return true;
+ } else if (paramName.startsWith("${") && paramName.endsWith("}")) {
+ return true;
} else {
return bodyMap.containsKey(paramName) || headersMap.containsKey(paramName);
}
@@ -58,6 +61,9 @@ public class ElsqlSqlMapSource extends AbstractSqlParameterSource {
Object answer;
if ("body".equals(paramName)) {
answer = exchange.getIn().getBody();
+ } else if (paramName.startsWith("${") && paramName.endsWith("}")) {
+ // its a simple language expression
+ answer = SimpleLanguage.expression(paramName).evaluate(exchange, Object.class);
} else {
answer = bodyMap.get(paramName);
if (answer == null) {
http://git-wip-us.apache.org/repos/asf/camel/blob/db1651df/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/ElSqlProducerBodySimpleTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/ElSqlProducerBodySimpleTest.java b/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/ElSqlProducerBodySimpleTest.java
new file mode 100644
index 0000000..595017e
--- /dev/null
+++ b/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/ElSqlProducerBodySimpleTest.java
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elsql;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Test;
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
+
+public class ElSqlProducerBodySimpleTest extends CamelTestSupport {
+
+ private EmbeddedDatabase db;
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry jndi = super.createRegistry();
+
+ // this is the database we create with some initial data for our unit test
+ db = new EmbeddedDatabaseBuilder()
+ .setType(EmbeddedDatabaseType.DERBY).addScript("sql/createAndPopulateDatabase.sql").build();
+
+ jndi.bind("dataSource", db);
+
+ return jndi;
+ }
+
+ @Test
+ public void testSimpleBody() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ Project pojo = new Project();
+ pojo.setLicense("XXX");
+
+ template.sendBody("direct:simple", pojo);
+
+ mock.assertIsSatisfied();
+
+ // the result is a List
+ List<?> received = assertIsInstanceOf(List.class, mock.getReceivedExchanges().get(0).getIn().getBody());
+
+ // and each row in the list is a Map
+ Map<?, ?> row = assertIsInstanceOf(Map.class, received.get(0));
+
+ // and we should be able the get the project from the map that should be Linux
+ assertEquals("Linux", row.get("PROJECT"));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ db.shutdown();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:simple")
+ .to("elsql:projectsByIdBody:elsql/projects.elsql?dataSource=dataSource")
+ .to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/db1651df/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/Project.java
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/Project.java b/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/Project.java
new file mode 100644
index 0000000..9f6c19e
--- /dev/null
+++ b/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/Project.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elsql;
+
+public class Project {
+
+ private String id;
+ private String license;
+ private String name;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLicense() {
+ return license;
+ }
+
+ public void setLicense(String license) {
+ this.license = license;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/db1651df/components/camel-elsql/src/test/resources/elsql/projects.elsql
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/test/resources/elsql/projects.elsql b/components/camel-elsql/src/test/resources/elsql/projects.elsql
index ffc4192..74f16b9 100644
--- a/components/camel-elsql/src/test/resources/elsql/projects.elsql
+++ b/components/camel-elsql/src/test/resources/elsql/projects.elsql
@@ -3,6 +3,11 @@
FROM projects
WHERE license = :body
ORDER BY id
+@NAME(projectsByIdBody)
+ SELECT *
+ FROM projects
+ WHERE license = :${body.license}
+ ORDER BY id
@NAME(allProjects)
SELECT *
FROM projects
[2/4] camel git commit: CAMEL-9192: camel-elsql - Allow using simple
language as named parameters
Posted by da...@apache.org.
CAMEL-9192: camel-elsql - Allow using simple language as named parameters
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/77644c08
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/77644c08
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/77644c08
Branch: refs/heads/master
Commit: 77644c086b21f093f36d88224d4c1829ff5ed0ba
Parents: db1651d
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Oct 9 18:20:11 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Oct 9 18:20:11 2015 +0200
----------------------------------------------------------------------
components/camel-elsql/pom.xml | 2 +-
parent/pom.xml | 2 +-
platforms/karaf/features/src/main/resources/features.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/77644c08/components/camel-elsql/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-elsql/pom.xml b/components/camel-elsql/pom.xml
index b883e1d..1fcf3b0 100644
--- a/components/camel-elsql/pom.xml
+++ b/components/camel-elsql/pom.xml
@@ -56,7 +56,7 @@
<dependency>
<groupId>com.opengamma</groupId>
<artifactId>elsql</artifactId>
- <version>1.1.1-SNAPSHOT</version>
+ <version>${elsql-version}</version>
</dependency>
<!-- test dependencies -->
http://git-wip-us.apache.org/repos/asf/camel/blob/77644c08/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 608a414..cce7094 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -146,7 +146,7 @@
<egit-github-core-bundle-version>2.1.5_1</egit-github-core-bundle-version>
<elasticsearch-bundle-version>1.7.1_1</elasticsearch-bundle-version>
<elasticsearch-version>1.7.1</elasticsearch-version>
- <elsql-version>1.1</elsql-version>
+ <elsql-version>1.2</elsql-version>
<el-api-1.0-version>1.0.1</el-api-1.0-version>
<embedmongo-version>1.50.0</embedmongo-version>
<exec-maven-plugin-version>1.4.0</exec-maven-plugin-version>
http://git-wip-us.apache.org/repos/asf/camel/blob/77644c08/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 7d2445c..54871ce 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -383,7 +383,7 @@
</feature>
<feature name='camel-elsql' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version="${project.version}">camel-sql</feature>
- <bundle dependency="true">wrap:mvn:com.opengamma/elsql/${elsql-version}</bundle>
+ <bundle dependency="true">mvn:com.opengamma/elsql/${elsql-version}</bundle>
<bundle>mvn:org.apache.camel/camel-elsql/${project.version}</bundle>
</feature>
<feature name='camel-elasticsearch' version='${project.version}' resolver='(obr)' start-level='50'>
[4/4] camel git commit: CAMEL-9192: camel-elsql - Allow using simple
language as named parameters
Posted by da...@apache.org.
CAMEL-9192: camel-elsql - Allow using simple language as named parameters
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c1e0f30c
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c1e0f30c
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c1e0f30c
Branch: refs/heads/camel-2.16.x
Commit: c1e0f30c41b46338e388f8a0665a8dc6455ba84f
Parents: 898d5c7
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Oct 9 18:20:11 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Oct 9 18:20:52 2015 +0200
----------------------------------------------------------------------
components/camel-elsql/pom.xml | 2 +-
parent/pom.xml | 2 +-
platforms/karaf/features/src/main/resources/features.xml | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/c1e0f30c/components/camel-elsql/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-elsql/pom.xml b/components/camel-elsql/pom.xml
index 958d871..8b22a3b 100644
--- a/components/camel-elsql/pom.xml
+++ b/components/camel-elsql/pom.xml
@@ -56,7 +56,7 @@
<dependency>
<groupId>com.opengamma</groupId>
<artifactId>elsql</artifactId>
- <version>1.1.1-SNAPSHOT</version>
+ <version>${elsql-version}</version>
</dependency>
<!-- test dependencies -->
http://git-wip-us.apache.org/repos/asf/camel/blob/c1e0f30c/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index ed399a0..22b8141 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -146,7 +146,7 @@
<egit-github-core-bundle-version>2.1.5_1</egit-github-core-bundle-version>
<elasticsearch-bundle-version>1.7.1_1</elasticsearch-bundle-version>
<elasticsearch-version>1.7.1</elasticsearch-version>
- <elsql-version>1.1</elsql-version>
+ <elsql-version>1.2</elsql-version>
<el-api-1.0-version>1.0.1</el-api-1.0-version>
<embedmongo-version>1.50.0</embedmongo-version>
<exec-maven-plugin-version>1.2.1</exec-maven-plugin-version>
http://git-wip-us.apache.org/repos/asf/camel/blob/c1e0f30c/platforms/karaf/features/src/main/resources/features.xml
----------------------------------------------------------------------
diff --git a/platforms/karaf/features/src/main/resources/features.xml b/platforms/karaf/features/src/main/resources/features.xml
index 7d2445c..54871ce 100644
--- a/platforms/karaf/features/src/main/resources/features.xml
+++ b/platforms/karaf/features/src/main/resources/features.xml
@@ -383,7 +383,7 @@
</feature>
<feature name='camel-elsql' version='${project.version}' resolver='(obr)' start-level='50'>
<feature version="${project.version}">camel-sql</feature>
- <bundle dependency="true">wrap:mvn:com.opengamma/elsql/${elsql-version}</bundle>
+ <bundle dependency="true">mvn:com.opengamma/elsql/${elsql-version}</bundle>
<bundle>mvn:org.apache.camel/camel-elsql/${project.version}</bundle>
</feature>
<feature name='camel-elasticsearch' version='${project.version}' resolver='(obr)' start-level='50'>
[3/4] camel git commit: When elsql supports functions
Posted by da...@apache.org.
When elsql supports functions
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/898d5c76
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/898d5c76
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/898d5c76
Branch: refs/heads/camel-2.16.x
Commit: 898d5c761f6e728ea43f22538de003a7880e6515
Parents: 252bee8
Author: Claus Ibsen <da...@apache.org>
Authored: Wed Oct 7 18:19:06 2015 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Oct 9 18:20:48 2015 +0200
----------------------------------------------------------------------
components/camel-elsql/pom.xml | 2 +-
.../component/elsql/ElsqlSqlMapSource.java | 6 ++
.../elsql/ElSqlProducerBodySimpleTest.java | 88 ++++++++++++++++++++
.../apache/camel/component/elsql/Project.java | 48 +++++++++++
.../src/test/resources/elsql/projects.elsql | 5 ++
5 files changed, 148 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/898d5c76/components/camel-elsql/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-elsql/pom.xml b/components/camel-elsql/pom.xml
index 8b22a3b..958d871 100644
--- a/components/camel-elsql/pom.xml
+++ b/components/camel-elsql/pom.xml
@@ -56,7 +56,7 @@
<dependency>
<groupId>com.opengamma</groupId>
<artifactId>elsql</artifactId>
- <version>${elsql-version}</version>
+ <version>1.1.1-SNAPSHOT</version>
</dependency>
<!-- test dependencies -->
http://git-wip-us.apache.org/repos/asf/camel/blob/898d5c76/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java b/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java
index 725022e..eb489af 100644
--- a/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java
+++ b/components/camel-elsql/src/main/java/org/apache/camel/component/elsql/ElsqlSqlMapSource.java
@@ -20,6 +20,7 @@ import java.util.Collections;
import java.util.Map;
import org.apache.camel.Exchange;
+import org.apache.camel.language.simple.SimpleLanguage;
import org.springframework.jdbc.core.namedparam.AbstractSqlParameterSource;
/**
@@ -48,6 +49,8 @@ public class ElsqlSqlMapSource extends AbstractSqlParameterSource {
public boolean hasValue(String paramName) {
if ("body".equals(paramName)) {
return true;
+ } else if (paramName.startsWith("${") && paramName.endsWith("}")) {
+ return true;
} else {
return bodyMap.containsKey(paramName) || headersMap.containsKey(paramName);
}
@@ -58,6 +61,9 @@ public class ElsqlSqlMapSource extends AbstractSqlParameterSource {
Object answer;
if ("body".equals(paramName)) {
answer = exchange.getIn().getBody();
+ } else if (paramName.startsWith("${") && paramName.endsWith("}")) {
+ // its a simple language expression
+ answer = SimpleLanguage.expression(paramName).evaluate(exchange, Object.class);
} else {
answer = bodyMap.get(paramName);
if (answer == null) {
http://git-wip-us.apache.org/repos/asf/camel/blob/898d5c76/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/ElSqlProducerBodySimpleTest.java
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/ElSqlProducerBodySimpleTest.java b/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/ElSqlProducerBodySimpleTest.java
new file mode 100644
index 0000000..595017e
--- /dev/null
+++ b/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/ElSqlProducerBodySimpleTest.java
@@ -0,0 +1,88 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elsql;
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.impl.JndiRegistry;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Test;
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabase;
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder;
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType;
+
+public class ElSqlProducerBodySimpleTest extends CamelTestSupport {
+
+ private EmbeddedDatabase db;
+
+ @Override
+ protected JndiRegistry createRegistry() throws Exception {
+ JndiRegistry jndi = super.createRegistry();
+
+ // this is the database we create with some initial data for our unit test
+ db = new EmbeddedDatabaseBuilder()
+ .setType(EmbeddedDatabaseType.DERBY).addScript("sql/createAndPopulateDatabase.sql").build();
+
+ jndi.bind("dataSource", db);
+
+ return jndi;
+ }
+
+ @Test
+ public void testSimpleBody() throws Exception {
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedMessageCount(1);
+
+ Project pojo = new Project();
+ pojo.setLicense("XXX");
+
+ template.sendBody("direct:simple", pojo);
+
+ mock.assertIsSatisfied();
+
+ // the result is a List
+ List<?> received = assertIsInstanceOf(List.class, mock.getReceivedExchanges().get(0).getIn().getBody());
+
+ // and each row in the list is a Map
+ Map<?, ?> row = assertIsInstanceOf(Map.class, received.get(0));
+
+ // and we should be able the get the project from the map that should be Linux
+ assertEquals("Linux", row.get("PROJECT"));
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ super.tearDown();
+
+ db.shutdown();
+ }
+
+ @Override
+ protected RouteBuilder createRouteBuilder() throws Exception {
+ return new RouteBuilder() {
+ public void configure() {
+ from("direct:simple")
+ .to("elsql:projectsByIdBody:elsql/projects.elsql?dataSource=dataSource")
+ .to("mock:result");
+ }
+ };
+ }
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/camel/blob/898d5c76/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/Project.java
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/Project.java b/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/Project.java
new file mode 100644
index 0000000..9f6c19e
--- /dev/null
+++ b/components/camel-elsql/src/test/java/org/apache/camel/component/elsql/Project.java
@@ -0,0 +1,48 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.elsql;
+
+public class Project {
+
+ private String id;
+ private String license;
+ private String name;
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getLicense() {
+ return license;
+ }
+
+ public void setLicense(String license) {
+ this.license = license;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/898d5c76/components/camel-elsql/src/test/resources/elsql/projects.elsql
----------------------------------------------------------------------
diff --git a/components/camel-elsql/src/test/resources/elsql/projects.elsql b/components/camel-elsql/src/test/resources/elsql/projects.elsql
index ffc4192..74f16b9 100644
--- a/components/camel-elsql/src/test/resources/elsql/projects.elsql
+++ b/components/camel-elsql/src/test/resources/elsql/projects.elsql
@@ -3,6 +3,11 @@
FROM projects
WHERE license = :body
ORDER BY id
+@NAME(projectsByIdBody)
+ SELECT *
+ FROM projects
+ WHERE license = :${body.license}
+ ORDER BY id
@NAME(allProjects)
SELECT *
FROM projects