use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.
the class DecisionTableAnalyzerFromFileTest method testFileScoreAchievementsGDST.
@Test
public void testFileScoreAchievementsGDST() throws Exception {
analyzerProvider.getFactTypes().add(new FactTypes.FactType("Player", new HashSet<FactTypes.Field>() {
{
add(new FactTypes.Field("score", DataType.TYPE_NUMERIC_INTEGER));
}
}));
final String xml = loadResource("Score Achievements.gdst");
final Analyzer analyzer = analyzerProvider.makeAnalyser(GuidedDTXMLPersistence.getInstance().unmarshal(xml));
analyzer.resetChecks();
analyzer.analyze();
assertOnlyContains(analyzerProvider.getAnalysisReport(), MISSING_RANGE_TITLE, SINGLE_HIT_LOST);
}
use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.
the class DecisionTableAnalyzerFromFileTest method testFileBaseEntitlementGDST.
@Test
public void testFileBaseEntitlementGDST() throws Exception {
final String xml = loadResource("Base entitlement.gdst");
final Analyzer analyzer = analyzerProvider.makeAnalyser(GuidedDTXMLPersistence.getInstance().unmarshal(xml));
analyzer.resetChecks();
analyzer.analyze();
assertTrue(analyzerProvider.getAnalysisReport().isEmpty());
}
use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.
the class DecisionTableAnalyzerFromFileTest method testFileLargeFileGDSTWithUpdate.
@Test
public void testFileLargeFileGDSTWithUpdate() throws Exception, UpdateException {
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(), SINGLE_HIT_LOST, 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(), SINGLE_HIT_LOST, EMPTY_RULE);
now = System.currentTimeMillis();
System.out.println("Partial analysis took.. " + (now - baseline) + " ms");
}
use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantActionsInOneRow001.
@Test
public void testRedundantActionsInOneRow001() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("a", "Person", "name", "==").withActionSetField("a", "salary", DataType.TYPE_NUMERIC_INTEGER).withActionSetField("a", "salary", DataType.TYPE_NUMERIC_INTEGER).withData(new Object[][] { { 1, "description", "Toni", 100, 100 }, { 2, "description", "Eder", 200, null }, { 3, "description", "Michael", null, 300 }, { 4, "description", null, null, null, null, null } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertContains(analyzerProvider.getAnalysisReport(), "ValueForFactFieldIsSetTwice(a, salary)", Severity.WARNING);
}
use of org.drools.workbench.services.verifier.core.main.Analyzer in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantRowsWithConflict.
@Test
public void testRedundantRowsWithConflict() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("a", "Person", "age", ">").withConditionDoubleColumn("d", "Account", "deposit", "<").withActionSetField("a", "approved", DataType.TYPE_BOOLEAN).withActionSetField("a", "approved", DataType.TYPE_BOOLEAN).withData(new Object[][] { { 1, "description", 100, 0.0, true, true }, { 2, "description", 100, 0.0, true, false } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertDoesNotContain("ThisRowIsRedundantTo(1)", analyzerProvider.getAnalysisReport());
assertDoesNotContain("ThisRowIsRedundantTo(2)", analyzerProvider.getAnalysisReport());
}
Aggregations