use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class ActionInsertFactColumnSynchronizerTest method testUpdate.
@Test
public void testUpdate() throws VetoException {
final ActionInsertFactCol52 column = spy(new ActionInsertFactCol52());
column.setHeader("col1");
column.setBoundName("$a");
column.setFactType("Applicant");
column.setFactField("age");
modelSynchronizer.appendColumn(column);
final ActionInsertFactCol52 edited = new ActionInsertFactCol52();
edited.setWidth(column.getWidth());
edited.setBoundName("$a");
edited.setFactType("Applicant");
edited.setFactField("name");
edited.setHideColumn(true);
edited.setHeader("updated");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(3, diffs.size());
verify(column).diff(edited);
assertEquals(1, model.getActionCols().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof StringUiColumn);
assertEquals("updated", uiModel.getColumns().get(3).getHeaderMetaData().get(1).getTitle());
assertEquals(false, uiModel.getColumns().get(3).isVisible());
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class BRLActionColumnSynchronizerTest method testUpdate1.
@Test
public void testUpdate1() throws VetoException {
// Single Column, single variable
final BRLActionColumn column = spy(new BRLActionColumn());
final BRLActionVariableColumn columnV0 = new BRLActionVariableColumn("$age", DataType.TYPE_NUMERIC_INTEGER, "Applicant", "age");
column.getChildColumns().add(columnV0);
column.setHeader("col1");
columnV0.setHeader("col1v0");
modelSynchronizer.appendColumn(column);
assertEquals(4, model.getExpandedColumns().size());
assertEquals(1, model.getActionCols().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof IntegerUiColumn);
final BRLActionColumn edited = new BRLActionColumn();
final BRLActionVariableColumn editedColumnV0 = new BRLActionVariableColumn("$name", DataType.TYPE_STRING, "Applicant", "name");
edited.getChildColumns().add(editedColumnV0);
edited.setHideColumn(true);
edited.setHeader("updated");
editedColumnV0.setHeader("updated");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(5, // header, hide, field name, field type, binding
diffs.size());
verify(column).diff(edited);
assertEquals(4, model.getExpandedColumns().size());
assertEquals(1, model.getActionCols().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof StringUiColumn);
assertEquals("updated", uiModel.getColumns().get(3).getHeaderMetaData().get(0).getTitle());
assertEquals("$name", uiModel.getColumns().get(3).getHeaderMetaData().get(1).getTitle());
assertEquals(false, uiModel.getColumns().get(3).isVisible());
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class BRLActionColumnSynchronizerTest method testUpdate2.
@Test
public void testUpdate2() throws VetoException {
// Single Column, multiple variables
final BRLActionColumn column = spy(new BRLActionColumn());
final BRLActionVariableColumn columnV0 = new BRLActionVariableColumn("$age", DataType.TYPE_NUMERIC_INTEGER, "Applicant", "age");
final BRLActionVariableColumn columnV1 = new BRLActionVariableColumn("$name", DataType.TYPE_STRING, "Applicant", "name");
column.getChildColumns().add(columnV0);
column.getChildColumns().add(columnV1);
column.setHeader("col1");
columnV0.setHeader("col1v0");
columnV1.setHeader("col1v1");
modelSynchronizer.appendColumn(column);
assertEquals(5, model.getExpandedColumns().size());
assertEquals(1, model.getActionCols().size());
assertEquals(5, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof IntegerUiColumn);
assertTrue(uiModel.getColumns().get(4) instanceof StringUiColumn);
final BRLActionColumn edited = new BRLActionColumn();
final BRLActionVariableColumn editedColumnV0 = new BRLActionVariableColumn("$name", DataType.TYPE_STRING, "Applicant", "name");
edited.getChildColumns().add(editedColumnV0);
edited.setHideColumn(true);
edited.setHeader("updated");
editedColumnV0.setHeader("updated");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(6, // header, hide, field name, field type, binding, removed column
diffs.size());
verify(column).diff(edited);
assertEquals(4, model.getExpandedColumns().size());
assertEquals(1, model.getActionCols().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof StringUiColumn);
assertEquals("updated", uiModel.getColumns().get(3).getHeaderMetaData().get(0).getTitle());
assertEquals("$name", uiModel.getColumns().get(3).getHeaderMetaData().get(1).getTitle());
assertEquals(false, uiModel.getColumns().get(3).isVisible());
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class ActionRetractFactColumnSynchronizerTest method testUpdate.
@Test
public void testUpdate() throws VetoException {
final ActionRetractFactCol52 column = spy(new ActionRetractFactCol52());
column.setHeader("col1");
modelSynchronizer.appendColumn(column);
final ActionRetractFactCol52 edited = new ActionRetractFactCol52();
edited.setWidth(column.getWidth());
edited.setHideColumn(true);
edited.setHeader("updated");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(2, diffs.size());
verify(column).diff(edited);
assertEquals(1, model.getActionCols().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof BoundFactUiColumn);
assertEquals("updated", uiModel.getColumns().get(3).getHeaderMetaData().get(0).getTitle());
assertEquals(false, uiModel.getColumns().get(3).isVisible());
}
use of org.drools.workbench.models.guided.dtable.shared.model.BaseColumnFieldDiff in project drools-wb by kiegroup.
the class BRLConditionColumnSynchronizerTest method testUpdate2.
@Test
public void testUpdate2() throws VetoException {
// Single Column, multiple variables
final BRLConditionColumn column = spy(new BRLConditionColumn());
final BRLConditionVariableColumn columnV0 = new BRLConditionVariableColumn("$age", DataType.TYPE_NUMERIC_INTEGER, "Applicant", "age");
final BRLConditionVariableColumn columnV1 = new BRLConditionVariableColumn("$name", DataType.TYPE_STRING, "Applicant", "name");
column.getChildColumns().add(columnV0);
column.getChildColumns().add(columnV1);
column.setHeader("col1");
columnV0.setHeader("col1v0");
columnV1.setHeader("col1v1");
modelSynchronizer.appendColumn(column);
assertEquals(5, model.getExpandedColumns().size());
assertEquals(1, model.getConditions().size());
assertEquals(5, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof IntegerUiColumn);
assertTrue(uiModel.getColumns().get(4) instanceof StringUiColumn);
final BRLConditionColumn edited = new BRLConditionColumn();
final BRLConditionVariableColumn editedColumnV0 = new BRLConditionVariableColumn("$name", DataType.TYPE_STRING, "Applicant", "name");
edited.getChildColumns().add(editedColumnV0);
edited.setHideColumn(true);
edited.setHeader("updated");
editedColumnV0.setHeader("updated");
List<BaseColumnFieldDiff> diffs = modelSynchronizer.updateColumn(column, edited);
assertEquals(6, // header, hide, field name, field type, binding, removed column
diffs.size());
verify(column).diff(edited);
assertEquals(4, model.getExpandedColumns().size());
assertEquals(1, model.getConditions().size());
assertEquals(4, uiModel.getColumns().size());
assertTrue(uiModel.getColumns().get(3) instanceof StringUiColumn);
assertEquals("updated", uiModel.getColumns().get(3).getHeaderMetaData().get(0).getTitle());
assertEquals(false, uiModel.getColumns().get(3).isVisible());
assertEquals("$name", uiModel.getColumns().get(3).getHeaderMetaData().get(1).getTitle());
}
Aggregations