Search in sources :

Example 1 with WorkflowExecutionInfo

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

the class CamelSWFWorkflowClient method describeWorkflowInstance.

public Map<String, Object> describeWorkflowInstance(String workflowId, String runId) {
    DescribeWorkflowExecutionRequest describeRequest = new DescribeWorkflowExecutionRequest();
    describeRequest.setDomain(configuration.getDomainName());
    describeRequest.setExecution(new WorkflowExecution().withWorkflowId(workflowId).withRunId(runId));
    WorkflowExecutionDetail executionDetail = endpoint.getSWClient().describeWorkflowExecution(describeRequest);
    WorkflowExecutionInfo instanceMetadata = executionDetail.getExecutionInfo();
    Map<String, Object> info = new HashMap<String, Object>();
    info.put("closeStatus", instanceMetadata.getCloseStatus());
    info.put("closeTimestamp", instanceMetadata.getCloseTimestamp());
    info.put("executionStatus", instanceMetadata.getExecutionStatus());
    info.put("tagList", instanceMetadata.getTagList());
    info.put("executionDetail", executionDetail);
    return info;
}
Also used : WorkflowExecutionDetail(com.amazonaws.services.simpleworkflow.model.WorkflowExecutionDetail) WorkflowExecutionInfo(com.amazonaws.services.simpleworkflow.model.WorkflowExecutionInfo) HashMap(java.util.HashMap) DescribeWorkflowExecutionRequest(com.amazonaws.services.simpleworkflow.model.DescribeWorkflowExecutionRequest) WorkflowExecution(com.amazonaws.services.simpleworkflow.model.WorkflowExecution)

Example 2 with WorkflowExecutionInfo

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

the class CamelSWFWorkflowClientTest method testDescribeWorkflowInstance.

@Test
public void testDescribeWorkflowInstance() throws Exception {
    WorkflowExecutionInfo executionInfo = new WorkflowExecutionInfo();
    executionInfo.setCloseStatus("COMPLETED");
    Date closeTimestamp = new Date();
    executionInfo.setCloseTimestamp(closeTimestamp);
    executionInfo.setExecutionStatus("CLOSED");
    executionInfo.setTagList(Collections.EMPTY_LIST);
    WorkflowExecutionDetail workflowExecutionDetail = new WorkflowExecutionDetail();
    workflowExecutionDetail.setExecutionInfo(executionInfo);
    when(swClient.describeWorkflowExecution(any(DescribeWorkflowExecutionRequest.class))).thenReturn(workflowExecutionDetail);
    Map<String, Object> description = camelSWFWorkflowClient.describeWorkflowInstance("123", "run1");
    DescribeWorkflowExecutionRequest describeRequest = new DescribeWorkflowExecutionRequest();
    describeRequest.setDomain(configuration.getDomainName());
    describeRequest.setExecution(new WorkflowExecution().withWorkflowId("123").withRunId("run1"));
    verify(swClient).describeWorkflowExecution(describeRequest);
    assertThat((String) description.get("closeStatus"), is("COMPLETED"));
    assertThat((Date) description.get("closeTimestamp"), is(closeTimestamp));
    assertThat((String) description.get("executionStatus"), is("CLOSED"));
    assertThat((List) description.get("tagList"), is(Collections.EMPTY_LIST));
    assertThat((WorkflowExecutionDetail) description.get("executionDetail"), is(workflowExecutionDetail));
}
Also used : WorkflowExecutionDetail(com.amazonaws.services.simpleworkflow.model.WorkflowExecutionDetail) WorkflowExecutionInfo(com.amazonaws.services.simpleworkflow.model.WorkflowExecutionInfo) DescribeWorkflowExecutionRequest(com.amazonaws.services.simpleworkflow.model.DescribeWorkflowExecutionRequest) WorkflowExecution(com.amazonaws.services.simpleworkflow.model.WorkflowExecution) Date(java.util.Date) Test(org.junit.Test)

Aggregations

DescribeWorkflowExecutionRequest (com.amazonaws.services.simpleworkflow.model.DescribeWorkflowExecutionRequest)2 WorkflowExecution (com.amazonaws.services.simpleworkflow.model.WorkflowExecution)2 WorkflowExecutionDetail (com.amazonaws.services.simpleworkflow.model.WorkflowExecutionDetail)2 WorkflowExecutionInfo (com.amazonaws.services.simpleworkflow.model.WorkflowExecutionInfo)2 Date (java.util.Date)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1