use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow in project kie-wb-common by kiegroup.
the class VariableListItemWidgetTest method testSetModel.
@Test
public void testSetModel() {
when(widget.getVariableType()).thenReturn(Variable.VariableType.PROCESS);
widget.setModel(new VariableRow());
verify(deleteButton).setIcon(IconType.TRASH);
verify(widget).getCustomDataType();
verify(widget).getDataTypeDisplayName();
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow in project kie-wb-common by kiegroup.
the class VariableListItemWidgetViewImplTest method testSetProcessVarDataType.
@Test
public void testSetProcessVarDataType() {
VariableRow row = new VariableRow();
row.setName(VARIABLE_NAME);
row.setCustomDataType(null);
row.setDataTypeDisplayName(DATA_TYPE_NAME);
row.setVariableType(Variable.VariableType.PROCESS);
doReturn(row).when(variableRow).getModel();
view.setModel(row);
verify(variableRow, times(1)).setModel(row);
verify(deleteButton, times(1)).setIcon(IconType.TRASH);
verify(customDataType, never()).setValue(DATA_TYPE_NAME);
verify(dataType, times(1)).setValue(DATA_TYPE_NAME);
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow in project kie-wb-common by kiegroup.
the class VariableListItemWidgetViewImplTest method testSetProcessVarCustomDataType.
@Test
public void testSetProcessVarCustomDataType() {
VariableRow row = new VariableRow();
row.setName(VARIABLE_NAME);
row.setCustomDataType(CUST_DATA_TYPE_NAME);
row.setDataTypeDisplayName(null);
row.setVariableType(Variable.VariableType.PROCESS);
doReturn(row).when(variableRow).getModel();
view.setModel(row);
verify(variableRow, times(1)).setModel(row);
verify(deleteButton, times(1)).setIcon(IconType.TRASH);
verify(customDataType, times(1)).setValue(CUST_DATA_TYPE_NAME);
verify(dataType, times(1)).setValue(CUST_DATA_TYPE_NAME);
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow in project kie-wb-common by kiegroup.
the class VariableListItemWidgetViewImplTest method setUp.
@Before
public void setUp() throws Exception {
GwtMockito.initMocks(this);
customDataType = mock(TextBox.class);
dataType = mock(ValueListBox.class);
dataTypeComboBox = mock(ComboBox.class);
processVarComboBox = mock(ComboBox.class);
view = mock(VariableListItemWidgetViewImpl.class);
view.variableRow = variableRow;
view.name = name;
view.deleteButton = deleteButton;
view.customDataType = customDataType;
view.dataType = dataType;
view.dataTypeComboBox = dataTypeComboBox;
view.notification = notification;
doCallRealMethod().when(view).init();
doCallRealMethod().when(view).getCustomDataType();
doCallRealMethod().when(view).setCustomDataType(anyString());
doCallRealMethod().when(view).getModel();
doCallRealMethod().when(view).setModel(any(VariableRow.class));
doCallRealMethod().when(view).getModelValue(any(ValueListBox.class));
doCallRealMethod().when(view).setTextBoxModelValue(any(TextBox.class), anyString());
doCallRealMethod().when(view).setListBoxModelValue(any(ValueListBox.class), anyString());
doCallRealMethod().when(view).getDataTypeDisplayName();
doCallRealMethod().when(view).setDataTypeDisplayName(anyString());
doCallRealMethod().when(view).getVariableType();
doCallRealMethod().when(view).setParentWidget(any(VariablesEditorWidgetView.Presenter.class));
doCallRealMethod().when(view).isDuplicateName(anyString());
doCallRealMethod().when(view).handleDeleteButton(any(ClickEvent.class));
VariableRow row = new VariableRow();
doReturn(row).when(variableRow).getModel();
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow in project kie-wb-common by kiegroup.
the class VariablesEditorFieldRendererTest method testDeserializeVariables.
@Test
public void testDeserializeVariables() {
List<String> dataTypes = new ArrayList<String>(Arrays.asList("Boolean", "Float", "Integer", "Object", "org.veg.Potato", "String"));
List<String> dataTypeDisplayNames = new ArrayList<String>(Arrays.asList("Boolean", "Float", "Integer", "Potato [org.veg]", "Object", "String"));
variablesEditor.setDataTypes(dataTypes, dataTypeDisplayNames);
List<VariableRow> variableRows = variablesEditor.deserializeVariables("var1:String,var2:Integer,var3:org.stuff.Potato");
assertEquals(3, variableRows.size());
VariableRow var = variableRows.get(0);
assertEquals("var1", var.getName());
assertEquals("String", var.getDataTypeDisplayName());
assertEquals(Variable.VariableType.PROCESS, var.getVariableType());
var = variableRows.get(1);
assertEquals("var2", var.getName());
assertEquals("Integer", var.getDataTypeDisplayName());
assertEquals(Variable.VariableType.PROCESS, var.getVariableType());
var = variableRows.get(2);
assertEquals("var3", var.getName());
assertEquals("org.stuff.Potato", var.getCustomDataType());
assertEquals(Variable.VariableType.PROCESS, var.getVariableType());
}
Aggregations