Search in sources :

Example 21 with HistoricTaskInstanceQuery

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

the class HistoricTaskInstanceTest method testHistoricTaskInstanceQueryByInvalidActivityInstanceId.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricTaskInstanceTest.testHistoricTaskInstance.bpmn20.xml" })
public void testHistoricTaskInstanceQueryByInvalidActivityInstanceId() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    query.activityInstanceIdIn("invalid");
    assertEquals(0, query.count());
    try {
        query.activityInstanceIdIn(null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (ProcessEngineException e) {
    }
    try {
        query.activityInstanceIdIn((String) null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (ProcessEngineException e) {
    }
    try {
        String[] values = { "a", null, "b" };
        query.activityInstanceIdIn(values);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (ProcessEngineException e) {
    }
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 22 with HistoricTaskInstanceQuery

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

the class HistoricTaskInstanceTest method testQueryByInvalidProcessInstanceBusinessKeyIn.

public void testQueryByInvalidProcessInstanceBusinessKeyIn() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    query.processInstanceBusinessKeyIn("invalid");
    assertEquals(0, query.count());
    try {
        query.processInstanceBusinessKeyIn(null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (ProcessEngineException e) {
    }
    try {
        query.processInstanceBusinessKeyIn((String) null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (ProcessEngineException e) {
    }
    try {
        String[] values = { "a", null, "b" };
        query.processInstanceBusinessKeyIn(values);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (ProcessEngineException e) {
    }
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 23 with HistoricTaskInstanceQuery

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

the class HistoricTaskInstanceTest method testQueryByInvalidTaskDefinitionKeys.

public void testQueryByInvalidTaskDefinitionKeys() {
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    query.taskDefinitionKeyIn("invalid");
    assertEquals(0, query.count());
    try {
        query.taskDefinitionKeyIn(null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (NotValidException e) {
    }
    try {
        query.taskDefinitionKeyIn((String) null);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (NotValidException e) {
    }
    try {
        String[] values = { "a", null, "b" };
        query.taskDefinitionKeyIn(values);
        fail("A ProcessEngineExcpetion was expected.");
    } catch (NotValidException e) {
    }
}
Also used : NotValidException(org.camunda.bpm.engine.exception.NotValidException) HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

Example 24 with HistoricTaskInstanceQuery

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

the class HistoricTaskInstanceTest method testHistoricTaskInstanceQueryByActivityInstanceId.

@Deployment(resources = { "org/camunda/bpm/engine/test/history/HistoricTaskInstanceTest.testHistoricTaskInstance.bpmn20.xml" })
public void testHistoricTaskInstanceQueryByActivityInstanceId() throws Exception {
    runtimeService.startProcessInstanceByKey("HistoricTaskInstanceTest");
    String activityInstanceId = historyService.createHistoricActivityInstanceQuery().activityId("task").singleResult().getId();
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().activityInstanceIdIn(activityInstanceId);
    assertEquals(1, query.count());
    assertEquals(1, query.list().size());
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 25 with HistoricTaskInstanceQuery

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

the class ProcessEngineRestServiceTest method createHistoricTaskInstanceMock.

private void createHistoricTaskInstanceMock() {
    List<HistoricTaskInstance> tasks = MockProvider.createMockHistoricTaskInstances();
    HistoricTaskInstanceQuery query = mock(HistoricTaskInstanceQuery.class);
    when(mockHistoryService.createHistoricTaskInstanceQuery()).thenReturn(query);
    when(query.list()).thenReturn(tasks);
}
Also used : HistoricTaskInstance(org.camunda.bpm.engine.history.HistoricTaskInstance) HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

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