You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by je...@apache.org on 2022/01/09 18:12:28 UTC
[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 <je...@gmail.com>
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..0000000
--- 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 limits) {
- this.limits = limits;
- }
-
- public String getTheme() {
- return theme;
- }
-
- public void setTheme(String theme) {
- this.theme = theme;
- }
-
- public String getQueryAll() {
- return queryAll;
- }
-
- public void setQueryAll(String queryAll) {
- this.queryAll = queryAll;
- }
-
- public String getKnowledgeManagement() {
- return knowledgeManagement;
- }
-
- public void setKnowledgeManagement(String knowledgeManagement) {
- this.knowledgeManagement = knowledgeManagement;
- }
-
- public String getProcess() {
- return process;
- }
-
- public void setProcess(String process) {
- this.process = process;
- }
-
- public String getFlexiPage() {
- return flexiPage;
- }
-
- public void setFlexiPage(String flexiPage) {
- this.flexiPage = flexiPage;
- }
-
- public String getQuickActions() {
- return quickActions;
- }
-
- public void setQuickActions(String quickActions) {
- this.quickActions = quickActions;
- }
-
- public String getAppMenu() {
- return appMenu;
- }
-
- public void setAppMenu(String appMenu) {
- this.appMenu = appMenu;
- }
-
- public String getCompactLayouts() {
- return compactLayouts;
- }
-
- public void setCompactLayouts(String compactLayouts) {
- this.compactLayouts = compactLayouts;
- }
-
- public String getActions() {
- return actions;
- }
-
- public void setActions(String actions) {
- this.actions = actions;
- }
-
- public String getTabs() {
- return tabs;
- }
-
- public void setTabs(String tabs) {
- this.tabs = tabs;
- }
-
- public String getWave() {
- return wave;
- }
-
- public void setWave(String wave) {
- this.wave = wave;
- }
-
- public String getAsyncQueries() {
- return asyncQueries;
- }
-
- public void setAsyncQueries(String asyncQueries) {
- this.asyncQueries = asyncQueries;
- }
-
- public String getExchangeConnect() {
- return exchangeConnect;
- }
-
- public void setExchangeConnect(String exchangeConnect) {
- this.exchangeConnect = exchangeConnect;
- }
-}
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 cb0a1b7..b13f41a 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
@@ -35,7 +35,6 @@ import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
import org.apache.camel.component.salesforce.api.dto.CreateSObjectResult;
import org.apache.camel.component.salesforce.api.dto.GlobalObjects;
import org.apache.camel.component.salesforce.api.dto.Limits;
-import org.apache.camel.component.salesforce.api.dto.RestResources;
import org.apache.camel.component.salesforce.api.dto.SObjectBasicInfo;
import org.apache.camel.component.salesforce.api.dto.SObjectDescription;
import org.apache.camel.component.salesforce.api.dto.SearchResult2;
@@ -72,7 +71,8 @@ public class JsonRestProcessor extends AbstractRestProcessor {
case GET_RESOURCES:
// handle in built response types
- exchange.setProperty(RESPONSE_CLASS, RestResources.class);
+ exchange.setProperty(RESPONSE_TYPE, new TypeReference<Map<String, String>>() {
+ });
break;
case GET_GLOBAL_OBJECTS:
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 f45abae..5c3f727 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
@@ -22,6 +22,7 @@ import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
@@ -36,7 +37,6 @@ import org.apache.camel.component.salesforce.api.SalesforceMultipleChoicesExcept
import org.apache.camel.component.salesforce.api.dto.AbstractDTOBase;
import org.apache.camel.component.salesforce.api.dto.CreateSObjectResult;
import org.apache.camel.component.salesforce.api.dto.GlobalObjects;
-import org.apache.camel.component.salesforce.api.dto.RestResources;
import org.apache.camel.component.salesforce.api.dto.SObjectBasicInfo;
import org.apache.camel.component.salesforce.api.dto.SObjectDescription;
import org.apache.camel.component.salesforce.api.dto.UpsertSObjectResult;
@@ -450,8 +450,11 @@ public class RestApiIntegrationTest extends AbstractSalesforceTestBase {
@Test
public void testGetResources() throws Exception {
- final RestResources resources = template().requestBody("direct:getResources", null, RestResources.class);
+ @SuppressWarnings("unchecked")
+ final Map<String, String> resources =
+ (Map<String, String>) template().requestBody("direct:getResources", "");
assertNotNull(resources);
+ assertTrue(resources.containsKey("metadata"));
}
@Test
diff --git a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
index 2ea3d7a..65d8cc3 100644
--- a/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
+++ b/docs/user-manual/modules/ROOT/pages/camel-3x-upgrade-guide-3_15.adoc
@@ -69,6 +69,10 @@ node in the JMX MBean tree.
Removed deprecated operations on `CamelContextMBean` and `CamelRouteMBean`.
+=== camel-salesforce
+
+The `getResources` operation now returns a `Map<String, String>` instead of `RestResources`.
+
=== camel-util
Deleted the `replaceAll` method of `org.apache.camel.util.StringHelper`. Please use the `replace` method of `java.lang.String` instead, as it is much faster from Java 11 onward.