use of org.drools.verifier.core.main.Analyzer in project drools-wb by kiegroup.
the class DecisionTableAnalyzerFromFileTest method testUpdateNotNullColumn.
@Test
public void testUpdateNotNullColumn() throws Exception {
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(), CheckType.MISSING_RESTRICTION, Severity.NOTE);
// Update
table52.getData().get(0).get(3).setBooleanValue(true);
final List<Coordinate> updates = new ArrayList<>();
updates.add(new Coordinate(0, 3));
analyzerProvider.getUpdateManager(table52, analyzer).update(table52, updates);
// Update
table52.getData().get(1).get(3).setBooleanValue(true);
final List<Coordinate> updates2 = new ArrayList<>();
updates2.add(new Coordinate(1, 3));
analyzerProvider.getUpdateManager(table52, analyzer).update(table52, updates2);
assertDoesNotContain(CheckType.MISSING_RESTRICTION, analyzerProvider.getAnalysisReport());
}
use of org.drools.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());
}
use of org.drools.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 Sets.Builder<FactTypes.Field>().add(new FactTypes.Field("score", DataType.TYPE_NUMERIC_INTEGER)).build()));
final String xml = loadResource("Score Achievements.gdst");
final Analyzer analyzer = analyzerProvider.makeAnalyser(GuidedDTXMLPersistence.getInstance().unmarshal(xml));
analyzer.resetChecks();
analyzer.analyze();
assertOnlyContains(analyzerProvider.getAnalysisReport(), CheckType.MISSING_RANGE, CheckType.SINGLE_HIT_LOST);
}
use of org.drools.verifier.core.main.Analyzer in project drools-wb by kiegroup.
the class DecisionTableAnalyzerFromFileTest method testFileLargeFileGDSTWithDeletes.
@Test
public void testFileLargeFileGDSTWithDeletes() throws Exception {
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(), CheckType.SINGLE_HIT_LOST, CheckType.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(), CheckType.SINGLE_HIT_LOST, CheckType.EMPTY_RULE);
}
}
use of org.drools.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(), CheckType.MISSING_RANGE);
}
Aggregations