camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [camel] branch rest-dsl-parser updated: CAMEL-12824: camel-route-parser - Add parser for rest-dsl
Date Sun, 23 Sep 2018 08:54:29 GMT
This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch rest-dsl-parser
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/rest-dsl-parser by this push:
     new 6bf952d  CAMEL-12824: camel-route-parser - Add parser for rest-dsl
6bf952d is described below

commit 6bf952d53afbb9e011c8bec77d6a0492f74697f6
Author: Claus Ibsen <claus.ibsen@gmail.com>
AuthorDate: Sun Sep 23 10:53:41 2018 +0200

    CAMEL-12824: camel-route-parser - Add parser for rest-dsl
---
 .../java/org/apache/camel/parser/XmlRestDslParser.java |  2 ++
 .../parser/helper/CamelJavaRestDslParserHelper.java    |  4 ++++
 .../org/apache/camel/parser/model/RestVerbDetails.java | 18 ++++++++++++++++++
 .../camel/parser/java/MyRestDslRouteBuilder.java       |  2 +-
 .../camel/parser/java/RoasterJavaRestDslTest.java      |  2 ++
 5 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/XmlRestDslParser.java
b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/XmlRestDslParser.java
index 372c9e1..db7a835 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/XmlRestDslParser.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/XmlRestDslParser.java
@@ -33,6 +33,8 @@ import org.apache.camel.parser.model.RestConfigurationDetails;
  */
 public final class XmlRestDslParser {
 
+    // TODO: xml rest services
+
     private XmlRestDslParser() {
     }
 
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelJavaRestDslParserHelper.java
b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelJavaRestDslParserHelper.java
index 4a0222a..8c3018f 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelJavaRestDslParserHelper.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/CamelJavaRestDslParserHelper.java
@@ -372,6 +372,10 @@ public final class CamelJavaRestDslParserHelper {
             verb.setOutType(extractValueFromFirstArgument(clazz, block, mi));
         } else  if ("apiDocs".equals(name)) {
             verb.setApiDocs(extractValueFromFirstArgument(clazz, block, mi));
+        } else  if ("to".equals(name)) {
+            verb.setTo(extractValueFromFirstArgument(clazz, block, mi));
+        } else  if ("toD".equals(name)) {
+            verb.setToD(extractValueFromFirstArgument(clazz, block, mi));
         } else  if ("tag".equals(name)) {
             // tag is only available on the node
             node.setTag(extractValueFromFirstArgument(clazz, block, mi));
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/RestVerbDetails.java
b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/RestVerbDetails.java
index 58c7a72..ba384e2 100644
--- a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/RestVerbDetails.java
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/RestVerbDetails.java
@@ -40,6 +40,8 @@ public class RestVerbDetails {
     private String outType;
     private String description;
     private String apiDocs;
+    private String to;
+    private String toD;
 
     public String getFileName() {
         return fileName;
@@ -176,4 +178,20 @@ public class RestVerbDetails {
     public void setApiDocs(String apiDocs) {
         this.apiDocs = apiDocs;
     }
+
+    public String getTo() {
+        return to;
+    }
+
+    public void setTo(String to) {
+        this.to = to;
+    }
+
+    public String getToD() {
+        return toD;
+    }
+
+    public void setToD(String toD) {
+        this.toD = toD;
+    }
 }
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRestDslRouteBuilder.java
b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRestDslRouteBuilder.java
index a5b862c..70afcfb 100644
--- a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRestDslRouteBuilder.java
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRestDslRouteBuilder.java
@@ -46,6 +46,6 @@ public class MyRestDslRouteBuilder extends RouteBuilder {
                 .to("log:id")
             .post().bindingMode(RestBindingMode.xml)
                 .description("post something")
-                .to("log:post");
+                .toD("log:post");
     }
 }
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterJavaRestDslTest.java
b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterJavaRestDslTest.java
index 2879f61..e5ae2a5 100644
--- a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterJavaRestDslTest.java
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterJavaRestDslTest.java
@@ -91,10 +91,12 @@ public class RoasterJavaRestDslTest extends CamelTestSupport {
         assertEquals("get", details.getVerbs().get(0).getMethod());
         assertEquals("{id}", details.getVerbs().get(0).getUri());
         assertEquals("get by id", details.getVerbs().get(0).getDescription());
+        assertEquals("log:id", details.getVerbs().get(0).getTo());
         assertEquals("false", details.getVerbs().get(0).getApiDocs());
         assertEquals("post", details.getVerbs().get(1).getMethod());
         assertEquals("post something", details.getVerbs().get(1).getDescription());
         assertEquals("xml", details.getVerbs().get(1).getBindingMode());
+        assertEquals("log:post", details.getVerbs().get(1).getToD());
         assertNull(details.getVerbs().get(1).getUri());
     }
 


Mime
View raw message