use of org.apache.camel.component.salesforce.api.dto.approval.Approvals 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());
}
Aggregations