camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject git commit: CAMEL-6428: Applied latest patch from Dhiraj Bokde
Date Thu, 20 Jun 2013 08:52:04 GMT
Updated Branches:
  refs/heads/master 13c1dd9f4 -> db2767306


CAMEL-6428: Applied latest patch from Dhiraj Bokde


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

Branch: refs/heads/master
Commit: db2767306d3619d37cb1cfb34d81581aa3f780ea
Parents: 13c1dd9
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Thu Jun 20 10:51:53 2013 +0200
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Thu Jun 20 10:51:53 2013 +0200

----------------------------------------------------------------------
 .../salesforce/StreamingApiIntegrationTest.java |  2 +
 .../camel-salesforce-maven-plugin/pom.xml       | 90 +++++++++++++++++++-
 .../src/it/settings.xml                         | 55 ++++++++++++
 .../src/it/simple-it/pom.xml                    | 61 +++++++++++++
 .../src/it/simple-it/verify.groovy              |  4 +
 .../apache/camel/maven/CamelSalesforceMojo.java | 49 ++++-------
 6 files changed, 229 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/db276730/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java
b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java
index f80c2f6..514f17e 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/StreamingApiIntegrationTest.java
@@ -56,6 +56,8 @@ public class StreamingApiIntegrationTest extends AbstractSalesforceTestBase
{
 
             // validate dynamic message headers
             assertNotNull("Missing header CamelSalesforceClientId", in.getHeader("CamelSalesforceClientId"));
+            assertNotNull("Missing header CamelSalesforceEventType", in.getHeader("CamelSalesforceEventType"));
+            assertNotNull("Missing header CamelSalesforceCreatedDate", in.getHeader("CamelSalesforceCreatedDate"));
 
         } finally {
             // remove the test record

http://git-wip-us.apache.org/repos/asf/camel/blob/db276730/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml b/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml
index a5bfdf7..6f8d64e 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/pom.xml
@@ -15,7 +15,8 @@
   See the License for the specific language governing permissions and
   limitations under the License.
 -->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
 
   <modelVersion>4.0.0</modelVersion>
 
@@ -38,6 +39,17 @@
       <version>2.0</version>
     </dependency>
     <dependency>
+      <groupId>org.apache.maven.plugin-tools</groupId>
+      <artifactId>maven-plugin-annotations</artifactId>
+      <version>3.2</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>3.0.8</version>
+    </dependency>
+    <dependency>
       <groupId>org.apache.camel</groupId>
       <artifactId>camel-salesforce</artifactId>
       <version>${project.version}</version>
@@ -62,6 +74,12 @@
 
     <!-- testing -->
     <dependency>
+      <groupId>org.apache.maven.plugin-testing</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>2.1</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-log4j12</artifactId>
       <version>${slf4j-api-version}</version>
@@ -75,4 +93,74 @@
     </dependency>
   </dependencies>
 
+  <build>
+    <plugins>
+      <!-- Generate plugin help -->
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-plugin-plugin</artifactId>
+        <version>3.2</version>
+        <configuration>
+          <goalPrefix>camel-salesforce</goalPrefix>
+          <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
+        </configuration>
+        <executions>
+          <execution>
+            <id>mojo-descriptor</id>
+            <goals>
+              <goal>descriptor</goal>
+            </goals>
+          </execution>
+          <execution>
+            <id>help-goal</id>
+            <goals>
+              <goal>helpmojo</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+  <!-- Plugin integration test profile -->
+  <profiles>
+    <profile>
+      <id>plugin-itest</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-invoker-plugin</artifactId>
+            <version>1.7</version>
+            <configuration>
+              <debug>true</debug>
+              <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+              <pomIncludes>
+                <pomInclude>*/pom.xml</pomInclude>
+              </pomIncludes>
+              <postBuildHookScript>verify</postBuildHookScript>
+              <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+              <settingsFile>src/it/settings.xml</settingsFile>
+              <goals>
+                <goal>clean</goal>
+                <goal>test-compile</goal>
+              </goals>
+            </configuration>
+            <executions>
+              <execution>
+                <id>integration-test</id>
+                <goals>
+                  <goal>install</goal>
+                  <goal>integration-test</goal>
+                  <goal>verify</goal>
+                </goals>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+
+      </build>
+    </profile>
+  </profiles>
+
 </project>

http://git-wip-us.apache.org/repos/asf/camel/blob/db276730/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/settings.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/settings.xml
b/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/settings.xml
new file mode 100644
index 0000000..c8f77f0
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/settings.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<settings>
+  <profiles>
+    <profile>
+      <id>it-repo</id>
+      <activation>
+        <activeByDefault>true</activeByDefault>
+      </activation>
+      <repositories>
+        <repository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </repository>
+      </repositories>
+      <pluginRepositories>
+        <pluginRepository>
+          <id>local.central</id>
+          <url>@localRepositoryUrl@</url>
+          <releases>
+            <enabled>true</enabled>
+          </releases>
+          <snapshots>
+            <enabled>true</enabled>
+          </snapshots>
+        </pluginRepository>
+      </pluginRepositories>
+    </profile>
+  </profiles>
+</settings>

http://git-wip-us.apache.org/repos/asf/camel/blob/db276730/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/simple-it/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/simple-it/pom.xml
b/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/simple-it/pom.xml
new file mode 100644
index 0000000..08142dd
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/simple-it/pom.xml
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.camel</groupId>
+  <artifactId>camel-salesforce-maven-plugin-it</artifactId>
+  <version>1.0-SNAPSHOT</version>
+
+  <description>A simple IT verifying the basic use case.</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <!-- Read salesforce login properties -->
+      <plugin>
+        <groupId>org.codehaus.mojo</groupId>
+        <artifactId>properties-maven-plugin</artifactId>
+        <version>1.0-alpha-2</version>
+        <executions>
+          <execution>
+            <phase>initialize</phase>
+            <goals><goal>read-project-properties</goal></goals>
+            <configuration>
+              <files>
+                <file>../../../../test-salesforce-login.properties</file>
+              </files>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+
+      <!-- Execute salesforce plugin -->
+      <plugin>
+        <groupId>@project.groupId@</groupId>
+        <artifactId>@project.artifactId@</artifactId>
+        <version>@project.version@</version>
+        <executions>
+          <execution>
+            <id>generate</id>
+            <goals>
+              <goal>generate</goal>
+            </goals>
+            <configuration>
+              <includePattern>(.*__c)</includePattern>
+              <!-- Salesforce login info -->
+              <clientId>${clientId}</clientId>
+              <clientSecret>${clientSecret}</clientSecret>
+              <userName>${userName}</userName>
+              <password>${password}</password>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

http://git-wip-us.apache.org/repos/asf/camel/blob/db276730/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/simple-it/verify.groovy
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/simple-it/verify.groovy
b/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/simple-it/verify.groovy
new file mode 100644
index 0000000..7153082
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/it/simple-it/verify.groovy
@@ -0,0 +1,4 @@
+// assert that the generated files directory exists
+File sourceDir = new File( basedir, "target/generated-sources/camel-salesforce" );
+
+assert sourceDir.isDirectory()

http://git-wip-us.apache.org/repos/asf/camel/blob/db276730/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
index 5513c9c..2adbf7f 100644
--- a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
+++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/java/org/apache/camel/maven/CamelSalesforceMojo.java
@@ -16,6 +16,7 @@
  */
 package org.apache.camel.maven;
 
+import org.apache.camel.component.salesforce.SalesforceEndpointConfig;
 import org.apache.camel.component.salesforce.SalesforceLoginConfig;
 import org.apache.camel.component.salesforce.api.SalesforceException;
 import org.apache.camel.component.salesforce.api.dto.*;
@@ -27,6 +28,9 @@ import org.apache.camel.component.salesforce.internal.client.SyncResponseCallbac
 import org.apache.log4j.Logger;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugins.annotations.LifecyclePhase;
+import org.apache.maven.plugins.annotations.Mojo;
+import org.apache.maven.plugins.annotations.Parameter;
 import org.apache.velocity.Template;
 import org.apache.velocity.VelocityContext;
 import org.apache.velocity.app.VelocityEngine;
@@ -48,10 +52,8 @@ import java.util.regex.Pattern;
 
 /**
  * Goal which generates POJOs for Salesforce SObjects
- *
- * @goal generate
- * @phase generate-sources
  */
+@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
 public class CamelSalesforceMojo extends AbstractMojo {
     private static final String JAVA_EXT = ".java";
     private static final String PACKAGE_NAME_PATTERN = "^[a-z]+(\\.[a-z][a-z0-9]*)*$";
@@ -65,84 +67,69 @@ public class CamelSalesforceMojo extends AbstractMojo {
 
     /**
      * Salesforce client id
-     *
-     * @parameter property="${clientId}"
-     * @required
      */
+    @Parameter(property = "camelSalesforce.clientId", required = true)
     protected String clientId;
 
     /**
      * Salesforce client secret
-     *
-     * @parameter property="${clientSecret}"
-     * @required
      */
+    @Parameter(property = "camelSalesforce.clientSecret", required = true)
     protected String clientSecret;
 
     /**
      * Salesforce user name
-     *
-     * @parameter property="${userName}"
-     * @required
      */
+    @Parameter(property = "camelSalesforce.userName", required = true)
     protected String userName;
 
     /**
      * Salesforce password
-     *
-     * @parameter property="${password}"
-     * @required
      */
+    @Parameter(property = "camelSalesforce.password", required = true)
     protected String password;
 
     /**
      * Salesforce version
-     *
-     * @parameter property="${version}" default-value="25.0"
      */
+    @Parameter(property = "camelSalesforce.version", defaultValue = SalesforceEndpointConfig.DEFAULT_VERSION)
     protected String version;
 
     /**
      * Location of the file.
-     *
-     * @parameter property="${outputDirectory}" default-value="${project.build.directory}/generated-sources/camel-salesforce"
-     * @required
      */
+    @Parameter(property = "camelSalesforce.outputDirectory",
+        defaultValue = "${project.build.directory}/generated-sources/camel-salesforce")
     protected File outputDirectory;
 
     /**
      * Names of Salesforce SObject for which POJOs must be generated
-     *
-     * @parameter
      */
+    @Parameter
     protected String[] includes;
 
     /**
      * Do NOT generate POJOs for these Salesforce SObjects
-     *
-     * @parameter
      */
+    @Parameter
     protected String[] excludes;
 
     /**
      * Include Salesforce SObjects that match pattern
-     *
-     * @parameter property="${includePattern}"
      */
+    @Parameter(property = "camelSalesforce.includePattern")
     protected String includePattern;
 
     /**
      * Exclude Salesforce SObjects that match pattern
-     *
-     * @parameter property="${excludePattern}"
      */
+    @Parameter(property = "camelSalesforce.excludePattern")
     protected String excludePattern;
 
     /**
      * Java package name for generated POJOs
-     *
-     * @parameter property="${packageName}" default-value="org.apache.camel.salesforce.dto"
      */
+    @Parameter(property = "camelSalesforce.packageName", defaultValue = "org.apache.camel.salesforce.dto")
     protected String packageName;
 
     private VelocityEngine engine;
@@ -193,7 +180,7 @@ public class CamelSalesforceMojo extends AbstractMojo {
         getLog().info("Salesforce login successful");
 
         // create rest client
-        RestClient restClient = null;
+        RestClient restClient;
         try {
             restClient = new DefaultRestClient(httpClient,
                     version, PayloadFormat.JSON, session);


Mime
View raw message