Search in sources :

Example 6 with VariableRow

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();
}
Also used : VariableRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow) Test(org.junit.Test)

Example 7 with VariableRow

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);
}
Also used : VariableRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow) Test(org.junit.Test)

Example 8 with VariableRow

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);
}
Also used : VariableRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow) Test(org.junit.Test)

Example 9 with VariableRow

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();
}
Also used : ValueListBox(org.gwtbootstrap3.client.ui.ValueListBox) ComboBox(org.kie.workbench.common.stunner.bpmn.client.forms.widgets.ComboBox) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) TextBox(org.gwtbootstrap3.client.ui.TextBox) VariableNameTextBox(org.kie.workbench.common.stunner.bpmn.client.forms.widgets.VariableNameTextBox) VariableRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow) Before(org.junit.Before)

Example 10 with VariableRow

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());
}
Also used : ArrayList(java.util.ArrayList) VariableRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow) Test(org.junit.Test)

Aggregations

VariableRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow)12 Test (org.junit.Test)7 ArrayList (java.util.ArrayList)4 Before (org.junit.Before)3 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)2 TextBox (org.gwtbootstrap3.client.ui.TextBox)2 ValueListBox (org.gwtbootstrap3.client.ui.ValueListBox)2 ComboBox (org.kie.workbench.common.stunner.bpmn.client.forms.widgets.ComboBox)2 VariableNameTextBox (org.kie.workbench.common.stunner.bpmn.client.forms.widgets.VariableNameTextBox)2 HashMap (java.util.HashMap)1 List (java.util.List)1 ListBoxValues (org.kie.workbench.common.stunner.bpmn.client.forms.util.ListBoxValues)1 Mockito.anyString (org.mockito.Mockito.anyString)1