Return-Path: X-Original-To: apmail-hive-commits-archive@www.apache.org Delivered-To: apmail-hive-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D7B5018C33 for ; Thu, 4 Jun 2015 20:46:53 +0000 (UTC) Received: (qmail 55308 invoked by uid 500); 4 Jun 2015 20:46:53 -0000 Delivered-To: apmail-hive-commits-archive@hive.apache.org Received: (qmail 55261 invoked by uid 500); 4 Jun 2015 20:46:53 -0000 Mailing-List: contact commits-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: hive-dev@hive.apache.org Delivered-To: mailing list commits@hive.apache.org Received: (qmail 55102 invoked by uid 99); 4 Jun 2015 20:46:53 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Jun 2015 20:46:53 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D5B5CE10E0; Thu, 4 Jun 2015 20:46:52 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sershe@apache.org To: commits@hive.apache.org Date: Thu, 04 Jun 2015 20:47:07 -0000 Message-Id: <552fe3e5344f460e835b11201b59a855@git.apache.org> In-Reply-To: <44e9de7dbd144260b2db9f709be8bbe3@git.apache.org> References: <44e9de7dbd144260b2db9f709be8bbe3@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [17/18] hive git commit: HIVE-10909 : Make TestFilterHooks robust (Ashutosh Chauhan via Thejas Nair) 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/llap Commit: 244386a4d25f75bd15c64410ec1cb1d914daf3c0 Parents: 991bb45 Author: Ashutosh Chauhan Authored: Thu Jun 4 11:18:29 2015 -0700 Committer: Ashutosh Chauhan 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");