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 2015/03/15 07:39:38 UTC

[1/4] camel git commit: Test fixed. Polishing. Test file moved out of target directory as target directory is ignored by git.

Repository: camel
Updated Branches:
  refs/heads/master f88d6dda3 -> 2ec8e5ce2


Test fixed. Polishing.
Test file moved out of target directory as target directory is ignored by git.


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

Branch: refs/heads/master
Commit: f2fbfc812ddd78034f7190f9fd5fa6487a2a662c
Parents: e296839
Author: nkukhar <ku...@gmail.com>
Authored: Sat Mar 14 11:21:12 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Mar 15 07:38:49 2015 +0100

----------------------------------------------------------------------
 .../java/org/apache/camel/maven/Constants.java  |  3 +-
 .../camel/maven/DocumentationEnricher.java      |  2 +-
 .../maven/EipDocumentationEnricherMojo.java     | 11 +++++-
 .../maven/EipDocumentationEnricherMojoTest.java | 37 ++++++++++++--------
 .../integration/EIPDocumentationMojoTest.java   |  1 +
 .../classes/org/apache/camel/model/aop.json     | 21 +++++++++++
 6 files changed, 56 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/f2fbfc81/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java
index e26ce78..586d9a0 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java
@@ -22,8 +22,7 @@ package org.apache.camel.maven;
 public final class Constants {
 
     // Camel core constants.
-    public static final String PATH_TO_MODEL_DIR = "target/classes/org/apache/camel/model";
-    public static final String DEFAULT_XML_INTEMSION = "  ";
+    public static final String DEFAULT_XML_INTENTION = "  ";
     public static final int WRAP_LENGTH = 80;
 
     // XML constants.

http://git-wip-us.apache.org/repos/asf/camel/blob/f2fbfc81/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
index 6e2db2c..86f2d1b 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/DocumentationEnricher.java
@@ -103,7 +103,7 @@ public class DocumentationEnricher {
                 .append(WordUtils.wrap(textContent, Constants.WRAP_LENGTH))
                 .append(System.lineSeparator())
                 // Fix closing tag intention.
-                .append(StringUtils.repeat(Constants.DEFAULT_XML_INTEMSION, getNodeDepth(item)));
+                .append(StringUtils.repeat(Constants.DEFAULT_XML_INTENTION, getNodeDepth(item)));
         return stringBuilder.toString();
     }
 

http://git-wip-us.apache.org/repos/asf/camel/blob/f2fbfc81/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
index 031e7d7..21d8440 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
@@ -69,8 +69,17 @@ public class EipDocumentationEnricherMojo extends AbstractMojo {
     @Parameter(defaultValue = "${project.build.directory}/../../..//camel-core")
     public File camelCoreDir;
 
+    /**
+     * Sub path from camel core directory to model directory with generated json files for components.
+     */
+    @Parameter(defaultValue = "target/classes/org/apache/camel/model")
+    public String pathToModelDir;
+
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
+        if (pathToModelDir == null) {
+            throw new MojoExecutionException("pathToModelDir parameter must not be null");
+        }
         validateExists(inputCamelSchemaFile, "inputCamelSchemaFile");
         validateIsFile(inputCamelSchemaFile, "inputCamelSchemaFile");
         validateExists(camelCoreDir, "camelCoreDir");
@@ -83,7 +92,7 @@ public class EipDocumentationEnricherMojo extends AbstractMojo {
     }
 
     private void runPlugin() throws Exception {
-        File rootDir = new File(camelCoreDir, Constants.PATH_TO_MODEL_DIR);
+        File rootDir = new File(camelCoreDir, pathToModelDir);
         Document document = XmlHelper.buildNamespaceAwareDocument(inputCamelSchemaFile);
         XPath xPath = XmlHelper.buildXPath(new CamelSpringNamespace());
         DomFinder domFinder = new DomFinder(document, xPath);

http://git-wip-us.apache.org/repos/asf/camel/blob/f2fbfc81/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
index e9dc226..560fa25 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
@@ -41,6 +41,9 @@ public class EipDocumentationEnricherMojoTest {
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
+        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
+        eipDocumentationEnricherMojo.pathToModelDir = "sub/path";
     }
 
     @Test
@@ -50,9 +53,6 @@ public class EipDocumentationEnricherMojoTest {
         when(mockInputSchema.exists()).thenReturn(true);
         when(mockInputSchema.isFile()).thenReturn(true);
 
-        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
-        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
-
         try {
             eipDocumentationEnricherMojo.execute();
             fail("Expected MojoExecutionException");
@@ -63,11 +63,11 @@ public class EipDocumentationEnricherMojoTest {
 
     @Test
     public void testExecuteCamelCoreIsNull() throws Exception {
+        eipDocumentationEnricherMojo.camelCoreDir = null;
+
         when(mockInputSchema.exists()).thenReturn(true);
         when(mockInputSchema.isFile()).thenReturn(true);
 
-        eipDocumentationEnricherMojo.camelCoreDir = null;
-        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
         try {
             eipDocumentationEnricherMojo.execute();
             fail("Expected MojoExecutionException");
@@ -83,9 +83,6 @@ public class EipDocumentationEnricherMojoTest {
         when(mockInputSchema.exists()).thenReturn(true);
         when(mockInputSchema.isFile()).thenReturn(true);
 
-        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
-        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
-
         try {
             eipDocumentationEnricherMojo.execute();
             fail("Expected MojoExecutionException");
@@ -101,9 +98,6 @@ public class EipDocumentationEnricherMojoTest {
         when(mockInputSchema.exists()).thenReturn(false);
         when(mockInputSchema.isFile()).thenReturn(true);
 
-        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
-        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
-
         try {
             eipDocumentationEnricherMojo.execute();
             fail("Expected MojoExecutionException");
@@ -114,11 +108,11 @@ public class EipDocumentationEnricherMojoTest {
 
     @Test
     public void testExecuteInputCamelSchemaIsNull() throws Exception {
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = null;
+
         when(mockCamelCore.exists()).thenReturn(true);
         when(mockCamelCore.isDirectory()).thenReturn(true);
 
-        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
-        eipDocumentationEnricherMojo.inputCamelSchemaFile = null;
         try {
             eipDocumentationEnricherMojo.execute();
             fail("Expected MojoExecutionException");
@@ -134,8 +128,21 @@ public class EipDocumentationEnricherMojoTest {
         when(mockInputSchema.exists()).thenReturn(true);
         when(mockInputSchema.isFile()).thenReturn(false);
 
-        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
-        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
+        try {
+            eipDocumentationEnricherMojo.execute();
+            fail("Expected MojoExecutionException");
+        } catch (MojoExecutionException e) {
+            // Expected.
+        }
+    }
+
+    @Test
+    public void testExecutePathToModelDirIsNull() throws Exception {
+        eipDocumentationEnricherMojo.pathToModelDir = null;
+        when(mockCamelCore.exists()).thenReturn(true);
+        when(mockCamelCore.isDirectory()).thenReturn(true);
+        when(mockInputSchema.exists()).thenReturn(true);
+        when(mockInputSchema.isFile()).thenReturn(true);
 
         try {
             eipDocumentationEnricherMojo.execute();

http://git-wip-us.apache.org/repos/asf/camel/blob/f2fbfc81/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
index 5dc7887..8d94b42 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
@@ -50,6 +50,7 @@ public class EIPDocumentationMojoTest {
     public void setUp() throws Exception {
         eipDocumentationEnricherMojo.camelCoreDir = ResourceUtils.getResourceAsFile("integration/camel-core-integration");
         eipDocumentationEnricherMojo.inputCamelSchemaFile = ResourceUtils.getResourceAsFile("integration/camel-spring.xsd");
+        eipDocumentationEnricherMojo.pathToModelDir = "trgt/classes/org/apache/camel/model";
         xPath.setNamespaceContext(new CamelSpringNamespace());
         tempFile = File.createTempFile("outputXml", ".xml");
         tempFile.deleteOnExit();

http://git-wip-us.apache.org/repos/asf/camel/blob/f2fbfc81/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/integration/camel-core-integration/trgt/classes/org/apache/camel/model/aop.json
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/integration/camel-core-integration/trgt/classes/org/apache/camel/model/aop.json b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/integration/camel-core-integration/trgt/classes/org/apache/camel/model/aop.json
new file mode 100644
index 0000000..7f32f72
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/integration/camel-core-integration/trgt/classes/org/apache/camel/model/aop.json
@@ -0,0 +1,21 @@
+{
+ "model": {
+    "kind": "model",
+    "name": "aop",
+    "title": "Aop",
+    "description": "element documentation",
+    "javaType": "org.apache.camel.model.AOPDefinition",
+    "label": "configuration",
+    "input": "true",
+    "output": "true"
+  },
+  "properties": {
+    "beforeUri": { "kind": "attribute", "required": "false", "type": "string", "javaType": "java.lang.String", "deprecated": "false", "description": "beforeUri documentation" },
+    "afterUri": { "kind": "attribute", "required": "false", "type": "string", "javaType": "java.lang.String", "deprecated": "false", "description": "Endpoint to call in AOP after. The difference between after and afterFinally is that afterFinally is invoked from a finally block so it will always be invoked no matter what eg also in case of an exception occur." },
+    "afterFinallyUri": { "kind": "attribute", "required": "false", "type": "string", "javaType": "java.lang.String", "deprecated": "false", "description": "Endpoint to call in AOP after finally. The difference between after and afterFinally is that afterFinally is invoked from a finally block so it will always be invoked no matter what eg also in case of an exception occur." },
+    "outputs": { "kind": "element", "required": "true", "type": "array", "javaType": "java.util.List<org.apache.camel.model.ProcessorDefinition<?>>", "oneOf": [ "aggregate", "aop", "bean", "choice", "convertBodyTo", "delay", "doCatch", "doFinally", "doTry", "dynamicRouter", "enrich", "filter", "idempotentConsumer", "inOnly", "inOut", "intercept", "interceptFrom", "interceptSendToEndpoint", "loadBalance", "log", "loop", "marshal", "multicast", "onCompletion", "onException", "otherwise", "pipeline", "policy", "pollEnrich", "process", "recipientList", "removeHeader", "removeHeaders", "removeProperties", "removeProperty", "resequence", "rollback", "routingSlip", "sample", "setBody", "setExchangePattern", "setFaultBody", "setHeader", "setOutHeader", "setProperty", "sort", "split", "stop", "threads", "throttle", "throwException", "to", "transacted", "transform", "unmarshal", "validate", "when", "whenSkipSendToEndpoint", "wireTap" ], "deprecated": "false" },
+    "id": { "kind": "attribute", "required": "false", "type": "string", "javaType": "java.lang.String", "deprecated": "false", "description": "id documentation" },
+    "description": { "kind": "element", "required": "false", "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": "false", "description": "Sets the description of this node" }
+  }
+}
+


[2/4] camel git commit: Tests added.

Posted by da...@apache.org.
Tests added.


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

Branch: refs/heads/master
Commit: e2968394b61b3b4132327548b6c2ca6367f4c7ad
Parents: c87732d
Author: nkukhar <ku...@gmail.com>
Authored: Sat Mar 14 01:07:20 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Mar 15 07:38:49 2015 +0100

----------------------------------------------------------------------
 .../pom.xml                                     |  13 ++
 .../camel/maven/CamelSpringNamespaceTest.java   |  55 +++++++
 .../org/apache/camel/maven/DomFinderTest.java   |  72 +++++++++
 .../maven/EipDocumentationEnricherMojoTest.java | 147 +++++++++++++++++++
 .../apache/camel/maven/PackageHelperTest.java   |   4 +-
 .../org/apache/camel/maven/ResourceUtils.java   |  28 ++++
 .../org/apache/camel/maven/XmlHelperTest.java   |  51 +++++++
 .../integration/EIPDocumentationMojoTest.java   | 113 ++++++++++++++
 .../test/resources/integration/camel-spring.xsd | 114 ++++++++++++++
 .../src/test/resources/json/aop.json            |  21 +++
 .../src/test/resources/xmls/3_elements.xml      |   6 +
 .../src/test/resources/xmls/aop.xml             |   4 +
 .../src/test/resources/xmls/complex_type.xml    |   9 ++
 .../resources/xmls/complex_type_w_parent.xml    |  19 +++
 .../test/resources/xmls/element_doc_enrich.xml  |   0
 .../src/test/resources/xmls/empty.xml           |   2 +
 16 files changed, 656 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml
index 177c5dc..370f2eb 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/pom.xml
@@ -100,6 +100,19 @@
       <artifactId>junit</artifactId>
       <scope>test</scope>
     </dependency>
+
+    <dependency>
+      <groupId>org.hamcrest</groupId>
+      <artifactId>hamcrest-core</artifactId>
+      <version>${hamcrest-version}</version>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
+      <groupId>org.mockito</groupId>
+      <artifactId>mockito-core</artifactId>
+      <scope>test</scope>
+    </dependency>
     <!-- Camel annotations in provided scope to avoid compile errors in IDEs -->
     <dependency>
       <groupId>org.apache.camel</groupId>

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/CamelSpringNamespaceTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/CamelSpringNamespaceTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/CamelSpringNamespaceTest.java
new file mode 100644
index 0000000..ee19982
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/CamelSpringNamespaceTest.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.maven;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
+
+public class CamelSpringNamespaceTest {
+
+    private CamelSpringNamespace camelSpringNamespace = new CamelSpringNamespace();
+
+    @Test
+    public void testSchemaNamespace() throws Exception {
+        assertEquals(Constants.XML_SCHEMA_NAMESPACE_URI,
+                camelSpringNamespace.getNamespaceURI(Constants.XML_SCHEMA_NAMESPACE_PREFIX));
+        assertNull(camelSpringNamespace.getNamespaceURI("unregisterdPrefix"));
+    }
+
+    @Test
+    public void testGetPrefix() throws Exception {
+        try {
+            camelSpringNamespace.getPrefix(Constants.XML_SCHEMA_NAMESPACE_URI);
+            fail("UnsupportedOperationException expected");
+        } catch (UnsupportedOperationException e) {
+            // Expected.
+        }
+    }
+
+    @Test
+    public void testGetPrefixes() throws Exception {
+        try {
+            camelSpringNamespace.getPrefixes(Constants.XML_SCHEMA_NAMESPACE_URI);
+            fail("UnsupportedOperationException expected");
+        } catch (UnsupportedOperationException e) {
+            // Expected.
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java
new file mode 100644
index 0000000..86a508f
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java
@@ -0,0 +1,72 @@
+/**
+ * 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.maven;
+
+import javax.xml.xpath.XPath;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+
+public class DomFinderTest {
+    private DomFinder domFinder;
+
+    @Test
+    public void testFindElementsAndTypes() throws Exception {
+        Document document = XmlHelper.buildNamespaceAwareDocument(
+                ResourceUtils.getResourceAsFile("xmls/3_elements.xml"));
+        XPath xPath = XmlHelper.buildXPath(new CamelSpringNamespace());
+        domFinder = new DomFinder(document, xPath);
+
+        NodeList elements = domFinder.findElementsAndTypes();
+
+        assertEquals(3, elements.getLength());
+    }
+
+    @Test
+    public void testFindAttributesElements() throws Exception {
+        Document document = XmlHelper.buildNamespaceAwareDocument(
+                ResourceUtils.getResourceAsFile("xmls/complex_type.xml"));
+        XPath xPath = XmlHelper.buildXPath(new CamelSpringNamespace());
+        domFinder = new DomFinder(document, xPath);
+
+        NodeList attributesList = domFinder.findAttributesElements("interceptSendToEndpointDefinition");
+
+        assertEquals(2, attributesList.getLength());
+
+        assertEquals("uri", ((Element) attributesList.item(0)).getAttribute(Constants.NAME_ATTRIBUTE_NAME));
+        assertEquals("skipSendToOriginalEndpoint",
+                ((Element) attributesList.item(1)).getAttribute(Constants.NAME_ATTRIBUTE_NAME));
+
+    }
+
+    @Test
+    public void testFindBaseType() throws Exception {
+        Document document = XmlHelper.buildNamespaceAwareDocument(
+                ResourceUtils.getResourceAsFile("xmls/complex_type_w_parent.xml"));
+        XPath xPath = XmlHelper.buildXPath(new CamelSpringNamespace());
+        domFinder = new DomFinder(document, xPath);
+
+        String baseTypeName = domFinder.findBaseType("keyManagersParametersFactoryBean");
+
+        assertEquals("tns:abstractKeyManagersParametersFactoryBean", baseTypeName);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
new file mode 100644
index 0000000..e9dc226
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
@@ -0,0 +1,147 @@
+/**
+ * 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.maven;
+
+import java.io.File;
+
+import org.apache.maven.plugin.MojoExecutionException;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.when;
+
+public class EipDocumentationEnricherMojoTest {
+    private EipDocumentationEnricherMojo eipDocumentationEnricherMojo = new EipDocumentationEnricherMojo();
+
+    @Mock
+    private File mockCamelCore;
+
+    @Mock
+    private File mockInputSchema;
+
+
+    @Before
+    public void setUp() throws Exception {
+        MockitoAnnotations.initMocks(this);
+    }
+
+    @Test
+    public void testExecuteCamelCoreDoesNotExist() throws Exception {
+        when(mockCamelCore.exists()).thenReturn(false);
+        when(mockCamelCore.isDirectory()).thenReturn(true);
+        when(mockInputSchema.exists()).thenReturn(true);
+        when(mockInputSchema.isFile()).thenReturn(true);
+
+        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
+
+        try {
+            eipDocumentationEnricherMojo.execute();
+            fail("Expected MojoExecutionException");
+        } catch (MojoExecutionException e) {
+            // Expected.
+        }
+    }
+
+    @Test
+    public void testExecuteCamelCoreIsNull() throws Exception {
+        when(mockInputSchema.exists()).thenReturn(true);
+        when(mockInputSchema.isFile()).thenReturn(true);
+
+        eipDocumentationEnricherMojo.camelCoreDir = null;
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
+        try {
+            eipDocumentationEnricherMojo.execute();
+            fail("Expected MojoExecutionException");
+        } catch (MojoExecutionException e) {
+            // Expected.
+        }
+    }
+
+    @Test
+    public void testExecuteCamelCoreIsNotADirectory() throws Exception {
+        when(mockCamelCore.exists()).thenReturn(true);
+        when(mockCamelCore.isDirectory()).thenReturn(false);
+        when(mockInputSchema.exists()).thenReturn(true);
+        when(mockInputSchema.isFile()).thenReturn(true);
+
+        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
+
+        try {
+            eipDocumentationEnricherMojo.execute();
+            fail("Expected MojoExecutionException");
+        } catch (MojoExecutionException e) {
+            // Expected.
+        }
+    }
+
+    @Test
+    public void testExecuteInputCamelSchemaDoesNotExist() throws Exception {
+        when(mockCamelCore.exists()).thenReturn(true);
+        when(mockCamelCore.isDirectory()).thenReturn(true);
+        when(mockInputSchema.exists()).thenReturn(false);
+        when(mockInputSchema.isFile()).thenReturn(true);
+
+        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
+
+        try {
+            eipDocumentationEnricherMojo.execute();
+            fail("Expected MojoExecutionException");
+        } catch (MojoExecutionException e) {
+            // Expected.
+        }
+    }
+
+    @Test
+    public void testExecuteInputCamelSchemaIsNull() throws Exception {
+        when(mockCamelCore.exists()).thenReturn(true);
+        when(mockCamelCore.isDirectory()).thenReturn(true);
+
+        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = null;
+        try {
+            eipDocumentationEnricherMojo.execute();
+            fail("Expected MojoExecutionException");
+        } catch (MojoExecutionException e) {
+            // Expected.
+        }
+    }
+
+    @Test
+    public void testExecuteInputCamelSchemaIsNotAFile() throws Exception {
+        when(mockCamelCore.exists()).thenReturn(true);
+        when(mockCamelCore.isDirectory()).thenReturn(true);
+        when(mockInputSchema.exists()).thenReturn(true);
+        when(mockInputSchema.isFile()).thenReturn(false);
+
+        eipDocumentationEnricherMojo.camelCoreDir = mockCamelCore;
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = mockInputSchema;
+
+        try {
+            eipDocumentationEnricherMojo.execute();
+            fail("Expected MojoExecutionException");
+        } catch (MojoExecutionException e) {
+            // Expected.
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java
index 0d45deb..2acdb20 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/PackageHelperTest.java
@@ -29,12 +29,12 @@ public class PackageHelperTest {
 
     @Test
     public void testFileToString() throws Exception {
-        assertEquals("dk19i21)@+#(OR", PackageHelper.fileToString(new File(this.getClass().getClassLoader().getResource("filecontent/a.txt").getFile())));
+        assertEquals("dk19i21)@+#(OR", PackageHelper.fileToString(ResourceUtils.getResourceAsFile("filecontent/a.txt")));
     }
 
     @Test
     public void testFindJsonFiles() throws Exception {
-        Map<String, File> jsonFiles = PackageHelper.findJsonFiles(new File(this.getClass().getClassLoader().getResource("json").getFile()));
+        Map<String, File> jsonFiles = PackageHelper.findJsonFiles(ResourceUtils.getResourceAsFile("json"));
 
         assertTrue("Files a.json must be found", jsonFiles.containsKey("a"));
         assertTrue("Files b.json must be found", jsonFiles.containsKey("b"));

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.java
new file mode 100644
index 0000000..2da69fa
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.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.maven;
+
+import java.io.File;
+
+public class ResourceUtils {
+    private ResourceUtils() { }
+
+    public static File getResourceAsFile(String pathToFile) throws Exception {
+        return new File(ResourceUtils.class.getClassLoader().getResource(pathToFile).getFile());
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java
new file mode 100644
index 0000000..b2e3ed5
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java
@@ -0,0 +1,51 @@
+/**
+ * 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.maven;
+
+import org.junit.Test;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+public class XmlHelperTest {
+
+    @Test
+    public void testBuildNamespaceAwareDocument() throws Exception {
+        assertNotNull(XmlHelper.buildNamespaceAwareDocument(ResourceUtils.getResourceAsFile("xmls/empty.xml")));
+    }
+
+    @Test
+    public void testBuildTransformer() throws Exception {
+        assertNotNull(XmlHelper.buildTransformer());
+    }
+
+    @Test
+    public void testBuildXPath() throws Exception {
+        assertNotNull(XmlHelper.buildXPath(new CamelSpringNamespace()));
+    }
+
+    @Test
+    public void testBuildXPathNullPointerExpected() throws Exception {
+        try {
+            XmlHelper.buildXPath(null);
+            fail("NullPointerException expected");
+        } catch (NullPointerException e) {
+            // Expected.
+        }
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
new file mode 100644
index 0000000..5dc7887
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
@@ -0,0 +1,113 @@
+/**
+ * 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.maven.integration;
+
+import java.io.File;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.CharacterData;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import org.apache.camel.maven.CamelSpringNamespace;
+import org.apache.camel.maven.Constants;
+import org.apache.camel.maven.EipDocumentationEnricherMojo;
+import org.apache.camel.maven.ResourceUtils;
+import org.junit.Before;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.containsString;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+
+public class EIPDocumentationMojoTest {
+    EipDocumentationEnricherMojo eipDocumentationEnricherMojo = new EipDocumentationEnricherMojo();
+    XPath xPath = XPathFactory.newInstance().newXPath();
+    File tempFile;
+
+    @Before
+    public void setUp() throws Exception {
+        eipDocumentationEnricherMojo.camelCoreDir = ResourceUtils.getResourceAsFile("integration/camel-core-integration");
+        eipDocumentationEnricherMojo.inputCamelSchemaFile = ResourceUtils.getResourceAsFile("integration/camel-spring.xsd");
+        xPath.setNamespaceContext(new CamelSpringNamespace());
+        tempFile = File.createTempFile("outputXml", ".xml");
+        tempFile.deleteOnExit();
+        eipDocumentationEnricherMojo.outputCamelSchemaFile = tempFile;
+    }
+
+    @Test
+    public void testExecuteMojo() throws Exception {
+        eipDocumentationEnricherMojo.execute();
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilderFactory.setNamespaceAware(true);
+        DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        Document doc = documentBuilder.parse(tempFile);
+        validateElement(doc);
+        validateAttributes(doc);
+        validateParentAttribute(doc);
+    }
+
+    private void validateParentAttribute(Document doc) throws Exception {
+        Element e = (Element) xPath.compile("//xs:attribute[@name='id']").evaluate(doc, XPathConstants.NODE);
+
+        assertEquals("id", e.getAttribute(Constants.NAME_ATTRIBUTE_NAME));
+
+        validateDocumentation(e, "id documentation");
+    }
+
+    private void validateAttributes(Document doc) throws Exception {
+        Element e = (Element) xPath.compile("//xs:attribute[@name='beforeUri']").evaluate(doc, XPathConstants.NODE);
+
+        assertEquals("beforeUri", e.getAttribute(Constants.NAME_ATTRIBUTE_NAME));
+
+        validateDocumentation(e, "beforeUri documentation");
+
+    }
+
+    private void validateElement(Document doc) {
+        NodeList element = doc.getElementsByTagName("xs:element");
+        Element e = ((Element) element.item(0));
+
+        assertEquals("aop", e.getAttribute(Constants.NAME_ATTRIBUTE_NAME));
+
+        validateDocumentation(e, "element documentation");
+    }
+
+    private void validateDocumentation(Element element, String expectedText) {
+        Element annotation = getFirsElement(element.getChildNodes());
+        Element documentation = getFirsElement(annotation.getChildNodes());
+
+        assertEquals("xs:annotation", annotation.getTagName());
+        assertEquals("xs:documentation", documentation.getTagName());
+
+        Node cdata = documentation.getFirstChild();
+        assertThat(cdata, instanceOf(CharacterData.class));
+
+        assertThat(cdata.getTextContent(), containsString(expectedText));
+    }
+
+    private Element getFirsElement(NodeList nodeList) {
+        return (Element) nodeList.item(1);
+    }
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/integration/camel-spring.xsd
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/integration/camel-spring.xsd b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/integration/camel-spring.xsd
new file mode 100644
index 0000000..6fa9e39
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/integration/camel-spring.xsd
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://camel.apache.org/schema/spring" elementFormDefault="qualified" targetNamespace="http://camel.apache.org/schema/spring" version="1.0">
+
+  <xs:element name="aop" type="tns:aopDefinition">
+
+  </xs:element>
+
+  <xs:complexType name="aopDefinition">
+    <xs:complexContent>
+      <xs:extension base="tns:output">
+        <xs:sequence/>
+        <xs:attribute name="beforeUri" type="xs:string">
+        </xs:attribute>
+        <xs:attribute name="afterUri" type="xs:string">
+        </xs:attribute>
+        <xs:attribute name="afterFinallyUri" type="xs:string">
+        </xs:attribute>
+        <xs:anyAttribute namespace="##other" processContents="skip"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="output">
+    <xs:complexContent>
+      <xs:extension base="tns:processorDefinition">
+        <xs:sequence>
+          <xs:choice maxOccurs="unbounded" minOccurs="0">
+            <xs:element ref="tns:aop"/>
+            <xs:element ref="tns:aggregate"/>
+            <xs:element ref="tns:bean"/>
+            <xs:element ref="tns:doCatch"/>
+            <xs:element ref="tns:when"/>
+            <xs:element ref="tns:choice"/>
+            <xs:element ref="tns:otherwise"/>
+            <xs:element ref="tns:convertBodyTo"/>
+            <xs:element ref="tns:delay"/>
+            <xs:element ref="tns:dynamicRouter"/>
+            <xs:element ref="tns:enrich"/>
+            <xs:element ref="tns:filter"/>
+            <xs:element ref="tns:doFinally"/>
+            <xs:element ref="tns:idempotentConsumer"/>
+            <xs:element ref="tns:inOnly"/>
+            <xs:element ref="tns:inOut"/>
+            <xs:element ref="tns:intercept"/>
+            <xs:element ref="tns:interceptFrom"/>
+            <xs:element ref="tns:interceptSendToEndpoint"/>
+            <xs:element ref="tns:loadBalance"/>
+            <xs:element ref="tns:log"/>
+            <xs:element ref="tns:loop"/>
+            <xs:element ref="tns:marshal"/>
+            <xs:element ref="tns:multicast"/>
+            <xs:element ref="tns:onCompletion"/>
+            <xs:element ref="tns:onException"/>
+            <xs:element ref="tns:pipeline"/>
+            <xs:element ref="tns:policy"/>
+            <xs:element ref="tns:pollEnrich"/>
+            <xs:element ref="tns:process"/>
+            <xs:element ref="tns:recipientList"/>
+            <xs:element ref="tns:removeHeader"/>
+            <xs:element ref="tns:removeHeaders"/>
+            <xs:element ref="tns:removeProperties"/>
+            <xs:element ref="tns:removeProperty"/>
+            <xs:element ref="tns:resequence"/>
+            <xs:element ref="tns:rollback"/>
+            <xs:element ref="tns:route"/>
+            <xs:element ref="tns:routingSlip"/>
+            <xs:element ref="tns:sample"/>
+            <xs:element ref="tns:setBody"/>
+            <xs:element ref="tns:setExchangePattern"/>
+            <xs:element ref="tns:setFaultBody"/>
+            <xs:element ref="tns:setHeader"/>
+            <xs:element ref="tns:setOutHeader"/>
+            <xs:element ref="tns:setProperty"/>
+            <xs:element ref="tns:sort"/>
+            <xs:element ref="tns:split"/>
+            <xs:element ref="tns:stop"/>
+            <xs:element ref="tns:threads"/>
+            <xs:element ref="tns:throttle"/>
+            <xs:element ref="tns:throwException"/>
+            <xs:element ref="tns:to"/>
+            <xs:element ref="tns:transacted"/>
+            <xs:element ref="tns:transform"/>
+            <xs:element ref="tns:doTry"/>
+            <xs:element ref="tns:unmarshal"/>
+            <xs:element ref="tns:validate"/>
+            <xs:element ref="tns:whenSkipSendToEndpoint"/>
+            <xs:element ref="tns:wireTap"/>
+            <xs:element ref="tns:restBinding"/>
+          </xs:choice>
+        </xs:sequence>
+        <xs:anyAttribute namespace="##other" processContents="skip"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType abstract="true" name="processorDefinition">
+    <xs:complexContent>
+      <xs:extension base="tns:optionalIdentifiedDefinition">
+        <xs:sequence/>
+        <xs:attribute name="inheritErrorHandler" type="xs:boolean"/>
+        <xs:anyAttribute namespace="##other" processContents="skip"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType abstract="true" name="optionalIdentifiedDefinition">
+    <xs:sequence>
+      <xs:element minOccurs="0" ref="tns:description"/>
+    </xs:sequence>
+    <xs:attribute name="customId" type="xs:boolean"/>
+    <xs:attribute name="id" type="xs:string">
+    </xs:attribute>
+  </xs:complexType>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/aop.json
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/aop.json b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/aop.json
new file mode 100644
index 0000000..3d91228
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/json/aop.json
@@ -0,0 +1,21 @@
+{
+ "model": {
+    "kind": "model",
+    "name": "aop",
+    "title": "Aop",
+    "description": "Does processing before and/or after the route is completed",
+    "javaType": "org.apache.camel.model.AOPDefinition",
+    "label": "configuration",
+    "input": "true",
+    "output": "true"
+  },
+  "properties": {
+    "beforeUri": { "kind": "attribute", "required": "false", "type": "string", "javaType": "java.lang.String", "deprecated": "false", "description": "Endpoint to call in AOP before." },
+    "afterUri": { "kind": "attribute", "required": "false", "type": "string", "javaType": "java.lang.String", "deprecated": "false", "description": "Endpoint to call in AOP after. The difference between after and afterFinally is that afterFinally is invoked from a finally block so it will always be invoked no matter what eg also in case of an exception occur." },
+    "afterFinallyUri": { "kind": "attribute", "required": "false", "type": "string", "javaType": "java.lang.String", "deprecated": "false", "description": "Endpoint to call in AOP after finally. The difference between after and afterFinally is that afterFinally is invoked from a finally block so it will always be invoked no matter what eg also in case of an exception occur." },
+    "outputs": { "kind": "element", "required": "true", "type": "array", "javaType": "java.util.List<org.apache.camel.model.ProcessorDefinition<?>>", "oneOf": [ "aggregate", "aop", "bean", "choice", "convertBodyTo", "delay", "doCatch", "doFinally", "doTry", "dynamicRouter", "enrich", "filter", "idempotentConsumer", "inOnly", "inOut", "intercept", "interceptFrom", "interceptSendToEndpoint", "loadBalance", "log", "loop", "marshal", "multicast", "onCompletion", "onException", "otherwise", "pipeline", "policy", "pollEnrich", "process", "recipientList", "removeHeader", "removeHeaders", "removeProperties", "removeProperty", "resequence", "rollback", "routingSlip", "sample", "setBody", "setExchangePattern", "setFaultBody", "setHeader", "setOutHeader", "setProperty", "sort", "split", "stop", "threads", "throttle", "throwException", "to", "transacted", "transform", "unmarshal", "validate", "when", "whenSkipSendToEndpoint", "wireTap" ], "deprecated": "false" },
+    "id": { "kind": "attribute", "required": "false", "type": "string", "javaType": "java.lang.String", "deprecated": "false", "description": "Sets the id of this node" },
+    "description": { "kind": "element", "required": "false", "type": "object", "javaType": "org.apache.camel.model.DescriptionDefinition", "deprecated": "false", "description": "Sets the description of this node" }
+  }
+}
+

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/3_elements.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/3_elements.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/3_elements.xml
new file mode 100644
index 0000000..a859838
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/3_elements.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://camel.apache.org/schema/spring" elementFormDefault="qualified" targetNamespace="http://camel.apache.org/schema/spring" version="1.0">
+  <xs:element name="aop"/>
+  <xs:element name="avro"/>
+  <xs:element name="barcode"/>
+</xs:schema>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/aop.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/aop.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/aop.xml
new file mode 100644
index 0000000..9c732e7
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/aop.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://camel.apache.org/schema/spring" elementFormDefault="qualified" targetNamespace="http://camel.apache.org/schema/spring" version="1.0">
+  <xs:element name="aop"/>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/complex_type.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/complex_type.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/complex_type.xml
new file mode 100644
index 0000000..c0436d4
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/complex_type.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://camel.apache.org/schema/spring" elementFormDefault="qualified" targetNamespace="http://camel.apache.org/schema/spring" version="1.0">
+  <xs:complexType name="interceptSendToEndpointDefinition">
+    <xs:sequence/>
+    <xs:attribute name="uri" type="xs:string" use="required"/>
+    <xs:attribute name="skipSendToOriginalEndpoint" type="xs:boolean"/>
+    <xs:anyAttribute namespace="##other" processContents="skip"/>
+  </xs:complexType>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/complex_type_w_parent.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/complex_type_w_parent.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/complex_type_w_parent.xml
new file mode 100644
index 0000000..02fc6c1
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/complex_type_w_parent.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://camel.apache.org/schema/spring" elementFormDefault="qualified" targetNamespace="http://camel.apache.org/schema/spring" version="1.0">
+
+  <xs:complexType name="keyManagersParametersFactoryBean">
+    <xs:complexContent>
+      <xs:extension base="tns:abstractKeyManagersParametersFactoryBean">
+        <xs:sequence>
+        </xs:sequence>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType abstract="true" name="abstractKeyManagersParametersFactoryBean">
+    <xs:sequence/>
+    <xs:attribute name="keyPassword" type="xs:string"/>
+    <xs:attribute name="provider" type="xs:string"/>
+    <xs:attribute name="algorithm" type="xs:string"/>
+  </xs:complexType>
+</xs:schema>

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/element_doc_enrich.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/element_doc_enrich.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/element_doc_enrich.xml
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/camel/blob/e2968394/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/empty.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/empty.xml b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/empty.xml
new file mode 100644
index 0000000..1b21f5a
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/resources/xmls/empty.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<void/>
\ No newline at end of file


[4/4] camel git commit: Fixed CS

Posted by da...@apache.org.
Fixed CS


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

Branch: refs/heads/master
Commit: 2ec8e5ce2f79c9b73b9d909c9a3c66bd35b2d14f
Parents: f2fbfc8
Author: Claus Ibsen <da...@apache.org>
Authored: Sun Mar 15 07:41:17 2015 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Mar 15 07:41:17 2015 +0100

----------------------------------------------------------------------
 .../src/test/java/org/apache/camel/maven/DomFinderTest.java   | 2 +-
 .../apache/camel/maven/EipDocumentationEnricherMojoTest.java  | 2 +-
 .../src/test/java/org/apache/camel/maven/ResourceUtils.java   | 7 +++++--
 .../src/test/java/org/apache/camel/maven/XmlHelperTest.java   | 1 -
 .../camel/maven/integration/EIPDocumentationMojoTest.java     | 2 +-
 5 files changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2ec8e5ce/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java
index 86a508f..c263a2f 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/DomFinderTest.java
@@ -27,6 +27,7 @@ import org.junit.Test;
 import static org.junit.Assert.assertEquals;
 
 public class DomFinderTest {
+
     private DomFinder domFinder;
 
     @Test
@@ -55,7 +56,6 @@ public class DomFinderTest {
         assertEquals("uri", ((Element) attributesList.item(0)).getAttribute(Constants.NAME_ATTRIBUTE_NAME));
         assertEquals("skipSendToOriginalEndpoint",
                 ((Element) attributesList.item(1)).getAttribute(Constants.NAME_ATTRIBUTE_NAME));
-
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/camel/blob/2ec8e5ce/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
index 560fa25..83035b3 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/EipDocumentationEnricherMojoTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.maven;
 
 import java.io.File;
@@ -29,6 +28,7 @@ import static org.junit.Assert.fail;
 import static org.mockito.Mockito.when;
 
 public class EipDocumentationEnricherMojoTest {
+
     private EipDocumentationEnricherMojo eipDocumentationEnricherMojo = new EipDocumentationEnricherMojo();
 
     @Mock

http://git-wip-us.apache.org/repos/asf/camel/blob/2ec8e5ce/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.java
index 2da69fa..5b3604f 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/ResourceUtils.java
@@ -18,8 +18,11 @@ package org.apache.camel.maven;
 
 import java.io.File;
 
-public class ResourceUtils {
-    private ResourceUtils() { }
+public final class ResourceUtils {
+
+    private ResourceUtils() {
+        // noop
+    }
 
     public static File getResourceAsFile(String pathToFile) throws Exception {
         return new File(ResourceUtils.class.getClassLoader().getResource(pathToFile).getFile());

http://git-wip-us.apache.org/repos/asf/camel/blob/2ec8e5ce/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java
index b2e3ed5..e0003c4 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/XmlHelperTest.java
@@ -14,7 +14,6 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
 package org.apache.camel.maven;
 
 import org.junit.Test;

http://git-wip-us.apache.org/repos/asf/camel/blob/2ec8e5ce/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
index 8d94b42..e5ce45a 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/test/java/org/apache/camel/maven/integration/EIPDocumentationMojoTest.java
@@ -88,7 +88,7 @@ public class EIPDocumentationMojoTest {
 
     private void validateElement(Document doc) {
         NodeList element = doc.getElementsByTagName("xs:element");
-        Element e = ((Element) element.item(0));
+        Element e = (Element) element.item(0);
 
         assertEquals("aop", e.getAttribute(Constants.NAME_ATTRIBUTE_NAME));
 


[3/4] camel git commit: Minor refactoring and bug fixes.

Posted by da...@apache.org.
Minor refactoring and bug fixes.


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

Branch: refs/heads/master
Commit: c87732dbdbce014930ab6e6d60d38b11e736ab3f
Parents: f88d6dd
Author: nkukhar <ku...@gmail.com>
Authored: Sat Mar 14 01:06:46 2015 -0700
Committer: Claus Ibsen <da...@apache.org>
Committed: Sun Mar 15 07:38:49 2015 +0100

----------------------------------------------------------------------
 .../camel/maven/CamelSpringNamespace.java       |   4 +-
 .../java/org/apache/camel/maven/Constants.java  |   2 +
 .../maven/EipDocumentationEnricherMojo.java     | 138 +++++++++----------
 .../java/org/apache/camel/maven/XmlHelper.java  |  55 ++++++++
 4 files changed, 121 insertions(+), 78 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/c87732db/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/CamelSpringNamespace.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/CamelSpringNamespace.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/CamelSpringNamespace.java
index 3daf1d3..ee443e3 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/CamelSpringNamespace.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/CamelSpringNamespace.java
@@ -29,8 +29,8 @@ public class CamelSpringNamespace implements NamespaceContext {
         if (prefix == null) {
             throw new IllegalArgumentException("The prefix cannot be null.");
         }
-        if ("xs".equals(prefix)) {
-            return "http://www.w3.org/2001/XMLSchema";
+        if (Constants.XML_SCHEMA_NAMESPACE_PREFIX.equals(prefix)) {
+            return Constants.XML_SCHEMA_NAMESPACE_URI;
         }
         return null;
     }

http://git-wip-us.apache.org/repos/asf/camel/blob/c87732db/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java
index ebfd846..e26ce78 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/Constants.java
@@ -27,6 +27,8 @@ public final class Constants {
     public static final int WRAP_LENGTH = 80;
 
     // XML constants.
+    public static final String XML_SCHEMA_NAMESPACE_PREFIX = "xs";
+    public static final String XML_SCHEMA_NAMESPACE_URI = "http://www.w3.org/2001/XMLSchema";
     public static final String NAME_ATTRIBUTE_NAME = "name";
     public static final String TYPE_ATTRIBUTE_NAME = "type";
     public static final String XS_ANNOTATION_ELEMENT_NAME = "xs:annotation";

http://git-wip-us.apache.org/repos/asf/camel/blob/c87732db/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
index db6ae1f..031e7d7 100644
--- a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/EipDocumentationEnricherMojo.java
@@ -24,26 +24,18 @@ import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import javax.xml.namespace.NamespaceContext;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
 import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
 import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.xpath.XPath;
 import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
 
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -63,50 +55,59 @@ public class EipDocumentationEnricherMojo extends AbstractMojo {
      * Path to camel EIP schema.
      */
     @Parameter(required = true)
-    File inputCamelSchemaFile;
+    public File inputCamelSchemaFile;
 
     /**
      * Path to camel EIP schema with enriched documentation.
      */
     @Parameter(required = true)
-    File outputCamelSchemaFile;
+    public File outputCamelSchemaFile;
 
     /**
      * Path to camel core project root directory.
      */
     @Parameter(defaultValue = "${project.build.directory}/../../..//camel-core")
-    File camelCoreDir;
+    public File camelCoreDir;
 
     @Override
     public void execute() throws MojoExecutionException, MojoFailureException {
-        Set<String> injectedTypes = new HashSet<String>();
+        validateExists(inputCamelSchemaFile, "inputCamelSchemaFile");
+        validateIsFile(inputCamelSchemaFile, "inputCamelSchemaFile");
+        validateExists(camelCoreDir, "camelCoreDir");
+        validateIsDirectory(camelCoreDir, "camelCoreDir");
+        try {
+            runPlugin();
+        } catch (Exception e) {
+            throw new MojoExecutionException("Error during plugin execution", e);
+        }
+    }
+
+    private void runPlugin() throws Exception {
         File rootDir = new File(camelCoreDir, Constants.PATH_TO_MODEL_DIR);
-        Document document = buildNamespaceAwareDocument(inputCamelSchemaFile);
-        XPath xPath = buildXPath(new CamelSpringNamespace());
+        Document document = XmlHelper.buildNamespaceAwareDocument(inputCamelSchemaFile);
+        XPath xPath = XmlHelper.buildXPath(new CamelSpringNamespace());
         DomFinder domFinder = new DomFinder(document, xPath);
         DocumentationEnricher documentationEnricher = new DocumentationEnricher(document);
         Map<String, File> jsonFiles = PackageHelper.findJsonFiles(rootDir);
-        try {
-            NodeList elementsAndTypes = domFinder.findElementsAndTypes();
-            documentationEnricher.enrichTopLevelElementsDocumentation(elementsAndTypes, jsonFiles);
-            Map<String, String> typeToNameMap = buildTypeToNameMap(elementsAndTypes);
-            for (Map.Entry<String, String> entry : typeToNameMap.entrySet()) {
-                String elementType = entry.getKey();
-                String elementName = entry.getValue();
-                if (jsonFileExistsForElement(jsonFiles, elementName)) {
-                    injectAttributesDocumentation(domFinder,
-                            documentationEnricher,
-                            jsonFiles.get(elementName),
-                            elementType,
-                            injectedTypes);
-                }
+
+        NodeList elementsAndTypes = domFinder.findElementsAndTypes();
+        documentationEnricher.enrichTopLevelElementsDocumentation(elementsAndTypes, jsonFiles);
+        Map<String, String> typeToNameMap = buildTypeToNameMap(elementsAndTypes);
+        Set<String> injectedTypes = new HashSet<String>();
+
+        for (Map.Entry<String, String> entry : typeToNameMap.entrySet()) {
+            String elementType = entry.getKey();
+            String elementName = entry.getValue();
+            if (jsonFileExistsForElement(jsonFiles, elementName)) {
+                injectAttributesDocumentation(domFinder,
+                        documentationEnricher,
+                        jsonFiles.get(elementName),
+                        elementType,
+                        injectedTypes);
             }
-            saveToFile(document, outputCamelSchemaFile, buildTransformer());
-        } catch (XPathExpressionException e) {
-            throw new MojoExecutionException("Error during documentation enrichment", e);
-        } catch (IOException e) {
-            throw new MojoExecutionException("Error during documentation enrichment", e);
         }
+
+        saveToFile(document, outputCamelSchemaFile, XmlHelper.buildTransformer());
     }
 
     private boolean jsonFileExistsForElement(Map<String, File> jsonFiles,
@@ -114,20 +115,28 @@ public class EipDocumentationEnricherMojo extends AbstractMojo {
         return jsonFiles.containsKey(elementName);
     }
 
+    /**
+     * Recursively injects documentation to complex type attributes and it's parents.
+     */
     private void injectAttributesDocumentation(DomFinder domFinder,
                                                DocumentationEnricher documentationEnricher,
                                                File jsonFile,
                                                String type,
                                                Set<String> injectedTypes) throws XPathExpressionException, IOException {
+        if (injectedTypes.contains(type)) {
+            return;
+        }
+
+        injectedTypes.add(type);
         NodeList attributeElements = domFinder.findAttributesElements(type);
         if (attributeElements.getLength() > 0) {
             documentationEnricher.enrichTypeAttributesDocumentation(attributeElements, jsonFile);
-            injectedTypes.add(type);
-            String baseType = domFinder.findBaseType(type);
+        }
+
+        String baseType = domFinder.findBaseType(type);
+        if (baseType != null && !StringUtils.isEmpty(baseType)) {
             baseType = truncateTypeNamespace(baseType);
-            if (baseType != null && !injectedTypes.contains(baseType)) {
-                injectAttributesDocumentation(domFinder, documentationEnricher, jsonFile, baseType, injectedTypes);
-            }
+            injectAttributesDocumentation(domFinder, documentationEnricher, jsonFile, baseType, injectedTypes);
         }
     }
 
@@ -152,51 +161,28 @@ public class EipDocumentationEnricherMojo extends AbstractMojo {
         return baseType.replaceAll("tns:", "");
     }
 
-    private XPath buildXPath(NamespaceContext namespaceContext) {
-        XPath xPath = XPathFactory.newInstance().newXPath();
-        xPath.setNamespaceContext(namespaceContext);
-        return xPath;
+
+    private void saveToFile(Document document, File outputFile, Transformer transformer) throws FileNotFoundException, TransformerException {
+        StreamResult result = new StreamResult(new FileOutputStream(outputFile));
+        DOMSource source = new DOMSource(document);
+        transformer.transform(source, result);
     }
 
-    private Transformer buildTransformer() throws MojoExecutionException {
-        Transformer transformer;
-        try {
-            transformer = TransformerFactory.newInstance().newTransformer();
-            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
-            transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
-        } catch (TransformerConfigurationException e) {
-            throw new MojoExecutionException("Error during building transformer", e);
+    private void validateIsFile(File file, String name) throws MojoExecutionException {
+        if (!file.isFile()) {
+            throw new MojoExecutionException(name + "is not a file");
         }
-        return transformer;
     }
 
-    public Document buildNamespaceAwareDocument(File xml) throws MojoExecutionException {
-        Document result;
-        DocumentBuilder builder;
-        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-        factory.setNamespaceAware(true);
-        try {
-            builder = factory.newDocumentBuilder();
-            result =  builder.parse(xml);
-        } catch (SAXException e) {
-            throw new MojoExecutionException("Error during building a document", e);
-        } catch (ParserConfigurationException e) {
-            throw new MojoExecutionException("Error during building a document", e);
-        } catch (IOException  e) {
-            throw new MojoExecutionException("Error during building a document", e);
+    private void validateIsDirectory(File file, String name) throws MojoExecutionException {
+        if (!file.isDirectory()) {
+            throw new MojoExecutionException(name + "is not a directory");
         }
-        return result;
     }
 
-    private void saveToFile(Document document, File outputFile, Transformer transformer) throws MojoExecutionException {
-        try {
-            StreamResult result = new StreamResult(new FileOutputStream(outputFile));
-            DOMSource source = new DOMSource(document);
-            transformer.transform(source, result);
-        } catch (TransformerException e) {
-            throw new MojoExecutionException("Error during saving to file", e);
-        } catch (FileNotFoundException e) {
-            throw new MojoExecutionException("Error during saving to file", e);
+    private void validateExists(File file, String name) throws MojoExecutionException {
+        if (file == null || !file.exists()) {
+            throw new MojoExecutionException(name + " does not exist");
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/camel/blob/c87732db/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/XmlHelper.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/XmlHelper.java b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/XmlHelper.java
new file mode 100644
index 0000000..7136c5c
--- /dev/null
+++ b/tooling/maven/camel-eip-documentation-enricher-maven-plugin/src/main/java/org/apache/camel/maven/XmlHelper.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.maven;
+
+import java.io.File;
+import java.io.IOException;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+public final class XmlHelper {
+    private XmlHelper() { }
+
+    public static Document buildNamespaceAwareDocument(File xml) throws SAXException, ParserConfigurationException, IOException {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        return factory.newDocumentBuilder().parse(xml);
+    }
+
+    public static Transformer buildTransformer() throws TransformerConfigurationException {
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+        return transformer;
+    }
+
+    public static XPath buildXPath(NamespaceContext namespaceContext) {
+        XPath xPath = XPathFactory.newInstance().newXPath();
+        xPath.setNamespaceContext(namespaceContext);
+        return xPath;
+    }
+}