use of org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService in project hive by apache.
the class TestSessionCleanup method testTempSessionFileCleanup.
@Test
public // This is to test session temporary files are cleaned up after HIVE-11768
void testTempSessionFileCleanup() throws Exception {
EmbeddedThriftBinaryCLIService service = new EmbeddedThriftBinaryCLIService();
HiveConf hiveConf = new HiveConf();
hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
service.init(hiveConf);
ThriftCLIServiceClient client = new ThriftCLIServiceClient(service);
Set<String> existingPipeoutFiles = new HashSet<String>(Arrays.asList(getPipeoutFiles()));
SessionHandle sessionHandle = client.openSession("user1", "foobar", Collections.<String, String>emptyMap());
client.executeStatement(sessionHandle, "set a=b", null);
File operationLogRootDir = new File(new HiveConf().getVar(ConfVars.HIVE_SERVER2_LOGGING_OPERATION_LOG_LOCATION));
Assert.assertNotEquals(operationLogRootDir.list().length, 0);
client.closeSession(sessionHandle);
// Check if session files are removed
Assert.assertEquals(operationLogRootDir.list().length, 0);
// Check if the pipeout files are removed
Set<String> finalPipeoutFiles = new HashSet<String>(Arrays.asList(getPipeoutFiles()));
finalPipeoutFiles.removeAll(existingPipeoutFiles);
Assert.assertTrue(finalPipeoutFiles.isEmpty());
}
use of org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService in project hive by apache.
the class TestEmbeddedThriftBinaryCLIService method setUpBeforeClass.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
service = new EmbeddedThriftBinaryCLIService();
HiveConf conf = new HiveConf();
conf.setBoolean("datanucleus.schema.autoCreateTables", true);
conf.setVar(HiveConf.ConfVars.HIVEMAPREDMODE, "nonstrict");
service.init(conf);
client = new ThriftCLIServiceClient(service);
}
use of org.apache.hive.service.cli.thrift.EmbeddedThriftBinaryCLIService in project hive by apache.
the class TestSessionHooks method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
SessionHookTest.runCount.set(0);
System.setProperty(ConfVars.HIVE_SERVER2_SESSION_HOOK.varname, TestSessionHooks.SessionHookTest.class.getName());
service = new EmbeddedThriftBinaryCLIService();
HiveConf hiveConf = new HiveConf();
hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory");
service.init(hiveConf);
client = new ThriftCLIServiceClient(service);
}
Aggregations