Search in sources :

Example 11 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 testSerializeVariables.

@Test
public void testSerializeVariables() {
    Map<String, String> mapDataTypeDisplayNamesToNames = new HashMap<String, String>();
    mapDataTypeDisplayNamesToNames.put("String", "String");
    mapDataTypeDisplayNamesToNames.put("Integer", "Integer");
    mapDataTypeDisplayNamesToNames.put("Potato [org.veg]", "org.veg.Potato");
    variablesEditor.mapDataTypeDisplayNamesToNames = mapDataTypeDisplayNamesToNames;
    List<VariableRow> variableRows = new ArrayList<VariableRow>();
    variableRows.add(new VariableRow(Variable.VariableType.PROCESS, "var1", "String", null));
    variableRows.add(new VariableRow(Variable.VariableType.PROCESS, "var2", "Integer", null));
    variableRows.add(new VariableRow(Variable.VariableType.PROCESS, "var3", "org.veg.Potato", null));
    String s = variablesEditor.serializeVariables(variableRows);
    assertEquals("var1:String,var2:Integer,var3:org.veg.Potato", s);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) VariableRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow) Test(org.junit.Test)

Example 12 with VariableRow

use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow in project kie-wb-common by kiegroup.

the class VariablesEditorWidgetViewImplTest method setUp.

@Before
public void setUp() {
    GwtMockito.initMocks(this);
    view = GWT.create(VariablesEditorWidgetViewImpl.class);
    view.variableRows = variableRows;
    view.addVarButton = button;
    view.nameth = nameth;
    view.datatypeth = datatypeth;
    view.notification = notification;
    doCallRealMethod().when(view).setVariableRows(any(List.class));
    doCallRealMethod().when(view).init(any(VariablesEditorWidgetView.Presenter.class));
    doCallRealMethod().when(view).handleAddVarButton(any(ClickEvent.class));
    doCallRealMethod().when(view).getVariableRows();
    doCallRealMethod().when(view).getVariableWidget(anyInt());
    doCallRealMethod().when(view).getVariableRowsCount();
    doCallRealMethod().when(view).setValue(anyString(), anyBoolean());
    doCallRealMethod().when(view).doSetValue(anyString(), anyBoolean(), anyBoolean());
    doCallRealMethod().when(view).setDataTypes(anyListOf(String.class), anyListOf(String.class));
    rows = new ArrayList<VariableRow>();
    rows.add(new VariableRow(Variable.VariableType.PROCESS, "varName", null, null));
    rows.add(new VariableRow(Variable.VariableType.PROCESS, "varName2", null, null));
}
Also used : ClickEvent(com.google.gwt.event.dom.client.ClickEvent) ArrayList(java.util.ArrayList) List(java.util.List) Mockito.anyString(org.mockito.Mockito.anyString) VariableRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.VariableRow) Before(org.junit.Before)

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