use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class EvaluateDecisionAuthorizationTest method evaluateDecisionByKey.
@Test
@Deployment(resources = DMN_FILE)
public void evaluateDecisionByKey() {
// given
DecisionDefinition decisionDefinition = engineRule.getRepositoryService().createDecisionDefinitionQuery().singleResult();
// when
authRule.init(scenario).withUser("userId").bindResource("decisionDefinitionKey", DECISION_DEFINITION_KEY).start();
DmnDecisionTableResult decisionResult = engineRule.getDecisionService().evaluateDecisionTableByKey(decisionDefinition.getKey(), createVariables());
// then
if (authRule.assertScenario(scenario)) {
assertThatDecisionHasExpectedResult(decisionResult);
}
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class EvaluateDecisionAuthorizationTest method evaluateDecisionByKeyAndVersion.
@Test
@Deployment(resources = DMN_FILE)
public void evaluateDecisionByKeyAndVersion() {
// given
DecisionDefinition decisionDefinition = engineRule.getRepositoryService().createDecisionDefinitionQuery().singleResult();
// when
authRule.init(scenario).withUser("userId").bindResource("decisionDefinitionKey", DECISION_DEFINITION_KEY).start();
DmnDecisionTableResult decisionResult = engineRule.getDecisionService().evaluateDecisionTableByKeyAndVersion(decisionDefinition.getKey(), decisionDefinition.getVersion(), createVariables());
// then
if (authRule.assertScenario(scenario)) {
assertThatDecisionHasExpectedResult(decisionResult);
}
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class BulkHistoryDeleteCmmnDisabledTest method prepareHistoricDecisions.
private void prepareHistoricDecisions(int instanceCount) {
Date oldCurrentTime = ClockUtil.getCurrentTime();
List<DecisionDefinition> decisionDefinitions = engineRule.getRepositoryService().createDecisionDefinitionQuery().decisionDefinitionKey("decision").list();
assertEquals(1, decisionDefinitions.size());
engineRule.getRepositoryService().updateDecisionDefinitionHistoryTimeToLive(decisionDefinitions.get(0).getId(), 5);
ClockUtil.setCurrentTime(DateUtils.addDays(new Date(), -6));
for (int i = 0; i < instanceCount; i++) {
engineRule.getDecisionService().evaluateDecisionByKey("decision").variables(Variables.createVariables().putValue("status", "silver").putValue("sum", 723)).evaluate();
}
ClockUtil.setCurrentTime(oldCurrentTime);
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionEvaluationTest method testFailToEvaluateDecisionByIdWithTenantId.
public void testFailToEvaluateDecisionByIdWithTenantId() {
deploymentForTenant(TENANT_ONE, DMN_FILE);
DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult();
try {
decisionService.evaluateDecisionById(decisionDefinition.getId()).variables(createVariables()).decisionDefinitionTenantId(TENANT_ONE).evaluate();
fail("BadUserRequestException exception");
} catch (BadUserRequestException e) {
assertThat(e.getMessage(), containsString("Cannot specify a tenant-id"));
}
}
use of org.camunda.bpm.engine.repository.DecisionDefinition in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionEvaluationTest method testFailToEvaluateDecisionByIdWithoutTenantId.
public void testFailToEvaluateDecisionByIdWithoutTenantId() {
deployment(DMN_FILE);
DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult();
try {
decisionService.evaluateDecisionById(decisionDefinition.getId()).variables(createVariables()).decisionDefinitionWithoutTenantId().evaluate();
fail("BadUserRequestException exception");
} catch (BadUserRequestException e) {
assertThat(e.getMessage(), containsString("Cannot specify a tenant-id"));
}
}
Aggregations