Search in sources :

Example 16 with HiveServer2

use of org.apache.hive.service.server.HiveServer2 in project hive by apache.

the class ThriftCliServiceTestWithCookie method setUpBeforeClass.

/**
 * @throws java.lang.Exception
 */
@BeforeClass
public static void setUpBeforeClass() throws Exception {
    // Find a free port
    port = MetaStoreTestUtils.findFreePort();
    hiveServer2 = new HiveServer2();
    hiveConf = new HiveConf();
    hiveConf.setBoolVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_COOKIE_AUTH_ENABLED, true);
    // Set the cookie max age to a very low value so that
    // the server sends 401 very frequently
    hiveConf.setTimeVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_COOKIE_MAX_AGE, 1, TimeUnit.SECONDS);
    hiveConf.setVar(ConfVars.HIVE_SERVER2_TRANSPORT_MODE, "http");
    hiveConf.setVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_PATH, "cliservice");
    assertNotNull(port);
    assertNotNull(hiveServer2);
    assertNotNull(hiveConf);
    hiveConf.setBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS, false);
    hiveConf.setVar(ConfVars.HIVE_SERVER2_THRIFT_BIND_HOST, host);
    hiveConf.setIntVar(ConfVars.HIVE_SERVER2_THRIFT_HTTP_PORT, port);
    hiveConf.setVar(ConfVars.HIVE_SERVER2_AUTHENTICATION, HiveAuthConstants.AuthTypes.NOSASL.toString());
    startHiveServer2WithConf(hiveConf);
    client = getServiceClientInternal();
}
Also used : HiveServer2(org.apache.hive.service.server.HiveServer2) HiveConf(org.apache.hadoop.hive.conf.HiveConf) BeforeClass(org.junit.BeforeClass)

Aggregations

HiveServer2 (org.apache.hive.service.server.HiveServer2)15 HiveConf (org.apache.hadoop.hive.conf.HiveConf)9 BeforeClass (org.junit.BeforeClass)6 Test (org.junit.Test)6 IOException (java.io.IOException)2 Connection (java.sql.Connection)2 Statement (java.sql.Statement)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 TimeoutException (java.util.concurrent.TimeoutException)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 ServletContext (javax.servlet.ServletContext)1 ServerOptionsProcessor (org.apache.hive.service.server.HiveServer2.ServerOptionsProcessor)1 ObjectMapper (org.codehaus.jackson.map.ObjectMapper)1