/**
* Test getting a single execution.
*/
@Deployment(resources = {"org/activiti/rest/service/api/runtime/ExecutionResourceTest.process-with-subprocess.bpmn20.xml"})
public void testGetExecution() throws Exception {
Execution parentExecution = runtimeService.startProcessInstanceByKey("processOne");
Execution childExecution = runtimeService.createExecutionQuery().activityId("processTask").singleResult();
assertNotNull(childExecution);
CloseableHttpResponse response = executeRequest(new HttpGet(SERVER_URL_PREFIX +
RestUrls.createRelativeResourceUrl(RestUrls.URL_EXECUTION, parentExecution.getId())), HttpStatus.SC_OK);
// Check resulting parent execution
JsonNode responseNode = objectMapper.readTree(response.getEntity().getContent());
closeResponse(response);
assertNotNull(responseNode);
assertEquals(parentExecution.getId(), responseNode.get("id").textValue());
assertTrue(responseNode.get("activityId").isNull());
assertFalse(responseNode.get("suspended").booleanValue());
assertTrue(responseNode.get("parentUrl").isNull());
assertFalse(responseNode.get("suspended").booleanValue());
assertTrue(responseNode.get("url").asText().endsWith(
RestUrls.createRelativeResourceUrl(RestUrls.URL_EXECUTION, parentExecution.getId())));
assertTrue(responseNode.get("processInstanceUrl").asText().endsWith(
RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_INSTANCE, parentExecution.getId())));
// Check resulting child execution
response = executeRequest(new HttpGet(SERVER_URL_PREFIX +
RestUrls.createRelativeResourceUrl(RestUrls.URL_EXECUTION, childExecution.getId())), HttpStatus.SC_OK);
responseNode = objectMapper.readTree(response.getEntity().getContent());
closeResponse(response);
assertNotNull(responseNode);
assertEquals(childExecution.getId(), responseNode.get("id").textValue());
assertEquals("processTask", responseNode.get("activityId").textValue());
assertFalse(responseNode.get("suspended").booleanValue());
assertFalse(responseNode.get("suspended").booleanValue());
assertTrue(responseNode.get("url").asText().endsWith(
RestUrls.createRelativeResourceUrl(RestUrls.URL_EXECUTION, childExecution.getId())));
assertTrue(responseNode.get("parentUrl").asText().endsWith(
RestUrls.createRelativeResourceUrl(RestUrls.URL_EXECUTION, parentExecution.getId())));
assertTrue(responseNode.get("processInstanceUrl").asText().endsWith(