use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsAuthorizationTest method testQueryIncludingCompleteScopeWithoutAuthorization.
// historic activity statistics query (including complete scope) //////////////////////////////////
public void testQueryIncludingCompleteScopeWithoutAuthorization() {
// given
String processDefinitionId = selectProcessDefinitionByKey(PROCESS_KEY).getId();
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectAnyTask().getId();
disableAuthorization();
taskService.complete(taskId);
enableAuthorization();
// when
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId).includeCompleteScope();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsAuthorizationTest method testQueryWithoutAuthorization.
// historic activity statistics query //////////////////////////////////
public void testQueryWithoutAuthorization() {
// given
String processDefinitionId = selectProcessDefinitionByKey(PROCESS_KEY).getId();
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
// when
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId);
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsAuthorizationTest method testQueryIncludingFinishedWithoutAuthorization.
// historic activity statistics query (including finished) //////////////////////////////////
public void testQueryIncludingFinishedWithoutAuthorization() {
// given
String processDefinitionId = selectProcessDefinitionByKey(PROCESS_KEY).getId();
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectAnyTask().getId();
disableAuthorization();
taskService.complete(taskId);
enableAuthorization();
// when
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId).includeFinished();
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsAuthorizationTest method testQueryIncludingFinishedWithReadHistoryPermissionOnAnyProcessDefinition.
public void testQueryIncludingFinishedWithReadHistoryPermissionOnAnyProcessDefinition() {
// given
String processDefinitionId = selectProcessDefinitionByKey(PROCESS_KEY).getId();
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectAnyTask().getId();
disableAuthorization();
taskService.complete(taskId);
enableAuthorization();
createGrantAuthorization(PROCESS_DEFINITION, ANY, userId, READ_HISTORY);
// when
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId).includeFinished();
// then
verifyQueryResults(query, 3);
List<HistoricActivityStatistics> statistics = query.list();
HistoricActivityStatistics start = getStatisticsByKey(statistics, "theStart");
verifyStatisticsResult(start, 0, 3, 0, 0);
HistoricActivityStatistics task = getStatisticsByKey(statistics, "theTask");
verifyStatisticsResult(task, 2, 1, 0, 0);
HistoricActivityStatistics end = getStatisticsByKey(statistics, "theEnd");
verifyStatisticsResult(end, 0, 1, 0, 0);
}
use of org.camunda.bpm.engine.history.HistoricActivityStatisticsQuery in project camunda-bpm-platform by camunda.
the class HistoricActivityStatisticsAuthorizationTest method testQueryIncludingCompleteScopeWithReadHistoryPermissionOnProcessDefinition.
public void testQueryIncludingCompleteScopeWithReadHistoryPermissionOnProcessDefinition() {
// given
String processDefinitionId = selectProcessDefinitionByKey(PROCESS_KEY).getId();
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
startProcessInstanceByKey(PROCESS_KEY);
String taskId = selectAnyTask().getId();
disableAuthorization();
taskService.complete(taskId);
enableAuthorization();
createGrantAuthorization(PROCESS_DEFINITION, PROCESS_KEY, userId, READ_HISTORY);
// when
HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId).includeCompleteScope();
// then
verifyQueryResults(query, 2);
List<HistoricActivityStatistics> statistics = query.list();
HistoricActivityStatistics task = getStatisticsByKey(statistics, "theTask");
verifyStatisticsResult(task, 2, 0, 0, 0);
HistoricActivityStatistics end = getStatisticsByKey(statistics, "theEnd");
verifyStatisticsResult(end, 0, 0, 0, 1);
}
Aggregations