You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by dh...@apache.org on 2014/06/10 21:51:37 UTC

[09/35] git commit: Added generated source validation, refactored package_path in unit tests

Added generated source validation, refactored package_path in unit tests


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

Branch: refs/heads/master
Commit: 03f63df8c6b3994e8a157e9545f56f5baec53607
Parents: ecee7f1
Author: Dhiraj Bokde <dh...@yahoo.com>
Authored: Mon May 26 06:04:01 2014 -0700
Committer: Dhiraj Bokde <dh...@yahoo.com>
Committed: Tue Jun 10 12:48:30 2014 -0700

----------------------------------------------------------------------
 .../camel-component-util-maven-plugin/pom.xml   | 34 ++++++++++++++++++++
 .../camel/maven/AbstractGeneratorMojoTest.java  |  2 +-
 .../maven/ApiComponentGeneratorMojoTest.java    |  2 +-
 .../maven/FileApiMethodGeneratorMojoTest.java   |  2 +-
 .../JavadocApiMethodGeneratorMojoTest.java      |  3 +-
 5 files changed, 38 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/03f63df8/tooling/maven/camel-component-util-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-component-util-maven-plugin/pom.xml b/tooling/maven/camel-component-util-maven-plugin/pom.xml
index 350cd08..90a9aea 100644
--- a/tooling/maven/camel-component-util-maven-plugin/pom.xml
+++ b/tooling/maven/camel-component-util-maven-plugin/pom.xml
@@ -121,6 +121,40 @@
           </plugin>
       </plugins>
     </pluginManagement>
+    <plugins>
+      <!-- validate generated code after unit tests -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>build-helper-maven-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>add-generated-test-sources</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>add-test-source</goal>
+            </goals>
+            <configuration>
+              <sources>
+                <source>${project.build.directory}/generated-test-sources/camelComponent</source>
+              </sources>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>validate-generated-test-sources</id>
+            <phase>verify</phase>
+            <goals>
+              <goal>testCompile</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
   </build>
 
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/03f63df8/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java
index eaaf704..07edb41 100644
--- a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java
+++ b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/AbstractGeneratorMojoTest.java
@@ -27,7 +27,7 @@ import static org.junit.Assert.assertTrue;
  */
 public class AbstractGeneratorMojoTest {
     protected static final String OUT_DIR = "target/generated-test-sources/camelComponent";
-    protected static final String PACKAGE_PATH = AbstractGeneratorMojo.OUT_PACKAGE.replaceAll("\\.", "/");
+    protected static final String PACKAGE_PATH = AbstractGeneratorMojo.OUT_PACKAGE.replaceAll("\\.", "/") + "/";
 
     protected void assertExists(File outFile) {
         assertTrue("Generated file not found " + outFile.getPath(), outFile.exists());

http://git-wip-us.apache.org/repos/asf/camel/blob/03f63df8/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java
index 3176755..b0f8168 100644
--- a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java
+++ b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/ApiComponentGeneratorMojoTest.java
@@ -41,7 +41,7 @@ public class ApiComponentGeneratorMojoTest extends AbstractGeneratorMojoTest {
         final File outDir = new File(OUT_DIR);
         FileUtil.removeDir(outDir);
 
-        final File collectionFile = new File(OUT_DIR, PACKAGE_PATH + "/" + COMPONENT_NAME + "ApiCollection.java");
+        final File collectionFile = new File(OUT_DIR, PACKAGE_PATH + COMPONENT_NAME + "ApiCollection.java");
 
         final ApiComponentGeneratorMojo mojo = new ApiComponentGeneratorMojo();
         mojo.componentName = COMPONENT_NAME;

http://git-wip-us.apache.org/repos/asf/camel/blob/03f63df8/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/FileApiMethodGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/FileApiMethodGeneratorMojoTest.java b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/FileApiMethodGeneratorMojoTest.java
index 7f9661e..20c4a5a 100644
--- a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/FileApiMethodGeneratorMojoTest.java
+++ b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/FileApiMethodGeneratorMojoTest.java
@@ -38,7 +38,7 @@ public class FileApiMethodGeneratorMojoTest extends AbstractGeneratorMojoTest {
     public void testExecute() throws IOException, MojoFailureException, MojoExecutionException {
 
         // delete target file to begin
-        final File outFile = new File(OUT_DIR, PACKAGE_PATH + "/TestProxyApiMethod.java");
+        final File outFile = new File(OUT_DIR, PACKAGE_PATH + "TestProxyApiMethod.java");
         if (outFile.exists()) {
             outFile.delete();
         }

http://git-wip-us.apache.org/repos/asf/camel/blob/03f63df8/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java
----------------------------------------------------------------------
diff --git a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java
index 8ac2d46..3528eda 100644
--- a/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java
+++ b/tooling/maven/camel-component-util-maven-plugin/src/test/java/org/apache/camel/maven/JavadocApiMethodGeneratorMojoTest.java
@@ -38,7 +38,7 @@ public class JavadocApiMethodGeneratorMojoTest extends AbstractGeneratorMojoTest
     public void testExecute() throws IOException, MojoFailureException, MojoExecutionException {
 
         // delete target file to begin
-        final File outFile = new File(OUT_DIR, AbstractGeneratorMojo.OUT_PACKAGE.replaceAll("\\.", "/") + "/VelocityEngineApiMethod.java");
+        final File outFile = new File(OUT_DIR, PACKAGE_PATH + "VelocityEngineApiMethod.java");
         if (outFile.exists()) {
             outFile.delete();
         }
@@ -62,5 +62,4 @@ public class JavadocApiMethodGeneratorMojoTest extends AbstractGeneratorMojoTest
         // check target file was generated
         assertExists(outFile);
     }
-
 }