public EmbeddedThriftBinaryCLIService() { // The non-test path that allows connections for the embedded service. super(new CLIService(null, true), null); isEmbedded = true; HiveConf.setLoadHiveServer2Config(true); }
public FakeEmbeddedThriftBinaryCLIService(HiveConf hiveConf) { super(new CLIService(null, true), null); isEmbedded = true; cliService.init(hiveConf); cliService.start(); }
private CLIService getService(HiveConf conf) { conf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory"); CLIService service = new CLIService(null, true); service.init(conf); service.start(); return service; } }
public CLIService getService() { HiveConf conf = new HiveConf(); conf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory"); CLIService service = new CLIService(null, true); service.init(conf); service.start(); return service; } }
/** * Test setting {@link HiveConf.ConfVars}} config parameter * HIVE_SERVER2_ENABLE_DOAS for unsecure mode */ public void testDoAsSetting(){ HiveConf hconf = new HiveConf(); hconf .setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, "org.apache.hadoop.hive.ql.security.authorization.plugin.sqlstd.SQLStdHiveAuthorizerFactory"); assertTrue("default value of hive server2 doAs should be true", hconf.getBoolVar(ConfVars.HIVE_SERVER2_ENABLE_DOAS)); CLIService cliService = new CLIService(null, true); cliService.init(hconf); ThriftCLIService tcliService = new ThriftBinaryCLIService(cliService, null); tcliService.init(hconf); TProcessorFactory procFactory = PlainSaslHelper.getPlainProcessorFactory(tcliService); assertEquals("doAs enabled processor for unsecure mode", procFactory.getProcessor(null).getClass(), TSetIpAddressProcessor.class); } }
cliService = new CLIService(this, false); addService(cliService); final HiveServer2 hiveServer2 = this;
@Test public void testSessionImpl() throws Exception { HiveConf hiveConf = new HiveConf(); hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER.getDefaultValue()); hiveConf.setVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_CLASSNAME, SampleHiveSessionImpl.class.getName()); hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS, false); CLIService cliService = new CLIService(null, true); cliService.init(hiveConf); ThriftBinaryCLIService service = new ThriftBinaryCLIService(cliService, null); service.init(hiveConf); ThriftCLIServiceClient client = new ThriftCLIServiceClient(service); SessionHandle sessionHandle = null; sessionHandle = client.openSession("tom", "password"); assertEquals(SampleHiveSessionImpl.class.getName(), service.getHiveConf().getVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_CLASSNAME)); HiveSession session = cliService.getSessionManager().getSession(sessionHandle); assertEquals(SampleHiveSessionImpl.MAGIC_RETURN_VALUE, session.getNoOperationTime()); client.closeSession(sessionHandle); }
@Test public void testSessionImplWithUGI() throws Exception { HiveConf hiveConf = new HiveConf(); hiveConf.setVar(HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER, HiveConf.ConfVars.HIVE_AUTHORIZATION_MANAGER.getDefaultValue()); hiveConf.setVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_WITH_UGI_CLASSNAME, SampleHiveSessionImplWithUGI.class.getName()); hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS, true); CLIService cliService = new CLIService(null, true); cliService.init(hiveConf); ThriftBinaryCLIService service = new ThriftBinaryCLIService(cliService, null); service.init(hiveConf); ThriftCLIServiceClient client = new ThriftCLIServiceClient(service); SessionHandle sessionHandle = null; sessionHandle = client.openSession("tom", "password"); assertEquals(SampleHiveSessionImplWithUGI.class.getName(), service.getHiveConf().getVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_WITH_UGI_CLASSNAME)); HiveSession session = cliService.getSessionManager().getSession(sessionHandle); assertEquals(SampleHiveSessionImplWithUGI.MAGIC_RETURN_VALUE, session.getNoOperationTime()); client.closeSession(sessionHandle); }
service = new CLIService(server, true);
protected CLIService createCLIService() { return new CLIService(null); }
protected CLIService createCLIService() { return new CLIService(null); }
public EmbeddedThriftBinaryCLIService() { super(new CLIService(null)); isEmbedded = true; HiveConf.setLoadHiveServer2Config(true); }
public EmbeddedThriftBinaryCLIService() { super(new CLIService(null), null); isEmbedded = true; HiveConf.setLoadHiveServer2Config(true); }
public EmbeddedThriftBinaryCLIService() { super(new CLIService(null)); isEmbedded = true; HiveConf.setLoadHiveServer2Config(true); }
@Override public synchronized void init(HiveConf hiveConf) { cliService = new CLIService(this); addService(cliService); if (isHTTPTransportMode(hiveConf)) { thriftCLIService = new ThriftHttpCLIService(cliService); } else { thriftCLIService = new ThriftBinaryCLIService(cliService); } addService(thriftCLIService); super.init(hiveConf); // Add a shutdown hook for catching SIGTERM & SIGINT final HiveServer2 hiveServer2 = this; Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { hiveServer2.stop(); } }); }
@Override public synchronized void init(HiveConf hiveConf) { cliService = new CLIService(this); addService(cliService); if (isHTTPTransportMode(hiveConf)) { thriftCLIService = new ThriftHttpCLIService(cliService); } else { thriftCLIService = new ThriftBinaryCLIService(cliService); } addService(thriftCLIService); super.init(hiveConf); // Add a shutdown hook for catching SIGTERM & SIGINT final HiveServer2 hiveServer2 = this; Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { hiveServer2.stop(); } }); }
@Override public synchronized void init(HiveConf hiveConf) { cliService = new CLIService(this); addService(cliService); if (isHTTPTransportMode(hiveConf)) { thriftCLIService = new ThriftHttpCLIService(cliService); } else { thriftCLIService = new ThriftBinaryCLIService(cliService); } addService(thriftCLIService); super.init(hiveConf); // Add a shutdown hook for catching SIGTERM & SIGINT // this must be higher than the Hadoop Filesystem priority of 10, // which the default priority is. // The signature of the callback must match that of a scala () -> Unit // function ShutdownHookManager.addShutdownHook( new AbstractFunction0<BoxedUnit>() { public BoxedUnit apply() { try { LOG.info("Hive Server Shutdown hook invoked"); stop(); } catch (Throwable e) { LOG.warn("Ignoring Exception while stopping Hive Server from shutdown hook", e); } return BoxedUnit.UNIT; } }); }
@Override public synchronized void init(HiveConf hiveConf) { cliService = new CLIService(this); addService(cliService); if (isHTTPTransportMode(hiveConf)) { thriftCLIService = new ThriftHttpCLIService(cliService); } else { thriftCLIService = new ThriftBinaryCLIService(cliService); } addService(thriftCLIService); super.init(hiveConf); // Add a shutdown hook for catching SIGTERM & SIGINT // this must be higher than the Hadoop Filesystem priority of 10, // which the default priority is. // The signature of the callback must match that of a scala () -> Unit // function ShutdownHookManager.addShutdownHook( new AbstractFunction0<BoxedUnit>() { public BoxedUnit apply() { try { LOG.info("Hive Server Shutdown hook invoked"); stop(); } catch (Throwable e) { LOG.warn("Ignoring Exception while stopping Hive Server from shutdown hook", e); } return BoxedUnit.UNIT; } }); }
@BeforeClass public void setup() throws Exception { /** * Test Setup - * Static test.jar containing ClassLoaderTestClass.class attached to DB1 * No static jar attached to 'default' DB * test2.jar containing ClassLoaderTestClass2.class added to session via addResource */ // Create test databases and tables LensServerTestUtil.createTestDatabaseResources(new String[]{DB1}, conf); conf.setVar(HiveConf.ConfVars.HIVE_SESSION_IMPL_CLASSNAME, LensSessionImpl.class.getName()); conf.set(LensConfConstants.DATABASE_RESOURCE_DIR, "target/resources"); CLIService cliService = new CLIService(null); cliService.init(conf); sessionService = new HiveSessionService(cliService); sessionService.init(conf); UserConfigLoaderFactory.init(conf); cliService.start(); sessionService.start(); }
conf.setLong(LensConfConstants.SESSION_TIMEOUT_SECONDS, 1L); conf.setInt(LensConfConstants.SESSION_EXPIRY_SERVICE_INTERVAL_IN_SECS, 1); CLIService cliService = new CLIService(null); cliService.init(conf); HiveSessionService lensService = new HiveSessionService(cliService);