Search in sources :

Example 6 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestHS2AuthzContext method beforeTest.

@BeforeClass
public static void beforeTest() throws Exception {
    Class.forName(MiniHS2.getJdbcDriverName());
    HiveConf conf = new HiveConf();
    conf.setVar(ConfVars.HIVE_AUTHORIZATION_MANAGER, MockedHiveAuthorizerFactory.class.getName());
    conf.setVar(ConfVars.HIVE_AUTHENTICATOR_MANAGER, SessionStateUserAuthenticator.class.getName());
    conf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, true);
    conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    conf.setBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS, false);
    miniHS2 = new MiniHS2(conf);
    miniHS2.start(new HashMap<String, String>());
}
Also used : SessionStateUserAuthenticator(org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator) HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 7 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestHS2AuthzSessionContext method beforeTest.

@BeforeClass
public static void beforeTest() throws Exception {
    Class.forName(MiniHS2.getJdbcDriverName());
    HiveConf conf = new HiveConf();
    conf.setVar(ConfVars.HIVE_AUTHORIZATION_MANAGER, MockedHiveAuthorizerFactory.class.getName());
    conf.setVar(ConfVars.HIVE_AUTHENTICATOR_MANAGER, SessionStateUserAuthenticator.class.getName());
    conf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, true);
    conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    conf.setBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS, false);
    miniHS2 = new MiniHS2(conf);
    miniHS2.start(new HashMap<String, String>());
}
Also used : SessionStateUserAuthenticator(org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator) HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 8 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestJdbcWithSQLAuthUDFBlacklist method startHS2.

public void startHS2(HiveConf conf) throws Exception {
    Class.forName(MiniHS2.getJdbcDriverName());
    conf.setVar(ConfVars.HIVE_AUTHORIZATION_MANAGER, SQLStdHiveAuthorizerFactory.class.getName());
    conf.setVar(ConfVars.HIVE_AUTHENTICATOR_MANAGER, SessionStateUserAuthenticator.class.getName());
    conf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, true);
    conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    conf.setBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS, false);
    miniHS2 = new MiniHS2(conf);
    miniHS2.start(new HashMap<String, String>());
}
Also used : SQLStdHiveAuthorizerFactory(org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory) SessionStateUserAuthenticator(org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2)

Example 9 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestJdbcWithSQLAuthorization method beforeTest.

@BeforeClass
public static void beforeTest() throws Exception {
    Class.forName(MiniHS2.getJdbcDriverName());
    HiveConf conf = new HiveConf();
    conf.setVar(ConfVars.HIVE_AUTHORIZATION_MANAGER, SQLStdHiveAuthorizerFactory.class.getName());
    conf.setVar(ConfVars.HIVE_AUTHENTICATOR_MANAGER, SessionStateUserAuthenticator.class.getName());
    conf.setBoolVar(ConfVars.HIVE_AUTHORIZATION_ENABLED, true);
    conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    conf.setBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS, false);
    miniHS2 = new MiniHS2(conf);
    miniHS2.start(new HashMap<String, String>());
}
Also used : SQLStdHiveAuthorizerFactory(org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory) SessionStateUserAuthenticator(org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator) HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 10 with MiniHS2

use of org.apache.hive.jdbc.miniHS2.MiniHS2 in project hive by apache.

the class TestJdbcWithMiniLlap method beforeTest.

@BeforeClass
public static void beforeTest() throws Exception {
    Class.forName(MiniHS2.getJdbcDriverName());
    String confDir = "../../data/conf/llap/";
    if (confDir != null && !confDir.isEmpty()) {
        HiveConf.setHiveSiteLocation(new URL("file://" + new File(confDir).toURI().getPath() + "/hive-site.xml"));
        System.out.println("Setting hive-site: " + HiveConf.getHiveSiteLocation());
    }
    conf = new HiveConf();
    conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    conf.addResource(new URL("file://" + new File(confDir).toURI().getPath() + "/tez-site.xml"));
    miniHS2 = new MiniHS2(conf, MiniClusterType.LLAP);
    dataFileDir = conf.get("test.data.files").replace('\\', '/').replace("c:", "");
    kvDataFilePath = new Path(dataFileDir, "kv1.txt");
    Map<String, String> confOverlay = new HashMap<String, String>();
    miniHS2.start(confOverlay);
    miniHS2.getDFS().getFileSystem().mkdirs(new Path("/apps_staging_dir/anonymous"));
}
Also used : Path(org.apache.hadoop.fs.Path) HashMap(java.util.HashMap) HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) File(java.io.File) URL(java.net.URL) BeforeClass(org.junit.BeforeClass)

Aggregations

MiniHS2 (org.apache.hive.jdbc.miniHS2.MiniHS2)19 BeforeClass (org.junit.BeforeClass)16 HiveConf (org.apache.hadoop.hive.conf.HiveConf)15 HashMap (java.util.HashMap)8 Path (org.apache.hadoop.fs.Path)6 SessionStateUserAuthenticator (org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator)5 File (java.io.File)2 URL (java.net.URL)2 Statement (java.sql.Statement)2 SQLStdHiveAuthorizerFactory (org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory)2 Test (org.junit.Test)2 Connection (java.sql.Connection)1 ResultSet (java.sql.ResultSet)1 MiniClusterType (org.apache.hive.jdbc.miniHS2.MiniHS2.MiniClusterType)1 Before (org.junit.Before)1