Search in sources :

Example 36 with HistoricTaskInstanceQuery

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

the class HistoricTaskInstanceAuthorizationTest method testMixedQueryWithReadHistoryPermissionOnAnyProcessDefinition.

public void testMixedQueryWithReadHistoryPermissionOnAnyProcessDefinition() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    startProcessInstanceByKey(PROCESS_KEY);
    startProcessInstanceByKey(PROCESS_KEY);
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
    createTask("one");
    createTask("two");
    createTask("three");
    createTask("four");
    createTask("five");
    createCaseInstanceByKey(CASE_KEY);
    createCaseInstanceByKey(CASE_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
    // when
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    // then
    verifyQueryResults(query, 14);
    deleteTask("one", true);
    deleteTask("two", true);
    deleteTask("three", true);
    deleteTask("four", true);
    deleteTask("five", true);
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

Example 37 with HistoricTaskInstanceQuery

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

the class HistoricTaskInstanceAuthorizationTest method testQueryWithReadHistoryPermissionOnProcessDefinition.

public void testQueryWithReadHistoryPermissionOnProcessDefinition() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    startProcessInstanceByKey(PROCESS_KEY);
    startProcessInstanceByKey(PROCESS_KEY);
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
    startProcessInstanceByKey(MESSAGE_START_PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
    // when
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    // then
    verifyQueryResults(query, 3);
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

Example 38 with HistoricTaskInstanceQuery

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

the class HistoricTaskInstanceAuthorizationTest method testSimpleQueryWithReadHistoryPermissionOnProcessDefinition.

public void testSimpleQueryWithReadHistoryPermissionOnProcessDefinition() {
    // given
    startProcessInstanceByKey(PROCESS_KEY);
    createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
    // when
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
    // then
    verifyQueryResults(query, 1);
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

Example 39 with HistoricTaskInstanceQuery

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

the class HistoricTaskInstanceAuthorizationTest method testDeleteHistoricTaskInstanceAfterDeletingDeployment.

public void testDeleteHistoricTaskInstanceAfterDeletingDeployment() {
    // given
    String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
    String taskId = selectSingleTask().getId();
    disableAuthorization();
    taskService.complete(taskId);
    enableAuthorization();
    createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, DELETE_HISTORY);
    disableAuthorization();
    repositoryService.deleteDeployment(deploymentId);
    enableAuthorization();
    // when
    historyService.deleteHistoricTaskInstance(taskId);
    // then
    disableAuthorization();
    HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().taskId(taskId);
    verifyQueryResults(query, 0);
    enableAuthorization();
    disableAuthorization();
    historyService.deleteHistoricProcessInstance(processInstanceId);
    enableAuthorization();
}
Also used : HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery)

Example 40 with HistoricTaskInstanceQuery

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

the class CompleteProcessWithParallelGatewayTest method testQueryHistoricProcessWithParallelGateway.

@Test
@ScenarioUnderTest("init.complete.two.1")
public void testQueryHistoricProcessWithParallelGateway() {
    // given an already finished process instance with parallel gateway and two user tasks
    HistoricProcessInstance historicProcessInstance = rule.historicProcessInstance();
    // when query history
    HistoricTaskInstanceQuery historicTaskQuery = rule.getHistoryService().createHistoricTaskInstanceQuery().processInstanceId(historicProcessInstance.getId());
    // then two historic user tasks are returned
    Assert.assertEquals(2, historicTaskQuery.count());
}
Also used : HistoricProcessInstance(org.camunda.bpm.engine.history.HistoricProcessInstance) HistoricTaskInstanceQuery(org.camunda.bpm.engine.history.HistoricTaskInstanceQuery) Test(org.junit.Test) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest) ScenarioUnderTest(org.camunda.bpm.qa.upgrade.ScenarioUnderTest)

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