SentryGenericPolicyProcessor implements SentryGenericPolicyService.Iface { public static List<NotificationHandler> createHandlers(Configuration conf) throws SentryConfigurationException { List<NotificationHandler> handlers = Lists.newArrayList(); Iterable<String> notificationHandlers = Splitter.onPattern("[\\s,]").trimResults() .omitEmptyStrings().split(conf.get(PolicyStoreConstants.SENTRY_GENERIC_POLICY_NOTIFICATION, "")); try { for (String notificationHandler : notificationHandlers) { handlers.add(createInstance(notificationHandler, conf, NotificationHandler.class)); } } catch (Exception e) { throw new SentryConfigurationException("Create notificationHandlers error: " + e.getMessage(), e); } return handlers; } SentryGenericPolicyProcessor(Configuration conf); @VisibleForTesting  SentryGenericPolicyProcessor(Configuration conf, SentryStoreLayer store); static Set<String> getRequestorGroups(Configuration conf, String userName); static SentryStoreLayer createStore(Configuration conf); static List<NotificationHandler> createHandlers(Configuration conf); @SuppressWarnings("unchecked") static T createInstance(String className, Configuration conf, Class<T> iface); @Override TCreateSentryRoleResponse create_sentry_role(
      final TCreateSentryRoleRequest request); @Override TDropSentryRoleResponse drop_sentry_role(final TDropSentryRoleRequest request); @Override TAlterSentryRoleGrantPrivilegeResponse alter_sentry_role_grant_privilege(
      final TAlterSentryRoleGrantPrivilegeRequest request); @Override TAlterSentryRoleRevokePrivilegeResponse alter_sentry_role_revoke_privilege(
      final TAlterSentryRoleRevokePrivilegeRequest request); @Override TAlterSentryRoleAddGroupsResponse alter_sentry_role_add_groups(
      final TAlterSentryRoleAddGroupsRequest request); @Override TAlterSentryRoleDeleteGroupsResponse alter_sentry_role_delete_groups(
      final TAlterSentryRoleDeleteGroupsRequest request); @Override TListSentryRolesResponse list_sentry_roles_by_group(
      final TListSentryRolesRequest request); @Override TListSentryPrivilegesResponse list_sentry_privileges_by_role(
      final TListSentryPrivilegesRequest request); @Override TListSentryPrivilegesForProviderResponse list_sentry_privileges_for_provider(
      final TListSentryPrivilegesForProviderRequest request); @Override TListSentryPrivilegesByAuthResponse list_sentry_privileges_by_authorizable(TListSentryPrivilegesByAuthRequest request); @Override TDropPrivilegesResponse drop_sentry_privilege(
      final TDropPrivilegesRequest request); @Override TRenamePrivilegesResponse rename_sentry_privilege(
      final TRenamePrivilegesRequest request); static final String SENTRY_GENERIC_SERVICE_NAME; }
@Test(expected=SentryConfigurationException.class) public void testConfigCannotCreateNotificationHandler() throws Exception { Configuration conf = new Configuration(); conf.set(PolicyStoreConstants.SENTRY_GENERIC_POLICY_NOTIFICATION,"junk"); SentryGenericPolicyProcessor.createHandlers(conf); }