use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class ExternalTaskQueryTest method testQueryByProcessInstanceId.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testQueryByProcessInstanceId() {
// given
List<ProcessInstance> processInstances = startInstancesByKey("oneExternalTaskProcess", 3);
// when
ExternalTask task = externalTaskService.createExternalTaskQuery().processInstanceId(processInstances.get(0).getId()).singleResult();
// then
assertNotNull(task);
assertEquals(processInstances.get(0).getId(), task.getProcessInstanceId());
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class ExternalTaskQueryTest method testQueryByProcessInstanceIdIn.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testQueryByProcessInstanceIdIn() {
// given
List<ProcessInstance> processInstances = startInstancesByKey("oneExternalTaskProcess", 3);
List<String> processInstanceIds = Arrays.asList(processInstances.get(0).getId(), processInstances.get(1).getId());
// when
List<ExternalTask> tasks = externalTaskService.createExternalTaskQuery().processInstanceIdIn(processInstances.get(0).getId(), processInstances.get(1).getId()).list();
// then
assertNotNull(tasks);
assertEquals(2, tasks.size());
for (ExternalTask task : tasks) {
assertTrue(processInstanceIds.contains(task.getProcessInstanceId()));
}
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class ExternalTaskQueryTest method testSingleResult.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testSingleResult() {
// given
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");
// when
ExternalTask externalTask = externalTaskService.createExternalTaskQuery().singleResult();
// then
assertNotNull(externalTask.getId());
assertEquals(processInstance.getId(), externalTask.getProcessInstanceId());
assertEquals("externalTask", externalTask.getActivityId());
assertNotNull(externalTask.getActivityInstanceId());
assertNotNull(externalTask.getExecutionId());
assertEquals(processInstance.getProcessDefinitionId(), externalTask.getProcessDefinitionId());
assertEquals("oneExternalTaskProcess", externalTask.getProcessDefinitionKey());
assertEquals(TOPIC_NAME, externalTask.getTopicName());
assertNull(externalTask.getWorkerId());
assertNull(externalTask.getLockExpirationTime());
assertFalse(externalTask.isSuspended());
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class ExternalTaskQueryTest method testQueryByExecutionId.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testQueryByExecutionId() {
// given
List<ProcessInstance> processInstances = startInstancesByKey("oneExternalTaskProcess", 3);
ProcessInstance firstInstance = processInstances.get(0);
ActivityInstance externalTaskActivityInstance = runtimeService.getActivityInstance(firstInstance.getId()).getActivityInstances("externalTask")[0];
String executionId = externalTaskActivityInstance.getExecutionIds()[0];
// when
ExternalTask externalTask = externalTaskService.createExternalTaskQuery().executionId(executionId).singleResult();
// then
assertNotNull(externalTask);
assertEquals(executionId, externalTask.getExecutionId());
}
use of org.camunda.bpm.engine.runtime.ProcessInstance in project camunda-bpm-platform by camunda.
the class ExternalTaskServiceTest method testHandleBpmnErrorReclaimedLockExpiredTaskWithoutDefinedBoundary.
@Deployment(resources = "org/camunda/bpm/engine/test/api/externaltask/oneExternalTaskProcess.bpmn20.xml")
public void testHandleBpmnErrorReclaimedLockExpiredTaskWithoutDefinedBoundary() {
// given
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneExternalTaskProcess");
handleBpmnErrorReclaimedLockExpiredTask();
assertProcessEnded(processInstance.getId());
}
Aggregations