use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-bpm-platform by camunda.
the class DecisionServiceTest method evaluateDecisionByKey.
@Deployment(resources = DMN_DECISION_LITERAL_EXPRESSION)
@Test
public void evaluateDecisionByKey() {
DmnDecisionResult decisionResult = decisionService.evaluateDecisionByKey(DECISION_DEFINITION_KEY).variables(createVariables()).evaluate();
assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-bpm-platform by camunda.
the class DecisionServiceTest method evaluateDecisionByKeyAndNullVersion.
@Deployment(resources = DMN_DECISION_LITERAL_EXPRESSION)
@Test
public void evaluateDecisionByKeyAndNullVersion() {
testRule.deploy(DMN_DECISION_LITERAL_EXPRESSION_V2);
DmnDecisionResult decisionResult = decisionService.evaluateDecisionByKey(DECISION_DEFINITION_KEY).version(null).variables(createVariables()).evaluate();
assertThatDecisionHasResult(decisionResult, RESULT_OF_SECOND_VERSION);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-bpm-platform by camunda.
the class DecisionServiceTest method evaluateDecisionByKeyAndLatestVersion.
@Deployment(resources = DMN_DECISION_LITERAL_EXPRESSION)
@Test
public void evaluateDecisionByKeyAndLatestVersion() {
testRule.deploy(DMN_DECISION_LITERAL_EXPRESSION_V2);
DmnDecisionResult decisionResult = decisionService.evaluateDecisionByKey(DECISION_DEFINITION_KEY).variables(createVariables()).evaluate();
assertThatDecisionHasResult(decisionResult, RESULT_OF_SECOND_VERSION);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-bpm-platform by camunda.
the class MultiTenancyDecisionEvaluationTest method testEvaluateDecisionByKeyWithTenantIdAuthenticatedTenant.
public void testEvaluateDecisionByKeyWithTenantIdAuthenticatedTenant() {
identityService.setAuthentication("user", null, Arrays.asList(TENANT_ONE));
deploymentForTenant(TENANT_ONE, DMN_FILE);
deploymentForTenant(TENANT_TWO, DMN_FILE);
DmnDecisionResult decisionResult = decisionService.evaluateDecisionByKey(DECISION_DEFINITION_KEY).decisionDefinitionTenantId(TENANT_ONE).variables(createVariables()).evaluate();
assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION);
}
use of org.camunda.bpm.dmn.engine.DmnDecisionResult in project camunda-bpm-platform by camunda.
the class DecisionDefinitionResourceImpl method evaluateDecision.
@Override
public List<Map<String, VariableValueDto>> evaluateDecision(UriInfo context, EvaluateDecisionDto parameters) {
DecisionService decisionService = engine.getDecisionService();
Map<String, Object> variables = VariableValueDto.toMap(parameters.getVariables(), engine, objectMapper);
try {
DmnDecisionResult decisionResult = decisionService.evaluateDecisionById(decisionDefinitionId).variables(variables).evaluate();
return createDecisionResultDto(decisionResult);
} catch (AuthorizationException e) {
throw e;
} catch (NotFoundException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new InvalidRequestException(Status.NOT_FOUND, e, errorMessage);
} catch (NotValidException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new InvalidRequestException(Status.BAD_REQUEST, e, errorMessage);
} catch (ProcessEngineException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
} catch (DmnEngineException e) {
String errorMessage = String.format("Cannot evaluate decision %s: %s", decisionDefinitionId, e.getMessage());
throw new RestException(Status.INTERNAL_SERVER_ERROR, e, errorMessage);
}
}
Aggregations