use of com.sequenceiq.cloudbreak.service.notification.Notification in project cloudbreak by hortonworks.
the class ImageStatusCheckerTask method getImageCopyNotification.
private Notification<CloudbreakEventsJson> getImageCopyNotification(ImageStatusResult result, Stack stack) {
CloudbreakEventsJson notification = new CloudbreakEventsJson();
notification.setEventType("IMAGE_COPY_STATE");
notification.setEventTimestamp(new Date().getTime());
notification.setEventMessage(String.valueOf(result.getStatusProgressValue()));
notification.setOwner(stack.getOwner());
notification.setAccount(stack.getAccount());
notification.setCloud(stack.cloudPlatform());
notification.setRegion(stack.getRegion());
notification.setStackId(stack.getId());
notification.setStackName(stack.getDisplayName());
notification.setStackStatus(stack.getStatus());
return new Notification<>(notification);
}
use of com.sequenceiq.cloudbreak.service.notification.Notification in project cloudbreak by hortonworks.
the class AmbariOperationsStatusCheckerTask method getAmbariProgressNotification.
private Notification<CloudbreakEventsJson> getAmbariProgressNotification(Long progressValue, Stack stack, AmbariOperationType ambariOperationType) {
CloudbreakEventsJson notification = new CloudbreakEventsJson();
notification.setEventType(ambariOperationType.name());
notification.setEventTimestamp(new Date().getTime());
notification.setEventMessage(String.valueOf(progressValue));
notification.setOwner(stack.getOwner());
notification.setAccount(stack.getAccount());
notification.setCloud(stack.cloudPlatform());
notification.setRegion(stack.getRegion());
notification.setStackId(stack.getId());
notification.setStackName(stack.getDisplayName());
notification.setStackStatus(stack.getStatus());
if (stack.getCluster() != null) {
notification.setClusterId(stack.getCluster().getId());
notification.setClusterName(stack.getCluster().getName());
}
return new Notification<>(notification);
}
use of com.sequenceiq.cloudbreak.service.notification.Notification in project cloudbreak by hortonworks.
the class StackCreationService method getImageCopyNotification.
private Notification<CloudbreakEventsJson> getImageCopyNotification(CheckImageResult result, Stack stack) {
CloudbreakEventsJson notification = new CloudbreakEventsJson();
notification.setEventType("IMAGE_COPY_STATE");
notification.setEventTimestamp(new Date().getTime());
notification.setEventMessage(String.valueOf(result.getStatusProgressValue()));
notification.setOwner(stack.getOwner());
notification.setAccount(stack.getAccount());
notification.setCloud(stack.cloudPlatform());
notification.setRegion(stack.getRegion());
notification.setStackId(stack.getId());
notification.setStackName(stack.getDisplayName());
notification.setStackStatus(stack.getStatus());
return new Notification<>(notification);
}
use of com.sequenceiq.cloudbreak.service.notification.Notification in project cloudbreak by hortonworks.
the class UptimeNotifierTest method notificationSendingWhenEverythingWorkFine.
@Test
public void notificationSendingWhenEverythingWorkFine() {
doNothing().when(notificationSender).send(any(Notification.class));
List<Cluster> clusters = TestUtil.generateCluster(1);
when(clusterRepository.findByStatuses(any())).thenReturn(Collections.singletonList(clusters.get(0)));
Stack stack1 = TestUtil.stack();
when(stackRepository.findStackForCluster(anyLong())).thenReturn(stack1);
underTest.sendUptime();
ArgumentCaptor<Notification> argument1 = ArgumentCaptor.forClass(Notification.class);
verify(notificationSender).send(argument1.capture());
Notification<CloudbreakEventsJson> notification = argument1.getValue();
assertEquals(GCP, notification.getNotification().getCloud());
assertEquals("null", notification.getNotification().getBlueprintName());
assertEquals(null, notification.getNotification().getBlueprintId());
verify(notificationSender, times(1)).send(any(Notification.class));
}
use of com.sequenceiq.cloudbreak.service.notification.Notification in project cloudbreak by hortonworks.
the class UptimeNotifierTest method notificationSendingWhenBlueprintNotNullEverythingWorkFine.
@Test
public void notificationSendingWhenBlueprintNotNullEverythingWorkFine() {
doNothing().when(notificationSender).send(any(Notification.class));
List<Cluster> clusters = TestUtil.generateCluster(1);
when(clusterRepository.findByStatuses(any())).thenReturn(Collections.singletonList(clusters.get(0)));
Stack stack2 = TestUtil.stack();
stack2.setCluster(clusters.get(0));
when(stackRepository.findStackForCluster(anyLong())).thenReturn(stack2);
underTest.sendUptime();
ArgumentCaptor<Notification> argument2 = ArgumentCaptor.forClass(Notification.class);
verify(notificationSender).send(argument2.capture());
Notification<CloudbreakEventsJson> notification = argument2.getValue();
assertEquals(GCP, notification.getNotification().getCloud());
assertEquals("multi-node-yarn", notification.getNotification().getBlueprintName());
assertEquals(Long.valueOf(1), notification.getNotification().getBlueprintId());
verify(notificationSender, times(1)).send(any(Notification.class));
}
Aggregations