use of com.amazonaws.services.simpleworkflow.model.WorkflowExecution 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.WorkflowExecution 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));
}
use of com.amazonaws.services.simpleworkflow.model.WorkflowExecution in project camel by apache.
the class CamelSWFWorkflowClientTest method testStartWorkflowExecution.
@Test
public void testStartWorkflowExecution() throws Throwable {
WorkflowExecution workflowExecution = new WorkflowExecution();
workflowExecution.setWorkflowId("123");
workflowExecution.setRunId("run1");
when(clientExternal.getWorkflowExecution()).thenReturn(workflowExecution);
String[] ids = camelSWFWorkflowClient.startWorkflowExecution(null, null, "eventName", "version", null, Collections.singletonList("camelTest"));
verify(clientExternal).startWorkflowExecution(new Object[] { null });
assertThat("123", is(ids[0]));
assertThat("run1", is(ids[1]));
}
use of com.amazonaws.services.simpleworkflow.model.WorkflowExecution in project camel by apache.
the class CamelSWFWorkflowClient method getDynamicWorkflowClient.
DynamicWorkflowClientExternal getDynamicWorkflowClient(String workflowId, String runId) {
GenericWorkflowClientExternalImpl genericClient = new GenericWorkflowClientExternalImpl(endpoint.getSWClient(), configuration.getDomainName());
WorkflowExecution workflowExecution = new WorkflowExecution();
workflowExecution.setWorkflowId(workflowId != null ? workflowId : genericClient.generateUniqueId());
workflowExecution.setRunId(runId);
return new DynamicWorkflowClientExternalImpl(workflowExecution, null, endpoint.getStartWorkflowOptions(), configuration.getDataConverter(), genericClient);
}
Aggregations