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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]