use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class DynamoDBCertRecordStoreTest method testEnableNotifications.
@Test
public void testEnableNotifications() {
DynamoDBCertRecordStore store = new DynamoDBCertRecordStore(dbClient, "Athenz-ZTS-Table", "Athenz-ZTS-Current-Time-Index", "Athenz-ZTS-Host-Name-Index", null);
boolean isEnabled = store.enableNotifications(null, null, null);
assertFalse(isEnabled);
ZTSClientNotificationSenderImpl ztsClientNotificationSender = new ZTSClientNotificationSenderImpl();
store = new DynamoDBCertRecordStore(dbClient, "Athenz-ZTS-Table", "Athenz-ZTS-Current-Time-Index", "Athenz-ZTS-Host-Name-Index", ztsClientNotificationSender);
isEnabled = store.enableNotifications(null, null, null);
assertFalse(isEnabled);
NotificationManager notificationManager = Mockito.mock(NotificationManager.class);
RolesProvider rolesProvider = Mockito.mock(RolesProvider.class);
String serverName = "testServer";
isEnabled = store.enableNotifications(notificationManager, rolesProvider, serverName);
assertTrue(isEnabled);
}
use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class DynamoDBSSHRecordStoreTest method testEnableNotifications.
@Test
public void testEnableNotifications() {
DynamoDBSSHRecordStore store = new DynamoDBSSHRecordStore(dbClient, "Athenz-ZTS-Table", null);
boolean isEnabled = store.enableNotifications(null, null, null);
assertFalse(isEnabled);
ZTSClientNotificationSenderImpl ztsClientNotificationSender = new ZTSClientNotificationSenderImpl();
store = new DynamoDBSSHRecordStore(dbClient, "Athenz-ZTS-Table", ztsClientNotificationSender);
isEnabled = store.enableNotifications(null, null, null);
assertFalse(isEnabled);
NotificationManager notificationManager = Mockito.mock(NotificationManager.class);
RolesProvider rolesProvider = Mockito.mock(RolesProvider.class);
String serverName = "testServer";
isEnabled = store.enableNotifications(notificationManager, rolesProvider, serverName);
assertTrue(isEnabled);
}
use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class ZMSImpl method setNotificationManager.
private void setNotificationManager() {
notificationToEmailConverterCommon = new NotificationToEmailConverterCommon(userAuthority);
ZMSNotificationTaskFactory zmsNotificationTaskFactory = new ZMSNotificationTaskFactory(dbService, userDomainPrefix, notificationToEmailConverterCommon);
notificationManager = new NotificationManager(zmsNotificationTaskFactory.getNotificationTasks(), userAuthority);
}
use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class ZTSClientNotificationSenderImplTest method testInit.
@Test
public void testInit() {
ZTSClientNotificationSenderImpl ztsClientNotificationSender = new ZTSClientNotificationSenderImpl();
NotificationManager notificationManager = Mockito.mock(NotificationManager.class);
Mockito.when(notificationManager.getNotificationUserAuthority()).thenReturn(Mockito.mock(Authority.class));
RolesProvider rolesProvider = Mockito.mock(RolesProvider.class);
String serverName = "testServer";
boolean initResult = ztsClientNotificationSender.init(notificationManager, rolesProvider, serverName);
assertTrue(initResult);
initResult = ztsClientNotificationSender.init(notificationManager, rolesProvider, null);
assertFalse(initResult);
initResult = ztsClientNotificationSender.init(notificationManager, null, serverName);
assertFalse(initResult);
initResult = ztsClientNotificationSender.init(null, rolesProvider, serverName);
assertFalse(initResult);
}
use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class ZTSClientNotificationSenderImplTest method testSendNotificationInit.
@Test
public void testSendNotificationInit() {
ZTSClientNotificationSenderImpl ztsClientNotificationSender = new ZTSClientNotificationSenderImpl();
NotificationManager notificationManager = Mockito.mock(NotificationManager.class);
RolesProvider rolesProvider = Mockito.mock(RolesProvider.class);
String serverName = "testServer";
ztsClientNotificationSender.init(notificationManager, rolesProvider, serverName);
ZTSClientNotification ztsClientNotification = Mockito.mock(ZTSClientNotification.class);
ztsClientNotificationSender.sendNotification(ztsClientNotification);
Mockito.verify(notificationManager, Mockito.times(1)).sendNotifications(any());
}
Aggregations