use of org.apache.atlas.model.notification.HookNotification in project atlas by apache.
the class AtlasHookTest method testFailedMessageIsLoggedIfRequired.
@Test
public void testFailedMessageIsLoggedIfRequired() throws NotificationException {
List<HookNotification> hookNotifications = new ArrayList<HookNotification>() {
{
add(new EntityCreateRequest("user"));
}
};
doThrow(new NotificationException(new Exception(), Arrays.asList("test message"))).when(notificationInterface).send(NotificationInterface.NotificationType.HOOK, hookNotifications);
AtlasHook.notifyEntitiesInternal(hookNotifications, 2, notificationInterface, true, failedMessagesLogger);
verify(failedMessagesLogger, times(1)).log("test message");
}
use of org.apache.atlas.model.notification.HookNotification in project atlas by apache.
the class CreateDatabase method getNotificationMessages.
@Override
public List<HookNotification> getNotificationMessages() throws Exception {
List<HookNotification> ret = null;
AtlasEntitiesWithExtInfo entities = getEntities();
if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) {
ret = Collections.singletonList(new EntityCreateRequestV2(getUserName(), entities));
}
return ret;
}
use of org.apache.atlas.model.notification.HookNotification in project atlas by apache.
the class CreateHiveProcess method getNotificationMessages.
@Override
public List<HookNotification> getNotificationMessages() throws Exception {
List<HookNotification> ret = null;
AtlasEntitiesWithExtInfo entities = getEntities();
if (entities != null && CollectionUtils.isNotEmpty(entities.getEntities())) {
ret = Collections.singletonList(new EntityCreateRequestV2(getUserName(), entities));
}
return ret;
}
use of org.apache.atlas.model.notification.HookNotification in project atlas by apache.
the class DropTable method getNotificationMessages.
@Override
public List<HookNotification> getNotificationMessages() throws Exception {
List<HookNotification> ret = null;
List<AtlasObjectId> entities = getEntities();
if (CollectionUtils.isNotEmpty(entities)) {
ret = new ArrayList<>(entities.size());
for (AtlasObjectId entity : entities) {
ret.add(new EntityDeleteRequestV2(getUserName(), Collections.singletonList(entity)));
}
}
return ret;
}
use of org.apache.atlas.model.notification.HookNotification in project atlas by apache.
the class FalconHook method fireAndForget.
private void fireAndForget(FalconEvent event) throws FalconException, URISyntaxException {
LOG.info("Entered Atlas hook for Falcon hook operation {}", event.getOperation());
List<HookNotification> messages = new ArrayList<>();
Operation op = getOperation(event.getOperation());
String user = getUser(event.getUser());
LOG.info("fireAndForget user:{}", user);
switch(op) {
case ADD:
messages.add(new EntityCreateRequest(user, createEntities(event, user)));
break;
}
notifyEntities(messages);
}
Aggregations