You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2023/06/19 11:40:55 UTC
[camel-spring-boot] branch main updated: camel-salesforce - Add missing test dependency and id (#863)
This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-spring-boot.git
The following commit(s) were added to refs/heads/main by this push:
new b8ee9b71ffb camel-salesforce - Add missing test dependency and id (#863)
b8ee9b71ffb is described below
commit b8ee9b71ffb18b2f25f9cd4549b4ddf1585bf64b
Author: Nicolas Filotto <es...@users.noreply.github.com>
AuthorDate: Mon Jun 19 13:40:49 2023 +0200
camel-salesforce - Add missing test dependency and id (#863)
## Motivation
The test `RawPayloadTest` in `camel-salesforce` fails due to the exception `NoSuchMethodError: 'void okhttp3.internal.Internal.initializeInstanceForTests()'`
## Modifications:
* Adds the missing test dependency based on https://github.com/apache/camel/blob/main/components/camel-salesforce/camel-salesforce-component/pom.xml#L237-L243
* Adds the id to the fake payload response to avoid an NPE when [extracting the `orgId`](https://github.com/apache/camel/blob/main/components/camel-salesforce/camel-salesforce-component/pom.xml#L237-L243)
---
components-starter/camel-salesforce-starter/pom.xml | 7 +++++++
.../camel/component/salesforce/springboot/RawPayloadTest.java | 10 ++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/components-starter/camel-salesforce-starter/pom.xml b/components-starter/camel-salesforce-starter/pom.xml
index 2da56d00571..fb15835d647 100644
--- a/components-starter/camel-salesforce-starter/pom.xml
+++ b/components-starter/camel-salesforce-starter/pom.xml
@@ -45,6 +45,13 @@
<version>${okclient-version}</version>
<scope>test</scope>
</dependency>
+ <!-- forcing okhttp v3.x related to https://issues.apache.org/jira/browse/CAMEL-16336 -->
+ <dependency>
+ <groupId>com.squareup.okhttp3</groupId>
+ <artifactId>okhttp</artifactId>
+ <version>${squareup-okhttp-version}</version>
+ <scope>test</scope>
+ </dependency>
<!--START OF GENERATED CODE-->
<dependency>
<groupId>org.apache.camel.springboot</groupId>
diff --git a/components-starter/camel-salesforce-starter/src/test/java/org/apache/camel/component/salesforce/springboot/RawPayloadTest.java b/components-starter/camel-salesforce-starter/src/test/java/org/apache/camel/component/salesforce/springboot/RawPayloadTest.java
index 16b1c231bdc..f19fa69d8af 100644
--- a/components-starter/camel-salesforce-starter/src/test/java/org/apache/camel/component/salesforce/springboot/RawPayloadTest.java
+++ b/components-starter/camel-salesforce-starter/src/test/java/org/apache/camel/component/salesforce/springboot/RawPayloadTest.java
@@ -127,10 +127,16 @@ public class RawPayloadTest extends AbstractSalesforceTestBase {
server.setDispatcher(new Dispatcher() {
@Override
- public MockResponse dispatch(RecordedRequest recordedRequest) throws InterruptedException {
+ public MockResponse dispatch(RecordedRequest recordedRequest) {
if (recordedRequest.getPath().equals(OAUTH2_TOKEN_PATH)) {
return new MockResponse().setResponseCode(200)
- .setBody("{ \"access_token\": \"mock_token\", \"instance_url\": \"" + loginUrl + "\"}");
+ .setBody(String.format("""
+ {
+ "access_token": "mock_token",
+ "instance_url": "%s",
+ "id": "https://login.salesforce.com/id/00D4100000xxxxxxxx/0054100000xxxxxxxx"
+ }
+ """, loginUrl));
} else {
return new MockResponse().setResponseCode(200)
.setHeader(HttpHeader.CONTENT_TYPE.toString(),