Search in sources :

Example 16 with MiniHS2

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

the class TestJdbcWithMiniHA method beforeTest.

@BeforeClass
public static void beforeTest() throws Exception {
    Class.forName(MiniHS2.getJdbcDriverName());
    conf = new HiveConf();
    conf.setBoolVar(ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    String dataFileDir = conf.get("test.data.files").replace('\\', '/').replace("c:", "");
    dataFilePath = new Path(dataFileDir, "kv1.txt");
    DriverManager.setLoginTimeout(0);
    conf.setBoolVar(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY, false);
    miniHS2 = new MiniHS2.Builder().withConf(conf).withMiniMR().withHA().build();
    Map<String, String> overlayProps = new HashMap<String, String>();
    overlayProps.put(ConfVars.HIVE_SERVER2_SESSION_HOOK.varname, HATestSessionHook.class.getName());
    miniHS2.start(overlayProps);
    assertTrue(HAUtil.isHAEnabled(conf, DFSUtil.getNamenodeNameServiceId(conf)));
    createDb();
}
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) BeforeClass(org.junit.BeforeClass)

Example 17 with MiniHS2

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

the class TestJdbcMetadataApiAuth method beforeTest.

@BeforeClass
public static void beforeTest() throws Exception {
    Class.forName(MiniHS2.getJdbcDriverName());
    HiveConf conf = new HiveConf();
    conf.setVar(ConfVars.HIVE_AUTHORIZATION_MANAGER, TestAuthorizerFactory.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>());
    TestAuthValidator.allowActions = true;
    // set up a db and table
    String tableName1 = TestJdbcMetadataApiAuth.class.getSimpleName() + "_tab";
    String dbName1 = TestJdbcMetadataApiAuth.class.getSimpleName() + "_db";
    // create connection as user1
    Connection hs2Conn = getConnection("user1");
    Statement stmt = hs2Conn.createStatement();
    // create table, db
    stmt.execute("create table " + tableName1 + "(i int) ");
    stmt.execute("create database " + dbName1);
    stmt.close();
    hs2Conn.close();
}
Also used : Statement(java.sql.Statement) SessionStateUserAuthenticator(org.apache.hadoop.hive.ql.security.SessionStateUserAuthenticator) Connection(java.sql.Connection) HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 18 with MiniHS2

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

the class TestBeeLineWithArgs method preTests.

/**
   * Start up a local Hive Server 2 for these tests
   */
@BeforeClass
public static void preTests() throws Exception {
    HiveConf hiveConf = new HiveConf();
    hiveConf.setVar(HiveConf.ConfVars.HIVE_LOCK_MANAGER, "org.apache.hadoop.hive.ql.lockmgr.EmbeddedLockManager");
    hiveConf.setBoolVar(HiveConf.ConfVars.HIVEOPTIMIZEMETADATAQUERIES, false);
    hiveConf.set(ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL.varname, "verbose");
    miniHS2 = new MiniHS2(hiveConf, MiniClusterType.TEZ);
    Map<String, String> confOverlay = new HashMap<String, String>();
    miniHS2.start(confOverlay);
    createTable();
}
Also used : HashMap(java.util.HashMap) HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 19 with MiniHS2

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

the class TestOperationLoggingLayout method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    tableName = "TestOperationLoggingLayout_table";
    hiveConf = new HiveConf();
    hiveConf.set(HiveConf.ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL.varname, "execution");
    miniHS2 = new MiniHS2(hiveConf);
    confOverlay = new HashMap<String, String>();
    confOverlay.put(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    miniHS2.start(confOverlay);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) BeforeClass(org.junit.BeforeClass)

Example 20 with MiniHS2

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

the class TestOperationLoggingAPIWithMr method setUpBeforeClass.

@BeforeClass
public static void setUpBeforeClass() throws Exception {
    tableName = "testOperationLoggingAPIWithMr_table";
    expectedLogsVerbose = new String[] { "Starting Semantic Analysis" };
    expectedLogsExecution = new String[] { "Compiling command", "Completed compiling command", "Total jobs", "Executing command", "Completed executing command", "Semantic Analysis Completed", "Number of reduce tasks determined at compile time", "number of splits", "Submitting tokens for job", "Ended Job" };
    expectedLogsPerformance = new String[] { "<PERFLOG method=compile from=org.apache.hadoop.hive.ql.Driver>", "<PERFLOG method=parse from=org.apache.hadoop.hive.ql.Driver>", "<PERFLOG method=Driver.run from=org.apache.hadoop.hive.ql.Driver>", "<PERFLOG method=runTasks from=org.apache.hadoop.hive.ql.Driver>" };
    hiveConf = new HiveConf();
    hiveConf.set(ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LEVEL.varname, "verbose");
    miniHS2 = new MiniHS2(hiveConf);
    confOverlay = new HashMap<String, String>();
    confOverlay.put(ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
    miniHS2.start(confOverlay);
}
Also used : HiveConf(org.apache.hadoop.hive.conf.HiveConf) MiniHS2(org.apache.hive.jdbc.miniHS2.MiniHS2) 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