use of org.sonar.db.notification.NotificationQueueDto in project sonarqube by SonarSource.
the class DefaultNotificationManagerTest method shouldGetFromQueueAndDelete.
@Test
public void shouldGetFromQueueAndDelete() {
Notification notification = new Notification("test");
NotificationQueueDto dto = NotificationQueueDto.toNotificationQueueDto(notification);
List<NotificationQueueDto> dtos = Arrays.asList(dto);
when(notificationQueueDao.selectOldest(1)).thenReturn(dtos);
assertThat(manager.getFromQueue()).isNotNull();
InOrder inOrder = inOrder(notificationQueueDao);
inOrder.verify(notificationQueueDao).selectOldest(1);
inOrder.verify(notificationQueueDao).delete(dtos);
}
use of org.sonar.db.notification.NotificationQueueDto in project sonarqube by SonarSource.
the class DefaultNotificationManager method scheduleForSending.
/**
* {@inheritDoc}
*/
@Override
public void scheduleForSending(Notification notification) {
NotificationQueueDto dto = NotificationQueueDto.toNotificationQueueDto(notification);
notificationQueueDao.insert(Arrays.asList(dto));
}
use of org.sonar.db.notification.NotificationQueueDto in project sonarqube by SonarSource.
the class DefaultNotificationManagerTest method shouldNotFailWhenUnableToDeserialize.
// SONAR-4739
@Test
public void shouldNotFailWhenUnableToDeserialize() throws Exception {
NotificationQueueDto dto1 = mock(NotificationQueueDto.class);
when(dto1.toNotification()).thenThrow(new InvalidClassException("Pouet"));
List<NotificationQueueDto> dtos = Arrays.asList(dto1);
when(notificationQueueDao.selectOldest(1)).thenReturn(dtos);
manager = spy(manager);
assertThat(manager.getFromQueue()).isNull();
assertThat(manager.getFromQueue()).isNull();
verify(manager, times(1)).logDeserializationIssue();
}
Aggregations