You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by GitBox <gi...@apache.org> on 2021/08/06 16:03:38 UTC

[GitHub] [camel-quarkus] zbendhiba opened a new pull request #2998: Salesforce : Expand producer test coverage

zbendhiba opened a new pull request #2998:
URL: https://github.com/apache/camel-quarkus/pull/2998


   <!-- Uncomment and fill this section if your PR is not trivial
   [ ] An issue should be filed for the change unless this is a trivial change (fixing a typo or similar). One issue should ideally be fixed by not more than one commit and the other way round, each commit should fix just one issue, without pulling in other changes.
   [ ] Each commit in the pull request should have a meaningful and properly spelled subject line and body. Copying the title of the associated issue is typically enough. Please include the issue number in the commit message prefixed by #.
   [ ] The pull request description should explain what the pull request does, how, and why. If the info is available in the associated issue or some other external document, a link is enough.
   [ ] Phrases like Fix #<issueNumber> or Fixes #<issueNumber> will auto-close the named issue upon merging the pull request. Using them is typically a good idea.
   [ ] Please run mvn process-resources -Pformat (and amend the changes if necessary) before sending the pull request.
   [ ] Contributor guide is your good friend: https://camel.apache.org/camel-quarkus/latest/contributor-guide.html
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #2998: Salesforce : Expand producer test coverage

Posted by GitBox <gi...@apache.org>.
aldettinger commented on a change in pull request #2998:
URL: https://github.com/apache/camel-quarkus/pull/2998#discussion_r684372223



##########
File path: integration-tests/salesforce/src/test/java/org/apache/camel/quarkus/component/salesforce/SalesforceTest.java
##########
@@ -81,4 +102,119 @@ public void testBulkJobApi() {
         state = jobInfo.getString("state");
         assertEquals("ABORTED", state);
     }
+
+    @Test
+    void testGlobalObjectsWithHeaders() {
+        GlobalObjectsAndHeaders globalObjectsAndHeaders = RestAssured.given()
+                .get("/salesforce/sobjects/force-limit")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(GlobalObjectsAndHeaders.class);
+
+        assertNotNull(globalObjectsAndHeaders);
+        assertNotNull(globalObjectsAndHeaders.getGlobalObjects());
+        assertTrue(globalObjectsAndHeaders.getHeader("Sforce-Limit-Info").contains("api-usage="));
+    }
+
+    @Test
+    void testGetVersions() {
+        List<Versions> versions = RestAssured.given()
+                .get("/salesforce/versions")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(List.class);
+        assertNotNull(versions);
+        assertNotEquals(0, versions.size());
+    }
+
+    @Test
+    void testGetRestResources() {
+        RestResources restResources = RestAssured.given()
+                .get("/salesforce/resources")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(RestResources.class);
+        assertNotNull(restResources);
+    }
+
+    @Test
+    void testAccountWithBasicInfo() {
+        // create an object of type Account
+        String accountName = "Camel Quarkus Account Test: " + UUID.randomUUID().toString();
+        final String accountId = RestAssured.given()
+                .body(accountName)
+                .post("/salesforce/account")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .asString();
+
+        if (accountId != null) {
+            // get Account basic info
+            SObjectBasicInfo accountBasicInfo = RestAssured.given()
+                    .get("/salesforce/basic-info/account")
+                    .then()
+                    .statusCode(200)
+                    .extract()
+                    .body()
+                    .as(SObjectBasicInfo.class);
+            assertNotNull(accountBasicInfo);
+            List<RecentItem> recentItems = accountBasicInfo.getRecentItems();
+            assertNotNull(recentItems);
+            // make sure the created account is referenced
+            assertTrue(recentItems.stream().anyMatch(recentItem -> recentItem.getAttributes().getUrl().contains(accountId)));
+
+            // Get Account - querying Sobject by ID
+            RestAssured.get("/salesforce/account/" + accountId)
+                    .then()
+                    .statusCode(200)
+                    .body(
+                            "Id", not(emptyString()),
+                            "AccountNumber", not(emptyString()));
+
+            // delete the account
+            // Clean up
+            RestAssured.delete("/salesforce/account/" + accountId)

Review comment:
       Would the delete not be invoked due to crash/exception, I think subsequent tests should be fine as the accountId would not be the same.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #2998: Salesforce : Expand producer test coverage

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #2998:
URL: https://github.com/apache/camel-quarkus/pull/2998#discussion_r684731522



##########
File path: integration-tests/salesforce/src/test/java/org/apache/camel/quarkus/component/salesforce/SalesforceTest.java
##########
@@ -81,4 +102,119 @@ public void testBulkJobApi() {
         state = jobInfo.getString("state");
         assertEquals("ABORTED", state);
     }
+
+    @Test
+    void testGlobalObjectsWithHeaders() {
+        GlobalObjectsAndHeaders globalObjectsAndHeaders = RestAssured.given()
+                .get("/salesforce/sobjects/force-limit")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(GlobalObjectsAndHeaders.class);
+
+        assertNotNull(globalObjectsAndHeaders);
+        assertNotNull(globalObjectsAndHeaders.getGlobalObjects());
+        assertTrue(globalObjectsAndHeaders.getHeader("Sforce-Limit-Info").contains("api-usage="));
+    }
+
+    @Test
+    void testGetVersions() {
+        List<Versions> versions = RestAssured.given()
+                .get("/salesforce/versions")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(List.class);
+        assertNotNull(versions);
+        assertNotEquals(0, versions.size());
+    }
+
+    @Test
+    void testGetRestResources() {
+        RestResources restResources = RestAssured.given()
+                .get("/salesforce/resources")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(RestResources.class);
+        assertNotNull(restResources);
+    }
+
+    @Test
+    void testAccountWithBasicInfo() {
+        // create an object of type Account
+        String accountName = "Camel Quarkus Account Test: " + UUID.randomUUID().toString();
+        final String accountId = RestAssured.given()
+                .body(accountName)
+                .post("/salesforce/account")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .asString();
+
+        if (accountId != null) {
+            // get Account basic info
+            SObjectBasicInfo accountBasicInfo = RestAssured.given()
+                    .get("/salesforce/basic-info/account")
+                    .then()
+                    .statusCode(200)
+                    .extract()
+                    .body()
+                    .as(SObjectBasicInfo.class);
+            assertNotNull(accountBasicInfo);
+            List<RecentItem> recentItems = accountBasicInfo.getRecentItems();
+            assertNotNull(recentItems);
+            // make sure the created account is referenced
+            assertTrue(recentItems.stream().anyMatch(recentItem -> recentItem.getAttributes().getUrl().contains(accountId)));
+
+            // Get Account - querying Sobject by ID
+            RestAssured.get("/salesforce/account/" + accountId)
+                    .then()
+                    .statusCode(200)
+                    .body(
+                            "Id", not(emptyString()),
+                            "AccountNumber", not(emptyString()));
+
+            // delete the account
+            // Clean up
+            RestAssured.delete("/salesforce/account/" + accountId)

Review comment:
       The latest commit addresses this unnecessary not null test on the accountId. Thanks for catching this 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] ppalaga merged pull request #2998: Salesforce : Expand producer test coverage

Posted by GitBox <gi...@apache.org>.
ppalaga merged pull request #2998:
URL: https://github.com/apache/camel-quarkus/pull/2998


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #2998: Salesforce : Expand producer test coverage

Posted by GitBox <gi...@apache.org>.
aldettinger commented on a change in pull request #2998:
URL: https://github.com/apache/camel-quarkus/pull/2998#discussion_r684973973



##########
File path: integration-tests/salesforce/src/test/java/org/apache/camel/quarkus/component/salesforce/SalesforceTest.java
##########
@@ -81,4 +102,119 @@ public void testBulkJobApi() {
         state = jobInfo.getString("state");
         assertEquals("ABORTED", state);
     }
+
+    @Test
+    void testGlobalObjectsWithHeaders() {
+        GlobalObjectsAndHeaders globalObjectsAndHeaders = RestAssured.given()
+                .get("/salesforce/sobjects/force-limit")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(GlobalObjectsAndHeaders.class);
+
+        assertNotNull(globalObjectsAndHeaders);
+        assertNotNull(globalObjectsAndHeaders.getGlobalObjects());
+        assertTrue(globalObjectsAndHeaders.getHeader("Sforce-Limit-Info").contains("api-usage="));
+    }
+
+    @Test
+    void testGetVersions() {
+        List<Versions> versions = RestAssured.given()
+                .get("/salesforce/versions")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(List.class);
+        assertNotNull(versions);
+        assertNotEquals(0, versions.size());
+    }
+
+    @Test
+    void testGetRestResources() {
+        RestResources restResources = RestAssured.given()
+                .get("/salesforce/resources")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(RestResources.class);
+        assertNotNull(restResources);
+    }
+
+    @Test
+    void testAccountWithBasicInfo() {
+        // create an object of type Account
+        String accountName = "Camel Quarkus Account Test: " + UUID.randomUUID().toString();
+        final String accountId = RestAssured.given()
+                .body(accountName)
+                .post("/salesforce/account")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .asString();
+
+        if (accountId != null) {
+            // get Account basic info
+            SObjectBasicInfo accountBasicInfo = RestAssured.given()
+                    .get("/salesforce/basic-info/account")
+                    .then()
+                    .statusCode(200)
+                    .extract()
+                    .body()
+                    .as(SObjectBasicInfo.class);
+            assertNotNull(accountBasicInfo);
+            List<RecentItem> recentItems = accountBasicInfo.getRecentItems();
+            assertNotNull(recentItems);
+            // make sure the created account is referenced
+            assertTrue(recentItems.stream().anyMatch(recentItem -> recentItem.getAttributes().getUrl().contains(accountId)));
+
+            // Get Account - querying Sobject by ID
+            RestAssured.get("/salesforce/account/" + accountId)
+                    .then()
+                    .statusCode(200)
+                    .body(
+                            "Id", not(emptyString()),
+                            "AccountNumber", not(emptyString()));
+
+            // delete the account
+            // Clean up
+            RestAssured.delete("/salesforce/account/" + accountId)

Review comment:
       @zbendhiba I was more thinking about cases like the "get" before the "delete" that would throw a network exception. And, in this rare case, there should only be an account leak and subsequent tests should be fine.
   
   I think, it should be fine. CI is only running mock tests and worst case one would need to cleanup the salesforce account from time to time on manual test.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] zbendhiba commented on a change in pull request #2998: Salesforce : Expand producer test coverage

Posted by GitBox <gi...@apache.org>.
zbendhiba commented on a change in pull request #2998:
URL: https://github.com/apache/camel-quarkus/pull/2998#discussion_r684729193



##########
File path: integration-tests/salesforce/src/test/java/org/apache/camel/quarkus/component/salesforce/SalesforceTest.java
##########
@@ -81,4 +102,119 @@ public void testBulkJobApi() {
         state = jobInfo.getString("state");
         assertEquals("ABORTED", state);
     }
+
+    @Test
+    void testGlobalObjectsWithHeaders() {
+        GlobalObjectsAndHeaders globalObjectsAndHeaders = RestAssured.given()
+                .get("/salesforce/sobjects/force-limit")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(GlobalObjectsAndHeaders.class);
+
+        assertNotNull(globalObjectsAndHeaders);
+        assertNotNull(globalObjectsAndHeaders.getGlobalObjects());
+        assertTrue(globalObjectsAndHeaders.getHeader("Sforce-Limit-Info").contains("api-usage="));
+    }
+
+    @Test
+    void testGetVersions() {
+        List<Versions> versions = RestAssured.given()
+                .get("/salesforce/versions")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(List.class);
+        assertNotNull(versions);
+        assertNotEquals(0, versions.size());
+    }
+
+    @Test
+    void testGetRestResources() {
+        RestResources restResources = RestAssured.given()
+                .get("/salesforce/resources")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(RestResources.class);
+        assertNotNull(restResources);
+    }
+
+    @Test
+    void testAccountWithBasicInfo() {
+        // create an object of type Account
+        String accountName = "Camel Quarkus Account Test: " + UUID.randomUUID().toString();
+        final String accountId = RestAssured.given()
+                .body(accountName)
+                .post("/salesforce/account")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .asString();
+
+        if (accountId != null) {
+            // get Account basic info
+            SObjectBasicInfo accountBasicInfo = RestAssured.given()
+                    .get("/salesforce/basic-info/account")
+                    .then()
+                    .statusCode(200)
+                    .extract()
+                    .body()
+                    .as(SObjectBasicInfo.class);
+            assertNotNull(accountBasicInfo);
+            List<RecentItem> recentItems = accountBasicInfo.getRecentItems();
+            assertNotNull(recentItems);
+            // make sure the created account is referenced
+            assertTrue(recentItems.stream().anyMatch(recentItem -> recentItem.getAttributes().getUrl().contains(accountId)));
+
+            // Get Account - querying Sobject by ID
+            RestAssured.get("/salesforce/account/" + accountId)
+                    .then()
+                    .statusCode(200)
+                    .body(
+                            "Id", not(emptyString()),
+                            "AccountNumber", not(emptyString()));
+
+            // delete the account
+            // Clean up
+            RestAssured.delete("/salesforce/account/" + accountId)

Review comment:
       yes, thanks @aldettinger. I'd fix that




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [camel-quarkus] aldettinger commented on a change in pull request #2998: Salesforce : Expand producer test coverage

Posted by GitBox <gi...@apache.org>.
aldettinger commented on a change in pull request #2998:
URL: https://github.com/apache/camel-quarkus/pull/2998#discussion_r684372223



##########
File path: integration-tests/salesforce/src/test/java/org/apache/camel/quarkus/component/salesforce/SalesforceTest.java
##########
@@ -81,4 +102,119 @@ public void testBulkJobApi() {
         state = jobInfo.getString("state");
         assertEquals("ABORTED", state);
     }
+
+    @Test
+    void testGlobalObjectsWithHeaders() {
+        GlobalObjectsAndHeaders globalObjectsAndHeaders = RestAssured.given()
+                .get("/salesforce/sobjects/force-limit")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(GlobalObjectsAndHeaders.class);
+
+        assertNotNull(globalObjectsAndHeaders);
+        assertNotNull(globalObjectsAndHeaders.getGlobalObjects());
+        assertTrue(globalObjectsAndHeaders.getHeader("Sforce-Limit-Info").contains("api-usage="));
+    }
+
+    @Test
+    void testGetVersions() {
+        List<Versions> versions = RestAssured.given()
+                .get("/salesforce/versions")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(List.class);
+        assertNotNull(versions);
+        assertNotEquals(0, versions.size());
+    }
+
+    @Test
+    void testGetRestResources() {
+        RestResources restResources = RestAssured.given()
+                .get("/salesforce/resources")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .as(RestResources.class);
+        assertNotNull(restResources);
+    }
+
+    @Test
+    void testAccountWithBasicInfo() {
+        // create an object of type Account
+        String accountName = "Camel Quarkus Account Test: " + UUID.randomUUID().toString();
+        final String accountId = RestAssured.given()
+                .body(accountName)
+                .post("/salesforce/account")
+                .then()
+                .statusCode(200)
+                .extract()
+                .body()
+                .asString();
+
+        if (accountId != null) {
+            // get Account basic info
+            SObjectBasicInfo accountBasicInfo = RestAssured.given()
+                    .get("/salesforce/basic-info/account")
+                    .then()
+                    .statusCode(200)
+                    .extract()
+                    .body()
+                    .as(SObjectBasicInfo.class);
+            assertNotNull(accountBasicInfo);
+            List<RecentItem> recentItems = accountBasicInfo.getRecentItems();
+            assertNotNull(recentItems);
+            // make sure the created account is referenced
+            assertTrue(recentItems.stream().anyMatch(recentItem -> recentItem.getAttributes().getUrl().contains(accountId)));
+
+            // Get Account - querying Sobject by ID
+            RestAssured.get("/salesforce/account/" + accountId)
+                    .then()
+                    .statusCode(200)
+                    .body(
+                            "Id", not(emptyString()),
+                            "AccountNumber", not(emptyString()));
+
+            // delete the account
+            // Clean up
+            RestAssured.delete("/salesforce/account/" + accountId)

Review comment:
       Would the delete not be invoked due to crash/exception, I think subsequent tests should be fine as the accountId would not be the same ?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org