Search in sources :

Example 6 with GuidedDTTemplateDataProvider

use of org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider in project drools by kiegroup.

the class GuidedDTDRLPersistenceTest method testNoOperator.

@Test
public void testNoOperator() {
    GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
    String[] row = new String[] { "1", "desc", "a", "> 42" };
    String[][] data = new String[1][];
    data[0] = row;
    List<BaseColumn> allColumns = new ArrayList<BaseColumn>();
    List<CompositeColumn<? extends BaseColumn>> allPatterns = new ArrayList<CompositeColumn<? extends BaseColumn>>();
    allColumns.add(new RowNumberCol52());
    allColumns.add(new DescriptionCol52());
    allColumns.add(new MetadataCol52());
    Pattern52 p1 = new Pattern52();
    p1.setBoundName("p1");
    p1.setFactType("Person");
    allPatterns.add(p1);
    ConditionCol52 col1 = new ConditionCol52();
    col1.setFactField("age");
    col1.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    col1.setOperator("");
    p1.getChildColumns().add(col1);
    allColumns.add(col1);
    RuleModel rm = new RuleModel();
    List<DTCellValue52> rowData = DataUtilities.makeDataRowList(row);
    TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider(allColumns, rowData);
    p.doConditions(allColumns, allPatterns, rowDataProvider, rowData, DataUtilities.makeDataLists(data), rm);
    String drl = RuleModelDRLPersistenceImpl.getInstance().marshal(rm);
    assertTrue(drl.indexOf("age > \"42\"") > 0);
}
Also used : ArrayList(java.util.ArrayList) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) RuleModel(org.drools.workbench.models.datamodel.rule.RuleModel) CompositeColumn(org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn) MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) LimitedEntryConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) TemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider) Test(org.junit.Test)

Example 7 with GuidedDTTemplateDataProvider

use of org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider in project drools by kiegroup.

the class GuidedDTDRLPersistenceTest method multipleConstraintLHSNotPatternInclusion.

@Test
public void multipleConstraintLHSNotPatternInclusion() {
    GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
    Object[] row = new Object[] { "1", "desc", "limburger", "strong" };
    Object[][] data = new Object[1][];
    data[0] = row;
    List<BaseColumn> allColumns = new ArrayList<>();
    List<CompositeColumn<? extends BaseColumn>> allPatterns = new ArrayList<>();
    allColumns.add(new RowNumberCol52());
    allColumns.add(new DescriptionCol52());
    Pattern52 p1 = new Pattern52();
    p1.setBoundName("");
    p1.setNegated(true);
    p1.setFactType("Cheese");
    allPatterns.add(p1);
    ConditionCol52 p1col1 = new ConditionCol52();
    p1col1.setFactField("name");
    p1col1.setOperator("==");
    p1col1.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    p1.getChildColumns().add(p1col1);
    allColumns.add(p1col1);
    ConditionCol52 p1col2 = new ConditionCol52();
    p1col2.setFactField("smell");
    p1col2.setOperator("==");
    p1col2.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    p1.getChildColumns().add(p1col2);
    allColumns.add(p1col2);
    List<DTCellValue52> rowData = DataUtilities.makeDataRowList(row);
    TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider(allColumns, rowData);
    RuleModel rm = new RuleModel();
    rm.name = "r0";
    p.doConditions(allColumns, allPatterns, rowDataProvider, rowData, DataUtilities.makeDataLists(data), rm);
    final String actualRuleModelDrl = RuleModelDRLPersistenceImpl.getInstance().marshal(rm);
    final String expectedRuleModelDrl = "rule \"r0\"\n" + "  dialect \"mvel\"\n" + "  when\n" + "    not Cheese( name == \"limburger\", smell == \"strong\" )\n" + "  then\n" + "end\n";
    assertEqualsIgnoreWhitespace(expectedRuleModelDrl, actualRuleModelDrl);
}
Also used : ArrayList(java.util.ArrayList) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) RuleModel(org.drools.workbench.models.datamodel.rule.RuleModel) CompositeColumn(org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn) LimitedEntryConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) TemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider) Test(org.junit.Test)

Example 8 with GuidedDTTemplateDataProvider

use of org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider in project drools by kiegroup.

the class GuidedDTDRLPersistenceTest method testLHSBindings.

@Test
public void testLHSBindings() {
    GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
    String[] row = new String[] { "1", "desc", "mike", "33 + 1", "age > 6" };
    String[][] data = new String[1][];
    data[0] = row;
    List<BaseColumn> allColumns = new ArrayList<BaseColumn>();
    List<CompositeColumn<? extends BaseColumn>> allPatterns = new ArrayList<CompositeColumn<? extends BaseColumn>>();
    allColumns.add(new RowNumberCol52());
    allColumns.add(new DescriptionCol52());
    Pattern52 p1 = new Pattern52();
    p1.setBoundName("p1");
    p1.setFactType("Person");
    allPatterns.add(p1);
    ConditionCol52 col = new ConditionCol52();
    col.setFactField("name");
    col.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    col.setOperator("==");
    col.setBinding("$name");
    p1.getChildColumns().add(col);
    allColumns.add(col);
    ConditionCol52 col2 = new ConditionCol52();
    col2.setFactField("age");
    col2.setConstraintValueType(BaseSingleFieldConstraint.TYPE_RET_VALUE);
    col2.setOperator("<");
    col2.setBinding("$age");
    p1.getChildColumns().add(col2);
    allColumns.add(col2);
    ConditionCol52 col3 = new ConditionCol52();
    col3.setConstraintValueType(BaseSingleFieldConstraint.TYPE_PREDICATE);
    col3.setBinding("$name");
    p1.getChildColumns().add(col3);
    allColumns.add(col3);
    List<DTCellValue52> rowData = DataUtilities.makeDataRowList(row);
    TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider(allColumns, rowData);
    RuleModel rm = new RuleModel();
    p.doConditions(allColumns, allPatterns, rowDataProvider, rowData, DataUtilities.makeDataLists(data), rm);
    assertEquals(1, rm.lhs.length);
    assertEquals("Person", ((FactPattern) rm.lhs[0]).getFactType());
    assertEquals("p1", ((FactPattern) rm.lhs[0]).getBoundName());
    // examine the first pattern
    FactPattern person = (FactPattern) rm.lhs[0];
    assertEquals(3, person.getConstraintList().getConstraints().length);
    SingleFieldConstraint cons = (SingleFieldConstraint) person.getConstraint(0);
    assertEquals(BaseSingleFieldConstraint.TYPE_LITERAL, cons.getConstraintValueType());
    assertEquals("name", cons.getFieldName());
    assertEquals("==", cons.getOperator());
    assertEquals("mike", cons.getValue());
    assertEquals("$name", cons.getFieldBinding());
    cons = (SingleFieldConstraint) person.getConstraint(1);
    assertEquals(BaseSingleFieldConstraint.TYPE_RET_VALUE, cons.getConstraintValueType());
    assertEquals("age", cons.getFieldName());
    assertEquals("<", cons.getOperator());
    assertEquals("33 + 1", cons.getValue());
    assertEquals("$age", cons.getFieldBinding());
    cons = (SingleFieldConstraint) person.getConstraint(2);
    assertEquals(BaseSingleFieldConstraint.TYPE_PREDICATE, cons.getConstraintValueType());
    assertEquals("age > 6", cons.getValue());
    assertNull(cons.getFieldBinding());
}
Also used : ArrayList(java.util.ArrayList) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) FactPattern(org.drools.workbench.models.datamodel.rule.FactPattern) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) RuleModel(org.drools.workbench.models.datamodel.rule.RuleModel) CompositeColumn(org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn) SingleFieldConstraint(org.drools.workbench.models.datamodel.rule.SingleFieldConstraint) BaseSingleFieldConstraint(org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint) LimitedEntryConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) TemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider) Test(org.junit.Test)

Example 9 with GuidedDTTemplateDataProvider

use of org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider in project drools by kiegroup.

the class GuidedDTDRLPersistenceTest method testRHSWithBRLColumn_ParseToRuleModel.

@Test
public // This test checks a Decision Table involving BRL columns is correctly converted into a RuleModel
void testRHSWithBRLColumn_ParseToRuleModel() {
    GuidedDecisionTable52 dtable = new GuidedDecisionTable52();
    GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
    // All three rows are entered, some columns with optional data
    String[][] data = new String[][] { new String[] { "1", "desc", "Gargamel", "Pupa", "50" }, new String[] { "2", "desc", "Gargamel", "", "50" }, new String[] { "3", "desc", "Gargamel", "Pupa", "" } };
    // Simple (mandatory) columns
    dtable.setRowNumberCol(new RowNumberCol52());
    dtable.setDescriptionCol(new DescriptionCol52());
    // Simple Action
    ActionInsertFactCol52 a1 = new ActionInsertFactCol52();
    a1.setBoundName("$b");
    a1.setFactType("Baddie");
    a1.setFactField("name");
    a1.setType(DataType.TYPE_STRING);
    dtable.getActionCols().add(a1);
    // BRL Column
    BRLActionColumn brl1 = new BRLActionColumn();
    // BRL Column definition
    List<IAction> brl1Definition = new ArrayList<IAction>();
    ActionInsertFact brl1DefinitionAction1 = new ActionInsertFact("Smurf");
    ActionFieldValue brl1DefinitionAction1FieldValue1 = new ActionFieldValue("name", "$name", DataType.TYPE_STRING);
    brl1DefinitionAction1FieldValue1.setNature(BaseSingleFieldConstraint.TYPE_TEMPLATE);
    brl1DefinitionAction1.addFieldValue(brl1DefinitionAction1FieldValue1);
    ActionFieldValue brl1DefinitionAction1FieldValue2 = new ActionFieldValue("age", "$age", DataType.TYPE_NUMERIC_INTEGER);
    brl1DefinitionAction1FieldValue2.setNature(BaseSingleFieldConstraint.TYPE_TEMPLATE);
    brl1DefinitionAction1.addFieldValue(brl1DefinitionAction1FieldValue2);
    brl1Definition.add(brl1DefinitionAction1);
    brl1.setDefinition(brl1Definition);
    // Setup BRL column bindings
    BRLActionVariableColumn brl1Variable1 = new BRLActionVariableColumn("$name", DataType.TYPE_STRING, "Person", "name");
    brl1.getChildColumns().add(brl1Variable1);
    BRLActionVariableColumn brl1Variable2 = new BRLActionVariableColumn("$age", DataType.TYPE_NUMERIC_INTEGER, "Person", "age");
    brl1.getChildColumns().add(brl1Variable2);
    dtable.getActionCols().add(brl1);
    // Now to test conversion
    RuleModel rm = new RuleModel();
    List<BaseColumn> allColumns = dtable.getExpandedColumns();
    List<ActionCol52> allActions = dtable.getActionCols();
    // Row 0
    List<DTCellValue52> dtRowData0 = DataUtilities.makeDataRowList(data[0]);
    TemplateDataProvider rowDataProvider0 = new GuidedDTTemplateDataProvider(allColumns, dtRowData0);
    p.doActions(allColumns, allActions, rowDataProvider0, dtRowData0, rm);
    assertEquals(2, rm.rhs.length);
    assertEquals("Baddie", ((ActionInsertFact) rm.rhs[0]).getFactType());
    assertEquals("Smurf", ((ActionInsertFact) rm.rhs[1]).getFactType());
    // examine the first action
    ActionInsertFact result0Action1 = (ActionInsertFact) rm.rhs[0];
    assertEquals(1, result0Action1.getFieldValues().length);
    ActionFieldValue result0Action1FieldValue1 = (ActionFieldValue) result0Action1.getFieldValues()[0];
    assertEquals(DataType.TYPE_STRING, result0Action1FieldValue1.getType());
    assertEquals("name", result0Action1FieldValue1.getField());
    assertEquals("Gargamel", result0Action1FieldValue1.getValue());
    // examine the second action
    ActionInsertFact result0Action2 = (ActionInsertFact) rm.rhs[1];
    assertEquals(2, result0Action2.getFieldValues().length);
    ActionFieldValue result0Action2FieldValue1 = (ActionFieldValue) result0Action2.getFieldValues()[0];
    assertEquals(DataType.TYPE_STRING, result0Action2FieldValue1.getType());
    assertEquals("name", result0Action2FieldValue1.getField());
    assertEquals("$name", result0Action2FieldValue1.getValue());
    ActionFieldValue result0Action2FieldValue2 = (ActionFieldValue) result0Action2.getFieldValues()[1];
    assertEquals(DataType.TYPE_NUMERIC_INTEGER, result0Action2FieldValue2.getType());
    assertEquals("age", result0Action2FieldValue2.getField());
    assertEquals("$age", result0Action2FieldValue2.getValue());
    // Row 1
    List<DTCellValue52> dtRowData1 = DataUtilities.makeDataRowList(data[1]);
    TemplateDataProvider rowDataProvider1 = new GuidedDTTemplateDataProvider(allColumns, dtRowData1);
    p.doActions(allColumns, allActions, rowDataProvider1, dtRowData1, rm);
    assertEquals(2, rm.rhs.length);
    assertEquals("Baddie", ((ActionInsertFact) rm.rhs[0]).getFactType());
    assertEquals("Smurf", ((ActionInsertFact) rm.rhs[1]).getFactType());
    // examine the first action
    ActionInsertFact result1Action1 = (ActionInsertFact) rm.rhs[0];
    assertEquals(1, result1Action1.getFieldValues().length);
    ActionFieldValue result1Action1FieldValue1 = (ActionFieldValue) result1Action1.getFieldValues()[0];
    assertEquals(DataType.TYPE_STRING, result1Action1FieldValue1.getType());
    assertEquals("name", result1Action1FieldValue1.getField());
    assertEquals("Gargamel", result1Action1FieldValue1.getValue());
    // examine the second action
    ActionInsertFact result1Action2 = (ActionInsertFact) rm.rhs[1];
    assertEquals(2, result1Action2.getFieldValues().length);
    ActionFieldValue result1Action2FieldValue1 = (ActionFieldValue) result1Action2.getFieldValues()[0];
    assertEquals(DataType.TYPE_STRING, result1Action2FieldValue1.getType());
    assertEquals("name", result1Action2FieldValue1.getField());
    assertEquals("$name", result1Action2FieldValue1.getValue());
    ActionFieldValue result1Action2FieldValue2 = (ActionFieldValue) result1Action2.getFieldValues()[1];
    assertEquals(DataType.TYPE_NUMERIC_INTEGER, result1Action2FieldValue2.getType());
    assertEquals("age", result1Action2FieldValue2.getField());
    assertEquals("$age", result1Action2FieldValue2.getValue());
    // Row 2
    List<DTCellValue52> dtRowData2 = DataUtilities.makeDataRowList(data[2]);
    TemplateDataProvider rowDataProvider2 = new GuidedDTTemplateDataProvider(allColumns, dtRowData2);
    p.doActions(allColumns, allActions, rowDataProvider2, dtRowData2, rm);
    assertEquals(2, rm.rhs.length);
    assertEquals("Baddie", ((ActionInsertFact) rm.rhs[0]).getFactType());
    assertEquals("Smurf", ((ActionInsertFact) rm.rhs[1]).getFactType());
    // examine the first action
    ActionInsertFact result2Action1 = (ActionInsertFact) rm.rhs[0];
    assertEquals(1, result2Action1.getFieldValues().length);
    ActionFieldValue result2Action1FieldValue1 = (ActionFieldValue) result2Action1.getFieldValues()[0];
    assertEquals(DataType.TYPE_STRING, result2Action1FieldValue1.getType());
    assertEquals("name", result2Action1FieldValue1.getField());
    assertEquals("Gargamel", result2Action1FieldValue1.getValue());
    // examine the second action
    ActionInsertFact result2Action2 = (ActionInsertFact) rm.rhs[1];
    assertEquals(2, result2Action2.getFieldValues().length);
    ActionFieldValue result2Action2FieldValue1 = (ActionFieldValue) result2Action2.getFieldValues()[0];
    assertEquals(DataType.TYPE_STRING, result2Action2FieldValue1.getType());
    assertEquals("name", result2Action2FieldValue1.getField());
    assertEquals("$name", result2Action2FieldValue1.getValue());
    ActionFieldValue result3Action2FieldValue2 = (ActionFieldValue) result2Action2.getFieldValues()[1];
    assertEquals(DataType.TYPE_NUMERIC_INTEGER, result3Action2FieldValue2.getType());
    assertEquals("age", result3Action2FieldValue2.getField());
    assertEquals("$age", result3Action2FieldValue2.getValue());
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) LimitedEntryActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52) IAction(org.drools.workbench.models.datamodel.rule.IAction) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) ArrayList(java.util.ArrayList) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) RuleModel(org.drools.workbench.models.datamodel.rule.RuleModel) BRLActionColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) ActionFieldValue(org.drools.workbench.models.datamodel.rule.ActionFieldValue) ActionInsertFact(org.drools.workbench.models.datamodel.rule.ActionInsertFact) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) BRLActionVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLActionVariableColumn) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) TemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider) Test(org.junit.Test)

Example 10 with GuidedDTTemplateDataProvider

use of org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider in project drools by kiegroup.

the class GuidedDTDRLPersistenceTest method testRHSExecuteWorkItem.

@Test
public void testRHSExecuteWorkItem() {
    GuidedDTDRLPersistence p = new GuidedDTDRLPersistence();
    String[] row = new String[] { "1", "desc", "true" };
    List<BaseColumn> allColumns = new ArrayList<BaseColumn>();
    allColumns.add(new RowNumberCol52());
    allColumns.add(new DescriptionCol52());
    List<ActionCol52> cols = new ArrayList<ActionCol52>();
    ActionWorkItemCol52 awi = new ActionWorkItemCol52();
    PortableWorkDefinition pwd = new PortableWorkDefinition();
    pwd.setName("work-item");
    awi.setWorkItemDefinition(pwd);
    PortableBooleanParameterDefinition p1 = new PortableBooleanParameterDefinition();
    p1.setName("BooleanParameter");
    p1.setValue(Boolean.TRUE);
    pwd.addParameter(p1);
    PortableFloatParameterDefinition p2 = new PortableFloatParameterDefinition();
    p2.setName("FloatParameter");
    p2.setValue(123.456f);
    pwd.addParameter(p2);
    PortableIntegerParameterDefinition p3 = new PortableIntegerParameterDefinition();
    p3.setName("IntegerParameter");
    p3.setValue(123);
    pwd.addParameter(p3);
    PortableStringParameterDefinition p4 = new PortableStringParameterDefinition();
    p4.setName("StringParameter");
    p4.setValue("hello");
    pwd.addParameter(p4);
    cols.add(awi);
    RuleModel rm = new RuleModel();
    allColumns.addAll(cols);
    List<DTCellValue52> rowData = DataUtilities.makeDataRowList(row);
    TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider(allColumns, rowData);
    p.doActions(allColumns, cols, rowDataProvider, rowData, rm);
    assertEquals(1, rm.rhs.length);
    // Examine RuleModel action
    ActionExecuteWorkItem aw = (ActionExecuteWorkItem) rm.rhs[0];
    assertNotNull(aw);
    PortableWorkDefinition mpwd = aw.getWorkDefinition();
    assertNotNull(mpwd);
    assertEquals(4, mpwd.getParameters().size());
    PortableBooleanParameterDefinition mp1 = (PortableBooleanParameterDefinition) mpwd.getParameter("BooleanParameter");
    assertNotNull(mp1);
    assertEquals(Boolean.TRUE, mp1.getValue());
    PortableFloatParameterDefinition mp2 = (PortableFloatParameterDefinition) mpwd.getParameter("FloatParameter");
    assertNotNull(mp2);
    assertEquals(new Float(123.456f), mp2.getValue());
    PortableIntegerParameterDefinition mp3 = (PortableIntegerParameterDefinition) mpwd.getParameter("IntegerParameter");
    assertNotNull(mp3);
    assertEquals(new Integer(123), mp3.getValue());
    PortableStringParameterDefinition mp4 = (PortableStringParameterDefinition) mpwd.getParameter("StringParameter");
    assertNotNull(mp4);
    assertEquals("hello", mp4.getValue());
}
Also used : PortableIntegerParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableIntegerParameterDefinition) PortableFloatParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition) ActionWorkItemCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) ArrayList(java.util.ArrayList) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) RuleModel(org.drools.workbench.models.datamodel.rule.RuleModel) PortableStringParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableStringParameterDefinition) DescriptionCol52(org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52) PortableWorkDefinition(org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) PortableBooleanParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableBooleanParameterDefinition) ActionExecuteWorkItem(org.drools.workbench.models.datamodel.rule.ActionExecuteWorkItem) RowNumberCol52(org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52) GuidedDTTemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider) TemplateDataProvider(org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider) Test(org.junit.Test)

Aggregations

ArrayList (java.util.ArrayList)20 GuidedDTTemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider)20 TemplateDataProvider (org.drools.workbench.models.guided.dtable.backend.util.TemplateDataProvider)20 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)20 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)20 RuleModel (org.drools.workbench.models.datamodel.rule.RuleModel)19 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)19 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)19 Test (org.junit.Test)19 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)12 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)12 CompositeColumn (org.drools.workbench.models.guided.dtable.shared.model.CompositeColumn)11 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)11 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)8 List (java.util.List)6 ActionExecuteWorkItem (org.drools.workbench.models.datamodel.rule.ActionExecuteWorkItem)6 PortableBooleanParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableBooleanParameterDefinition)6 PortableFloatParameterDefinition (org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition)6 PortableWorkDefinition (org.drools.workbench.models.datamodel.workitems.PortableWorkDefinition)6 ActionWorkItemCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemCol52)6