use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class ValidatorTest method utilDefinitions.
private Definitions utilDefinitions(String filename, String modelName) {
// List<DMNMessage> validateXML;
// try {
// validateXML = validator.validate( new File(this.getClass().getResource(filename).toURI()), DMNValidator.Validation.VALIDATE_SCHEMA );
// assertThat( "using unit test method utilDefinitions must received a XML valid DMN file", validateXML, IsEmptyCollection.empty() );
// } catch (URISyntaxException e) {
// e.printStackTrace();
// fail("Unable for the test suite to locate the file for XML validation.");
// }
DMNMarshaller marshaller = DMNMarshallerFactory.newDefaultMarshaller();
try (InputStreamReader isr = new InputStreamReader(getClass().getResourceAsStream(filename))) {
Definitions definitions = marshaller.unmarshal(isr);
assertThat(definitions, notNullValue());
return definitions;
} catch (IOException e) {
e.printStackTrace();
fail("Unable for the test suite to locate the file for validation.");
}
return null;
}
use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class RecommenderHitPolicyTest method testGaps.
@Test
public void testGaps() {
Definitions definitions = getDefinitions("RecommenderHitPolicy1.dmn", "http://www.trisotech.com/definitions/_50aea0bb-4482-48f6-acfe-4abc1a1bd0d6", "Drawing 1");
List<DMNMessage> validate = validator.validate(definitions, VALIDATE_COMPILATION, ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_3aa68aee-6314-482f-a0be-84c2411d65d7");
debugValidatorMsg(validate);
assertThat(analysis.getGaps(), hasSize(1));
assertTrue(validate.stream().noneMatch(m -> m.getMessageType() == DMNMessageType.DECISION_TABLE_HITPOLICY_RECOMMENDER));
}
use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class RecommenderHitPolicyTest method getRecommenderHitPolicy2.
private List<DMNMessage> getRecommenderHitPolicy2(HitPolicy hp) {
Definitions definitions = getDefinitions("RecommenderHitPolicy2.dmn", "http://www.trisotech.com/definitions/_50aea0bb-4482-48f6-acfe-4abc1a1bd0d6", "Drawing 1");
// mutates XML file in the Hit Policy, accordingly to this test parameter.
((DecisionTable) ((Decision) definitions.getDrgElement().get(1)).getExpression()).setHitPolicy(hp);
List<DMNMessage> validate = validator.validate(definitions, VALIDATE_COMPILATION, ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_3aa68aee-6314-482f-a0be-84c2411d65d7");
debugValidatorMsg(validate);
assertThat(analysis.getGaps(), hasSize(0));
assertThat(analysis.getOverlaps(), hasSize(0));
return validate;
}
use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class RecommenderHitPolicyTest method getRecommenderHitPolicy4.
private List<DMNMessage> getRecommenderHitPolicy4(HitPolicy hp) {
Definitions definitions = getDefinitions("RecommenderHitPolicy4.dmn", "http://www.trisotech.com/definitions/_50aea0bb-4482-48f6-acfe-4abc1a1bd0d6", "Drawing 1");
// mutates XML file in the Hit Policy, accordingly to this test parameter.
((DecisionTable) ((Decision) definitions.getDrgElement().get(1)).getExpression()).setHitPolicy(hp);
List<DMNMessage> validate = validator.validate(definitions, VALIDATE_COMPILATION, ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_3aa68aee-6314-482f-a0be-84c2411d65d7");
debugValidatorMsg(validate);
assertThat(analysis.getGaps(), hasSize(0));
assertThat(analysis.getOverlaps(), hasSize(1));
return validate;
}
use of org.kie.dmn.model.api.Definitions in project drools by kiegroup.
the class RecommenderHitPolicyTest method getRecommenderHitPolicy3.
private List<DMNMessage> getRecommenderHitPolicy3(HitPolicy hp) {
Definitions definitions = getDefinitions("RecommenderHitPolicy3.dmn", "http://www.trisotech.com/definitions/_50aea0bb-4482-48f6-acfe-4abc1a1bd0d6", "Drawing 1");
// mutates XML file in the Hit Policy, accordingly to this test parameter.
((DecisionTable) ((Decision) definitions.getDrgElement().get(1)).getExpression()).setHitPolicy(hp);
List<DMNMessage> validate = validator.validate(definitions, VALIDATE_COMPILATION, ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_3aa68aee-6314-482f-a0be-84c2411d65d7");
debugValidatorMsg(validate);
assertThat(analysis.getGaps(), hasSize(0));
assertThat(analysis.getOverlaps(), hasSize(1));
return validate;
}
Aggregations