use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceAuthorizationTest method testDeleteProcessTaskWithDeleteHistoryPermissionOnProcessDefinition.
public void testDeleteProcessTaskWithDeleteHistoryPermissionOnProcessDefinition() {
// given
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectSingleTask().getId();
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, DELETE_HISTORY);
// when
historyService.deleteHistoricTaskInstance(taskId);
// then
disableAuthorization();
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery().taskId(taskId);
verifyQueryResults(query, 0);
enableAuthorization();
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceAuthorizationTest method testQueryWithoutAuthorization.
// historic task instance query (multiple process instances) ////////////////////////
public void testQueryWithoutAuthorization() {
// 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);
// when
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceAuthorizationTest method testMixedQueryWithoutAuthorization.
// historic task instance query (mixed tasks) ////////////////////////////////////
public void testMixedQueryWithoutAuthorization() {
// 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);
// when
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
// then
verifyQueryResults(query, 7);
deleteTask("one", true);
deleteTask("two", true);
deleteTask("three", true);
deleteTask("four", true);
deleteTask("five", true);
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceAuthorizationTest method testSimpleQueryWithMultiple.
public void testSimpleQueryWithMultiple() {
// given
startProcessInstanceByKey(PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
// when
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
// then
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.history.HistoricTaskInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricTaskInstanceAuthorizationTest method testQueryAfterDeletingDeployment.
// delete deployment (cascade = false)
public void testQueryAfterDeletingDeployment() {
// given
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
disableAuthorization();
List<Task> tasks = taskService.createTaskQuery().list();
for (Task task : tasks) {
taskService.complete(task.getId());
}
enableAuthorization();
disableAuthorization();
repositoryService.deleteDeployment(deploymentId);
enableAuthorization();
// when
HistoricTaskInstanceQuery query = historyService.createHistoricTaskInstanceQuery();
// then
verifyQueryResults(query, 3);
disableAuthorization();
List<HistoricProcessInstance> instances = historyService.createHistoricProcessInstanceQuery().list();
for (HistoricProcessInstance instance : instances) {
historyService.deleteHistoricProcessInstance(instance.getId());
}
enableAuthorization();
}
Aggregations