(camel) branch main updated: Add Variables support to FlexibleAggregationStrategy
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 5cb8b06b645 Add Variables support to FlexibleAggregationStrategy 5cb8b06b645 is described below commit 5cb8b06b64546f790774a45dd36d866aa0a8883e Author: Jeremy Ross AuthorDate: Mon Jun 17 14:31:34 2024 -0500 Add Variables support to FlexibleAggregationStrategy --- .../camel/builder/FlexibleAggregationStrategy.java | 52 ++ .../toolbox/FlexibleAggregationStrategiesTest.java | 16 +++ 2 files changed, 68 insertions(+) diff --git a/core/camel-core-model/src/main/java/org/apache/camel/builder/FlexibleAggregationStrategy.java b/core/camel-core-model/src/main/java/org/apache/camel/builder/FlexibleAggregationStrategy.java index 50f182e7240..d7353a73c1c 100644 --- a/core/camel-core-model/src/main/java/org/apache/camel/builder/FlexibleAggregationStrategy.java +++ b/core/camel-core-model/src/main/java/org/apache/camel/builder/FlexibleAggregationStrategy.java @@ -129,6 +129,18 @@ public class FlexibleAggregationStrategy implements AggregationStrategy { return this; } +/** + * Store the result of this Aggregation Strategy (whether an atomic element or a Collection) in a variable with the + * designated name. + * + * @param variableName The variable name. + * @return This instance. + */ +public FlexibleAggregationStrategy storeInVariable(String variableName) { +this.injector = new VariableInjector(castAs, variableName); +return this; +} + /** * Store the result of this Aggregation Strategy (whether an atomic element or a Collection) in an IN message header * with the designated name. @@ -370,7 +382,47 @@ public class FlexibleAggregationStrategy implements AggregationStrategy { public void setValueAsCollection(Exchange exchange, Collection obj) { exchange.setProperty(propertyName, obj); } +} + +private class VariableInjector extends FlexibleAggregationStrategyInjector { +private final String variableName; + +VariableInjector(Class type, String variableName) { +super(type); +this.variableName = variableName; +} + +@Override +public void prepareAggregationExchange(Exchange exchange) { +exchange.removeVariable(variableName); +} + +@Override +public E getValue(Exchange exchange) { +return exchange.getVariable(variableName, type); +} + +@Override +public void setValue(Exchange exchange, E obj) { +exchange.setVariable(variableName, obj); +} +@Override +@SuppressWarnings("unchecked") +public Collection getValueAsCollection(Exchange exchange, Class type) { +Object value = exchange.getVariable(variableName); +if (value == null) { +// empty so create a new collection to host this +return exchange.getContext().getInjector().newInstance(type); +} else { +return exchange.getVariable(variableName, type); +} +} + +@Override +public void setValueAsCollection(Exchange exchange, Collection obj) { +exchange.setVariable(variableName, obj); +} } private class HeaderInjector extends FlexibleAggregationStrategyInjector { diff --git a/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java b/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java index 373d13f30a0..c4ea4bf8ed3 100644 --- a/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java +++ b/core/camel-core/src/test/java/org/apache/camel/util/toolbox/FlexibleAggregationStrategiesTest.java @@ -124,6 +124,17 @@ public class FlexibleAggregationStrategiesTest extends ContextTestSupport { assertMockEndpointsSatisfied(); } +@Test +public void testFlexibleAggregationStrategyStoreInVariableSingleValue() throws Exception { +getMockEndpoint("mock:result7").expectedMessageCount(1); + getMockEndpoint("mock:result7").message(0).variable("AggregationResult").isInstanceOf(String.class); + getMockEndpoint("mock:result7").message(0).variable("AggregationResult").isEqualTo("AGGREGATE1"); + +template.sendBody("direct:start7", "AGGREGATE1"); + +assertMockEndpointsSatisfied(); +} + @Test @SuppressWarnings("rawtypes") public void testFlexibleAggregationStrategyGenericArrayListWithoutNulls() throws Excepti
(camel) branch main updated: camel-salesforce: Document CLIENT_CREDENTIALS auth type.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new e844404abe3 camel-salesforce: Document CLIENT_CREDENTIALS auth type. e844404abe3 is described below commit e844404abe37fb1cc764b80a383778a512c73ff7 Author: Jeremy Ross AuthorDate: Wed May 15 13:10:30 2024 -0700 camel-salesforce: Document CLIENT_CREDENTIALS auth type. --- .../src/main/docs/salesforce-component.adoc | 2 +- .../org/apache/camel/component/salesforce/SalesforceComponent.java| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index d72db1e6040..d1e7bd0ec0f 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -87,7 +87,7 @@ For each of the flows, different sets of properties need to be set: | Property | Where to find it on Salesforce | Flow | clientId | Connected App, Consumer Key| All flows -| clientSecret | Connected App, Consumer Secret | Username-Password, Refresh Token +| clientSecret | Connected App, Consumer Secret | Username-Password, Refresh Token, Client Credentials | userName | Salesforce user username | Username-Password, JWT Bearer Token | password | Salesforce user password | Username-Password | refreshToken | From OAuth flow callback | Refresh Token diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java index 434c5bf8be7..6e88f559467 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java @@ -153,10 +153,10 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP label = "common,security") private String jwtAudience; -@Metadata(description = "Explicit authentication method to be used, one of USERNAME_PASSWORD, REFRESH_TOKEN or JWT." +@Metadata(description = "Explicit authentication method to be used, one of USERNAME_PASSWORD, REFRESH_TOKEN, CLIENT_CREDENTIALS, or JWT." + " Salesforce component can auto-determine the authentication method to use from the properties set, set this " + " property to eliminate any ambiguity.", - label = "common,security", enums = "USERNAME_PASSWORD,REFRESH_TOKEN,JWT") + label = "common,security", enums = "USERNAME_PASSWORD,REFRESH_TOKEN,CLIENT_CREDENTIALS,JWT") private AuthenticationType authenticationType; @Metadata(description = "If set to true prevents the component from authenticating to Salesforce with the start of"
(camel) branch main updated: Revert inadvertent change.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new cf9a2cab956 Revert inadvertent change. cf9a2cab956 is described below commit cf9a2cab956af5e9aac204e5e0559c25ee6ed082 Author: Jeremy Ross AuthorDate: Thu Jan 4 15:03:47 2024 -0600 Revert inadvertent change. --- .../component/salesforce/api/utils/JsonUtils.java | 75 ++ 1 file changed, 4 insertions(+), 71 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/utils/JsonUtils.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/utils/JsonUtils.java index 3d1d1511797..3c7a134372b 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/utils/JsonUtils.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/utils/JsonUtils.java @@ -148,20 +148,18 @@ public final class JsonUtils { throws JsonProcessingException { ObjectMapper schemaObjectMapper = createSchemaObjectMapper(); return getJsonSchemaString(schemaObjectMapper, -getSObjectJsonSchema(schemaObjectMapper, description, DEFAULT_ID_PREFIX, addQuerySchema, false), -DEFAULT_ID_PREFIX); +getSObjectJsonSchema(schemaObjectMapper, description, DEFAULT_ID_PREFIX, addQuerySchema), DEFAULT_ID_PREFIX); } public static JsonSchema getSObjectJsonSchemaAsSchema(SObjectDescription description, boolean addQuerySchema) throws JsonProcessingException { ObjectMapper schemaObjectMapper = createSchemaObjectMapper(); -return getJsonSchemaAsSchema( -getSObjectJsonSchema(schemaObjectMapper, description, DEFAULT_ID_PREFIX, addQuerySchema, false), +return getJsonSchemaAsSchema(getSObjectJsonSchema(schemaObjectMapper, description, DEFAULT_ID_PREFIX, addQuerySchema), DEFAULT_ID_PREFIX); } public static Set getSObjectJsonSchema( -ObjectMapper objectMapper, SObjectDescription description, String idPrefix, boolean addQuerySchema, boolean forCdc) +ObjectMapper objectMapper, SObjectDescription description, String idPrefix, boolean addQuerySchema) throws JsonProcessingException { Set allSchemas = new HashSet<>(); @@ -282,7 +280,7 @@ public final class JsonUtils { fieldSchema.setDescription(descriptionText); // add property to sobject schema -if (field.isNillable() || forCdc) { +if (field.isNillable()) { sobjectSchema.putOptionalProperty(field.getName(), fieldSchema); } else { sobjectSchema.putProperty(field.getName(), fieldSchema); @@ -310,71 +308,6 @@ public final class JsonUtils { return allSchemas; } -public static JsonSchema getCdcSchema( -ObjectMapper objectMapper, Iterable descriptions, -String idPrefix) -throws JsonProcessingException { -ObjectSchema cdcSchema = new ObjectSchema(); -cdcSchema.set$schema(SCHEMA4); -cdcSchema.setId(idPrefix + ":cdc"); -cdcSchema.setTitle("CDC Change Events"); - -ObjectSchema header = new ObjectSchema(); -header.putProperty("entityName", new StringSchema()); - -ArraySchema recordIds = new ArraySchema(); -recordIds.setItems(new ArraySchema.SingleItems(new StringSchema())); -header.putProperty("recordIds", recordIds); - -ArraySchema changedFields = new ArraySchema(); -changedFields.setItems(new ArraySchema.SingleItems(new StringSchema())); -header.putProperty("changedFields", changedFields); - -StringSchema changeType = new StringSchema(); -changeType.setEnums(Set.of( -"CREATE", -"UPDATE", -"DELETE", -"UNDELETE", -"GAP_CREATE", -"GAP_UPDATE", -"GAP_DELETE", -"GAP_UNDELETE", -"GAP_OVERFLOW")); -header.putProperty("changeType", changeType); - -header.putProperty("changeOrigin", new StringSchema()); -header.putProperty("transactionKey", new StringSchema()); -header.putProperty("sequenceNumber", new IntegerSchema()); -header.putProperty("commitTimestamp", new IntegerSchema()); -header.putProperty("commitUser", new StringSc
(camel) 01/02: CAMEL-17719: camel-salesforce: Add operation to get event schemas
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit 0267211e9b5bb1be8628331bb6ac07293e692037 Author: Jeremy Ross AuthorDate: Fri Apr 15 10:21:42 2022 -0500 CAMEL-17719: camel-salesforce: Add operation to get event schemas Event schemas are Avro schemas and support Platform Events, Change Data Capture events, and custom events. --- .../salesforce/SalesforceComponentConfigurer.java | 18 + .../salesforce/SalesforceEndpointConfigurer.java | 18 + .../salesforce/SalesforceEndpointUriFactory.java | 5 +- .../camel/component/salesforce/salesforce.json | 84 -- .../src/main/docs/salesforce-component.adoc| 20 ++ .../component/salesforce/SalesforceEndpoint.java | 4 +- .../salesforce/SalesforceEndpointConfig.java | 55 +- .../component/salesforce/SalesforceProducer.java | 2 +- .../component/salesforce/api/utils/JsonUtils.java | 75 +-- .../salesforce/internal/OperationName.java | 1 + .../internal/client/DefaultRestClient.java | 37 ++ .../salesforce/internal/client/RestClient.java | 18 + .../internal/dto/EventSchemaFormatEnum.java| 44 .../internal/processor/AbstractRestProcessor.java | 26 +++ .../internal/processor/SalesforceProcessor.java| 2 - .../salesforce/RestApiIntegrationTest.java | 32 + 16 files changed, 391 insertions(+), 50 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java index 41fe36cac2a..93e4abef2d8 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java @@ -59,6 +59,12 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "contentType": getOrCreateConfig(target).setContentType(property(camelContext, org.apache.camel.component.salesforce.api.dto.bulk.ContentType.class, value)); return true; case "defaultreplayid": case "defaultReplayId": getOrCreateConfig(target).setDefaultReplayId(property(camelContext, java.lang.Long.class, value)); return true; +case "eventname": +case "eventName": getOrCreateConfig(target).setEventName(property(camelContext, java.lang.String.class, value)); return true; +case "eventschemaformat": +case "eventSchemaFormat": getOrCreateConfig(target).setEventSchemaFormat(property(camelContext, org.apache.camel.component.salesforce.internal.dto.EventSchemaFormatEnum.class, value)); return true; +case "eventschemaid": +case "eventSchemaId": getOrCreateConfig(target).setEventSchemaId(property(camelContext, java.lang.String.class, value)); return true; case "fallbackreplayid": case "fallBackReplayId": getOrCreateConfig(target).setFallBackReplayId(property(camelContext, java.lang.Long.class, value)); return true; case "format": getOrCreateConfig(target).setFormat(property(camelContext, org.apache.camel.component.salesforce.internal.PayloadFormat.class, value)); return true; @@ -255,6 +261,12 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "contentType": return org.apache.camel.component.salesforce.api.dto.bulk.ContentType.class; case "defaultreplayid": case "defaultReplayId": return java.lang.Long.class; +case "eventname": +case "eventName": return java.lang.String.class; +case "eventschemaformat": +case "eventSchemaFormat": return org.apache.camel.component.salesforce.internal.dto.EventSchemaFormatEnum.class; +case "eventschemaid": +case "eventSchemaId": return java.lang.String.class; case "fallbackreplayid": case "fallBackReplayId": return java.lang.Long.class; case "format": return org.apache.camel.component.salesforce.internal.PayloadFormat.class; @@ -452,6 +464,12 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "contentType": return getOrCreateConfig(target).getContentType(); case "defaultreplayid": case "default
(camel) 02/02: CAMEL-17719: camel-salesforce: Add operation to get event schemas
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit 682a7de070c9110093f763b00db59d9966bfab82 Author: Jeremy Ross AuthorDate: Thu Jan 4 14:25:52 2024 -0600 CAMEL-17719: camel-salesforce: Add operation to get event schemas Event schemas are Avro schemas and support Platform Events, Change Data Capture events, and custom events. --- .../org/apache/camel/component/salesforce/RestApiIntegrationTest.java| 1 - 1 file changed, 1 deletion(-) 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 e8fa5e95704..a4b91c047a9 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 @@ -554,7 +554,6 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { final String schemaId = (String) map.get("uuid"); final Object idResult = template.requestBodyAndHeader("salesforce:getEventSchema", "", EVENT_SCHEMA_ID, schemaId); -System.out.println(idResult); assertNotNull(idResult); }
(camel) branch main updated (031d6b0fe22 -> 682a7de070c)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git from 031d6b0fe22 Bump io.smallrye:smallrye-health from 4.0.4 to 4.1.0 new 0267211e9b5 CAMEL-17719: camel-salesforce: Add operation to get event schemas new 682a7de070c CAMEL-17719: camel-salesforce: Add operation to get event schemas The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../salesforce/SalesforceComponentConfigurer.java | 18 + .../salesforce/SalesforceEndpointConfigurer.java | 18 + .../salesforce/SalesforceEndpointUriFactory.java | 5 +- .../camel/component/salesforce/salesforce.json | 84 -- .../src/main/docs/salesforce-component.adoc| 20 ++ .../component/salesforce/SalesforceEndpoint.java | 4 +- .../salesforce/SalesforceEndpointConfig.java | 55 +- .../component/salesforce/SalesforceProducer.java | 2 +- .../component/salesforce/api/utils/JsonUtils.java | 75 +-- .../salesforce/internal/OperationName.java | 1 + .../internal/client/DefaultRestClient.java | 37 ++ .../salesforce/internal/client/RestClient.java | 18 + ...rFieldsEnum.java => EventSchemaFormatEnum.java} | 29 +++- .../internal/processor/AbstractRestProcessor.java | 26 +++ .../internal/processor/SalesforceProcessor.java| 2 - .../salesforce/RestApiIntegrationTest.java | 31 16 files changed, 354 insertions(+), 71 deletions(-) copy components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/dto/{NotifyForFieldsEnum.java => EventSchemaFormatEnum.java} (67%)
(camel) branch main updated (0375ff9c705 -> 8882d6c186d)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git from 0375ff9c705 Bump org.openapitools:openapi-generator from 7.1.0 to 7.2.0 (#12578) add 8490563ba76 CAMEL-20248: camel-salesforce: Continue Jetty 12 migration add 5d3f4192480 CAMEL-20236: camel-salesforce: Add missing bulk job properties add e5779d198d2 camel-salesforce: Enable checkstyle add 8882d6c186d camel-salesforce: Improve test. No new revisions were added by this update. Summary of changes: .../codegen/AbstractSalesforceExecution.java | 14 +- .../component/salesforce/PubSubApiConsumer.java|7 +- .../component/salesforce/SalesforceComponent.java | 18 +- .../component/salesforce/SalesforceEndpoint.java | 32 +- .../component/salesforce/SalesforceHttpClient.java |7 +- .../salesforce/api/FieldsToNullPropertyFilter.java |3 +- .../salesforce/api/dto/AbstractSObjectBase.java|6 +- .../component/salesforce/api/dto/RestError.java|5 +- .../component/salesforce/api/dto/bulk/Error.java |5 +- .../salesforce/api/dto/bulk/ResultError.java | 12 +- .../component/salesforce/api/dto/bulkv2/Job.java | 20 + .../salesforce/api/dto/composite/SObjectBatch.java |3 +- .../api/dto/composite/SObjectComposite.java|3 +- .../internal/client/AbstractClientBase.java| 722 .../internal/client/DefaultBulkApiClient.java | 21 +- .../internal/client/DefaultCompositeApiClient.java |1 - .../internal/client/DefaultRawClient.java |2 +- .../internal/client/DefaultRestClient.java |3 + .../internal/client/SalesforceHttpRequest.java | 38 - .../internal/client/SalesforceSecurityHandler.java | 64 +- .../internal/processor/AnalyticsApiProcessor.java |6 +- .../internal/processor/RawProcessor.java |1 - .../internal/streaming/SubscriptionHelper.java | 18 +- .../salesforce/HttpProxyIntegrationTest.java | 301 ++-- .../camel/component/salesforce/PubSubApiTest.java | 24 +- .../salesforce/RestApiIntegrationTest.java | 1739 ++-- .../salesforce/StreamingApiIntegrationTest.java|3 + .../component/salesforce/api/dto/LimitsTest.java |1 - .../api/dto/composite/SObjectCompositeTest.java|2 +- .../salesforce/internal/SalesforceSessionTest.java | 116 +- .../internal/client/AbstractClientBaseTest.java| 287 ++-- .../pubsub/SendOneMessagePubSubServer.java | 98 +- .../salesforce/internal/streaming/StubServer.java | 21 +- components/camel-salesforce/pom.xml|3 +- 34 files changed, 1792 insertions(+), 1814 deletions(-) delete mode 100644 components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/SalesforceHttpRequest.java
[camel] branch main updated: add salesforce section to 4.0 migration guide.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 52143bd62a1 add salesforce section to 4.0 migration guide. 52143bd62a1 is described below commit 52143bd62a1cad57d5dbdf8a98a1a543963bfcfb Author: Jeremy Ross AuthorDate: Fri Aug 4 13:18:18 2023 -0500 add salesforce section to 4.0 migration guide. --- docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc | 4 1 file changed, 4 insertions(+) diff --git a/docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc b/docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc index 90ac23f460c..12167803fb6 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-4-migration-guide.adoc @@ -435,6 +435,10 @@ Solver Daemon solutions should be migrated to use SolverManager. If the route or consumer is suspended then http status 503 is now returned instead of 404. +=== camel-salesforce + +Property names of blob fields on generated DTOs no longer have 'Url' affixed. E.g., the `ContentVersionUrl` property is now just `ContentVersion`. + === camel-slack The default delay (on slack consumer) is changed from 0.5s to 10s to avoid being rate limited to often by Slack.
[camel] branch main updated: CAMEL-19690: camel-salesforce: Fix DTO generation
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new e6f054cc09c CAMEL-19690: camel-salesforce: Fix DTO generation e6f054cc09c is described below commit e6f054cc09cc211beb90ba88ea2312744c7d45ad Author: Jeremy Ross AuthorDate: Fri Aug 4 12:53:52 2023 -0500 CAMEL-19690: camel-salesforce: Fix DTO generation Also removed duplicate resources under /camel-salesforce-maven-plugin in favor of /camel-salesforce-codegen --- .../src/main/resources/sobject-pojo-optional.vm| 4 - .../src/main/resources/sobject-pojo.vm | 4 - .../resources/sobject-query-records-optional.vm| 12 +- .../src/main/resources/sobject-query-records.vm| 12 +- .../src/main/resources/sobject-picklist.vm | 67 --- .../src/main/resources/sobject-pojo-optional.vm| 92 - .../src/main/resources/sobject-pojo.vm | 223 - .../resources/sobject-query-records-optional.vm| 34 .../src/main/resources/sobject-query-records.vm| 34 9 files changed, 2 insertions(+), 480 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo-optional.vm b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo-optional.vm index ea2cb42154a..5d8bdd12ff3 100644 --- a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo-optional.vm +++ b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo-optional.vm @@ -54,11 +54,7 @@ public class ${desc.Name}Optional extends AbstractSObjectBase { #set ( $fieldName = $field.Name ) #set ( $isMultiSelectPicklist = $utility.isMultiSelectPicklist($field) ) // $fieldName -#if ( $utility.isBlobField($field) ) -#set ( $propertyName = $fieldName + "Url" ) -#else #set ( $propertyName = $fieldName ) -#end #else #end private Optional<$fieldType> $propertyName; diff --git a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo.vm b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo.vm index 09b7ae6aa59..68bffe6cbc8 100644 --- a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo.vm +++ b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo.vm @@ -77,11 +77,7 @@ public class $desc.Name extends AbstractDescribedSObjectBase { #if ( ($utility.notBaseField($field.Name)) && ($fieldType) ) #set ( $fieldName = $field.Name ) #set ( $isMultiSelectPicklist = $utility.isMultiSelectPicklist($field) ) -#if ( $utility.isBlobField($field) ) -#set ( $propertyName = $fieldName + "Url" ) -#else #set ( $propertyName = $fieldName ) -#end private $fieldType $propertyName; @JsonProperty("$fieldName") diff --git a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-query-records-optional.vm b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-query-records-optional.vm index ec400cffa15..db87240f695 100644 --- a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-query-records-optional.vm +++ b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-query-records-optional.vm @@ -30,15 +30,5 @@ import javax.annotation.processing.Generated; */ #set( $descName = "${desc.Name}Optional" ) @Generated("org.apache.camel.maven.CamelSalesforceMojo") -public class QueryRecords$descName extends AbstractQueryRecordsBase { - -private List<$descName> records; - -public List<$descName> getRecords() { -return records; -} - -public void setRecords(List<$descName> records) { -this.records = records; -} +public class QueryRecords$descName extends AbstractQueryRecordsBase<$descName> { } diff --git a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-query-records.vm b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-query-records.vm index aba70ce9b4b..5ae7d9a619b 100644 --- a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-query-records.vm +++ b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-query-records.vm @@ -30,15 +30,5 @@ import javax.annotation.processing.Generated; */ #set( $descName = $desc.Name ) @Generated("org.apache.camel.maven.CamelSalesforceMojo") -public class QueryRecords$descName extends AbstractQueryRecordsBase { - -private List<$descName> records; - -public List<$descName> getRecords() { -return records; -} - -public void set
[camel] branch main updated: CAMEL-19161: camel-salesforce: Lazy login not allowed with consumers.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 595ce85f9d5 CAMEL-19161: camel-salesforce: Lazy login not allowed with consumers. 595ce85f9d5 is described below commit 595ce85f9d5c74d6413fd7a8233b18cf21781aeb Author: Jeremy Ross AuthorDate: Sat Jul 29 11:42:27 2023 -0500 CAMEL-19161: camel-salesforce: Lazy login not allowed with consumers. --- .../org/apache/camel/component/salesforce/PubSubApiConsumer.java| 6 ++ .../org/apache/camel/component/salesforce/SalesforceComponent.java | 2 +- .../component/salesforce/internal/streaming/SubscriptionHelper.java | 4 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/PubSubApiConsumer.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/PubSubApiConsumer.java index 2b7589bbf7d..043638a0143 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/PubSubApiConsumer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/PubSubApiConsumer.java @@ -24,6 +24,7 @@ import org.apache.camel.AsyncCallback; import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.Processor; +import org.apache.camel.component.salesforce.api.SalesforceException; import org.apache.camel.component.salesforce.internal.client.PubSubApiClient; import org.apache.camel.support.DefaultConsumer; import org.apache.camel.support.service.ServiceHelper; @@ -75,6 +76,11 @@ public class PubSubApiConsumer extends DefaultConsumer { @Override protected void doStart() throws Exception { super.doStart(); + +if (endpoint.getComponent().getLoginConfig().isLazyLogin()) { +throw new SalesforceException("Lazy login is not supported by salesforce consumers.", null); +} + this.eventClassMap = endpoint.getComponent().getEventClassMap(); this.pubSubClient = new PubSubApiClient( endpoint.getComponent().getSession(), endpoint.getComponent().getLoginConfig(), diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java index fd1745fdce8..8eb6309154c 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java @@ -161,7 +161,7 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP @Metadata(description = "If set to true prevents the component from authenticating to Salesforce with the start of" + " the component. You would generally set this to the (default) false and authenticate early and be immediately" -+ " aware of any authentication issues.", ++ " aware of any authentication issues. Lazy login is not supported by salesforce consumers.", defaultValue = "false", label = "common,security") private boolean lazyLogin; diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java index 0addba56da8..b4d1100ac95 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java @@ -103,6 +103,10 @@ public class SubscriptionHelper extends ServiceSupport { protected void doStart() throws Exception { session = component.getSession(); +if (component.getLoginConfig().isLazyLogin()) { +throw new CamelException("Lazy login is not supported by salesforce consumers."); +} + // create CometD client client = createClient(component, session);
[camel] branch main updated: camel-salesforce: doc fix.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 121ad577c0f camel-salesforce: doc fix. 121ad577c0f is described below commit 121ad577c0fa27a1c5bb1832bec26f321444a107 Author: Jeremy Ross AuthorDate: Mon Jun 26 10:59:33 2023 -0500 camel-salesforce: doc fix. --- .../camel-salesforce-component/src/main/docs/salesforce-component.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index faef11019b8..3fb381fb74e 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -203,7 +203,7 @@ The following operations are supported: * <> - Gets an SObject. * <> - Gets an SObject using an External Id (user defined) field. * <> - Retrieves the specified blob field from an individual record. -* <> - Creates an SObject. +* <> - Creates an SObject. * <> - Updates an SObject. * <> - Deletes an SObject. * <> - Inserts or updates an SObject using an External Id.
[camel] 01/02: CAMEL-19249: camel-salesforce: Fix blob creation
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.18.x in repository https://gitbox.apache.org/repos/asf/camel.git commit fb396b1238e0321f8c72c07fca62de91b88946c5 Author: Jeremy Ross AuthorDate: Tue Apr 4 09:15:57 2023 -0500 CAMEL-19249: camel-salesforce: Fix blob creation This restores the ability to create records that have blob data, such as Documents and Files/ContentVersion --- .../salesforce/RestApiIntegrationTest.java | 17 + .../salesforce/dto/generated/ContentVersion.java | 689 + .../src/test/resources/camel-test-doc.pdf | Bin 0 -> 9660 bytes 3 files changed, 706 insertions(+) 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 6ea82df1142..69096b0de0e 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 @@ -29,6 +29,7 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.CamelExecutionException; import org.apache.camel.Exchange; import org.apache.camel.Processor; @@ -47,6 +48,7 @@ import org.apache.camel.component.salesforce.api.dto.Version; import org.apache.camel.component.salesforce.api.dto.Versions; import org.apache.camel.component.salesforce.dto.generated.Account; import org.apache.camel.component.salesforce.dto.generated.Contact; +import org.apache.camel.component.salesforce.dto.generated.ContentVersion; 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; @@ -452,6 +454,21 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { } } +@Test +public void testUploadBlob() throws Exception { +final InputStream inputStream = this.getClass().getResourceAsStream("/camel-test-doc.pdf"); +final byte[] bytes = inputStream.readAllBytes(); +ObjectMapper mapper = new ObjectMapper(); +String enc = mapper.convertValue(bytes, String.class); +ContentVersion cv = new ContentVersion(); +cv.setVersionDataUrl(enc); +cv.setPathOnClient("camel-test-doc.pdf"); +cv.setTitle("Camel Test Doc"); +final CreateSObjectResult result = +template.requestBody("salesforce:createSObject", cv, CreateSObjectResult.class); +assertNotNull(result.getId()); +} + @Test public void testGetDescription() throws Exception { final SObjectDescription sObjectDescription diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java new file mode 100644 index 000..c3e622010e5 --- /dev/null +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java @@ -0,0 +1,689 @@ +/* + * 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. + */ +/* + * Salesforce DTO generated by camel-salesforce-maven-plugin. + */ +package org.apache.camel.component.salesforce.dto.generated; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Generated; + +import org.apache.camel.component.salesforce.api.dto.AbstractDescribedSObjectBase; +import org.apache.camel.component.salesforce.api.dto.Attributes; +import org.apach
[camel] 02/02: CAMEL-19249: camel-salesforce: Blob fix (cont.)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.18.x in repository https://gitbox.apache.org/repos/asf/camel.git commit 3a929f85364b0c9413122f1d51eacc1f7f69b126 Author: Jeremy Ross AuthorDate: Tue Apr 4 10:00:22 2023 -0500 CAMEL-19249: camel-salesforce: Blob fix (cont.) --- .../salesforce/api/FieldsToNullPropertyFilter.java | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java index 0f32666fc25..cd38ea8c0a0 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java @@ -31,8 +31,18 @@ public class FieldsToNullPropertyFilter extends SimpleBeanPropertyFilter { AbstractSObjectBase sob = (AbstractSObjectBase) pojo; String fieldName = writer.getName(); -Object fieldValue = FieldUtils.readField(pojo, fieldName, true); -if (sob.getFieldsToNull().contains(writer.getName()) || fieldValue != null) { +Object fieldValue = null; +boolean failedToReadFieldValue = false; +try { +fieldValue = FieldUtils.readField(pojo, fieldName, true); +} +catch (IllegalArgumentException e) { +// This happens if the backing field for the getter doesn't match the name provided to @JsonProperty +// This is expected to happen in the case of blob fields, e.g., ContentVersion.getVersionDataUrl(), +// whose backing property is specified as @JsonData("VersionData") +failedToReadFieldValue = true; +} +if (sob.getFieldsToNull().contains(writer.getName()) || fieldValue != null || failedToReadFieldValue) { writer.serializeAsField(pojo, jgen, provider); } else { writer.serializeAsOmittedField(pojo, jgen, provider);
[camel] branch camel-3.18.x updated (1156a803c8d -> 3a929f85364)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch camel-3.18.x in repository https://gitbox.apache.org/repos/asf/camel.git from 1156a803c8d Merge branch 'release/3.18.6' into camel-3.18.x new fb396b1238e CAMEL-19249: camel-salesforce: Fix blob creation new 3a929f85364 CAMEL-19249: camel-salesforce: Blob fix (cont.) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../salesforce/api/FieldsToNullPropertyFilter.java | 14 +- .../salesforce/RestApiIntegrationTest.java | 17 + .../salesforce/dto/generated/ContentVersion.java | 689 + .../src/test/resources/camel-test-doc.pdf | Bin 0 -> 9660 bytes 4 files changed, 718 insertions(+), 2 deletions(-) create mode 100644 components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java create mode 100644 components/camel-salesforce/camel-salesforce-component/src/test/resources/camel-test-doc.pdf
[camel] 01/02: CAMEL-19249: camel-salesforce: Fix blob creation
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.20.x in repository https://gitbox.apache.org/repos/asf/camel.git commit f156cebb3cb8a29701ff97d1511319e5bc01161f Author: Jeremy Ross AuthorDate: Tue Apr 4 09:15:57 2023 -0500 CAMEL-19249: camel-salesforce: Fix blob creation This restores the ability to create records that have blob data, such as Documents and Files/ContentVersion --- .../salesforce/RestApiIntegrationTest.java | 17 + .../salesforce/dto/generated/ContentVersion.java | 689 + .../src/test/resources/camel-test-doc.pdf | Bin 0 -> 9660 bytes 3 files changed, 706 insertions(+) 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 0966e5ee092..9a5d1048c88 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 @@ -29,6 +29,7 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.CamelExecutionException; import org.apache.camel.Exchange; import org.apache.camel.Processor; @@ -47,6 +48,7 @@ import org.apache.camel.component.salesforce.api.dto.Version; import org.apache.camel.component.salesforce.api.dto.Versions; import org.apache.camel.component.salesforce.dto.generated.Account; import org.apache.camel.component.salesforce.dto.generated.Contact; +import org.apache.camel.component.salesforce.dto.generated.ContentVersion; 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; @@ -461,6 +463,21 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { } } +@Test +public void testUploadBlob() throws Exception { +final InputStream inputStream = this.getClass().getResourceAsStream("/camel-test-doc.pdf"); +final byte[] bytes = inputStream.readAllBytes(); +ObjectMapper mapper = new ObjectMapper(); +String enc = mapper.convertValue(bytes, String.class); +ContentVersion cv = new ContentVersion(); +cv.setVersionDataUrl(enc); +cv.setPathOnClient("camel-test-doc.pdf"); +cv.setTitle("Camel Test Doc"); +final CreateSObjectResult result = +template.requestBody("salesforce:createSObject", cv, CreateSObjectResult.class); +assertNotNull(result.getId()); +} + @Test public void testGetDescription() throws Exception { final SObjectDescription sObjectDescription diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java new file mode 100644 index 000..c3e622010e5 --- /dev/null +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java @@ -0,0 +1,689 @@ +/* + * 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. + */ +/* + * Salesforce DTO generated by camel-salesforce-maven-plugin. + */ +package org.apache.camel.component.salesforce.dto.generated; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Generated; + +import org.apache.camel.component.salesforce.api.dto.AbstractDescribedSObjectBase; +import org.apache.camel.component.salesforce.api.dto.Attributes; +import org.apach
[camel] 02/02: CAMEL-19249: camel-salesforce: Blob fix (cont.)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.20.x in repository https://gitbox.apache.org/repos/asf/camel.git commit e9eb1cfd29252a0ebb20a19205288897bf5f54ea Author: Jeremy Ross AuthorDate: Tue Apr 4 10:00:22 2023 -0500 CAMEL-19249: camel-salesforce: Blob fix (cont.) --- .../salesforce/api/FieldsToNullPropertyFilter.java | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java index 0f32666fc25..cd38ea8c0a0 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java @@ -31,8 +31,18 @@ public class FieldsToNullPropertyFilter extends SimpleBeanPropertyFilter { AbstractSObjectBase sob = (AbstractSObjectBase) pojo; String fieldName = writer.getName(); -Object fieldValue = FieldUtils.readField(pojo, fieldName, true); -if (sob.getFieldsToNull().contains(writer.getName()) || fieldValue != null) { +Object fieldValue = null; +boolean failedToReadFieldValue = false; +try { +fieldValue = FieldUtils.readField(pojo, fieldName, true); +} +catch (IllegalArgumentException e) { +// This happens if the backing field for the getter doesn't match the name provided to @JsonProperty +// This is expected to happen in the case of blob fields, e.g., ContentVersion.getVersionDataUrl(), +// whose backing property is specified as @JsonData("VersionData") +failedToReadFieldValue = true; +} +if (sob.getFieldsToNull().contains(writer.getName()) || fieldValue != null || failedToReadFieldValue) { writer.serializeAsField(pojo, jgen, provider); } else { writer.serializeAsOmittedField(pojo, jgen, provider);
[camel] branch camel-3.20.x updated (41958dbcacf -> e9eb1cfd292)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch camel-3.20.x in repository https://gitbox.apache.org/repos/asf/camel.git from 41958dbcacf CAMEL-19224: Fix blob consumer prefix usage (#9773) new f156cebb3cb CAMEL-19249: camel-salesforce: Fix blob creation new e9eb1cfd292 CAMEL-19249: camel-salesforce: Blob fix (cont.) The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../salesforce/api/FieldsToNullPropertyFilter.java | 14 +- .../salesforce/RestApiIntegrationTest.java | 17 + .../salesforce/dto/generated/ContentVersion.java | 689 + .../src/test/resources/camel-test-doc.pdf | Bin 0 -> 9660 bytes 4 files changed, 718 insertions(+), 2 deletions(-) create mode 100644 components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java create mode 100644 components/camel-salesforce/camel-salesforce-component/src/test/resources/camel-test-doc.pdf
[camel] branch main updated: CAMEL-19249: camel-salesforce: Blob fix (cont.)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 3d5ae361bb7 CAMEL-19249: camel-salesforce: Blob fix (cont.) 3d5ae361bb7 is described below commit 3d5ae361bb7d286c40a1ecdfda2a27928b81d41a Author: Jeremy Ross AuthorDate: Tue Apr 4 10:00:22 2023 -0500 CAMEL-19249: camel-salesforce: Blob fix (cont.) --- .../salesforce/api/FieldsToNullPropertyFilter.java | 14 -- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java index 0f32666fc25..cd38ea8c0a0 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/FieldsToNullPropertyFilter.java @@ -31,8 +31,18 @@ public class FieldsToNullPropertyFilter extends SimpleBeanPropertyFilter { AbstractSObjectBase sob = (AbstractSObjectBase) pojo; String fieldName = writer.getName(); -Object fieldValue = FieldUtils.readField(pojo, fieldName, true); -if (sob.getFieldsToNull().contains(writer.getName()) || fieldValue != null) { +Object fieldValue = null; +boolean failedToReadFieldValue = false; +try { +fieldValue = FieldUtils.readField(pojo, fieldName, true); +} +catch (IllegalArgumentException e) { +// This happens if the backing field for the getter doesn't match the name provided to @JsonProperty +// This is expected to happen in the case of blob fields, e.g., ContentVersion.getVersionDataUrl(), +// whose backing property is specified as @JsonData("VersionData") +failedToReadFieldValue = true; +} +if (sob.getFieldsToNull().contains(writer.getName()) || fieldValue != null || failedToReadFieldValue) { writer.serializeAsField(pojo, jgen, provider); } else { writer.serializeAsOmittedField(pojo, jgen, provider);
[camel] branch main updated: camel-salesforce: fixes to test-related metadata
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 032f04164d9 camel-salesforce: fixes to test-related metadata 032f04164d9 is described below commit 032f04164d989075705b6023f3ed0a9f743f4169 Author: Jeremy Ross AuthorDate: Tue Apr 4 10:00:22 2023 -0500 camel-salesforce: fixes to test-related metadata and DTOs --- .../camel/component/salesforce/dto/generated/ContentVersion.java | 3 --- .../ChangeEvents_AccountChangeEvent.platformEventChannelMember | 1 - 2 files changed, 4 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java index c3e622010e5..2bf09dfbab7 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java @@ -679,9 +679,6 @@ public class ContentVersion extends AbstractDescribedSObjectBase { sObjectDescriptionUrls1.setLayouts("/services/data/v46.0/sobjects/ContentVersion/describe/layouts"); sObjectDescriptionUrls1.setRowTemplate("/services/data/v46.0/sobjects/ContentVersion/{ID}"); sObjectDescriptionUrls1.setSobject("/services/data/v46.0/sobjects/ContentVersion"); - sObjectDescriptionUrls1.setUiDetailTemplate("https://emuedu.my.salesforce.com/{ID}";); - sObjectDescriptionUrls1.setUiEditTemplate("https://emuedu.my.salesforce.com/{ID}/e";); - sObjectDescriptionUrls1.setUiNewRecord("https://emuedu.my.salesforce.com/068/e";); description.setUrls(sObjectDescriptionUrls1); return description; diff --git a/components/camel-salesforce/it/resources/salesforce/platformEventChannelMembers/ChangeEvents_AccountChangeEvent.platformEventChannelMember b/components/camel-salesforce/it/resources/salesforce/platformEventChannelMembers/ChangeEvents_AccountChangeEvent.platformEventChannelMember index 07922ccb00c..fbf27136af1 100644 --- a/components/camel-salesforce/it/resources/salesforce/platformEventChannelMembers/ChangeEvents_AccountChangeEvent.platformEventChannelMember +++ b/components/camel-salesforce/it/resources/salesforce/platformEventChannelMembers/ChangeEvents_AccountChangeEvent.platformEventChannelMember @@ -15,7 +15,6 @@ See the License for the specific language governing permissions and limitations under the License. --> - http://soap.sforce.com/2006/04/metadata";> ChangeEvents AccountChangeEvent
[camel] branch main updated: CAMEL-19249: camel-salesforce: Fix blob creation
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 5f6960266cd CAMEL-19249: camel-salesforce: Fix blob creation 5f6960266cd is described below commit 5f6960266cd88beda0b0e3e970575c0388ea5b35 Author: Jeremy Ross AuthorDate: Tue Apr 4 09:15:57 2023 -0500 CAMEL-19249: camel-salesforce: Fix blob creation This restores the ability to create records that have blob data, such as Documents and Files/ContentVersion --- .../salesforce/RestApiIntegrationTest.java | 17 + .../salesforce/dto/generated/ContentVersion.java | 689 + .../src/test/resources/camel-test-doc.pdf | Bin 0 -> 9660 bytes 3 files changed, 706 insertions(+) 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 cc5ec0f4bf4..9847667bae8 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 @@ -29,6 +29,7 @@ import java.util.UUID; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.CamelExecutionException; import org.apache.camel.Exchange; import org.apache.camel.Processor; @@ -47,6 +48,7 @@ import org.apache.camel.component.salesforce.api.dto.Version; import org.apache.camel.component.salesforce.api.dto.Versions; import org.apache.camel.component.salesforce.dto.generated.Account; import org.apache.camel.component.salesforce.dto.generated.Contact; +import org.apache.camel.component.salesforce.dto.generated.ContentVersion; 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; @@ -464,6 +466,21 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { } } +@Test +public void testUploadBlob() throws Exception { +final InputStream inputStream = this.getClass().getResourceAsStream("/camel-test-doc.pdf"); +final byte[] bytes = inputStream.readAllBytes(); +ObjectMapper mapper = new ObjectMapper(); +String enc = mapper.convertValue(bytes, String.class); +ContentVersion cv = new ContentVersion(); +cv.setVersionDataUrl(enc); +cv.setPathOnClient("camel-test-doc.pdf"); +cv.setTitle("Camel Test Doc"); +final CreateSObjectResult result = +template.requestBody("salesforce:createSObject", cv, CreateSObjectResult.class); +assertNotNull(result.getId()); +} + @Test public void testGetDescription() throws Exception { final SObjectDescription sObjectDescription diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java new file mode 100644 index 000..c3e622010e5 --- /dev/null +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/dto/generated/ContentVersion.java @@ -0,0 +1,689 @@ +/* + * 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. + */ +/* + * Salesforce DTO generated by camel-salesforce-maven-plugin. + */ +package org.apache.camel.component.salesforce.dto.generated; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Generated; + +import org.apache.
[camel] branch main updated: CAMEL-18959: camel-salesforce: Report deserialize exception.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new e79d5c4613e CAMEL-18959: camel-salesforce: Report deserialize exception. e79d5c4613e is described below commit e79d5c4613e2c37350fa6df2b0c710235559341c Author: Jeremy Ross AuthorDate: Sat Jan 21 10:34:04 2023 -0600 CAMEL-18959: camel-salesforce: Report deserialize exception. --- .../component/salesforce/internal/processor/JsonRestProcessor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java index b3e4d02c1bc..5885b8b58bf 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java @@ -289,7 +289,7 @@ public class JsonRestProcessor extends AbstractRestProcessor { objectMapper, responseClass, restClient, determineHeaders(exchange), response); out.setBody(iterator); } -} catch (IOException e) { +} catch (Exception e) { String msg = "Error parsing JSON response: " + e.getMessage(); exchange.setException(new SalesforceException(msg, e)); } finally {
[camel-spring-boot] branch main updated: CAMEL-18934: Update to Jetty 11.
This is an automated email from the ASF dual-hosted git repository. jeremyross 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 6ceaf1b8822 CAMEL-18934: Update to Jetty 11. 6ceaf1b8822 is described below commit 6ceaf1b88227888da95acba867a0746f9e45d4c2 Author: Jeremy Ross AuthorDate: Tue Jan 17 11:03:47 2023 -0600 CAMEL-18934: Update to Jetty 11. --- components-starter/camel-salesforce-starter/pom.xml | 8 .../src/main/resources/spring-boot-fix-dependencies.properties| 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/components-starter/camel-salesforce-starter/pom.xml b/components-starter/camel-salesforce-starter/pom.xml index f76d8687d7f..2da56d00571 100644 --- a/components-starter/camel-salesforce-starter/pom.xml +++ b/components-starter/camel-salesforce-starter/pom.xml @@ -53,22 +53,22 @@ org.eclipse.jetty jetty-client - ${jetty9-version} + ${jetty-version} org.eclipse.jetty jetty-io - ${jetty9-version} + ${jetty-version} org.eclipse.jetty jetty-util-ajax - ${jetty9-version} + ${jetty-version} org.eclipse.jetty jetty-util - ${jetty9-version} + ${jetty-version} diff --git a/tooling/camel-spring-boot-generator-maven-plugin/src/main/resources/spring-boot-fix-dependencies.properties b/tooling/camel-spring-boot-generator-maven-plugin/src/main/resources/spring-boot-fix-dependencies.properties index d0b302b2d98..71337c5dda7 100644 --- a/tooling/camel-spring-boot-generator-maven-plugin/src/main/resources/spring-boot-fix-dependencies.properties +++ b/tooling/camel-spring-boot-generator-maven-plugin/src/main/resources/spring-boot-fix-dependencies.properties @@ -45,7 +45,7 @@ camel-spring-boot-xml=org.apache.camel.springboot:camel-core-starter camel-spring-ws=org.springframework.boot:spring-boot-starter-web:${spring-boot-version} # Force the spring-boot version of jetty -camel-salesforce=org.eclipse.jetty:jetty-client:${jetty9-version},org.eclipse.jetty:jetty-util:${jetty9-version},org.eclipse.jetty:jetty-util-ajax:${jetty9-version},org.eclipse.jetty:jetty-io:${jetty9-version} +camel-salesforce=org.eclipse.jetty:jetty-client:${jetty-version},org.eclipse.jetty:jetty-util:${jetty-version},org.eclipse.jetty:jetty-util-ajax:${jetty-version},org.eclipse.jetty:jetty-io:${jetty-version} # Existed for Netty 3 exclude_camel-hbase=io.netty:netty
[camel] branch main updated: camel-salesforce: Jetty 11 migration
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new e9f7afe27bd camel-salesforce: Jetty 11 migration e9f7afe27bd is described below commit e9f7afe27bd7e4c56a5b7bdfbd2fe06e55a81056 Author: Jeremy Ross AuthorDate: Mon Jan 16 11:11:58 2023 -0600 camel-salesforce: Jetty 11 migration Ignore TunnelRequest requests Prevent duplicate HTTP auth headers --- .../component/salesforce/internal/client/DefaultBulkApiClient.java | 3 ++- .../component/salesforce/internal/client/DefaultBulkApiV2Client.java | 1 + .../salesforce/internal/client/DefaultCompositeApiClient.java| 1 + .../internal/client/DefaultCompositeSObjectCollectionsApiClient.java | 1 + .../camel/component/salesforce/internal/client/DefaultRawClient.java | 2 ++ .../component/salesforce/internal/client/DefaultRestClient.java | 1 + .../salesforce/internal/client/SalesforceSecurityHandler.java| 5 + 7 files changed, 13 insertions(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultBulkApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultBulkApiClient.java index 1567172b22f..1d776bb4cdd 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultBulkApiClient.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultBulkApiClient.java @@ -366,7 +366,8 @@ public class DefaultBulkApiClient extends AbstractClientBase implements BulkApiC @Override protected void setAccessToken(Request request) { -// replace old token +// Replace token +request.header(TOKEN_HEADER, null); request.header(TOKEN_HEADER, accessToken); } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultBulkApiV2Client.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultBulkApiV2Client.java index 8b4ff1554c3..7cfd3bf23d5 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultBulkApiV2Client.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultBulkApiV2Client.java @@ -312,6 +312,7 @@ public class DefaultBulkApiV2Client extends AbstractClientBase implements BulkAp @Override protected void setAccessToken(Request request) { +request.header(AUTHORIZATION_HEADER, null); request.header(AUTHORIZATION_HEADER, BEARER_PREFIX + accessToken); } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeApiClient.java index 79567c25471..596ebc795dc 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeApiClient.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeApiClient.java @@ -228,6 +228,7 @@ public class DefaultCompositeApiClient extends AbstractClientBase implements Com @Override protected void setAccessToken(final Request request) { +request.header("Authorization", null); request.header("Authorization", "Bearer " + accessToken); } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java index ff9d6956d1a..f3b72a4c3a4 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java @@ -182,6 +182,7 @@ public class DefaultCompositeSObjectCollectionsApiC
[camel-website] branch main updated: Fix user stories formatting.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-website.git The following commit(s) were added to refs/heads/main by this push: new 6ef3b3aa Fix user stories formatting. 6ef3b3aa is described below commit 6ef3b3aaeb7ebe8400559255239186b749dc1938 Author: Jeremy Ross AuthorDate: Sat Jan 7 16:34:33 2023 -0600 Fix user stories formatting. --- content/community/user-stories.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/content/community/user-stories.md b/content/community/user-stories.md index d5d65713..ebe55ad0 100644 --- a/content/community/user-stories.md +++ b/content/community/user-stories.md @@ -111,7 +111,5 @@ This page is intended as a place to collect user stories and feedback on Apache |[camel-spring-cloud-stream](https://github.com/donovanmuller/)|A component to integrate with Spring Cloud Stream| |[camel-rocketmq](https://github.com/TeslaCN/camel-rocketmq)|A component to integrate with Apache RocketMQ| |[camel-openhtmltopdf](https://github.com/elevation-solutions/camel-openhtmltopdf)|A Camel component to generate nice looking PDF files from HTML, CSS, images, etc.| -|[camel-xtrasonnet](https://jam01.github.io/xtrasonnet/camel/)|xtrasonnet is an extensible, jsonnet-based, data transformation engine -for Java or any JVM-based language. The Camel xtrasonnet component enables the use of xtrasonnet transformations as -Expressions or Predicates in the DSL.| +|[camel-xtrasonnet](https://jam01.github.io/xtrasonnet/camel/)|xtrasonnet is an extensible, jsonnet-based, data transformation engine for Java or any JVM-based language. The Camel xtrasonnet component enables the use of xtrasonnet transformations as Expressions or Predicates in the DSL.| {{< /table >}}
[camel-website] branch main updated: Add camel-xtrasonnet to user stories. (#961)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel-website.git The following commit(s) were added to refs/heads/main by this push: new 78de6b29 Add camel-xtrasonnet to user stories. (#961) 78de6b29 is described below commit 78de6b2904ea2db916bbac233a016565590dd1ae Author: Jeremy Ross AuthorDate: Sat Jan 7 13:48:05 2023 -0600 Add camel-xtrasonnet to user stories. (#961) --- content/community/user-stories.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/community/user-stories.md b/content/community/user-stories.md index 22eba931..d5d65713 100644 --- a/content/community/user-stories.md +++ b/content/community/user-stories.md @@ -111,4 +111,7 @@ This page is intended as a place to collect user stories and feedback on Apache |[camel-spring-cloud-stream](https://github.com/donovanmuller/)|A component to integrate with Spring Cloud Stream| |[camel-rocketmq](https://github.com/TeslaCN/camel-rocketmq)|A component to integrate with Apache RocketMQ| |[camel-openhtmltopdf](https://github.com/elevation-solutions/camel-openhtmltopdf)|A Camel component to generate nice looking PDF files from HTML, CSS, images, etc.| +|[camel-xtrasonnet](https://jam01.github.io/xtrasonnet/camel/)|xtrasonnet is an extensible, jsonnet-based, data transformation engine +for Java or any JVM-based language. The Camel xtrasonnet component enables the use of xtrasonnet transformations as +Expressions or Predicates in the DSL.| {{< /table >}}
[camel] branch main updated: camel-salesforce: Bump default salesforce version to 56.0.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 6091965de71 camel-salesforce: Bump default salesforce version to 56.0. 6091965de71 is described below commit 6091965de71673fbbd83dfec3db22502cd5fa56e Author: Jeremy Ross AuthorDate: Tue Jan 3 14:51:40 2023 -0600 camel-salesforce: Bump default salesforce version to 56.0. --- .../resources/org/apache/camel/component/salesforce/salesforce.json | 4 ++-- .../apache/camel/component/salesforce/SalesforceEndpointConfig.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json index 23f3cd06a2b..0953488a77d 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json @@ -25,7 +25,7 @@ "componentProperties": { "apexMethod": { "kind": "property", "displayName": "Apex Method", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "APEX method name" }, "apexQueryParams": { "kind": "property", "displayName": "Apex Query Params", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Query params for APEX method" }, -"apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "54.0", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Salesforce API version." }, +"apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "56.0", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Salesforce API version." }, "backoffIncrement": { "kind": "property", "displayName": "Backoff Increment", "group": "common", "label": "", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1000", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto- [...] "batchId": { "kind": "property", "displayName": "Batch Id", "group": "common", "label": "", "required": false, "ty
[camel] branch main updated: CAMEL-18687: camel-salesforce: Support Client Credentials
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new d3889fc6854 CAMEL-18687: camel-salesforce: Support Client Credentials d3889fc6854 is described below commit d3889fc685498bdf83bbd942fe1fe3cc253e5594 Author: Jeremy Ross AuthorDate: Tue Jan 3 14:20:01 2023 -0600 CAMEL-18687: camel-salesforce: Support Client Credentials Salesforce supports Client Credentials OAuth flow as of Winter '23 --- .../component/salesforce/AuthenticationType.java | 3 +- .../salesforce/SalesforceLoginConfig.java | 8 .../salesforce/internal/SalesforceSession.java | 4 ++ ...sforceClientCredentialsFlowIntegrationTest.java | 51 ++ .../salesforce/SalesforceLoginConfigTest.java | 11 + 5 files changed, 76 insertions(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/AuthenticationType.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/AuthenticationType.java index 8aefd1f0b97..d0b3ee685e6 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/AuthenticationType.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/AuthenticationType.java @@ -19,5 +19,6 @@ package org.apache.camel.component.salesforce; public enum AuthenticationType { USERNAME_PASSWORD, REFRESH_TOKEN, -JWT +JWT, +CLIENT_CREDENTIALS } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java index b969aaa6d7e..cc036e43b1f 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java @@ -164,6 +164,7 @@ public class SalesforceLoginConfig { final boolean hasPassword = ObjectHelper.isNotEmpty(password); final boolean hasRefreshToken = ObjectHelper.isNotEmpty(refreshToken); final boolean hasKeystore = keystore != null && ObjectHelper.isNotEmpty(keystore.getResource()); +final boolean hasClientCredentials = ObjectHelper.isNotEmpty(clientId) && ObjectHelper.isNotEmpty(clientSecret); if (hasPassword && !hasRefreshToken && !hasKeystore) { return AuthenticationType.USERNAME_PASSWORD; @@ -177,6 +178,10 @@ public class SalesforceLoginConfig { return AuthenticationType.JWT; } +if (!hasPassword && !hasRefreshToken && !hasKeystore && hasClientCredentials) { +return AuthenticationType.CLIENT_CREDENTIALS; +} + if (hasPassword && hasRefreshToken || hasPassword && hasKeystore || hasRefreshToken && hasKeystore) { throw new IllegalArgumentException( "The provided authentication configuration can be used in multiple ways" @@ -253,6 +258,9 @@ public class SalesforceLoginConfig { ObjectHelper.notNull(userName, "userName (JWT authentication)"); ObjectHelper.notNull(keystore, "keystore (JWT authentication)"); break; +case CLIENT_CREDENTIALS: +ObjectHelper.notNull(clientSecret, "clientSecret (Client Credentials authentication)"); +break; default: throw new IllegalArgumentException("Unknown authentication type: " + type); } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java index 40728627a05..03e2b6e1dff 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java @@ -168,6 +168,10 @@ public class SalesforceSession extends ServiceSupport { fields.put("grant_type", "urn:ietf:params:oauth:grant-type:jwt-bearer"); fields.put("
[camel] branch main updated: Spring doc minor fix.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 796e58cd27a Spring doc minor fix. 796e58cd27a is described below commit 796e58cd27a07b91c5690cac977356788ba7a03a Author: Jeremy Ross AuthorDate: Sun Dec 25 13:30:11 2022 -0600 Spring doc minor fix. --- docs/user-manual/modules/ROOT/pages/spring.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/user-manual/modules/ROOT/pages/spring.adoc b/docs/user-manual/modules/ROOT/pages/spring.adoc index b4f3da46a9d..206ff0b05a1 100644 --- a/docs/user-manual/modules/ROOT/pages/spring.adoc +++ b/docs/user-manual/modules/ROOT/pages/spring.adoc @@ -11,7 +11,7 @@ Apache Camel is designed to work first class with Spring in a number of ways, su == Using Camel on Spring Boot -See the Camel Spring Boot documentation. +See the xref:camel-spring-boot::index.adoc[Camel Spring Boot] documentation. == Using Camel with Spring XML files @@ -23,7 +23,7 @@ To use Camel with Spring XML files see the xref:spring-xml-extensions.adoc[Sprin == Using Spring dependency injection -Spring dependency injection is integrated first-class when using Spring and Spring together. +Spring dependency injection is integrated first-class when using Camel and Spring together. For example when using Camel on Spring Boot, then you can use any kind of Spring dependency and be able to inject Camel resources such as 'CamelContext', xref:endpoint.adoc[Endpoint] and many more.
[camel] branch main updated: CAMEL-18665: Document default resource type change.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 5b73eba46d3 CAMEL-18665: Document default resource type change. 5b73eba46d3 is described below commit 5b73eba46d3e4017a9fc29271814ce18732c5a6c Author: Jeremy Ross AuthorDate: Thu Dec 22 16:56:24 2022 -0600 CAMEL-18665: Document default resource type change. --- docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc index 649a717ea86..f0b3b649ac7 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_20.adoc @@ -10,7 +10,9 @@ from both 3.0 to 3.1 and 3.1 to 3.2. The `org.apache.camel.support.jsse.SSLContextParameters` is now using `ResourceLoader` from `CamelContext` to load keystore and other resources in a standard way. Therefore, the `SSLContextParameters` now must have been pre-configured -with a `CamelContext` otherwise an exception is thrown. +with a `CamelContext` otherwise an exception is thrown. This also changes the default resource type from file to classpath. +If using a file resource for a keystore and the keystore is not found, or entries/aliases aren't found, try explicitly +specifying the file resource type, .e.g `file:myKeystore.jks`. The model class `org.apache.camel.model.errorhandler.ErrorHandlerRefDefinition` has been renamed to `org.apache.camel.model.errorhandler.RefErrorHandlerDefinition`.
[camel] branch main updated: camel-salesforce: Doc fix.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new d7d527f49c5 camel-salesforce: Doc fix. d7d527f49c5 is described below commit d7d527f49c5afc7e1336f76e543c130da485c9e8 Author: Jeremy Ross AuthorDate: Mon Dec 19 16:21:29 2022 -0600 camel-salesforce: Doc fix. --- .../src/main/docs/salesforce-component.adoc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index 6e57d7878e5..b6576d87d3a 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -1262,8 +1262,9 @@ Get bulk query job results. `jobId` parameter is required. Accepts | Parameter | Type | Description| Default| Required | `jobId` | `String` | Id of Job to get results for | | x -| `maxRecords` | `Integer` | Id of Job to get results for | | -| `locator` | `locator` | Value to use for subsequent calls | | +| `maxRecords` | `Integer` | The maximum number of records to retrieve per set of results for the query. The request is still subject to the size limits. If you are working with a very large number of query results, you may experience a timeout before receiving all the data from Salesforce. To prevent a timeout, specify the maximum number of records your client is expecting to receive in the maxRecords parameter. This splits the results into smaller sets with this value as the maximum size. | | +| `locator` | `locator` | A string that identifies a specific set of query results. Providing a value for this parameter returns only that set of results. +Omitting this parameter returns the first set of results. | | |=== *Output*
[camel] branch main updated: camel-salesforce: Fix param name/usage
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new de618ec7f31 camel-salesforce: Fix param name/usage de618ec7f31 is described below commit de618ec7f3103f8a4d2e1d877a356cdeb971907f Author: Jeremy Ross AuthorDate: Tue Nov 29 11:08:01 2022 -0600 camel-salesforce: Fix param name/usage for the retrieve sobject collections operation --- .../src/main/docs/salesforce-component.adoc | 4 ++-- .../internal/processor/CompositeSObjectCollectionsProcessor.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index 7b7e6961839..6e57d7878e5 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -912,8 +912,8 @@ Retrieve one or more records of the same object type. |=== | Parameter | Type | Description | Default | Required -| ids | List of String or comma-separated string | A list of one or more IDs of the objects to return. All IDs must belong to the same object type. | | x -| fields | List of String or comma-separated string | A list of fields to include in the response. The field names you specify must be valid, and you must have read-level permissions to each field. | | x +| sObjectIds | List of String or comma-separated string | A list of one or more IDs of the objects to return. All IDs must belong to the same object type. | | x +| sObjectFields | List of String or comma-separated string | A list of fields to include in the response. The field names you specify must be valid, and you must have read-level permissions to each field. | | x | sObjectName | String | Type of SObject, e.g. `Account` | | x | sObjectClass | String | Fully-qualified class name of DTO class to use for deserializing the response. | | Required if `sObjectName` parameter does not resolve to a class that exists in the package specified by the `package` option. |=== diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java index 979c2d4708b..4627a02d830 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java @@ -93,8 +93,8 @@ public class CompositeSObjectCollectionsProcessor extends AbstractSalesforceProc private boolean processRetrieveSObjectCollections(Exchange exchange, AsyncCallback callback) throws SalesforceException { -List ids = getListParameter(SalesforceEndpointConfig.SOBJECT_IDS, exchange, USE_BODY, NOT_OPTIONAL); -List fields = getListParameter(SalesforceEndpointConfig.SOBJECT_FIELDS, exchange, USE_BODY, NOT_OPTIONAL); +List ids = getListParameter(SalesforceEndpointConfig.SOBJECT_IDS, exchange, IGNORE_BODY, NOT_OPTIONAL); +List fields = getListParameter(SalesforceEndpointConfig.SOBJECT_FIELDS, exchange, IGNORE_BODY, NOT_OPTIONAL); String sObjectName = getParameter(SalesforceEndpointConfig.SOBJECT_NAME, exchange, IGNORE_BODY, IS_OPTIONAL); // gets class by sObjectName if not null, otherwise tries the SOBJECT_CLASS option
[camel] branch main updated: camel-http: Make proxyAuthScheme configurable at global level. (#8685)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 4bf4074d9e0 camel-http: Make proxyAuthScheme configurable at global level. (#8685) 4bf4074d9e0 is described below commit 4bf4074d9e0a091f9abd6ee08785258a8fef26d1 Author: Jeremy Ross AuthorDate: Mon Nov 7 16:56:03 2022 -0600 camel-http: Make proxyAuthScheme configurable at global level. (#8685) --- .../org/apache/camel/component/http/HttpComponentConfigurer.java| 6 ++ .../generated/resources/org/apache/camel/component/http/http.json | 1 + .../generated/resources/org/apache/camel/component/http/https.json | 1 + .../main/java/org/apache/camel/component/http/HttpComponent.java| 1 + 4 files changed, 9 insertions(+) diff --git a/components/camel-http/src/generated/java/org/apache/camel/component/http/HttpComponentConfigurer.java b/components/camel-http/src/generated/java/org/apache/camel/component/http/HttpComponentConfigurer.java index 57df16e623f..3caf3f0eed8 100644 --- a/components/camel-http/src/generated/java/org/apache/camel/component/http/HttpComponentConfigurer.java +++ b/components/camel-http/src/generated/java/org/apache/camel/component/http/HttpComponentConfigurer.java @@ -79,6 +79,8 @@ public class HttpComponentConfigurer extends PropertyConfigurerSupport implement case "proxyAuthPassword": target.setProxyAuthPassword(property(camelContext, java.lang.String.class, value)); return true; case "proxyauthport": case "proxyAuthPort": target.setProxyAuthPort(property(camelContext, java.lang.Integer.class, value)); return true; +case "proxyauthscheme": +case "proxyAuthScheme": target.setProxyAuthScheme(property(camelContext, java.lang.String.class, value)); return true; case "proxyauthusername": case "proxyAuthUsername": target.setProxyAuthUsername(property(camelContext, java.lang.String.class, value)); return true; case "redirecthandlingdisabled": @@ -162,6 +164,8 @@ public class HttpComponentConfigurer extends PropertyConfigurerSupport implement case "proxyAuthPassword": return java.lang.String.class; case "proxyauthport": case "proxyAuthPort": return java.lang.Integer.class; +case "proxyauthscheme": +case "proxyAuthScheme": return java.lang.String.class; case "proxyauthusername": case "proxyAuthUsername": return java.lang.String.class; case "redirecthandlingdisabled": @@ -246,6 +250,8 @@ public class HttpComponentConfigurer extends PropertyConfigurerSupport implement case "proxyAuthPassword": return target.getProxyAuthPassword(); case "proxyauthport": case "proxyAuthPort": return target.getProxyAuthPort(); +case "proxyauthscheme": +case "proxyAuthScheme": return target.getProxyAuthScheme(); case "proxyauthusername": case "proxyAuthUsername": return target.getProxyAuthUsername(); case "redirecthandlingdisabled": diff --git a/components/camel-http/src/generated/resources/org/apache/camel/component/http/http.json b/components/camel-http/src/generated/resources/org/apache/camel/component/http/http.json index d87bcaa6f42..89519a465c0 100644 --- a/components/camel-http/src/generated/resources/org/apache/camel/component/http/http.json +++ b/components/camel-http/src/generated/resources/org/apache/camel/component/http/http.json @@ -56,6 +56,7 @@ "proxyAuthNtHost": { "kind": "property", "displayName": "Proxy Auth Nt Host", "group": "proxy", "label": "producer,proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "description": "Proxy authentication domain (workstation name) to use with NTML" }, "proxyAuthPassword": { "kind": "property", "displayName": "Proxy Auth Password", "group": "proxy", "label": "producer,proxy", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": true, "description": "Proxy authentication password" }, "proxyAuthPort": { "kind": "property", "displayName": "Proxy Auth Po
[camel-website] branch 319 updated (0037bf9c -> ffa1c812)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch 319 in repository https://gitbox.apache.org/repos/asf/camel-website.git from 0037bf9c Apply suggestions from code review add ffa1c812 3.19 - what's new - salesforce query result type auto-detection. No new revisions were added by this update. Summary of changes: content/blog/2022/10/camel319-whatsnew/index.md | 5 + 1 file changed, 5 insertions(+)
[camel] branch main updated: CAMEL-16642: camel-salesforce: Detect SObject type (#8275)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new c2b6f494f6a CAMEL-16642: camel-salesforce: Detect SObject type (#8275) c2b6f494f6a is described below commit c2b6f494f6a89ec7ab85925ea735f570a12a64b2 Author: Jeremy Ross AuthorDate: Mon Sep 5 14:25:07 2022 -0500 CAMEL-16642: camel-salesforce: Detect SObject type (#8275) CAMEL-16642: camel-salesforce: Detect SObject type Sniff the response to detect SObject type. Implemented for query* and apexcall operations. --- .../src/main/docs/salesforce-component.adoc| 32 + .../salesforce/api/SalesforceException.java| 4 +++ .../internal/processor/AbstractRestProcessor.java | 32 + .../processor/AbstractSalesforceProcessor.java | 27 ++ .../CompositeSObjectCollectionsProcessor.java | 2 +- .../internal/processor/JsonRestProcessor.java | 33 +- .../salesforce/RestApiIntegrationTest.java | 32 +++-- 7 files changed, 129 insertions(+), 33 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index fbb608cb786..7b7e6961839 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -522,15 +522,16 @@ Deletes a record in salesforce by External ID. `query` -Runs a Salesforce SOQL query. +Runs a Salesforce SOQL query. If neither `sObjectClass` nor `sObjectName` are set, Camel will attempt to determine +the correct `AbstractQueryRecordsBase` sublcass based on the response. |=== | Parameter | Type | Description | Default | Required | Body or `sObjectQuery` | `String` | SOQL query | | x | streamQueryResult | `Boolean` | If true, returns a streaming `Iterator` and transparently retrieves all pages as needed. The `sObjectClass` option must reference an `AbstractQueryRecordsBase` subclass. | false | -| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| | One of sObjectClass or sObjectName is required -| `sObjectName` | `String` | Simple name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `QueryRecordsAccount`. Requires the `package` option be set.| |One of sObjectClass or sObjectName is required +| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| | +| `sObjectName` | `String` | Simple name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `QueryRecordsAccount`. Requires the `package` option be set.| | |=== *Output* @@ -542,14 +543,16 @@ Type: Instance of class supplied in `sObjectClass`, or `Iterator` i `queryMore` -Retrieves more results (in case of large number of results) using result link returned from the `query` and `queryAll` operations. +Retrieves more results (in case of large number of results) using result link returned from the `query` and `queryAll` +operations. If neither `sObjectClass` nor `sObjectName` are set, Camel will attempt to determine the correct +`AbstractQueryRecordsBase` sublcass based on the response. |=== | Parameter | Type | Description | Default | Required | Body or `sObjectQuery` | `String` | `nextRecords` value. Can be found in a prior query result in the `AbstractQueryRecordsBase.nextRecordsUrl` property | | X -| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| |One of sObjectClass or sObjectName is required -| `sObjectName` | `String` | Simple name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `QueryRecordsAccount`. Requires the `package` option be set. | |One of sObjectClass or sObjectName is required +| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| | +| `sObjectName` | `String` | Simple name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `QueryRecordsAccount`. Requires the `package` option be set. | | |=== @@ -562,15 +565,18 @@ Type: Instance of class supplied in `sObjectClass` `queryAll` -Executes the specified SOQL query. Unlike
[camel] branch main updated: camel-core: Update delay EIP doc.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 884c7eae744 camel-core: Update delay EIP doc. 884c7eae744 is described below commit 884c7eae744bfe8bf074751ef2863dbf6729ed0c Author: Jeremy Ross AuthorDate: Mon Aug 29 15:01:40 2022 -0500 camel-core: Update delay EIP doc. Some DSLs require delay to be closed in certain situations. --- .../src/main/docs/modules/eips/pages/delay-eip.adoc | 15 +++ 1 file changed, 15 insertions(+) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/delay-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/delay-eip.adoc index 2dc749b9af8..f75e38669d2 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/delay-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/delay-eip.adoc @@ -37,6 +37,21 @@ And in XML: +Note that delay creates its own block, so some DSLs (including Java) require the delay block be closed: +[source,java] + +.from("direct:delayBlockExample") +.to("direct:getJobState") +.loopDoWhile(simple("${body.state} = 'NOT_DONE'")) +.log(LoggingLevel.DEBUG, "Pausing") +.delay(1) +.syncDelayed() +.end() // we must end the delay or else the log statement will be executed in each loop iteration +.to("direct:getJobState") +.end() +.log("and we're done"); + + The delayed value can be a dynamic xref:manual::expression.adoc[Expression]. For example to delay a random between 1 and 5 seconds, we can use
[camel] branch main updated: camel-salesforce: JUnit 5.9.0 compatibility
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 7ec5b085b1a camel-salesforce: JUnit 5.9.0 compatibility 7ec5b085b1a is described below commit 7ec5b085b1a78f902206022d74a77d09546a7a56 Author: Jeremy Ross AuthorDate: Sat Aug 20 11:31:18 2022 -0500 camel-salesforce: JUnit 5.9.0 compatibility Private lifecycle methods no longer allowed https://github.com/junit-team/junit5/issues/2914 --- .../camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java index f0b8f13e305..e747e4121d9 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java @@ -51,12 +51,12 @@ public class BulkApiV2QueryJobIntegrationTest extends AbstractSalesforceTestBase private static final String LAST_NAME = "CamelBulkTest"; @BeforeEach -private void setup() { +void setup() { createContacts(); } @AfterEach -private void teardown() { +void teardown() { deleteContacts(); }
[camel] branch main updated: camel-jackson: Clarify docs, AutoDiscoverObjectMapper option.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 8087bb2b8f9 camel-jackson: Clarify docs, AutoDiscoverObjectMapper option. 8087bb2b8f9 is described below commit 8087bb2b8f9b8d08de609cce4db55d8d7012cda9 Author: Jeremy Ross AuthorDate: Thu Aug 18 17:06:56 2022 -0500 camel-jackson: Clarify docs, AutoDiscoverObjectMapper option. --- .../org/apache/camel/component/jackson/AbstractJacksonDataFormat.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java index e3de9ddf90d..25ad8f9e74a 100644 --- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java +++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java @@ -413,7 +413,7 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport } /** - * If set to true then Jackson will lookup for an objectMapper into the registry + * If set to true and useDefaultObjectMapper is true, then Jackson will look for an objectMapper in the registry. */ public void setAutoDiscoverObjectMapper(boolean autoDiscoverObjectMapper) { this.autoDiscoverObjectMapper = autoDiscoverObjectMapper;
[camel] branch main updated: camel-datasonnet: Fix docs.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 81b0674a744 camel-datasonnet: Fix docs. 81b0674a744 is described below commit 81b0674a7444af1a6c6167b5c34188f942c8d980 Author: Jeremy Ross AuthorDate: Mon Aug 15 08:39:24 2022 -0500 camel-datasonnet: Fix docs. bodyMediaType and outputMediaType methods no longer exist. Updated docs to reflect this. --- .../camel-datasonnet/src/main/docs/datasonnet-language.adoc | 8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/components/camel-datasonnet/src/main/docs/datasonnet-language.adoc b/components/camel-datasonnet/src/main/docs/datasonnet-language.adoc index 819fdee3a16..ae2d95fff4e 100644 --- a/components/camel-datasonnet/src/main/docs/datasonnet-language.adoc +++ b/components/camel-datasonnet/src/main/docs/datasonnet-language.adoc @@ -63,9 +63,7 @@ Here is an example of a simple DataSonnet expression as a transformation EIP. Th [source,java] from("queue:foo") -.transform(datasonnet("ds.filter(body.lineItems, function(item) item > 100)", String.class) -.bodyMediaType("application/xml").outputMediaType("application/json") -) +.transform(datasonnet("ds.filter(body.lineItems, function(item) item > 100)", String.class, "application/xml", "application/json")) .to("queue:bar") @@ -123,7 +121,7 @@ media types without the need for a Header, this is useful if the transformation The DataSonnet expression will look for a body media type in the following order: 1. If the body is a `Document` it will use the metadata in the object -2. If the convenience bodyMediaType method was used, it will use its value +2. If the bodyMediaType parameter was provided in the DSL, it will use its value 3. A "CamelDatasonnetBodyMediaType" exchange property 4. A "Content-Type" message header 5. The DataSonnet Header payload media type directive @@ -131,7 +129,7 @@ The DataSonnet expression will look for a body media type in the following order And for output media type: -1. If the convenience outputMediaType method was used, it will use its value +1. If the outputMediaType parameter was provided in the DSL, it will use its value 2. A "CamelDatasonnetOutputMediaType" exchange property 3. A "CamelDatasonnetOutputMediaType" message header 4. The DataSonnet Header output media type directive
[camel] branch camel-3.18.x updated: CAMEL-18373: camel-salesforce: Support the new subscribe operation
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.18.x in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/camel-3.18.x by this push: new fd6498ab4d5 CAMEL-18373: camel-salesforce: Support the new subscribe operation fd6498ab4d5 is described below commit fd6498ab4d55635b75c6d772596788a9924e4fec Author: Jeremy Ross AuthorDate: Fri Aug 12 10:06:03 2022 -0500 CAMEL-18373: camel-salesforce: Support the new subscribe operation This is a backport of CAMEL-18317. --- .../salesforce/SalesforceEndpointUriFactory.java | 2 +- .../camel/component/salesforce/salesforce.json | 2 +- .../src/main/docs/salesforce-component.adoc| 24 +++--- .../component/salesforce/SalesforceComponent.java | 21 --- .../SalesforceComponentVerifierExtension.java | 9 +--- .../component/salesforce/SalesforceEndpoint.java | 13 .../salesforce/internal/OperationName.java | 4 +++- .../ChangeEventsConsumerIntegrationTest.java | 2 +- .../PlatformEventsConsumerIntegrationTest.java | 3 ++- .../SalesforceComponentVerifierExtensionTest.java | 3 +++ .../salesforce/StreamingApiIntegrationTest.java| 18 +--- 11 files changed, 62 insertions(+), 39 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java index 86a2b97c7a5..4d10a0fe5d2 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java @@ -99,7 +99,7 @@ public class SalesforceEndpointUriFactory extends org.apache.camel.support.compo Map copy = new HashMap<>(properties); -uri = buildPathParameter(syntax, uri, "operationName", null, false, copy); +uri = buildPathParameter(syntax, uri, "operationName", null, true, copy); uri = buildPathParameter(syntax, uri, "topicName", null, false, copy); uri = buildQueryParameters(uri, copy, encode); return uri; diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json index 9db58a4cef4..a87e8d2bdab 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json @@ -137,7 +137,7 @@ "CamelSalesforceClientId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The client id.", "constantName": "org.apache.camel.component.salesforce.SalesforceConstants#HEADER_SALESFORCE_CLIENT_ID" } }, "properties": { -"operationName": { "kind": "path", "displayName": "Operation Name", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.salesforce.internal.OperationName", "enum": [ "getVersions", "getResources", "getGlobalObjects", "getBasicInfo", "getDescription", "getSObject", "createSObject", "updateSObject", "deleteSObject", "getSObjectWithId", "upsertSObject", "deleteSObjectWithId", "getBlobField", "query", "queryMore", "queryA [...] +"operationName": { "kind": "path", "displayName": "Operation Name", "group": "common", "label": "common", "required": true, "type": "object", "javaType": "org.apache.camel.component.salesforce.internal.OperationName", "enum&qu
[camel] branch camel-3.18.x updated: camel-sftp: Document deprecated algos.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.18.x in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/camel-3.18.x by this push: new 8bcd30b3596 camel-sftp: Document deprecated algos. 8bcd30b3596 is described below commit 8bcd30b3596d51c2cb4693ebe8dd6d5729f546dc Author: Jeremy Ross AuthorDate: Thu Aug 11 21:33:17 2022 -0500 camel-sftp: Document deprecated algos. --- .../camel-ftp/src/main/docs/sftp-component.adoc | 20 1 file changed, 20 insertions(+) diff --git a/components/camel-ftp/src/main/docs/sftp-component.adoc b/components/camel-ftp/src/main/docs/sftp-component.adoc index a5953a88a96..f0f2c2fdcc7 100644 --- a/components/camel-ftp/src/main/docs/sftp-component.adoc +++ b/components/camel-ftp/src/main/docs/sftp-component.adoc @@ -45,6 +45,26 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END +== Restoring Deprecated Key Types and Algorithms + +As of Camel 3.17.0, key types and algorithms that use SHA1 have been deprecated. These can be restored, if necessary, by setting JSch configuration directly. E.g.: + +[source,java] + +JSch.setConfig("server_host_key", JSch.getConfig("server_host_key") + ",ssh-rsa"); +JSch.setConfig("PubkeyAcceptedAlgorithms", JSch.getConfig("PubkeyAcceptedAlgorithms") + ",ssh-rsa"); +JSch.setConfig("kex", JSch.getConfig("kex") + ",diffie-hellman-group1-sha1,diffie-hellman-group14-sha1"); + + +Note that the key types and algorithms your server supports may differ than the above example. You can use the following +command to inspect your server's configuration: + + +ssh -vvv + + +As of Camel 3.18.1, these values can also be set on SFTP endpoints by setting the corresponding URI parameters. + == More Information For more information you can look at xref:ftp-component.adoc[FTP component]
[camel] branch main updated: CAMEL-17835: camel-sftp: Update component and migration docs.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 8f4b8e6b2da CAMEL-17835: camel-sftp: Update component and migration docs. 8f4b8e6b2da is described below commit 8f4b8e6b2da12ab759ba9f3a8c09401ca62d8f43 Author: Jeremy Ross AuthorDate: Wed Aug 10 12:31:58 2022 -0500 CAMEL-17835: camel-sftp: Update component and migration docs. Include tip on restoring ssh-rsa/SHA1 for older SFTP servers. --- .../camel-ftp/src/main/docs/sftp-component.adoc | 20 .../ROOT/pages/camel-3x-upgrade-guide-3_17.adoc | 6 ++ 2 files changed, 26 insertions(+) diff --git a/components/camel-ftp/src/main/docs/sftp-component.adoc b/components/camel-ftp/src/main/docs/sftp-component.adoc index a5953a88a96..f0f2c2fdcc7 100644 --- a/components/camel-ftp/src/main/docs/sftp-component.adoc +++ b/components/camel-ftp/src/main/docs/sftp-component.adoc @@ -45,6 +45,26 @@ include::partial$component-endpoint-options.adoc[] include::partial$component-endpoint-headers.adoc[] // component headers: END +== Restoring Deprecated Key Types and Algorithms + +As of Camel 3.17.0, key types and algorithms that use SHA1 have been deprecated. These can be restored, if necessary, by setting JSch configuration directly. E.g.: + +[source,java] + +JSch.setConfig("server_host_key", JSch.getConfig("server_host_key") + ",ssh-rsa"); +JSch.setConfig("PubkeyAcceptedAlgorithms", JSch.getConfig("PubkeyAcceptedAlgorithms") + ",ssh-rsa"); +JSch.setConfig("kex", JSch.getConfig("kex") + ",diffie-hellman-group1-sha1,diffie-hellman-group14-sha1"); + + +Note that the key types and algorithms your server supports may differ than the above example. You can use the following +command to inspect your server's configuration: + + +ssh -vvv + + +As of Camel 3.18.1, these values can also be set on SFTP endpoints by setting the corresponding URI parameters. + == More Information For more information you can look at xref:ftp-component.adoc[FTP component] diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc index f47296b3975..6bcd3d92793 100644 --- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc +++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_17.adoc @@ -238,6 +238,12 @@ Notice how we must use `depends-on="VerySimple-context"` in the `cxf:cxfEndpoint +=== camel-sftp + +The underlying JSch library has been updated (https://issues.apache.org/jira/browse/CAMEL-17835[CAMEL-17835]) to a +more secure and actively maintained fork which has removed key types and algorithms that rely on SHA1. For +information on how these can be restored, consult the xref:components::sftp-component.adoc#_restoring_deprecated_key_types_and_algorithms[documentation for the SFTP component]. + === Deprecated Components The following components that had been marked as deprecated, were removed in this release:
[camel] branch main updated: CAMEL-18317: camel-salesforce: Add `subscribe` operation.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new e9dd46e23b2 CAMEL-18317: camel-salesforce: Add `subscribe` operation. e9dd46e23b2 is described below commit e9dd46e23b29068331af6a523453edbe815bf485 Author: Jeremy Ross AuthorDate: Sun Aug 7 13:54:07 2022 -0500 CAMEL-18317: camel-salesforce: Add `subscribe` operation. This allows endpoint syntax to have a mandatory operationName. --- .../salesforce/SalesforceEndpointUriFactory.java | 2 +- .../camel/component/salesforce/salesforce.json | 2 +- .../src/main/docs/salesforce-component.adoc| 24 +++--- .../component/salesforce/SalesforceComponent.java | 23 +++-- .../component/salesforce/SalesforceEndpoint.java | 13 .../salesforce/internal/OperationName.java | 4 +++- .../ChangeEventsConsumerIntegrationTest.java | 2 +- .../PlatformEventsConsumerIntegrationTest.java | 3 ++- .../salesforce/StreamingApiIntegrationTest.java| 6 +++--- .../ROOT/pages/camel-3x-upgrade-guide-3_19.adoc| 4 10 files changed, 43 insertions(+), 40 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java index 86a2b97c7a5..4d10a0fe5d2 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointUriFactory.java @@ -99,7 +99,7 @@ public class SalesforceEndpointUriFactory extends org.apache.camel.support.compo Map copy = new HashMap<>(properties); -uri = buildPathParameter(syntax, uri, "operationName", null, false, copy); +uri = buildPathParameter(syntax, uri, "operationName", null, true, copy); uri = buildPathParameter(syntax, uri, "topicName", null, false, copy); uri = buildQueryParameters(uri, copy, encode); return uri; diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json index 56ef73e696e..56a68b8a6df 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json @@ -138,7 +138,7 @@ "CamelSalesforceQueryResultTotalSize": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "Total number of records matching a query.", "constantName": "org.apache.camel.component.salesforce.SalesforceConstants#HEADER_SALESFORCE_QUERY_RESULT_TOTAL_SIZE" } }, "properties": { -"operationName": { "kind": "path", "displayName": "Operation Name", "group": "producer", "label": "producer", "required": false, "type": "object", "javaType": "org.apache.camel.component.salesforce.internal.OperationName", "enum": [ "getVersions", "getResources", "getGlobalObjects", "getBasicInfo", "getDescription", "getSObject", "createSObject", "updateSObject", "deleteSObject", "getSObjectWithId", "upsertSObject", "deleteSObjectWithId", "getBlobField", "query", "queryMore", "queryA [...] +"operationName": { "kind": "path", "displayName": "Operation Name", "group": "common", "label": "common", "required": true, "type": "object", "javaType": "org.apache.camel.component.salesforce.internal.OperationName", "enum": [ "
[camel] branch main updated: camel-salesforce: Document header.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 30d15e84d2e camel-salesforce: Document header. 30d15e84d2e is described below commit 30d15e84d2ee7cdfe3cc9dc67f46943c85b853e4 Author: Jeremy Ross AuthorDate: Tue Jul 26 15:08:58 2022 -0500 camel-salesforce: Document header. Header: CamelSalesforceQueryResultTotalSize --- .../resources/org/apache/camel/component/salesforce/salesforce.json | 3 ++- .../src/main/docs/salesforce-component.adoc | 4 ++-- .../org/apache/camel/component/salesforce/SalesforceConstants.java| 3 +++ .../component/salesforce/internal/processor/JsonRestProcessor.java| 4 ++-- .../it/resources/CamelSalesforceIntegrationTests.connectedApp | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json index e3b96ec8a08..56ef73e696e 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json @@ -134,7 +134,8 @@ "CamelSalesforceCreatedDate": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "java.time.ZonedDateTime", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The created date.", "constantName": "org.apache.camel.component.salesforce.SalesforceConstants#HEADER_SALESFORCE_CREATED_DATE" }, "CamelSalesforceTopicName": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The topic name.", "constantName": "org.apache.camel.component.salesforce.SalesforceConstants#HEADER_SALESFORCE_TOPIC_NAME" }, "CamelSalesforceChannel": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The channel.", "constantName": "org.apache.camel.component.salesforce.SalesforceConstants#HEADER_SALESFORCE_CHANNEL" }, -"CamelSalesforceClientId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The client id.", "constantName": "org.apache.camel.component.salesforce.SalesforceConstants#HEADER_SALESFORCE_CLIENT_ID" } +"CamelSalesforceClientId": { "kind": "header", "displayName": "", "group": "consumer", "label": "consumer", "required": false, "javaType": "String", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": false, "description": "The client id.", "constantName": "org.apache.camel.component.salesforce.SalesforceConstants#HEADER_SALESFORCE_CLIENT_ID" }, +"CamelSalesforceQueryResultTotalSize": { "kind": "header", "displayName": "", "group": "producer", "label": "producer", "required": false, "javaType": "int", "deprecated": false, "deprecationNote": "", "autowired": false, "secret": fals
[camel] branch main updated: camel-salesforce: Upgrade to v54.0 API.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 887a190c85d camel-salesforce: Upgrade to v54.0 API. 887a190c85d is described below commit 887a190c85dca4ddff148bafc2b5cbde5a7b7c2d Author: Jeremy Ross AuthorDate: Tue May 24 23:29:00 2022 -0500 camel-salesforce: Upgrade to v54.0 API. Also clean up tests' usage of versions. --- .../org/apache/camel/component/salesforce/salesforce.json| 4 ++-- .../camel/component/salesforce/SalesforceEndpointConfig.java | 2 +- .../camel/component/salesforce/AbstractSalesforceTestBase.java | 7 +-- .../salesforce/ChangeEventsConsumerIntegrationTest.java | 5 - .../component/salesforce/CompositeApiBatchIntegrationTest.java | 7 +-- .../salesforce/CompositeApiCollectionsIntegrationTest.java | 5 - .../camel/component/salesforce/CompositeApiIntegrationTest.java | 7 +-- .../camel/component/salesforce/LazyLoginIntegrationTest.java | 2 +- .../salesforce/PlatformEventsConsumerIntegrationTest.java| 5 - .../camel/component/salesforce/RawOperationIntegrationTest.java | 9 ++--- .../org/apache/camel/component/salesforce/RawPayloadTest.java| 2 +- .../camel/component/salesforce/RestApiIntegrationTest.java | 9 - 12 files changed, 18 insertions(+), 46 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json index 448dab40af3..a215322f0bb 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json @@ -25,7 +25,7 @@ "componentProperties": { "apexMethod": { "kind": "property", "displayName": "Apex Method", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "APEX method name" }, "apexQueryParams": { "kind": "property", "displayName": "Apex Query Params", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Query params for APEX method" }, -"apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "53.0", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Salesforce API version." }, +"apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "54.0", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Salesforce API version." }, "backoffIncrement": { "kind": "property", "displayName": "Backoff Increment", "group": "common", "label": ""
[camel] 02/02: camel-salesforce: integration test maintenance
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit 488b348828e40accb8fee7b6dffdc4d75e3b Author: Jeremy Ross AuthorDate: Tue May 24 21:20:21 2022 -0500 camel-salesforce: integration test maintenance --- .../camel-salesforce-component/README.md | 8 +- .../BulkApiV2QueryJobIntegrationTest.java | 2 +- .../salesforce/CompositeApiIntegrationTest.java| 2 +- .../salesforce/RestApiIntegrationTest.java | 8 +- .../it/resources/enterprise-scratch-def.json | 16 + .../it/resources/salesforce/package.xml| 4 - .../Hard_Delete_Permission_Set.permissionset | 713 - .../System Administrator With Hard Delete.profile | 652 --- 8 files changed, 722 insertions(+), 683 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/README.md b/components/camel-salesforce/camel-salesforce-component/README.md index e8f32bef6d5..ace7f81d765 100644 --- a/components/camel-salesforce/camel-salesforce-component/README.md +++ b/components/camel-salesforce/camel-salesforce-component/README.md @@ -36,7 +36,11 @@ If you need any custom fields, Apex classes or other configuration changes done, After the initial successful deployment, in salesforce go to Setup > App Manager, find the CamelSalesforceIntegrationTests app and click View. Copy the Consumer Key and Consumer Secret values into salesforce.client.id and salesforce.client.secret respectively. -It's also recommended to set email deliverability to `System Email Only` so you don't receive loads of approval emails when the tests run. +The deployment includes a permission set called `Hard Delete Permission Set` which contains the Hard Delete +permission as well as field-level permissions needed to run the integration tests. You can assign this +permissions set to the user you use to run tests. + +It's also recommended to set email deliverability to `System Email Only` so you don't receive loads of approval emails when the tests run. This can be found in Setup > Email > Deliverability. If your org contains Duplicate Rules for Objects the integration tests use, they could cause the tests to fail. If this is the case, deactivating the rules is recommended. @@ -46,7 +50,7 @@ If your tests cannot be run alongside other tests you can use `@Standalone` to m This is included 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 [...] +Besides that account you'll need a _test user_ account that has `Bulk API Hard Delete` permission set. 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 _ [...] 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=04ti000Pj8s](https://login.salesforce.com/packaging/installPackage.apexp?p0=04ti000Pj8s), and make the following modifications manually: - add custom field `Description` of type `Text` with maximum length of `100` on the `Merchandise` object diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java index ceb29d0e42c..f0b8f13e305 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java @@ -159,7 +159,7 @@ public class BulkApiV2QueryJobIntegrationTest extends AbstractSalesforceTestBase int i = 0; while (job.getState() != JobStateEnum.JOB_COMPLETE) { i++; -i
[camel] branch main updated (b08f121891c -> 488b348828e)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git from b08f121891c Regen for commit 8acc8d738386959b0ddefba49752aa80897d new eeb2bd5b324 camel-salesforce: consolidate error parsing. new 488b348828e camel-salesforce: integration test maintenance The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../camel-salesforce-component/README.md | 8 +- .../internal/client/AbstractClientBase.java| 59 +- .../internal/client/DefaultCompositeApiClient.java | 24 - ...efaultCompositeSObjectCollectionsApiClient.java | 22 - .../internal/client/DefaultRestClient.java | 71 -- .../BulkApiV2QueryJobIntegrationTest.java | 2 +- .../salesforce/CompositeApiIntegrationTest.java| 2 +- .../salesforce/RestApiIntegrationTest.java | 8 +- .../it/resources/enterprise-scratch-def.json | 16 + .../it/resources/salesforce/package.xml| 4 - .../Hard_Delete_Permission_Set.permissionset | 713 - .../System Administrator With Hard Delete.profile | 652 --- 12 files changed, 779 insertions(+), 802 deletions(-) create mode 100644 components/camel-salesforce/it/resources/enterprise-scratch-def.json delete mode 100644 components/camel-salesforce/it/resources/salesforce/profiles/System Administrator With Hard Delete.profile
[camel] 01/02: camel-salesforce: consolidate error parsing.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit eeb2bd5b324952e0730b31bf150fa5a00199408a Author: Jeremy Ross AuthorDate: Tue May 24 21:10:35 2022 -0500 camel-salesforce: consolidate error parsing. --- .../internal/client/AbstractClientBase.java| 59 +- .../internal/client/DefaultCompositeApiClient.java | 24 ...efaultCompositeSObjectCollectionsApiClient.java | 22 --- .../internal/client/DefaultRestClient.java | 71 -- 4 files changed, 57 insertions(+), 119 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java index 66f0610509e..0027da3822e 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java @@ -19,6 +19,7 @@ package org.apache.camel.component.salesforce.internal.client; import java.io.IOException; import java.io.InputStream; import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -39,12 +40,16 @@ import org.apache.camel.Exchange; import org.apache.camel.Message; import org.apache.camel.component.salesforce.SalesforceHttpClient; import org.apache.camel.component.salesforce.SalesforceLoginConfig; +import org.apache.camel.component.salesforce.api.NoSuchSObjectException; import org.apache.camel.component.salesforce.api.SalesforceException; +import org.apache.camel.component.salesforce.api.SalesforceMultipleChoicesException; import org.apache.camel.component.salesforce.api.TypeReferences; import org.apache.camel.component.salesforce.api.dto.RestError; +import org.apache.camel.component.salesforce.api.utils.JsonUtils; import org.apache.camel.component.salesforce.internal.PayloadFormat; import org.apache.camel.component.salesforce.internal.SalesforceSession; import org.apache.camel.support.service.ServiceSupport; +import org.apache.commons.io.IOUtils; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.HttpContentResponse; import org.eclipse.jetty.client.api.ContentProvider; @@ -82,7 +87,8 @@ public abstract class AbstractClientBase extends ServiceSupport private Phaser inflightRequests; -private long terminationTimeout; +private final long terminationTimeout; +private final ObjectMapper objectMapper; public AbstractClientBase(String version, SalesforceSession session, SalesforceHttpClient httpClient, SalesforceLoginConfig loginConfig) { @@ -96,6 +102,7 @@ public abstract class AbstractClientBase extends ServiceSupport this.httpClient = httpClient; this.loginConfig = loginConfig; this.terminationTimeout = terminationTimeout; +this.objectMapper = JsonUtils.createObjectMapper(); } @Override @@ -292,7 +299,55 @@ public abstract class AbstractClientBase extends ServiceSupport protected abstract void setAccessToken(Request request); -protected abstract SalesforceException createRestException(Response response, InputStream responseContent); +protected SalesforceException createRestException(Response response, InputStream responseContent) { +// get status code and reason phrase +final int statusCode = response.getStatus(); +String reason = response.getReason(); +if (reason == null || reason.isEmpty()) { +reason = HttpStatus.getMessage(statusCode); +} +try { +if (responseContent != null && responseContent.available() > 0) { +final List choices; +// return list of choices as error message for 300 +if (statusCode == HttpStatus.MULTIPLE_CHOICES_300) { +choices = objectMapper.readValue(responseContent, TypeReferences.STRING_LIST_TYPE); +return new SalesforceMultipleChoicesException(reason, statusCode, choices); +} else { +List restErrors = null; +String body = null; +try { +restErrors = readErrorsFrom(responseContent, objectMapper); +} catch (IOException ignored) { +// ok. could be a custom response +} +try { +responseContent.reset(); +
[camel] branch main updated: CAMEL-18046: Support sObjectName param for queries
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 97a4a38ca99 CAMEL-18046: Support sObjectName param for queries 97a4a38ca99 is described below commit 97a4a38ca9920e3b7cb2b1fbefcc501b6a0ad7b3 Author: Jeremy Ross AuthorDate: Tue May 3 10:05:38 2022 -0500 CAMEL-18046: Support sObjectName param for queries sObjectName allows theuser to specify the simple class name, vs sObjectClass which requires the fully qualified class name. --- .../src/main/docs/salesforce-component.adoc | 10 +++--- .../component/salesforce/SalesforceComponent.java | 4 ++-- .../internal/processor/AbstractRestProcessor.java | 9 ++--- .../component/salesforce/RestApiIntegrationTest.java | 19 +++ 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index db55f8c0d37..7add05acdc6 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -529,7 +529,8 @@ Runs a Salesforce SOQL query | Body or `sObjectQuery` | `String` | SOQL query | | x | streamQueryResult | `Boolean` | If true, returns a streaming `Iterator` and transparently retrieves all pages as needed. The `sObjectClass` option must reference an `AbstractQueryRecordsBase` subclass. | false | -| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| |x +| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| | One of sObjectClass or sObjectName is required +| `sObjectName` | `String` | Simple name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `QueryRecordsAccount`. Requires the `package` option be set.| |One of sObjectClass or sObjectName is required |=== *Output* @@ -547,7 +548,9 @@ Retrieves more results (in case of large number of results) using result link re | Parameter | Type | Description | Default | Required | Body or `sObjectQuery` | `String` | `nextRecords` value. Can be found in a prior query result in the `AbstractQueryRecordsBase.nextRecordsUrl` property | | X -| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| |x +| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| |One of sObjectClass or sObjectName is required +| `sObjectName` | `String` | Simple name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `QueryRecordsAccount`. Requires the `package` option be set. | |One of sObjectClass or sObjectName is required + |=== *Output* @@ -566,7 +569,8 @@ Executes the specified SOQL query. Unlike the `query` operation , `queryAll` ret | Body or `sObjectQuery` | `String` | SOQL query | | x | streamQueryResult | `Boolean` | If true, returns a streaming `Iterable` and transparently retrieves all pages as needed. The `sObjectClass` option must reference an `AbstractQueryRecordsBase` subclass. | false | -| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| |x +| `sObjectClass` | `String` | Fully qualified name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `org.my.dto.QueryRecordsAccount`| |One of sObjectClass or sObjectName is required +| `sObjectName` | `String` | Simple name of class to deserialize response to. Usually a subclass of `AbstractQueryRecordsBase`, e.g. `QueryRecordsAccount`. Requires the `package` option be set.| |One of sObjectClass or sObjectName is required |=== *Output* diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java index 248e65033b3..80a699c47f3 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java +++ b/components/camel-salesforce
[camel] branch main updated: Polish.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new d6b787a117e Polish. d6b787a117e is described below commit d6b787a117e250aa8f3526f9f832445c98bda43d Author: Jeremy Ross AuthorDate: Mon May 2 09:31:13 2022 -0500 Polish. --- .../camel/component/salesforce/RestApiIntegrationTest.java | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) 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 8583ea56d8a..01b44ff9f0e 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 @@ -231,8 +231,8 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { public void returnsHttpResponseStatusAndText() { Exchange exchange = new DefaultExchange(context); template().send("direct:query", exchange); -assertEquals("200", exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE)); - assertNotNull(exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_TEXT)); +assertEquals("200", exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_CODE)); + assertNotNull(exchange.getMessage().getHeader(Exchange.HTTP_RESPONSE_TEXT)); } @Test @@ -518,9 +518,8 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { createLineItems(createCount); Exchange exchange = new DefaultExchange(context); template().send("direct:queryStreamResult", exchange); -@SuppressWarnings("unchecked") -Iterator queryRecords = (Iterator) exchange.getOut().getBody(); - assertNotNull(exchange.getOut().getHeader("CamelSalesforceQueryResultTotalSize")); +Iterator queryRecords = exchange.getMessage(Iterator.class); + assertNotNull(exchange.getMessage().getHeader("CamelSalesforceQueryResultTotalSize")); int count = 0; while (queryRecords.hasNext()) { count = count + 1;
[camel] branch main updated: Remove non-exist MultiSelectPicklistConverter (#7507)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 35de5ab8466 Remove non-exist MultiSelectPicklistConverter (#7507) 35de5ab8466 is described below commit 35de5ab8466fdae0fd54ef21e665fab3741321b6 Author: ismail BASKIN AuthorDate: Sun May 1 19:37:23 2022 +0300 Remove non-exist MultiSelectPicklistConverter (#7507) MultiSelectPicklistConverter does not exist anymore. But generated DTOs still import it and cause error. --- .../camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm | 1 - 1 file changed, 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm index ffacb40af77..05927319901 100644 --- a/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm +++ b/components/camel-salesforce/camel-salesforce-maven-plugin/src/main/resources/sobject-pojo.vm @@ -34,7 +34,6 @@ import javax.annotation.Generated; import org.apache.camel.component.salesforce.api.StringMultiSelectPicklistDeserializer; import org.apache.camel.component.salesforce.api.StringMultiSelectPicklistSerializer; #else -import org.apache.camel.component.salesforce.api.MultiSelectPicklistConverter; import org.apache.camel.component.salesforce.api.MultiSelectPicklistDeserializer; import org.apache.camel.component.salesforce.api.MultiSelectPicklistSerializer; #end
[camel] branch main updated: CAMEL-17818: camel-salesforce: set query result size header
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new a0d24995345 CAMEL-17818: camel-salesforce: set query result size header a0d24995345 is described below commit a0d24995345042616a6169c90869f3c7b033c7c4 Author: Jeremy Ross AuthorDate: Sat Apr 30 11:38:25 2022 -0500 CAMEL-17818: camel-salesforce: set query result size header When streaming query results --- .../component/salesforce/internal/processor/JsonRestProcessor.java | 3 +++ .../apache/camel/component/salesforce/RestApiIntegrationTest.java | 7 +-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java index 0a3b02431f7..a9d40ea0f3d 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java @@ -46,6 +46,8 @@ import org.apache.camel.component.salesforce.api.utils.JsonUtils; public class JsonRestProcessor extends AbstractRestProcessor { +public static final String HEADER_SALESFORCE_QUERY_RESULT_TOTAL_SIZE = "CamelSalesforceQueryResultTotalSize"; + // it is ok to use a single thread safe ObjectMapper private final ObjectMapper objectMapper; @@ -252,6 +254,7 @@ public class JsonRestProcessor extends AbstractRestProcessor { final AbstractQueryRecordsBase response; Class responseClass = exchange.getProperty(RESPONSE_CLASS, Class.class); response = (AbstractQueryRecordsBase) objectMapper.readValue(responseEntity, responseClass); +out.setHeader(HEADER_SALESFORCE_QUERY_RESULT_TOTAL_SIZE, response.getTotalSize()); QueryResultIterator iterator = new QueryResultIterator( objectMapper, responseClass, restClient, determineHeaders(exchange), response); 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 b88756918e9..8583ea56d8a 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 @@ -516,8 +516,11 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { public void testQueryStreamResults() throws Exception { final int createCount = 300; createLineItems(createCount); -final Iterator queryRecords -= template().requestBody("direct:queryStreamResult", "", Iterator.class); +Exchange exchange = new DefaultExchange(context); +template().send("direct:queryStreamResult", exchange); +@SuppressWarnings("unchecked") +Iterator queryRecords = (Iterator) exchange.getOut().getBody(); + assertNotNull(exchange.getOut().getHeader("CamelSalesforceQueryResultTotalSize")); int count = 0; while (queryRecords.hasNext()) { count = count + 1;
[camel] branch main updated: CAMEL-17979: camel-salesforce: Restore field values...
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new fd68d1cce1f CAMEL-17979: camel-salesforce: Restore field values... fd68d1cce1f is described below commit fd68d1cce1f91cf9df7d5ae567000f566dc5bad4 Author: Jeremy Ross AuthorDate: Sun Apr 17 17:05:01 2022 -0500 CAMEL-17979: camel-salesforce: Restore field values... prior to invoking the callback. --- .../salesforce/internal/processor/AbstractRestProcessor.java | 10 +- .../camel/component/salesforce/RestApiIntegrationTest.java | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java index c9a4a0e140b..e78e5a0b511 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java @@ -367,8 +367,8 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor new RestClient.ResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException exception) { -processResponse(exchange, response, headers, exception, callback); restoreFields(exchange, sObjectBase, finalsObjectId, null, null); +processResponse(exchange, response, headers, exception, callback); } }); } @@ -381,8 +381,8 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor restClient.deleteSObject(sObjectName, sObjectId, determineHeaders(exchange), new RestClient.ResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException exception) { -processResponse(exchange, response, headers, exception, callback); restoreFields(exchange, sObjectBase, sObjectId, null, null); +processResponse(exchange, response, headers, exception, callback); } }); } @@ -410,8 +410,8 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor new RestClient.ResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException exception) { -processResponse(exchange, response, headers, exception, callback); restoreFields(exchange, sObjectBase, null, sObjectExtIdName, finalOldValue); +processResponse(exchange, response, headers, exception, callback); } }); } @@ -438,8 +438,8 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor getRequestStream(exchange), new RestClient.ResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException exception) { -processResponse(exchange, response, headers, exception, callback); restoreFields(exchange, sObjectBase, null, sObjectExtIdName, finalOldValue); +processResponse(exchange, response, headers, exception, callback); } }); } @@ -483,8 +483,8 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor new RestClient.ResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException exception) { -processResponse(exchange, response, headers, exception, callback); restoreFields(exchange, sObjectBase, sObjectId, null, null); +processResponse(exchange, response, headers, exception, callback); } }); } 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 51bbb663286..b88756918e9 100644 --- a/components/camel-salesforce
[camel] branch main updated: CAMEL-17954: Fix integration tests
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 17e09dc2fdd CAMEL-17954: Fix integration tests 17e09dc2fdd is described below commit 17e09dc2fdd0dfbe5c9fa661e178cc308d9b5d05 Author: Jeremy Ross AuthorDate: Sun Apr 17 16:54:10 2022 -0500 CAMEL-17954: Fix integration tests --- .../camel-salesforce-component/pom.xml | 1 + .../salesforce/AbstractSalesforceTestBase.java | 2 ++ .../BulkApiV2QueryJobIntegrationTest.java | 2 +- .../CompositeApiBatchIntegrationTest.java | 35 +++--- ...eComponentVerifierExtensionIntegrationTest.java | 1 + .../camel/maven/SchemaMojoIntegrationTest.java | 2 +- 6 files changed, 23 insertions(+), 20 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/pom.xml b/components/camel-salesforce/camel-salesforce-component/pom.xml index 9b24b2190cc..3fef64277fa 100644 --- a/components/camel-salesforce/camel-salesforce-component/pom.xml +++ b/components/camel-salesforce/camel-salesforce-component/pom.xml @@ -429,6 +429,7 @@ https://developer.salesforce.com/page/Force.com_Migration_Tool]]> **/*IntegrationTest.java standalone + 240 diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java index 1772fd49f04..40246fc91dc 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java @@ -60,6 +60,8 @@ public abstract class AbstractSalesforceTestBase extends CamelTestSupport { clientProperties.put("maxContentLength", String.valueOf(4 * 1024 * 1024)); component.setHttpClientProperties(clientProperties); +component.setHttpClientIdleTimeout(6); + // set DTO package component.setPackages(Merchandise__c.class.getPackage().getName()); diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java index ad969f4fc50..ceb29d0e42c 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/BulkApiV2QueryJobIntegrationTest.java @@ -159,7 +159,7 @@ public class BulkApiV2QueryJobIntegrationTest extends AbstractSalesforceTestBase int i = 0; while (job.getState() != JobStateEnum.JOB_COMPLETE) { i++; -if (i == 5) { +if (i == 10) { throw new IllegalStateException("Job failed to reach JOB_COMPLETE status."); } Thread.sleep(2000); diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/CompositeApiBatchIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/CompositeApiBatchIntegrationTest.java index e009a2f97ca..6fdc2d14668 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/CompositeApiBatchIntegrationTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/CompositeApiBatchIntegrationTest.java @@ -24,10 +24,9 @@ import java.util.Map; import java.util.Set; import java.util.stream.Collectors; -import org.apache.camel.CamelExecutionException; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.salesforce.api.dto.AbstractQueryRecordsBase; -import org.apache.camel.component.salesforce.api.dto.CreateSObjectResult; +import org.apache.camel.component.salesforce.api.dto.UpsertSObjectResult; import org.apache.camel.component.salesforce.api.dto.composite.SObjectBatch; import org.apache.camel.component.salesforce.api.dto.composite.SObje
[camel] 02/02: CAMEL-17954: camel-salesforce: Fix integration tests
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit d2bdee9a83acf93a2d415b75064b504203185e5e Author: Jeremy Ross AuthorDate: Sat Apr 16 13:51:10 2022 -0500 CAMEL-17954: camel-salesforce: Fix integration tests Add Record Type to Line_Item__c. --- .../it/resources/salesforce/objects/Line_Item__c.object | 5 + 1 file changed, 5 insertions(+) diff --git a/components/camel-salesforce/it/resources/salesforce/objects/Line_Item__c.object b/components/camel-salesforce/it/resources/salesforce/objects/Line_Item__c.object index cfe23057b7c..a09ee549944 100644 --- a/components/camel-salesforce/it/resources/salesforce/objects/Line_Item__c.object +++ b/components/camel-salesforce/it/resources/salesforce/objects/Line_Item__c.object @@ -106,6 +106,11 @@ Text Line Items + +Test_Record_Type +true +Test Record Type + ReadWrite Public
[camel] branch main updated (8c36841b075 -> d2bdee9a83a)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git from 8c36841b075 CAMEL-17974: camel-jbang - Reload local kamelets new 81d65747a55 [CAMEL-17954]fix integration tests failure new d2bdee9a83a CAMEL-17954: camel-salesforce: Fix integration tests The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../camel/component/salesforce/CompoundTypesIntegrationTest.java | 5 +++-- .../apache/camel/component/salesforce/HttpProxyIntegrationTest.java | 5 +++-- .../it/resources/CamelSalesforceIntegrationTests.connectedApp| 4 ++-- .../it/resources/salesforce/objects/Line_Item__c.object | 5 + 4 files changed, 13 insertions(+), 6 deletions(-)
[camel] 01/02: [CAMEL-17954]fix integration tests failure
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit 81d65747a550dbad364a1a862527277c74f72d60 Author: Freeman Fang AuthorDate: Wed Apr 13 16:45:08 2022 -0400 [CAMEL-17954]fix integration tests failure --- .../camel/component/salesforce/CompoundTypesIntegrationTest.java | 5 +++-- .../apache/camel/component/salesforce/HttpProxyIntegrationTest.java | 5 +++-- .../it/resources/CamelSalesforceIntegrationTests.connectedApp| 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/CompoundTypesIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/CompoundTypesIntegrationTest.java index a1f25fd0c9b..b5028a0e64f 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/CompoundTypesIntegrationTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/CompoundTypesIntegrationTest.java @@ -23,8 +23,8 @@ import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static org.junit.Assert.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -90,7 +90,8 @@ public class CompoundTypesIntegrationTest extends AbstractSalesforceTestBase { } finally { // delete the test SObject -assertNull(template().requestBody("direct:deleteSObject" + suffix, result.getId())); +String id = (String) template().requestBody("direct:deleteSObject" + suffix, result.getId()); +assertEquals(id, result.getId()); LOG.debug("Delete successful"); } } 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 116007bb418..555379373bf 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 @@ -38,6 +38,7 @@ import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; import org.eclipse.jetty.util.B64Code; import org.eclipse.jetty.util.StringUtil; +import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -149,8 +150,8 @@ public class HttpProxyIntegrationTest extends AbstractSalesforceTestBase { configurationMethod.accept(salesforce); } -@Override -public void cleanupResources() throws Exception { +@AfterAll +public static void cleanup() throws Exception { // stop the proxy server after component LOG.info("Stopping proxy server..."); server.stop(); diff --git a/components/camel-salesforce/it/resources/CamelSalesforceIntegrationTests.connectedApp b/components/camel-salesforce/it/resources/CamelSalesforceIntegrationTests.connectedApp index dc1ffd36fc2..ae4f9c265d5 100644 --- a/components/camel-salesforce/it/resources/CamelSalesforceIntegrationTests.connectedApp +++ b/components/camel-salesforce/it/resources/CamelSalesforceIntegrationTests.connectedApp @@ -21,8 +21,8 @@ https://login.salesforce.com/services/oauth2/success MIIC1TCCAb2gAwIBAgIEM3ZMGjANBgkqhkiG9w0BAQsFADAaMRgwFgYDVQQDEw9TYWxlc2ZvcmNlIHRlc3QwIBcNMTcwMzE0MjIxMjU0WhgPMjExNzAyMTgyMjEyNTRaMBoxGDAWBgNVBAMTD1NhbGVzZm9yY2UgdGVzdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbZinVCZerzZvyyQlfE6nMpEQRfVsjpcfT01UTG/bwzWorP7YRpGkDW7Q4eu6IPrHtohkhM3JtsSVka5jfS1iEguMXLdNkEyMjMiBrWJeyGfcISF1yazgqLxxwcwGjMn3C9xV5tBxiRSqtMrV1iRx3fxmLue1UnZjSyUaG+Vi+FcKxqre5ixApeDCZHLONxBy3mjWK4GIeBBbUqQqy3LNrT6B34WdNX8vTslpTKOlmLyycEI/Rx+A4lNaultrJHdnRhGBr [...] -${salesforce.client.id} -${salesforce.client.secret} + Api RefreshToken
[camel] branch main updated: CAMEL-17883: camel-salesforce: remove erroneous import
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 1bcae63 CAMEL-17883: camel-salesforce: remove erroneous import 1bcae63 is described below commit 1bcae6319355cc2c7c485d1667d3af18d9215a5b Author: Jeremy Ross AuthorDate: Wed Mar 30 12:33:38 2022 -0500 CAMEL-17883: camel-salesforce: remove erroneous import in DTO template --- .../camel-salesforce-codegen/src/main/resources/sobject-pojo.vm | 1 - 1 file changed, 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo.vm b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo.vm index ffacb40..0592731 100644 --- a/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo.vm +++ b/components/camel-salesforce/camel-salesforce-codegen/src/main/resources/sobject-pojo.vm @@ -34,7 +34,6 @@ import javax.annotation.Generated; import org.apache.camel.component.salesforce.api.StringMultiSelectPicklistDeserializer; import org.apache.camel.component.salesforce.api.StringMultiSelectPicklistSerializer; #else -import org.apache.camel.component.salesforce.api.MultiSelectPicklistConverter; import org.apache.camel.component.salesforce.api.MultiSelectPicklistDeserializer; import org.apache.camel.component.salesforce.api.MultiSelectPicklistSerializer; #end
[camel] branch main updated: CAMEL-17705: camel-salesforce: HTTP request timeout option.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 91848c1 CAMEL-17705: camel-salesforce: HTTP request timeout option. 91848c1 is described below commit 91848c1114f60e2242b356805439bcf9ff5903c8 Author: Jeremy Ross AuthorDate: Fri Mar 25 10:18:32 2022 -0500 CAMEL-17705: camel-salesforce: HTTP request timeout option. --- .../salesforce/SalesforceComponentConfigurer.java | 6 ++ .../apache/camel/component/salesforce/salesforce.json | 1 + .../component/salesforce/SalesforceComponent.java | 19 +++ 3 files changed, 26 insertions(+) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java index 173d977..3db266e 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java @@ -96,6 +96,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "httpProxyUsername": target.setHttpProxyUsername(property(camelContext, java.lang.String.class, value)); return true; case "httprequestbuffersize": case "httpRequestBufferSize": target.setHttpRequestBufferSize(property(camelContext, java.lang.Integer.class, value)); return true; +case "httprequesttimeout": +case "httpRequestTimeout": target.setHttpRequestTimeout(property(camelContext, long.class, value)); return true; case "includedetails": case "includeDetails": getOrCreateConfig(target).setIncludeDetails(property(camelContext, java.lang.Boolean.class, value)); return true; case "initialreplayidmap": @@ -278,6 +280,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "httpProxyUsername": return java.lang.String.class; case "httprequestbuffersize": case "httpRequestBufferSize": return java.lang.Integer.class; +case "httprequesttimeout": +case "httpRequestTimeout": return long.class; case "includedetails": case "includeDetails": return java.lang.Boolean.class; case "initialreplayidmap": @@ -461,6 +465,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "httpProxyUsername": return target.getHttpProxyUsername(); case "httprequestbuffersize": case "httpRequestBufferSize": return target.getHttpRequestBufferSize(); +case "httprequesttimeout": +case "httpRequestTimeout": return target.getHttpRequestTimeout(); case "includedetails": case "includeDetails": return getOrCreateConfig(target).getIncludeDetails(); case "initialreplayidmap": diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json index 60eab17..091c3cc 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json @@ -37,6 +37,7 @@ "httpClientIdleTimeout": { "kind": "property", "displayName": "Http Client Idle Timeout", "group": "common", "label": "common", "required": false, "type": "integer", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": 1, "description": "Timeout used by the HttpClient when waiting for response from the Salesforce server." }, "httpMaxContentLength": { "kind": "property", "displayName": "Http Max Content Length", "group": "common", "label": "common", "required": false, "type&
[camel] branch main updated: CAMEL-17818: camel-salesforce: stream query results
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 959eacd CAMEL-17818: camel-salesforce: stream query results 959eacd is described below commit 959eacd46af42dd10555a728777f6966cdd53867 Author: Jeremy Ross AuthorDate: Thu Mar 24 11:27:26 2022 -0500 CAMEL-17818: camel-salesforce: stream query results --- .../salesforce/SalesforceComponentConfigurer.java | 6 ++ .../salesforce/SalesforceEndpointConfigurer.java | 6 ++ .../salesforce/SalesforceEndpointUriFactory.java | 3 +- .../camel/component/salesforce/salesforce.json | 2 + .../src/main/docs/salesforce-component.adoc| 6 +- .../salesforce/SalesforceEndpointConfig.java | 16 .../api/dto/AbstractQueryRecordsBase.java | 33 +++- .../dto/analytics/reports/QueryRecordsReport.java | 14 +--- .../internal/dto/QueryRecordsPushTopic.java| 13 +-- .../internal/processor/AbstractRestProcessor.java | 28 ++- .../internal/processor/JsonRestProcessor.java | 52 +++- .../internal/processor/QueryResultIterator.java| 95 ++ .../CompositeApiBatchIntegrationTest.java | 12 +-- .../salesforce/CompositeApiIntegrationTest.java| 12 +-- .../salesforce/RecentIntegrationTest.java | 12 +-- .../salesforce/RestApiIntegrationTest.java | 77 -- .../dto/generated/QueryRecordsAccount.java | 13 +-- .../dto/generated/QueryRecordsContact.java | 13 +-- .../dto/generated/QueryRecordsLine_Item__c.java| 13 +-- .../AbstractRestProcessorApprovalTest.java | 7 ++ .../resources/sobject-query-records-optional.vm| 12 +-- .../src/main/resources/sobject-query-records.vm| 12 +-- .../test/resources/generated/QueryRecordsCase.java | 12 +-- .../QueryRecordsComplexCalculatedFormula.java | 12 +-- 24 files changed, 304 insertions(+), 177 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java index 1018e7c..173d977 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java @@ -191,6 +191,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "sObjectSearch": getOrCreateConfig(target).setSObjectSearch(property(camelContext, java.lang.String.class, value)); return true; case "sslcontextparameters": case "sslContextParameters": target.setSslContextParameters(property(camelContext, org.apache.camel.support.jsse.SSLContextParameters.class, value)); return true; +case "streamqueryresult": +case "streamQueryResult": getOrCreateConfig(target).setStreamQueryResult(property(camelContext, java.lang.Boolean.class, value)); return true; case "updatetopic": case "updateTopic": getOrCreateConfig(target).setUpdateTopic(property(camelContext, boolean.class, value)); return true; case "useglobalsslcontextparameters": @@ -371,6 +373,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "sObjectSearch": return java.lang.String.class; case "sslcontextparameters": case "sslContextParameters": return org.apache.camel.support.jsse.SSLContextParameters.class; +case "streamqueryresult": +case "streamQueryResult": return java.lang.Boolean.class; case "updatetopic": case "updateTopic": return boolean.class; case "useglobalsslcontextparameters": @@ -552,6 +556,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "sObjectSearch": return getOrCreateConfig(target).getSObjectSearch(); case "sslcontextparameters": case "sslContextParameters": return target.getSslContextParameters(); +case "streamqueryresult": +case "streamQueryResult": return getOrCreateConfig(target).getStreamQueryResult(); case "updatetopic": case "updateTopic": return getOrCreateConfig(target).isUpdateTopic(); case "useglobalsslcontextparameters": diff --git a/components/camel-sale
[camel] branch main updated: CAMEL-17795: camel-salesforce: add JAXB implementation
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new d5e9516 CAMEL-17795: camel-salesforce: add JAXB implementation d5e9516 is described below commit d5e95166f472cd2159f3a310837e622cfb472d28 Author: Jeremy Ross AuthorDate: Mon Mar 14 22:33:41 2022 -0500 CAMEL-17795: camel-salesforce: add JAXB implementation --- components/camel-salesforce/camel-salesforce-component/pom.xml | 5 + 1 file changed, 5 insertions(+) diff --git a/components/camel-salesforce/camel-salesforce-component/pom.xml b/components/camel-salesforce/camel-salesforce-component/pom.xml index ee7ca05..1d16a16 100644 --- a/components/camel-salesforce/camel-salesforce-component/pom.xml +++ b/components/camel-salesforce/camel-salesforce-component/pom.xml @@ -137,6 +137,11 @@ javax.annotation-api + +com.sun.xml.bind +jaxb-impl + + org.slf4j
[camel] branch main updated: CAMEL-17608: camel-salesforce: Use sObjectName option better
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 27300d1 CAMEL-17608: camel-salesforce: Use sObjectName option better 27300d1 is described below commit 27300d1b5689242ce55f6df1528daad01e2c1164 Author: Jeremy Ross AuthorDate: Sun Mar 13 13:01:49 2022 -0500 CAMEL-17608: camel-salesforce: Use sObjectName option better --- .../internal/processor/AbstractRestProcessor.java | 102 + .../salesforce/RestApiIntegrationTest.java | 71 ++ .../ROOT/pages/camel-3x-upgrade-guide-3_16.adoc| 6 ++ 3 files changed, 78 insertions(+), 101 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java index b9e9570..0f0fdb2 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/AbstractRestProcessor.java @@ -325,18 +325,8 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor } private void processGetSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException { -String sObjectName; -String sObjectIdValue; -// determine parameters from input AbstractSObject -final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class); -if (sObjectBase != null) { -sObjectName = sObjectBase.getClass().getSimpleName(); -sObjectIdValue = sObjectBase.getId(); -} else { -sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL); -sObjectIdValue = getParameter(SOBJECT_ID, exchange, USE_BODY, NOT_OPTIONAL); -} -final String sObjectId = sObjectIdValue; +String sObjectName = determineSObjectName(exchange); +final String sObjectId = determineSObjectId(exchange); // use sObject name to load class setResponseClass(exchange, sObjectName); @@ -353,33 +343,20 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor } private void processCreateSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException { -String sObjectName; -// determine parameters from input AbstractSObject -AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class); -if (sObjectBase != null) { -sObjectName = sObjectBase.getClass().getSimpleName(); -} else { -sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL); -} +String sObjectName = determineSObjectName(exchange); restClient.createSObject(sObjectName, getRequestStream(exchange), determineHeaders(exchange), processWithResponseCallback(exchange, callback)); } private void processUpdateSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException { -String sObjectName; -// determine parameters from input AbstractSObject +String sObjectName = determineSObjectName(exchange); +String sObjectId = determineSObjectId(exchange); final AbstractSObjectBase sObjectBase = exchange.getIn().getBody(AbstractSObjectBase.class); -String sObjectId; +// raw payloads will not be AbstractSObjectBase if (sObjectBase != null) { -sObjectName = sObjectBase.getClass().getSimpleName(); -// remember the sObject Id -sObjectId = sObjectBase.getId(); -// clear base object fields, which cannot be updated sObjectBase.clearBaseFields(); -} else { -sObjectName = getParameter(SOBJECT_NAME, exchange, IGNORE_BODY, NOT_OPTIONAL); -sObjectId = getParameter(SOBJECT_ID, exchange, IGNORE_BODY, NOT_OPTIONAL); + } final String finalsObjectId = sObjectId; @@ -394,18 +371,9 @@ public abstract class AbstractRestProcessor extends AbstractSalesforceProcessor } private void processDeleteSobject(final Exchange exchange, final AsyncCallback callback) throws SalesforceException { -String sObjectName; -// determine parameters from input AbstractSObject +String sObjectName = determineSObjectName(exchange); +final String sObjectId = determineSObjectId(exchange
[camel] branch main updated (cfe69f6 -> 8188f29)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git. from cfe69f6 CAMEL-15562: simplify the resumable processor lifecycle add 8188f29 CAMEL-17558: Rename test No new revisions were added by this update. Summary of changes: .../salesforce/{LazyLoginTest.java => LazyLoginIntegrationTest.java}| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/{LazyLoginTest.java => LazyLoginIntegrationTest.java} (97%)
[camel] branch camel-3.14.x updated: CAMEL-17558: Rename test
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.14.x in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/camel-3.14.x by this push: new 758b8a5 CAMEL-17558: Rename test 758b8a5 is described below commit 758b8a5a06e1c2e62aac5fbee98d01d066856ad5 Author: Jeremy Ross AuthorDate: Tue Mar 1 12:30:37 2022 -0600 CAMEL-17558: Rename test --- .../salesforce/{LazyLoginTest.java => LazyLoginIntegrationTest.java}| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LazyLoginTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LazyLoginIntegrationTest.java similarity index 97% rename from components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LazyLoginTest.java rename to components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LazyLoginIntegrationTest.java index 9dee1e3..b6b10e6 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LazyLoginTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LazyLoginIntegrationTest.java @@ -21,7 +21,7 @@ import java.util.HashMap; import org.apache.camel.component.salesforce.dto.generated.Merchandise__c; import org.junit.jupiter.api.Test; -public class LazyLoginTest extends AbstractSalesforceTestBase { +public class LazyLoginIntegrationTest extends AbstractSalesforceTestBase { @Test public void lazyLoginDoesNotThrowExceptions() throws Exception {
[camel] branch camel-3.14.x updated: CAMEL-17558: Fix salesforce lazy login
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.14.x in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/camel-3.14.x by this push: new b66db9e CAMEL-17558: Fix salesforce lazy login b66db9e is described below commit b66db9e813f0f952524674f725736f98c06f5fe4 Author: Jeremy Ross AuthorDate: Tue Mar 1 09:54:06 2022 -0600 CAMEL-17558: Fix salesforce lazy login --- .../salesforce/SalesforceLoginConfig.java | 7 .../salesforce/internal/SalesforceSession.java | 4 -- .../salesforce/AbstractSalesforceTestBase.java | 3 +- ...tSalesforceTestBase.java => LazyLoginTest.java} | 49 +- 4 files changed, 29 insertions(+), 34 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java index c97a9cc..b969aaa 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java @@ -93,6 +93,10 @@ public class SalesforceLoginConfig { */ public void setLoginUrl(String loginUrl) { this.loginUrl = loginUrl; +if (loginUrl != null) { +// strip trailing slash +this.loginUrl = loginUrl.endsWith("/") ? loginUrl.substring(0, loginUrl.length() - 1) : loginUrl; +} } public String getClientId() { @@ -227,6 +231,9 @@ public class SalesforceLoginConfig { } public void validate() { +if (lazyLogin) { +return; +} ObjectHelper.notNull(loginUrl, "loginUrl"); ObjectHelper.notNull(clientId, "clientId"); diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java index a0a0c84..4072862 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java @@ -97,10 +97,6 @@ public class SalesforceSession extends ServiceSupport { this.timeout = timeout; this.config = config; -// strip trailing '/' -String loginUrl = config.getLoginUrl(); -config.setLoginUrl(loginUrl.endsWith("/") ? loginUrl.substring(0, loginUrl.length() - 1) : loginUrl); - this.objectMapper = JsonUtils.createObjectMapper(); this.listeners = new CopyOnWriteArraySet<>(); } diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java index dd6b88f..1772fd4 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; public abstract class AbstractSalesforceTestBase extends CamelTestSupport { protected final Logger log = LoggerFactory.getLogger(getClass()); +protected SalesforceComponent component; @Override protected RouteBuilder createRouteBuilder() throws Exception { @@ -46,7 +47,7 @@ public abstract class AbstractSalesforceTestBase extends CamelTestSupport { protected void createComponent() throws Exception { // create the component -SalesforceComponent component = new SalesforceComponent(); +component = new SalesforceComponent(); final SalesforceEndpointConfig config = new SalesforceEndpointConfig(); config.setApiVersion(System.getProperty("apiVersion", salesforceApiVersionToUse())); component.setConfig(config); diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LazyLoginTest.java similarity index 61% copy from components
[camel] branch main updated: CAMEL-17558: Fix salesforce lazy login
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new b890d82 CAMEL-17558: Fix salesforce lazy login b890d82 is described below commit b890d82f929cd79c3e37da7ccf6ae1482ef082d9 Author: Jeremy Ross AuthorDate: Tue Mar 1 09:54:06 2022 -0600 CAMEL-17558: Fix salesforce lazy login --- .../salesforce/SalesforceLoginConfig.java | 7 .../salesforce/internal/SalesforceSession.java | 4 -- .../salesforce/AbstractSalesforceTestBase.java | 3 +- ...tSalesforceTestBase.java => LazyLoginTest.java} | 49 +- 4 files changed, 29 insertions(+), 34 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java index c97a9cc..b969aaa 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceLoginConfig.java @@ -93,6 +93,10 @@ public class SalesforceLoginConfig { */ public void setLoginUrl(String loginUrl) { this.loginUrl = loginUrl; +if (loginUrl != null) { +// strip trailing slash +this.loginUrl = loginUrl.endsWith("/") ? loginUrl.substring(0, loginUrl.length() - 1) : loginUrl; +} } public String getClientId() { @@ -227,6 +231,9 @@ public class SalesforceLoginConfig { } public void validate() { +if (lazyLogin) { +return; +} ObjectHelper.notNull(loginUrl, "loginUrl"); ObjectHelper.notNull(clientId, "clientId"); diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java index a0a0c84..4072862 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java @@ -97,10 +97,6 @@ public class SalesforceSession extends ServiceSupport { this.timeout = timeout; this.config = config; -// strip trailing '/' -String loginUrl = config.getLoginUrl(); -config.setLoginUrl(loginUrl.endsWith("/") ? loginUrl.substring(0, loginUrl.length() - 1) : loginUrl); - this.objectMapper = JsonUtils.createObjectMapper(); this.listeners = new CopyOnWriteArraySet<>(); } diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java index dd6b88f..1772fd4 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; public abstract class AbstractSalesforceTestBase extends CamelTestSupport { protected final Logger log = LoggerFactory.getLogger(getClass()); +protected SalesforceComponent component; @Override protected RouteBuilder createRouteBuilder() throws Exception { @@ -46,7 +47,7 @@ public abstract class AbstractSalesforceTestBase extends CamelTestSupport { protected void createComponent() throws Exception { // create the component -SalesforceComponent component = new SalesforceComponent(); +component = new SalesforceComponent(); final SalesforceEndpointConfig config = new SalesforceEndpointConfig(); config.setApiVersion(System.getProperty("apiVersion", salesforceApiVersionToUse())); component.setConfig(config); diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/AbstractSalesforceTestBase.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/LazyLoginTest.java similarity index 61% copy from components/camel-salesforc
[camel] branch main updated: Polish claim check docs.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 029c2f0 Polish claim check docs. 029c2f0 is described below commit 029c2f083d6d4fb33b444d2bcbd74c0a44a3e3a8 Author: Jeremy Ross AuthorDate: Wed Jan 12 12:14:31 2022 -0600 Polish claim check docs. --- .../docs/modules/eips/pages/claimCheck-eip.adoc| 42 +++--- .../org/apache/camel/model/claimCheck.json | 4 +-- .../apache/camel/model/ClaimCheckDefinition.java | 22 ++-- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/core/camel-core-engine/src/main/docs/modules/eips/pages/claimCheck-eip.adoc b/core/camel-core-engine/src/main/docs/modules/eips/pages/claimCheck-eip.adoc index b24d2e6..48498e3 100644 --- a/core/camel-core-engine/src/main/docs/modules/eips/pages/claimCheck-eip.adoc +++ b/core/camel-core-engine/src/main/docs/modules/eips/pages/claimCheck-eip.adoc @@ -27,7 +27,7 @@ include::partial$eip-options.adoc[] When using this EIP you must specify the operation to use which can be of the following: * *Get* - Gets (does not remove) the claim check by the given key. -* *GetAndRemove* - Gets and remove the claim check by the given key. +* *GetAndRemove* - Gets and removes the claim check by the given key. * *Set* - Sets a new (will override if key already exists) claim check with the given key. * *Push* - Sets a new claim check on the stack (does not use key). * *Pop* - Gets the latest claim check from the stack (does not use key). @@ -41,19 +41,19 @@ The `Push` and `Pop` operations do *not* use a key but stores the data in a stac == Merging data using get or pop operation The `Get`, `GetAndRemove` and `Pop` operations will claim data back from the claim check repository. -The data is then merged with the current data on the exchange, this is done with an `AggregationStrategy`. +The data is then merged with the current data on the exchange. This is done with an `AggregationStrategy`. The default strategy uses the `filter` option to easily specify what data to merge back. The `filter` option takes a `String` value with the following syntax: -* `body` = to aggregate the message body -* `attachments` = to aggregate all the message attachments -* `headers` = to aggregate all the message headers -* `header:pattern` = to aggregate all the message headers that matches the pattern. +* `body` - to aggregate the message body. +* `attachments` - to aggregate all the message attachments. +* `headers` - to aggregate all the message headers. +* `header:pattern` - to aggregate all the message headers that matches the pattern. -The pattern rule supports wildcard and regular expression: +The pattern rule supports wildcards and regular expressions: -* wildcard match (pattern ends with a `*, and the name starts with the pattern) +* wildcard match (pattern ends with a `*`, and the name starts with the pattern) * regular expression match You can specify multiple rules separated by comma. @@ -97,15 +97,15 @@ header:foo If the filter rule is specified as empty or as wildcard then everything is merged. -Notice that when merging back data, then any existing data is overwritten, and any other existing data is preserved. +Notice that when merging back data, any data in the Message that is not overwritten is preserved. === Filtering with include and exclude patterns -The syntax also supports the following prefixes which can be used to specify include,exclude, or remove +The syntax also supports the following prefixes which can be used to specify include, exclude, or remove -* `+` = to include (which is the default mode) -* `-` = to exclude (exclude takes precedence over include) -* `--` = to remove (remove takes precedence) +* `+` to include (which is the default mode) +* `-` to exclude (exclude takes precedence over include) +* `--` to remove (remove takes precedence) For example to skip the message body, and merge back everything else @@ -114,14 +114,14 @@ For example to skip the message body, and merge back everything else -body -Or to skip the message header foo, and merge back everything else +Or to skip the message header foo and merge back everything else [source,text] -header:foo -You can also instruct removing headers when merging data back, for example to remove all headers starting with _bar_: +You can also remove headers when merging data back. For example, to remove all headers starting with _bar_: [source,text] @@ -132,8 +132,8 @@ Note you cannot have both include (`+`) and exclude (`-`) `header:pattern` at th == Dynamic keys -The claim check key are static, but you can use the `simple` language syntax to define dynamic keys, -for example to use a header from the message named `myKey`: +The claim check keys
[camel] branch main updated (1b0f4d5 -> ce5913e)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git. from 1b0f4d5 (chores) camel-lucene: code cleanups add ce5913e camel-salesforce: Incl error body in exception msg No new revisions were added by this update. Summary of changes: .../component/salesforce/internal/client/DefaultRestClient.java| 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-)
[camel] branch main updated: CAMEL-17365: camel-salesforce: Fixed CS.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new a415620 CAMEL-17365: camel-salesforce: Fixed CS. a415620 is described below commit a41562063335a323b053574e315d614c0f2b33d0 Author: Jeremy Ross AuthorDate: Sun Jan 9 13:10:17 2022 -0600 CAMEL-17365: camel-salesforce: Fixed CS. --- .../org/apache/camel/component/salesforce/RestApiIntegrationTest.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 5c3f727..722cd70 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 @@ -451,8 +451,7 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { @Test public void testGetResources() throws Exception { @SuppressWarnings("unchecked") -final Map resources = -(Map) template().requestBody("direct:getResources", ""); +final Map resources = (Map) template().requestBody("direct:getResources", ""); assertNotNull(resources); assertTrue(resources.containsKey("metadata")); }
[camel] branch main updated: CAMEL-17365: camel-salesforce: update doc for getResources
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 35d6238 CAMEL-17365: camel-salesforce: update doc for getResources 35d6238 is described below commit 35d62382686853581d07e2253fd203089aca4a03 Author: Jeremy Ross AuthorDate: Sun Jan 9 13:08:12 2022 -0600 CAMEL-17365: camel-salesforce: update doc for getResources --- .../src/main/docs/salesforce-component.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index e31a2b0..4a6e940 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -240,11 +240,11 @@ Type: `List` `getResources` -Lists available resources for the specified API version, including resource name and URI. +Lists available resources for the current API version, including resource name and URI. *Output* -Type: `RestResources` +Type: `Map` [[limits]] Limits
[camel] branch main updated: CAMEL-17365: camel-salesforce: getResources returns a Map
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 1d47ce9 CAMEL-17365: camel-salesforce: getResources returns a Map 1d47ce9 is described below commit 1d47ce957600a0256686a5c070effa0b8407fb1c Author: Jeremy Ross AuthorDate: Sun Jan 9 12:10:37 2022 -0600 CAMEL-17365: camel-salesforce: getResources returns a Map instead of hard-coded resources names that are difficult to keep up with. --- .../salesforce/api/dto/RestResources.java | 244 - .../internal/processor/JsonRestProcessor.java | 4 +- .../salesforce/RestApiIntegrationTest.java | 7 +- .../ROOT/pages/camel-3x-upgrade-guide-3_15.adoc| 4 + 4 files changed, 11 insertions(+), 248 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/RestResources.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/RestResources.java deleted file mode 100644 index 9c63ea7..000 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/RestResources.java +++ /dev/null @@ -1,244 +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.api.dto; - -import com.fasterxml.jackson.annotation.JsonProperty; - -/** - * DTO for Salesforce Resources. - */ -public class RestResources extends AbstractDTOBase { - -private String sobjects; -private String identity; -private String connect; -private String search; -private String query; -private String chatter; -private String recent; -private String tooling; -private String licensing; -private String analytics; -private String limits; -private String theme; -private String queryAll; -private String knowledgeManagement; -private String process; -private String flexiPage; -private String quickActions; -private String appMenu; -private String compactLayouts; -private String actions; -private String tabs; -private String wave; -@JsonProperty("async-queries") -private String asyncQueries; -@JsonProperty("exchange-connect") -private String exchangeConnect; - -public String getSobjects() { -return sobjects; -} - -public void setSobjects(String sobjects) { -this.sobjects = sobjects; -} - -public String getIdentity() { -return identity; -} - -public void setIdentity(String identity) { -this.identity = identity; -} - -public String getConnect() { -return connect; -} - -public void setConnect(String connect) { -this.connect = connect; -} - -public String getSearch() { -return search; -} - -public void setSearch(String search) { -this.search = search; -} - -public String getQuery() { -return query; -} - -public void setQuery(String query) { -this.query = query; -} - -public String getChatter() { -return chatter; -} - -public void setChatter(String chatter) { -this.chatter = chatter; -} - -public String getRecent() { -return recent; -} - -public void setRecent(String recent) { -this.recent = recent; -} - -public String getTooling() { -return tooling; -} - -public void setTooling(String tooling) { -this.tooling = tooling; -} - -public String getLicensing() { -return licensing; -} - -public void setLicensing(String licensing) { -this.licensing = licensing; -} - -public String getAnalytics() { -return analytics; -} - -public void setAnalytics(String analytics) { -this.analytics = analytics; -} - -public String getLimits() { -return limits; -} - -public void setLimits(String
[camel] branch main updated: CAMEL-11001: camel-salesforce: Add getting started
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new e94fae1 CAMEL-11001: camel-salesforce: Add getting started e94fae1 is described below commit e94fae17fee1be571cc9d74a9ad1cf1ffcdd8e3b Author: Jeremy Ross AuthorDate: Sat Jan 8 11:34:04 2022 -0600 CAMEL-11001: camel-salesforce: Add getting started Also remove redundant information in README.md that's already in the component doc. --- .../camel-salesforce-component/README.md | 66 +- .../src/main/docs/salesforce-component.adoc| 65 ++--- 2 files changed, 34 insertions(+), 97 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/README.md b/components/camel-salesforce/camel-salesforce-component/README.md index 3409020..c158667 100644 --- a/components/camel-salesforce/camel-salesforce-component/README.md +++ b/components/camel-salesforce/camel-salesforce-component/README.md @@ -1,71 +1,7 @@ # Camel Salesforce component # This component supports producer and consumer endpoints to communicate with Salesforce using Java DTOs. -There is a companion maven plugin [camel-salesforce-plugin](https://github.com/apache/camel/tree/main/components/camel-salesforce/camel-salesforce-maven-plugin) that generates these DTOs. - -The component supports the following Salesforce APIs - -## REST API ## - -Producer endpoints can use the following APIs. Most of the APIs process one record at a time, the Query API can retrieve multiple Records. - -* getVersions - Gets supported Salesforce REST API versions -* getResources - Gets available Salesforce REST Resource endpoints -* getGlobalObjects - Gets metadata for all available SObject types -* getBasicInfo - Gets basic metadata for a specific SObject type -* getDescription - Gets comprehensive metadata for a specific SObject type -* getSObject - Gets an SObject using its Salesforce Id -* createSObject - Creates an SObject -* updateSObject - Updates an SObject using Id -* deleteSObject - Deletes an SObject using Id -* getSObjectWithId - Gets an SObject using an external (user defined) id field -* upsertSObject - Updates or inserts an SObject using an external id -* deleteSObjectWithId - Deletes an SObject using an external id -* query - Runs a Salesforce SOQL query -* queryMore - Retrieves more results (in case of large number of results) using result link returned from the 'query' API -* search - Runs a Salesforce SOSL query - -For example, the following producer endpoint uses the upsertSObject API, with the sObjectIdName parameter specifying 'Name' as the external id field. -The request message body should be an SObject DTO generated using the maven plugin. -The response message will either be NULL if an existing record was updated, or [CreateSObjectResult] with an id of the new record, or a list of errors while creating the new object. - - ...to("salesforce:upsertSObject?sObjectIdName=Name")... - -## Bulk API ## - -Producer endpoints can use the following APIs. All Job data formats, i.e. xml, csv, zip/xml, and zip/csv are supported. -The request and response have to be marshalled/unmarshalled by the route. Usually the request will be some stream source like a CSV file, -and the response may also be saved to a file to be correlated with the request. - -* createJob - Creates a Salesforce Bulk Job -* getJob - Gets a Job using its Salesforce Id -* closeJob - Closes a Job -* abortJob - Aborts a Job -* createBatch - Submits a Batch within a Bulk Job -* getBatch - Gets a Batch using Id -* getAllBatches - Gets all Batches for a Bulk Job Id -* getRequest - Gets Request data (XML/CSV) for a Batch -* getResults - Gets the results of the Batch when its complete -* createBatchQuery - Creates a Batch from an SOQL query -* getQueryResultIds - Gets a list of Result Ids for a Batch Query -* getQueryResult - Gets results for a Result Id - -For example, the following producer endpoint uses the createBatch API to create a Job Batch. -The in message must contain a body that can be converted into an InputStream (usually UTF-8 CSV or XML content from a file, etc.) and header fields 'jobId' for the Job and 'contentType' for the Job content type, which can be XML, CSV, ZIP\_XML or ZIP\_CSV. The put message body will contain [BatchInfo] on success, or throw a [SalesforceException] on error. - - ...to("salesforce:createBatchJob").. - -## Streaming API ## - -Consumer endpoints can use the following syntax for streaming endpoints to receive Salesforce notifications on create/update. - -To create and subscribe to a topic - - from("salesforce:CamelTestTopic?notifyForFields=ALL¬ifyForOperations=ALL&sObjectName=Merchandise__c&updateTopic=
[camel] branch main updated: camel-salesforce: doc fix
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 4ff1476 camel-salesforce: doc fix 4ff1476 is described below commit 4ff1476979a0f66cf7015330c52204be9c4ed77a Author: Jeremy Ross AuthorDate: Mon Jan 3 08:37:08 2022 -0600 camel-salesforce: doc fix Output type for CDC consumer was incorrect. --- .../camel-salesforce-component/src/main/docs/salesforce-component.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index 88607d2..b8b6fce 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -1693,7 +1693,7 @@ The dynamic nature of change event body fields, high level replication steps as *Output* -Type: `PlatformEvent` or `org.cometd.bayeux.Message` +Type: `Map` or `org.cometd.bayeux.Message` Headers |===
[camel] branch main updated: camel-salesforce: Should return null
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 9c9e09c camel-salesforce: Should return null 9c9e09c is described below commit 9c9e09c53d492df2d9af7080f05b3f25aadd8a60 Author: Jeremy Ross AuthorDate: Sun Jan 2 13:36:30 2022 -0600 camel-salesforce: Should return null In case of NotFoundBehaviour.NULL --- .../internal/processor/JsonRestProcessor.java | 2 ++ .../salesforce/NotFoundIntegrationTest.java | 21 + 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java index 08c7572..cb0a1b7 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/JsonRestProcessor.java @@ -188,6 +188,8 @@ public class JsonRestProcessor extends AbstractRestProcessor { // if an exception is reported we should not loose it if (shouldReport(ex)) { exchange.setException(ex); +} else { +out.setBody(null); } } else if (responseEntity != null) { // do we need to un-marshal a response diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/NotFoundIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/NotFoundIntegrationTest.java index 92daefe..b005026 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/NotFoundIntegrationTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/NotFoundIntegrationTest.java @@ -19,8 +19,7 @@ package org.apache.camel.component.salesforce; import org.apache.camel.CamelExecutionException; import org.apache.camel.component.salesforce.api.NoSuchSObjectException; import org.apache.camel.component.salesforce.dto.generated.Account; -import org.junit.jupiter.params.ParameterizedTest; -import org.junit.jupiter.params.provider.ValueSource; +import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -28,22 +27,20 @@ import static org.junit.jupiter.api.Assertions.fail; public class NotFoundIntegrationTest extends AbstractSalesforceTestBase { -@ParameterizedTest -@ValueSource(strings = { "XML", "JSON" }) -public void shouldNotReportNotFoundExceptionFromRestApiIfConfiguredNotTo(String format) { -final Account got = template.requestBody("salesforce:getSObjectWithId?sObjectName=Account&sObjectIdName=Name&format=" - + format + "¬FoundBehaviour=NULL", -"NonExistant", +@Test +public void shouldNotReportNotFoundExceptionFromRestApiIfConfiguredNotTo() { +final Account got = template.requestBody("salesforce:getSObjectWithId?sObjectName=Account&sObjectIdName=Name" + + "¬FoundBehaviour=NULL", +"NonExistent", Account.class); assertNull(got, "Expecting null when `notFoundBehaviour` is set to NULL"); } -@ParameterizedTest -@ValueSource(strings = { "XML", "JSON" }) -public void shouldReportNotFoundExceptionFromRestApi(String format) { +@Test +public void shouldReportNotFoundExceptionFromRestApi() { try { - template.requestBody("salesforce:getSObjectWithId?sObjectName=Account&sObjectIdName=Name&format=" + format, + template.requestBody("salesforce:getSObjectWithId?sObjectName=Account&sObjectIdName=Name", "NonExistant", Account.class); fail("Expecting CamelExecutionException"); } catch (final CamelExecutionException e) {
[camel] branch main updated: CAMEL-11001: camel-salesforce: Improve docs
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 1ddab98 CAMEL-11001: camel-salesforce: Improve docs 1ddab98 is described below commit 1ddab988122554b58b51d89ba79a5ad2e03cac8e Author: Jeremy Ross AuthorDate: Sat Jan 1 22:39:46 2022 -0600 CAMEL-11001: camel-salesforce: Improve docs * Document all operations incl inputs, headers and output * Organize operations by API * Move disjointed information to appropriate sections * Corrections and polish --- .../src/main/docs/salesforce-component.adoc| 2039 +++- .../internal/processor/AbstractRestProcessor.java |6 +- 2 files changed, 1537 insertions(+), 508 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index 2a45ef4..6db534b 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -14,22 +14,8 @@ *{component-header}* This component supports producer and consumer endpoints to communicate -with Salesforce using Java DTOs. + - There is a companion maven plugin Camel Salesforce Plugin that -generates these DTOs (see further below). - -Maven users will need to add the following dependency to their `pom.xml` -for this component: - -[source,xml] - - -org.apache.camel -camel-salesforce -x.x.x - - - +with Salesforce using Java DTOs. There is a companion <> that +generates these DTOs. [NOTE] @@ -61,11 +47,12 @@ The component supports three OAuth authentication flows: * https://help.salesforce.com/articleView?id=remoteaccess_oauth_refresh_token_flow.htm[OAuth 2.0 Refresh Token Flow] * https://help.salesforce.com/articleView?id=remoteaccess_oauth_jwt_flow.htm[OAuth 2.0 JWT Bearer Token Flow] -For each of the flow different set of properties needs to be set: +For each of the flows, different sets of properties needs to be set: .Properties to set for each authentication flow |=== | Property | Where to find it on Salesforce | Flow + | clientId | Connected App, Consumer Key| All flows | clientSecret | Connected App, Consumer Secret | Username-Password, Refresh Token | userName | Salesforce user username | Username-Password, JWT Bearer Token @@ -74,8 +61,8 @@ For each of the flow different set of properties needs to be set: | keystore | Connected App, Digital Certificate | JWT Bearer Token |=== -The component auto determines what flow you're trying to configure, to -be remove ambiguity set the `authenticationType` property. +The component auto determines what flow you're trying to configure. In order to be explicit, set the +`authenticationType` property. [NOTE] @@ -84,12 +71,14 @@ Using Username-Password Flow in production is not encouraged. [NOTE] -The certificate used in JWT Bearer Token Flow can be a selfsigned +The certificate used in JWT Bearer Token Flow can be a self-signed certificate. The KeyStore holding the certificate and the private key must contain only single certificate-private key entry. -== URI format +== General Usage + +=== URI format When used as a consumer, receiving streaming events, the URI scheme is: @@ -104,7 +93,16 @@ scheme is: salesforce:operationName?options -== Passing in Salesforce headers and fetching Salesforce response headers +As a general example on using the operations in this salesforce component, the following producer endpoint uses +the upsertSObject API, with the sObjectIdName parameter specifying 'Name' as the external id field. +The request message body should be an SObject DTO generated using the maven plugin. + +[source,java] + +...to("salesforce:upsertSObject?sObjectIdName=Name")... + + +=== Passing in Salesforce headers and fetching Salesforce response headers There is support to pass https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/headers.htm[Salesforce headers] via inbound message headers, header names that start with `Sforce` or @@ -135,252 +133,97 @@ class MyProcessor implements Processor { In addition, HTTP response status code and text are available as headers `Exchange.HTTP_RESPONSE_CODE` and `Exchange.HTTP_RESPONSE_TEXT`. -== Supported Salesforce APIs - -The component supports the following Salesforce APIs - -Producer endpoints can use the following APIs. Most of the APIs process -one record at a time, the Query API can retrieve multiple Records. - -=== Rest API - -You can use the following for `operationName
[camel] branch main updated: CAMEL-13180: camel-salesforce: Custom errors (#6549)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 64a3adf CAMEL-13180: camel-salesforce: Custom errors (#6549) 64a3adf is described below commit 64a3adfdb9cab8814ca298b137f3d8e151440dff Author: Jeremy Ross AuthorDate: Fri Dec 17 08:49:12 2021 -0600 CAMEL-13180: camel-salesforce: Custom errors (#6549) In case of non-2xx responses to Apex REST requests, preserve the response content since it won't necessarily be in the standard salesforce exception format. --- .../salesforce/api/SalesforceException.java| 23 ++ .../internal/client/DefaultRestClient.java | 15 -- .../salesforce/RestApiIntegrationTest.java | 11 +++ .../salesforce/classes/MerchandiseRestResource.cls | 10 -- 4 files changed, 51 insertions(+), 8 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/SalesforceException.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/SalesforceException.java index d6c52d0..529c094 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/SalesforceException.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/SalesforceException.java @@ -16,6 +16,7 @@ */ package org.apache.camel.component.salesforce.api; +import java.io.InputStream; import java.util.Collections; import java.util.List; @@ -28,6 +29,7 @@ public class SalesforceException extends CamelException { private final List errors; private final int statusCode; +private final InputStream responseContent; public SalesforceException(Throwable cause) { this(null, 0, null, cause); @@ -38,7 +40,7 @@ public class SalesforceException extends CamelException { } public SalesforceException(String message, int statusCode) { -this(null, statusCode, message, null); +this(null, statusCode, message, (InputStream) null); } public SalesforceException(String message, int statusCode, Throwable cause) { @@ -46,7 +48,7 @@ public class SalesforceException extends CamelException { } public SalesforceException(List errors, int statusCode) { -this(errors, statusCode, null, null); +this(errors, statusCode, null, (InputStream) null); } public SalesforceException(List errors, int statusCode, Throwable cause) { @@ -54,13 +56,23 @@ public class SalesforceException extends CamelException { } public SalesforceException(List errors, int statusCode, String message) { -this(errors, statusCode, message, null); +this(errors, statusCode, message, null, null); +} + +public SalesforceException(List errors, int statusCode, String message, InputStream responseContent) { +this(errors, statusCode, message, responseContent, null); } public SalesforceException(List errors, int statusCode, String message, Throwable cause) { +this(errors, statusCode, message, null, cause); +} + +public SalesforceException(List errors, int statusCode, String message, InputStream responseContent, + Throwable cause) { super(message == null ? toErrorMessage(errors, statusCode) : message, cause); this.errors = errors; this.statusCode = statusCode; +this.responseContent = responseContent; } public List getErrors() { @@ -71,6 +83,10 @@ public class SalesforceException extends CamelException { return statusCode; } +public InputStream getResponseContent() { +return responseContent; +} + private static String toErrorMessage(List errors, int statusCode) { StringBuilder builder = new StringBuilder("{"); if (errors != null) { @@ -86,5 +102,4 @@ public class SalesforceException extends CamelException { return builder.toString(); } - } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultRestClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultRestClient.java index 8abaadf..89fab53 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultRestClient.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultRestClient.java @@ -89,14 +89,25
[camel] branch main updated: fix untested adoc edits (#6550)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 00fae34 fix untested adoc edits (#6550) 00fae34 is described below commit 00fae34bc56ad46f46e736e1d01a9d7716f34964 Author: djencks AuthorDate: Thu Dec 16 15:37:13 2021 -0800 fix untested adoc edits (#6550) --- .../camel-salesforce-component/src/main/docs/salesforce-component.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index 94c3911..493e785 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -421,7 +421,7 @@ salesforce:apexCall[/yourApexRestUrl][?options] You can supply the apexUrl either in the endpoint (see above), or as the `apexUrl` option as listed in the table below. -In either case the Apex URL can contain placeholders in the format of `{headerName}`. E.g., for the Apex URL `MyApexClass/{id}`, +In either case the Apex URL can contain placeholders in the format of `\{headerName}`. E.g., for the Apex URL `MyApexClass/\{id}`, the value of the header named `id` will be used to replace the placeholder. |===
[camel] branch main updated: camel-salesforce: Document apexCall operation
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 43ddb34 camel-salesforce: Document apexCall operation 43ddb34 is described below commit 43ddb349bafeed4a7defb667f834a5f086b22d5b Author: Jeremy Ross AuthorDate: Thu Dec 16 12:26:25 2021 -0600 camel-salesforce: Document apexCall operation --- .../src/main/docs/salesforce-component.adoc | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index d6a5f3f..94c3911 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -429,12 +429,12 @@ the value of the header named `id` will be used to replace the placeholder. | request body | `Map` if `GET`, otherwise `String` or `InputStream`| In the case of a `GET`, the body (`Map` instance) is transformed into query parameters. For other HTTP methods, the body is used for the HTTP body. | | -| `apexUrl` | `String` | The portion of the endpoint URL after `https://instance.salesforce.com/services/apexrest/`, e.g., 'MyApexClass/' | | +| `apexUrl` | `String` | The portion of the endpoint URL after `https://instance.salesforce.com/services/apexrest/`, e.g., 'MyApexClass/' | | Yes, unless supplied in endpoint | `apexMethod` | `String` | The HTTP method (e.g. `GET`, `POST`) to use. | `GET` | | `rawPayload` | `Boolean` | If true, Camel will not serialize the request or response bodies. | false | -| Header: `apexQueryParam.[paramName]` | Object | Headers that override apex parameters passed in the endpoint. | false | -| `sObjectName` | `String` | Name of sObject (e.g. `Merchandise__c`) used to deserialize the response | false | -| `sObjectClass` | `String` | Fully qualified class name used to deserialize the response | false | +| Header: `apexQueryParam.[paramName]` | Object | Headers that override apex parameters passed in the endpoint. | | +| `sObjectName` | `String` | Name of sObject (e.g. `Merchandise__c`) used to deserialize the response | | If `rawPayload` is false and `sObjectClass` not supplied +| `sObjectClass` | `String` | Fully qualified class name used to deserialize the response | | If `rawPayload` is false and `sObjectName` not supplied |===
[camel] branch main updated: camel-salesforce: Document apexCall operation
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 65f2065 camel-salesforce: Document apexCall operation 65f2065 is described below commit 65f20650430657de9b7145c2b3fa50cd645492c6 Author: Jeremy Ross AuthorDate: Thu Dec 16 12:20:26 2021 -0600 camel-salesforce: Document apexCall operation --- .../src/main/docs/salesforce-component.adoc| 111 + 1 file changed, 70 insertions(+), 41 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index 189a51b..d6a5f3f 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -380,47 +380,6 @@ The https://developer.salesforce.com/docs/atlas.en-us.change_data_capture.meta/c is a good fit to better know the subtleties of implementing a change data capture integration application. The dynamic nature of change event body fields, high level replication steps as well as security considerations could be of interest. -== Examples - -=== Uploading a document to a ContentWorkspace - -Create the ContentVersion in Java, using a Processor instance: - -[source,java] - -public class ContentProcessor implements Processor { -public void process(Exchange exchange) throws Exception { -Message message = exchange.getIn(); - -ContentVersion cv = new ContentVersion(); -ContentWorkspace cw = getWorkspace(exchange); -cv.setFirstPublishLocationId(cw.getId()); -cv.setTitle("test document"); -cv.setPathOnClient("test_doc.html"); -byte[] document = message.getBody(byte[].class); -ObjectMapper mapper = new ObjectMapper(); -String enc = mapper.convertValue(document, String.class); -cv.setVersionDataUrl(enc); -message.setBody(cv); -} - -protected ContentWorkspace getWorkSpace(Exchange exchange) { -// Look up the content workspace somehow, maybe use enrich() to add it to a -// header that can be extracted here - -} -} - - -Give the output from the processor to the Salesforce component: - -[source,java] - -from("file:///home/camel/library") -.to(new ContentProcessor()) // convert bytes from the file into a ContentVersion SObject -// for the salesforce component -.to("salesforce:createSObject"); - == Using Salesforce Limits API @@ -450,6 +409,36 @@ from("direct:querySalesforce") .endChoice() +== Invoking Apex REST endpoints + +You can https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_intro.htm[expose your Apex class and methods] +so that external applications can access your code and your application through the REST architecture. + +The URI format for invoking Apex REST is: + + +salesforce:apexCall[/yourApexRestUrl][?options] + + +You can supply the apexUrl either in the endpoint (see above), or as the `apexUrl` option as listed in the table below. +In either case the Apex URL can contain placeholders in the format of `{headerName}`. E.g., for the Apex URL `MyApexClass/{id}`, +the value of the header named `id` will be used to replace the placeholder. + +|=== +| Parameter | Type | Description| Default| Required + +| request body | `Map` if `GET`, otherwise `String` or `InputStream`| In the case of a `GET`, the body (`Map` instance) +is transformed into query parameters. For other HTTP methods, the body is used for the HTTP body. | | +| `apexUrl` | `String` | The portion of the endpoint URL after `https://instance.salesforce.com/services/apexrest/`, e.g., 'MyApexClass/' | | +| `apexMethod` | `String` | The HTTP method (e.g. `GET`, `POST`) to use. | `GET` | +| `rawPayload` | `Boolean` | If true, Camel will not serialize the request or response bodies. | false | +| Header: `apexQueryParam.[paramName]` | Object | Headers that override apex parameters passed in the endpoint. | false | +| `sObjectName` | `String` | Name of sObject (e.g. `Merchandise__c`) used to deserialize the response | false | +| `sObjectClass` | `String` | Fully qualified class name used to deserialize the response | false | +|=== + + + == Working with approvals All the properties are named exactly the same as in the Salesforce REST API prefixed with `approval.`. You can set @@ -799,6 +788,46 @@ send null values to salesforce, use the `fieldsToNull` property, as follows: accountSObject.getFieldsToNull().add("Site"); +== Uploading
[camel] branch main updated: camel-salesforce: Update URLs
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 6ad9347 camel-salesforce: Update URLs 6ad9347 is described below commit 6ad934779497cfaae7afcc00b408a6f3887ce7d8 Author: Jeremy Ross AuthorDate: Thu Dec 16 11:26:29 2021 -0600 camel-salesforce: Update URLs Doc URLs have changed. --- .../org/apache/camel/component/salesforce/RestApiIntegrationTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 d12d70c..de74c01 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 @@ -76,7 +76,7 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { /** * Request DTO for Salesforce APEX REST calls. See - * https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_rest_methods.htm. + * https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm. */ public static class MerchandiseRequest extends AbstractDTOBase { private Merchandise__c merchandise; @@ -96,7 +96,7 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { /** * Response DTO for Salesforce APEX REST calls. See - * https://www.salesforce.com/us/developer/docs/apexcode/Content/apex_rest_methods.htm. + * https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_rest_methods.htm. */ public static class MerchandiseResponse extends Merchandise__c { // XML response contains a type string with the SObject type name
[camel] branch main updated: camel-salesforce: Fix test.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new b1faad4 camel-salesforce: Fix test. b1faad4 is described below commit b1faad40fe224c00a7bda90ab07a756ebb7c1ec5 Author: Jeremy Ross AuthorDate: Thu Dec 16 11:01:36 2021 -0600 camel-salesforce: Fix test. --- .../org/apache/camel/component/salesforce/RestApiIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 31afd77..d12d70c 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 @@ -803,7 +803,7 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { + Merchandise__c.class.getName()); from("direct:apexCallPatch").to("salesforce:apexCall/Merchandise/" -+ "&apexMethod=PATCH&sObjectClass=" + MerchandiseResponse.class.getName()); ++ "?apexMethod=PATCH&sObjectClass=" + MerchandiseResponse.class.getName()); from("direct:createSObjectContinueOnException").onException(Exception.class).continued(true).end() .to("salesforce:createSObject");
[camel] 01/02: CAMEL-17344: camel-salesforce: swallowing exceptions
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit c08783523cdc4e2e4f2b5ded56f0a27e4e72c024 Author: Jeremy Ross AuthorDate: Wed Dec 15 12:24:33 2021 -0600 CAMEL-17344: camel-salesforce: swallowing exceptions collections operations swallow exceptions --- ...efaultCompositeSObjectCollectionsApiClient.java | 34 +- .../CompositeSObjectCollectionsProcessor.java | 2 +- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java index 75c575a..953ac60 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java @@ -85,11 +85,11 @@ public class DefaultCompositeSObjectCollectionsApiClient extends AbstractClientB doHttpRequest(request, new ClientResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException ex) { -callback.onResponse( -tryToReadListResponse( -sobjectType, response), -headers, -ex); +Optional> body = Optional.empty(); +if (ex == null) { +body = tryToReadListResponse(sobjectType, response); +} +callback.onResponse(body, headers, ex); } }); } @@ -124,9 +124,11 @@ public class DefaultCompositeSObjectCollectionsApiClient extends AbstractClientB doHttpRequest(request, new ClientResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException ex) { -callback.onResponse( -tryToReadListResponse(SaveSObjectResult.class, response), -headers, ex); +Optional> body = Optional.empty(); +if (ex == null) { +body = tryToReadListResponse(SaveSObjectResult.class, response); +} +callback.onResponse(body, headers, ex); } }); } @@ -152,9 +154,11 @@ public class DefaultCompositeSObjectCollectionsApiClient extends AbstractClientB doHttpRequest(request, new ClientResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException ex) { -callback.onResponse( -tryToReadListResponse(UpsertSObjectResult.class, response), -headers, ex); +Optional> body = Optional.empty(); +if (ex == null) { +body = tryToReadListResponse(UpsertSObjectResult.class, response); +} +callback.onResponse(body, headers, ex); } }); } @@ -172,9 +176,11 @@ public class DefaultCompositeSObjectCollectionsApiClient extends AbstractClientB doHttpRequest(request, new ClientResponseCallback() { @Override public void onResponse(InputStream response, Map headers, SalesforceException ex) { -callback.onResponse( -tryToReadListResponse(DeleteSObjectResult.class, response), -headers, ex); +Optional> body = Optional.empty(); +if (ex == null) { +body = tryToReadListResponse(DeleteSObjectResult.class, response); +} +callback.onResponse(body, headers, ex); } }); } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java index 98319a7..03d6a20 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesfo
[camel] branch main updated (0bd749e -> 5882290)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git. from 0bd749e Regen for commit ca1b9fe47a297fa1524687c1597da8fb23954d2e new c087835 CAMEL-17344: camel-salesforce: swallowing exceptions new 5882290 CAMEL-17346: camel-salesforce: expired passwords The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: ...efaultCompositeSObjectCollectionsApiClient.java | 34 +- .../internal/client/SalesforceSecurityHandler.java | 34 ++ .../CompositeSObjectCollectionsProcessor.java | 2 +- 3 files changed, 55 insertions(+), 15 deletions(-)
[camel] 02/02: CAMEL-17346: camel-salesforce: expired passwords
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit 58822906704efd99470aec37430a12afa86e3dbc Author: Jeremy Ross AuthorDate: Wed Dec 15 13:36:51 2021 -0600 CAMEL-17346: camel-salesforce: expired passwords Better handling for 401 expired password. --- .../internal/client/SalesforceSecurityHandler.java | 34 ++ 1 file changed, 34 insertions(+) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/SalesforceSecurityHandler.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/SalesforceSecurityHandler.java index 62633be..375cfda 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/SalesforceSecurityHandler.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/SalesforceSecurityHandler.java @@ -16,10 +16,15 @@ */ package org.apache.camel.component.salesforce.internal.client; +import java.io.IOException; import java.io.InputStream; +import java.util.Collections; +import java.util.List; +import com.fasterxml.jackson.databind.ObjectMapper; import org.apache.camel.component.salesforce.SalesforceHttpClient; import org.apache.camel.component.salesforce.api.SalesforceException; +import org.apache.camel.component.salesforce.api.dto.RestError; import org.apache.camel.component.salesforce.internal.SalesforceSession; import org.eclipse.jetty.client.HttpContentResponse; import org.eclipse.jetty.client.HttpConversation; @@ -45,12 +50,14 @@ public class SalesforceSecurityHandler implements ProtocolHandler { private static final Logger LOG = LoggerFactory.getLogger(SalesforceSecurityHandler.class); private static final String AUTHENTICATION_RETRIES_ATTRIBUTE = SalesforceSecurityHandler.class.getName().concat(".retries"); +private static final String EXPIRED_PASSWORD_CODE = "INVALID_OPERATION_WITH_EXPIRED_PASSWORD"; private final SalesforceHttpClient httpClient; private final SalesforceSession session; private final int maxAuthenticationRetries; private final int maxContentLength; private final ResponseNotifier notifier; +private final ObjectMapper objectMapper = new ObjectMapper(); public SalesforceSecurityHandler(SalesforceHttpClient httpClient) { @@ -159,6 +166,22 @@ public class SalesforceSecurityHandler implements ProtocolHandler { // request failed authentication? if (status == HttpStatus.UNAUTHORIZED_401) { +// Salesforce will allow successful login with an expired password, but any subsequent +// API calls will fail with a 401 and message about expired password. +// It's fatal. User must reset password. +List errors = Collections.emptyList(); +try { +errors = client.readErrorsFrom(getContentAsInputStream(), objectMapper); +} catch (IOException e) { +LOG.warn("Unable to deserialize errors from response body."); +} +if (errors.stream().anyMatch(error -> EXPIRED_PASSWORD_CODE.equals(error.getErrorCode( { +SalesforceException salesforceException = createSalesforceException(client, status, +reason); +forwardFailureComplete(request, null, response, salesforceException); +return; +} + // REST token expiry LOG.warn("Retrying on Salesforce authentication error [{}]: [{}]", status, reason); @@ -188,6 +211,16 @@ public class SalesforceSecurityHandler implements ProtocolHandler { } } +private SalesforceException createSalesforceException(AbstractClientBase client, int statusCode, String reason) { +List restErrors = Collections.emptyList(); +try { +restErrors = client.readErrorsFrom(getContentAsInputStream(), new ObjectMapper()); +} catch (IOException e) { +LOG.warn("Unable to deserialize errors from response body."); +} +return new SalesforceException(restErrors, statusCode); +} + protected void retryOnFailure( SalesforceHttpRequest request, HttpConversation conversation, Integer retries, AbstractClientBase client, Throwable failure) { @@ -286,6 +319,7 @@ public class SalesforceSecurityHandler implements ProtocolHandler { notifier.forwardFailureComplete(conversation.
[camel] branch camel-3.14.x updated: CAMEL-17336: camel-jackson: useList has no effect (#6540)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch camel-3.14.x in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/camel-3.14.x by this push: new 2e69826 CAMEL-17336: camel-jackson: useList has no effect (#6540) 2e69826 is described below commit 2e6982655246d1a6507ba582781ddb495b133d07 Author: Jeremy Ross AuthorDate: Tue Dec 14 12:35:24 2021 -0600 CAMEL-17336: camel-jackson: useList has no effect (#6540) If an ObjectMapper from the registry is used, useList=true has no effect. --- .../apache/camel/component/jackson/AbstractJacksonDataFormat.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java index 67f838d6..b338ca9 100644 --- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java +++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java @@ -533,6 +533,10 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport @Override protected void doStart() throws Exception { +if (useList) { +setCollectionType(ArrayList.class); +} + boolean objectMapperFoundRegistry = false; if (objectMapper == null) { // lookup if there is a single default mapper we can use @@ -559,9 +563,6 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport } if (!objectMapperFoundRegistry) { -if (useList) { -setCollectionType(ArrayList.class); -} if (include != null) { JsonInclude.Include inc = getCamelContext().getTypeConverter().mandatoryConvertTo(JsonInclude.Include.class, include);
[camel] branch main updated: CAMEL-17336: camel-jackson: useList has no effect (#6540)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 88c6b22 CAMEL-17336: camel-jackson: useList has no effect (#6540) 88c6b22 is described below commit 88c6b2239df5d36c955ed10b141d1fc92de5b02c Author: Jeremy Ross AuthorDate: Tue Dec 14 12:35:24 2021 -0600 CAMEL-17336: camel-jackson: useList has no effect (#6540) If an ObjectMapper from the registry is used, useList=true has no effect. --- .../apache/camel/component/jackson/AbstractJacksonDataFormat.java | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java index 67f838d6..b338ca9 100644 --- a/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java +++ b/components/camel-jackson/src/main/java/org/apache/camel/component/jackson/AbstractJacksonDataFormat.java @@ -533,6 +533,10 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport @Override protected void doStart() throws Exception { +if (useList) { +setCollectionType(ArrayList.class); +} + boolean objectMapperFoundRegistry = false; if (objectMapper == null) { // lookup if there is a single default mapper we can use @@ -559,9 +563,6 @@ public abstract class AbstractJacksonDataFormat extends ServiceSupport } if (!objectMapperFoundRegistry) { -if (useList) { -setCollectionType(ArrayList.class); -} if (include != null) { JsonInclude.Include inc = getCamelContext().getTypeConverter().mandatoryConvertTo(JsonInclude.Include.class, include);
[camel] branch main updated: camel-salesforce: Better exception messages.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new e5b03fd camel-salesforce: Better exception messages. e5b03fd is described below commit e5b03fdb2ff1fcbddc6bda40da385b244b8347f9 Author: Jeremy Ross AuthorDate: Mon Dec 6 10:31:01 2021 -0600 camel-salesforce: Better exception messages. --- .../salesforce/internal/client/DefaultCompositeApiClient.java | 3 ++- .../camel/component/salesforce/internal/client/DefaultRestClient.java | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeApiClient.java index 9555bfd..29e7d1e 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeApiClient.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeApiClient.java @@ -246,7 +246,8 @@ public class DefaultCompositeApiClient extends AbstractClientBase implements Com final String reason = response.getReason(); -return new SalesforceException(errors, status, "Unexpected error: " + reason); +return new SalesforceException( +errors, status, "Unexpected error: " + reason + ". See exception `errors` property for detail."); } @Override diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultRestClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultRestClient.java index f975a18..8abaadf 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultRestClient.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultRestClient.java @@ -94,7 +94,9 @@ public class DefaultRestClient extends AbstractClientBase implements RestClient return new NoSuchSObjectException(restErrors); } -return new SalesforceException(restErrors, statusCode); +return new SalesforceException( +restErrors, statusCode, +"Unexpected error: " + reason + ". See exception `errors` property for detail."); } } } catch (IOException e) {
[camel] branch main updated: camel-salesforce: Doc fix.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new dca7e5f camel-salesforce: Doc fix. dca7e5f is described below commit dca7e5f57fa5aad31173cb0e7be0ed20764a Author: Jeremy Ross AuthorDate: Sun Dec 5 19:54:23 2021 -0600 camel-salesforce: Doc fix. --- .../camel-salesforce-component/src/main/docs/salesforce-component.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index 70b6073..189a51b 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -785,7 +785,7 @@ Delete up to 200 records, returning a list of DeleteSObjectResult objects. Mixed | Parameter | Type | Description | Default | Required | `sObjectIds` or request body | List of String or comma-separated string | A list of up to 200 IDs of objects to be deleted. | | x -| `allOrNone` | boolean | Indicates whether to roll back the entire request when the upsert of any object fails (true) or to continue with the independent upsert of other objects in the request. | false | +| `allOrNone` | boolean | Indicates whether to roll back the entire request when the deletion of any object fails (true) or to continue with the independent deletion of other objects in the request. | false | |===
[camel] 01/02: camel-salesforce: Fix allOrNone option
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit 2df724d5b357da7118e4b0c14b7c0da899089ced Author: Jeremy Ross AuthorDate: Sun Dec 5 16:15:38 2021 -0600 camel-salesforce: Fix allOrNone option It shouldn't come from message body. --- .../internal/processor/CompositeSObjectCollectionsProcessor.java| 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java index 276007a..98319a7 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/processor/CompositeSObjectCollectionsProcessor.java @@ -144,7 +144,7 @@ public class CompositeSObjectCollectionsProcessor extends AbstractSalesforceProc throws SalesforceException { List ids = getListParameter(SalesforceEndpointConfig.SOBJECT_IDS, exchange, USE_BODY, NOT_OPTIONAL); boolean allOrNone = Boolean.parseBoolean( -getParameter(SalesforceEndpointConfig.ALL_OR_NONE, exchange, USE_BODY, IS_OPTIONAL)); +getParameter(SalesforceEndpointConfig.ALL_OR_NONE, exchange, IGNORE_BODY, IS_OPTIONAL)); compositeClient.submitDeleteCompositeCollections(ids, allOrNone, determineHeaders(exchange), (response, responseHeaders, exception) -> processResponse(exchange, response, responseHeaders, exception, callback));
[camel] branch main updated (8c5d470 -> dfc3526)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git. from 8c5d470 Regen for commit f6f122954698bd32c6f90c1c7bfc7fe20d685c3d new 2df724d camel-salesforce: Fix allOrNone option new dfc3526 camel-salesforce: Doc fix. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../src/main/docs/salesforce-component.adoc | 4 ++-- .../internal/processor/CompositeSObjectCollectionsProcessor.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
[camel] 02/02: camel-salesforce: Doc fix.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit dfc3526238f82130a51628072c7f4fec07d5c50b Author: Jeremy Ross AuthorDate: Sun Dec 5 16:16:10 2021 -0600 camel-salesforce: Doc fix. --- .../src/main/docs/salesforce-component.adoc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index f25af90..70b6073 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -784,8 +784,8 @@ Delete up to 200 records, returning a list of DeleteSObjectResult objects. Mixed |=== | Parameter | Type | Description | Default | Required -| ids | List of String or comma-separated string | A list of up to 200 IDs of objects to be deleted. | | x -| allOrNone | boolean | Indicates whether to roll back the entire request when the upsert of any object fails (true) or to continue with the independent upsert of other objects in the request. | false | +| `sObjectIds` or request body | List of String or comma-separated string | A list of up to 200 IDs of objects to be deleted. | | x +| `allOrNone` | boolean | Indicates whether to roll back the entire request when the upsert of any object fails (true) or to continue with the independent upsert of other objects in the request. | false | |===
[camel] branch main updated: CAMEL-11078: camel-salesforce: Expose HTTP response code/message.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new fdf484e CAMEL-11078: camel-salesforce: Expose HTTP response code/message. fdf484e is described below commit fdf484e9244f5bf12ed346cbe0486ebf18b77aa2 Author: Jeremy Ross AuthorDate: Tue Nov 16 13:21:21 2021 -0600 CAMEL-11078: camel-salesforce: Expose HTTP response code/message. --- .../src/main/docs/salesforce-component.adoc| 3 +++ .../salesforce/internal/client/AbstractClientBase.java | 2 ++ .../camel/component/salesforce/RestApiIntegrationTest.java | 10 ++ 3 files changed, 15 insertions(+) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc index fc310d0..1506fc0 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc +++ b/components/camel-salesforce/camel-salesforce-component/src/main/docs/salesforce-component.adoc @@ -133,6 +133,9 @@ class MyProcessor implements Processor { } +In addition, HTTP response status code and text are available as headers `Exchange.HTTP_RESPONSE_CODE` and +`Exchange.HTTP_RESPONSE_TEXT`. + == Supported Salesforce APIs The component supports the following Salesforce APIs diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java index 28aa214..66f0610 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/AbstractClientBase.java @@ -305,6 +305,8 @@ public abstract class AbstractClientBase extends ServiceSupport answer.put(headerName, header.getValue()); } } +answer.put(Exchange.HTTP_RESPONSE_CODE, String.valueOf(response.getStatus())); +answer.put(Exchange.HTTP_RESPONSE_TEXT, response.getReason()); return answer; } 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 362f88e..31afd77 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 @@ -26,6 +26,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import org.apache.camel.CamelExecutionException; +import org.apache.camel.Exchange; import org.apache.camel.Processor; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.salesforce.api.NoSuchSObjectException; @@ -50,6 +51,7 @@ import org.apache.camel.component.salesforce.dto.generated.QueryRecordsContact; import org.apache.camel.component.salesforce.dto.generated.QueryRecordsLine_Item__c; import org.apache.camel.component.salesforce.dto.generated.Task; import org.apache.camel.component.salesforce.dto.generated.User; +import org.apache.camel.support.DefaultExchange; import org.apache.camel.support.jsse.SSLContextParameters; import org.eclipse.jetty.client.HttpClient; import org.eclipse.jetty.client.api.ContentResponse; @@ -204,6 +206,14 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase { } @Test +public void returnsHttpResponseStatusAndText() { +Exchange exchange = new DefaultExchange(context); +template().send("direct:query", exchange); +assertEquals("200", exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_CODE)); + assertNotNull(exchange.getOut().getHeader(Exchange.HTTP_RESPONSE_TEXT)); +} + +@Test public void testCreateUpdateDelete() throws Exception { final Merchandise__c merchandise = new Merchandise__c(); merchandise.setName("Wee Wee Wee Plane");
[camel] branch main updated: CAMEL-17195: camel-salesforce: Recover from invalid replayId
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 8050b827 CAMEL-17195: camel-salesforce: Recover from invalid replayId 8050b827 is described below commit 8050b82724b10b4de8cb22e16e4a513bf66f1eb9 Author: Jeremy Ross AuthorDate: Tue Nov 16 11:22:09 2021 -0600 CAMEL-17195: camel-salesforce: Recover from invalid replayId Implement fallBackReplayId to use in case of an invalid replay Id. --- .../salesforce/SalesforceComponentConfigurer.java | 6 ++ .../salesforce/SalesforceEndpointConfigurer.java | 6 ++ .../salesforce/SalesforceEndpointUriFactory.java | 3 +- .../camel/component/salesforce/salesforce.json | 2 + .../salesforce/SalesforceEndpointConfig.java | 18 .../internal/streaming/SubscriptionHelper.java | 19 - .../salesforce/StreamingApiIntegrationTest.java| 20 - .../dsl/SalesforceComponentBuilderFactory.java | 17 .../dsl/SalesforceEndpointBuilderFactory.java | 98 ++ 9 files changed, 183 insertions(+), 6 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java index 9144c49..1018e7c 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceComponentConfigurer.java @@ -59,6 +59,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "contentType": getOrCreateConfig(target).setContentType(property(camelContext, org.apache.camel.component.salesforce.api.dto.bulk.ContentType.class, value)); return true; case "defaultreplayid": case "defaultReplayId": getOrCreateConfig(target).setDefaultReplayId(property(camelContext, java.lang.Long.class, value)); return true; +case "fallbackreplayid": +case "fallBackReplayId": getOrCreateConfig(target).setFallBackReplayId(property(camelContext, java.lang.Long.class, value)); return true; case "format": getOrCreateConfig(target).setFormat(property(camelContext, org.apache.camel.component.salesforce.internal.PayloadFormat.class, value)); return true; case "httpclient": case "httpClient": getOrCreateConfig(target).setHttpClient(property(camelContext, org.apache.camel.component.salesforce.SalesforceHttpClient.class, value)); return true; @@ -237,6 +239,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "contentType": return org.apache.camel.component.salesforce.api.dto.bulk.ContentType.class; case "defaultreplayid": case "defaultReplayId": return java.lang.Long.class; +case "fallbackreplayid": +case "fallBackReplayId": return java.lang.Long.class; case "format": return org.apache.camel.component.salesforce.internal.PayloadFormat.class; case "httpclient": case "httpClient": return org.apache.camel.component.salesforce.SalesforceHttpClient.class; @@ -416,6 +420,8 @@ public class SalesforceComponentConfigurer extends PropertyConfigurerSupport imp case "contentType": return getOrCreateConfig(target).getContentType(); case "defaultreplayid": case "defaultReplayId": return getOrCreateConfig(target).getDefaultReplayId(); +case "fallbackreplayid": +case "fallBackReplayId": return getOrCreateConfig(target).getFallBackReplayId(); case "format": return getOrCreateConfig(target).getFormat(); case "httpclient": case "httpClient": return getOrCreateConfig(target).getHttpClient(); diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointConfigurer.java b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointConfigurer.java index 47c35d9..836f542 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/camel/component/salesforce/SalesforceEndpointConfigurer.java +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/java/org/apache/came
[camel] branch main updated: CAMEL-17189: User-supplied SalesforceHttpClient
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new db6a2d7 CAMEL-17189: User-supplied SalesforceHttpClient db6a2d7 is described below commit db6a2d7c4f4555904d6c60efc6aeb056c6c276b4 Author: Jeremy Ross AuthorDate: Mon Nov 15 19:58:21 2021 -0600 CAMEL-17189: User-supplied SalesforceHttpClient Make sure we actually use the SalesforceHttpClient that the user provides. --- .../component/salesforce/SalesforceComponent.java | 16 - .../SalesforceComponentIntegrationTest.java| 27 ++ 2 files changed, 37 insertions(+), 6 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java index c99fa0a..0fca548 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/SalesforceComponent.java @@ -378,14 +378,18 @@ public class SalesforceComponent extends DefaultComponent implements SSLContextP // create a Jetty HttpClient if not already set if (httpClient == null) { -final SSLContextParameters contextParameters = Optional.ofNullable(sslContextParameters) -.orElseGet(() -> Optional.ofNullable(retrieveGlobalSslContextParameters()) -.orElseGet(() -> new SSLContextParameters())); +if (config != null && config.getHttpClient() != null) { +httpClient = config.getHttpClient(); +} else { +final SSLContextParameters contextParameters = Optional.ofNullable(sslContextParameters) +.orElseGet(() -> Optional.ofNullable(retrieveGlobalSslContextParameters()) +.orElseGet(() -> new SSLContextParameters())); -final SslContextFactory sslContextFactory = new SslContextFactory(); - sslContextFactory.setSslContext(contextParameters.createSSLContext(getCamelContext())); +final SslContextFactory sslContextFactory = new SslContextFactory(); + sslContextFactory.setSslContext(contextParameters.createSSLContext(getCamelContext())); -httpClient = createHttpClient(this, sslContextFactory, getCamelContext(), workerPoolSize, workerPoolMaxSize); +httpClient = createHttpClient(this, sslContextFactory, getCamelContext(), workerPoolSize, workerPoolMaxSize); +} if (config != null) { config.setHttpClient(httpClient); } diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentIntegrationTest.java new file mode 100644 index 000..af38b25 --- /dev/null +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/SalesforceComponentIntegrationTest.java @@ -0,0 +1,27 @@ +package org.apache.camel.component.salesforce; + +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class SalesforceComponentIntegrationTest extends AbstractSalesforceTestBase { + +private SalesforceHttpClient client = new SalesforceHttpClient(); +private SalesforceComponent component; + +@Test +public void usesUserSuppliedHttpClient() { +assertEquals(client, component.getHttpClient()); +} + +@Override +protected void createComponent() throws Exception { +super.createComponent(); +client = new SalesforceHttpClient(); +SalesforceEndpointConfig config = new SalesforceEndpointConfig(); +config.setHttpClient(client); +component = (SalesforceComponent) context.getComponent("salesforce"); +component.setConfig(config); +component.getLoginConfig().setLazyLogin(true); +} +}
[camel] branch main updated: CAMEL-17165: Upgrade to salesforce API v53.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 866b5d1 CAMEL-17165: Upgrade to salesforce API v53. 866b5d1 is described below commit 866b5d139692e461eb94244a43316bc2e0d47048 Author: Jeremy Ross AuthorDate: Sun Nov 14 22:11:55 2021 -0600 CAMEL-17165: Upgrade to salesforce API v53. --- .../resources/org/apache/camel/component/salesforce/salesforce.json | 4 ++-- .../apache/camel/component/salesforce/SalesforceEndpointConfig.java | 2 +- .../salesforce/CompositeApiCollectionsIntegrationTest.java | 2 +- .../builder/component/dsl/SalesforceComponentBuilderFactory.java| 2 +- .../builder/endpoint/dsl/SalesforceEndpointBuilderFactory.java | 6 +++--- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json index f193d43..6db43a4 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json +++ b/components/camel-salesforce/camel-salesforce-component/src/generated/resources/org/apache/camel/component/salesforce/salesforce.json @@ -25,7 +25,7 @@ "componentProperties": { "apexMethod": { "kind": "property", "displayName": "Apex Method", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "APEX method name" }, "apexQueryParams": { "kind": "property", "displayName": "Apex Query Params", "group": "common", "label": "", "required": false, "type": "object", "javaType": "java.util.Map", "deprecated": false, "autowired": false, "secret": false, "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Query params for APEX method" }, -"apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "50.0", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Salesforce API version." }, +"apiVersion": { "kind": "property", "displayName": "Api Version", "group": "common", "label": "", "required": false, "type": "string", "javaType": "java.lang.String", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "53.0", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Salesforce API version." }, "backoffIncrement": { "kind": "property", "displayName": "Backoff Increment", "group": "common", "label": "", "required": false, "type": "duration", "javaType": "long", "deprecated": false, "autowired": false, "secret": false, "defaultValue": "1000", "configurationClass": "org.apache.camel.component.salesforce.SalesforceEndpointConfig", "configurationField": "config", "description": "Backoff interval increment for Streaming connection restart attempts for failures beyond CometD auto- [...] "batchId": { "kind": &
[camel] 02/02: camel-salesforce: restore & fix integration test.
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit 2fbf4b94c5f9db6bd66040ed49abd9262ea3788c Author: Jeremy Ross AuthorDate: Sun Nov 14 20:15:45 2021 -0600 camel-salesforce: restore & fix integration test. --- .../SubscriptionHelperIntegrationTest.java | 109 ++--- 1 file changed, 96 insertions(+), 13 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelperIntegrationTest.java b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelperIntegrationTest.java index 5105595..8df70f1 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelperIntegrationTest.java +++ b/components/camel-salesforce/camel-salesforce-component/src/test/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelperIntegrationTest.java @@ -37,6 +37,7 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.TestInstance.Lifecycle; import org.mockito.ArgumentMatcher; +import org.mockito.Mockito; import org.slf4j.LoggerFactory; import static org.apache.camel.component.salesforce.internal.streaming.SubscriptionHelperIntegrationTest.MessageArgumentMatcher.messageForAccountCreationWithName; @@ -53,15 +54,10 @@ import static org.mockito.Mockito.when; public class SubscriptionHelperIntegrationTest { final CamelContext camel; - final SalesforceEndpointConfig config = new SalesforceEndpointConfig(); - final BlockingQueue messages = new LinkedBlockingDeque<>(); - final SalesforceComponent salesforce; - final StubServer server; - final SubscriptionHelper subscription; SalesforceConsumer toUnsubscribe; @@ -77,33 +73,25 @@ public class SubscriptionHelperIntegrationTest { @Override public boolean matches(final Message message) { final Map data = message.getDataAsMap(); - @SuppressWarnings("unchecked") final Map event = (Map) data.get("event"); - @SuppressWarnings("unchecked") final Map sobject = (Map) data.get("sobject"); - return "created".equals(event.get("type")) && name.equals(sobject.get("Name")); } static Message messageForAccountCreationWithName(final String name) { return argThat(new MessageArgumentMatcher(name)); } - } public SubscriptionHelperIntegrationTest() throws SalesforceException { server = new StubServer(); - LoggerFactory.getLogger(SubscriptionHelperIntegrationTest.class).info("Port for wireshark to filter: {}", server.port()); - final String instanceUrl = "http://localhost:"; + server.port(); - server.replyTo("POST", "/services/oauth2/token", "{\"instance_url\":\"" + instanceUrl + "\",\"access_token\":\"token\"}"); - server.replyTo("GET", "/services/oauth2/revoke?token=token", 200); server.replyTo("POST", "/cometd/" + SalesforceEndpointConfig.DEFAULT_VERSION + "/handshake", "[\n" @@ -202,6 +190,101 @@ public class SubscriptionHelperIntegrationTest { } @Test +void shouldResubscribeOnConnectionFailures() throws InterruptedException { +// handshake and connect +subscription.start(); + +final SalesforceConsumer consumer += toUnsubscribe = mock(SalesforceConsumer.class, "shouldResubscribeOnConnectionFailures:consumer"); + +final SalesforceEndpoint endpoint = mock(SalesforceEndpoint.class, "shouldResubscribeOnConnectionFailures:endpoint"); + +// subscribe +when(consumer.getTopicName()).thenReturn("Account"); + +when(consumer.getEndpoint()).thenReturn(endpoint); +when(endpoint.getConfiguration()).thenReturn(config); +when(endpoint.getComponent()).thenReturn(salesforce); +when(endpoint.getTopicName()).thenReturn("Account"); + +subscription.subscribe("Account", consumer); + +// push one message so we know connection is established and consumer +// receives notifications +messages.add("[\n" + + " {\n" + + "\"data\": {\n" + + " \"event\":
[camel] branch main updated (b44527d -> 2fbf4b9)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git. from b44527d fix doc error new 706e77a camel-salesforce: Don't login if shutting down new 2fbf4b9 camel-salesforce: restore & fix integration test. The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../internal/streaming/SubscriptionHelper.java | 3 + .../SubscriptionHelperIntegrationTest.java | 109 ++--- 2 files changed, 99 insertions(+), 13 deletions(-)
[camel] 01/02: camel-salesforce: Don't login if shutting down
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git commit 706e77a49c57c3f5fda7de30c5a6ba0b636ff895 Author: Jeremy Ross AuthorDate: Sun Nov 14 20:10:23 2021 -0600 camel-salesforce: Don't login if shutting down --- .../component/salesforce/internal/streaming/SubscriptionHelper.java| 3 +++ 1 file changed, 3 insertions(+) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java index d730a66..c3831ba 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java @@ -543,6 +543,9 @@ public class SubscriptionHelper extends ServiceSupport { try { for (;;) { try { +if (isStoppingOrStopped()) { +return; +} session.login(session.getAccessToken()); break; } catch (SalesforceException e) {
[camel] branch main updated (7a6315a -> 4817a7a)
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a change to branch main in repository https://gitbox.apache.org/repos/asf/camel.git. from 7a6315a camel-salesforce: Streaming API fixes and improvements add 4817a7a Fix CS No new revisions were added by this update. Summary of changes: .../component/salesforce/internal/streaming/SubscriptionHelper.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
[camel] branch main updated: camel-salesforce: Streaming API fixes and improvements
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new 7a6315a camel-salesforce: Streaming API fixes and improvements 7a6315a is described below commit 7a6315a73569f92a234a948a11cf4fc5478701c0 Author: Jeremy Ross AuthorDate: Sat Nov 13 10:27:15 2021 -0600 camel-salesforce: Streaming API fixes and improvements * Fixes CAMEL-16370, CAMEL-15203, CAMEL-13170. * Fix: fails to reconnect due to NPE * Smarter, more reliable reconnect/handshake logic * Use Bayeux client's reconnect functionality instead of restarting the whole SubscriptionHelper unnecessarily. * SubscriptionHelper: Avoid using doStart()/doStop() for anything other than starting and stopping this service * Eliminate unnecessary churn, e.g. full restarts, recreating listeners, Bayeux client, etc. * When reconnecting after a lost connection, replayId state is retained instead of going back to the endpoint config, which would be stale and result in repeated messages. This also applies to replayID values specified in the initialReplayIdMap option. * Ensure listener callbacks always use a different thread in order to avoid deadlocks * Toned down some log levels * When the auth token expires, attempt to login (with backoff) indefinitely. * Don't always expect a response to unsubscribe, because if there are other listeners on the channel, the Bayeux client will not send an unsubscribe message to the server --- .../salesforce/internal/SalesforceSession.java | 7 +- .../internal/streaming/SubscriptionHelper.java | 358 + .../salesforce/StreamingApiIntegrationTest.java| 7 +- .../SubscriptionHelperIntegrationTest.java | 85 - .../internal/streaming/SubscriptionHelperTest.java | 4 +- 5 files changed, 168 insertions(+), 293 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java index a600ef1..a0a0c84 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/SalesforceSession.java @@ -311,10 +311,9 @@ public class SalesforceSession extends ServiceSupport { final String reason = logoutResponse.getReason(); if (statusCode == HttpStatus.OK_200) { -LOG.info("Logout successful"); +LOG.debug("Logout successful"); } else { -throw new SalesforceException( -String.format("Logout error, code: [%s] reason: [%s]", statusCode, reason), statusCode); +LOG.debug("Failed to revoke OAuth token. This is expected if the token is invalid or already expired"); } } catch (InterruptedException e) { @@ -324,7 +323,7 @@ public class SalesforceSession extends ServiceSupport { final Throwable ex = e.getCause(); throw new SalesforceException("Unexpected logout exception: " + ex.getMessage(), ex); } catch (TimeoutException e) { -throw new SalesforceException("Logout request TIMEOUT!", null); +throw new SalesforceException("Logout request TIMEOUT!", e); } finally { // reset session accessToken = null; diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java index ff760f9..969abfb 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/streaming/SubscriptionHelper.java @@ -21,7 +21,6 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.CountDownLatch; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Stream; @@ -50,10 +49,8 @@ import or
[camel] branch main updated: CAMEL-17145: camel-salesforce: Upsert return type
This is an automated email from the ASF dual-hosted git repository. jeremyross pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/camel.git The following commit(s) were added to refs/heads/main by this push: new cbedd26 CAMEL-17145: camel-salesforce: Upsert return type cbedd26 is described below commit cbedd261336d576c558dcc2c4f4e358b27c9cb8f Author: Jeremy Ross AuthorDate: Thu Oct 28 21:16:33 2021 -0500 CAMEL-17145: camel-salesforce: Upsert return type Composite SObject Collection upsert operation should return UpsertSObjectResult instead of SaveSObjectResult. --- .../salesforce/api/dto/UpsertSObjectResult.java| 31 +--- .../CompositeSObjectCollectionsApiClient.java | 16 -- ...efaultCompositeSObjectCollectionsApiClient.java | 57 ++ .../CompositeSObjectCollectionsProcessor.java | 14 +++--- .../CompositeApiCollectionsIntegrationTest.java| 3 +- 5 files changed, 69 insertions(+), 52 deletions(-) diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/UpsertSObjectResult.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/UpsertSObjectResult.java index 237ced9..3f0ca6d 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/UpsertSObjectResult.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/api/dto/UpsertSObjectResult.java @@ -16,39 +16,10 @@ */ package org.apache.camel.component.salesforce.api.dto; -import java.util.List; +public class UpsertSObjectResult extends SaveSObjectResult { -public class UpsertSObjectResult extends AbstractDTOBase { - -private String id; -private List errors; -private Boolean success; private Boolean created; -public String getId() { -return id; -} - -public void setId(String id) { -this.id = id; -} - -public List getErrors() { -return errors; -} - -public void setErrors(List errors) { -this.errors = errors; -} - -public Boolean getSuccess() { -return success; -} - -public void setSuccess(Boolean success) { -this.success = success; -} - public Boolean getCreated() { return created; } diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/CompositeSObjectCollectionsApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/CompositeSObjectCollectionsApiClient.java index e3e9934..9292ffb 100644 --- a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/CompositeSObjectCollectionsApiClient.java +++ b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/CompositeSObjectCollectionsApiClient.java @@ -23,6 +23,7 @@ import java.util.Optional; import org.apache.camel.component.salesforce.api.SalesforceException; import org.apache.camel.component.salesforce.api.dto.DeleteSObjectResult; import org.apache.camel.component.salesforce.api.dto.SaveSObjectResult; +import org.apache.camel.component.salesforce.api.dto.UpsertSObjectResult; import org.apache.camel.component.salesforce.api.dto.composite.SObjectCollection; import org.apache.camel.component.salesforce.internal.dto.composite.RetrieveSObjectCollectionsDto; @@ -39,10 +40,19 @@ public interface CompositeSObjectCollectionsApiClient { Class returnType) throws SalesforceException; -void submitCompositeCollections( +void createCompositeCollections( SObjectCollection collection, Map> headers, -ResponseCallback> callback, String sObjectName, String externalIdFieldName, -String method) +ResponseCallback> callback) +throws SalesforceException; + +void updateCompositeCollections( +SObjectCollection collection, Map> headers, +ResponseCallback> callback) +throws SalesforceException; + +void upsertCompositeCollections( +SObjectCollection collection, Map> headers, +ResponseCallback> callback, String sObjectName, String externalIdFieldName) throws SalesforceException; void submitDeleteCompositeCollections( diff --git a/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/salesforce/internal/client/DefaultCompositeSObjectCollectionsApiClient.java b/components/camel-salesforce/camel-salesforce-component/src/main/java/org/apache/camel/component/sales