use of org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class SpeedTest method noConflictTable.
@Test
public void noConflictTable() throws Exception, UpdateException {
long baseline = System.currentTimeMillis();
final DataBuilderProvider.DataBuilder builder = DataBuilderProvider.row(-1, true);
for (int i = 0; i < 1000; i++) {
builder.row(i, true);
}
final Object[][] data = builder.end();
table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("$p", "Person", "age", "==").withActionSetField("$p", "approved", DataType.TYPE_BOOLEAN).withData(data).buildTable();
long now = System.currentTimeMillis();
logger.debug("Loading of model took.. " + (now - baseline) + " ms");
baseline = now;
fireUpAnalyzer();
now = System.currentTimeMillis();
logger.debug("Analyzing took.. " + (now - baseline) + " ms");
baseline = now;
setValue(1, 2, 3);
now = System.currentTimeMillis();
logger.debug("Update.. " + (now - baseline) + " ms");
assertContains(analyzerProvider.getAnalysisReport(), REDUNDANT_ROWS, Severity.WARNING);
}
use of org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder 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.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder 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());
}
use of org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantConditions001.
@Test
public void testRedundantConditions001() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withEnumColumn("a", "Person", "name", "==", "Toni,Eder").withConditionIntegerColumn("a", "Person", "name", "==").withData(new Object[][] { { 1, "description", "Toni", "Toni" } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertContains(analyzerProvider.getAnalysisReport(), REDUNDANT_CONDITIONS_TITLE, Severity.NOTE);
}
use of org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class DecisionTableAnalyzerTest method testRuleHasNoActionBRLFragmentHasAction.
// GUVNOR-2546: Verification & Validation: BRL fragments are ignored
@Test
public void testRuleHasNoActionBRLFragmentHasAction() throws Exception {
table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("a", "Person", "age", ">").withActionBRLFragment().withData(new Object[][] { { 1, "description", 0, true } }).buildTable();
fireUpAnalyzer();
assertDoesNotContain(EMPTY_RULE, analyzerProvider.getAnalysisReport(), 1);
assertDoesNotContain(RULE_HAS_NO_ACTION, analyzerProvider.getAnalysisReport());
}
Aggregations