use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.
the class AbstractDTAnalysisTest method debugAnalysis.
protected static void debugAnalysis(DTAnalysis analysis) {
if (!LOG.isDebugEnabled()) {
return;
}
StringBuilder sbGaps = new StringBuilder("\nGaps:\n");
for (Hyperrectangle gap : analysis.getGaps()) {
sbGaps.append(gap.toString());
sbGaps.append("\n");
}
LOG.debug(sbGaps.toString());
DefaultPrinterConfiguration printConfig = new DefaultPrinterConfiguration();
printConfig.addOption(new DefaultConfigurationOption(DefaultPrinterConfiguration.ConfigOption.COLUMN_ALIGN_PARAMETERS, true));
printConfig.addOption(new DefaultConfigurationOption(DefaultPrinterConfiguration.ConfigOption.COLUMN_ALIGN_FIRST_METHOD_CHAIN, true));
Expression printGaps = DTAnalysisMeta.printGaps(analysis);
LOG.debug("\n" + printGaps.toString(printConfig));
StringBuilder sbOverlaps = new StringBuilder("\nOverlaps:\n");
for (Overlap overlap : analysis.getOverlaps()) {
sbOverlaps.append(overlap.toString());
sbOverlaps.append("\n");
}
LOG.debug(sbOverlaps.toString());
Expression printOverlaps = DTAnalysisMeta.printOverlaps(analysis);
LOG.debug("\n" + printOverlaps.toString(printConfig));
}
use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.
the class BuiltinAndOtherValuesTest method checkComplexDTDates.
private void checkComplexDTDates(DTAnalysis analysis) {
assertThat(analysis.getGaps(), hasSize(2));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(java.time.LocalDate.parse("2019-03-31"), RangeBoundary.CLOSED, null), new Bound(java.time.LocalDate.parse("2019-03-31"), RangeBoundary.CLOSED, null)))), new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(java.time.LocalDate.parse("2019-12-31"), RangeBoundary.CLOSED, null), new Bound(java.time.LocalDate.parse("2019-12-31"), RangeBoundary.CLOSED, null)))));
assertThat(gaps, hasSize(2));
// Assert GAPS same values
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(2, 3), new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(java.time.LocalDate.parse("2019-06-30"), RangeBoundary.CLOSED, null), new Bound(java.time.LocalDate.parse("2019-06-30"), RangeBoundary.CLOSED, null))))));
assertThat(overlaps, hasSize(1));
// Assert OVERLAPs same values
assertThat(analysis.getOverlaps(), contains(overlaps.toArray()));
}
use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.
the class BuiltinAndOtherValuesTest method testWeirdPosNeg.
@Test
public void testWeirdPosNeg() {
List<DMNMessage> validate = validator.validate(getReader("weirdPosNeg.dmn"), ANALYZE_DECISION_TABLE);
DTAnalysis analysis = getAnalysis(validate, "_54ae95be-6866-4dc1-8c10-1c5a4dd15c93");
assertThat(analysis.getGaps(), hasSize(1));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("0"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("0"), 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.Hyperrectangle in project drools by kiegroup.
the class NotTest method testNOTString2.
@Test
public void testNOTString2() {
List<DMNMessage> validate = validator.validate(getReader("DTusingNOT2.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(0));
}
use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.
the class OverlapHitPolicyTest method checkAnalysis.
private void checkAnalysis(List<DMNMessage> validate) {
DTAnalysis analysis = getAnalysis(validate, "_C4A1625B-0606-4F2D-9779-49B1A981718E");
assertThat(analysis.getGaps(), hasSize(0));
// assert OVERLAPs count.
assertThat(analysis.getOverlaps(), hasSize(1));
@SuppressWarnings({ "unchecked", "rawtypes" }) List<Overlap> overlaps = Arrays.asList(new Overlap(Arrays.asList(2, 3), new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("30"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("30"), RangeBoundary.CLOSED, null))))));
assertThat(overlaps, hasSize(1));
// Assert OVERLAPs same values
assertThat(analysis.getOverlaps(), contains(overlaps.toArray()));
}
Aggregations