* AUTHZ_PROVIDER, AUTHZ_PROVIDER_BACKEND, and AUTHZ_POLICY_ENGINE
* correctly throw ClassNotFoundExceptions
*/
@Test
public void testClassNotFound() throws Exception {
SolrAuthzConf solrAuthzConf =
new SolrAuthzConf(Resources.getResource("sentry-site.xml"));
setUsableAuthzConf(solrAuthzConf);
// verify it is usable
new SolrAuthzBinding(solrAuthzConf);
// give a bogus provider
solrAuthzConf.set(AuthzConfVars.AUTHZ_PROVIDER.getVar(), "org.apache.sentry.provider.BogusProvider");
try {
new SolrAuthzBinding(solrAuthzConf);
Assert.fail("Expected ClassNotFoundException");
} catch (ClassNotFoundException e) {}
setUsableAuthzConf(solrAuthzConf);
// give a bogus provider backend
solrAuthzConf.set(AuthzConfVars.AUTHZ_PROVIDER_BACKEND.getVar(), "org.apache.sentry.provider.file.BogusProviderBackend");
try {
new SolrAuthzBinding(solrAuthzConf);
Assert.fail("Expected ClassNotFoundException");
} catch (ClassNotFoundException e) {}
setUsableAuthzConf(solrAuthzConf);
// give a bogus policy enine
solrAuthzConf.set(AuthzConfVars.AUTHZ_POLICY_ENGINE.getVar(), "org.apache.sentry.provider.solr.BogusPolicyEngine");
try {
new SolrAuthzBinding(solrAuthzConf);
Assert.fail("Expected ClassNotFoundException");
} catch (ClassNotFoundException e) {}
}