@Override public synchronized void init(HiveConf hiveConf) { init(hiveConf, null); }
embeddedClient.init(null, connParams.getHiveConfs()); client = embeddedClient; connParams.getHiveConfs().clear();
@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); }
@Test // This is to test session temporary files are cleaned up after HIVE-11768 public 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()); }
@Override public synchronized void init(HiveConf hiveConf) { init(hiveConf, null); }
@Override public void init(HiveConf conf, String user) { try (SessionStateContext ignored = new SessionStateContext()) { getService().init(conf); } } //RESUME CHECKSTYLE CHECK InnerAssignmentCheck
@Override public void init(HiveConf conf, String user) { try (SessionStateContext ignored = new SessionStateContext()) { getService().init(conf); } } //RESUME CHECKSTYLE CHECK InnerAssignmentCheck
embeddedClient.init(new HiveConf()); client = embeddedClient; } else {
embeddedClient.init(new HiveConf()); client = embeddedClient; } else {
embeddedClient.init(null, connParams.getHiveConfs()); client = embeddedClient; connParams.getHiveConfs().clear();