Search in sources :

Example 51 with HistoricTaskInstanceQuery

use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricTaskInstanceTest method testQueryByInvalidCaseInstanceId.

public void testQueryByInvalidCaseInstanceId() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    query.caseInstanceId("invalid");
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());
    query.caseInstanceId(null);
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

Example 52 with HistoricTaskInstanceQuery

use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricTaskInstanceTest method testQueryByProcessInstanceBusinessKeyAndArray.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryByProcessInstanceBusinessKeyAndArray() {
    // given
    String businessKey1 = "BUSINESS-KEY-1";
    String businessKey2 = "BUSINESS-KEY-2";
    String businessKey3 = "BUSINESS-KEY-3";
    String unexistingBusinessKey = "unexistingBusinessKey";
    runtimeService.startProcessInstanceByKey("oneTaskProcess", businessKey1);
    runtimeService.startProcessInstanceByKey("oneTaskProcess", businessKey2);
    runtimeService.startProcessInstanceByKey("oneTaskProcess", businessKey3);
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    // then
    assertEquals(0, query.processInstanceBusinessKeyIn(businessKey1, businessKey2).processInstanceBusinessKey(unexistingBusinessKey).count());
    assertEquals(1, query.processInstanceBusinessKeyIn(businessKey2, businessKey3).processInstanceBusinessKey(businessKey2).count());
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 53 with HistoricTaskInstanceQuery

use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricTaskInstanceTest method testQueryByProcessInstanceBusinessKeyIn.

@Deployment(resources = { "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testQueryByProcessInstanceBusinessKeyIn() {
    // given
    String businessKey1 = "BUSINESS-KEY-1";
    String businessKey2 = "BUSINESS-KEY-2";
    String businessKey3 = "BUSINESS-KEY-3";
    String unexistingBusinessKey = "unexistingBusinessKey";
    runtimeService.startProcessInstanceByKey("oneTaskProcess", businessKey1);
    runtimeService.startProcessInstanceByKey("oneTaskProcess", businessKey2);
    runtimeService.startProcessInstanceByKey("oneTaskProcess", businessKey3);
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    // then
    assertEquals(3, query.processInstanceBusinessKeyIn(businessKey1, businessKey2, businessKey3).list().size());
    assertEquals(1, query.processInstanceBusinessKeyIn(businessKey2, unexistingBusinessKey).count());
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 54 with HistoricTaskInstanceQuery

use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricTaskInstanceTest method testQueryByInvalidCaseExecutionId.

public void testQueryByInvalidCaseExecutionId() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    query.caseExecutionId("invalid");
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());
    query.caseExecutionId(null);
    assertEquals(0, query.count());
    assertEquals(0, query.list().size());
    assertNull(query.singleResult());
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

Example 55 with HistoricTaskInstanceQuery

use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.

the class HistoricTaskInstanceTest method testQueryByTaskDefinitionKey.

@Deployment(resources = "org/camunda/bpm/engine/test/api/oneTaskProcess.bpmn20.xml")
public void testQueryByTaskDefinitionKey() {
    // given
    runtimeService.startProcessInstanceByKey("oneTaskProcess");
    // when
    HistoricTaskInstanceQuery query1 = historyService.createHistoricTaskInstanceQuery().taskDefinitionKey("theTask");
    HistoricTaskInstanceQuery query2 = historyService.createHistoricTaskInstanceQuery().taskDefinitionKeyIn("theTask");
    // then
    assertEquals(1, query1.count());
    assertEquals(1, query2.count());
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Aggregations

HistoricTaskInstanceQuery (org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)55 Deployment (org.camunda.bpm.engine.test.Deployment)16 HistoricTaskInstance (org.camunda.bpm.engine.history.HistoricTaskInstance)9 ProcessInstance (org.camunda.bpm.engine.runtime.ProcessInstance)5 Test (org.junit.Test)4 HistoricProcessInstance (org.camunda.bpm.engine.history.HistoricProcessInstance)3 Task (org.camunda.bpm.engine.task.Task)3 ScenarioUnderTest (org.camunda.bpm.qa.upgrade.ScenarioUnderTest)3 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)2 RequiredHistoryLevel (org.camunda.bpm.engine.test.RequiredHistoryLevel)2 ArrayList (java.util.ArrayList)1 NotValidException (org.camunda.bpm.engine.exception.NotValidException)1 MigrationPlan (org.camunda.bpm.engine.migration.MigrationPlan)1 CaseDefinition (org.camunda.bpm.engine.repository.CaseDefinition)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 CountResultDto (org.camunda.bpm.engine.rest.dto.CountResultDto)1 HistoricTaskInstanceDto (org.camunda.bpm.engine.rest.dto.history.HistoricTaskInstanceDto)1 ActivityInstance (org.camunda.bpm.engine.runtime.ActivityInstance)1 Job (org.camunda.bpm.engine.runtime.Job)1 ProcessInstanceQuery (org.camunda.bpm.engine.runtime.ProcessInstanceQuery)1