Search in sources :

Example 16 with Hyperrectangle

use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.

the class AK0100v2domainOnTableTest method test.

@Test
public void test() {
    List<DMNMessage> validate = validator.validate(getReader("AK0100v2-domainOnTable.dmn"), VALIDATE_COMPILATION, ANALYZE_DECISION_TABLE);
    DTAnalysis analysis = getAnalysis(validate, "_e9e5c68a-ebc3-4f09-a107-2049edbe554d");
    assertThat(analysis.getGaps(), hasSize(2));
    @SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(2, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("0"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("12"), RangeBoundary.OPEN, null)))), new Hyperrectangle(2, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("15"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("18"), RangeBoundary.OPEN, null)), Interval.newFromBounds(new Bound(new BigDecimal("100"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("100"), RangeBoundary.CLOSED, null)))));
    assertThat(gaps, hasSize(2));
    // Assert GAPS
    assertThat(analysis.getGaps(), contains(gaps.toArray()));
}
Also used : DMNMessage(org.kie.dmn.api.core.DMNMessage) Hyperrectangle(org.kie.dmn.validation.dtanalysis.model.Hyperrectangle) Bound(org.kie.dmn.validation.dtanalysis.model.Bound) DTAnalysis(org.kie.dmn.validation.dtanalysis.model.DTAnalysis) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 17 with Hyperrectangle

use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.

the class Gaps0100domainOnTableTest method test.

@Test
public void test() {
    List<DMNMessage> validate = validator.validate(getReader("Gaps0100-domainOnTable.dmn"), VALIDATE_COMPILATION, ANALYZE_DECISION_TABLE);
    DTAnalysis analysis = getAnalysis(validate, "_70a95e62-8f5b-4b75-8cb9-9a9f781077da");
    assertThat(analysis.getGaps(), hasSize(2));
    @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)))), new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("100"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("100"), RangeBoundary.CLOSED, null)))));
    assertThat(gaps, hasSize(2));
    // Assert GAPS
    assertThat(analysis.getGaps(), contains(gaps.toArray()));
}
Also used : DMNMessage(org.kie.dmn.api.core.DMNMessage) Hyperrectangle(org.kie.dmn.validation.dtanalysis.model.Hyperrectangle) Bound(org.kie.dmn.validation.dtanalysis.model.Bound) DTAnalysis(org.kie.dmn.validation.dtanalysis.model.DTAnalysis) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Example 18 with Hyperrectangle

use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.

the class DTNestingTest method checkPositiveTableNestedInSubcontextOfDecision.

private void checkPositiveTableNestedInSubcontextOfDecision(List<DMNMessage> validate) {
    DTAnalysis analysis = getAnalysis(validate, "_83a8fbd6-ffcb-4068-ab6a-4a19086ce9c7");
    assertThat(analysis.getGaps(), hasSize(1));
    @SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound(Interval.NEG_INF, RangeBoundary.CLOSED, null), new Bound(new BigDecimal("0"), RangeBoundary.CLOSED, null)))));
    assertThat(gaps, hasSize(1));
    // Assert GAPS
    assertThat(analysis.getGaps(), contains(gaps.toArray()));
    // assert OVERLAPs count.
    assertThat(analysis.getOverlaps(), hasSize(0));
}
Also used : Hyperrectangle(org.kie.dmn.validation.dtanalysis.model.Hyperrectangle) Bound(org.kie.dmn.validation.dtanalysis.model.Bound) DTAnalysis(org.kie.dmn.validation.dtanalysis.model.DTAnalysis) BigDecimal(java.math.BigDecimal)

Example 19 with Hyperrectangle

use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.

the class EnumerationWithNullTest method test.

@Test
public void test() {
    List<DMNMessage> validate = validator.validate(getReader("EnumerationWithNull.dmn"), ANALYZE_DECISION_TABLE);
    DTAnalysis analysis = getAnalysis(validate, "_5ef1ff81-621d-4c9a-9881-0aaf865758cb");
    assertThat(analysis.getGaps(), hasSize(1));
    @SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(1, Arrays.asList(Interval.newFromBounds(new Bound("c", RangeBoundary.CLOSED, null), new Bound("c", RangeBoundary.CLOSED, null)))));
    assertThat(gaps, hasSize(1));
    // Assert GAPS
    assertThat(analysis.getGaps(), contains(gaps.toArray()));
}
Also used : DMNMessage(org.kie.dmn.api.core.DMNMessage) Hyperrectangle(org.kie.dmn.validation.dtanalysis.model.Hyperrectangle) Bound(org.kie.dmn.validation.dtanalysis.model.Bound) DTAnalysis(org.kie.dmn.validation.dtanalysis.model.DTAnalysis) Test(org.junit.Test)

Example 20 with Hyperrectangle

use of org.kie.dmn.validation.dtanalysis.model.Hyperrectangle in project drools by kiegroup.

the class AK0100domainOnTableTest method test.

@Test
public void test() {
    List<DMNMessage> validate = validator.validate(getReader("AK0100-domainOnTable.dmn"), VALIDATE_COMPILATION, ANALYZE_DECISION_TABLE);
    DTAnalysis analysis = getAnalysis(validate, "_e9e5c68a-ebc3-4f09-a107-2049edbe554d");
    assertThat(analysis.getGaps(), hasSize(2));
    @SuppressWarnings({ "unchecked", "rawtypes" }) List<Hyperrectangle> gaps = Arrays.asList(new Hyperrectangle(2, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("0"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("12"), RangeBoundary.OPEN, null)))), new Hyperrectangle(2, Arrays.asList(Interval.newFromBounds(new Bound(new BigDecimal("15"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("18"), RangeBoundary.OPEN, null)), Interval.newFromBounds(new Bound(new BigDecimal("0"), RangeBoundary.CLOSED, null), new Bound(new BigDecimal("50"), RangeBoundary.OPEN, null)))));
    assertThat(gaps, hasSize(2));
    // Assert GAPS
    assertThat(analysis.getGaps(), contains(gaps.toArray()));
}
Also used : DMNMessage(org.kie.dmn.api.core.DMNMessage) Hyperrectangle(org.kie.dmn.validation.dtanalysis.model.Hyperrectangle) Bound(org.kie.dmn.validation.dtanalysis.model.Bound) DTAnalysis(org.kie.dmn.validation.dtanalysis.model.DTAnalysis) BigDecimal(java.math.BigDecimal) Test(org.junit.Test)

Aggregations

Hyperrectangle (org.kie.dmn.validation.dtanalysis.model.Hyperrectangle)37 Bound (org.kie.dmn.validation.dtanalysis.model.Bound)35 DTAnalysis (org.kie.dmn.validation.dtanalysis.model.DTAnalysis)32 BigDecimal (java.math.BigDecimal)24 Test (org.junit.Test)23 DMNMessage (org.kie.dmn.api.core.DMNMessage)23 Overlap (org.kie.dmn.validation.dtanalysis.model.Overlap)18 Interval (org.kie.dmn.validation.dtanalysis.model.Interval)8 Arrays (java.util.Arrays)6 List (java.util.List)6 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)6 Matchers.contains (org.hamcrest.Matchers.contains)6 Matchers.hasSize (org.hamcrest.Matchers.hasSize)6 Assert.assertTrue (org.junit.Assert.assertTrue)6 DMNMessageType (org.kie.dmn.api.core.DMNMessageType)6 RangeBoundary (org.kie.dmn.feel.runtime.Range.RangeBoundary)6 ANALYZE_DECISION_TABLE (org.kie.dmn.validation.DMNValidator.Validation.ANALYZE_DECISION_TABLE)6 VALIDATE_COMPILATION (org.kie.dmn.validation.DMNValidator.Validation.VALIDATE_COMPILATION)5 MaskedRule (org.kie.dmn.validation.dtanalysis.model.MaskedRule)4 Expression (com.github.javaparser.ast.expr.Expression)2