hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject [43/50] [abbrv] hive git commit: HIVE-10909 : Make TestFilterHooks robust (Ashutosh Chauhan via Thejas Nair)
Date Fri, 05 Jun 2015 23:16:56 GMT
HIVE-10909 : Make TestFilterHooks robust (Ashutosh Chauhan via Thejas Nair)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/244386a4
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/244386a4
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/244386a4

Branch: refs/heads/hbase-metastore
Commit: 244386a4d25f75bd15c64410ec1cb1d914daf3c0
Parents: 991bb45
Author: Ashutosh Chauhan <hashutosh@apache.org>
Authored: Thu Jun 4 11:18:29 2015 -0700
Committer: Ashutosh Chauhan <hashutosh@apache.org>
Committed: Thu Jun 4 11:18:29 2015 -0700

----------------------------------------------------------------------
 .../hadoop/hive/metastore/TestFilterHooks.java  | 29 +++++++++++---------
 1 file changed, 16 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/244386a4/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java
----------------------------------------------------------------------
diff --git a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java
index 4ceee8c..b8cf94f 100644
--- a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java
+++ b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestFilterHooks.java
@@ -24,6 +24,7 @@ import static org.junit.Assert.fail;
 import java.util.ArrayList;
 import java.util.List;
 
+import org.apache.hadoop.hive.UtilsForTest;
 import org.apache.hadoop.hive.cli.CliSessionState;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
@@ -37,8 +38,8 @@ import org.apache.hadoop.hive.metastore.api.Table;
 import org.apache.hadoop.hive.ql.Driver;
 import org.apache.hadoop.hive.ql.session.SessionState;
 import org.apache.hadoop.hive.shims.ShimLoader;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
 import org.junit.Test;
 
 import com.google.common.collect.Lists;
@@ -157,23 +158,25 @@ public class TestFilterHooks {
   private static final String TAB1 = "tab1";
   private static final String TAB2 = "tab2";
   private static final String INDEX1 = "idx1";
-  private HiveConf hiveConf;
-  private HiveMetaStoreClient msc;
-  private Driver driver;
+  private static HiveConf hiveConf;
+  private static HiveMetaStoreClient msc;
+  private static Driver driver;
 
-  @Before
-  public void setUp() throws Exception {
+  @BeforeClass
+  public static void setUp() throws Exception {
     DummyMetaStoreFilterHookImpl.blockResults = false;
-    int port = MetaStoreUtils.findFreePort();
-    MetaStoreUtils.startMetaStore(port, ShimLoader.getHadoopThriftAuthBridge());
 
-    hiveConf = new HiveConf(this.getClass());
-    hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
+    hiveConf = new HiveConf(TestFilterHooks.class);
     hiveConf.setIntVar(HiveConf.ConfVars.METASTORETHRIFTCONNECTIONRETRIES, 3);
     hiveConf.set(HiveConf.ConfVars.PREEXECHOOKS.varname, "");
     hiveConf.set(HiveConf.ConfVars.POSTEXECHOOKS.varname, "");
     hiveConf.set(HiveConf.ConfVars.HIVE_SUPPORT_CONCURRENCY.varname, "false");
     hiveConf.setVar(ConfVars.METASTORE_FILTER_HOOK, DummyMetaStoreFilterHookImpl.class.getName());
+    UtilsForTest.setNewDerbyDbLocation(hiveConf, TestFilterHooks.class.getSimpleName());
+    int port = MetaStoreUtils.findFreePort();
+    hiveConf.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:" + port);
+    MetaStoreUtils.startMetaStore(port, ShimLoader.getHadoopThriftAuthBridge(), hiveConf);
+
     SessionState.start(new CliSessionState(hiveConf));
     msc = new HiveMetaStoreClient(hiveConf, null);
     driver = new Driver(hiveConf);
@@ -190,8 +193,8 @@ public class TestFilterHooks {
     driver.run("CREATE INDEX " + INDEX1 + " on table " + TAB1 + "(id) AS 'COMPACT' WITH DEFERRED
REBUILD");
   }
 
-  @After
-  public void tearDown() throws Exception {
+  @AfterClass
+  public static void tearDown() throws Exception {
     DummyMetaStoreFilterHookImpl.blockResults = false;
     driver.run("drop database if exists " + DBNAME1  + " cascade");
     driver.run("drop database if exists " + DBNAME2  + " cascade");


Mime
View raw message