camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [3/4] camel git commit: https://stackoverflow.com/questions/43607569/simple-expression-in-sql-stored-component Added colon to Simple and parameter grammar
Date Mon, 08 May 2017 12:35:15 GMT
https://stackoverflow.com/questions/43607569/simple-expression-in-sql-stored-component Added
colon to Simple and parameter grammar


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/c63be354
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/c63be354
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/c63be354

Branch: refs/heads/camel-2.18.x
Commit: c63be3548a8feb551659f9bba0cfe6f88117c52c
Parents: 6802207
Author: Sami Nurminen <snurmine@gmail.com>
Authored: Tue May 2 20:39:01 2017 +0300
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Mon May 8 14:35:00 2017 +0200

----------------------------------------------------------------------
 .../sql/stored/template/grammar/sspt.jj         |  2 +-
 .../camel/component/sql/stored/ParserTest.java  | 21 ++++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c63be354/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
index 85a2f27..0ad95ed 100644
--- a/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
+++ b/components/camel-sql/src/main/java/org/apache/camel/component/sql/stored/template/grammar/sspt.jj
@@ -142,7 +142,7 @@ TOKEN: {
 }
 
 TOKEN: {
-    <#SPECIAL: (["#","_","-","'",".","$","{","}","\"","[","]"])>
+    <#SPECIAL: ([":","#","_","-","'",".","$","{","}","\"","[","]"])>
 }
 
 TOKEN: {

http://git-wip-us.apache.org/repos/asf/camel/blob/c63be354/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
----------------------------------------------------------------------
diff --git a/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
b/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
index 888a4d2..98a17f6 100644
--- a/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
+++ b/components/camel-sql/src/test/java/org/apache/camel/component/sql/stored/ParserTest.java
@@ -22,6 +22,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import org.apache.camel.Exchange;
+import org.apache.camel.component.properties.PropertiesComponent;
 import org.apache.camel.component.sql.stored.template.TemplateParser;
 import org.apache.camel.component.sql.stored.template.ast.InputParameter;
 import org.apache.camel.component.sql.stored.template.ast.OutParameter;
@@ -105,6 +106,26 @@ public class ParserTest extends CamelTestSupport {
     }
 
     @Test
+    public void colonInSimple() {
+
+        PropertiesComponent pc = (PropertiesComponent) context.getComponent("properties");
+        pc.setLocation("classpath:jndi.properties");
+        Exchange exchange = createExchangeWithBody(1);
+        Template template = parser.parseTemplate("ADDNUMBERS2(-1342 ${properties:java.naming.factory.initial})");
+        assertEquals("org.apache.camel.util.jndi.CamelInitialContextFactory",((InputParameter)template.getParameterList().get(0)).getValueExtractor().eval(exchange,
null));
+    }
+
+    @Test
+    public void colonInLocation() {
+        Template template = parser.parseTemplate("ADDNUMBERS2(-1342 :#a:)");
+        Exchange exchange = createExchangeWithBody(1);
+
+        Map container = new HashMap();
+        container.put("a:",1);
+        assertEquals(1, ((InputParameter) template.getParameterList().get(0)).getValueExtractor().eval(exchange,
container));
+    }
+
+    @Test
     public void vendorSpecificPositiveSqlTypeOut() {
         Template template = parser.parseTemplate("ADDNUMBERS2(OUT 1342 h1)");
         assertEquals(1342, ((OutParameter) template.getParameterList().get(0)).getSqlType());


Mime
View raw message