use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest method testSimpleQueryWithReadHistoryPermissionOnProcessDefinition.
public void testSimpleQueryWithReadHistoryPermissionOnProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
// when
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
// then
verifyQueryResults(query, 1);
HistoricProcessInstance instance = query.singleResult();
assertNotNull(instance);
assertEquals(processInstanceId, instance.getId());
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest method testSimpleQueryWithoutAuthorization.
// historic process instance query //////////////////////////////////////////////////////////
public void testSimpleQueryWithoutAuthorization() {
// given
startProcessInstanceByKey(PROCESS_KEY);
// when
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest method testSimpleQueryWithReadHistoryPermissionOnAnyProcessDefinition.
public void testSimpleQueryWithReadHistoryPermissionOnAnyProcessDefinition() {
// given
String processInstanceId = startProcessInstanceByKey(PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
// when
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
// then
verifyQueryResults(query, 1);
HistoricProcessInstance instance = query.singleResult();
assertNotNull(instance);
assertEquals(processInstanceId, instance.getId());
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest method testSimpleQueryWithMultiple.
public void testSimpleQueryWithMultiple() {
// given
startProcessInstanceByKey(PROCESS_KEY).getId();
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
// when
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
// then
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.history.HistoricProcessInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricProcessInstanceAuthorizationTest 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
HistoricProcessInstanceQuery query = historyService.createHistoricProcessInstanceQuery();
// then
verifyQueryResults(query, 3);
disableAuthorization();
List<HistoricProcessInstance> instances = historyService.createHistoricProcessInstanceQuery().list();
for (HistoricProcessInstance instance : instances) {
historyService.deleteHistoricProcessInstance(instance.getId());
}
enableAuthorization();
}
Aggregations