use of org.drools.workbench.services.verifier.plugin.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class DecisionTableAnalyzerTest method testMissingActionForBrlAction.
/**
* Check if the message about missing action is thrown
* if the action is defined as BRLAction
*/
@Test
public void testMissingActionForBrlAction() throws Exception {
table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("a", "Person", "age", ">").withActionBRLFragment().withData(new Object[][] { { 1, "", "description", Integer.MIN_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 DecisionTableAnalyzerDeficiencyTest method testRuleIsDeficient001.
@Test
public void testRuleIsDeficient001() 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, 200 }, { 3, "", "description", null, "Toni", "Rikkola", 300 }, { 4, "", "description", null, null, null, null } }).buildTable();
fireUpAnalyzer();
assertDoesNotContain(CheckType.DEFICIENT_ROW, analyzerProvider.getAnalysisReport(), 1);
assertContains(analyzerProvider.getAnalysisReport(), CheckType.DEFICIENT_ROW, Severity.WARNING, 2);
assertDoesNotContain(CheckType.DEFICIENT_ROW, analyzerProvider.getAnalysisReport(), 3);
assertDoesNotContain(CheckType.DEFICIENT_ROW, analyzerProvider.getAnalysisReport(), 4);
}
use of org.drools.workbench.services.verifier.plugin.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testNoIssues2.
@Test
public void testNoIssues2() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("application", "LoanApplication", "amount", ">").withConditionIntegerColumn("application", "LoanApplication", "amount", "<=").withConditionIntegerColumn("application", "LoanApplication", "lengthYears", "==").withConditionIntegerColumn("application", "LoanApplication", "deposit", "<").withStringColumn("income", "IncomeSource", "type", "==").withActionSetField("application", "approved", DataType.TYPE_BOOLEAN).withActionSetField("application", "insuranceCost", DataType.TYPE_NUMERIC_INTEGER).withActionSetField("application", "approvedRate", DataType.TYPE_NUMERIC_INTEGER).withData(new Object[][] { { 1, "", "description", 131000, 200000, 30, 20000, "Asset", true, 0, 2 }, { 2, "", "description", 1000, 200000, 30, 20000, "Asset", true, 0, 2 }, { 3, "", "description", 100001, 130000, 20, 3000, "Job", true, 10, 6 } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertDoesNotContain(CheckType.REDUNDANT_ROWS, analyzerProvider.getAnalysisReport());
}
use of org.drools.workbench.services.verifier.plugin.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.
the class DecisionTableAnalyzerSubsumptionResolverTest method testRedundantRows001.
@Test
@Ignore("This randomly does not pick up the issue. Better that way, I'm hoping future changes will find the cause. Every other test works 100%")
public void testRedundantRows001() throws Exception {
GuidedDecisionTable52 table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withNumericColumn("application", "LoanApplication", "amount", ">").withNumericColumn("application", "LoanApplication", "amount", "<=").withNumericColumn("application", "LoanApplication", "lengthYears", "==").withNumericColumn("application", "LoanApplication", "deposit", "<").withStringColumn("income", "IncomeSource", "type", "==").withActionSetField("application", "approved", DataType.TYPE_BOOLEAN).withActionSetField("application", "insuranceCost", DataType.TYPE_NUMERIC).withActionSetField("application", "approvedRate", DataType.TYPE_NUMERIC).withData(new Object[][] { { 1, "", "description", 131000, 200000, 30, 20000, "Asset", true, 0, 2 }, { 2, "", "description", 131000, 200000, 30, 20000, "Asset", true, 0, 2 }, { 3, "", "description", 100001, 130000, 20, 3000, "Job", true, 10, 6 } }).buildTable();
Analyzer analyzer = analyzerProvider.makeAnalyser(table52);
analyzer.resetChecks();
analyzer.analyze();
assertContains(analyzerProvider.getAnalysisReport(), CheckType.REDUNDANT_ROWS, Severity.WARNING, 1, 2);
}
use of org.drools.workbench.services.verifier.plugin.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(CheckType.REDUNDANT_ROWS, analyzerProvider.getAnalysisReport());
}
Aggregations