Search in sources :

Example 1 with Approvals

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());
}
Also used : Approvals(org.apache.camel.component.salesforce.api.dto.approval.Approvals) ApprovalResult(org.apache.camel.component.salesforce.api.dto.approval.ApprovalResult) Info(org.apache.camel.component.salesforce.api.dto.approval.Approvals.Info) Test(org.junit.Test)

Aggregations

ApprovalResult (org.apache.camel.component.salesforce.api.dto.approval.ApprovalResult)1 Approvals (org.apache.camel.component.salesforce.api.dto.approval.Approvals)1 Info (org.apache.camel.component.salesforce.api.dto.approval.Approvals.Info)1 Test (org.junit.Test)1