use of com.yahoo.athenz.common.server.notification.NotificationToEmailConverterCommon in project athenz by yahoo.
the class ZMSNotificationTaskFactoryTest method testNotificationTasksOrdering.
@Test
public void testNotificationTasksOrdering() {
DBService dbsvc = Mockito.mock(DBService.class);
ZMSNotificationTaskFactory zmsNotificationTaskFactory = new ZMSNotificationTaskFactory(dbsvc, USER_DOMAIN_PREFIX, new NotificationToEmailConverterCommon(null));
List<NotificationTask> notificationTasks = zmsNotificationTaskFactory.getNotificationTasks();
assertEquals(5, notificationTasks.size());
assertEquals(notificationTasks.get(0).getDescription(), "pending role membership approvals reminders");
assertEquals(notificationTasks.get(1).getDescription(), "pending group membership approvals reminders");
assertEquals(notificationTasks.get(2).getDescription(), "membership expiration reminders");
assertEquals(notificationTasks.get(3).getDescription(), "Periodic Review Reminder");
assertEquals(notificationTasks.get(4).getDescription(), "group membership expiration reminders");
}
use of com.yahoo.athenz.common.server.notification.NotificationToEmailConverterCommon 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.NotificationToEmailConverterCommon in project athenz by yahoo.
the class CertFailedRefreshNotificationTaskTest method testGetEmailBodySingleRecord.
@Test
public void testGetEmailBodySingleRecord() {
System.setProperty("athenz.notification_workflow_url", "https://athenz.example.com/workflow");
System.setProperty("athenz.notification_support_text", "#Athenz slack channel");
System.setProperty("athenz.notification_support_url", "https://link.to.athenz.channel.com");
System.setProperty("athenz.notification_athenz_ui_url", "https://ui-athenz.example.com/");
Map<String, String> details = new HashMap<>();
details.put("domain", "dom1");
details.put(NOTIFICATION_DETAILS_UNREFRESHED_CERTS, "service1;provider1;instanceid1;Sun Mar 15 15:08:07 IST 2020;;hostName1");
Notification notification = new Notification();
notification.setDetails(details);
CertFailedRefreshNotificationTask.CertFailedRefreshNotificationToEmailConverter converter = new CertFailedRefreshNotificationTask.CertFailedRefreshNotificationToEmailConverter(serverName, httpsPort, new NotificationToEmailConverterCommon(null));
NotificationEmail notificationAsEmail = converter.getNotificationAsEmail(notification);
String body = notificationAsEmail.getBody();
assertNotNull(body);
assertTrue(body.contains(htmlSingleRecord));
System.clearProperty("athenz.notification_workflow_url");
System.clearProperty("notification_support_text");
System.clearProperty("notification_support_url");
System.clearProperty("athenz.notification_athenz_ui_url");
}
Aggregations