SentryGenericPolicyProcessor(Configuration conf) throws Exception { this.store = new DelegateSentryStore(conf); this.handerInvoker = new NotificationHandlerInvoker(createHandlers(conf)); this.conf = conf; adminGroups = ImmutableSet.copyOf((Sets.newHashSet(conf.getStrings( ServerConfig.ADMIN_GROUPS, new String[]{})))); }
@Test(expected = RuntimeException.class) public void testGrantPrivilegeExternalComponentInvalidConf() throws Exception { String externalComponent = "mycomponent"; Configuration confCopy = new Configuration(conf); confCopy.set(String.format(ServiceConstants.ServerConfig.SENTRY_COMPONENT_ACTION_FACTORY_FORMAT, externalComponent), InvalidActionFactory.class.getName()); SentryStoreLayer store = new DelegateSentryStore(confCopy); testGrantPrivilege(store, externalComponent); }
@Test public void testGrantPrivilegeExternalComponent() throws Exception { String externalComponent = "mycomponent"; Configuration confCopy = new Configuration(conf); confCopy.set(String.format(ServiceConstants.ServerConfig.SENTRY_COMPONENT_ACTION_FACTORY_FORMAT, externalComponent), MyComponentActionFactory.class.getName()); SentryStoreLayer store = new DelegateSentryStore(confCopy); testGrantPrivilege(store, externalComponent); }
@Test(expected = Exception.class) public void testGrantPrivilegeExternalComponentInvalidConf() throws Exception { String externalComponent = "mycomponent"; Configuration confCopy = new Configuration(conf); confCopy.set(String.format(ServiceConstants.ServerConfig.SENTRY_COMPONENT_ACTION_FACTORY_FORMAT, externalComponent), InvalidActionFactory.class.getName()); SentryStoreLayer store = new DelegateSentryStore(confCopy); testGrantPrivilege(store, externalComponent); }
@Test public void testGrantPrivilegeExternalComponentCaseInsensitivity() throws Exception { String externalComponent = "MyCoMpOnEnT"; Configuration confCopy = new Configuration(conf); confCopy.set(String.format(ServiceConstants.ServerConfig.SENTRY_COMPONENT_ACTION_FACTORY_FORMAT, "mycomponent"), MyComponentActionFactory.class.getName()); SentryStoreLayer store = new DelegateSentryStore(confCopy); testGrantPrivilege(store, externalComponent); }
@Test public void testGrantPrivilegeExternalComponent() throws Exception { String externalComponent = "mycomponent"; Configuration confCopy = new Configuration(conf); confCopy.set(String.format(ServiceConstants.ServerConfig.SENTRY_COMPONENT_ACTION_FACTORY_FORMAT, externalComponent), MyComponentActionFactory.class.getName()); SentryStoreLayer store = new DelegateSentryStore(confCopy); testGrantPrivilege(store, externalComponent); }
@Test public void testGrantPrivilegeExternalComponentCaseInsensitivity() throws Exception { String externalComponent = "MyCoMpOnEnT"; Configuration confCopy = new Configuration(conf); confCopy.set(String.format(ServiceConstants.ServerConfig.SENTRY_COMPONENT_ACTION_FACTORY_FORMAT, "mycomponent"), MyComponentActionFactory.class.getName()); SentryStoreLayer store = new DelegateSentryStore(confCopy); testGrantPrivilege(store, externalComponent); }
@BeforeClass public static void setup() throws Exception { conf = new Configuration(true); setup(conf); sentryStore = new DelegateSentryStore(conf); }
@BeforeClass public static void setup() throws Exception { conf = new Configuration(false); setup(conf); sentryStore = new DelegateSentryStore(conf); }