use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestReplicationScenarios method setUpBeforeClass.
// if verifySetup is set to true, all the test setup we do will perform additional
// verifications as well, which is useful to verify that our setup occurred
// correctly when developing and debugging tests. These verifications, however
// do not test any new functionality for replication, and thus, are not relevant
// for testing replication itself. For steady state, we want this to be false.
@BeforeClass
public static void setUpBeforeClass() throws Exception {
hconf = new HiveConf(TestReplicationScenarios.class);
String metastoreUri = System.getProperty("test." + HiveConf.ConfVars.METASTOREURIS.varname);
if (metastoreUri != null) {
hconf.setVar(HiveConf.ConfVars.METASTOREURIS, metastoreUri);
useExternalMS = true;
return;
}
hconf.setVar(HiveConf.ConfVars.METASTORE_TRANSACTIONAL_EVENT_LISTENERS, // turn on db notification listener on metastore
DBNOTIF_LISTENER_CLASSNAME);
hconf.setBoolVar(HiveConf.ConfVars.REPLCMENABLED, true);
hconf.setBoolVar(HiveConf.ConfVars.FIRE_EVENTS_FOR_DML, true);
hconf.setVar(HiveConf.ConfVars.REPLCMDIR, TEST_PATH + "/cmroot/");
msPort = MetaStoreUtils.startMetaStore(hconf);
hconf.setVar(HiveConf.ConfVars.REPLDIR, TEST_PATH + "/hrepl/");
hconf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + msPort);
hconf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
hconf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
hconf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
hconf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
System.setProperty(HiveConf.ConfVars.PREEXECHOOKS.varname, " ");
System.setProperty(HiveConf.ConfVars.POSTEXECHOOKS.varname, " ");
Path testPath = new Path(TEST_PATH);
FileSystem fs = FileSystem.get(testPath.toUri(), hconf);
fs.mkdirs(testPath);
driver = new Driver(hconf);
SessionState.start(new CliSessionState(hconf));
metaStoreClient = new HiveMetaStoreClient(hconf);
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestHiveHistory method testHiveHistoryConfigDisabled.
/**
* Check if HiveHistory class is a Proxy class when hive history is disabled
* @throws Exception
*/
public void testHiveHistoryConfigDisabled() throws Exception {
HiveConf conf = new HiveConf(SessionState.class);
conf.setBoolVar(ConfVars.HIVE_SESSION_HISTORY_ENABLED, false);
SessionState ss = new CliSessionState(conf);
SessionState.start(ss);
HiveHistory hHistory = ss.getHiveHistory();
assertTrue("checking hive history class when history is disabled", hHistory.getClass() != HiveHistoryImpl.class);
System.err.println("hHistory.getClass" + hHistory.getClass());
assertTrue("verifying proxy class is used when history is disabled", Proxy.isProxyClass(hHistory.getClass()));
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestHiveHistory method testHiveHistoryConfigEnabled.
/**
* Check if HiveHistoryImpl class is returned when hive history is enabled
* @throws Exception
*/
public void testHiveHistoryConfigEnabled() throws Exception {
HiveConf conf = new HiveConf(SessionState.class);
conf.setBoolVar(ConfVars.HIVE_SESSION_HISTORY_ENABLED, true);
SessionState ss = new CliSessionState(conf);
SessionState.start(ss);
HiveHistory hHistory = ss.getHiveHistory();
assertEquals("checking hive history class when history is enabled", hHistory.getClass(), HiveHistoryImpl.class);
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestSemanticAnalyzerHookLoading method testHookLoading.
public void testHookLoading() throws Exception {
HiveConf conf = new HiveConf(this.getClass());
conf.set(ConfVars.SEMANTIC_ANALYZER_HOOK.varname, DummySemanticAnalyzerHook.class.getName());
conf.set(ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
SessionState.start(conf);
Driver driver = new Driver(conf);
driver.run("drop table testDL");
CommandProcessorResponse resp = driver.run("create table testDL (a int) as select * from tbl2");
assertEquals(40000, resp.getResponseCode());
resp = driver.run("create table testDL (a int)");
assertEquals(0, resp.getResponseCode());
assertNull(resp.getErrorMessage());
Map<String, String> params = Hive.get(conf).getTable(MetaStoreUtils.DEFAULT_DATABASE_NAME, "testDL").getParameters();
assertEquals(DummyCreateTableHook.class.getName(), params.get("createdBy"));
assertEquals("Open Source rocks!!", params.get("Message"));
driver.run("drop table testDL");
}
use of org.apache.hadoop.hive.conf.HiveConf in project hive by apache.
the class TestAuthorizationPreEventListener method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
int port = MetaStoreUtils.findFreePort();
System.setProperty(HiveConf.ConfVars.METASTORE_PRE_EVENT_LISTENERS.varname, AuthorizationPreEventListener.class.getName());
System.setProperty(HiveConf.ConfVars.HIVE_METASTORE_AUTHORIZATION_MANAGER.varname, DummyHiveMetastoreAuthorizationProvider.class.getName());
System.setProperty(HiveConf.ConfVars.HIVE_METASTORE_AUTHENTICATOR_MANAGER.varname, HadoopDefaultMetastoreAuthenticator.class.getName());
MetaStoreUtils.startMetaStore(port, ShimLoader.getHadoopThriftAuthBridge());
clientHiveConf = new HiveConf(this.getClass());
clientHiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
clientHiveConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
clientHiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
clientHiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
clientHiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
SessionState.start(new CliSessionState(clientHiveConf));
msc = new HiveMetaStoreClient(clientHiveConf);
driver = new Driver(clientHiveConf);
}
Aggregations