use of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn in project drools-wb by kiegroup.
the class DefaultValuesPageTest method prepareViewWithChildren.
@Test
public void prepareViewWithChildren() {
final GuidedDecisionTableView.Presenter presenter = mock(GuidedDecisionTableView.Presenter.class);
final BRLActionColumn brlColumn = mock(BRLActionColumn.class);
final GuidedDecisionTable52 dtable = mock(GuidedDecisionTable52.class);
final ArrayList<BRLVariableColumn> childColumns = new ArrayList<>();
childColumns.add(brlActionVariableColumn1);
childColumns.add(brlActionVariableColumn2);
doReturn(brlColumn).when(plugin).editingCol();
doReturn(presenter).when(plugin).getPresenter();
doReturn(dtable).when(presenter).getModel();
doReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY).when(dtable).getTableFormat();
doReturn(childColumns).when(brlColumn).getChildColumns();
page.prepareView();
verify(view).init(page);
verify(view).clear();
verify(view).addVariable("var1", defaultValueOneWidget);
verify(view).addVariable("var2", defaultValueTwoWidget);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn in project drools-wb by kiegroup.
the class GuidedDecisionTableFactory method makeTableWithBRLFragmentActionCol.
public static GuidedDecisionTable52 makeTableWithBRLFragmentActionCol(final String packageName, final Collection<Import> imports, final String tableName) {
final GuidedDecisionTable52 dt = new GuidedDecisionTable52();
dt.setPackageName(packageName);
dt.getImports().getImports().addAll(imports);
dt.setTableName(tableName);
final BRLActionColumn brl = new BRLActionColumn();
final ActionInsertFact ifc1 = new ActionInsertFact();
ifc1.setFactType("Applicant");
ifc1.setBoundName("$a");
final ActionFieldValue afv1 = new ActionFieldValue();
afv1.setNature(FieldNatureType.TYPE_TEMPLATE);
afv1.setField("age");
afv1.setValue("f1");
ifc1.addFieldValue(afv1);
final ActionInsertFact ifc2 = new ActionInsertFact();
ifc2.setFactType("Mortgage");
ifc2.setBoundName("$m");
final ActionFieldValue afv2 = new ActionFieldValue();
afv2.setNature(FieldNatureType.TYPE_TEMPLATE);
afv2.setField("amount");
afv2.setValue("f2");
ifc2.addFieldValue(afv2);
final ActionSetField asf = new ActionSetField();
asf.setVariable("$a");
asf.addFieldValue(new ActionFieldValue("age", "33", DataType.TYPE_NUMERIC_INTEGER));
final ActionUpdateField auf = new ActionUpdateField();
asf.setVariable("$m");
asf.addFieldValue(new ActionFieldValue("amount", "10000", DataType.TYPE_NUMERIC_INTEGER));
brl.getDefinition().add(ifc1);
brl.getDefinition().add(ifc2);
brl.getChildColumns().add(new BRLActionVariableColumn("f1", DataType.TYPE_NUMERIC_INTEGER));
brl.getChildColumns().add(new BRLActionVariableColumn("f2", DataType.TYPE_NUMERIC_INTEGER));
brl.getDefinition().add(asf);
brl.getDefinition().add(auf);
dt.getConditions().add(brl);
dt.setData(DataUtilities.makeDataLists(new String[][] { new String[] { "1", "", "desc", "33", "" } }));
return dt;
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn in project drools-wb by kiegroup.
the class DecisionTableAnalyzerTest method testInsertBRLActionColumn.
@Test
public void testInsertBRLActionColumn() throws Exception {
BRLActionColumn brlActionOne = new BRLActionColumn();
BRLActionVariableColumn a = new BRLActionVariableColumn();
BRLActionVariableColumn b = new BRLActionVariableColumn();
BRLActionColumn brlActionTwo = new BRLActionColumn();
BRLActionVariableColumn c = new BRLActionVariableColumn();
BRLActionVariableColumn d = new BRLActionVariableColumn();
brlActionOne.setChildColumns(Arrays.asList(a, b));
brlActionTwo.setChildColumns(Arrays.asList(c, d));
model.setActionCols(Arrays.asList(brlActionOne, brlActionTwo));
decisionTableAnalyzer.insertColumn(brlActionOne);
verify(updateManager).newColumn(model, 3);
}
Aggregations