use of org.apache.camel.component.salesforce.api.dto.approval.ApprovalResult in project camel by apache.
the class ApprovalExamplesIntegrationTest method example1.
@Test
public void example1() {
// tag::example1Usage
final Map<String, String> body = new HashMap<>();
body.put("contextId", accountIds.iterator().next());
body.put("nextApproverIds", userId);
final ApprovalResult result = template.requestBody("direct:example1", body, ApprovalResult.class);
// end::example1Usage
assertNotNull("Result should be received", result);
}
use of org.apache.camel.component.salesforce.api.dto.approval.ApprovalResult in project camel by apache.
the class ApprovalIntegrationTest method shouldSubmitAndFetchApprovals.
@Test
public void shouldSubmitAndFetchApprovals() {
final ApprovalResult approvalResult = template.requestBody(String.format(//
"salesforce:approval?" + //
"format=%s" + //
"&approvalActionType=Submit" + //
"&approvalContextId=%s" + //
"&approvalNextApproverIds=%s" + //
"&approvalComments=Integration test" + "&approvalProcessDefinitionNameOrId=Test_Account_Process", format, accountIds.get(0), userId), NOT_USED, ApprovalResult.class);
assertNotNull("Approval should have resulted in value", approvalResult);
assertEquals("There should be one Account waiting approval", 1, approvalResult.size());
assertEquals("Instance status of the item in approval result should be `Pending`", "Pending", approvalResult.iterator().next().getInstanceStatus());
// as it stands on 18.11.2016. the GET method on /vXX.X/process/approvals/ with Accept other than
// `application/json` results in HTTP status 500, so only JSON is supported
final Approvals approvals = template.requestBody("salesforce:approvals", NOT_USED, Approvals.class);
assertNotNull("Approvals should be fetched", approvals);
final List<Info> accountApprovals = approvals.approvalsFor("Account");
assertEquals("There should be one Account waiting approval", 1, accountApprovals.size());
}
use of org.apache.camel.component.salesforce.api.dto.approval.ApprovalResult in project camel by apache.
the class ApprovalIntegrationTest method shouldSubmitBulkApprovals.
@Test
public void shouldSubmitBulkApprovals() {
final List<ApprovalRequest> approvalRequests = accountIds.stream().map(id -> {
final ApprovalRequest request = new ApprovalRequest();
request.setContextId(id);
request.setComments("Approval for " + id);
request.setActionType(Action.Submit);
return request;
}).collect(Collectors.toList());
final ApprovalResult approvalResult = template.requestBody(String.format(//
"salesforce:approval?" + //
"format=%s" + //
"&approvalActionType=Submit" + //
"&approvalNextApproverIds=%s" + "&approvalProcessDefinitionNameOrId=Test_Account_Process", format, userId), approvalRequests, ApprovalResult.class);
assertEquals("Should have same number of approval results as requests", approvalRequests.size(), approvalResult.size());
}
use of org.apache.camel.component.salesforce.api.dto.approval.ApprovalResult in project camel by apache.
the class ApprovalExamplesIntegrationTest method example2.
@Test
public void example2() {
// tag::example2Usage
final Map<String, String> body = new HashMap<>();
body.put("contextId", accountIds.iterator().next());
body.put("nextApproverIds", userId);
final ApprovalResult result = template.requestBody("direct:example2", body, ApprovalResult.class);
// end::example2Usage
assertNotNull("Result should be received", result);
}
Aggregations