Search in sources :

Example 11 with NotificationRow

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

the class NotificationValueValidatorTest method test1DigExpiresAtNotificationRow.

@Test
public void test1DigExpiresAtNotificationRow() {
    NotificationRow value = new NotificationRow();
    value.setExpiresAt("1d");
    boolean result = validator.isValid(value, context);
    assertTrue(result);
    assertTrue(errorMessages.isEmpty());
}
Also used : NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) Test(org.junit.Test)

Example 12 with NotificationRow

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

the class NotificationValueValidatorTest method testR4T4HR4T6H.

@Test
public void testR4T4HR4T6H() {
    NotificationRow value = new NotificationRow();
    value.setExpiresAt("R4/PT4H,R4/PT6H");
    boolean result = validator.isValid(value, context);
    assertTrue(result);
    assertTrue(errorMessages.isEmpty());
}
Also used : NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) Test(org.junit.Test)

Example 13 with NotificationRow

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

the class NotificationWidgetViewImplTest method generateRows.

private List<NotificationRow> generateRows() {
    List<NotificationRow> rows = new ArrayList<>();
    NotificationRow row1 = new NotificationRow();
    row1.setId(1);
    NotificationRow row2 = new NotificationRow();
    row2.setId(2);
    NotificationRow row3 = new NotificationRow();
    row3.setId(3);
    NotificationRow row4 = new NotificationRow();
    row4.setId(4);
    rows.add(row1);
    rows.add(row2);
    rows.add(row3);
    rows.add(row4);
    return rows;
}
Also used : NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) ArrayList(java.util.ArrayList)

Example 14 with NotificationRow

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

the class NotificationWidgetViewImplTest method testOnAddNewValueAndSave.

@Test
public void testOnAddNewValueAndSave() {
    dataProvider.setList(new ArrayList<>());
    final NotificationTypeListValue[] value = new NotificationTypeListValue[1];
    NotificationsEditorWidget.GetNotificationsCallback callback = v -> value[0] = v;
    setFieldValue(presenter, "view", view);
    notificationWidgetViewImpl.init(presenter, generateRows());
    presenter.setCallback(callback);
    setFieldValue(notificationWidgetViewImpl, "editor", notificationEditorWidget);
    setFieldValue(notificationEditorWidget, "view", notificationEditorWidgetImpl);
    NotificationRow newRow = new NotificationRow();
    newRow.setId(111);
    notificationWidgetViewImpl.addOrEdit(newRow);
    notificationWidgetViewImpl.onSubscription(new NotificationEvent(newRow));
    notificationWidgetViewImpl.ok();
    notificationWidgetViewImpl.hide();
    Assert.assertEquals(0, presenter.getValue().size());
    Assert.assertEquals(5, value[0].getValues().size());
}
Also used : ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Mockito.doCallRealMethod(org.mockito.Mockito.doCallRealMethod) RunWith(org.junit.runner.RunWith) Mockito.spy(org.mockito.Mockito.spy) ArrayList(java.util.ArrayList) NotificationsEditorWidget(org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.NotificationsEditorWidget) LienzoMockitoTestRunner(com.ait.lienzo.test.LienzoMockitoTestRunner) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest) SimpleTable(org.uberfire.ext.widgets.common.client.tables.SimpleTable) Before(org.junit.Before) HasData(com.google.gwt.view.client.HasData) Test(org.junit.Test) Mockito.doNothing(org.mockito.Mockito.doNothing) Mockito.when(org.mockito.Mockito.when) ArgumentMatchers.anyList(org.mockito.ArgumentMatchers.anyList) BaseModal(org.uberfire.ext.widgets.common.client.common.popups.BaseModal) GwtMock(com.google.gwtmockito.GwtMock) List(java.util.List) NotificationEvent(org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.event.NotificationEvent) ListDataProvider(com.google.gwt.view.client.ListDataProvider) NotificationTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationTypeListValue) GwtMockito(com.google.gwtmockito.GwtMockito) Assert(org.junit.Assert) Collections(java.util.Collections) NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) NotificationsEditorWidget(org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.NotificationsEditorWidget) NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) NotificationEvent(org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.event.NotificationEvent) NotificationTypeListValue(org.kie.workbench.common.stunner.bpmn.definition.property.notification.NotificationTypeListValue) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest) Test(org.junit.Test)

Example 15 with NotificationRow

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

the class NotificationEditorWidgetTest method testCreateAndClose.

@Test
public void testCreateAndClose() {
    List<String> groups = Arrays.asList("AAA", "BBB", "CCC", "DDD");
    List<String> users = Arrays.asList("aaa", "bbb", "ccc");
    doNothing().when(view).hide();
    when(subject.getValue()).thenReturn("QWERTY!");
    when(body.getValue()).thenReturn("QWERTY!");
    NotificationRow test = new NotificationRow();
    doNothing().when(view).hide();
    when(customerBinder.getModel()).thenReturn(test);
    when(notCompleted.getValue()).thenReturn(NOT_STARTED_NOTIFY.getAlias());
    when(typeSelect.getSelectedItem()).thenReturn(notCompleted);
    when(searchSelectionReplyToHandler.getSelectedValue()).thenReturn("admin");
    when(searchSelectionFromHandler.getSelectedValue()).thenReturn("admin");
    when(multipleLiveSearchSelectionHandlerGroups.getSelectedValues()).thenReturn(groups);
    when(multipleLiveSearchSelectionHandlerUsers.getSelectedValues()).thenReturn(users);
    view.createOrEdit(notificationWidgetViewImpl, test);
    view.close();
    Assert.assertNotEquals("QWERTY!", test.getSubject());
    Assert.assertNotEquals("QWERTY!", test.getBody());
    Assert.assertNotEquals("admin", test.getReplyTo());
    Assert.assertNotEquals("admin", test.getFrom());
    Assert.assertNotEquals(NOT_STARTED_NOTIFY, test.getType());
    Assert.assertNotEquals(groups, test.getGroups());
    Assert.assertNotEquals(users, test.getUsers());
}
Also used : NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString) ReflectionUtilsTest(org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest) Test(org.junit.Test)

Aggregations

NotificationRow (org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow)140 Test (org.junit.Test)127 Column (com.google.gwt.user.cellview.client.Column)11 ReflectionUtilsTest (org.kie.workbench.common.stunner.bpmn.client.forms.util.ReflectionUtilsTest)9 PopoverTextCell (org.uberfire.ext.widgets.common.client.tables.PopoverTextCell)9 ArrayList (java.util.ArrayList)5 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)4 LienzoMockitoTestRunner (com.ait.lienzo.test.LienzoMockitoTestRunner)3 TextCell (com.google.gwt.cell.client.TextCell)3 HasData (com.google.gwt.view.client.HasData)3 ListDataProvider (com.google.gwt.view.client.ListDataProvider)3 GwtMock (com.google.gwtmockito.GwtMock)3 GwtMockito (com.google.gwtmockito.GwtMockito)3 Collections (java.util.Collections)3 List (java.util.List)3 Assert (org.junit.Assert)3 Before (org.junit.Before)3 RunWith (org.junit.runner.RunWith)3 NotificationsEditorWidget (org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.NotificationsEditorWidget)3 NotificationEvent (org.kie.workbench.common.stunner.bpmn.client.forms.fields.notificationsEditor.event.NotificationEvent)3