04-15-2014 11:58 PM
04-22-2014 06:38 AM
/**
* Test starting a process instance using procDefinitionId, key procDefinitionKey business-key.
*/
@Deployment(resources = {"org/activiti/rest/service/api/runtime/ProcessInstanceResourceTest.process-one.bpmn20.xml"})
public void testStartProcess() throws Exception {
ClientResource client = getAuthenticatedClient(RestUrls.createRelativeResourceUrl(RestUrls.URL_PROCESS_INSTANCE_COLLECTION));
ObjectNode requestNode = objectMapper.createObjectNode();
// Start using process definition key
requestNode.put("processDefinitionKey", "processOne");
Representation response = client.post(requestNode);
assertEquals(Status.SUCCESS_CREATED, client.getResponse().getStatus());
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().singleResult();
assertNotNull(processInstance);
JsonNode responseNode = objectMapper.readTree(response.getStream());
assertNotNull(responseNode);
assertEquals(processInstance.getId(), responseNode.get("id").getTextValue());
assertTrue(responseNode.get("businessKey").isNull());
assertEquals("processTask", responseNode.get("activityId").getTextValue());
assertFalse(responseNode.get("suspended").getBooleanValue());
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.