public virtual void evaluateDecisionById() { DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult(); DmnDecisionResult decisionResult = decisionService.evaluateDecisionById(decisionDefinition.Id).variables(createVariables()).evaluate(); assertThatDecisionHasResult(decisionResult, RESULT_OF_FIRST_VERSION); }
private void setUpDecisionService() { decisionEvaluationBuilderMock = mock(typeof(DecisionsEvaluationBuilder)); when(decisionEvaluationBuilderMock.variables(anyMapOf(typeof(string), typeof(object)))).thenReturn(decisionEvaluationBuilderMock); decisionServiceMock = mock(typeof(DecisionService)); when(decisionServiceMock.evaluateDecisionById(MockProvider.EXAMPLE_DECISION_DEFINITION_ID)).thenReturn(decisionEvaluationBuilderMock); when(decisionServiceMock.evaluateDecisionByKey(MockProvider.EXAMPLE_DECISION_DEFINITION_KEY)).thenReturn(decisionEvaluationBuilderMock); when(processEngine.DecisionService).thenReturn(decisionServiceMock); }
public virtual void logCreationOnEvaluateDecisionById() { // given DecisionDefinition decisionDefinition = repositoryService.createDecisionDefinitionQuery().singleResult(); // when identityService.AuthenticatedUserId = USER_ID; decisionService.evaluateDecisionById(decisionDefinition.Id).variables(createVariables()).evaluate(); identityService.clearAuthentication(); // then assertOperationLog(decisionDefinition); }
public virtual IList <IDictionary <string, VariableValueDto> > evaluateDecision(UriInfo context, EvaluateDecisionDto parameters) { DecisionService decisionService = engine.DecisionService; IDictionary <string, object> variables = VariableValueDto.toMap(parameters.Variables, 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 {0}: {1}", decisionDefinitionId, e.Message); throw new InvalidRequestException(Response.Status.NOT_FOUND, e, errorMessage); } catch (NotValidException e) { string errorMessage = string.Format("Cannot evaluate decision {0}: {1}", decisionDefinitionId, e.Message); throw new InvalidRequestException(Response.Status.BAD_REQUEST, e, errorMessage); } catch (ProcessEngineException e) { string errorMessage = string.Format("Cannot evaluate decision {0}: {1}", decisionDefinitionId, e.Message); throw new RestException(Response.Status.INTERNAL_SERVER_ERROR, e, errorMessage); } catch (DmnEngineException e) { string errorMessage = string.Format("Cannot evaluate decision {0}: {1}", decisionDefinitionId, e.Message); throw new RestException(Response.Status.INTERNAL_SERVER_ERROR, e, errorMessage); } }