use of org.drools.workbench.services.verifier.plugin.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class DecisionTableAnalyzerTest method testRuleHasNoActionSet.
@Test
public void testRuleHasNoActionSet() throws Exception {
table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("a", "Person", "age", ">").withActionSetField("a", "age", DataType.TYPE_NUMERIC_INTEGER).withActionSetField("a", "approved", DataType.TYPE_BOOLEAN).withActionSetField("a", "name", DataType.TYPE_STRING).withData(new Object[][] { { 1, "", "description", 0, null, null, "" }, { 2, "", "description", null, null, null, null } }).buildTable();
fireUpAnalyzer();
assertContains(analyzerProvider.getAnalysisReport(), CheckType.MISSING_ACTION, Severity.WARNING, 1);
assertContains(analyzerProvider.getAnalysisReport(), CheckType.EMPTY_RULE, Severity.WARNING, 2);
assertDoesNotContain(CheckType.EMPTY_RULE, analyzerProvider.getAnalysisReport(), 1);
assertDoesNotContain(CheckType.MISSING_ACTION, analyzerProvider.getAnalysisReport(), 2);
}
use of org.drools.workbench.services.verifier.plugin.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class DecisionTableAnalyzerTest method testMissingActionForBrlCondition.
/**
* Check if the message about missing action is thrown
* if the condition is defined as BRLCondition
*/
@Test
public void testMissingActionForBrlCondition() throws Exception {
table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionBRLColumn().withActionInsertFact("Application", "a", "approved", DataType.TYPE_BOOLEAN).withData(new Object[][] { { 1, "", "description", "value", null } }).buildTable();
fireUpAnalyzer();
Assert.assertEquals(1, analyzerProvider.getAnalysisReport().size());
assertContains(analyzerProvider.getAnalysisReport(), CheckType.MISSING_ACTION, Severity.WARNING);
}
use of org.drools.workbench.services.verifier.plugin.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class SpeedTest method noConflictTable.
@Test
public void noConflictTable() throws Exception {
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(), CheckType.REDUNDANT_ROWS, Severity.WARNING);
}
use of org.drools.workbench.services.verifier.plugin.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class DecisionTableAnalyzerDeficiencyTest method testRuleIsNotDeficient.
@Test
public void testRuleIsNotDeficient() throws Exception {
table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("a", "Person", "age", "==").withStringColumn("a", "Person", "name", "==").withStringColumn("a", "Person", "lastName", "==").withActionSetField("a", "salary", DataType.TYPE_NUMERIC_INTEGER).withData(new Object[][] { { 1, "", "description", null, "Eder", null, 100 }, { 2, "", "description", 10, null, null, 100 }, { 3, "", "description", null, "Toni", "Rikkola", 100 }, { 4, "", "description", null, null, null, null } }).buildTable();
fireUpAnalyzer();
assertDoesNotContain(CheckType.DEFICIENT_ROW, analyzerProvider.getAnalysisReport());
}
Aggregations