diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java index e4e9405f798..2761b8f5b19 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestHCM.java @@ -75,6 +75,7 @@ import org.apache.hadoop.hbase.util.JVMClusterUtil; import org.apache.hadoop.hbase.util.ManualEnvironmentEdge; import org.apache.hadoop.hbase.util.Threads; import org.apache.hadoop.hbase.zookeeper.ZooKeeperWatcher; +import org.jboss.netty.util.internal.DetectionUtil; import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; @@ -106,6 +107,8 @@ public class TestHCM { private static final byte[] ROW_X = Bytes.toBytes("xxx"); private static Random _randy = new Random(); + private static boolean isJavaOk = DetectionUtil.javaVersion() > 6; + /** * This copro sleeps 20 second. The first call it fails. The second time, it works. */ @@ -127,7 +130,9 @@ public class TestHCM { @BeforeClass public static void setUpBeforeClass() throws Exception { - TEST_UTIL.getConfiguration().setBoolean(HConstants.STATUS_PUBLISHED, true); + if (isJavaOk) { + TEST_UTIL.getConfiguration().setBoolean(HConstants.STATUS_PUBLISHED, true); + } TEST_UTIL.startMiniCluster(2); } @@ -214,6 +219,11 @@ public class TestHCM { @Test(expected = RegionServerStoppedException.class) public void testClusterStatus() throws Exception { + if (!isJavaOk){ + // This test requires jdk 1.7+ + throw new RegionServerStoppedException("as expected by the test..."); + } + TableName tn = TableName.valueOf("testClusterStatus"); byte[] cf = "cf".getBytes(); @@ -460,6 +470,11 @@ public class TestHCM { */ @Test public void testConnectionCut() throws Exception { + if (!isJavaOk){ + // This test requires jdk 1.7+ + return; + } + String tableName = "HCM-testConnectionCut"; TEST_UTIL.createTable(tableName.getBytes(), FAM_NAM).close();