Search in sources :

Example 21 with Analyzer

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

the class BRLFragmentsAnalyzerFromFileTest method testRuleTableGDST.

@Test
public void testRuleTableGDST() throws Exception {
    final String xml = loadResource("RuleTable.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    final Set<Issue> analysisReport = analyzerProvider.getAnalysisReport();
    assertDoesNotContain(CheckType.CONFLICTING_ROWS, analysisReport);
    assertDoesNotContain(CheckType.SINGLE_HIT_LOST, analysisReport);
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Issue(org.drools.verifier.api.reporting.Issue) Analyzer(org.drools.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 22 with Analyzer

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

the class BRLFragmentsAnalyzerFromFileTest method legalBRLColumns.

/*
    https://issues.redhat.com/browse/DROOLS-4945
     */
@Test
public void legalBRLColumns() throws Exception {
    final String xml = loadResource("TicketsDT.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    final Set<Issue> analysisReport = analyzerProvider.getAnalysisReport();
    assertTrue(analysisReport.isEmpty());
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Issue(org.drools.verifier.api.reporting.Issue) Analyzer(org.drools.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 23 with Analyzer

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

the class BRLFragmentsAnalyzerFromFileTest method testRuleTableGDSTWorkItem.

@Test
public void testRuleTableGDSTWorkItem() throws Exception {
    final String xml = loadResource("WorkItem.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    final Set<Issue> analysisReport = analyzerProvider.getAnalysisReport();
    assertTrue(analysisReport.isEmpty());
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Issue(org.drools.verifier.api.reporting.Issue) Analyzer(org.drools.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 24 with Analyzer

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

the class DecisionTableAnalyzerFromFileTest method testFile3.

@Test
@Ignore
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(CheckType.REDUNDANT_ROWS, analyzerProvider.getAnalysisReport());
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Analyzer(org.drools.verifier.core.main.Analyzer) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 25 with Analyzer

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

the class DecisionTableAnalyzerFromFileTest method testFileLargeFileGDSTWithUpdate.

@Test
public void testFileLargeFileGDSTWithUpdate() throws Exception {
    long baseline = System.currentTimeMillis();
    final String xml = loadResource("Large file.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    long now = System.currentTimeMillis();
    System.out.println("Loading of model took.. " + (now - baseline) + " ms");
    baseline = now;
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    now = System.currentTimeMillis();
    System.out.println("Indexing took.. " + (now - baseline) + " ms");
    analyzer.resetChecks();
    analyzer.analyze();
    assertOnlyContains(analyzerProvider.getAnalysisReport(), CheckType.SINGLE_HIT_LOST, CheckType.EMPTY_RULE);
    now = System.currentTimeMillis();
    System.out.println("Initial analysis took.. " + (now - baseline) + " ms");
    baseline = now;
    table52.getData().get(2).get(6).clearValues();
    final List<Coordinate> updates = new ArrayList<>();
    updates.add(new Coordinate(2, 6));
    analyzerProvider.getUpdateManager(table52, analyzer).update(table52, updates);
    assertOnlyContains(analyzerProvider.getAnalysisReport(), CheckType.SINGLE_HIT_LOST, CheckType.EMPTY_RULE);
    now = System.currentTimeMillis();
    System.out.println("Partial analysis took.. " + (now - baseline) + " ms");
}
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.verifier.core.main.Analyzer) Test(org.junit.Test)

Aggregations

Analyzer (org.drools.verifier.core.main.Analyzer)30 Test (org.junit.Test)29 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)26 ExtendedGuidedDecisionTableBuilder (org.drools.workbench.services.verifier.plugin.client.testutil.ExtendedGuidedDecisionTableBuilder)9 Import (org.kie.soup.project.datamodel.imports.Import)7 Issue (org.drools.verifier.api.reporting.Issue)6 ArrayList (java.util.ArrayList)5 Ignore (org.junit.Ignore)4 Coordinate (org.drools.workbench.services.verifier.plugin.client.Coordinate)3 FactTypes (org.drools.workbench.services.verifier.plugin.client.api.FactTypes)2