use of com.amazonaws.services.simpleworkflow.model.DescribeWorkflowExecutionRequest 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;
}
use of com.amazonaws.services.simpleworkflow.model.DescribeWorkflowExecutionRequest 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));
}
Aggregations