From 5d30c57478fa7f682c79314eb08328b32af3afc3 Mon Sep 17 00:00:00 2001 From: Ashish Singhi Date: Mon, 11 May 2015 20:22:43 +0530 Subject: [PATCH] HBASE-13659 Improve test run time for TestMetaWithReplicas class --- .../hadoop/hbase/client/TestMetaWithReplicas.java | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java index b145109..84b6916 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaWithReplicas.java @@ -18,7 +18,10 @@ */ package org.apache.hadoop.hbase.client; -import javax.annotation.Nullable; +import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.assertErrors; +import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.doFsck; +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; import java.io.IOException; import java.util.Arrays; @@ -26,6 +29,8 @@ import java.util.Collection; import java.util.List; import java.util.concurrent.ExecutorService; +import javax.annotation.Nullable; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.hadoop.conf.Configuration; @@ -51,26 +56,21 @@ import org.apache.hadoop.hbase.zookeeper.LoadBalancerTracker; import org.apache.hadoop.hbase.zookeeper.ZKUtil; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; import org.apache.zookeeper.KeeperException; -import org.junit.After; -import org.junit.Before; +import org.junit.AfterClass; +import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; -import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.assertErrors; -import static org.apache.hadoop.hbase.util.hbck.HbckTestingUtil.doFsck; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - /** * Tests the scenarios where replicas are enabled for the meta table */ @Category(MediumTests.class) public class TestMetaWithReplicas { private static final Log LOG = LogFactory.getLog(TestMetaWithReplicas.class); - private final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); + private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); - @Before - public void setup() throws Exception { + @BeforeClass + public static void setup() throws Exception { TEST_UTIL.getConfiguration().setInt("zookeeper.session.timeout", 30000); TEST_UTIL.getConfiguration().setInt(HConstants.META_REPLICAS_NUM, 3); TEST_UTIL.getConfiguration().setInt( @@ -98,8 +98,8 @@ public class TestMetaWithReplicas { LOG.debug("All meta replicas assigned"); } - @After - public void tearDown() throws Exception { + @AfterClass + public static void tearDown() throws Exception { TEST_UTIL.shutdownMiniCluster(); } -- 1.9.2.msysgit.0