use of org.apache.atlas.v1.model.notification.HookNotificationV1.EntityCreateRequest in project atlas by apache.
the class AtlasHookTest method testAllFailedMessagesAreLogged.
@Test
public void testAllFailedMessagesAreLogged() throws NotificationException {
List<HookNotification> hookNotifications = new ArrayList<HookNotification>() {
{
add(new EntityCreateRequest("user"));
}
};
doThrow(new NotificationException(new Exception(), Arrays.asList("test message1", "test message2"))).when(notificationInterface).send(NotificationInterface.NotificationType.HOOK, hookNotifications);
AtlasHook.notifyEntitiesInternal(hookNotifications, 2, notificationInterface, true, failedMessagesLogger);
verify(failedMessagesLogger, times(1)).log("test message1");
verify(failedMessagesLogger, times(1)).log("test message2");
}
use of org.apache.atlas.v1.model.notification.HookNotificationV1.EntityCreateRequest in project atlas by apache.
the class AtlasHookTest method testNotifyEntitiesRetriesOnException.
@Test
public void testNotifyEntitiesRetriesOnException() throws NotificationException {
List<HookNotification> hookNotifications = new ArrayList<HookNotification>() {
{
add(new EntityCreateRequest("user"));
}
};
doThrow(new NotificationException(new Exception())).when(notificationInterface).send(NotificationInterface.NotificationType.HOOK, hookNotifications);
AtlasHook.notifyEntitiesInternal(hookNotifications, 2, notificationInterface, false, failedMessagesLogger);
verify(notificationInterface, times(2)).send(NotificationInterface.NotificationType.HOOK, hookNotifications);
}
Aggregations