org.apache.hadoop.hive.ql.security
Class TestMetastoreAuthorizationProvider

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.apache.hadoop.hive.ql.security.TestMetastoreAuthorizationProvider
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
TestStorageBasedMetastoreAuthorizationProvider

public class TestMetastoreAuthorizationProvider
extends junit.framework.TestCase

TestHiveMetastoreAuthorizationProvider. Test case for HiveMetastoreAuthorizationProvider, and by default, for DefaultHiveMetaStoreAuthorizationProvider using org.apache.hadoop.hive.metastore.AuthorizationPreEventListener and org.apache.hadoop.hive. Note that while we do use the hive driver to test, that is mostly for test writing ease, and it has the same effect as using a metastore client directly because we disable hive client-side authorization for this test, and only turn on server-side auth. This test is also intended to be extended to provide tests for other authorization providers like StorageBasedAuthorizationProvider


Field Summary
protected  HiveConf clientHiveConf
           
protected  Driver driver
           
protected  HiveMetaStoreClient msc
           
protected  UserGroupInformation ugi
           
 
Constructor Summary
TestMetastoreAuthorizationProvider()
           
 
Method Summary
protected  void allowCreateInDb(String dbName, String userName, String location)
           
protected  void allowCreateInTbl(String tableName, String userName, String location)
           
protected  void allowDropOnDb(String dbName, String userName, String location)
           
protected  void allowDropOnTable(String tblName, String userName, String location)
           
protected  void assertNoPrivileges(MetaException me)
           
protected  void disallowCreateInDb(String dbName, String userName, String location)
           
protected  void disallowCreateInTbl(String tableName, String userName, String location)
           
protected  String getAuthorizationProvider()
           
protected  String getTestDbName()
           
protected  String getTestTableName()
           
protected  void setUp()
           
protected  void tearDown()
           
 void testSimplePrivileges()
           
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

clientHiveConf

protected HiveConf clientHiveConf

msc

protected HiveMetaStoreClient msc

driver

protected Driver driver

ugi

protected UserGroupInformation ugi
Constructor Detail

TestMetastoreAuthorizationProvider

public TestMetastoreAuthorizationProvider()
Method Detail

getAuthorizationProvider

protected String getAuthorizationProvider()

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

tearDown

protected void tearDown()
                 throws Exception
Overrides:
tearDown in class junit.framework.TestCase
Throws:
Exception

getTestDbName

protected String getTestDbName()

getTestTableName

protected String getTestTableName()

testSimplePrivileges

public void testSimplePrivileges()
                          throws Exception
Throws:
Exception

allowCreateInTbl

protected void allowCreateInTbl(String tableName,
                                String userName,
                                String location)
                         throws Exception
Throws:
Exception

disallowCreateInTbl

protected void disallowCreateInTbl(String tableName,
                                   String userName,
                                   String location)
                            throws Exception
Throws:
Exception

allowCreateInDb

protected void allowCreateInDb(String dbName,
                               String userName,
                               String location)
                        throws Exception
Throws:
Exception

disallowCreateInDb

protected void disallowCreateInDb(String dbName,
                                  String userName,
                                  String location)
                           throws Exception
Throws:
Exception

allowDropOnTable

protected void allowDropOnTable(String tblName,
                                String userName,
                                String location)
                         throws Exception
Throws:
Exception

allowDropOnDb

protected void allowDropOnDb(String dbName,
                             String userName,
                             String location)
                      throws Exception
Throws:
Exception

assertNoPrivileges

protected void assertNoPrivileges(MetaException me)


Copyright © 2012 The Apache Software Foundation