use of com.epam.pipeline.entity.notification.NotificationSettings in project cloud-pipeline by epam.
the class NotificationSettingsManagerTest method testDelete.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testDelete() {
NotificationTemplate template = createTemplate(1L, "template");
NotificationSettings settings = createSettings(NotificationType.LONG_RUNNING, template.getId(), 1L, 1L);
notificationSettingsManager.createOrUpdate(settings);
NotificationSettings loaded = notificationSettingsManager.load(NotificationType.LONG_RUNNING);
Assert.assertNotNull(loaded);
notificationSettingsManager.delete(loaded.getId());
loaded = notificationSettingsManager.load(NotificationType.LONG_RUNNING);
Assert.assertNull(loaded);
}
use of com.epam.pipeline.entity.notification.NotificationSettings in project cloud-pipeline by epam.
the class NotificationAspectTest method setUp.
@Before
public void setUp() throws Exception {
statusTemplate = new NotificationTemplate(5L);
statusTemplate.setBody("///");
statusTemplate.setSubject("//");
statusTemplate.setName("testTemplate");
notificationTemplateDao.createNotificationTemplate(statusTemplate);
NotificationSettings settings = new NotificationSettings();
settings.setType(NotificationSettings.NotificationType.PIPELINE_RUN_STATUS);
settings.setKeepInformedAdmins(true);
settings.setInformedUserIds(Collections.emptyList());
settings.setTemplateId(statusTemplate.getId());
settings.setThreshold(null);
settings.setEnabled(true);
settings.setResendDelay(null);
settings.setKeepInformedOwner(true);
notificationSettingsDao.createNotificationSettings(settings);
testOwner = new PipelineUser("testOwner");
userDao.createUser(testOwner, Collections.emptyList());
pipeline = new Pipeline();
pipeline.setName("TestPipeline");
Mockito.when(pipelineManager.load(Mockito.anyLong())).thenReturn(pipeline);
}
use of com.epam.pipeline.entity.notification.NotificationSettings in project cloud-pipeline by epam.
the class NotificationSettingsManagerTest method testCreateWithoutThresholdAndResendDelay.
@Test
@Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Throwable.class)
public void testCreateWithoutThresholdAndResendDelay() {
NotificationTemplate template = createTemplate(1L, "template");
NotificationSettings settings = createSettings(NotificationType.LONG_RUNNING, template.getId(), null, null);
notificationSettingsManager.createOrUpdate(settings);
NotificationSettings loaded = notificationSettingsManager.load(NotificationType.LONG_RUNNING);
Assert.assertEquals(-1, loaded.getThreshold().longValue());
Assert.assertEquals(-1, loaded.getResendDelay().longValue());
}
Aggregations