Search in sources :

Example 6 with Analyzer

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

the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantRows002.

@Test
public void testRedundantRows002() throws Exception {
    GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withStringColumn("application", "LoanApplication", "amount", ">").withStringColumn("person", "Person", "name", "==").withStringColumn("income", "IncomeSource", "type", "==").withActionSetField("application", "approved", DataType.TYPE_STRING).withData(new Object[][] { { 1, "description", "131000", "Toni", "Asset", "true" }, { 2, "description", "131000", "Toni", "Asset", "true" }, { 3, "description", "100001", "Michael", "Job", "true" } }).buildTable();
    Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    assertContains(analyzerProvider.getAnalysisReport(), REDUNDANT_ROWS, Severity.WARNING, 1, 2);
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Import(org.kie.soup.project.datamodel.imports.Import) ExtendedGuidedDecisionTableBuilder(org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer) Test(org.junit.Test)

Example 7 with Analyzer

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

the class DecisionTableAnalyzerFromFileTest method testLHSConflictsArePickedUpForEachFieldOfAPatternTheFileFromTicket.

@Test
public void testLHSConflictsArePickedUpForEachFieldOfAPatternTheFileFromTicket() throws Exception {
    final String xml = loadResource("GUVNOR-3513-second-version.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)

Example 8 with Analyzer

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

the class DecisionTableAnalyzerFromFileTest method testFileLargeFileGDSTWithDeletes.

@Test
public void testFileLargeFileGDSTWithDeletes() throws Exception, UpdateException {
    final String xml = loadResource("Large file.gdst");
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    analyzer.resetChecks();
    analyzer.analyze();
    assertOnlyContains(analyzerProvider.getAnalysisReport(), SINGLE_HIT_LOST, EMPTY_RULE);
    long baseline = System.currentTimeMillis();
    for (int iterations = 0; iterations < 10; iterations++) {
        analyzer.removeRule(100);
        table52.getData().remove(100);
        List<Coordinate> canBeUpdated = new ArrayList<>();
        canBeUpdated.add(new Coordinate(0, 0));
        analyzerProvider.getUpdateManager(table52, analyzer).update(table52, canBeUpdated);
        long now = System.currentTimeMillis();
        System.out.println("Partial analysis took.. " + (now - baseline) + " ms");
        baseline = now;
        assertOnlyContains(analyzerProvider.getAnalysisReport(), SINGLE_HIT_LOST, EMPTY_RULE);
    }
}
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 9 with Analyzer

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

the class AnalyzerUpdateTestBase method analyze.

protected void analyze(String resourceName) throws Exception {
    final String xml = loadResource(resourceName);
    final GuidedDecisionTable52 table52 = GuidedDTXMLPersistence.getInstance().unmarshal(xml);
    final Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
    // First run
    analyzer.resetChecks();
    analyzer.analyze();
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Analyzer(org.drools.workbench.services.verifier.core.main.Analyzer)

Example 10 with Analyzer

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

the class RangeCheckFromFileTest method testFileExtraDays.

@Test
@Ignore("list of admitted values is in the model and currently not accessible for the analyzer")
public void testFileExtraDays() throws Exception {
    final String xml = loadResource("Extra 5 days.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)

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