use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class NotTest method testNOTString.
@Test
public void testNOTString() {
List<DMNMessage> validate = validator.validate(getReader("DTusingNOT.dmn"), ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_b53fac34-fb12-4601-8605-c226e68292f9");
assertThat(analysis.getGaps(), hasSize(1));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound("i", RangeBoundary.CLOSED, null), new Bound("o", RangeBoundary.OPEN, null)))));
assertThat(gaps, hasSize(1));
// Assert GAPS
assertThat(analysis.getGaps(), contains(gaps.toArray()));
// assert OVERLAPs count.
assertThat(analysis.getOverlaps(), hasSize(1));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Overlap> overlaps = Arrays.asList(new Overlap(Arrays.asList(1, 2), new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound("o", RangeBoundary.CLOSED, null), new Bound("u", RangeBoundary.OPEN, null))))));
assertThat(overlaps, hasSize(1));
// Assert OVERLAPs same values
assertThat(analysis.getOverlaps(), contains(overlaps.toArray()));
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis 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.validation.dtanalysis.model.DTAnalysis 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.validation.dtanalysis.model.DTAnalysis 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.validation.dtanalysis.model.DTAnalysis 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