Search in sources :

Example 11 with Analyzer

use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.

the class DecisionTableAnalyzerFromFileTest method testFileLargeFileGDST.

@Test
public void testFileLargeFileGDST() throws Exception {
    final String xml = loadResource("Large file.gdst");
    final Analyzer analyzer = analyzerProvider.makeAnalyser(GuidedDTXMLPersistence.getInstance().unmarshal(xml));
    analyzer.resetChecks();
    analyzer.analyze();
    assertOnlyContains(analyzerProvider.getAnalysisReport(), SINGLE_HIT_LOST, EMPTY_RULE);
}
Also used : Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 12 with Analyzer

use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.

the class DecisionTableAnalyzerFromFileTest method testFilePricingLoansGDST.

@Test
@Ignore("list of admitted values is in the model and currently not accessible for the analyzer")
public void testFilePricingLoansGDST() throws Exception {
    final String xml = loadResource("Pricing loans.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    assertOnlyContains(analyzerProvider.getAnalysisReport(), MISSING_RANGE_TITLE);
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 13 with Analyzer

use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.

the class DecisionTableAnalyzerFromFileTest method testFile3.

@Test
public void testFile3() throws Exception {
    final String xml = loadResource("Pricing loans version 2.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    assertDoesNotContain("ThisRowIsRedundantTo", analyzerProvider.getAnalysisReport());
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 14 with Analyzer

use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.

the class DecisionTableAnalyzerFromFileTest method testUpdateNotNullColumn.

@Test
public void testUpdateNotNullColumn() throws Exception, UpdateException {
    final String xml = loadResource("Is Null Table.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    // First run
    analyzer.resetChecks();
    analyzer.analyze();
    assertContains(analyzerProvider.getAnalysisReport(), RULE_HAS_NO_RESTRICTIONS_AND_WILL_ALWAYS_FIRE, Severity.NOTE);
    // Update
    table52.getData().get(0).get(2).setBooleanValue(true);
    final List<Coordinate> updates = new ArrayList<>();
    updates.add(new Coordinate(0, 2));
    analyzerProvider.getUpdateManager(table52, analyzer).update(table52, updates);
    // Update
    table52.getData().get(1).get(2).setBooleanValue(true);
    final List<Coordinate> updates2 = new ArrayList<>();
    updates2.add(new Coordinate(1, 2));
    analyzerProvider.getUpdateManager(table52, analyzer).update(table52, updates2);
    assertDoesNotContain(RULE_HAS_NO_RESTRICTIONS_AND_WILL_ALWAYS_FIRE, analyzerProvider.getAnalysisReport());
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Coordinate(org.drools.workbench.services.verifier.plugin.client.Coordinate) ArrayList(java.util.ArrayList) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 15 with Analyzer

use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.

the class DecisionTableAnalyzerFromFileTest method testLHSConflictsArePickedUpForEachFieldOfAPattern.

@Test
public void testLHSConflictsArePickedUpForEachFieldOfAPattern() throws Exception {
    final String xml = loadResource("GUVNOR-3513.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    assertResultIsEmpty(analyzerProvider.getAnalysisReport());
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Test(org.junit.Test)

Aggregations

Analyzer (org.drools.workbench.services.verifier.core.main.Analyzer)22 Test (org.junit.Test)21 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)19 ExtendedGuidedDecisionTableBuilder (org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder)9 Import (org.kie.soup.project.datamodel.imports.Import)7 ArrayList (java.util.ArrayList)5 Coordinate (org.drools.workbench.services.verifier.plugin.client.Coordinate)3 Ignore (org.junit.Ignore)3 HashSet (java.util.HashSet)1 Issue (org.drools.workbench.services.verifier.api.client.reporting.Issue)1 FactTypes (org.drools.workbench.services.verifier.plugin.client.api.FactTypes)1