camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [09/25] camel git commit: CAMEL-10559: route parser for java and xml to parse source code. Donated from fabric8 project.
Date Mon, 05 Dec 2016 13:12:42 GMT
http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSplitTokenizeTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSplitTokenizeTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSplitTokenizeTest.java
deleted file mode 100644
index c12a5e3..0000000
--- a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSplitTokenizeTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- *  Copyright 2005-2015 Red Hat, Inc.
- *
- *  Red Hat 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.parser;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.camel.parser.model.CamelEndpointDetails;
-import org.jboss.forge.roaster.Roaster;
-import org.jboss.forge.roaster.model.source.JavaClassSource;
-import org.jboss.forge.roaster.model.source.MethodSource;
-import org.junit.Assert;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RoasterSplitTokenizeTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger(RoasterSplitTokenizeTest.class);
-
-    @Test
-    public void parse() throws Exception {
-        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/SplitTokenizeTest.java"));
-        MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
-
-        List<CamelEndpointDetails> details = new ArrayList<>();
-        RouteBuilderParser.parseRouteBuilderEndpoints(clazz, "src/test/java", "org/apache/camel/parser/SplitTokenizeTest.java", details);
-        LOG.info("{}", details);
-
-        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
-        for (ParserResult result : list) {
-            LOG.info("Consumer: " + result.getElement());
-        }
-        Assert.assertEquals("direct:a", list.get(0).getElement());
-        Assert.assertEquals("direct:b", list.get(1).getElement());
-        Assert.assertEquals("direct:c", list.get(2).getElement());
-        Assert.assertEquals("direct:d", list.get(3).getElement());
-        Assert.assertEquals("direct:e", list.get(4).getElement());
-        Assert.assertEquals("direct:f", list.get(5).getElement());
-
-        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
-        for (ParserResult result : list) {
-            LOG.info("Producer: " + result.getElement());
-        }
-        Assert.assertEquals("mock:split", list.get(0).getElement());
-        Assert.assertEquals("mock:split", list.get(1).getElement());
-        Assert.assertEquals("mock:split", list.get(2).getElement());
-        Assert.assertEquals("mock:split", list.get(3).getElement());
-        Assert.assertEquals("mock:split", list.get(4).getElement());
-        Assert.assertEquals("mock:split", list.get(5).getElement());
-
-        Assert.assertEquals(12, details.size());
-        Assert.assertEquals("direct:a", details.get(0).getEndpointUri());
-        Assert.assertEquals("mock:split", details.get(11).getEndpointUri());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/SimpleProcessorTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/SimpleProcessorTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/SimpleProcessorTest.java
deleted file mode 100644
index 3c5f7b3..0000000
--- a/tooling/route-parser/src/test/java/org/apache/camel/parser/SimpleProcessorTest.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- *  Copyright 2005-2015 Red Hat, Inc.
- *
- *  Red Hat 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.parser;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.Processor;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.test.junit4.CamelTestSupport;
-
-public class SimpleProcessorTest extends CamelTestSupport {
-
-    public void testProcess() throws Exception {
-        String out = template.requestBody("direct:start", "Hello World", String.class);
-        assertEquals("Bye World", out);
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-                from("direct:start").process(new Processor() {
-                    public void process(Exchange exchange) throws Exception {
-                        exchange.getOut().setBody("Bye World");
-                    }
-                });
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/SplitTokenizeTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/SplitTokenizeTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/SplitTokenizeTest.java
deleted file mode 100644
index 251e531..0000000
--- a/tooling/route-parser/src/test/java/org/apache/camel/parser/SplitTokenizeTest.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/**
- *  Copyright 2005-2015 Red Hat, Inc.
- *
- *  Red Hat 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.parser;
-
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.mock.MockEndpoint;
-import org.apache.camel.test.junit4.CamelTestSupport;
-
-public class SplitTokenizeTest extends CamelTestSupport {
-
-    public void testSplitTokenizerA() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:split");
-        mock.expectedBodiesReceived("Claus", "James", "Willem");
-
-        template.sendBody("direct:a", "Claus,James,Willem");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    public void testSplitTokenizerB() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:split");
-        mock.expectedBodiesReceived("Claus", "James", "Willem");
-
-        template.sendBodyAndHeader("direct:b", "Hello World", "myHeader", "Claus,James,Willem");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    public void testSplitTokenizerC() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:split");
-        mock.expectedBodiesReceived("Claus", "James", "Willem");
-
-        template.sendBody("direct:c", "Claus James Willem");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    public void testSplitTokenizerD() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:split");
-        mock.expectedBodiesReceived("[Claus]", "[James]", "[Willem]");
-
-        template.sendBody("direct:d", "[Claus][James][Willem]");
-
-        assertMockEndpointsSatisfied();
-    }
-
-    public void testSplitTokenizerE() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:split");
-        mock.expectedBodiesReceived("<person>Claus</person>", "<person>James</person>", "<person>Willem</person>");
-
-        String xml = "<persons><person>Claus</person><person>James</person><person>Willem</person></persons>";
-        template.sendBody("direct:e", xml);
-
-        assertMockEndpointsSatisfied();
-    }
-
-    public void testSplitTokenizerEWithSlash() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:split");
-        String xml = "<persons><person attr='/' /></persons>";
-        mock.expectedBodiesReceived("<person attr='/' />");
-        template.sendBody("direct:e", xml);
-        mock.assertIsSatisfied();
-        assertMockEndpointsSatisfied();
-    }
-
-    public void testSplitTokenizerF() throws Exception {
-        MockEndpoint mock = getMockEndpoint("mock:split");
-        mock.expectedBodiesReceived("<person name=\"Claus\"/>", "<person>James</person>", "<person>Willem</person>");
-
-        String xml = "<persons><person/><person name=\"Claus\"/><person>James</person><person>Willem</person></persons>";
-        template.sendBody("direct:f", xml);
-
-        assertMockEndpointsSatisfied();
-    }
-
-    @Override
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            @Override
-            public void configure() throws Exception {
-
-                from("direct:a")
-                        .split().tokenize(",")
-                        .to("mock:split");
-
-                from("direct:b")
-                        .split().tokenize(",", "myHeader")
-                        .to("mock:split");
-
-                from("direct:c")
-                        .split().tokenize("(\\W+)\\s*", null, true)
-                        .to("mock:split");
-
-                from("direct:d")
-                        .split().tokenizePair("[", "]", true)
-                        .to("mock:split");
-
-                from("direct:e")
-                        .split().tokenizeXML("person")
-                        .to("mock:split");
-
-                from("direct:f")
-                        .split().xpath("//person")
-                        // To test the body is not empty
-                        // it will call the ObjectHelper.evaluateValuePredicate()
-                        .filter().simple("${body}")
-                        .to("mock:split");
-
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyBasePortRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyBasePortRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyBasePortRouteBuilder.java
new file mode 100644
index 0000000..1a4336e
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyBasePortRouteBuilder.java
@@ -0,0 +1,26 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public abstract class MyBasePortRouteBuilder extends RouteBuilder {
+
+    public int getNextPort() {
+        return 8080;
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java
new file mode 100644
index 0000000..1360d00
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java
@@ -0,0 +1,48 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import javax.inject.Inject;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.Uri;
+
+public class MyCdiConcatRouteBuilder extends RouteBuilder {
+
+    private static final int DELAY = 4999;
+    private static final int PORT = 80;
+
+    @Inject
+    @Uri("timer:foo?period=" + DELAY)
+    private Endpoint inputEndpoint;
+
+    @Inject
+    @Uri("log:a")
+    private Endpoint loga;
+
+    @EndpointInject(uri = "netty4-http:http:someserver:" + PORT + "/hello")
+    private Endpoint mynetty;
+
+    @Override
+    public void configure() throws Exception {
+        from(inputEndpoint)
+            .log("I was here")
+            .to(loga)
+            .to(mynetty);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java
new file mode 100644
index 0000000..16261bb
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java
@@ -0,0 +1,45 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import javax.inject.Inject;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.cdi.Uri;
+
+public class MyCdiRouteBuilder extends RouteBuilder {
+
+    @Inject
+    @Uri("timer:foo?period=4999")
+    private Endpoint inputEndpoint;
+
+    @Inject
+    @Uri("log:a")
+    private Endpoint loga;
+
+    @Inject
+    @Uri("netty4-http:http:someserver:80/hello")
+    private Endpoint mynetty;
+
+    @Override
+    public void configure() throws Exception {
+        from(inputEndpoint)
+            .log("I was here")
+            .to(loga)
+            .to(mynetty);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java
new file mode 100644
index 0000000..7fedeaf
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java
@@ -0,0 +1,30 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MyConcatFieldRouteBuilder extends RouteBuilder {
+
+    private int ftpPort;
+    private String ftp = "ftp:localhost:" + ftpPort + "/myapp?password=admin&username=admin";
+
+    @Override
+    public void configure() throws Exception {
+        from(ftp)
+            .to("log:b");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java
new file mode 100644
index 0000000..5cdfa5d
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java
@@ -0,0 +1,32 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+public class MyFieldMethodCallRouteBuilder extends MyBasePortRouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        int port2 = getNextPort();
+
+        from("netty-http:http://0.0.0.0:{{port}}/foo")
+                .to("mock:input1")
+                .to("netty-http:http://0.0.0.0:" + port2 + "/bar");
+        from("netty-http:http://0.0.0.0:" + port2 + "/bar")
+                .to("mock:input2")
+                .transform().constant("Bye World");
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java
new file mode 100644
index 0000000..7515c58
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java
@@ -0,0 +1,30 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MyFieldRouteBuilder extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        String exists = "Override";
+
+        from("timer:foo")
+            .toD("file:output?fileExist=" + exists)
+            .to("log:b");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java
new file mode 100644
index 0000000..0409d4b
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java
@@ -0,0 +1,51 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class MyLocalAddRouteBuilderTest extends CamelTestSupport {
+
+    @Override
+    public boolean isUseRouteBuilder() {
+        return false;
+    }
+
+    @Test
+    public void testFoo() throws Exception {
+        log.info("Adding a route locally");
+
+        context.addRoutes(new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:start")
+                    .to("mock:foo");
+            }
+        });
+        context.start();
+
+        getMockEndpoint("mock:foo").expectedMessageCount(1);
+
+        template.sendBody("direct:start", "Hello World");
+
+        assertMockEndpointsSatisfied();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java
new file mode 100644
index 0000000..2a56891
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java
@@ -0,0 +1,32 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MyMethodCallRouteBuilder extends RouteBuilder {
+
+    private String whatToDoWhenExists() {
+        return "Override";
+    }
+
+    @Override
+    public void configure() throws Exception {
+        from("timer:foo")
+            .to("file:output?fileExist=" + whatToDoWhenExists())
+            .to("log:b");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNettyTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNettyTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNettyTest.java
new file mode 100644
index 0000000..bf8f16b
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNettyTest.java
@@ -0,0 +1,51 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class MyNettyTest extends CamelTestSupport {
+
+    public int getNextPort() {
+        return 8080;
+    }
+
+    @Test
+    public void testFoo() throws Exception {
+        // noop
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            int port2 = getNextPort();
+
+            @Override
+            public void configure() throws Exception {
+                from("netty-http:http://0.0.0.0:{{port}}/foo")
+                        .to("mock:input1")
+                        .to("netty-http:http://0.0.0.0:" + port2 + "/bar");
+                from("netty-http:http://0.0.0.0:" + port2 + "/bar")
+                        .to("mock:input2")
+                        .transform().constant("Bye World");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java
new file mode 100644
index 0000000..95a0a4f
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java
@@ -0,0 +1,33 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MyNewLineConstRouteBuilder extends RouteBuilder {
+
+    private static final String EXISTS = "Append";
+    private static final int MOD = 770;
+
+    @Override
+    public void configure() throws Exception {
+        from("timer:foo")
+            .toD("file:output?fileExist=" + EXISTS
+                    + "&chmod=" + (MOD + 6 + 1)
+                    + "&allowNullBody=true")
+            .to("log:b");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java
new file mode 100644
index 0000000..4b34945
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java
@@ -0,0 +1,30 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MyNewLineRouteBuilder extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("timer:foo")
+            .toD("file:output?fileExist=Append"
+                    + "&chmod=777"
+                    + "&allowNullBody=true")
+            .to("log:b");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java
new file mode 100644
index 0000000..5bc9803
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java
@@ -0,0 +1,30 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MyRouteBuilder extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("timer:foo")
+            .log("I was here")
+            .toD("log:a")
+            .wireTap("mock:tap")
+            .to("log:b");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java
new file mode 100644
index 0000000..82732d2
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java
@@ -0,0 +1,41 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
+
+@Ignore
+public class MyRouteEmptyUriTest extends CamelTestSupport {
+
+    @Test
+    public void testFoo() throws Exception {
+        // noop
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:foo")
+                    .to(""); // is empty on purpose
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java
new file mode 100644
index 0000000..1a03847
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java
@@ -0,0 +1,39 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+
+public class MyRouteTest extends CamelTestSupport {
+
+    @Test
+    public void testFoo() throws Exception {
+        // noop
+    }
+
+    @Override
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            @Override
+            public void configure() throws Exception {
+                from("direct:foo")
+                    .to("mock:foo");
+            }
+        };
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java
new file mode 100644
index 0000000..490a575
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java
@@ -0,0 +1,33 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MySimpleRouteBuilder extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("timer:foo")
+            .filter(simple("${body} > 100"))
+                .toD("log:a")
+            .end()
+            .filter().simple("${body} > 200")
+                .to("log:b")
+            .end()
+            .to("log:c");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToDRoute.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToDRoute.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToDRoute.java
new file mode 100644
index 0000000..105791f
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToDRoute.java
@@ -0,0 +1,33 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.ExchangePattern;
+import org.apache.camel.builder.RouteBuilder;
+
+public class MySimpleToDRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+
+        String uri = "log:c";
+
+        from("direct:start")
+            .toD("log:a", true)
+            .to(ExchangePattern.InOnly, "log:b")
+            .to(uri);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java
new file mode 100644
index 0000000..89b3f0e
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java
@@ -0,0 +1,27 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import org.apache.camel.builder.RouteBuilder;
+
+public class MySimpleToFRoute extends RouteBuilder {
+
+    @Override
+    public void configure() throws Exception {
+        from("direct:start")
+            .toF("log:a?level=%s", "info");
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiConcatRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiConcatRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiConcatRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..90d0423
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiConcatRouteBuilderConfigureTest.java
@@ -0,0 +1,54 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterCdiConcatRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterCdiConcatRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("timer:foo?period=4999", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("log:a", list.get(0).getElement());
+        Assert.assertEquals("netty4-http:http:someserver:80/hello", list.get(1).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..2c0677c
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiRouteBuilderConfigureTest.java
@@ -0,0 +1,54 @@
+/**
+ * Copyright 2005-2015 Red Hat, Inc.
+ * <p/>
+ * Red Hat 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterCdiRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterCdiRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("timer:foo?period=4999", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("log:a", list.get(0).getElement());
+        Assert.assertEquals("netty4-http:http:someserver:80/hello", list.get(1).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterConcatFieldRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterConcatFieldRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterConcatFieldRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..a74d161
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterConcatFieldRouteBuilderConfigureTest.java
@@ -0,0 +1,53 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterConcatFieldRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterConcatFieldRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("ftp:localhost:{{ftpPort}}/myapp?password=admin&username=admin", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("log:b", list.get(0).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterEndpointInjectTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterEndpointInjectTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterEndpointInjectTest.java
new file mode 100644
index 0000000..5d54b7c
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterEndpointInjectTest.java
@@ -0,0 +1,72 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.apache.camel.parser.RouteBuilderParser;
+import org.apache.camel.parser.model.CamelEndpointDetails;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterEndpointInjectTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterEndpointInjectTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+        List<CamelEndpointDetails> details = new ArrayList<>();
+        RouteBuilderParser.parseRouteBuilderEndpoints(clazz, ".", "src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java", details);
+        LOG.info("{}", details);
+
+        Assert.assertEquals("timer:foo?period=4999", details.get(0).getEndpointUri());
+        Assert.assertEquals("27", details.get(0).getLineNumber());
+
+        Assert.assertEquals("log:a", details.get(1).getEndpointUri());
+        Assert.assertEquals("31", details.get(1).getLineNumber());
+
+        Assert.assertEquals("netty4-http:http:someserver:80/hello", details.get(2).getEndpointUri());
+        Assert.assertEquals("35", details.get(2).getLineNumber());
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("timer:foo?period=4999", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals(2, list.size());
+
+        Assert.assertEquals(5, details.size());
+        Assert.assertEquals("log:a", details.get(3).getEndpointUri());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterFieldRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterFieldRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterFieldRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..d3c7e72
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterFieldRouteBuilderConfigureTest.java
@@ -0,0 +1,54 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterFieldRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterFieldRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("timer:foo", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("file:output?fileExist=Override", list.get(0).getElement());
+        Assert.assertEquals("log:b", list.get(1).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMethodCallRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMethodCallRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMethodCallRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..18e589e
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMethodCallRouteBuilderConfigureTest.java
@@ -0,0 +1,54 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterMethodCallRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterMethodCallRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("timer:foo", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("file:output?fileExist={{whatToDoWhenExists}}", list.get(0).getElement());
+        Assert.assertEquals("log:b", list.get(1).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyFieldMethodCallRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyFieldMethodCallRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyFieldMethodCallRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..2be99cf
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyFieldMethodCallRouteBuilderConfigureTest.java
@@ -0,0 +1,56 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterMyFieldMethodCallRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterMyFieldMethodCallRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("netty-http:http://0.0.0.0:{{port}}/foo", list.get(0).getElement());
+        Assert.assertEquals("netty-http:http://0.0.0.0:{{getNextPort}}/bar", list.get(1).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("mock:input1", list.get(0).getElement());
+        Assert.assertEquals("netty-http:http://0.0.0.0:{{getNextPort}}/bar", list.get(1).getElement());
+        Assert.assertEquals("mock:input2", list.get(2).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyLocalAddRouteBuilderTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyLocalAddRouteBuilderTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyLocalAddRouteBuilderTest.java
new file mode 100644
index 0000000..523f906
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyLocalAddRouteBuilderTest.java
@@ -0,0 +1,56 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterMyLocalAddRouteBuilderTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterMyLocalAddRouteBuilderTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java"));
+        MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+        Assert.assertNull(method);
+
+        List<MethodSource<JavaClassSource>> methods = CamelJavaParserHelper.findInlinedConfigureMethods(clazz);
+        Assert.assertEquals(1, methods.size());
+        method = methods.get(0);
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyNettyTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyNettyTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyNettyTest.java
new file mode 100644
index 0000000..a787671
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterMyNettyTest.java
@@ -0,0 +1,56 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterMyNettyTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterMyNettyTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyNettyTest.java"));
+        MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("netty-http:http://0.0.0.0:{{port}}/foo", list.get(0).getElement());
+        Assert.assertEquals("netty-http:http://0.0.0.0:{{getNextPort}}/bar", list.get(1).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("mock:input1", list.get(0).getElement());
+        Assert.assertEquals("netty-http:http://0.0.0.0:{{getNextPort}}/bar", list.get(1).getElement());
+        Assert.assertEquals("mock:input2", list.get(2).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterNewLineConstRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterNewLineConstRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterNewLineConstRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..c6c36e5
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterNewLineConstRouteBuilderConfigureTest.java
@@ -0,0 +1,54 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterNewLineConstRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterNewLineConstRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("timer:foo", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("file:output?fileExist=Append&chmod=777&allowNullBody=true", list.get(0).getElement());
+        Assert.assertEquals("log:b", list.get(1).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterNewLineRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterNewLineRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterNewLineRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..999bcfd
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterNewLineRouteBuilderConfigureTest.java
@@ -0,0 +1,54 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterNewLineRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterNewLineRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("timer:foo", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("file:output?fileExist=Append&chmod=777&allowNullBody=true", list.get(0).getElement());
+        Assert.assertEquals("log:b", list.get(1).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderCamelTestSupportTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderCamelTestSupportTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderCamelTestSupportTest.java
new file mode 100644
index 0000000..b9e902b
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderCamelTestSupportTest.java
@@ -0,0 +1,53 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterRouteBuilderCamelTestSupportTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterRouteBuilderCamelTestSupportTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyRouteTest.java"));
+        MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("direct:foo", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("mock:foo", list.get(0).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..896b938
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderConfigureTest.java
@@ -0,0 +1,55 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("timer:foo", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals("log:a", list.get(0).getElement());
+        Assert.assertEquals("mock:tap", list.get(1).getElement());
+        Assert.assertEquals("log:b", list.get(2).getElement());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderEmptyUriTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderEmptyUriTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderEmptyUriTest.java
new file mode 100644
index 0000000..4391365
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterRouteBuilderEmptyUriTest.java
@@ -0,0 +1,54 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterRouteBuilderEmptyUriTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterRouteBuilderEmptyUriTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java"));
+        MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, false);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("direct:foo", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, false);
+        Assert.assertEquals(1, list.size());
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+            Assert.assertFalse("Should be invalid", result.isParsed());
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterSimpleProcessorTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterSimpleProcessorTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterSimpleProcessorTest.java
new file mode 100644
index 0000000..e0bcf99
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterSimpleProcessorTest.java
@@ -0,0 +1,63 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.apache.camel.parser.RouteBuilderParser;
+import org.apache.camel.parser.model.CamelEndpointDetails;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterSimpleProcessorTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterSimpleProcessorTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/SimpleProcessorTest.java"));
+        MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+        List<CamelEndpointDetails> details = new ArrayList<CamelEndpointDetails>();
+        RouteBuilderParser.parseRouteBuilderEndpoints(clazz, ".", "src/test/java/org/apache/camel/parser/java/SimpleProcessorTest.java", details);
+        LOG.info("{}", details);
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelConsumerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Consumer: " + result.getElement());
+        }
+        Assert.assertEquals("direct:start", list.get(0).getElement());
+
+        list = CamelJavaParserHelper.parseCamelProducerUris(method, true, true);
+        for (ParserResult result : list) {
+            LOG.info("Producer: " + result.getElement());
+        }
+        Assert.assertEquals(0, list.size());
+
+        Assert.assertEquals(1, details.size());
+        Assert.assertEquals("direct:start", details.get(0).getEndpointUri());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/b9253664/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterSimpleRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterSimpleRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterSimpleRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..18e96dd
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/java/RoasterSimpleRouteBuilderConfigureTest.java
@@ -0,0 +1,70 @@
+/**
+ *  Copyright 2005-2015 Red Hat, Inc.
+ *
+ *  Red Hat 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.parser.java;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.List;
+
+import org.apache.camel.parser.CamelJavaParserHelper;
+import org.apache.camel.parser.ParserResult;
+import org.jboss.forge.roaster.Roaster;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.junit.Assert;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class RoasterSimpleRouteBuilderConfigureTest {
+
+    private static final Logger LOG = LoggerFactory.getLogger(RoasterSimpleRouteBuilderConfigureTest.class);
+
+    @Test
+    public void parse() throws Exception {
+        JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java"));
+        MethodSource<JavaClassSource> method = clazz.getMethod("configure");
+
+        List<ParserResult> list = CamelJavaParserHelper.parseCamelSimpleExpressions(method);
+        for (ParserResult simple : list) {
+            LOG.info("Simple: " + simple.getElement());
+            LOG.info("  Line: " + findLineNumber(simple.getPosition()));
+        }
+        Assert.assertEquals("${body} > 100", list.get(0).getElement());
+        Assert.assertEquals(26, findLineNumber(list.get(0).getPosition()));
+        Assert.assertEquals("${body} > 200", list.get(1).getElement());
+        Assert.assertEquals(29, findLineNumber(list.get(1).getPosition()));
+    }
+
+    public static int findLineNumber(int pos) throws Exception {
+        int lines = 0;
+        int current = 0;
+        File file = new File("src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java");
+        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
+            String line;
+            while ((line = br.readLine()) != null) {
+                lines++;
+                current += line.length();
+                if (current > pos) {
+                    return lines;
+                }
+            }
+        }
+        return -1;
+    }
+
+}


Mime
View raw message