Search in sources :

Example 16 with ExtendedGuidedDecisionTableBuilder

use of org.drools.workbench.services.verifier.webworker.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();
    assertEquals(1, analyzerProvider.getAnalysisReport().size());
    assertContains(analyzerProvider.getAnalysisReport(), RULE_HAS_NO_ACTION, Severity.WARNING);
}
Also used : ArrayList(java.util.ArrayList) ExtendedGuidedDecisionTableBuilder(org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder) Test(org.junit.Test)

Example 17 with ExtendedGuidedDecisionTableBuilder

use of org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.

the class DecisionTableAnalyzerTest method ruleHasNoActionShouldNotIgnoreRetract.

@Test
public void ruleHasNoActionShouldNotIgnoreRetract() throws Exception {
    table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionIntegerColumn("a", "Person", "age", ">").withRetract().withData(DataBuilderProvider.row(0, "a").end()).buildTable();
    fireUpAnalyzer();
    assertDoesNotContain(RULE_HAS_NO_ACTION, analyzerProvider.getAnalysisReport());
}
Also used : ArrayList(java.util.ArrayList) ExtendedGuidedDecisionTableBuilder(org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder) Test(org.junit.Test)

Example 18 with ExtendedGuidedDecisionTableBuilder

use of org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder in project drools-wb by kiegroup.

the class DecisionTableAnalyzerTest method testConditionsShouldNotBeIgnored.

// GUVNOR-2546: Verification & Validation: BRL fragments are ignored
@Test
public void testConditionsShouldNotBeIgnored() throws Exception {
    table52 = new ExtendedGuidedDecisionTableBuilder("org.test", new ArrayList<Import>(), "mytable").withConditionBRLColumn().withActionInsertFact("Application", "a", "approved", DataType.TYPE_BOOLEAN).withData(new Object[][] { { 1, "description", null, true }, { 2, "description", null, null } }).buildTable();
    fireUpAnalyzer();
    assertContains(analyzerProvider.getAnalysisReport(), EMPTY_RULE, Severity.WARNING, 2);
    assertDoesNotContain(EMPTY_RULE, analyzerProvider.getAnalysisReport(), 1);
    assertContains(analyzerProvider.getAnalysisReport(), RULE_HAS_NO_RESTRICTIONS_AND_WILL_ALWAYS_FIRE, Severity.NOTE, 1);
    assertDoesNotContain(RULE_HAS_NO_RESTRICTIONS_AND_WILL_ALWAYS_FIRE, analyzerProvider.getAnalysisReport(), 2);
}
Also used : ArrayList(java.util.ArrayList) ExtendedGuidedDecisionTableBuilder(org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder) Test(org.junit.Test)

Example 19 with ExtendedGuidedDecisionTableBuilder

use of org.drools.workbench.services.verifier.webworker.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();
    assertEquals(1, analyzerProvider.getAnalysisReport().size());
    assertContains(analyzerProvider.getAnalysisReport(), RULE_HAS_NO_ACTION, Severity.WARNING);
}
Also used : ArrayList(java.util.ArrayList) ExtendedGuidedDecisionTableBuilder(org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder) Test(org.junit.Test)

Aggregations

ExtendedGuidedDecisionTableBuilder (org.drools.workbench.services.verifier.webworker.client.testutil.ExtendedGuidedDecisionTableBuilder)19 Test (org.junit.Test)19 ArrayList (java.util.ArrayList)12 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)9 Analyzer (org.drools.workbench.services.verifier.core.main.Analyzer)9 Import (org.kie.soup.project.datamodel.imports.Import)7 Ignore (org.junit.Ignore)1