use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class ZTSImpl method setNotificationManager.
private void setNotificationManager() {
ZTSNotificationTaskFactory ztsNotificationTaskFactory = new ZTSNotificationTaskFactory(instanceCertManager, dataStore, hostnameResolver, userDomainPrefix, serverHostName, httpsPort, new NotificationToEmailConverterCommon(userAuthority));
notificationManager = new NotificationManager(ztsNotificationTaskFactory.getNotificationTasks(), userAuthority);
// Enable notifications for instanceCertManager
instanceCertManager.enableCertStoreNotifications(notificationManager, dataStore, serverHostName);
instanceCertManager.enableSSHStoreNotifications(notificationManager, dataStore, serverHostName);
}
use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class JDBCCertRecordStoreTest method testEnableNotifications.
@Test
public void testEnableNotifications() {
PoolableDataSource mockDataSrc = Mockito.mock(PoolableDataSource.class);
JDBCCertRecordStore store = new JDBCCertRecordStore(mockDataSrc);
boolean 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);
// Not supported for FileCertStore even if all dependencies provided
assertFalse(isEnabled);
}
use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class ZTSClientNotificationSenderImplTest method testSendNotificationNotInit.
@Test
public void testSendNotificationNotInit() {
ZTSClientNotificationSenderImpl ztsClientNotificationSender = new ZTSClientNotificationSenderImpl();
NotificationManager notificationManager = Mockito.mock(NotificationManager.class);
ztsClientNotificationSender.init(notificationManager, null, null);
ZTSClientNotification ztsClientNotification = Mockito.mock(ZTSClientNotification.class);
ztsClientNotificationSender.sendNotification(ztsClientNotification);
Mockito.verify(notificationManager, Mockito.times(0)).sendNotifications(any());
}
use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class InstanceCertManagerTest method testeEnableCertStoreNotifications.
@Test
public void testeEnableCertStoreNotifications() {
InstanceCertManager instance = new InstanceCertManager(null, null, null, true, null);
boolean isEnabled = instance.enableCertStoreNotifications(null, null, null);
assertFalse(isEnabled);
CertRecordStore certStore = Mockito.mock(CertRecordStore.class);
when(certStore.enableNotifications(any(), any(), any())).thenReturn(true);
instance.setCertStore(certStore);
NotificationManager notificationManager = Mockito.mock(NotificationManager.class);
RolesProvider rolesProvider = Mockito.mock(RolesProvider.class);
isEnabled = instance.enableCertStoreNotifications(notificationManager, rolesProvider, "testServer");
assertTrue(isEnabled);
}
use of com.yahoo.athenz.common.server.notification.NotificationManager in project athenz by yahoo.
the class FileCertRecordStoreTest method testEnableNotifications.
@Test
public void testEnableNotifications() {
FileCertRecordStore store = new FileCertRecordStore(new File("/tmp"));
boolean 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);
// Not supported for FileCertStore even if all dependencies provided
assertFalse(isEnabled);
}
Aggregations