HBaseUtils { public static String extractTimestamp4Region(String regionName) { if (!validRegionName(regionName)) return regionName; String[] infos = regionName.split(","); int len = infos.length; if (len < 3) return regionName; return infos[len - 1].substring(0, infos[len - 1].indexOf(".")); } private  HBaseUtils(); static HBaseUtils getInstance(); static void setUpEnv(); static boolean createTable(Admin admin, HTableDescriptor table, byte[][] splits); static String getNameSpace(RegionLoad region); static String getSingleTableName(RegionLoad region); static String getTableName(RegionLoad region); static String extractTableName(String regionName); static LinkedList<String> splitJmxRegion(String aim); static String removeEndKey(String regionName); static String extractTimestamp4Region(String regionName); static String extractHostName(String regionServerName); static String removeTimestamp(String regionServerName); static String extractTimestamp4RS(String regionServerName); static String generateSplitKeys(int startKey, int endKey, int stepSize, int fill); static byte[][] getHexSplits(String startKey, String endKey, int numRegions); Date getClusterStartTime(); String getClusterStartTimeStr();  }
@Test public void extraTimestampTest() { { String regionName = "hbase:acl,400309eb,1495941314418.4cc9912158f76cdabb253c7dbe9059c2."; assertEquals("1495941314418", extractTimestamp4Region(regionName)); regionName = "hbase:acl,,1495941314418.."; assertEquals("1495941314418", extractTimestamp4Region(regionName)); regionName = ":,,1495941314418.."; assertEquals("1495941314418", extractTimestamp4Region(regionName)); regionName = ":,,.."; assertEquals("", extractTimestamp4Region(regionName)); } { String regionName = "hbase:acl,40030,9eb,1495941314418.4cc9912158f76cdabb253c7dbe9059c2."; assertEquals("1495941314418", extractTimestamp4Region(regionName)); regionName = "hbase:acl,,1495941314418.."; assertEquals("1495941314418", extractTimestamp4Region(regionName)); regionName = ":,,1495941314418.."; assertEquals("1495941314418", extractTimestamp4Region(regionName)); regionName = ":,,.."; assertEquals("", extractTimestamp4Region(regionName)); } }