You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by al...@apache.org on 2019/05/20 16:24:26 UTC
[camel] branch master updated: CAMEL-13550: Fixed some integration
tests in camel-salesforce
This is an automated email from the ASF dual-hosted git repository.
aldettinger pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/master by this push:
new e61138b CAMEL-13550: Fixed some integration tests in camel-salesforce
e61138b is described below
commit e61138b9f2834bf4a3d0c3e8cf868e5de8faea70
Author: aldettinger <al...@gmail.com>
AuthorDate: Mon May 20 17:55:18 2019 +0200
CAMEL-13550: Fixed some integration tests in camel-salesforce
---
.../camel-salesforce-component/README.md | 3 ++-
.../SalesforceComponentVerifierExtension.java | 17 +++++++----------
.../component/salesforce/HttpProxyIntegrationTest.java | 6 +++---
.../PlatformEventsConsumerIntegrationTest.java | 2 +-
4 files changed, 13 insertions(+), 15 deletions(-)
diff --git a/components/camel-salesforce/camel-salesforce-component/README.md b/components/camel-salesforce/camel-salesforce-component/README.md
index c0f145b..943c64e 100644
--- a/components/camel-salesforce/camel-salesforce-component/README.md
+++ b/components/camel-salesforce/camel-salesforce-component/README.md
@@ -99,7 +99,7 @@ If your tests cannot be run alongside other tests you can use `@Category(Standal
#### Manual Salesforce instance setup for integration tests
-This is include for those that wish to setup the Salesforce instance manually for integration tests.
+This is include for those that wish to setup the Salesforce instance manually for integration tests. It could also help to double-check your setup.
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 [...]
@@ -111,6 +111,7 @@ Install the Warehouse package, tested with _Spring 2013_ (version 1.2) that can
- 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`
+ - deactivate the `Contact Duplicate Rule` in salesforce configuration
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.
diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifierExtension.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifierExtension.java
index b9f7946..cce1658 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifierExtension.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponentVerifierExtension.java
@@ -77,20 +77,17 @@ public class SalesforceComponentVerifierExtension extends DefaultComponentVerifi
try {
SalesforceClientTemplate.invoke(getCamelContext(), parameters, client -> {
- client.getVersions(Collections.emptyMap(),
- (response, headers, exception) -> processSalesforceException(builder, Optional.ofNullable(exception)));
+ client.getVersions(Collections.emptyMap(), (response, headers, exception) -> processSalesforceException(builder, Optional.ofNullable(exception)));
return null;
});
} catch (NoSuchOptionException e) {
- builder.error(
- ResultErrorBuilder.withMissingOption(e.getOptionName()).build()
- );
- } catch (SalesforceException e) {
- processSalesforceException(builder, Optional.of(e));
+ builder.error(ResultErrorBuilder.withMissingOption(e.getOptionName()).build());
} catch (Exception e) {
- builder.error(
- ResultErrorBuilder.withException(e).build()
- );
+ if (e.getCause() instanceof SalesforceException) {
+ processSalesforceException(builder, Optional.of((SalesforceException)e.getCause()));
+ } else {
+ builder.error(ResultErrorBuilder.withException(e).build());
+ }
}
return builder.build();
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/HttpProxyIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/HttpProxyIntegrationTest.java
index 0c8a487..1905940 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/HttpProxyIntegrationTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/HttpProxyIntegrationTest.java
@@ -61,7 +61,7 @@ public class HttpProxyIntegrationTest extends AbstractSalesforceTestBase {
private static Server server;
private static int httpProxyPort;
- private static final AtomicBoolean WENT_TORUGH_PROXY = new AtomicBoolean();
+ private static final AtomicBoolean WENT_THROUGH_PROXY = new AtomicBoolean();
@Parameter(0)
public Consumer<SalesforceComponent> configurationMethod;
@@ -77,7 +77,7 @@ public class HttpProxyIntegrationTest extends AbstractSalesforceTestBase {
doTestGetVersions("");
doTestGetVersions("Xml");
- assertTrue("Should have gone through the test proxy", WENT_TORUGH_PROXY.get());
+ assertTrue("Should have gone through the test proxy", WENT_THROUGH_PROXY.get());
}
@SuppressWarnings("unchecked")
@@ -120,7 +120,7 @@ public class HttpProxyIntegrationTest extends AbstractSalesforceTestBase {
return false;
}
LOG.info("Request contains required header " + PROXY_AUTHORIZATION);
- WENT_TORUGH_PROXY.set(true);
+ WENT_THROUGH_PROXY.set(true);
return true;
}
};
diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/PlatformEventsConsumerIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/PlatformEventsConsumerIntegrationTest.java
index 74cc9dd..9e13dc5 100644
--- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/PlatformEventsConsumerIntegrationTest.java
+++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/PlatformEventsConsumerIntegrationTest.java
@@ -36,7 +36,7 @@ public class PlatformEventsConsumerIntegrationTest extends AbstractSalesforceTes
public void shouldConsumePlatformEvents() throws InterruptedException, ExecutionException {
final ExecutorService parallel = Executors.newSingleThreadExecutor();
- final Future<PlatformEvent> futurePlatformEvent = parallel.submit(() -> consumer.receiveBody("salesforce:event/TestEvent__e", PlatformEvent.class));
+ final Future<PlatformEvent> futurePlatformEvent = parallel.submit(() -> consumer.receiveBody("salesforce:event/TestEvent__e?replayId=-1", PlatformEvent.class));
// it takes some time for the subscriber to subscribe, so we'll try to
// send repeated platform events and wait until the first one is