Search in sources :

Example 6 with ApprovalRequests

use of org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests in project camel by apache.

the class AbstractRestProcessorApprovalTest method shouldFetchApprovalRequestFromHeader.

@Test
public void shouldFetchApprovalRequestFromHeader() throws SalesforceException {
    final ApprovalRequest request = new ApprovalRequest();
    request.setComments("hi there");
    final TestRestProcessor processor = sendBodyAndHeader(null, request);
    verify(processor).getRequestStream(new ApprovalRequests(request));
}
Also used : ApprovalRequests(org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests) ApprovalRequest(org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequest) Test(org.junit.Test)

Example 7 with ApprovalRequests

use of org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests in project camel by apache.

the class AbstractRestProcessorApprovalTest method shouldFetchApprovalRequestFromHeaderEvenIfBodyIsDefinedButNotConvertable.

@Test
public void shouldFetchApprovalRequestFromHeaderEvenIfBodyIsDefinedButNotConvertable() throws SalesforceException {
    final ApprovalRequest request = new ApprovalRequest();
    request.setComments("hi there");
    final TestRestProcessor processor = sendBodyAndHeaders("Nothing to see here", request, Collections.singletonMap("approval.ContextId", "context-id"));
    final ApprovalRequest combined = new ApprovalRequest();
    combined.setComments("hi there");
    combined.setContextId("context-id");
    verify(processor).getRequestStream(new ApprovalRequests(combined));
}
Also used : ApprovalRequests(org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests) ApprovalRequest(org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequest) Test(org.junit.Test)

Example 8 with ApprovalRequests

use of org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests in project camel by apache.

the class AbstractRestProcessorApprovalTest method shouldFetchApprovalRequestFromBody.

@Test
public void shouldFetchApprovalRequestFromBody() throws SalesforceException {
    final ApprovalRequest approvalRequest = new ApprovalRequest();
    approvalRequest.setComments("it should be me");
    final TestRestProcessor processor = sendBody(approvalRequest);
    verify(processor).getRequestStream(new ApprovalRequests(approvalRequest));
}
Also used : ApprovalRequests(org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests) ApprovalRequest(org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequest) Test(org.junit.Test)

Example 9 with ApprovalRequests

use of org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests in project camel by apache.

the class AbstractRestProcessorApprovalTest method shouldFetchApprovalRequestsFromBody.

@Test
public void shouldFetchApprovalRequestsFromBody() throws SalesforceException {
    final ApprovalRequest approvalRequest1 = new ApprovalRequest();
    approvalRequest1.setComments("it should be me first");
    final ApprovalRequest approvalRequest2 = new ApprovalRequest();
    approvalRequest2.setComments("it should be me second");
    final TestRestProcessor processor = sendBody(Arrays.asList(approvalRequest1, approvalRequest2));
    verify(processor).getRequestStream(new ApprovalRequests(Arrays.asList(approvalRequest1, approvalRequest2)));
}
Also used : ApprovalRequests(org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests) ApprovalRequest(org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequest) Test(org.junit.Test)

Aggregations

ApprovalRequest (org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequest)9 ApprovalRequests (org.apache.camel.component.salesforce.api.dto.approval.ApprovalRequests)9 Test (org.junit.Test)8 HashMap (java.util.HashMap)2 InputStream (java.io.InputStream)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 URLEncoder (java.net.URLEncoder)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 StreamSupport (java.util.stream.StreamSupport)1 AsyncCallback (org.apache.camel.AsyncCallback)1 Exchange (org.apache.camel.Exchange)1 Message (org.apache.camel.Message)1 TypeConverter (org.apache.camel.TypeConverter)1