use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class AbstractDTAnalysisTest method getAnalysis.
protected static DTAnalysis getAnalysis(List<DMNMessage> dmnMessages, String id) {
assertThat("Expected to find DTAnalysis but messages are empty.", dmnMessages, not(empty()));
if (LOG.isDebugEnabled()) {
LOG.debug("List<DMNMessage> dmnMessages: \n{}", ValidatorUtil.formatMessages(dmnMessages));
}
Map<String, DTAnalysis> as = new HashMap<>();
for (DMNMessage dmnMessage : dmnMessages) {
if (dmnMessage.getSourceId().equals(id) && dmnMessage instanceof DMNDTAnalysisMessage) {
DMNDTAnalysisMessage dmndtAnalysisMessage = (DMNDTAnalysisMessage) dmnMessage;
if (as.containsKey(id)) {
assertThat("Inconsistency detected", as.get(id), is(dmndtAnalysisMessage.getAnalysis()));
} else {
as.put(id, dmndtAnalysisMessage.getAnalysis());
}
}
}
DTAnalysis analysis = as.get(id);
assertThat("Null analysis value for key.", analysis, notNullValue());
debugAnalysis(analysis);
return analysis;
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class BuiltinAndOtherValuesTest method testComplexDTdates.
@Test
public void testComplexDTdates() {
List<DMNMessage> validate = validator.validate(getReader("complexDTdates.dmn"), ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_a8a4362e-9f2d-4051-9bd6-e7356244f6b7");
checkComplexDTDates(analysis);
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class BuiltinAndOtherValuesTest method testWeirdYMduration.
@Test
public void testWeirdYMduration() {
List<DMNMessage> validate = validator.validate(getReader("weirdYMduration.dmn"), ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_fe7d267b-d770-461e-8300-e09981147341");
assertThat(analysis.getGaps(), hasSize(1));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(org.kie.dmn.feel.lang.types.impl.ComparablePeriod.parse("P1M"), RangeBoundary.CLOSED, null), new Bound(org.kie.dmn.feel.lang.types.impl.ComparablePeriod.parse("P1M"), RangeBoundary.CLOSED, null)))));
assertThat(gaps, hasSize(1));
// Assert GAPS same values
assertThat(analysis.getGaps(), contains(gaps.toArray()));
// assert OVERLAPs count.
assertThat(analysis.getOverlaps(), hasSize(0));
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class BuiltinAndOtherValuesTest method testComplexDTdatesV2.
@Test
public void testComplexDTdatesV2() {
List<DMNMessage> validate = validator.validate(getReader("complexDTdatesV2.dmn"), ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_a8a4362e-9f2d-4051-9bd6-e7356244f6b7");
checkComplexDTDates(analysis);
}
use of org.kie.dmn.validation.dtanalysis.model.DTAnalysis in project drools by kiegroup.
the class Check2ndNFViolationTest method testCheck2ndNFViolationWasADash2.
@Test
public void testCheck2ndNFViolationWasADash2() {
List<DMNMessage> validate = validator.validate(getReader("DT2ndNFWasADash2.dmn"), ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_D3F1D5B8-642B-446D-9099-DE4CB978CB94");
assertThat(analysis.is2ndNFViolation(), is(true));
assertThat(analysis.getCellsViolating2ndNF(), hasSize(1));
}
Aggregations