use of org.graylog2.notifications.NotificationImpl in project graylog2-server by Graylog2.
the class IndexerClusterCheckerThreadTest method ignoresNonDataNodes.
@Test
public void ignoresNonDataNodes() throws Exception {
final Set<NodeDiskUsageStats> nodeDiskUsageStats = mockNodeDiskUsageStats(EnumSet.of(MASTER_ELIGIBLE, TRANSFORM));
when(cluster.getDiskUsageStats()).thenReturn(nodeDiskUsageStats);
when(cluster.getClusterAllocationDiskSettings()).thenReturn(buildThresholdTriggeredClusterAllocationDiskSettings(ES_NODE_DISK_WATERMARK_LOW, WatermarkSettings.SettingsType.ABSOLUTE));
Notification notification = new NotificationImpl();
when(notificationService.buildNow()).thenReturn(notification);
when(notificationService.isFirst(ES_NODE_DISK_WATERMARK_LOW)).thenReturn(true);
indexerClusterCheckerThread.checkDiskUsage();
verify(notificationService, never()).publishIfFirst(any());
}
use of org.graylog2.notifications.NotificationImpl in project graylog2-server by Graylog2.
the class IndexerClusterCheckerThreadTest method notificationCreated.
private void notificationCreated(Notification.Type notificationType, WatermarkSettings.SettingsType watermarkSettingsType) throws Exception {
Set<NodeDiskUsageStats> nodeDiskUsageStats = mockNodeDiskUsageStats();
when(cluster.getDiskUsageStats()).thenReturn(nodeDiskUsageStats);
if (watermarkSettingsType == WatermarkSettings.SettingsType.ABSOLUTE) {
when(cluster.getClusterAllocationDiskSettings()).thenReturn(buildThresholdTriggeredClusterAllocationDiskSettings(notificationType, WatermarkSettings.SettingsType.ABSOLUTE));
} else {
when(cluster.getClusterAllocationDiskSettings()).thenReturn(buildThresholdTriggeredClusterAllocationDiskSettings(notificationType, WatermarkSettings.SettingsType.PERCENTAGE));
}
when(notificationService.isFirst(notificationType)).thenReturn(true);
Notification notification = new NotificationImpl();
when(notificationService.buildNow()).thenReturn(notification);
indexerClusterCheckerThread.checkDiskUsage();
ArgumentCaptor<Notification> argument = ArgumentCaptor.forClass(Notification.class);
verify(notificationService, times(1)).publishIfFirst(argument.capture());
Notification publishedNotification = argument.getValue();
assertThat(publishedNotification.getType()).isEqualTo(notificationType);
}
Aggregations