use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceAuthorizationTest method testQueryWithMultiple.
public void testQueryWithMultiple() {
// given
startProcessInstanceAndEvaluateDecision();
createGrantAuthorization(DECISION_DEFINITION, ANY, userId, READ_HISTORY);
createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ_HISTORY);
// when
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
// then
verifyQueryResults(query, 1);
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceAuthorizationTest method testDeleteHistoricDecisionInstanceByInstanceIdWithDeleteHistoryPermissionOnDecisionDefinition.
public void testDeleteHistoricDecisionInstanceByInstanceIdWithDeleteHistoryPermissionOnDecisionDefinition() {
// given
createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, DELETE_HISTORY, READ_HISTORY);
startProcessInstanceAndEvaluateDecision();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
verifyQueryResults(query, 1);
HistoricDecisionInstance historicDecisionInstance = query.includeInputs().includeOutputs().singleResult();
// when
historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId());
// then
verifyQueryResults(query, 0);
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceAuthorizationTest method testDeleteHistoricDecisionInstanceByInstanceIdWithoutAuthorization.
public void testDeleteHistoricDecisionInstanceByInstanceIdWithoutAuthorization() {
// given
createGrantAuthorization(DECISION_DEFINITION, DECISION_DEFINITION_KEY, userId, READ_HISTORY);
startProcessInstanceAndEvaluateDecision();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
HistoricDecisionInstance historicDecisionInstance = query.includeInputs().includeOutputs().singleResult();
try {
// when
historyService.deleteHistoricDecisionInstanceByInstanceId(historicDecisionInstance.getId());
fail("expect authorization exception");
} catch (AuthorizationException e) {
// then
assertThat(e.getMessage(), is("The user with id 'test' does not have 'DELETE_HISTORY' permission on resource 'testDecision' of type 'DecisionDefinition'."));
}
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceQueryTest method testQueryByCaseDefinitionId.
@Deployment(resources = { DECISION_CASE, DECISION_SINGLE_OUTPUT_DMN })
public void testQueryByCaseDefinitionId() {
CaseInstance caseInstance = createCaseInstanceAndEvaluateDecision();
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.caseDefinitionId(caseInstance.getCaseDefinitionId()).count(), is(1L));
}
use of org.camunda.bpm.engine.history.HistoricDecisionInstanceQuery in project camunda-bpm-platform by camunda.
the class HistoricDecisionInstanceQueryTest method testQueryByInvalidUserId.
@Deployment(resources = { DECISION_SINGLE_OUTPUT_DMN })
public void testQueryByInvalidUserId() {
evaluateDecisionWithAuthenticatedUser("demo");
HistoricDecisionInstanceQuery query = historyService.createHistoricDecisionInstanceQuery();
assertThat(query.userId("dem1").count(), is(0L));
try {
query.userId(null);
fail("exception expected");
} catch (ProcessEngineException e) {
}
}
Aggregations