use of com.yahoo.athenz.common.server.db.RolesProvider 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.db.RolesProvider 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.db.RolesProvider 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());
}
use of com.yahoo.athenz.common.server.db.RolesProvider in project athenz by yahoo.
the class JDBCSSHRecordStoreTest method testEnableNotifications.
@Test
public void testEnableNotifications() {
PoolableDataSource mockDataSrc = Mockito.mock(PoolableDataSource.class);
JDBCSSHRecordStore store = new JDBCSSHRecordStore(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);
}
Aggregations