Search in sources :

Example 31 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestSetProcessor method before.

@BeforeClass
public static void before() throws Exception {
    Map<String, String> env = new HashMap<>();
    env.put(TEST_ENV_VAR_PASSWORD, TEST_ENV_VAR_PASSWORD_VALUE);
    setEnv(env);
    System.setProperty(TEST_SYSTEM_PROPERTY, TEST_SYSTEM_PROPERTY_VALUE);
    HiveConf conf = new HiveConf();
    SessionState.start(conf);
    state = SessionState.get();
}
Also used : HashMap(java.util.HashMap) HiveConf(org.apache.hadoop.hive.conf.HiveConf) BeforeClass(org.junit.BeforeClass)

Example 32 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestSQLStdHiveAccessControllerCLI method testConfigProcessing.

/**
   * Test that SQLStdHiveAccessController is not applying config restrictions on CLI
   *
   * @throws HiveAuthzPluginException
   */
@Test
public void testConfigProcessing() throws HiveAuthzPluginException {
    HiveConf processedConf = new HiveConf();
    SQLStdHiveAccessController accessController = new SQLStdHiveAccessController(null, processedConf, new HadoopDefaultAuthenticator(), getCLISessionCtx());
    accessController.applyAuthorizationConfigPolicy(processedConf);
    // check that hook to disable transforms has not been added
    assertFalse("Check for transform query disabling hook", processedConf.getVar(ConfVars.PREEXECHOOKS).contains(DisallowTransformHook.class.getName()));
    // verify that some dummy param can be set
    processedConf.verifyAndSet("dummy.param", "dummy.val");
    processedConf.verifyAndSet(ConfVars.HIVE_AUTHORIZATION_ENABLED.varname, "true");
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) HadoopDefaultAuthenticator(org.apache.hadoop.hive.ql.security.HadoopDefaultAuthenticator) Test(org.junit.Test)

Example 33 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestPrivilegesV2 method setup.

@Before
public void setup() throws Exception {
    queryState = new QueryState(null);
    //set authorization mode to V2
    HiveConf conf = queryState.getConf();
    conf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, SQLStdHiveAuthorizerFactory.class.getName());
    db = Mockito.mock(Hive.class);
    table = new Table(DB, TABLE);
    SessionState.start(conf);
    Mockito.when(db.getTable(DB, TABLE, false)).thenReturn(table);
    Mockito.when(db.getTable(TABLE_QNAME, false)).thenReturn(table);
    Mockito.when(db.getPartition(table, new HashMap<String, String>(), false)).thenReturn(partition);
}
Also used : Hive(org.apache.hadoop.hive.ql.metadata.Hive) Table(org.apache.hadoop.hive.ql.metadata.Table) SQLStdHiveAuthorizerFactory(org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory) HiveConf(org.apache.hadoop.hive.conf.HiveConf) QueryState(org.apache.hadoop.hive.ql.QueryState) Before(org.junit.Before)

Example 34 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestSessionUserName method getAuthV2HiveConf.

/**
   * @return HiveConf with authorization V2 enabled with a dummy authorization factory
   * that captures the given user name
   */
private HiveConf getAuthV2HiveConf() {
    HiveConf conf = new HiveConf();
    conf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, HiveAuthorizerStoringUserNameFactory.class.getName());
    conf.setVar(HiveConf.ConfVars.HIVE_AUTHENTICATOR_MANAGER, SessionStateUserAuthenticator.class.getName());
    return conf;
}
Also used : SessionStateUserAuthenticator(org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator) HiveConf(org.apache.hadoop.hive.conf.HiveConf)

Example 35 with HiveConf

use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.

the class TestIUD method initialize.

@BeforeClass
public static void initialize() {
    conf = new HiveConf(SemanticAnalyzer.class);
    SessionState.start(conf);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) BeforeClass(org.junit.BeforeClass)

Aggregations

HiveConf (org.apache.hadoop.hive.conf.HiveConf)404 BeforeClass (org.junit.BeforeClass)73 Test (org.junit.Test)66 Path (org.apache.hadoop.fs.Path)54 Before (org.junit.Before)50 Driver (org.apache.hadoop.hive.ql.Driver)46 CliSessionState (org.apache.hadoop.hive.cli.CliSessionState)44 IOException (java.io.IOException)39 ArrayList (java.util.ArrayList)37 File (java.io.File)31 HashMap (java.util.HashMap)26 FileSystem (org.apache.hadoop.fs.FileSystem)26 SessionState (org.apache.hadoop.hive.ql.session.SessionState)22 LinkedHashMap (java.util.LinkedHashMap)17 List (java.util.List)16 HiveException (org.apache.hadoop.hive.ql.metadata.HiveException)15 MiniHS2 (org.apache.hive.jdbc.miniHS2.MiniHS2)14 Map (java.util.Map)12 HiveMetaStoreClient (org.apache.hadoop.hive.metastore.HiveMetaStoreClient)12 MetaException (org.apache.hadoop.hive.metastore.api.MetaException)12