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-unsubscr...@camel.apache.org

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


Reply via email to