camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject camel git commit: Update Camel Salesforce integration tests
Date Tue, 22 Nov 2016 09:20:31 GMT
Repository: camel
Updated Branches:
  refs/heads/master 603dfb48a -> 52459d26a


Update Camel Salesforce integration tests

Tests in SalesforceComponentConfigurationTest were not updated to the
latest functionality provided by the
SalesforceComponent::completeEndpointPath.

Also renamed SalesforceComponentConfigurationTest to
SalesforceComponentConfigurationIntegrationTest, the test requires
Salesforce access to run. Renamed the `salesforce-test` profile to
`integration` and enforced existence of
`test-salesforce-login.properties` file in the root of
`camel-salesforce-parent` project -- it is needed for the integration
tests and contains the credentials required for accessing Salesforce
account used.

Details in README.md.


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

Branch: refs/heads/master
Commit: 52459d26ae17bb0436fb84354b169e8a649e4f3e
Parents: 603dfb4
Author: Zoran Regvart <zoran@regvart.com>
Authored: Thu Nov 10 11:51:28 2016 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Tue Nov 22 10:19:12 2016 +0100

----------------------------------------------------------------------
 .../camel-salesforce-component/README.md        |  36 ++++
 .../salesforce/RestApiIntegrationTest.java      |  24 ++-
 ...ceComponentConfigurationIntegrationTest.java | 209 +++++++++++++++++++
 .../SalesforceComponentConfigurationTest.java   | 200 ------------------
 components/camel-salesforce/pom.xml             |  23 +-
 5 files changed, 288 insertions(+), 204 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/52459d26/components/camel-salesforce/camel-salesforce-component/README.md
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/README.md b/components/camel-salesforce/camel-salesforce-component/README.md
index 9bf9845..ef3dc12 100644
--- a/components/camel-salesforce/camel-salesforce-component/README.md
+++ b/components/camel-salesforce/camel-salesforce-component/README.md
@@ -66,3 +66,39 @@ To create and subscribe to a topic
 To subscribe to an existing topic
 
 	from("force:CamelTestTopic&sObjectName=Merchandise__c")...
+
+## Developing the Camel Salesforce component
+
+### Running the integration tests
+
+**Note:** These instructions are only for running integration tests, they use permissions
and IP restrictions that should be reconsidered for production use. 
+
+In order to run the integration tests you need a Salesforce Developer account. You can get
a Salesforce Developer account by visiting [developer.salesforce.com](https://developer.salesforce.com/)
and sign up for one.
+
+Besides that account you'll need a _test user_ account that has `Bulk API Hard Delete` permission.
You can create one by going to _My Developer Account_ (link from [developer.salesforce.com](https://login.salesforce.com/?lt=de)).
Under _Administer_ expand _Manage Users_  and select _Profiles_ find _System Administrator_
profile and select _Clone_. Use `System Administrator With Hard Delete` as the profile name,
and after saving under _Administrative Permissions_ click edit and tick _Bulk API Hard Delete_
and save. Next, create a new user under _Administer_ expand _Manage Users_  and select _Users_
and then click on _New User_. Fill in the required fields, and select _Salesforce_ for _User
License_ and newly created profile for _Profile_. You get two user _Salesforce_ licenses so
the newly created user will put you at a maximum.
+
+Install the Warehouse package, tested with _Spring 2013_ (version 1.2) that can be installed
from the [https://login.salesforce.com/packaging/installPackage.apexp?p0=04ti0000000Pj8s](https://login.salesforce.com/packaging/installPackage.apexp?p0=04ti0000000Pj8s),
and make the following modifications manually:
+ - add custom field `Description` of type `Text` with maxumum length of `100` on the `Merchandise`
object
+ - add custom **required** field `Total_Inventory` of type `Number` with maximum length of
`18` without default value on the `Merchandise` object
+ - add custom field `Shipping_Location` of type `GeoLocation` on the `Account` object
+ - add custom field `Units_Sold` of `Number` type with maximum length of `18` on the `Line_Item`
object
+ - delete custom fields `Quantity`, `Invoice`, `Line_Item_Total` from the `Line_Item` object
+ - delete custom field `Quantity` from the `Merchanidise` object, you will need to delete
dependencies (ApexClass and Visualforce Page)
+ - create new ApexClass named `MerchandiseRestResource` with the content of `MerchandiseRestResource.apxc`
+
+You'll need to access a Merchandise record and run a `Test Report` in order for them to appear
in _Recent Items_ and _Recent Reports_. Do this by accessing _Warehouse_ application from
the menu in the top right, and selecting _Merchandise_ click _Go!_ (preselected is View: _All_)
and click on the single Merchandise item available. Next go to Reports and select and run
_Test Report_ from _Test Reports_. This is needed by the integration tests as they access
recent items and recently run reports.
+
+Create `Camel` connected application by selecting under _Apps_ in _Build_ and _Create_ sections
by clicking _New_ in _Connected Apps_ section. Fill in the required fields and in the _API
(Enable OAuth Settings)_ section thick _Enable OAuth Settings_ and move all scopes from _Available
OAuth Scopes_ to _Selected OAuth Scopes_. For _Callback URL_ you can use any URL it's not
needed by the REST API used by the Camel Salesforce component. Make note of _Consumer Key_
and _Consumer Secret_ you'll need to specify them in `test-salesforce-login.properties`, more
on that below.
+
+Next enable relaxed IP restrictions, by editing the policy of the _Camel_ connected application
in _Connected Apps_ under _Administer_ and _Manage Apps_ pick _Relax IP restrictions_ for
_IP Relaxation_.  
+
+Create `test-salesforce-login.properties` in `camel-salesforce` directory (one up from the
directory this file resides in) with the content:
+
+    clientId=<Consumer Key of the `Camel` connected App>
+    clientSecret=<Consumer Secret of the `Camel` connected app>
+    userName=<Username of the user with the `System Administrator With Hard Delete` profile>
+    password=<Password of the above user>
+    loginUrl=https://login.salesforce.com/
+    report.0=Test_Report
+
+

http://git-wip-us.apache.org/repos/asf/camel/blob/52459d26/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
index 486447a..ddfa832 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/RestApiIntegrationTest.java
@@ -306,8 +306,17 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase
{
     }
 
     private void doTestCreateUpdateDeleteWithId(String suffix) throws Exception {
+        template().request("direct:deleteLineItems", null);
+
+        Line_Item__c lineItem = new Line_Item__c();
+        lineItem.setName("1");
+        CreateSObjectResult result = template().requestBody("direct:createLineItem",
+                lineItem, CreateSObjectResult.class);
+        assertNotNull(result);
+        assertTrue(result.getSuccess());
+
         // get line item with Name 1
-        Line_Item__c lineItem = template().requestBody("direct:getSObjectWithId" + suffix,
TEST_LINE_ITEM_ID,
+        lineItem = template().requestBody("direct:getSObjectWithId" + suffix, TEST_LINE_ITEM_ID,
                 Line_Item__c.class);
         assertNotNull(lineItem);
         LOG.debug("GetWithId: {}", lineItem);
@@ -319,7 +328,7 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase
{
         // update line item with Name NEW_LINE_ITEM_ID
         lineItem.setName(NEW_LINE_ITEM_ID);
 
-        CreateSObjectResult result = template().requestBodyAndHeader("direct:upsertSObject"
+ suffix,
+        result = template().requestBodyAndHeader("direct:upsertSObject" + suffix,
                 lineItem, SalesforceEndpointConfig.SOBJECT_EXT_ID_VALUE, NEW_LINE_ITEM_ID,
                 CreateSObjectResult.class);
         assertNotNull(result);
@@ -529,7 +538,8 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase
{
         // get test merchandise
         // note that the header value overrides sObjectFields in endpoint
         Merchandise__c merchandise = template().requestBodyAndHeader("direct:getSObject"
+ suffix, testId,
-                "sObjectFields", "Name,Description__c,Price__c,Total_Inventory__c", Merchandise__c.class);
+                "sObjectFields", "Name,Description__c,Price__c,Total_Inventory__c",
+                Merchandise__c.class);
         assertNotNull(merchandise);
         assertNotNull(merchandise.getName());
         assertNotNull(merchandise.getPrice__c());
@@ -715,6 +725,14 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase
{
                         .to("salesforce:getSObjectWithId?format=XML&sObjectName=Line_Item__c&sObjectIdName=Name");
 
                 // testUpsertSObject
+                from("direct:deleteLineItems")
+                        .to("salesforce:query?sObjectQuery=SELECT Id FROM Line_Item__C&sObjectClass="
+ QueryRecordsLine_Item__c.class.getName())
+                        .transform(simple("${body.records}")).split(body()).transform(simple("${body.id}"))
+                        .to("salesforce:deleteSObject?sObjectName=Line_Item__c");
+
+                from("direct:createLineItem")
+                        .to("salesforce:createSObject?sObjectName=Line_Item__c");
+
                 from("direct:upsertSObject")
                         .to("salesforce:upsertSObject?sObjectName=Line_Item__c&sObjectIdName=Name");
 

http://git-wip-us.apache.org/repos/asf/camel/blob/52459d26/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurationIntegrationTest.java
b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurationIntegrationTest.java
new file mode 100644
index 0000000..db9acc8
--- /dev/null
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurationIntegrationTest.java
@@ -0,0 +1,209 @@
+/**
+ * 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.component.salesforce;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.SortedMap;
+
+import org.apache.camel.CamelContext;
+import org.apache.camel.Component;
+import org.apache.camel.ComponentConfiguration;
+import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.component.salesforce.dto.generated.Account;
+import org.apache.camel.component.salesforce.dto.generated.Document;
+import org.apache.camel.component.salesforce.dto.generated.Line_Item__c;
+import org.apache.camel.component.salesforce.dto.generated.MSPTest;
+import org.apache.camel.component.salesforce.dto.generated.Merchandise__c;
+import org.apache.camel.component.salesforce.dto.generated.QueryRecordsLine_Item__c;
+import org.apache.camel.component.salesforce.dto.generated.Tasks__c;
+import org.apache.camel.component.salesforce.internal.PayloadFormat;
+import org.apache.camel.impl.ParameterConfiguration;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Lets test the use of the ComponentConfiguration on the Salesforce endpoint
+ */
+public class SalesforceComponentConfigurationIntegrationTest extends CamelTestSupport {
+
+    private static final Logger LOG = LoggerFactory.getLogger(SalesforceComponentConfigurationIntegrationTest.class);
+
+    protected String componentName = "salesforce123";
+    protected boolean verbose = true;
+
+    @Test
+    public void testConfiguration() throws Exception {
+        Component component = context().getComponent(componentName);
+        ComponentConfiguration configuration = component.createComponentConfiguration();
+        SortedMap<String, ParameterConfiguration> parameterConfigurationMap = configuration.getParameterConfigurationMap();
+        if (verbose) {
+            Set<Map.Entry<String, ParameterConfiguration>> entries = parameterConfigurationMap.entrySet();
+            for (Map.Entry<String, ParameterConfiguration> entry : entries) {
+                String name = entry.getKey();
+                ParameterConfiguration config = entry.getValue();
+                LOG.info("Has name: {} with type {}", name, config.getParameterType().getName());
+            }
+        }
+
+        assertParameterConfig(configuration, "format", PayloadFormat.class);
+        assertParameterConfig(configuration, "sObjectName", String.class);
+        assertParameterConfig(configuration, "sObjectFields", String.class);
+        assertParameterConfig(configuration, "updateTopic", boolean.class);
+
+        configuration.setParameter("format", PayloadFormat.XML);
+        configuration.setParameter("sObjectName", "Merchandise__c");
+        configuration.setParameter("sObjectFields", "Description__c,Total_Inventory__c");
+        configuration.setParameter("updateTopic", false);
+
+        // operation name is base uri
+        configuration.setBaseUri("getSObject");
+
+        SalesforceEndpoint endpoint = assertIsInstanceOf(SalesforceEndpoint.class, configuration.createEndpoint());
+        final SalesforceEndpointConfig endpointConfig = endpoint.getConfiguration();
+        assertEquals("endpoint.format", PayloadFormat.XML, endpointConfig.getFormat());
+        assertEquals("endpoint.sObjectName", "Merchandise__c", endpointConfig.getSObjectName());
+        assertEquals("endpoint.sObjectFields", "Description__c,Total_Inventory__c", endpointConfig.getSObjectFields());
+        assertEquals("endpoint.updateTopic", false, endpointConfig.isUpdateTopic());
+    }
+
+    public static void assertParameterConfig(ComponentConfiguration configuration, String
name,
+                                       Class<?> parameterType) {
+        ParameterConfiguration config = configuration.getParameterConfiguration(name);
+        assertNotNull("ParameterConfiguration should exist for parameter name " + name, config);
+        assertEquals("ParameterConfiguration." + name + ".getName()", name, config.getName());
+        assertEquals("ParameterConfiguration." + name + ".getParameterType()", parameterType,
+                config.getParameterType());
+    }
+
+    @Test
+    public void testEndpointCompletion() throws Exception {
+        Component component = context().getComponent(componentName);
+        ComponentConfiguration configuration = component.createComponentConfiguration();
+
+        // get operation names
+        assertCompletionOptions(configuration.completeEndpointPath(""),
+            "getVersions", "getResources", "getGlobalObjects", "getBasicInfo", "getDescription",
"getSObject", "createSObject",
+            "updateSObject", "deleteSObject", "getSObjectWithId", "upsertSObject", "deleteSObjectWithId",
"getBlobField",
+            "query", "queryMore", "queryAll", "search", "apexCall", "createJob", "getJob",
"closeJob", "abortJob",
+            "createBatch", "getBatch", "getAllBatches", "getRequest", "getResults", "createBatchQuery",
"getQueryResultIds",
+            "getQueryResult", "getRecentReports", "getReportDescription", "executeSyncReport",
"executeAsyncReport",
+            "getReportInstances", "getReportResults", "[PushTopicName]"
+        );
+
+        // get filtered operation names
+        assertCompletionOptions(configuration.completeEndpointPath("get"),
+            "getVersions", "getResources", "getGlobalObjects", "getBasicInfo", "getDescription",
"getSObject", "getSObjectWithId",
+            "getBlobField", "getJob", "getBatch", "getAllBatches", "getRequest", "getResults",
"getQueryResultIds",
+            "getQueryResult", "getRecentReports", "getReportDescription", "getReportInstances",
"getReportResults"
+        );
+
+/* TODO support parameter completion
+        // get ALL REST operation parameters
+        // TODO support operation specific parameter completion
+        assertCompletionOptions(configuration.completeEndpointPath("getSObject?"),
+            "apiVersion", "httpClient", "format", "sObjectName", "sObjectId", "sObjectFields",
+            "sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery",
"sObjectSearch");
+
+        // get filtered REST parameters
+        assertCompletionOptions(configuration.completeEndpointPath("getSObject?format=XML&"),
+            "apiVersion", "httpClient", "sObjectName", "sObjectId", "sObjectFields",
+            "sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery",
"sObjectSearch");
+
+        // get ALL Bulk operation parameters
+        // TODO support operation specific parameter completion
+        assertCompletionOptions(configuration.completeEndpointPath("createJob?"),
+            "apiVersion", "httpClient", "sObjectQuery", "contentType", "jobId", "batchId",
"resultId");
+
+        // get filtered Bulk operation parameters
+        assertCompletionOptions(configuration.completeEndpointPath("createJob?contentType=XML&"),
+            "apiVersion", "httpClient", "sObjectQuery", "jobId", "batchId", "resultId");
+
+        // get ALL topic parameters for consumers
+        assertCompletionOptions(configuration.completeEndpointPath("myTopic?"),
+            "apiVersion", "httpClient", "updateTopic", "notifyForFields", "notifyForOperations");
+
+        // get filtered topic parameters for consumers
+        assertCompletionOptions(configuration.completeEndpointPath("myTopic?updateTopic=true&"),
+            "apiVersion", "httpClient", "notifyForFields", "notifyForOperations");
+
+        // get parameters from partial name
+        assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObject"),
+            "sObjectName", "sObjectId", "sObjectFields",
+            "sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery",
"sObjectSearch");
+*/
+
+        // get sObjectName values, from scanned DTO packages
+        assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObjectName="),
+            "Account", "Tasks__c", "Line_Item__c", "Merchandise__c", "Document", "MSPTest");
+
+        // get sObjectFields values, from scanned DTO
+        assertCompletionOptions(
+            configuration.completeEndpointPath("getSObject?sObjectName=Merchandise__c&sObjectFields="),
+            "Description__c", "Price__c", "Total_Inventory__c", "attributes", "Id",
+            "OwnerId", "IsDeleted", "Name", "CreatedDate", "CreatedById", "LastModifiedDate",
"LastModifiedById",
+            "SystemModstamp", "LastActivityDate", "LastViewedDate", "LastReferencedDate");
+
+        // get sObjectClass values, from scanned DTO packages
+        assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObjectClass="),
+            Account.class.getName(),
+            Tasks__c.class.getName(),
+            Line_Item__c.class.getName(),
+            Merchandise__c.class.getName(),
+            Document.class.getName(),
+            MSPTest.class.getName(),
+            QueryRecordsLine_Item__c.class.getName());
+    }
+
+    private void assertCompletionOptions(List<String> options, final String ...args)
{
+        List<String> missing = new ArrayList<String>();
+        for (String arg : args) {
+            if (!options.remove(arg)) {
+                missing.add(arg);
+            }
+        }
+        if (!missing.isEmpty() || !options.isEmpty()) {
+            fail(String.format("Missing options %s, unknown options %s",
+                missing, options));
+        }
+    }
+
+    protected CamelContext createCamelContext() throws Exception {
+        final CamelContext camelContext = super.createCamelContext();
+        final SalesforceLoginConfig loginConfig = LoginConfigHelper.getLoginConfig();
+        final SalesforceComponent component = new SalesforceComponent();
+        component.setLoginConfig(loginConfig);
+        // set DTO package
+        component.setPackages(new String[]{
+            Merchandise__c.class.getPackage().getName()
+        });
+        camelContext.addComponent(componentName, component);
+        return camelContext;
+    }
+
+    protected RouteBuilder createRouteBuilder() throws Exception {
+        return new RouteBuilder() {
+            public void configure() throws Exception {
+            }
+        };
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/camel/blob/52459d26/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurationTest.java
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurationTest.java
b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurationTest.java
deleted file mode 100644
index 4841943..0000000
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurationTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/**
- * 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.component.salesforce;
-
-import java.util.*;
-
-import org.apache.camel.CamelContext;
-import org.apache.camel.Component;
-import org.apache.camel.ComponentConfiguration;
-import org.apache.camel.builder.RouteBuilder;
-import org.apache.camel.component.salesforce.dto.generated.Document;
-import org.apache.camel.component.salesforce.dto.generated.Line_Item__c;
-import org.apache.camel.component.salesforce.dto.generated.Merchandise__c;
-import org.apache.camel.component.salesforce.dto.generated.QueryRecordsLine_Item__c;
-import org.apache.camel.component.salesforce.internal.PayloadFormat;
-import org.apache.camel.impl.ParameterConfiguration;
-import org.apache.camel.test.junit4.CamelTestSupport;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Lets test the use of the ComponentConfiguration on the Salesforce endpoint
- */
-@Ignore("Must run manually with a user supplied test-salesforce-login.properties")
-public class SalesforceComponentConfigurationTest extends CamelTestSupport {
-
-    private static final Logger LOG = LoggerFactory.getLogger(SalesforceComponentConfigurationTest.class);
-
-    protected String componentName = "salesforce123";
-    protected boolean verbose = true;
-
-    @Test
-    public void testConfiguration() throws Exception {
-        Component component = context().getComponent(componentName);
-        ComponentConfiguration configuration = component.createComponentConfiguration();
-        SortedMap<String, ParameterConfiguration> parameterConfigurationMap = configuration.getParameterConfigurationMap();
-        if (verbose) {
-            Set<Map.Entry<String, ParameterConfiguration>> entries = parameterConfigurationMap.entrySet();
-            for (Map.Entry<String, ParameterConfiguration> entry : entries) {
-                String name = entry.getKey();
-                ParameterConfiguration config = entry.getValue();
-                LOG.info("Has name: {} with type {}", name, config.getParameterType().getName());
-            }
-        }
-
-        assertParameterConfig(configuration, "format", PayloadFormat.class);
-        assertParameterConfig(configuration, "sObjectName", String.class);
-        assertParameterConfig(configuration, "sObjectFields", String.class);
-        assertParameterConfig(configuration, "updateTopic", boolean.class);
-
-        configuration.setParameter("format", PayloadFormat.XML);
-        configuration.setParameter("sObjectName", "Merchandise__c");
-        configuration.setParameter("sObjectFields", "Description__c,Total_Inventory__c");
-        configuration.setParameter("updateTopic", false);
-
-        // operation name is base uri
-        configuration.setBaseUri("getSObject");
-
-        SalesforceEndpoint endpoint = assertIsInstanceOf(SalesforceEndpoint.class, configuration.createEndpoint());
-        final SalesforceEndpointConfig endpointConfig = endpoint.getConfiguration();
-        assertEquals("endpoint.format", PayloadFormat.XML, endpointConfig.getFormat());
-        assertEquals("endpoint.sObjectName", "Merchandise__c", endpointConfig.getSObjectName());
-        assertEquals("endpoint.sObjectFields", "Description__c,Total_Inventory__c", endpointConfig.getSObjectFields());
-        assertEquals("endpoint.updateTopic", false, endpointConfig.isUpdateTopic());
-    }
-
-    public static void assertParameterConfig(ComponentConfiguration configuration, String
name,
-                                       Class<?> parameterType) {
-        ParameterConfiguration config = configuration.getParameterConfiguration(name);
-        assertNotNull("ParameterConfiguration should exist for parameter name " + name, config);
-        assertEquals("ParameterConfiguration." + name + ".getName()", name, config.getName());
-        assertEquals("ParameterConfiguration." + name + ".getParameterType()", parameterType,
-                config.getParameterType());
-    }
-
-    @Test
-    public void testEndpointCompletion() throws Exception {
-        Component component = context().getComponent(componentName);
-        ComponentConfiguration configuration = component.createComponentConfiguration();
-
-        // get operation names
-        assertCompletionOptions(configuration.completeEndpointPath(""),
-            "getVersions", "getResources", "getGlobalObjects", "getBasicInfo", "getDescription",
"getSObject",
-            "createSObject", "updateSObject", "deleteSObject", "getSObjectWithId", "upsertSObject",
-            "deleteSObjectWithId", "getBlobField", "query", "queryMore", "search", "createJob",
"getJob",
-            "closeJob", "abortJob", "createBatch", "getBatch", "getAllBatches", "getRequest",
"getResults",
-            "createBatchQuery", "getQueryResultIds", "getQueryResult", "[PushTopicName]"
-        );
-
-        // get filtered operation names
-        assertCompletionOptions(configuration.completeEndpointPath("get"),
-            "getVersions", "getResources", "getGlobalObjects", "getBasicInfo", "getDescription",
"getSObject",
-            "getSObjectWithId", "getBlobField", "getJob", "getBatch", "getAllBatches", "getRequest",
"getResults",
-            "getQueryResultIds", "getQueryResult"
-        );
-
-/* TODO support parameter completion
-        // get ALL REST operation parameters
-        // TODO support operation specific parameter completion
-        assertCompletionOptions(configuration.completeEndpointPath("getSObject?"),
-            "apiVersion", "httpClient", "format", "sObjectName", "sObjectId", "sObjectFields",
-            "sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery",
"sObjectSearch");
-
-        // get filtered REST parameters
-        assertCompletionOptions(configuration.completeEndpointPath("getSObject?format=XML&"),
-            "apiVersion", "httpClient", "sObjectName", "sObjectId", "sObjectFields",
-            "sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery",
"sObjectSearch");
-
-        // get ALL Bulk operation parameters
-        // TODO support operation specific parameter completion
-        assertCompletionOptions(configuration.completeEndpointPath("createJob?"),
-            "apiVersion", "httpClient", "sObjectQuery", "contentType", "jobId", "batchId",
"resultId");
-
-        // get filtered Bulk operation parameters
-        assertCompletionOptions(configuration.completeEndpointPath("createJob?contentType=XML&"),
-            "apiVersion", "httpClient", "sObjectQuery", "jobId", "batchId", "resultId");
-
-        // get ALL topic parameters for consumers
-        assertCompletionOptions(configuration.completeEndpointPath("myTopic?"),
-            "apiVersion", "httpClient", "updateTopic", "notifyForFields", "notifyForOperations");
-
-        // get filtered topic parameters for consumers
-        assertCompletionOptions(configuration.completeEndpointPath("myTopic?updateTopic=true&"),
-            "apiVersion", "httpClient", "notifyForFields", "notifyForOperations");
-
-        // get parameters from partial name
-        assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObject"),
-            "sObjectName", "sObjectId", "sObjectFields",
-            "sObjectIdName", "sObjectIdValue", "sObjectBlobFieldName", "sObjectClass", "sObjectQuery",
"sObjectSearch");
-*/
-
-        // get sObjectName values, from scanned DTO packages
-        assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObjectName="),
-            "Document", "Line_Item__c", "Merchandise__c");
-
-        // get sObjectFields values, from scanned DTO
-        assertCompletionOptions(
-            configuration.completeEndpointPath("getSObject?sObjectName=Merchandise__c&sObjectFields="),
-            "attributes", "Id", "OwnerId", "IsDeleted", "Name", "CreatedDate", "CreatedById",
-            "LastModifiedDate", "LastModifiedById", "SystemModstamp", "LastActivityDate",
-            "Description__c", "Price__c", "Total_Inventory__c");
-
-        // get sObjectClass values, from scanned DTO packages
-        assertCompletionOptions(configuration.completeEndpointPath("getSObject?sObjectClass="),
-            Document.class.getName(),
-            Line_Item__c.class.getName(),
-            Merchandise__c.class.getName(),
-            QueryRecordsLine_Item__c.class.getName());
-    }
-
-    private void assertCompletionOptions(List<String> options, final String ...args)
{
-        List<String> missing = new ArrayList<String>();
-        for (String arg : args) {
-            if (!options.remove(arg)) {
-                missing.add(arg);
-            }
-        }
-        if (!missing.isEmpty() || !options.isEmpty()) {
-            fail(String.format("Missing options %s, unknown options %s",
-                missing, options));
-        }
-    }
-
-    protected CamelContext createCamelContext() throws Exception {
-        final CamelContext camelContext = super.createCamelContext();
-        final SalesforceLoginConfig loginConfig = LoginConfigHelper.getLoginConfig();
-        final SalesforceComponent component = new SalesforceComponent();
-        component.setLoginConfig(loginConfig);
-        // set DTO package
-        component.setPackages(new String[]{
-            Merchandise__c.class.getPackage().getName()
-        });
-        camelContext.addComponent(componentName, component);
-        return camelContext;
-    }
-
-    protected RouteBuilder createRouteBuilder() throws Exception {
-        return new RouteBuilder() {
-            public void configure() throws Exception {
-            }
-        };
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/camel/blob/52459d26/components/camel-salesforce/pom.xml
----------------------------------------------------------------------
diff --git a/components/camel-salesforce/pom.xml b/components/camel-salesforce/pom.xml
index a26ed7c..258710b 100644
--- a/components/camel-salesforce/pom.xml
+++ b/components/camel-salesforce/pom.xml
@@ -68,10 +68,31 @@
     <profiles>
 
       <profile>
-        <id>salesforce-test</id>
+        <id>integration</id>
         <build>
           <plugins>
             <plugin>
+              <artifactId>maven-enforcer-plugin</artifactId>
+              <executions>
+                <execution>
+                  <id>test-salesforce-login-properties-exists</id>
+                  <goals>
+                    <goal>enforce</goal>
+                  </goals>
+                  <configuration>
+                    <rules>
+                      <requireFilesExist>
+                        <files>
+                         <file>../test-salesforce-login.properties</file>
+                        </files>
+                      </requireFilesExist>
+                    </rules>
+                    <fail>true</fail>
+                  </configuration>
+                </execution>
+              </executions>
+            </plugin>
+            <plugin>
               <artifactId>maven-surefire-plugin</artifactId>
               <configuration>
                 <childDelegation>false</childDelegation>


Mime
View raw message