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(); + } } - }