hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [04/26] hbase-site git commit: Published site at .
Date Tue, 06 Feb 2018 15:13:54 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/ac54a6a8/testdevapidocs/src-html/org/apache/hadoop/hbase/TestFullLogReconstruction.html
----------------------------------------------------------------------
diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/TestFullLogReconstruction.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/TestFullLogReconstruction.html
index 1d55ae7..b669c23 100644
--- a/testdevapidocs/src-html/org/apache/hadoop/hbase/TestFullLogReconstruction.html
+++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/TestFullLogReconstruction.html
@@ -30,10 +30,10 @@
 <span class="sourceLineNo">022</span>import org.apache.hadoop.conf.Configuration;<a name="line.22"></a>
 <span class="sourceLineNo">023</span>import org.apache.hadoop.hbase.Waiter.ExplainingPredicate;<a name="line.23"></a>
 <span class="sourceLineNo">024</span>import org.apache.hadoop.hbase.client.Table;<a name="line.24"></a>
-<span class="sourceLineNo">025</span>import org.apache.hadoop.hbase.regionserver.HRegionServer;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.testclassification.LargeTests;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.testclassification.MiscTests;<a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.28"></a>
+<span class="sourceLineNo">025</span>import org.apache.hadoop.hbase.testclassification.LargeTests;<a name="line.25"></a>
+<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.testclassification.MiscTests;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.util.JVMClusterUtil.RegionServerThread;<a name="line.28"></a>
 <span class="sourceLineNo">029</span>import org.junit.AfterClass;<a name="line.29"></a>
 <span class="sourceLineNo">030</span>import org.junit.BeforeClass;<a name="line.30"></a>
 <span class="sourceLineNo">031</span>import org.junit.ClassRule;<a name="line.31"></a>
@@ -89,27 +89,28 @@
 <span class="sourceLineNo">081</span>    for (int i = 0; i &lt; 4; i++) {<a name="line.81"></a>
 <span class="sourceLineNo">082</span>      TEST_UTIL.loadTable(table, FAMILY);<a name="line.82"></a>
 <span class="sourceLineNo">083</span>    }<a name="line.83"></a>
-<span class="sourceLineNo">084</span>    HRegionServer rs = TEST_UTIL.expireRegionServerSession(0);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>    // make sure that the RS is fully down before reading, so that we will read the data from other<a name="line.85"></a>
-<span class="sourceLineNo">086</span>    // RSes.<a name="line.86"></a>
-<span class="sourceLineNo">087</span>    TEST_UTIL.waitFor(30000, new ExplainingPredicate&lt;Exception&gt;() {<a name="line.87"></a>
-<span class="sourceLineNo">088</span><a name="line.88"></a>
-<span class="sourceLineNo">089</span>      @Override<a name="line.89"></a>
-<span class="sourceLineNo">090</span>      public boolean evaluate() throws Exception {<a name="line.90"></a>
-<span class="sourceLineNo">091</span>        return !rs.isAlive();<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      }<a name="line.92"></a>
-<span class="sourceLineNo">093</span><a name="line.93"></a>
-<span class="sourceLineNo">094</span>      @Override<a name="line.94"></a>
-<span class="sourceLineNo">095</span>      public String explainFailure() throws Exception {<a name="line.95"></a>
-<span class="sourceLineNo">096</span>        return rs + " is still alive";<a name="line.96"></a>
-<span class="sourceLineNo">097</span>      }<a name="line.97"></a>
-<span class="sourceLineNo">098</span>    });<a name="line.98"></a>
-<span class="sourceLineNo">099</span><a name="line.99"></a>
-<span class="sourceLineNo">100</span>    int newCount = TEST_UTIL.countRows(table);<a name="line.100"></a>
-<span class="sourceLineNo">101</span>    assertEquals(count, newCount);<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    table.close();<a name="line.102"></a>
-<span class="sourceLineNo">103</span>  }<a name="line.103"></a>
-<span class="sourceLineNo">104</span>}<a name="line.104"></a>
+<span class="sourceLineNo">084</span>    RegionServerThread rsThread = TEST_UTIL.getHBaseCluster().getRegionServerThreads().get(0);<a name="line.84"></a>
+<span class="sourceLineNo">085</span>    TEST_UTIL.expireRegionServerSession(0);<a name="line.85"></a>
+<span class="sourceLineNo">086</span>    // make sure that the RS is fully down before reading, so that we will read the data from other<a name="line.86"></a>
+<span class="sourceLineNo">087</span>    // RSes.<a name="line.87"></a>
+<span class="sourceLineNo">088</span>    TEST_UTIL.waitFor(30000, new ExplainingPredicate&lt;Exception&gt;() {<a name="line.88"></a>
+<span class="sourceLineNo">089</span><a name="line.89"></a>
+<span class="sourceLineNo">090</span>      @Override<a name="line.90"></a>
+<span class="sourceLineNo">091</span>      public boolean evaluate() throws Exception {<a name="line.91"></a>
+<span class="sourceLineNo">092</span>        return !rsThread.isAlive();<a name="line.92"></a>
+<span class="sourceLineNo">093</span>      }<a name="line.93"></a>
+<span class="sourceLineNo">094</span><a name="line.94"></a>
+<span class="sourceLineNo">095</span>      @Override<a name="line.95"></a>
+<span class="sourceLineNo">096</span>      public String explainFailure() throws Exception {<a name="line.96"></a>
+<span class="sourceLineNo">097</span>        return rsThread.getRegionServer() + " is still alive";<a name="line.97"></a>
+<span class="sourceLineNo">098</span>      }<a name="line.98"></a>
+<span class="sourceLineNo">099</span>    });<a name="line.99"></a>
+<span class="sourceLineNo">100</span><a name="line.100"></a>
+<span class="sourceLineNo">101</span>    int newCount = TEST_UTIL.countRows(table);<a name="line.101"></a>
+<span class="sourceLineNo">102</span>    assertEquals(count, newCount);<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    table.close();<a name="line.103"></a>
+<span class="sourceLineNo">104</span>  }<a name="line.104"></a>
+<span class="sourceLineNo">105</span>}<a name="line.105"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/ac54a6a8/testdevapidocs/src-html/org/apache/hadoop/hbase/TestRegionLoad.html
----------------------------------------------------------------------
diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/TestRegionLoad.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/TestRegionLoad.html
index ae35f56..1542672 100644
--- a/testdevapidocs/src-html/org/apache/hadoop/hbase/TestRegionLoad.html
+++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/TestRegionLoad.html
@@ -6,7 +6,7 @@
 </head>
 <body>
 <div class="sourceContainer">
-<pre><span class="sourceLineNo">001</span>/**<a name="line.1"></a>
+<pre><span class="sourceLineNo">001</span>/*<a name="line.1"></a>
 <span class="sourceLineNo">002</span> * Licensed to the Apache Software Foundation (ASF) under one<a name="line.2"></a>
 <span class="sourceLineNo">003</span> * or more contributor license agreements.  See the NOTICE file<a name="line.3"></a>
 <span class="sourceLineNo">004</span> * distributed with this work for additional information<a name="line.4"></a>
@@ -72,114 +72,118 @@
 <span class="sourceLineNo">064</span><a name="line.64"></a>
 <span class="sourceLineNo">065</span>  @BeforeClass<a name="line.65"></a>
 <span class="sourceLineNo">066</span>  public static void beforeClass() throws Exception {<a name="line.66"></a>
-<span class="sourceLineNo">067</span>    UTIL.startMiniCluster(4);<a name="line.67"></a>
-<span class="sourceLineNo">068</span>    admin = UTIL.getAdmin();<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    admin.setBalancerRunning(false, true);<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    createTables();<a name="line.70"></a>
-<span class="sourceLineNo">071</span>  }<a name="line.71"></a>
-<span class="sourceLineNo">072</span><a name="line.72"></a>
-<span class="sourceLineNo">073</span>  @AfterClass<a name="line.73"></a>
-<span class="sourceLineNo">074</span>  public static void afterClass() throws Exception {<a name="line.74"></a>
-<span class="sourceLineNo">075</span>    UTIL.shutdownMiniCluster();<a name="line.75"></a>
-<span class="sourceLineNo">076</span>  }<a name="line.76"></a>
-<span class="sourceLineNo">077</span><a name="line.77"></a>
-<span class="sourceLineNo">078</span>  private static void createTables() throws IOException, InterruptedException {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>    byte[][] FAMILIES = new byte [][] {Bytes.toBytes("f")};<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    for (TableName tableName : tables) {<a name="line.80"></a>
-<span class="sourceLineNo">081</span>      Table table =<a name="line.81"></a>
-<span class="sourceLineNo">082</span>          UTIL.createTable(tableName, FAMILIES, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);<a name="line.82"></a>
-<span class="sourceLineNo">083</span>      UTIL.waitTableAvailable(tableName);<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      UTIL.loadTable(table, FAMILIES[0]);<a name="line.84"></a>
-<span class="sourceLineNo">085</span>    }<a name="line.85"></a>
-<span class="sourceLineNo">086</span>  }<a name="line.86"></a>
-<span class="sourceLineNo">087</span><a name="line.87"></a>
-<span class="sourceLineNo">088</span>  @Test<a name="line.88"></a>
-<span class="sourceLineNo">089</span>  public void testRegionLoad() throws Exception {<a name="line.89"></a>
+<span class="sourceLineNo">067</span>    // Make servers report eagerly. This test is about looking at the cluster status reported.<a name="line.67"></a>
+<span class="sourceLineNo">068</span>    // Make it so we don't have to wait around too long to see change.<a name="line.68"></a>
+<span class="sourceLineNo">069</span>    UTIL.getConfiguration().setInt("hbase.regionserver.msginterval", 500);<a name="line.69"></a>
+<span class="sourceLineNo">070</span>    UTIL.startMiniCluster(4);<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    admin = UTIL.getAdmin();<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    admin.setBalancerRunning(false, true);<a name="line.72"></a>
+<span class="sourceLineNo">073</span>    createTables();<a name="line.73"></a>
+<span class="sourceLineNo">074</span>  }<a name="line.74"></a>
+<span class="sourceLineNo">075</span><a name="line.75"></a>
+<span class="sourceLineNo">076</span>  @AfterClass<a name="line.76"></a>
+<span class="sourceLineNo">077</span>  public static void afterClass() throws Exception {<a name="line.77"></a>
+<span class="sourceLineNo">078</span>    UTIL.shutdownMiniCluster();<a name="line.78"></a>
+<span class="sourceLineNo">079</span>  }<a name="line.79"></a>
+<span class="sourceLineNo">080</span><a name="line.80"></a>
+<span class="sourceLineNo">081</span>  private static void createTables() throws IOException, InterruptedException {<a name="line.81"></a>
+<span class="sourceLineNo">082</span>    byte[][] FAMILIES = new byte [][] {Bytes.toBytes("f")};<a name="line.82"></a>
+<span class="sourceLineNo">083</span>    for (TableName tableName : tables) {<a name="line.83"></a>
+<span class="sourceLineNo">084</span>      Table table =<a name="line.84"></a>
+<span class="sourceLineNo">085</span>          UTIL.createTable(tableName, FAMILIES, HBaseTestingUtility.KEYS_FOR_HBA_CREATE_TABLE);<a name="line.85"></a>
+<span class="sourceLineNo">086</span>      UTIL.waitTableAvailable(tableName);<a name="line.86"></a>
+<span class="sourceLineNo">087</span>      UTIL.loadTable(table, FAMILIES[0]);<a name="line.87"></a>
+<span class="sourceLineNo">088</span>    }<a name="line.88"></a>
+<span class="sourceLineNo">089</span>  }<a name="line.89"></a>
 <span class="sourceLineNo">090</span><a name="line.90"></a>
-<span class="sourceLineNo">091</span>    // Check if regions match with the regionLoad from the server<a name="line.91"></a>
-<span class="sourceLineNo">092</span>    for (ServerName serverName : admin<a name="line.92"></a>
-<span class="sourceLineNo">093</span>        .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {<a name="line.93"></a>
-<span class="sourceLineNo">094</span>      List&lt;HRegionInfo&gt; regions = admin.getOnlineRegions(serverName);<a name="line.94"></a>
-<span class="sourceLineNo">095</span>      LOG.info("serverName=" + serverName + ", regions=" +<a name="line.95"></a>
-<span class="sourceLineNo">096</span>          regions.stream().map(r -&gt; r.getRegionNameAsString()).collect(Collectors.toList()));<a name="line.96"></a>
-<span class="sourceLineNo">097</span>      Collection&lt;RegionLoad&gt; regionLoads = admin.getRegionMetrics(serverName)<a name="line.97"></a>
-<span class="sourceLineNo">098</span>        .stream().map(r -&gt; new RegionLoad(r)).collect(Collectors.toList());<a name="line.98"></a>
-<span class="sourceLineNo">099</span>      LOG.info("serverName=" + serverName + ", regionLoads=" +<a name="line.99"></a>
-<span class="sourceLineNo">100</span>          regionLoads.stream().map(r -&gt; Bytes.toString(r.getRegionName())).<a name="line.100"></a>
-<span class="sourceLineNo">101</span>              collect(Collectors.toList()));<a name="line.101"></a>
-<span class="sourceLineNo">102</span>      checkRegionsAndRegionLoads(regions, regionLoads);<a name="line.102"></a>
-<span class="sourceLineNo">103</span>    }<a name="line.103"></a>
-<span class="sourceLineNo">104</span><a name="line.104"></a>
-<span class="sourceLineNo">105</span>    // Check if regionLoad matches the table's regions and nothing is missed<a name="line.105"></a>
-<span class="sourceLineNo">106</span>    for (TableName table : new TableName[]{TABLE_1, TABLE_2, TABLE_3}) {<a name="line.106"></a>
-<span class="sourceLineNo">107</span>      List&lt;HRegionInfo&gt; tableRegions = admin.getTableRegions(table);<a name="line.107"></a>
-<span class="sourceLineNo">108</span><a name="line.108"></a>
-<span class="sourceLineNo">109</span>      List&lt;RegionLoad&gt; regionLoads = Lists.newArrayList();<a name="line.109"></a>
-<span class="sourceLineNo">110</span>      for (ServerName serverName : admin<a name="line.110"></a>
-<span class="sourceLineNo">111</span>          .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {<a name="line.111"></a>
-<span class="sourceLineNo">112</span>        regionLoads.addAll(admin.getRegionMetrics(serverName, table)<a name="line.112"></a>
-<span class="sourceLineNo">113</span>          .stream().map(r -&gt; new RegionLoad(r)).collect(Collectors.toList()));<a name="line.113"></a>
-<span class="sourceLineNo">114</span>      }<a name="line.114"></a>
-<span class="sourceLineNo">115</span>      checkRegionsAndRegionLoads(tableRegions, regionLoads);<a name="line.115"></a>
-<span class="sourceLineNo">116</span>    }<a name="line.116"></a>
-<span class="sourceLineNo">117</span><a name="line.117"></a>
-<span class="sourceLineNo">118</span>    // Just wait here. If this fixes the test, come back and do a better job.<a name="line.118"></a>
-<span class="sourceLineNo">119</span>    // Thought is that cluster status is stale.<a name="line.119"></a>
-<span class="sourceLineNo">120</span>    Threads.sleep(10000);<a name="line.120"></a>
+<span class="sourceLineNo">091</span>  @Test<a name="line.91"></a>
+<span class="sourceLineNo">092</span>  public void testRegionLoad() throws Exception {<a name="line.92"></a>
+<span class="sourceLineNo">093</span><a name="line.93"></a>
+<span class="sourceLineNo">094</span>    // Check if regions match with the regionLoad from the server<a name="line.94"></a>
+<span class="sourceLineNo">095</span>    for (ServerName serverName : admin<a name="line.95"></a>
+<span class="sourceLineNo">096</span>        .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      List&lt;HRegionInfo&gt; regions = admin.getOnlineRegions(serverName);<a name="line.97"></a>
+<span class="sourceLineNo">098</span>      LOG.info("serverName=" + serverName + ", regions=" +<a name="line.98"></a>
+<span class="sourceLineNo">099</span>          regions.stream().map(r -&gt; r.getRegionNameAsString()).collect(Collectors.toList()));<a name="line.99"></a>
+<span class="sourceLineNo">100</span>      Collection&lt;RegionLoad&gt; regionLoads = admin.getRegionMetrics(serverName)<a name="line.100"></a>
+<span class="sourceLineNo">101</span>        .stream().map(r -&gt; new RegionLoad(r)).collect(Collectors.toList());<a name="line.101"></a>
+<span class="sourceLineNo">102</span>      LOG.info("serverName=" + serverName + ", regionLoads=" +<a name="line.102"></a>
+<span class="sourceLineNo">103</span>          regionLoads.stream().map(r -&gt; Bytes.toString(r.getRegionName())).<a name="line.103"></a>
+<span class="sourceLineNo">104</span>              collect(Collectors.toList()));<a name="line.104"></a>
+<span class="sourceLineNo">105</span>      checkRegionsAndRegionLoads(regions, regionLoads);<a name="line.105"></a>
+<span class="sourceLineNo">106</span>    }<a name="line.106"></a>
+<span class="sourceLineNo">107</span><a name="line.107"></a>
+<span class="sourceLineNo">108</span>    // Check if regionLoad matches the table's regions and nothing is missed<a name="line.108"></a>
+<span class="sourceLineNo">109</span>    for (TableName table : new TableName[]{TABLE_1, TABLE_2, TABLE_3}) {<a name="line.109"></a>
+<span class="sourceLineNo">110</span>      List&lt;HRegionInfo&gt; tableRegions = admin.getTableRegions(table);<a name="line.110"></a>
+<span class="sourceLineNo">111</span><a name="line.111"></a>
+<span class="sourceLineNo">112</span>      List&lt;RegionLoad&gt; regionLoads = Lists.newArrayList();<a name="line.112"></a>
+<span class="sourceLineNo">113</span>      for (ServerName serverName : admin<a name="line.113"></a>
+<span class="sourceLineNo">114</span>          .getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)).getLiveServerMetrics().keySet()) {<a name="line.114"></a>
+<span class="sourceLineNo">115</span>        regionLoads.addAll(admin.getRegionMetrics(serverName, table)<a name="line.115"></a>
+<span class="sourceLineNo">116</span>          .stream().map(r -&gt; new RegionLoad(r)).collect(Collectors.toList()));<a name="line.116"></a>
+<span class="sourceLineNo">117</span>      }<a name="line.117"></a>
+<span class="sourceLineNo">118</span>      checkRegionsAndRegionLoads(tableRegions, regionLoads);<a name="line.118"></a>
+<span class="sourceLineNo">119</span>    }<a name="line.119"></a>
+<span class="sourceLineNo">120</span>    int pause = UTIL.getConfiguration().getInt("hbase.regionserver.msginterval", 3000);<a name="line.120"></a>
 <span class="sourceLineNo">121</span><a name="line.121"></a>
-<span class="sourceLineNo">122</span>    // Check RegionLoad matches the regionLoad from ClusterStatus<a name="line.122"></a>
-<span class="sourceLineNo">123</span>    ClusterStatus clusterStatus<a name="line.123"></a>
-<span class="sourceLineNo">124</span>      = new ClusterStatus(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)));<a name="line.124"></a>
-<span class="sourceLineNo">125</span>    for (ServerName serverName : clusterStatus.getServers()) {<a name="line.125"></a>
-<span class="sourceLineNo">126</span>      ServerLoad serverLoad = clusterStatus.getLoad(serverName);<a name="line.126"></a>
-<span class="sourceLineNo">127</span>      Map&lt;byte[], RegionLoad&gt; regionLoads = admin.getRegionMetrics(serverName).stream()<a name="line.127"></a>
-<span class="sourceLineNo">128</span>        .collect(Collectors.toMap(e -&gt; e.getRegionName(), e -&gt; new RegionLoad(e),<a name="line.128"></a>
-<span class="sourceLineNo">129</span>          (v1, v2) -&gt; {<a name="line.129"></a>
-<span class="sourceLineNo">130</span>            throw new RuntimeException("impossible!!");<a name="line.130"></a>
-<span class="sourceLineNo">131</span>          }, () -&gt; new TreeMap&lt;&gt;(Bytes.BYTES_COMPARATOR)));<a name="line.131"></a>
-<span class="sourceLineNo">132</span>      LOG.info("serverName=" + serverName + ", getRegionLoads=" +<a name="line.132"></a>
-<span class="sourceLineNo">133</span>          serverLoad.getRegionsLoad().keySet().stream().map(r -&gt; Bytes.toString(r)).<a name="line.133"></a>
-<span class="sourceLineNo">134</span>              collect(Collectors.toList()));<a name="line.134"></a>
-<span class="sourceLineNo">135</span>      LOG.info("serverName=" + serverName + ", regionLoads=" +<a name="line.135"></a>
-<span class="sourceLineNo">136</span>          regionLoads.keySet().stream().map(r -&gt; Bytes.toString(r)).<a name="line.136"></a>
-<span class="sourceLineNo">137</span>              collect(Collectors.toList()));<a name="line.137"></a>
-<span class="sourceLineNo">138</span>      compareRegionLoads(serverLoad.getRegionsLoad(), regionLoads);<a name="line.138"></a>
-<span class="sourceLineNo">139</span>    }<a name="line.139"></a>
-<span class="sourceLineNo">140</span>  }<a name="line.140"></a>
-<span class="sourceLineNo">141</span><a name="line.141"></a>
-<span class="sourceLineNo">142</span>  private void compareRegionLoads(Map&lt;byte[], RegionLoad&gt; regionLoadCluster,<a name="line.142"></a>
-<span class="sourceLineNo">143</span>      Map&lt;byte[], RegionLoad&gt; regionLoads) {<a name="line.143"></a>
-<span class="sourceLineNo">144</span><a name="line.144"></a>
-<span class="sourceLineNo">145</span>    assertEquals("No of regionLoads from clusterStatus and regionloads from RS doesn't match",<a name="line.145"></a>
-<span class="sourceLineNo">146</span>        regionLoadCluster.size(), regionLoads.size());<a name="line.146"></a>
-<span class="sourceLineNo">147</span><a name="line.147"></a>
-<span class="sourceLineNo">148</span>    // The contents of region load from cluster and server should match<a name="line.148"></a>
-<span class="sourceLineNo">149</span>    for (byte[] regionName : regionLoadCluster.keySet()) {<a name="line.149"></a>
-<span class="sourceLineNo">150</span>      regionLoads.remove(regionName);<a name="line.150"></a>
-<span class="sourceLineNo">151</span>    }<a name="line.151"></a>
-<span class="sourceLineNo">152</span>    assertEquals("regionLoads from SN should be empty", 0, regionLoads.size());<a name="line.152"></a>
-<span class="sourceLineNo">153</span>  }<a name="line.153"></a>
-<span class="sourceLineNo">154</span><a name="line.154"></a>
-<span class="sourceLineNo">155</span>  private void checkRegionsAndRegionLoads(Collection&lt;HRegionInfo&gt; regions,<a name="line.155"></a>
-<span class="sourceLineNo">156</span>      Collection&lt;RegionLoad&gt; regionLoads) {<a name="line.156"></a>
-<span class="sourceLineNo">157</span><a name="line.157"></a>
-<span class="sourceLineNo">158</span>    for (RegionLoad load : regionLoads) {<a name="line.158"></a>
-<span class="sourceLineNo">159</span>      assertNotNull(load.regionLoadPB);<a name="line.159"></a>
-<span class="sourceLineNo">160</span>    }<a name="line.160"></a>
+<span class="sourceLineNo">122</span>    // Just wait here. If this fixes the test, come back and do a better job.<a name="line.122"></a>
+<span class="sourceLineNo">123</span>    // Would have to redo the below so can wait on cluster status changing.<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    Threads.sleep(2 * pause);<a name="line.124"></a>
+<span class="sourceLineNo">125</span><a name="line.125"></a>
+<span class="sourceLineNo">126</span>    // Check RegionLoad matches the regionLoad from ClusterStatus<a name="line.126"></a>
+<span class="sourceLineNo">127</span>    ClusterStatus clusterStatus<a name="line.127"></a>
+<span class="sourceLineNo">128</span>      = new ClusterStatus(admin.getClusterMetrics(EnumSet.of(Option.LIVE_SERVERS)));<a name="line.128"></a>
+<span class="sourceLineNo">129</span>    for (ServerName serverName : clusterStatus.getServers()) {<a name="line.129"></a>
+<span class="sourceLineNo">130</span>      ServerLoad serverLoad = clusterStatus.getLoad(serverName);<a name="line.130"></a>
+<span class="sourceLineNo">131</span>      Map&lt;byte[], RegionLoad&gt; regionLoads = admin.getRegionMetrics(serverName).stream()<a name="line.131"></a>
+<span class="sourceLineNo">132</span>        .collect(Collectors.toMap(e -&gt; e.getRegionName(), e -&gt; new RegionLoad(e),<a name="line.132"></a>
+<span class="sourceLineNo">133</span>          (v1, v2) -&gt; {<a name="line.133"></a>
+<span class="sourceLineNo">134</span>            throw new RuntimeException("impossible!!");<a name="line.134"></a>
+<span class="sourceLineNo">135</span>          }, () -&gt; new TreeMap&lt;&gt;(Bytes.BYTES_COMPARATOR)));<a name="line.135"></a>
+<span class="sourceLineNo">136</span>      LOG.info("serverName=" + serverName + ", getRegionLoads=" +<a name="line.136"></a>
+<span class="sourceLineNo">137</span>          serverLoad.getRegionsLoad().keySet().stream().map(r -&gt; Bytes.toString(r)).<a name="line.137"></a>
+<span class="sourceLineNo">138</span>              collect(Collectors.toList()));<a name="line.138"></a>
+<span class="sourceLineNo">139</span>      LOG.info("serverName=" + serverName + ", regionLoads=" +<a name="line.139"></a>
+<span class="sourceLineNo">140</span>          regionLoads.keySet().stream().map(r -&gt; Bytes.toString(r)).<a name="line.140"></a>
+<span class="sourceLineNo">141</span>              collect(Collectors.toList()));<a name="line.141"></a>
+<span class="sourceLineNo">142</span>      compareRegionLoads(serverLoad.getRegionsLoad(), regionLoads);<a name="line.142"></a>
+<span class="sourceLineNo">143</span>    }<a name="line.143"></a>
+<span class="sourceLineNo">144</span>  }<a name="line.144"></a>
+<span class="sourceLineNo">145</span><a name="line.145"></a>
+<span class="sourceLineNo">146</span>  private void compareRegionLoads(Map&lt;byte[], RegionLoad&gt; regionLoadCluster,<a name="line.146"></a>
+<span class="sourceLineNo">147</span>      Map&lt;byte[], RegionLoad&gt; regionLoads) {<a name="line.147"></a>
+<span class="sourceLineNo">148</span><a name="line.148"></a>
+<span class="sourceLineNo">149</span>    assertEquals("No of regionLoads from clusterStatus and regionloads from RS doesn't match",<a name="line.149"></a>
+<span class="sourceLineNo">150</span>        regionLoadCluster.size(), regionLoads.size());<a name="line.150"></a>
+<span class="sourceLineNo">151</span><a name="line.151"></a>
+<span class="sourceLineNo">152</span>    // The contents of region load from cluster and server should match<a name="line.152"></a>
+<span class="sourceLineNo">153</span>    for (byte[] regionName : regionLoadCluster.keySet()) {<a name="line.153"></a>
+<span class="sourceLineNo">154</span>      regionLoads.remove(regionName);<a name="line.154"></a>
+<span class="sourceLineNo">155</span>    }<a name="line.155"></a>
+<span class="sourceLineNo">156</span>    assertEquals("regionLoads from SN should be empty", 0, regionLoads.size());<a name="line.156"></a>
+<span class="sourceLineNo">157</span>  }<a name="line.157"></a>
+<span class="sourceLineNo">158</span><a name="line.158"></a>
+<span class="sourceLineNo">159</span>  private void checkRegionsAndRegionLoads(Collection&lt;HRegionInfo&gt; regions,<a name="line.159"></a>
+<span class="sourceLineNo">160</span>      Collection&lt;RegionLoad&gt; regionLoads) {<a name="line.160"></a>
 <span class="sourceLineNo">161</span><a name="line.161"></a>
-<span class="sourceLineNo">162</span>    assertEquals("No of regions and regionloads doesn't match",<a name="line.162"></a>
-<span class="sourceLineNo">163</span>        regions.size(), regionLoads.size());<a name="line.163"></a>
-<span class="sourceLineNo">164</span><a name="line.164"></a>
-<span class="sourceLineNo">165</span>    Map&lt;byte[], RegionLoad&gt; regionLoadMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);<a name="line.165"></a>
-<span class="sourceLineNo">166</span>    for (RegionLoad regionLoad : regionLoads) {<a name="line.166"></a>
-<span class="sourceLineNo">167</span>      regionLoadMap.put(regionLoad.getName(), regionLoad);<a name="line.167"></a>
-<span class="sourceLineNo">168</span>    }<a name="line.168"></a>
-<span class="sourceLineNo">169</span>    for (HRegionInfo info : regions) {<a name="line.169"></a>
-<span class="sourceLineNo">170</span>      assertTrue("Region not in regionLoadMap region:" + info.getRegionNameAsString() +<a name="line.170"></a>
-<span class="sourceLineNo">171</span>          " regionMap: " + regionLoadMap, regionLoadMap.containsKey(info.getRegionName()));<a name="line.171"></a>
+<span class="sourceLineNo">162</span>    for (RegionLoad load : regionLoads) {<a name="line.162"></a>
+<span class="sourceLineNo">163</span>      assertNotNull(load.regionLoadPB);<a name="line.163"></a>
+<span class="sourceLineNo">164</span>    }<a name="line.164"></a>
+<span class="sourceLineNo">165</span><a name="line.165"></a>
+<span class="sourceLineNo">166</span>    assertEquals("No of regions and regionloads doesn't match",<a name="line.166"></a>
+<span class="sourceLineNo">167</span>        regions.size(), regionLoads.size());<a name="line.167"></a>
+<span class="sourceLineNo">168</span><a name="line.168"></a>
+<span class="sourceLineNo">169</span>    Map&lt;byte[], RegionLoad&gt; regionLoadMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);<a name="line.169"></a>
+<span class="sourceLineNo">170</span>    for (RegionLoad regionLoad : regionLoads) {<a name="line.170"></a>
+<span class="sourceLineNo">171</span>      regionLoadMap.put(regionLoad.getName(), regionLoad);<a name="line.171"></a>
 <span class="sourceLineNo">172</span>    }<a name="line.172"></a>
-<span class="sourceLineNo">173</span>  }<a name="line.173"></a>
-<span class="sourceLineNo">174</span>}<a name="line.174"></a>
+<span class="sourceLineNo">173</span>    for (HRegionInfo info : regions) {<a name="line.173"></a>
+<span class="sourceLineNo">174</span>      assertTrue("Region not in regionLoadMap region:" + info.getRegionNameAsString() +<a name="line.174"></a>
+<span class="sourceLineNo">175</span>          " regionMap: " + regionLoadMap, regionLoadMap.containsKey(info.getRegionName()));<a name="line.175"></a>
+<span class="sourceLineNo">176</span>    }<a name="line.176"></a>
+<span class="sourceLineNo">177</span>  }<a name="line.177"></a>
+<span class="sourceLineNo">178</span>}<a name="line.178"></a>
 
 
 

http://git-wip-us.apache.org/repos/asf/hbase-site/blob/ac54a6a8/testdevapidocs/src-html/org/apache/hadoop/hbase/TestServerName.html
----------------------------------------------------------------------
diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/TestServerName.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/TestServerName.html
index deec5e2..a258375 100644
--- a/testdevapidocs/src-html/org/apache/hadoop/hbase/TestServerName.html
+++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/TestServerName.html
@@ -30,100 +30,113 @@
 <span class="sourceLineNo">022</span>import static org.junit.Assert.assertNotSame;<a name="line.22"></a>
 <span class="sourceLineNo">023</span>import static org.junit.Assert.assertTrue;<a name="line.23"></a>
 <span class="sourceLineNo">024</span><a name="line.24"></a>
-<span class="sourceLineNo">025</span>import java.util.regex.Pattern;<a name="line.25"></a>
-<span class="sourceLineNo">026</span>import org.apache.hadoop.hbase.testclassification.MiscTests;<a name="line.26"></a>
-<span class="sourceLineNo">027</span>import org.apache.hadoop.hbase.testclassification.SmallTests;<a name="line.27"></a>
-<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.util.Addressing;<a name="line.28"></a>
-<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.29"></a>
-<span class="sourceLineNo">030</span>import org.junit.ClassRule;<a name="line.30"></a>
-<span class="sourceLineNo">031</span>import org.junit.Test;<a name="line.31"></a>
-<span class="sourceLineNo">032</span>import org.junit.experimental.categories.Category;<a name="line.32"></a>
-<span class="sourceLineNo">033</span><a name="line.33"></a>
-<span class="sourceLineNo">034</span>@Category({MiscTests.class, SmallTests.class})<a name="line.34"></a>
-<span class="sourceLineNo">035</span>public class TestServerName {<a name="line.35"></a>
-<span class="sourceLineNo">036</span><a name="line.36"></a>
-<span class="sourceLineNo">037</span>  @ClassRule<a name="line.37"></a>
-<span class="sourceLineNo">038</span>  public static final HBaseClassTestRule CLASS_RULE =<a name="line.38"></a>
-<span class="sourceLineNo">039</span>      HBaseClassTestRule.forClass(TestServerName.class);<a name="line.39"></a>
-<span class="sourceLineNo">040</span><a name="line.40"></a>
-<span class="sourceLineNo">041</span>  @Test<a name="line.41"></a>
-<span class="sourceLineNo">042</span>  public void testGetHostNameMinusDomain() {<a name="line.42"></a>
-<span class="sourceLineNo">043</span>    assertEquals("2607:f0d0:1002:51::4",<a name="line.43"></a>
-<span class="sourceLineNo">044</span>      ServerName.getHostNameMinusDomain("2607:f0d0:1002:51::4"));<a name="line.44"></a>
-<span class="sourceLineNo">045</span>    assertEquals("2607:f0d0:1002:0051:0000:0000:0000:0004",<a name="line.45"></a>
-<span class="sourceLineNo">046</span>        ServerName.getHostNameMinusDomain("2607:f0d0:1002:0051:0000:0000:0000:0004"));<a name="line.46"></a>
-<span class="sourceLineNo">047</span>    assertEquals("1.1.1.1", ServerName.getHostNameMinusDomain("1.1.1.1"));<a name="line.47"></a>
-<span class="sourceLineNo">048</span>    assertEquals("x", ServerName.getHostNameMinusDomain("x"));<a name="line.48"></a>
-<span class="sourceLineNo">049</span>    assertEquals("x", ServerName.getHostNameMinusDomain("x.y.z"));<a name="line.49"></a>
-<span class="sourceLineNo">050</span>    assertEquals("asf000", ServerName.getHostNameMinusDomain("asf000.sp2.ygridcore.net"));<a name="line.50"></a>
-<span class="sourceLineNo">051</span>    ServerName sn = ServerName.valueOf("asf000.sp2.ygridcore.net", 1, 1);<a name="line.51"></a>
-<span class="sourceLineNo">052</span>    assertEquals("asf000.sp2.ygridcore.net,1,1", sn.toString());<a name="line.52"></a>
-<span class="sourceLineNo">053</span>  }<a name="line.53"></a>
-<span class="sourceLineNo">054</span><a name="line.54"></a>
-<span class="sourceLineNo">055</span>  @Test<a name="line.55"></a>
-<span class="sourceLineNo">056</span>  public void testShortString() {<a name="line.56"></a>
-<span class="sourceLineNo">057</span>    ServerName sn = ServerName.valueOf("asf000.sp2.ygridcore.net", 1, 1);<a name="line.57"></a>
-<span class="sourceLineNo">058</span>    assertEquals("asf000:1", sn.toShortString());<a name="line.58"></a>
-<span class="sourceLineNo">059</span>    sn = ServerName.valueOf("2607:f0d0:1002:0051:0000:0000:0000:0004", 1, 1);<a name="line.59"></a>
-<span class="sourceLineNo">060</span>    assertEquals("2607:f0d0:1002:0051:0000:0000:0000:0004:1", sn.toShortString());<a name="line.60"></a>
-<span class="sourceLineNo">061</span>    sn = ServerName.valueOf("1.1.1.1", 1, 1);<a name="line.61"></a>
-<span class="sourceLineNo">062</span>    assertEquals("1.1.1.1:1", sn.toShortString());<a name="line.62"></a>
-<span class="sourceLineNo">063</span>  }<a name="line.63"></a>
-<span class="sourceLineNo">064</span><a name="line.64"></a>
-<span class="sourceLineNo">065</span>  @Test<a name="line.65"></a>
-<span class="sourceLineNo">066</span>  public void testRegexPatterns() {<a name="line.66"></a>
-<span class="sourceLineNo">067</span>    assertTrue(Pattern.matches(Addressing.VALID_PORT_REGEX, "123"));<a name="line.67"></a>
-<span class="sourceLineNo">068</span>    assertFalse(Pattern.matches(Addressing.VALID_PORT_REGEX, ""));<a name="line.68"></a>
-<span class="sourceLineNo">069</span>    assertTrue(ServerName.SERVERNAME_PATTERN.matcher("www1.example.org,1234,567").matches());<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    ServerName.parseServerName("a.b.c,58102,1319771740322");<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    ServerName.parseServerName("192.168.1.199,58102,1319771740322");<a name="line.71"></a>
-<span class="sourceLineNo">072</span>    ServerName.parseServerName("a.b.c:58102");<a name="line.72"></a>
-<span class="sourceLineNo">073</span>    ServerName.parseServerName("192.168.1.199:58102");<a name="line.73"></a>
-<span class="sourceLineNo">074</span>  }<a name="line.74"></a>
-<span class="sourceLineNo">075</span><a name="line.75"></a>
-<span class="sourceLineNo">076</span>  @Test public void testParseOfBytes() {<a name="line.76"></a>
-<span class="sourceLineNo">077</span>    final String snStr = "www.example.org,1234,5678";<a name="line.77"></a>
-<span class="sourceLineNo">078</span>    ServerName sn = ServerName.valueOf(snStr);<a name="line.78"></a>
-<span class="sourceLineNo">079</span>    byte [] versionedBytes = sn.getVersionedBytes();<a name="line.79"></a>
-<span class="sourceLineNo">080</span>    assertEquals(sn.toString(), ServerName.parseVersionedServerName(versionedBytes).toString());<a name="line.80"></a>
-<span class="sourceLineNo">081</span>    final String hostnamePortStr = sn.getHostAndPort();<a name="line.81"></a>
-<span class="sourceLineNo">082</span>    byte [] bytes = Bytes.toBytes(hostnamePortStr);<a name="line.82"></a>
-<span class="sourceLineNo">083</span>    String expecting =<a name="line.83"></a>
-<span class="sourceLineNo">084</span>      hostnamePortStr.replace(":", ServerName.SERVERNAME_SEPARATOR) +<a name="line.84"></a>
-<span class="sourceLineNo">085</span>      ServerName.SERVERNAME_SEPARATOR + ServerName.NON_STARTCODE;<a name="line.85"></a>
-<span class="sourceLineNo">086</span>    assertEquals(expecting, ServerName.parseVersionedServerName(bytes).toString());<a name="line.86"></a>
+<span class="sourceLineNo">025</span>import java.util.HashSet;<a name="line.25"></a>
+<span class="sourceLineNo">026</span>import java.util.Set;<a name="line.26"></a>
+<span class="sourceLineNo">027</span>import java.util.regex.Pattern;<a name="line.27"></a>
+<span class="sourceLineNo">028</span>import org.apache.hadoop.hbase.testclassification.MiscTests;<a name="line.28"></a>
+<span class="sourceLineNo">029</span>import org.apache.hadoop.hbase.testclassification.SmallTests;<a name="line.29"></a>
+<span class="sourceLineNo">030</span>import org.apache.hadoop.hbase.util.Addressing;<a name="line.30"></a>
+<span class="sourceLineNo">031</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.31"></a>
+<span class="sourceLineNo">032</span>import org.junit.ClassRule;<a name="line.32"></a>
+<span class="sourceLineNo">033</span>import org.junit.Test;<a name="line.33"></a>
+<span class="sourceLineNo">034</span>import org.junit.experimental.categories.Category;<a name="line.34"></a>
+<span class="sourceLineNo">035</span><a name="line.35"></a>
+<span class="sourceLineNo">036</span>@Category({MiscTests.class, SmallTests.class})<a name="line.36"></a>
+<span class="sourceLineNo">037</span>public class TestServerName {<a name="line.37"></a>
+<span class="sourceLineNo">038</span><a name="line.38"></a>
+<span class="sourceLineNo">039</span>  @ClassRule<a name="line.39"></a>
+<span class="sourceLineNo">040</span>  public static final HBaseClassTestRule CLASS_RULE =<a name="line.40"></a>
+<span class="sourceLineNo">041</span>      HBaseClassTestRule.forClass(TestServerName.class);<a name="line.41"></a>
+<span class="sourceLineNo">042</span><a name="line.42"></a>
+<span class="sourceLineNo">043</span>  @Test<a name="line.43"></a>
+<span class="sourceLineNo">044</span>  public void testHash() {<a name="line.44"></a>
+<span class="sourceLineNo">045</span>    ServerName sn1 = ServerName.parseServerName("asf903.gq1.ygridcore.net,52690,1517835491385");<a name="line.45"></a>
+<span class="sourceLineNo">046</span>    ServerName sn2 = ServerName.parseServerName("asf903.gq1.ygridcore.net,42231,1517835491329");<a name="line.46"></a>
+<span class="sourceLineNo">047</span>    Set&lt;ServerName&gt; sns = new HashSet&lt;ServerName&gt;();<a name="line.47"></a>
+<span class="sourceLineNo">048</span>    sns.add(sn2);<a name="line.48"></a>
+<span class="sourceLineNo">049</span>    sns.add(sn1);<a name="line.49"></a>
+<span class="sourceLineNo">050</span>    sns.add(sn1);<a name="line.50"></a>
+<span class="sourceLineNo">051</span>    assertEquals(2, sns.size());<a name="line.51"></a>
+<span class="sourceLineNo">052</span>  }<a name="line.52"></a>
+<span class="sourceLineNo">053</span><a name="line.53"></a>
+<span class="sourceLineNo">054</span>  @Test<a name="line.54"></a>
+<span class="sourceLineNo">055</span>  public void testGetHostNameMinusDomain() {<a name="line.55"></a>
+<span class="sourceLineNo">056</span>    assertEquals("2607:f0d0:1002:51::4",<a name="line.56"></a>
+<span class="sourceLineNo">057</span>      ServerName.getHostNameMinusDomain("2607:f0d0:1002:51::4"));<a name="line.57"></a>
+<span class="sourceLineNo">058</span>    assertEquals("2607:f0d0:1002:0051:0000:0000:0000:0004",<a name="line.58"></a>
+<span class="sourceLineNo">059</span>        ServerName.getHostNameMinusDomain("2607:f0d0:1002:0051:0000:0000:0000:0004"));<a name="line.59"></a>
+<span class="sourceLineNo">060</span>    assertEquals("1.1.1.1", ServerName.getHostNameMinusDomain("1.1.1.1"));<a name="line.60"></a>
+<span class="sourceLineNo">061</span>    assertEquals("x", ServerName.getHostNameMinusDomain("x"));<a name="line.61"></a>
+<span class="sourceLineNo">062</span>    assertEquals("x", ServerName.getHostNameMinusDomain("x.y.z"));<a name="line.62"></a>
+<span class="sourceLineNo">063</span>    assertEquals("asf000", ServerName.getHostNameMinusDomain("asf000.sp2.ygridcore.net"));<a name="line.63"></a>
+<span class="sourceLineNo">064</span>    ServerName sn = ServerName.valueOf("asf000.sp2.ygridcore.net", 1, 1);<a name="line.64"></a>
+<span class="sourceLineNo">065</span>    assertEquals("asf000.sp2.ygridcore.net,1,1", sn.toString());<a name="line.65"></a>
+<span class="sourceLineNo">066</span>  }<a name="line.66"></a>
+<span class="sourceLineNo">067</span><a name="line.67"></a>
+<span class="sourceLineNo">068</span>  @Test<a name="line.68"></a>
+<span class="sourceLineNo">069</span>  public void testShortString() {<a name="line.69"></a>
+<span class="sourceLineNo">070</span>    ServerName sn = ServerName.valueOf("asf000.sp2.ygridcore.net", 1, 1);<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    assertEquals("asf000:1", sn.toShortString());<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    sn = ServerName.valueOf("2607:f0d0:1002:0051:0000:0000:0000:0004", 1, 1);<a name="line.72"></a>
+<span class="sourceLineNo">073</span>    assertEquals("2607:f0d0:1002:0051:0000:0000:0000:0004:1", sn.toShortString());<a name="line.73"></a>
+<span class="sourceLineNo">074</span>    sn = ServerName.valueOf("1.1.1.1", 1, 1);<a name="line.74"></a>
+<span class="sourceLineNo">075</span>    assertEquals("1.1.1.1:1", sn.toShortString());<a name="line.75"></a>
+<span class="sourceLineNo">076</span>  }<a name="line.76"></a>
+<span class="sourceLineNo">077</span><a name="line.77"></a>
+<span class="sourceLineNo">078</span>  @Test<a name="line.78"></a>
+<span class="sourceLineNo">079</span>  public void testRegexPatterns() {<a name="line.79"></a>
+<span class="sourceLineNo">080</span>    assertTrue(Pattern.matches(Addressing.VALID_PORT_REGEX, "123"));<a name="line.80"></a>
+<span class="sourceLineNo">081</span>    assertFalse(Pattern.matches(Addressing.VALID_PORT_REGEX, ""));<a name="line.81"></a>
+<span class="sourceLineNo">082</span>    assertTrue(ServerName.SERVERNAME_PATTERN.matcher("www1.example.org,1234,567").matches());<a name="line.82"></a>
+<span class="sourceLineNo">083</span>    ServerName.parseServerName("a.b.c,58102,1319771740322");<a name="line.83"></a>
+<span class="sourceLineNo">084</span>    ServerName.parseServerName("192.168.1.199,58102,1319771740322");<a name="line.84"></a>
+<span class="sourceLineNo">085</span>    ServerName.parseServerName("a.b.c:58102");<a name="line.85"></a>
+<span class="sourceLineNo">086</span>    ServerName.parseServerName("192.168.1.199:58102");<a name="line.86"></a>
 <span class="sourceLineNo">087</span>  }<a name="line.87"></a>
 <span class="sourceLineNo">088</span><a name="line.88"></a>
-<span class="sourceLineNo">089</span>  @Test<a name="line.89"></a>
-<span class="sourceLineNo">090</span>  public void testServerName() {<a name="line.90"></a>
-<span class="sourceLineNo">091</span>    ServerName sn = ServerName.valueOf("www.example.org", 1234, 5678);<a name="line.91"></a>
-<span class="sourceLineNo">092</span>    ServerName sn2 = ServerName.valueOf("www.example.org", 1234, 5678);<a name="line.92"></a>
-<span class="sourceLineNo">093</span>    ServerName sn3 = ServerName.valueOf("www.example.org", 1234, 56789);<a name="line.93"></a>
-<span class="sourceLineNo">094</span>    assertTrue(sn.equals(sn2));<a name="line.94"></a>
-<span class="sourceLineNo">095</span>    assertFalse(sn.equals(sn3));<a name="line.95"></a>
-<span class="sourceLineNo">096</span>    assertEquals(sn.hashCode(), sn2.hashCode());<a name="line.96"></a>
-<span class="sourceLineNo">097</span>    assertNotSame(sn.hashCode(), sn3.hashCode());<a name="line.97"></a>
-<span class="sourceLineNo">098</span>    assertEquals(sn.toString(),<a name="line.98"></a>
-<span class="sourceLineNo">099</span>      ServerName.valueOf("www.example.org", 1234, 5678).toString());<a name="line.99"></a>
-<span class="sourceLineNo">100</span>    assertEquals(sn.toString(),<a name="line.100"></a>
-<span class="sourceLineNo">101</span>      ServerName.valueOf("www.example.org:1234", 5678).toString());<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    assertEquals("www.example.org" + ServerName.SERVERNAME_SEPARATOR + "1234"<a name="line.102"></a>
-<span class="sourceLineNo">103</span>        + ServerName.SERVERNAME_SEPARATOR + "5678", sn.toString());<a name="line.103"></a>
-<span class="sourceLineNo">104</span>  }<a name="line.104"></a>
-<span class="sourceLineNo">105</span><a name="line.105"></a>
-<span class="sourceLineNo">106</span>  @Test<a name="line.106"></a>
-<span class="sourceLineNo">107</span>  public void testHostNameCaseSensitivity() {<a name="line.107"></a>
-<span class="sourceLineNo">108</span>    ServerName lower = ServerName.valueOf("www.example.org", 1234, 5678);<a name="line.108"></a>
-<span class="sourceLineNo">109</span>    ServerName upper = ServerName.valueOf("www.EXAMPLE.org", 1234, 5678);<a name="line.109"></a>
-<span class="sourceLineNo">110</span>    assertEquals(0, lower.compareTo(upper));<a name="line.110"></a>
-<span class="sourceLineNo">111</span>    assertEquals(0, upper.compareTo(lower));<a name="line.111"></a>
-<span class="sourceLineNo">112</span>    assertEquals(lower.hashCode(), upper.hashCode());<a name="line.112"></a>
-<span class="sourceLineNo">113</span>    assertTrue(lower.equals(upper));<a name="line.113"></a>
-<span class="sourceLineNo">114</span>    assertTrue(upper.equals(lower));<a name="line.114"></a>
-<span class="sourceLineNo">115</span>    assertTrue(ServerName.isSameAddress(lower, upper));<a name="line.115"></a>
-<span class="sourceLineNo">116</span>  }<a name="line.116"></a>
-<span class="sourceLineNo">117</span>}<a name="line.117"></a>
+<span class="sourceLineNo">089</span>  @Test public void testParseOfBytes() {<a name="line.89"></a>
+<span class="sourceLineNo">090</span>    final String snStr = "www.example.org,1234,5678";<a name="line.90"></a>
+<span class="sourceLineNo">091</span>    ServerName sn = ServerName.valueOf(snStr);<a name="line.91"></a>
+<span class="sourceLineNo">092</span>    byte [] versionedBytes = sn.getVersionedBytes();<a name="line.92"></a>
+<span class="sourceLineNo">093</span>    assertEquals(sn.toString(), ServerName.parseVersionedServerName(versionedBytes).toString());<a name="line.93"></a>
+<span class="sourceLineNo">094</span>    final String hostnamePortStr = sn.getHostAndPort();<a name="line.94"></a>
+<span class="sourceLineNo">095</span>    byte [] bytes = Bytes.toBytes(hostnamePortStr);<a name="line.95"></a>
+<span class="sourceLineNo">096</span>    String expecting =<a name="line.96"></a>
+<span class="sourceLineNo">097</span>      hostnamePortStr.replace(":", ServerName.SERVERNAME_SEPARATOR) +<a name="line.97"></a>
+<span class="sourceLineNo">098</span>      ServerName.SERVERNAME_SEPARATOR + ServerName.NON_STARTCODE;<a name="line.98"></a>
+<span class="sourceLineNo">099</span>    assertEquals(expecting, ServerName.parseVersionedServerName(bytes).toString());<a name="line.99"></a>
+<span class="sourceLineNo">100</span>  }<a name="line.100"></a>
+<span class="sourceLineNo">101</span><a name="line.101"></a>
+<span class="sourceLineNo">102</span>  @Test<a name="line.102"></a>
+<span class="sourceLineNo">103</span>  public void testServerName() {<a name="line.103"></a>
+<span class="sourceLineNo">104</span>    ServerName sn = ServerName.valueOf("www.example.org", 1234, 5678);<a name="line.104"></a>
+<span class="sourceLineNo">105</span>    ServerName sn2 = ServerName.valueOf("www.example.org", 1234, 5678);<a name="line.105"></a>
+<span class="sourceLineNo">106</span>    ServerName sn3 = ServerName.valueOf("www.example.org", 1234, 56789);<a name="line.106"></a>
+<span class="sourceLineNo">107</span>    assertTrue(sn.equals(sn2));<a name="line.107"></a>
+<span class="sourceLineNo">108</span>    assertFalse(sn.equals(sn3));<a name="line.108"></a>
+<span class="sourceLineNo">109</span>    assertEquals(sn.hashCode(), sn2.hashCode());<a name="line.109"></a>
+<span class="sourceLineNo">110</span>    assertNotSame(sn.hashCode(), sn3.hashCode());<a name="line.110"></a>
+<span class="sourceLineNo">111</span>    assertEquals(sn.toString(),<a name="line.111"></a>
+<span class="sourceLineNo">112</span>      ServerName.valueOf("www.example.org", 1234, 5678).toString());<a name="line.112"></a>
+<span class="sourceLineNo">113</span>    assertEquals(sn.toString(),<a name="line.113"></a>
+<span class="sourceLineNo">114</span>      ServerName.valueOf("www.example.org:1234", 5678).toString());<a name="line.114"></a>
+<span class="sourceLineNo">115</span>    assertEquals("www.example.org" + ServerName.SERVERNAME_SEPARATOR + "1234"<a name="line.115"></a>
+<span class="sourceLineNo">116</span>        + ServerName.SERVERNAME_SEPARATOR + "5678", sn.toString());<a name="line.116"></a>
+<span class="sourceLineNo">117</span>  }<a name="line.117"></a>
 <span class="sourceLineNo">118</span><a name="line.118"></a>
+<span class="sourceLineNo">119</span>  @Test<a name="line.119"></a>
+<span class="sourceLineNo">120</span>  public void testHostNameCaseSensitivity() {<a name="line.120"></a>
+<span class="sourceLineNo">121</span>    ServerName lower = ServerName.valueOf("www.example.org", 1234, 5678);<a name="line.121"></a>
+<span class="sourceLineNo">122</span>    ServerName upper = ServerName.valueOf("www.EXAMPLE.org", 1234, 5678);<a name="line.122"></a>
+<span class="sourceLineNo">123</span>    assertEquals(0, lower.compareTo(upper));<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    assertEquals(0, upper.compareTo(lower));<a name="line.124"></a>
+<span class="sourceLineNo">125</span>    assertEquals(lower.hashCode(), upper.hashCode());<a name="line.125"></a>
+<span class="sourceLineNo">126</span>    assertTrue(lower.equals(upper));<a name="line.126"></a>
+<span class="sourceLineNo">127</span>    assertTrue(upper.equals(lower));<a name="line.127"></a>
+<span class="sourceLineNo">128</span>    assertTrue(ServerName.isSameAddress(lower, upper));<a name="line.128"></a>
+<span class="sourceLineNo">129</span>  }<a name="line.129"></a>
+<span class="sourceLineNo">130</span>}<a name="line.130"></a>
+<span class="sourceLineNo">131</span><a name="line.131"></a>
 
 
 


Mime
View raw message