use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow in project kie-wb-common by kiegroup.
the class NotificationWidgetViewImplTest method testRowCountOneAndTwo.
@Test
public void testRowCountOneAndTwo() {
List<NotificationRow> rows = new ArrayList<>();
rows.add(new NotificationRow());
notificationWidgetViewImpl.init(presenter, rows);
ListDataProvider<NotificationRow> dataProvider = getFieldValue(NotificationWidgetViewImpl.class, notificationWidgetViewImpl, "dataProvider");
Assert.assertEquals(1, dataProvider.getList().size());
rows = new ArrayList<>();
rows.add(new NotificationRow());
notificationWidgetViewImpl.init(presenter, rows);
Assert.assertEquals(1, dataProvider.getList().size());
rows.add(new NotificationRow());
notificationWidgetViewImpl.init(presenter, rows);
Assert.assertEquals(2, dataProvider.getList().size());
notificationWidgetViewImpl.init(presenter, Collections.EMPTY_LIST);
Assert.assertEquals(0, dataProvider.getList().size());
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow in project kie-wb-common by kiegroup.
the class NotificationWidgetViewImplTest method testOnEditValueAndSave.
@Test
public void testOnEditValueAndSave() {
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(1);
notificationWidgetViewImpl.addOrEdit(newRow);
notificationWidgetViewImpl.onSubscription(new NotificationEvent(newRow));
notificationWidgetViewImpl.ok();
notificationWidgetViewImpl.hide();
Assert.assertEquals(0, presenter.getValue().size());
Assert.assertEquals(4, value[0].getValues().size());
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow in project kie-wb-common by kiegroup.
the class NotificationWidgetViewImplTest method testDeleteRow.
@Test
public void testDeleteRow() {
NotificationRow row4 = new NotificationRow();
row4.setId(4);
notificationWidgetViewImpl.init(presenter, generateRows());
ListDataProvider<NotificationRow> dataProvider = getFieldValue(NotificationWidgetViewImpl.class, notificationWidgetViewImpl, "dataProvider");
Assert.assertEquals(4, dataProvider.getList().size());
notificationWidgetViewImpl.delete(row4);
Assert.assertEquals(3, dataProvider.getList().size());
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow in project kie-wb-common by kiegroup.
the class NotificationValueValidatorTest method testP2y10M14dT20h13m.
@Test
public void testP2y10M14dT20h13m() {
NotificationRow value = new NotificationRow();
value.setExpiresAt("P2y10M14dT20h13m");
boolean result = validator.isValid(value, context);
assertTrue(result);
assertTrue(errorMessages.isEmpty());
}
use of org.kie.workbench.common.stunner.bpmn.client.forms.fields.model.NotificationRow in project kie-wb-common by kiegroup.
the class NotificationValueValidatorTest method testDayRepeatableUntilStateChangesNotification.
@Test
public void testDayRepeatableUntilStateChangesNotification() {
NotificationRow notification = new NotificationRow();
notification.setExpiresAt("R/P33D");
boolean result = validator.isValid(notification, context);
assertTrue(result);
assertTrue(errorMessages.isEmpty());
}
Aggregations