From d405dbeca647b4046cf09be0b3ec14c5e3c3912b Mon Sep 17 00:00:00 2001 From: Michael Stack Date: Tue, 12 Oct 2010 15:01:48 +0000 Subject: [PATCH] Add shutdown of clusters -- not shutting down was causing subsequent TestMergeTool to fail because there was running zk git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1021789 13f79535-47bb-0310-9956-ffa450edef68 --- .../hadoop/hbase/TestMultiClusters.java | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/src/test/java/org/apache/hadoop/hbase/TestMultiClusters.java b/src/test/java/org/apache/hadoop/hbase/TestMultiClusters.java index b12a5f5c277..74d59435621 100644 --- a/src/test/java/org/apache/hadoop/hbase/TestMultiClusters.java +++ b/src/test/java/org/apache/hadoop/hbase/TestMultiClusters.java @@ -34,7 +34,6 @@ import static org.junit.Assert.assertEquals; * only for "unit'ish tests". */ public class TestMultiClusters { - private static final byte[] TABLE_NAME = Bytes.toBytes("test"); private static final byte[] FAM_NAME = Bytes.toBytes("fam"); private static final byte[] ROW = Bytes.toBytes("row"); @@ -61,23 +60,28 @@ public class TestMultiClusters { // They share the same ensemble, but homed differently utility2.setZkCluster(utility1.getZkCluster()); - utility1.startMiniCluster(); - utility2.startMiniCluster(); + try { + utility1.startMiniCluster(); + utility2.startMiniCluster(); - HTable table1 = utility1.createTable(TABLE_NAME, FAM_NAME); - HTable table2 = utility2.createTable(TABLE_NAME, FAM_NAME); + HTable table1 = utility1.createTable(TABLE_NAME, FAM_NAME); + HTable table2 = utility2.createTable(TABLE_NAME, FAM_NAME); - Put put = new Put(ROW); - put.add(FAM_NAME, QUAL_NAME, VALUE); - table1.put(put); + Put put = new Put(ROW); + put.add(FAM_NAME, QUAL_NAME, VALUE); + table1.put(put); - Get get = new Get(ROW); - get.addColumn(FAM_NAME, QUAL_NAME); - Result res = table1.get(get); - assertEquals(1, res.size()); + Get get = new Get(ROW); + get.addColumn(FAM_NAME, QUAL_NAME); + Result res = table1.get(get); + assertEquals(1, res.size()); - res = table2.get(get); - assertEquals(0, res.size()); + res = table2.get(get); + assertEquals(0, res.size()); + } finally { + utility1.shutdownMiniCluster(); + utility2.shutdownMiniCluster(); + utility1.shutdownMiniZKCluster(); + } } - }