Search in sources :

Example 1 with DecisionTask

use of com.amazonaws.services.simpleworkflow.model.DecisionTask in project camel by apache.

the class CamelSWFWorkflowConsumerTest method receivesDecisionTask.

@Test
public void receivesDecisionTask() throws Exception {
    // use minimum as depending on the polling we may do more than 1 in the test before we assert and stop
    result.expectedMinimumMessageCount(1);
    result.expectedMessagesMatches(new Predicate() {

        public boolean matches(Exchange exchange) {
            return exchange.getIn().getHeader(SWFConstants.ACTION) != null;
        }
    });
    DecisionTask decisionTask = new DecisionTask();
    decisionTask.setTaskToken("token");
    when(amazonSWClient.pollForDecisionTask(any(PollForDecisionTaskRequest.class))).thenReturn(decisionTask);
    context.start();
    assertMockEndpointsSatisfied();
    verify(amazonSWClient, atLeastOnce()).pollForDecisionTask(any(PollForDecisionTaskRequest.class));
}
Also used : Exchange(org.apache.camel.Exchange) DecisionTask(com.amazonaws.services.simpleworkflow.model.DecisionTask) PollForDecisionTaskRequest(com.amazonaws.services.simpleworkflow.model.PollForDecisionTaskRequest) Predicate(org.apache.camel.Predicate) Test(org.junit.Test)

Aggregations

DecisionTask (com.amazonaws.services.simpleworkflow.model.DecisionTask)1 PollForDecisionTaskRequest (com.amazonaws.services.simpleworkflow.model.PollForDecisionTaskRequest)1 Exchange (org.apache.camel.Exchange)1 Predicate (org.apache.camel.Predicate)1 Test (org.junit.Test)1