use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceTest method testQueryByCaseDefinitionId.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseDefinitionId() {
// given
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().singleResult().getId();
String caseInstanceId = caseService.withCaseDefinition(caseDefinitionId).create().getId();
String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
// then
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
query.caseDefinitionId(caseDefinitionId);
assertEquals(1, query.count());
assertEquals(1, query.list().size());
assertNotNull(query.singleResult());
HistoricTaskInstance task = query.singleResult();
assertNotNull(task);
assertEquals(caseDefinitionId, task.getCaseDefinitionId());
assertEquals(caseInstanceId, task.getCaseInstanceId());
assertEquals(humanTaskId, task.getCaseExecutionId());
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceTest method testQueryByCaseExecutionId.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByCaseExecutionId() {
// given
String key = "oneTaskCase";
String caseDefinitionId = repositoryService.createCaseDefinitionQuery().caseDefinitionKey(key).singleResult().getId();
String caseInstanceId = caseService.withCaseDefinitionByKey(key).create().getId();
String humanTaskId = caseService.createCaseExecutionQuery().activityId("PI_HumanTask_1").singleResult().getId();
// then
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
query.caseExecutionId(humanTaskId);
assertEquals(1, query.count());
assertEquals(1, query.list().size());
assertNotNull(query.singleResult());
HistoricTaskInstance task = query.singleResult();
assertNotNull(task);
assertEquals(caseDefinitionId, task.getCaseDefinitionId());
assertEquals(caseInstanceId, task.getCaseInstanceId());
assertEquals(humanTaskId, task.getCaseExecutionId());
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceTest method testQueryByTaskDefinitionKeys.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml", "org/camunda/bpm/engine/test/api/cmmn/oneTaskCase.cmmn" })
public void testQueryByTaskDefinitionKeys() {
// given
runtimeService.startProcessInstanceByKey("oneTaskProcess");
caseService.createCaseInstanceByKey("oneTaskCase");
// when
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().taskDefinitionKeyIn("theTask", "PI_HumanTask_1");
// then
assertEquals(2, query.count());
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceTest method testQueryByProcessInstanceBusinessKeyLike.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryByProcessInstanceBusinessKeyLike() {
// given
runtimeService.startProcessInstanceByKey("oneTaskProcess", "BUSINESS-KEY-1");
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
// then
assertEquals(1, query.processInstanceBusinessKeyLike("BUSINESS-KEY-1").list().size());
assertEquals(1, query.processInstanceBusinessKeyLike("BUSINESS-KEY%").count());
assertEquals(1, query.processInstanceBusinessKeyLike("%KEY-1").count());
assertEquals(1, query.processInstanceBusinessKeyLike("%KEY%").count());
assertEquals(0, query.processInstanceBusinessKeyLike("BUZINESS-KEY%").count());
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceTest method testQueryByInvalidCaseDefinitionName.
public void testQueryByInvalidCaseDefinitionName() {
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
query.caseDefinitionName("invalid");
assertEquals(0, query.count());
assertEquals(0, query.list().size());
assertNull(query.singleResult());
query.caseDefinitionName(null);
assertEquals(0, query.count());
assertEquals(0, query.list().size());
assertNull(query.singleResult());
}
Aggregations