From 6c4c434639dae4f9a7ffba1d36069c2f23b256a8 Mon Sep 17 00:00:00 2001 From: kesavan Date: Tue, 9 Apr 2019 13:16:33 +0530 Subject: [PATCH] Fix to support EI 6.5.0. --- README.md | 9 ++--- pom.xml | 14 ++++---- .../esb-connector-salesforcerest.properties | 2 +- src/test/INTEGRATION-TEST.md | 8 ++--- ...alesforceRestConnectorIntegrationTest.java | 34 +++++++++---------- 5 files changed, 34 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index 9e7f730..7507b36 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # Salesforce REST EI Connector -The Salesforce REST [Connector](https://docs.wso2.com/display/EI640/Working+with+Connectors) allows you to work with records in Salesforce, a web-based service that allows organizations to manage contact relationship management (CRM) data. You can use the Salesforce connector to create, query, retrieve, update, and delete records in your organization's Salesforce data. The connector uses the [Salesforce REST API](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_what_is_rest_api.htm) to interact with Salesforce. +The Salesforce REST [Connector](https://docs.wso2.com/display/EI650/Working+with+Connectors) allows you to work with records in Salesforce, a web-based service that allows organizations to manage contact relationship management (CRM) data. You can use the Salesforce connector to create, query, retrieve, update, and delete records in your organization's Salesforce data. The connector uses the [Salesforce REST API](https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/intro_what_is_rest_api.htm) to interact with Salesforce. ## Compatibility | Connector version | Supported Salesforce REST API version | Supported WSO2 ESB/EI version | | ------------- | ------------- | ------------- | +| [1.0.7](https://github.com/wso2-extensions/esb-connector-salesforcerest/tree/org.wso2.carbon.connector.salesforcerest-1.0.7) | v32.0 | EI 6.5.0 | | [1.0.6](https://github.com/wso2-extensions/esb-connector-salesforcerest/tree/org.wso2.carbon.connector.salesforcerest-1.0.6) | v32.0 | ESB 5.0.0, EI 6.1.0, 6.1.1, 6.2.0, 6.3.0, 6.4.0 | | [1.0.5](https://github.com/wso2-extensions/esb-connector-salesforcerest/tree/org.wso2.carbon.connector.salesforcerest-1.0.5) | v32.0 | ESB 5.0.0, EI 6.1.0, 6.1.1, 6.2.0, 6.3.0, 6.4.0 | | [1.0.4](https://github.com/wso2-extensions/esb-connector-salesforcerest/tree/org.wso2.carbon.connector.salesforcerest-1.0.4) | v32.0 | ESB 4.9.0, 5.0.0 | @@ -15,9 +16,9 @@ The Salesforce REST [Connector](https://docs.wso2.com/display/EI640/Working+with #### Download and install the connector 1. Download the connector from the [WSO2 Store](https://store.wso2.com/store/assets/esbconnector/details/43e44763-0d73-4ab3-8ae9-d6f73532d164) by clicking the Download Connector button. -2. Then you can follow this [Documentation](https://docs.wso2.com/display/EI640/Working+with+Connectors+via+the+Management+Console) to add and enable the connector via the Management Console in your EI instance. -3. For more information on using connectors and their operations in your EI configurations, see [Using a Connector](https://docs.wso2.com/display/EI640/Using+a+Connector). -4. If you want to work with connectors via EI tooling, see [Working with Connectors via Tooling](https://docs.wso2.com/display/EI640/Working+with+Connectors+via+Tooling). +2. Then you can follow this [Documentation](https://docs.wso2.com/display/EI650/Working+with+Connectors+via+the+Management+Console) to add and enable the connector via the Management Console in your EI instance. +3. For more information on using connectors and their operations in your EI configurations, see [Using a Connector](https://docs.wso2.com/display/EI650/Using+a+Connector). +4. If you want to work with connectors via EI tooling, see [Working with Connectors via Tooling](https://docs.wso2.com/display/EI650/Working+with+Connectors+via+Tooling). #### Configuring the connector operations diff --git a/pom.xml b/pom.xml index 693ce2e..7b142c8 100644 --- a/pom.xml +++ b/pom.xml @@ -22,19 +22,19 @@ org.wso2.carbon.connector org.wso2.carbon.connector.salesforcerest jar - 1.0.7-SNAPSHOT + 1.0.7 WSO2 Carbon - Mediation Library Connector For Salesforcerest http://wso2.org salesforcerest - 6.4.0 + 6.5.0 4.4.17 4.4.2 4.4.3 2.1.5320 - 2.1.7-wso2v19 - 4.6.19 - 2.0.0.wso2v1 + 2.1.7-wso2v95 + 4.6.123 + 3.0.0.wso2v1 6.1.1 0.9.4 1.55 @@ -169,9 +169,9 @@ ${product.ei.version} - org.wso2.ei + org.wso2.carbon.mediation org.wso2.carbon.integrator.core - ${product.ei.version} + ${carbon.mediation.version} org.wso2.ei diff --git a/repository/esb-connector-salesforcerest.properties b/repository/esb-connector-salesforcerest.properties index d7485bb..4abb43e 100644 --- a/repository/esb-connector-salesforcerest.properties +++ b/repository/esb-connector-salesforcerest.properties @@ -3,4 +3,4 @@ apiUrl=https://kesavan-dev-ed.my.salesforce.com apiVersion=v32.0 refreshToken=5Aep861TSESvWeug_wh8Zdrl_VI2_3Nto6FnQjpVsd1el5_cxt1qKRiVmI5B5x6ABH.QEq4FGbXtI5ARrLxzibR clientSecret=9148186152266986099 -clientId=3MVG9ZL0ppGP5UrBKpO5NfGJn9gXRXLOKwHHYHfEh.gTMriEXwhf6DFvyPl481H09MQ8EUAwQxmFraW3k0KgU +clientId=3MVG9ZL0ppGP5UrBKpO5NfGJn9gXRXLOKwHHYHfEh.gTMriEXwhf6DFvyPl481H09MQ8EUAwQxmFraW3k0KgU \ No newline at end of file diff --git a/src/test/INTEGRATION-TEST.md b/src/test/INTEGRATION-TEST.md index 6fed6bd..8c889c7 100644 --- a/src/test/INTEGRATION-TEST.md +++ b/src/test/INTEGRATION-TEST.md @@ -1,4 +1,4 @@ -## Integration tests for WSO2 ESB Salesforce REST connector +## Integration tests for WSO2 EI Salesforce REST connector ### Pre-requisites: - Maven 3.x @@ -6,14 +6,14 @@ ### Tested Platforms: - - Mac OS 10.12.6 - - WSO2 EI 6.4.0 + - Ubuntu 16.04 + - WSO2 EI 6.5.0 Steps to follow in setting integration test. - 1. Download EI 6.4.0 from official website. + 1. Download EI 6.5.0 from official website. 2. Create a Salesforce account and create a connected app. diff --git a/src/test/java/org/wso2/carbon/connector/integration/test/salesforcerest/SalesforceRestConnectorIntegrationTest.java b/src/test/java/org/wso2/carbon/connector/integration/test/salesforcerest/SalesforceRestConnectorIntegrationTest.java index 3266b78..2d1593a 100644 --- a/src/test/java/org/wso2/carbon/connector/integration/test/salesforcerest/SalesforceRestConnectorIntegrationTest.java +++ b/src/test/java/org/wso2/carbon/connector/integration/test/salesforcerest/SalesforceRestConnectorIntegrationTest.java @@ -100,7 +100,7 @@ public void describeGlobal() throws IOException, JSONException { RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("sobjects"), apiRestResponse.getBody().getString("sobjects")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("sobjects").length(), apiRestResponse.getBody().getJSONArray("sobjects").length()); } /** @@ -130,7 +130,7 @@ public void sObjectBasicInfo() throws IOException, JSONException { RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("objectDescribe"), apiRestResponse.getBody().getString("objectDescribe")); + Assert.assertEquals(esbRestResponse.getBody().getJSONObject("objectDescribe").toString(), apiRestResponse.getBody().getJSONObject("objectDescribe").toString()); } /** @@ -189,7 +189,7 @@ public void query() throws IOException, JSONException { RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("records"), apiRestResponse.getBody().getString("records")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("records").toString(), apiRestResponse.getBody().getJSONArray("records").toString()); } /** @@ -204,7 +204,7 @@ public void queryPerformanceFeedback() throws IOException, JSONException { RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("plans"), apiRestResponse.getBody().getString("plans")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("plans").length(), apiRestResponse.getBody().getJSONArray("plans").length()); } /** @@ -219,7 +219,7 @@ public void queryAll() throws IOException, JSONException { RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("records"), apiRestResponse.getBody().getString("records")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("records").toString(), apiRestResponse.getBody().getJSONArray("records").toString()); } /** @@ -262,7 +262,7 @@ public void getSpecificAction() throws IOException, JSONException { RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("layout"), apiRestResponse.getBody().getString("layout")); + Assert.assertEquals(esbRestResponse.getBody().toString(), apiRestResponse.getBody().toString()); } /** @@ -403,7 +403,7 @@ public void listViews() throws IOException, JSONException { connectorProperties.put("listViewID",listViewId); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("listviews"), apiRestResponse.getBody().getString("listviews")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("listviews").length(), apiRestResponse.getBody().getJSONArray("listviews").length()); } /** @@ -447,7 +447,7 @@ public void listviewQueryPerformanceFeedback() throws IOException, JSONException RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("plans"), apiRestResponse.getBody().getString("plans")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("plans").toString(), apiRestResponse.getBody().getJSONArray("plans").toString()); } /** @@ -461,7 +461,7 @@ public void listViewResultsWithMandatoryParameters() throws IOException, JSONExc RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("columns"), apiRestResponse.getBody().getString("columns")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("columns").toString(), apiRestResponse.getBody().getJSONArray("columns").toString()); } /** @@ -476,7 +476,7 @@ public void recentListViews() throws IOException, JSONException { RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("listviews"), apiRestResponse.getBody().getString("listviews")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("listviews").toString(), apiRestResponse.getBody().getJSONArray("listviews").toString()); } /** @@ -491,7 +491,7 @@ public void listApprovals() throws IOException, JSONException { RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("approvals"), apiRestResponse.getBody().getString("approvals")); + Assert.assertEquals(esbRestResponse.getBody().getJSONObject("approvals").toString(), apiRestResponse.getBody().getJSONObject("approvals").toString()); } /** @@ -672,7 +672,7 @@ public void sObjectLayoutsWithMandatoryParameters() throws IOException, JSONExce RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).getString("buttonLayoutSection"), apiRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).getString("buttonLayoutSection")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).toString(), apiRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).toString()); } /** @@ -686,7 +686,7 @@ public void globalSObjectLayoutsWithMandatoryParameters() throws IOException, JS RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).getString("buttonLayoutSection"), apiRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).getString("buttonLayoutSection")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).toString(), apiRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).toString()); } /** @@ -700,7 +700,7 @@ public void compactLayoutsWithMandatoryParameters() throws IOException, JSONExce RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("Account"), apiRestResponse.getBody().getString("Account")); + Assert.assertEquals(esbRestResponse.getBody().getJSONObject("Account").toString(), apiRestResponse.getBody().getJSONObject("Account").toString()); } /** @@ -727,7 +727,7 @@ public void sObjectCompactLayoutsWithMandatoryParameters() throws IOException, J RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getJSONArray("compactLayouts").getJSONObject(0).getString("actions"), apiRestResponse.getBody().getJSONArray("compactLayouts").getJSONObject(0).getString("actions")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("compactLayouts").getJSONObject(0).toString(), apiRestResponse.getBody().getJSONArray("compactLayouts").getJSONObject(0).toString()); } /** @@ -741,7 +741,7 @@ public void sObjectNamedLayoutsWithMandatoryParameters() throws IOException, JSO RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).getString("buttonLayoutSection"), apiRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).getString("buttonLayoutSection")); + Assert.assertEquals(esbRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).toString(), apiRestResponse.getBody().getJSONArray("layouts").getJSONObject(0).toString()); } /** @@ -769,7 +769,7 @@ public void listOrganizationLimitsWithMandatoryParameters() throws IOException, RestResponse apiRestResponse = sendJsonRestRequest(apiEndPoint, "GET", apiRequestHeadersMap); Assert.assertEquals(esbRestResponse.getHttpStatusCode(), 200); Assert.assertEquals(apiRestResponse.getHttpStatusCode(), 200); - Assert.assertEquals(esbRestResponse.getBody().getString("ConcurrentAsyncGetReportInstances"), apiRestResponse.getBody().getString("ConcurrentAsyncGetReportInstances")); + Assert.assertEquals(esbRestResponse.getBody().getJSONObject("ConcurrentAsyncGetReportInstances").toString(), apiRestResponse.getBody().getJSONObject("ConcurrentAsyncGetReportInstances").toString()); } /**