- PublishNotificationService notification = new PublishNotificationServiceBuilder().setTopic("wrongtopic")
- .setCommonId("commonId").setConnectionType(ConnectionType.Service).setMessage("Service deleted")
- .setOperationalState(State.OutOfService).setServiceName("service name").build();
- listener.onPublishNotificationService(notification);
- verify(publisher, times(0)).sendEvent(any());
+ PublishNotificationProcessService notification = new PublishNotificationProcessServiceBuilder()
+ .setPublisherName("wrongPublisher")
+ .setCommonId("commonId")
+ .setConnectionType(ConnectionType.Service)
+ .setMessage("Service deleted")
+ .setOperationalState(State.OutOfService)
+ .setServiceName("service name")
+ .build();
+ listener.onPublishNotificationProcessService(notification);
+ verify(publisherService, times(0)).sendEvent(any(), anyString());
+ }
+
+ @Test
+ public void onPublishNotificationAlarmServiceTest() {
+ NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ Map.of("test", publisherAlarm));
+ PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
+ .setPublisherName("test")
+ .setConnectionType(ConnectionType.Service)
+ .setMessage("The service is now inService")
+ .setOperationalState(State.OutOfService)
+ .setServiceName("service name")
+ .build();
+ listener.onPublishNotificationAlarmService(notification);
+ verify(publisherAlarm, times(1)).sendEvent(any(), anyString());
+ }
+
+ @Test
+ public void onPublishNotificationAlarmServiceWrongPublisherTest() {
+ NbiNotificationsListenerImpl listener = new NbiNotificationsListenerImpl(Map.of("test", publisherService),
+ Map.of("test", publisherAlarm));
+ PublishNotificationAlarmService notification = new PublishNotificationAlarmServiceBuilder()
+ .setPublisherName("wrongPublisher")
+ .setConnectionType(ConnectionType.Service)
+ .setMessage("The service is now inService")
+ .setOperationalState(State.OutOfService)
+ .setServiceName("service name")
+ .build();
+ listener.onPublishNotificationAlarmService(notification);
+ verify(publisherAlarm, times(0)).sendEvent(any(), anyString());