Search in sources :

Example 76 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 test3DigExpiresAtNotificationRow.

@Test
public void test3DigExpiresAtNotificationRow() {
    NotificationRow value = new NotificationRow();
    value.setExpiresAt("111d");
    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 77 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 testR2PT4H20190527T133300Z.

@Test
public void testR2PT4H20190527T133300Z() {
    NotificationRow notification = new NotificationRow();
    notification.setExpiresAt("R2/PT4H/2019-05-27T13:33:00Z");
    boolean result = validator.isValid(notification, 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 78 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 testDurationsW.

@Test
public void testDurationsW() {
    NotificationRow value = new NotificationRow();
    value.setExpiresAt("P1WT20H13M");
    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 79 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 testR0120011201T133402P1M1D.

@Test
public void testR0120011201T133402P1M1D() {
    NotificationRow value = new NotificationRow();
    value.setExpiresAt("R0/2001-12-01T13:34+02/P1M1D");
    boolean result = validator.isValid(value, context);
    assertFalse(result);
    assertEquals(NotificationValueValidator.WRONG_EXPIRES_AT_EXPRESSION, errorMessages.get(0));
}
Also used : NotificationRow(org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow) Test(org.junit.Test)

Example 80 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 testOnAddNewValueAndClose.

@Test
public void testOnAddNewValueAndClose() {
    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(null));
    notificationWidgetViewImpl.ok();
    notificationWidgetViewImpl.hide();
    Assert.assertEquals(0, presenter.getValue().size());
    Assert.assertEquals(4, 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)

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