camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [1/4] camel git commit: Test fixed. Polishing. Test file moved out of target directory as target directory is ignored by git.
Date Sun, 15 Mar 2015 06:39:38 GMT
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 <kukhar.n@gmail.com>
Authored: Sat Mar 14 11:21:12 2015 -0700
Committer: Claus Ibsen <davsclaus@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" }
+  }
+}
+


Mime
View raw message