You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2016/12/05 13:12:40 UTC
[07/25] camel git commit: CAMEL-10559: route parser for java and xml
to parse source code. Donated from fabric8 project.
CAMEL-10559: route parser for java and xml to parse source code. Donated from fabric8 project.
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/745f46fd
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/745f46fd
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/745f46fd
Branch: refs/heads/master
Commit: 745f46fda1447ec5939767471f4ebeda2804d9e8
Parents: 42e4d97
Author: Claus Ibsen <da...@apache.org>
Authored: Mon Dec 5 11:58:46 2016 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Mon Dec 5 14:04:48 2016 +0100
----------------------------------------------------------------------
tooling/route-parser/pom.xml | 58 ++++++++-
.../camel/parser/MyBasePortRouteBuilder.java | 26 ++++
.../camel/parser/MyCdiConcatRouteBuilder.java | 48 +++++++
.../apache/camel/parser/MyCdiRouteBuilder.java | 45 +++++++
.../camel/parser/MyConcatFieldRouteBuilder.java | 30 +++++
.../parser/MyFieldMethodCallRouteBuilder.java | 32 +++++
.../camel/parser/MyFieldRouteBuilder.java | 30 +++++
.../parser/MyLocalAddRouteBuilderTest.java | 51 ++++++++
.../camel/parser/MyMethodCallRouteBuilder.java | 32 +++++
.../org/apache/camel/parser/MyNettyTest.java | 51 ++++++++
.../parser/MyNewLineConstRouteBuilder.java | 33 +++++
.../camel/parser/MyNewLineRouteBuilder.java | 30 +++++
.../org/apache/camel/parser/MyRouteBuilder.java | 30 +++++
.../camel/parser/MyRouteEmptyUriTest.java | 41 ++++++
.../org/apache/camel/parser/MyRouteTest.java | 39 ++++++
.../camel/parser/MySimpleRouteBuilder.java | 33 +++++
.../apache/camel/parser/MySimpleToDRoute.java | 33 +++++
.../apache/camel/parser/MySimpleToFRoute.java | 27 ++++
...asterCdiConcatRouteBuilderConfigureTest.java | 52 ++++++++
.../RoasterCdiRouteBuilderConfigureTest.java | 52 ++++++++
...terConcatFieldRouteBuilderConfigureTest.java | 51 ++++++++
.../camel/parser/RoasterEndpointInjectTest.java | 69 ++++++++++
.../RoasterFieldRouteBuilderConfigureTest.java | 52 ++++++++
...sterMethodCallRouteBuilderConfigureTest.java | 52 ++++++++
...ieldMethodCallRouteBuilderConfigureTest.java | 54 ++++++++
.../RoasterMyLocalAddRouteBuilderTest.java | 54 ++++++++
.../apache/camel/parser/RoasterMyNettyTest.java | 54 ++++++++
...erNewLineConstRouteBuilderConfigureTest.java | 52 ++++++++
...RoasterNewLineRouteBuilderConfigureTest.java | 52 ++++++++
...RoasterRouteBuilderCamelTestSupportTest.java | 51 ++++++++
.../RoasterRouteBuilderConfigureTest.java | 53 ++++++++
.../parser/RoasterRouteBuilderEmptyUriTest.java | 52 ++++++++
.../parser/RoasterSimpleProcessorTest.java | 60 +++++++++
.../RoasterSimpleRouteBuilderConfigureTest.java | 68 ++++++++++
.../camel/parser/RoasterSimpleToDTest.java | 69 ++++++++++
.../camel/parser/RoasterSimpleToFTest.java | 63 ++++++++++
.../camel/parser/RoasterSplitTokenizeTest.java | 71 +++++++++++
.../camel/parser/SimpleProcessorTest.java | 44 +++++++
.../apache/camel/parser/SplitTokenizeTest.java | 125 +++++++++++++++++++
.../src/test/resources/log4j2.properties | 30 +++++
40 files changed, 1948 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/745f46fd/tooling/route-parser/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/route-parser/pom.xml b/tooling/route-parser/pom.xml
index b6f51a0..b374453 100644
--- a/tooling/route-parser/pom.xml
+++ b/tooling/route-parser/pom.xml
@@ -15,7 +15,8 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -33,11 +34,66 @@
</properties>
<dependencies>
+
<dependency>
<groupId>org.jboss.forge.roaster</groupId>
<artifactId>roaster-jdt</artifactId>
<version>${roaster-version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cdi</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-test-cdi</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.logging.log4j</groupId>
+ <artifactId>log4j-slf4j-impl</artifactId>
+ <scope>test</scope>
+ </dependency>
+
</dependencies>
</project>
http://git-wip-us.apache.org/repos/asf/camel/blob/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyBasePortRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyBasePortRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyBasePortRouteBuilder.java
new file mode 100644
index 0000000..1aa0f7c
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyCdiConcatRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyCdiConcatRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyCdiConcatRouteBuilder.java
new file mode 100644
index 0000000..9a44d71
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyCdiRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyCdiRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyCdiRouteBuilder.java
new file mode 100644
index 0000000..480d7f1
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyConcatFieldRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyConcatFieldRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyConcatFieldRouteBuilder.java
new file mode 100644
index 0000000..781a471
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyFieldMethodCallRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyFieldMethodCallRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyFieldMethodCallRouteBuilder.java
new file mode 100644
index 0000000..0b21b17
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyFieldRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyFieldRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyFieldRouteBuilder.java
new file mode 100644
index 0000000..7e3c21c
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyLocalAddRouteBuilderTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyLocalAddRouteBuilderTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyLocalAddRouteBuilderTest.java
new file mode 100644
index 0000000..072a60b
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyMethodCallRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyMethodCallRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyMethodCallRouteBuilder.java
new file mode 100644
index 0000000..cfa900d
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNettyTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNettyTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNettyTest.java
new file mode 100644
index 0000000..af56cc1
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNewLineConstRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNewLineConstRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNewLineConstRouteBuilder.java
new file mode 100644
index 0000000..c7a4628
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNewLineRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNewLineRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyNewLineRouteBuilder.java
new file mode 100644
index 0000000..6eeff01
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteBuilder.java
new file mode 100644
index 0000000..a8d5dfdc
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteEmptyUriTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteEmptyUriTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteEmptyUriTest.java
new file mode 100644
index 0000000..1a1cfa4
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MyRouteTest.java
new file mode 100644
index 0000000..0647945
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleRouteBuilder.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleRouteBuilder.java
new file mode 100644
index 0000000..cfd6bd1
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleToDRoute.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleToDRoute.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleToDRoute.java
new file mode 100644
index 0000000..bafce03
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleToFRoute.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleToFRoute.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/MySimpleToFRoute.java
new file mode 100644
index 0000000..7180161
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/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;
+
+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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterCdiConcatRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterCdiConcatRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterCdiConcatRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..a1c3e54
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterCdiConcatRouteBuilderConfigureTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterCdiRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterCdiRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterCdiRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..3ced7bc
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterCdiRouteBuilderConfigureTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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;
+
+import java.io.File;
+import java.util.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterConcatFieldRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterConcatFieldRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterConcatFieldRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..2f376e2
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterConcatFieldRouteBuilderConfigureTest.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;
+
+import java.io.File;
+import java.util.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterEndpointInjectTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterEndpointInjectTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterEndpointInjectTest.java
new file mode 100644
index 0000000..a61a95a
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterEndpointInjectTest.java
@@ -0,0 +1,69 @@
+/**
+ * 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 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/MyCdiRouteBuilder.java"));
+ MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+ List<CamelEndpointDetails> details = new ArrayList<>();
+ RouteBuilderParser.parseRouteBuilderEndpoints(clazz, ".", "src/test/java/org/apache/camel/parser/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterFieldRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterFieldRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterFieldRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..39d8944
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterFieldRouteBuilderConfigureTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMethodCallRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMethodCallRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMethodCallRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..09bf2b7
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMethodCallRouteBuilderConfigureTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyFieldMethodCallRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyFieldMethodCallRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyFieldMethodCallRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..9cfe117
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyFieldMethodCallRouteBuilderConfigureTest.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;
+
+import java.io.File;
+import java.util.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyLocalAddRouteBuilderTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyLocalAddRouteBuilderTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyLocalAddRouteBuilderTest.java
new file mode 100644
index 0000000..44c1189
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyLocalAddRouteBuilderTest.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;
+
+import java.io.File;
+import java.util.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyNettyTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyNettyTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyNettyTest.java
new file mode 100644
index 0000000..cf48862
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterMyNettyTest.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;
+
+import java.io.File;
+import java.util.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterNewLineConstRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterNewLineConstRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterNewLineConstRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..c2dbb0e
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterNewLineConstRouteBuilderConfigureTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterNewLineRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterNewLineRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterNewLineRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..ad3493b
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterNewLineRouteBuilderConfigureTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderCamelTestSupportTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderCamelTestSupportTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderCamelTestSupportTest.java
new file mode 100644
index 0000000..e74a5be
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderCamelTestSupportTest.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;
+
+import java.io.File;
+import java.util.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..a5ab68a
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderConfigureTest.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;
+
+import java.io.File;
+import java.util.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderEmptyUriTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderEmptyUriTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderEmptyUriTest.java
new file mode 100644
index 0000000..11b272b
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterRouteBuilderEmptyUriTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.List;
+
+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/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleProcessorTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleProcessorTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleProcessorTest.java
new file mode 100644
index 0000000..06f686a
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleProcessorTest.java
@@ -0,0 +1,60 @@
+/**
+ * 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 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/SimpleProcessorTest.java"));
+ MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+ List<CamelEndpointDetails> details = new ArrayList<CamelEndpointDetails>();
+ RouteBuilderParser.parseRouteBuilderEndpoints(clazz, ".", "src/test/java/org/apache/camel/parser/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/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleRouteBuilderConfigureTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..38d1211
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleRouteBuilderConfigureTest.java
@@ -0,0 +1,68 @@
+/**
+ * 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.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.util.List;
+
+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/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/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;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleToDTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleToDTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleToDTest.java
new file mode 100644
index 0000000..70a064a
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleToDTest.java
@@ -0,0 +1,69 @@
+/**
+ * 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 RoasterSimpleToDTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RoasterSimpleToDTest.class);
+
+ @Test
+ public void parse() throws Exception {
+ JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/MySimpleToDRoute.java"));
+ MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+ List<CamelEndpointDetails> details = new ArrayList<>();
+ RouteBuilderParser.parseRouteBuilderEndpoints(clazz, ".", "src/test/java/org/apache/camel/parser/MySimpleToDRoute.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("toD", list.get(0).getNode());
+ Assert.assertEquals("log:a", list.get(0).getElement());
+ Assert.assertEquals("to", list.get(1).getNode());
+ Assert.assertEquals("log:b", list.get(1).getElement());
+ Assert.assertEquals("to", list.get(2).getNode());
+ Assert.assertEquals("log:c", list.get(2).getElement());
+ Assert.assertEquals(3, list.size());
+
+ Assert.assertEquals(4, details.size());
+ Assert.assertEquals("direct:start", details.get(0).getEndpointUri());
+ Assert.assertEquals("log:a", details.get(1).getEndpointUri());
+ Assert.assertEquals("log:b", details.get(2).getEndpointUri());
+ Assert.assertEquals("log:c", details.get(3).getEndpointUri());
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/745f46fd/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleToFTest.java
----------------------------------------------------------------------
diff --git a/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleToFTest.java b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleToFTest.java
new file mode 100644
index 0000000..84eb77e
--- /dev/null
+++ b/tooling/route-parser/src/test/java/org/apache/camel/parser/RoasterSimpleToFTest.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;
+
+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 RoasterSimpleToFTest {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RoasterSimpleToFTest.class);
+
+ @Test
+ public void parse() throws Exception {
+ JavaClassSource clazz = (JavaClassSource) Roaster.parse(new File("src/test/java/org/apache/camel/parser/MySimpleToFRoute.java"));
+ MethodSource<JavaClassSource> method = CamelJavaParserHelper.findConfigureMethod(clazz);
+
+ List<CamelEndpointDetails> details = new ArrayList<>();
+ RouteBuilderParser.parseRouteBuilderEndpoints(clazz, ".", "src/test/java/org/apache/camel/parser/MySimpleToFRoute.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("toF", list.get(0).getNode());
+ Assert.assertEquals("log:a?level={{%s}}", list.get(0).getElement());
+ Assert.assertEquals(1, list.size());
+
+ Assert.assertEquals(2, details.size());
+ Assert.assertEquals("direct:start", details.get(0).getEndpointUri());
+ Assert.assertEquals("log:a?level={{%s}}", details.get(1).getEndpointUri());
+ }
+
+}