use of org.kie.dmn.core.impl.DMNMessageImpl in project drools by kiegroup.
the class DMNScenarioRunnerHelperTest method getSingleFactValueResultFailDecisionWithMessages.
@Test
public void getSingleFactValueResultFailDecisionWithMessages() {
DMNMessage errorMessage = new DMNMessageImpl(ERROR, "DMN Internal Error", DMNMessageType.FEEL_EVALUATION_ERROR, null);
DMNMessage warnMessage = new DMNMessageImpl(WARN, "DMN Internal Warn", DMNMessageType.FEEL_EVALUATION_ERROR, null);
DMNDecisionResult failedDecision = createDecisionResultMock("Test", false, new ArrayList<>());
ValueWrapper<?> failedResult = runnerHelper.getSingleFactValueResult(null, null, failedDecision, Arrays.asList(warnMessage, errorMessage), expressionEvaluator);
assertFalse(failedResult.isValid());
assertEquals("The decision \"" + failedDecision.getDecisionName() + "\" has not been successfully evaluated: DMN Internal Error", failedResult.getErrorMessage().get());
}
use of org.kie.dmn.core.impl.DMNMessageImpl in project drools by kiegroup.
the class DMNValidatorImpl method validateSchema.
private List<DMNMessage> validateSchema(String xml, String path) {
List<DMNMessage> problems = new ArrayList<>();
try {
DMN_VERSION inferDMNVersion = XStreamMarshaller.inferDMNVersion(new StringReader(xml));
Schema usingSchema = determineSchema(inferDMNVersion);
Source s = new StreamSource(new StringReader(xml));
validateSchema(s, usingSchema);
} catch (Exception e) {
problems.add(new DMNMessageImpl(DMNMessage.Severity.ERROR, MsgUtil.createMessage(Msg.FAILED_XML_VALIDATION, e.getMessage()), Msg.FAILED_XML_VALIDATION.getType(), null, e).withPath(path));
}
return problems;
}
Aggregations