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:54 UTC
[21/25] camel git commit: CAMEL-10559: route parser for java and xml
to parse source code. Donated from fabric8 project.
http://git-wip-us.apache.org/repos/asf/camel/blob/88ba9063/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/XmlLineNumberParser.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/XmlLineNumberParser.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/XmlLineNumberParser.java
new file mode 100644
index 0000000..b214b1e
--- /dev/null
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/helper/XmlLineNumberParser.java
@@ -0,0 +1,197 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.parser.helper;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.Stack;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * An XML parser that uses SAX to include line and column number for each XML element in the parsed Document.
+ * <p/>
+ * The line number and column number can be obtained from a Node/Element using
+ * <pre>
+ * String lineNumber = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER);
+ * String lineNumberEnd = (String) node.getUserData(XmlLineNumberParser.LINE_NUMBER_END);
+ * String columnNumber = (String) node.getUserData(XmlLineNumberParser.COLUMN_NUMBER);
+ * String columnNumberEnd = (String) node.getUserData(XmlLineNumberParser.COLUMN_NUMBER_END);
+ * </pre>
+ */
+public final class XmlLineNumberParser {
+
+ public static final String LINE_NUMBER = "lineNumber";
+ public static final String COLUMN_NUMBER = "colNumber";
+ public static final String LINE_NUMBER_END = "lineNumberEnd";
+ public static final String COLUMN_NUMBER_END = "colNumberEnd";
+
+ private XmlLineNumberParser() {
+ }
+
+ /**
+ * Parses the XML.
+ *
+ * @param is the XML content as an input stream
+ * @return the DOM model
+ * @throws Exception is thrown if error parsing
+ */
+ public static Document parseXml(final InputStream is) throws Exception {
+ return parseXml(is, null, null);
+ }
+
+ /**
+ * Parses the XML.
+ *
+ * @param is the XML content as an input stream
+ * @param rootNames one or more root names that is used as baseline for beginning the parsing, for example camelContext to start parsing
+ * when Camel is discovered. Multiple names can be defined separated by comma
+ * @param forceNamespace an optional namespace to force assign to each node. This may be needed for JAXB unmarshalling from XML -> POJO.
+ * @return the DOM model
+ * @throws Exception is thrown if error parsing
+ */
+ public static Document parseXml(final InputStream is, final String rootNames, final String forceNamespace) throws Exception {
+ final Document doc;
+ SAXParser parser;
+ final SAXParserFactory factory = SAXParserFactory.newInstance();
+ parser = factory.newSAXParser();
+ final DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+ // turn off validator and loading external dtd
+ dbf.setValidating(false);
+ dbf.setNamespaceAware(true);
+ dbf.setFeature("http://xml.org/sax/features/namespaces", false);
+ dbf.setFeature("http://xml.org/sax/features/validation", false);
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-dtd-grammar", false);
+ dbf.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
+ dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
+ dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ final DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+ doc = docBuilder.newDocument();
+
+ final Stack<Element> elementStack = new Stack<Element>();
+ final StringBuilder textBuffer = new StringBuilder();
+ final DefaultHandler handler = new DefaultHandler() {
+ private Locator locator;
+ private boolean found;
+
+ @Override
+ public void setDocumentLocator(final Locator locator) {
+ this.locator = locator; // Save the locator, so that it can be used later for line tracking when traversing nodes.
+ this.found = rootNames == null;
+ }
+
+ private boolean isRootName(String qName) {
+ for (String root : rootNames.split(",")) {
+ if (qName.equals(root)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void startElement(final String uri, final String localName, final String qName, final Attributes attributes) throws SAXException {
+ addTextIfNeeded();
+
+ if (rootNames != null && !found) {
+ if (isRootName(qName)) {
+ found = true;
+ }
+ }
+
+ if (found) {
+ Element el;
+ if (forceNamespace != null) {
+ el = doc.createElementNS(forceNamespace, qName);
+ } else {
+ el = doc.createElement(qName);
+ }
+
+ for (int i = 0; i < attributes.getLength(); i++) {
+ el.setAttribute(attributes.getQName(i), attributes.getValue(i));
+ }
+
+ el.setUserData(LINE_NUMBER, String.valueOf(this.locator.getLineNumber()), null);
+ el.setUserData(COLUMN_NUMBER, String.valueOf(this.locator.getColumnNumber()), null);
+ elementStack.push(el);
+ }
+ }
+
+ @Override
+ public void endElement(final String uri, final String localName, final String qName) {
+ if (!found) {
+ return;
+ }
+
+ addTextIfNeeded();
+
+ final Element closedEl = elementStack.isEmpty() ? null : elementStack.pop();
+ if (closedEl != null) {
+ if (elementStack.isEmpty()) {
+ // Is this the root element?
+ doc.appendChild(closedEl);
+ } else {
+ final Element parentEl = elementStack.peek();
+ parentEl.appendChild(closedEl);
+ }
+
+ closedEl.setUserData(LINE_NUMBER_END, String.valueOf(this.locator.getLineNumber()), null);
+ closedEl.setUserData(COLUMN_NUMBER_END, String.valueOf(this.locator.getColumnNumber()), null);
+ }
+ }
+
+ @Override
+ public void characters(final char ch[], final int start, final int length) throws SAXException {
+ textBuffer.append(ch, start, length);
+ }
+
+ @Override
+ public InputSource resolveEntity(String publicId, String systemId) throws IOException, SAXException {
+ // do not resolve external dtd
+ return new InputSource(new StringReader(""));
+ }
+
+ // Outputs text accumulated under the current node
+ private void addTextIfNeeded() {
+ if (textBuffer.length() > 0) {
+ final Element el = elementStack.isEmpty() ? null : elementStack.peek();
+ if (el != null) {
+ final Node textNode = doc.createTextNode(textBuffer.toString());
+ el.appendChild(textNode);
+ textBuffer.delete(0, textBuffer.length());
+ }
+ }
+ }
+ };
+ parser.parse(is, handler);
+
+ return doc;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/88ba9063/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelEndpointDetails.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelEndpointDetails.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelEndpointDetails.java
new file mode 100644
index 0000000..3b112a4
--- /dev/null
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelEndpointDetails.java
@@ -0,0 +1,175 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.parser.model;
+
+/**
+ * Details about a parsed and discovered Camel endpoint.
+ */
+public class CamelEndpointDetails {
+
+ private String fileName;
+ private String lineNumber;
+ private String lineNumberEnd;
+ private String className;
+ private String methodName;
+ private String endpointComponentName;
+ private String endpointInstance;
+ private String endpointUri;
+ private boolean consumerOnly;
+ private boolean producerOnly;
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public String getLineNumber() {
+ return lineNumber;
+ }
+
+ public void setLineNumber(String lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ public String getLineNumberEnd() {
+ return lineNumberEnd;
+ }
+
+ public void setLineNumberEnd(String lineNumberEnd) {
+ this.lineNumberEnd = lineNumberEnd;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+
+ public String getEndpointComponentName() {
+ return endpointComponentName;
+ }
+
+ public void setEndpointComponentName(String endpointComponentName) {
+ this.endpointComponentName = endpointComponentName;
+ }
+
+ public String getEndpointInstance() {
+ return endpointInstance;
+ }
+
+ public void setEndpointInstance(String endpointInstance) {
+ this.endpointInstance = endpointInstance;
+ }
+
+ public String getEndpointUri() {
+ return endpointUri;
+ }
+
+ public void setEndpointUri(String endpointUri) {
+ this.endpointUri = endpointUri;
+ }
+
+ public boolean isConsumerOnly() {
+ return consumerOnly;
+ }
+
+ public void setConsumerOnly(boolean consumerOnly) {
+ this.consumerOnly = consumerOnly;
+ }
+
+ public boolean isProducerOnly() {
+ return producerOnly;
+ }
+
+ public void setProducerOnly(boolean producerOnly) {
+ this.producerOnly = producerOnly;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+
+ CamelEndpointDetails that = (CamelEndpointDetails) o;
+
+ if (!fileName.equals(that.fileName)) {
+ return false;
+ }
+ if (lineNumber != null ? !lineNumber.equals(that.lineNumber) : that.lineNumber != null) {
+ return false;
+ }
+ if (lineNumberEnd != null ? !lineNumberEnd.equals(that.lineNumberEnd) : that.lineNumberEnd != null) {
+ return false;
+ }
+ if (!className.equals(that.className)) {
+ return false;
+ }
+ if (methodName != null ? !methodName.equals(that.methodName) : that.methodName != null) {
+ return false;
+ }
+ if (endpointInstance != null ? !endpointInstance.equals(that.endpointInstance) : that.endpointInstance != null) {
+ return false;
+ }
+ return endpointUri.equals(that.endpointUri);
+
+ }
+
+ @Override
+ public int hashCode() {
+ int result = fileName.hashCode();
+ result = 31 * result + (lineNumber != null ? lineNumber.hashCode() : 0);
+ result = 31 * result + (lineNumberEnd != null ? lineNumberEnd.hashCode() : 0);
+ result = 31 * result + className.hashCode();
+ result = 31 * result + (methodName != null ? methodName.hashCode() : 0);
+ result = 31 * result + (endpointInstance != null ? endpointInstance.hashCode() : 0);
+ result = 31 * result + endpointUri.hashCode();
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return "CamelEndpointDetails["
+ + "fileName='" + fileName + '\''
+ + ", lineNumber='" + lineNumber + '\''
+ + ", lineNumberEnd='" + lineNumberEnd + '\''
+ + ", className='" + className + '\''
+ + ", methodName='" + methodName + '\''
+ + ", endpointComponentName='" + endpointComponentName + '\''
+ + ", endpointInstance='" + endpointInstance + '\''
+ + ", endpointUri='" + endpointUri + '\''
+ + ", consumerOnly=" + consumerOnly
+ + ", producerOnly=" + producerOnly
+ + ']';
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/88ba9063/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelSimpleExpressionDetails.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelSimpleExpressionDetails.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelSimpleExpressionDetails.java
new file mode 100644
index 0000000..9d6db11
--- /dev/null
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/model/CamelSimpleExpressionDetails.java
@@ -0,0 +1,101 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.parser.model;
+
+/**
+ * Details about a parsed and discovered Camel simple expression.
+ */
+public class CamelSimpleExpressionDetails {
+
+ private String fileName;
+ private String lineNumber;
+ private String lineNumberEnd;
+ private String className;
+ private String methodName;
+ private String simple;
+ private boolean predicate;
+ private boolean expression;
+
+ public String getFileName() {
+ return fileName;
+ }
+
+ public void setFileName(String fileName) {
+ this.fileName = fileName;
+ }
+
+ public String getLineNumber() {
+ return lineNumber;
+ }
+
+ public void setLineNumber(String lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ public String getLineNumberEnd() {
+ return lineNumberEnd;
+ }
+
+ public void setLineNumberEnd(String lineNumberEnd) {
+ this.lineNumberEnd = lineNumberEnd;
+ }
+
+ public String getClassName() {
+ return className;
+ }
+
+ public void setClassName(String className) {
+ this.className = className;
+ }
+
+ public String getMethodName() {
+ return methodName;
+ }
+
+ public void setMethodName(String methodName) {
+ this.methodName = methodName;
+ }
+
+ public String getSimple() {
+ return simple;
+ }
+
+ public void setSimple(String simple) {
+ this.simple = simple;
+ }
+
+ public boolean isPredicate() {
+ return predicate;
+ }
+
+ public void setPredicate(boolean predicate) {
+ this.predicate = predicate;
+ }
+
+ public boolean isExpression() {
+ return expression;
+ }
+
+ public void setExpression(boolean expression) {
+ this.expression = expression;
+ }
+
+ @Override
+ public String toString() {
+ return simple;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/88ba9063/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/roaster/AnonymousMethodSource.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/roaster/AnonymousMethodSource.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/roaster/AnonymousMethodSource.java
new file mode 100644
index 0000000..234082a
--- /dev/null
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/roaster/AnonymousMethodSource.java
@@ -0,0 +1,426 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.parser.roaster;
+
+import java.lang.annotation.Annotation;
+import java.util.List;
+
+import org.jboss.forge.roaster.model.JavaType;
+import org.jboss.forge.roaster.model.Type;
+import org.jboss.forge.roaster.model.TypeVariable;
+import org.jboss.forge.roaster.model.Visibility;
+import org.jboss.forge.roaster.model.source.AnnotationSource;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.JavaDocSource;
+import org.jboss.forge.roaster.model.source.MethodSource;
+import org.jboss.forge.roaster.model.source.ParameterSource;
+import org.jboss.forge.roaster.model.source.TypeVariableSource;
+
+/**
+ * In use when we have discovered a RouteBuilder being as anonymous inner class
+ */
+public class AnonymousMethodSource implements MethodSource<JavaClassSource> {
+
+ // this implementation should only implement the needed logic to support the parser
+
+ private final JavaClassSource origin;
+ private final Object internal;
+
+ public AnonymousMethodSource(JavaClassSource origin, Object internal) {
+ this.origin = origin;
+ this.internal = internal;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setDefault(boolean b) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setSynchronized(boolean b) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setNative(boolean b) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setReturnType(Class<?> aClass) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setReturnType(String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setReturnType(JavaType<?> javaType) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setReturnTypeVoid() {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setBody(String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setConstructor(boolean b) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setParameters(String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> addThrows(String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> addThrows(Class<? extends Exception> aClass) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeThrows(String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeThrows(Class<? extends Exception> aClass) {
+ return null;
+ }
+
+ @Override
+ public boolean isSynchronized() {
+ return false;
+ }
+
+ @Override
+ public boolean isNative() {
+ return false;
+ }
+
+ @Override
+ public String getBody() {
+ return null;
+ }
+
+ @Override
+ public boolean isConstructor() {
+ return false;
+ }
+
+ @Override
+ public Type<JavaClassSource> getReturnType() {
+ return null;
+ }
+
+ @Override
+ public boolean isReturnTypeVoid() {
+ return false;
+ }
+
+ @Override
+ public List<ParameterSource<JavaClassSource>> getParameters() {
+ return null;
+ }
+
+ @Override
+ public String toSignature() {
+ return null;
+ }
+
+ @Override
+ public List<String> getThrownExceptions() {
+ return null;
+ }
+
+ @Override
+ public boolean isDefault() {
+ return false;
+ }
+
+ @Override
+ public ParameterSource<JavaClassSource> addParameter(Class<?> aClass, String s) {
+ return null;
+ }
+
+ @Override
+ public ParameterSource<JavaClassSource> addParameter(String s, String s1) {
+ return null;
+ }
+
+ @Override
+ public ParameterSource<JavaClassSource> addParameter(JavaType<?> javaType, String s) {
+ return null;
+ }
+
+ @Override
+ public void removeAllAnnotations() {
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeParameter(ParameterSource<JavaClassSource> parameterSource) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeParameter(Class<?> aClass, String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeParameter(String s, String s1) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeParameter(JavaType<?> javaType, String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setAbstract(boolean b) {
+ return null;
+ }
+
+ @Override
+ public List<AnnotationSource<JavaClassSource>> getAnnotations() {
+ return null;
+ }
+
+ @Override
+ public boolean hasAnnotation(Class<? extends Annotation> aClass) {
+ return false;
+ }
+
+ @Override
+ public boolean hasAnnotation(String s) {
+ return false;
+ }
+
+ @Override
+ public AnnotationSource<JavaClassSource> getAnnotation(Class<? extends Annotation> aClass) {
+ return null;
+ }
+
+ @Override
+ public AnnotationSource<JavaClassSource> getAnnotation(String s) {
+ return null;
+ }
+
+ @Override
+ public AnnotationSource<JavaClassSource> addAnnotation() {
+ return null;
+ }
+
+ @Override
+ public AnnotationSource<JavaClassSource> addAnnotation(Class<? extends Annotation> aClass) {
+ return null;
+ }
+
+ @Override
+ public AnnotationSource<JavaClassSource> addAnnotation(String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeAnnotation(org.jboss.forge.roaster.model.Annotation<JavaClassSource> annotation) {
+ return null;
+ }
+
+ @Override
+ public List<TypeVariableSource<JavaClassSource>> getTypeVariables() {
+ return null;
+ }
+
+ @Override
+ public TypeVariableSource<JavaClassSource> getTypeVariable(String s) {
+ return null;
+ }
+
+ @Override
+ public TypeVariableSource<JavaClassSource> addTypeVariable() {
+ return null;
+ }
+
+ @Override
+ public TypeVariableSource<JavaClassSource> addTypeVariable(String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeTypeVariable(String s) {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeTypeVariable(TypeVariable<?> typeVariable) {
+ return null;
+ }
+
+ @Override
+ public boolean hasJavaDoc() {
+ return false;
+ }
+
+ @Override
+ public boolean isAbstract() {
+ return false;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setFinal(boolean b) {
+ return null;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return false;
+ }
+
+ @Override
+ public Object getInternal() {
+ return internal;
+ }
+
+ @Override
+ public JavaDocSource<MethodSource<JavaClassSource>> getJavaDoc() {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> removeJavaDoc() {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setName(String s) {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public JavaClassSource getOrigin() {
+ return origin;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setStatic(boolean b) {
+ return null;
+ }
+
+ @Override
+ public boolean isStatic() {
+ return false;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setPackagePrivate() {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setPublic() {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setPrivate() {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setProtected() {
+ return null;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setVisibility(Visibility visibility) {
+ return null;
+ }
+
+ @Override
+ public boolean isPackagePrivate() {
+ return false;
+ }
+
+ @Override
+ public boolean isPublic() {
+ return false;
+ }
+
+ @Override
+ public boolean isPrivate() {
+ return false;
+ }
+
+ @Override
+ public boolean isProtected() {
+ return false;
+ }
+
+ @Override
+ public Visibility getVisibility() {
+ return null;
+ }
+
+ @Override
+ public int getColumnNumber() {
+ return 0;
+ }
+
+ @Override
+ public int getStartPosition() {
+ return 0;
+ }
+
+ @Override
+ public int getEndPosition() {
+ return 0;
+ }
+
+ @Override
+ public int getLineNumber() {
+ return 0;
+ }
+
+ @Override
+ public boolean hasTypeVariable(String arg0) {
+ return false;
+ }
+
+ @Override
+ public MethodSource<JavaClassSource> setReturnType(Type<?> arg0) {
+ return null;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/88ba9063/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/roaster/StatementFieldSource.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/roaster/StatementFieldSource.java b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/roaster/StatementFieldSource.java
new file mode 100644
index 0000000..cbfcedc
--- /dev/null
+++ b/tooling/camel-route-parser/src/main/java/org/apache/camel/parser/roaster/StatementFieldSource.java
@@ -0,0 +1,278 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.parser.roaster;
+
+import java.util.List;
+
+import org.jboss.forge.roaster.model.Annotation;
+import org.jboss.forge.roaster.model.JavaType;
+import org.jboss.forge.roaster.model.Type;
+import org.jboss.forge.roaster.model.Visibility;
+import org.jboss.forge.roaster.model.impl.TypeImpl;
+import org.jboss.forge.roaster.model.source.AnnotationSource;
+import org.jboss.forge.roaster.model.source.FieldSource;
+import org.jboss.forge.roaster.model.source.JavaClassSource;
+import org.jboss.forge.roaster.model.source.JavaDocSource;
+
+public class StatementFieldSource implements FieldSource {
+
+ // this implementation should only implement the needed logic to support the parser
+
+ private final JavaClassSource origin;
+ private final Object internal;
+ private final Type type;
+
+ public StatementFieldSource(JavaClassSource origin, Object internal, Object typeInternal) {
+ this.origin = origin;
+ this.internal = internal;
+ this.type = new TypeImpl(origin, typeInternal);
+ }
+
+ @Override
+ public FieldSource setType(Class clazz) {
+ return null;
+ }
+
+ @Override
+ public FieldSource setType(String type) {
+ return null;
+ }
+
+ @Override
+ public FieldSource setLiteralInitializer(String value) {
+ return null;
+ }
+
+ @Override
+ public FieldSource setStringInitializer(String value) {
+ return null;
+ }
+
+ @Override
+ public FieldSource setTransient(boolean value) {
+ return null;
+ }
+
+ @Override
+ public FieldSource setVolatile(boolean value) {
+ return null;
+ }
+
+ @Override
+ public FieldSource setType(JavaType entity) {
+ return null;
+ }
+
+ @Override
+ public List<AnnotationSource> getAnnotations() {
+ return null;
+ }
+
+ @Override
+ public boolean hasAnnotation(String type) {
+ return false;
+ }
+
+ @Override
+ public boolean hasAnnotation(Class type) {
+ return false;
+ }
+
+ @Override
+ public AnnotationSource getAnnotation(String type) {
+ return null;
+ }
+
+ @Override
+ public AnnotationSource addAnnotation() {
+ return null;
+ }
+
+ @Override
+ public AnnotationSource addAnnotation(String className) {
+ return null;
+ }
+
+ @Override
+ public void removeAllAnnotations() {
+ }
+
+ @Override
+ public Object removeAnnotation(Annotation annotation) {
+ return null;
+ }
+
+ @Override
+ public AnnotationSource addAnnotation(Class type) {
+ return null;
+ }
+
+ @Override
+ public AnnotationSource getAnnotation(Class type) {
+ return null;
+ }
+
+ @Override
+ public Type getType() {
+ return type;
+ }
+
+ @Override
+ public String getStringInitializer() {
+ return null;
+ }
+
+ @Override
+ public String getLiteralInitializer() {
+ return null;
+ }
+
+ @Override
+ public boolean isTransient() {
+ return false;
+ }
+
+ @Override
+ public boolean isVolatile() {
+ return false;
+ }
+
+ @Override
+ public Object setFinal(boolean finl) {
+ return null;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return false;
+ }
+
+ @Override
+ public Object getInternal() {
+ return internal;
+ }
+
+ @Override
+ public JavaDocSource getJavaDoc() {
+ return null;
+ }
+
+ @Override
+ public boolean hasJavaDoc() {
+ return false;
+ }
+
+ @Override
+ public Object removeJavaDoc() {
+ return null;
+ }
+
+ @Override
+ public Object setName(String name) {
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return null;
+ }
+
+ @Override
+ public Object getOrigin() {
+ return origin;
+ }
+
+ @Override
+ public Object setStatic(boolean value) {
+ return null;
+ }
+
+ @Override
+ public boolean isStatic() {
+ return false;
+ }
+
+ @Override
+ public Object setPackagePrivate() {
+ return null;
+ }
+
+ @Override
+ public Object setPublic() {
+ return null;
+ }
+
+ @Override
+ public Object setPrivate() {
+ return null;
+ }
+
+ @Override
+ public Object setProtected() {
+ return null;
+ }
+
+ @Override
+ public Object setVisibility(Visibility scope) {
+ return null;
+ }
+
+ @Override
+ public boolean isPackagePrivate() {
+ return false;
+ }
+
+ @Override
+ public boolean isPublic() {
+ return false;
+ }
+
+ @Override
+ public boolean isPrivate() {
+ return false;
+ }
+
+ @Override
+ public boolean isProtected() {
+ return false;
+ }
+
+ @Override
+ public Visibility getVisibility() {
+ return null;
+ }
+
+ @Override
+ public int getColumnNumber() {
+ return 0;
+ }
+
+ @Override
+ public int getStartPosition() {
+ return 0;
+ }
+
+ @Override
+ public int getEndPosition() {
+ return 0;
+ }
+
+ @Override
+ public int getLineNumber() {
+ return 0;
+ }
+}
http://git-wip-us.apache.org/repos/asf/camel/blob/88ba9063/tooling/camel-route-parser/src/main/resources/META-INF/LICENSE.txt
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/main/resources/META-INF/LICENSE.txt b/tooling/camel-route-parser/src/main/resources/META-INF/LICENSE.txt
new file mode 100755
index 0000000..6b0b127
--- /dev/null
+++ b/tooling/camel-route-parser/src/main/resources/META-INF/LICENSE.txt
@@ -0,0 +1,203 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed 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.
+
http://git-wip-us.apache.org/repos/asf/camel/blob/88ba9063/tooling/camel-route-parser/src/main/resources/META-INF/NOTICE.txt
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/main/resources/META-INF/NOTICE.txt b/tooling/camel-route-parser/src/main/resources/META-INF/NOTICE.txt
new file mode 100644
index 0000000..2e215bf
--- /dev/null
+++ b/tooling/camel-route-parser/src/main/resources/META-INF/NOTICE.txt
@@ -0,0 +1,11 @@
+ =========================================================================
+ == NOTICE file corresponding to the section 4 d of ==
+ == the Apache License, Version 2.0, ==
+ == in this case for the Apache Camel distribution. ==
+ =========================================================================
+
+ This product includes software developed by
+ The Apache Software Foundation (http://www.apache.org/).
+
+ Please read the different LICENSE files present in the licenses directory of
+ this distribution.
http://git-wip-us.apache.org/repos/asf/camel/blob/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyBasePortRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyBasePortRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyBasePortRouteBuilder.java
new file mode 100644
index 0000000..e5fb01c
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyBasePortRouteBuilder.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java
new file mode 100644
index 0000000..374ffb9
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyCdiConcatRouteBuilder.java
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java
new file mode 100644
index 0000000..2bf3e78
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyCdiRouteBuilder.java
@@ -0,0 +1,46 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java
new file mode 100644
index 0000000..4322689
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyConcatFieldRouteBuilder.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java
new file mode 100644
index 0000000..2a13f19
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyFieldMethodCallRouteBuilder.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java
new file mode 100644
index 0000000..b56595b
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyFieldRouteBuilder.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java
new file mode 100644
index 0000000..4a8de07
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyLocalAddRouteBuilderTest.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java
new file mode 100644
index 0000000..f54541f
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyMethodCallRouteBuilder.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNettyTest.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNettyTest.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNettyTest.java
new file mode 100644
index 0000000..4391576
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNettyTest.java
@@ -0,0 +1,52 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java
new file mode 100644
index 0000000..4701c2e
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineConstRouteBuilder.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java
new file mode 100644
index 0000000..8213244
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyNewLineRouteBuilder.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java
new file mode 100644
index 0000000..9c44803
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteBuilder.java
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java
new file mode 100644
index 0000000..12a797d
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteEmptyUriTest.java
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java
new file mode 100644
index 0000000..a6c4923
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MyRouteTest.java
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java
new file mode 100644
index 0000000..85bbe14
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleRouteBuilder.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToDRoute.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToDRoute.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToDRoute.java
new file mode 100644
index 0000000..2825070
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToDRoute.java
@@ -0,0 +1,34 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java
new file mode 100644
index 0000000..3e43655
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/MySimpleToFRoute.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiConcatRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiConcatRouteBuilderConfigureTest.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiConcatRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..7d9abe4
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiConcatRouteBuilderConfigureTest.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.ParserResult;
+import org.apache.camel.parser.helper.CamelJavaParserHelper;
+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/88ba9063/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiRouteBuilderConfigureTest.java
----------------------------------------------------------------------
diff --git a/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiRouteBuilderConfigureTest.java b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiRouteBuilderConfigureTest.java
new file mode 100644
index 0000000..6abd424
--- /dev/null
+++ b/tooling/camel-route-parser/src/test/java/org/apache/camel/parser/java/RoasterCdiRouteBuilderConfigureTest.java
@@ -0,0 +1,55 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.parser.java;
+
+import java.io.File;
+import java.util.List;
+
+import org.apache.camel.parser.ParserResult;
+import org.apache.camel.parser.helper.CamelJavaParserHelper;
+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());
+ }
+
+}