hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1465198 [10/41] - in /hbase/hbase.apache.org/trunk: ./ css/ hbase-assembly/ images/ xref-test/ xref-test/org/apache/hadoop/hbase/ xref-test/org/apache/hadoop/hbase/client/ xref-test/org/apache/hadoop/hbase/client/replication/ xref-test/org...
Date Sat, 06 Apr 2013 06:06:09 GMT
Modified: hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/TestCompoundConfiguration.html
URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/TestCompoundConfiguration.html?rev=1465198&r1=1465197&r2=1465198&view=diff
==============================================================================
--- hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/TestCompoundConfiguration.html (original)
+++ hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/TestCompoundConfiguration.html Sat Apr  6 06:06:07 2013
@@ -30,133 +30,173 @@
 <a class="jxr_linenumber" name="20" href="#20">20</a>  <strong class="jxr_keyword">package</strong> org.apache.hadoop.hbase;
 <a class="jxr_linenumber" name="21" href="#21">21</a>  
 <a class="jxr_linenumber" name="22" href="#22">22</a>  <strong class="jxr_keyword">import</strong> java.util.HashMap;
-<a class="jxr_linenumber" name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> java.util.Map;
-<a class="jxr_linenumber" name="24" href="#24">24</a>  
-<a class="jxr_linenumber" name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.conf.Configuration;
-<a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.io.ImmutableBytesWritable;
-<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes;
-<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.SmallTests;
-<a class="jxr_linenumber" name="29" href="#29">29</a>  
-<a class="jxr_linenumber" name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> org.junit.experimental.categories.Category;
-<a class="jxr_linenumber" name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> org.junit.Test;
-<a class="jxr_linenumber" name="32" href="#32">32</a>  
-<a class="jxr_linenumber" name="33" href="#33">33</a>  <strong class="jxr_keyword">import</strong> junit.framework.TestCase;
-<a class="jxr_linenumber" name="34" href="#34">34</a>  
-<a class="jxr_linenumber" name="35" href="#35">35</a>  @Category(SmallTests.<strong class="jxr_keyword">class</strong>)
-<a class="jxr_linenumber" name="36" href="#36">36</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/hadoop/hbase/TestCompoundConfiguration.html">TestCompoundConfiguration</a> <strong class="jxr_keyword">extends</strong> TestCase {
-<a class="jxr_linenumber" name="37" href="#37">37</a>    <strong class="jxr_keyword">private</strong> Configuration baseConf;
-<a class="jxr_linenumber" name="38" href="#38">38</a>  
-<a class="jxr_linenumber" name="39" href="#39">39</a>    @Override
-<a class="jxr_linenumber" name="40" href="#40">40</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> setUp() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="41" href="#41">41</a>      baseConf = <strong class="jxr_keyword">new</strong> Configuration();
-<a class="jxr_linenumber" name="42" href="#42">42</a>      baseConf.set(<span class="jxr_string">"A"</span>, <span class="jxr_string">"1"</span>);
-<a class="jxr_linenumber" name="43" href="#43">43</a>      baseConf.setInt(<span class="jxr_string">"B"</span>, 2);
-<a class="jxr_linenumber" name="44" href="#44">44</a>      baseConf.set(<span class="jxr_string">"C"</span>, <span class="jxr_string">"3"</span>);
-<a class="jxr_linenumber" name="45" href="#45">45</a>    }
-<a class="jxr_linenumber" name="46" href="#46">46</a>  
-<a class="jxr_linenumber" name="47" href="#47">47</a>    @Test
-<a class="jxr_linenumber" name="48" href="#48">48</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testBasicFunctionality() <strong class="jxr_keyword">throws</strong> ClassNotFoundException {
-<a class="jxr_linenumber" name="49" href="#49">49</a>      CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration()
-<a class="jxr_linenumber" name="50" href="#50">50</a>          .add(baseConf);
-<a class="jxr_linenumber" name="51" href="#51">51</a>      assertEquals(<span class="jxr_string">"1"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
-<a class="jxr_linenumber" name="52" href="#52">52</a>      assertEquals(2, compoundConf.getInt(<span class="jxr_string">"B"</span>, 0));
-<a class="jxr_linenumber" name="53" href="#53">53</a>      assertEquals(3, compoundConf.getInt(<span class="jxr_string">"C"</span>, 0));
-<a class="jxr_linenumber" name="54" href="#54">54</a>      assertEquals(0, compoundConf.getInt(<span class="jxr_string">"D"</span>, 0));
-<a class="jxr_linenumber" name="55" href="#55">55</a>  
-<a class="jxr_linenumber" name="56" href="#56">56</a>      assertEquals(CompoundConfiguration.<strong class="jxr_keyword">class</strong>, compoundConf
-<a class="jxr_linenumber" name="57" href="#57">57</a>          .getClassByName(CompoundConfiguration.<strong class="jxr_keyword">class</strong>.getName()));
-<a class="jxr_linenumber" name="58" href="#58">58</a>      <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="59" href="#59">59</a>        compoundConf.getClassByName(<span class="jxr_string">"bad_class_name"</span>);
-<a class="jxr_linenumber" name="60" href="#60">60</a>        fail(<span class="jxr_string">"Trying to load bad_class_name should throw an exception"</span>);
-<a class="jxr_linenumber" name="61" href="#61">61</a>      } <strong class="jxr_keyword">catch</strong> (ClassNotFoundException e) {
-<a class="jxr_linenumber" name="62" href="#62">62</a>        <em class="jxr_comment">// win!</em>
-<a class="jxr_linenumber" name="63" href="#63">63</a>      }
-<a class="jxr_linenumber" name="64" href="#64">64</a>    }
-<a class="jxr_linenumber" name="65" href="#65">65</a>  
-<a class="jxr_linenumber" name="66" href="#66">66</a>    @Test
-<a class="jxr_linenumber" name="67" href="#67">67</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testWithConfig() {
-<a class="jxr_linenumber" name="68" href="#68">68</a>      Configuration conf = <strong class="jxr_keyword">new</strong> Configuration();
-<a class="jxr_linenumber" name="69" href="#69">69</a>      conf.set(<span class="jxr_string">"B"</span>, <span class="jxr_string">"2b"</span>);
-<a class="jxr_linenumber" name="70" href="#70">70</a>      conf.set(<span class="jxr_string">"C"</span>, <span class="jxr_string">"33"</span>);
-<a class="jxr_linenumber" name="71" href="#71">71</a>      conf.set(<span class="jxr_string">"D"</span>, <span class="jxr_string">"4"</span>);
-<a class="jxr_linenumber" name="72" href="#72">72</a>  
-<a class="jxr_linenumber" name="73" href="#73">73</a>      CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration()
-<a class="jxr_linenumber" name="74" href="#74">74</a>          .add(baseConf)
-<a class="jxr_linenumber" name="75" href="#75">75</a>          .add(conf);
-<a class="jxr_linenumber" name="76" href="#76">76</a>      assertEquals(<span class="jxr_string">"1"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
-<a class="jxr_linenumber" name="77" href="#77">77</a>      assertEquals(<span class="jxr_string">"2b"</span>, compoundConf.get(<span class="jxr_string">"B"</span>));
-<a class="jxr_linenumber" name="78" href="#78">78</a>      assertEquals(33, compoundConf.getInt(<span class="jxr_string">"C"</span>, 0));
-<a class="jxr_linenumber" name="79" href="#79">79</a>      assertEquals(<span class="jxr_string">"4"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
-<a class="jxr_linenumber" name="80" href="#80">80</a>      assertEquals(4, compoundConf.getInt(<span class="jxr_string">"D"</span>, 0));
-<a class="jxr_linenumber" name="81" href="#81">81</a>      assertNull(compoundConf.get(<span class="jxr_string">"E"</span>));
-<a class="jxr_linenumber" name="82" href="#82">82</a>      assertEquals(6, compoundConf.getInt(<span class="jxr_string">"F"</span>, 6));
-<a class="jxr_linenumber" name="83" href="#83">83</a>    }
-<a class="jxr_linenumber" name="84" href="#84">84</a>  
-<a class="jxr_linenumber" name="85" href="#85">85</a>    <strong class="jxr_keyword">private</strong> ImmutableBytesWritable strToIbw(String s) {
-<a class="jxr_linenumber" name="86" href="#86">86</a>      <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> ImmutableBytesWritable(Bytes.toBytes(s));
-<a class="jxr_linenumber" name="87" href="#87">87</a>    }
-<a class="jxr_linenumber" name="88" href="#88">88</a>  
-<a class="jxr_linenumber" name="89" href="#89">89</a>    @Test
-<a class="jxr_linenumber" name="90" href="#90">90</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testWithIbwMap() {
-<a class="jxr_linenumber" name="91" href="#91">91</a>      Map&lt;ImmutableBytesWritable, ImmutableBytesWritable&gt; map =
-<a class="jxr_linenumber" name="92" href="#92">92</a>        <strong class="jxr_keyword">new</strong> HashMap&lt;ImmutableBytesWritable, ImmutableBytesWritable&gt;();
-<a class="jxr_linenumber" name="93" href="#93">93</a>      map.put(strToIbw(<span class="jxr_string">"B"</span>), strToIbw(<span class="jxr_string">"2b"</span>));
-<a class="jxr_linenumber" name="94" href="#94">94</a>      map.put(strToIbw(<span class="jxr_string">"C"</span>), strToIbw(<span class="jxr_string">"33"</span>));
-<a class="jxr_linenumber" name="95" href="#95">95</a>      map.put(strToIbw(<span class="jxr_string">"D"</span>), strToIbw(<span class="jxr_string">"4"</span>));
-<a class="jxr_linenumber" name="96" href="#96">96</a>      <em class="jxr_comment">// unlike config, note that IBW Maps can accept null values</em>
-<a class="jxr_linenumber" name="97" href="#97">97</a>      map.put(strToIbw(<span class="jxr_string">"G"</span>), <strong class="jxr_keyword">null</strong>);
-<a class="jxr_linenumber" name="98" href="#98">98</a>  
-<a class="jxr_linenumber" name="99" href="#99">99</a>      CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration()
-<a class="jxr_linenumber" name="100" href="#100">100</a>       .add(baseConf)
-<a class="jxr_linenumber" name="101" href="#101">101</a>       .addWritableMap(map);
-<a class="jxr_linenumber" name="102" href="#102">102</a>     assertEquals(<span class="jxr_string">"1"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
-<a class="jxr_linenumber" name="103" href="#103">103</a>     assertEquals(<span class="jxr_string">"2b"</span>, compoundConf.get(<span class="jxr_string">"B"</span>));
-<a class="jxr_linenumber" name="104" href="#104">104</a>     assertEquals(33, compoundConf.getInt(<span class="jxr_string">"C"</span>, 0));
-<a class="jxr_linenumber" name="105" href="#105">105</a>     assertEquals(<span class="jxr_string">"4"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
-<a class="jxr_linenumber" name="106" href="#106">106</a>     assertEquals(4, compoundConf.getInt(<span class="jxr_string">"D"</span>, 0));
-<a class="jxr_linenumber" name="107" href="#107">107</a>     assertNull(compoundConf.get(<span class="jxr_string">"E"</span>));
-<a class="jxr_linenumber" name="108" href="#108">108</a>     assertEquals(6, compoundConf.getInt(<span class="jxr_string">"F"</span>, 6));
-<a class="jxr_linenumber" name="109" href="#109">109</a>     assertNull(compoundConf.get(<span class="jxr_string">"G"</span>));
-<a class="jxr_linenumber" name="110" href="#110">110</a>   }
-<a class="jxr_linenumber" name="111" href="#111">111</a> 
-<a class="jxr_linenumber" name="112" href="#112">112</a>   @Test
-<a class="jxr_linenumber" name="113" href="#113">113</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testWithStringMap() {
-<a class="jxr_linenumber" name="114" href="#114">114</a>     Map&lt;String, String&gt; map = <strong class="jxr_keyword">new</strong> HashMap&lt;String, String&gt;();
-<a class="jxr_linenumber" name="115" href="#115">115</a>     map.put(<span class="jxr_string">"B"</span>, <span class="jxr_string">"2b"</span>);
-<a class="jxr_linenumber" name="116" href="#116">116</a>     map.put(<span class="jxr_string">"C"</span>, <span class="jxr_string">"33"</span>);
-<a class="jxr_linenumber" name="117" href="#117">117</a>     map.put(<span class="jxr_string">"D"</span>, <span class="jxr_string">"4"</span>);
-<a class="jxr_linenumber" name="118" href="#118">118</a>     <em class="jxr_comment">// unlike config, note that IBW Maps can accept null values</em>
-<a class="jxr_linenumber" name="119" href="#119">119</a>     map.put(<span class="jxr_string">"G"</span>, <strong class="jxr_keyword">null</strong>);
-<a class="jxr_linenumber" name="120" href="#120">120</a> 
-<a class="jxr_linenumber" name="121" href="#121">121</a>     CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration().addStringMap(map);
-<a class="jxr_linenumber" name="122" href="#122">122</a>     assertEquals(<span class="jxr_string">"2b"</span>, compoundConf.get(<span class="jxr_string">"B"</span>));
-<a class="jxr_linenumber" name="123" href="#123">123</a>     assertEquals(33, compoundConf.getInt(<span class="jxr_string">"C"</span>, 0));
-<a class="jxr_linenumber" name="124" href="#124">124</a>     assertEquals(<span class="jxr_string">"4"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
-<a class="jxr_linenumber" name="125" href="#125">125</a>     assertEquals(4, compoundConf.getInt(<span class="jxr_string">"D"</span>, 0));
-<a class="jxr_linenumber" name="126" href="#126">126</a>     assertNull(compoundConf.get(<span class="jxr_string">"E"</span>));
-<a class="jxr_linenumber" name="127" href="#127">127</a>     assertEquals(6, compoundConf.getInt(<span class="jxr_string">"F"</span>, 6));
-<a class="jxr_linenumber" name="128" href="#128">128</a>     assertNull(compoundConf.get(<span class="jxr_string">"G"</span>));
-<a class="jxr_linenumber" name="129" href="#129">129</a>   }
-<a class="jxr_linenumber" name="130" href="#130">130</a> 
-<a class="jxr_linenumber" name="131" href="#131">131</a>   @Test
-<a class="jxr_linenumber" name="132" href="#132">132</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testLaterConfigsOverrideEarlier() {
-<a class="jxr_linenumber" name="133" href="#133">133</a>     Map&lt;String, String&gt; map1 = <strong class="jxr_keyword">new</strong> HashMap&lt;String, String&gt;();
-<a class="jxr_linenumber" name="134" href="#134">134</a>     map1.put(<span class="jxr_string">"A"</span>, <span class="jxr_string">"2"</span>);
-<a class="jxr_linenumber" name="135" href="#135">135</a>     map1.put(<span class="jxr_string">"D"</span>, <span class="jxr_string">"5"</span>);
-<a class="jxr_linenumber" name="136" href="#136">136</a>     Map&lt;String, String&gt; map2 = <strong class="jxr_keyword">new</strong> HashMap&lt;String, String&gt;();
-<a class="jxr_linenumber" name="137" href="#137">137</a>     map2.put(<span class="jxr_string">"A"</span>, <span class="jxr_string">"3"</span>);
-<a class="jxr_linenumber" name="138" href="#138">138</a>     map2.put(<span class="jxr_string">"B"</span>, <span class="jxr_string">"4"</span>);
-<a class="jxr_linenumber" name="139" href="#139">139</a> 
-<a class="jxr_linenumber" name="140" href="#140">140</a>     CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration()
-<a class="jxr_linenumber" name="141" href="#141">141</a>       .addStringMap(map1).add(baseConf);
-<a class="jxr_linenumber" name="142" href="#142">142</a>     assertEquals(<span class="jxr_string">"1"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
-<a class="jxr_linenumber" name="143" href="#143">143</a>     assertEquals(<span class="jxr_string">"5"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
-<a class="jxr_linenumber" name="144" href="#144">144</a>     compoundConf.addStringMap(map2);
-<a class="jxr_linenumber" name="145" href="#145">145</a>     assertEquals(<span class="jxr_string">"3"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
-<a class="jxr_linenumber" name="146" href="#146">146</a>     assertEquals(<span class="jxr_string">"4"</span>, compoundConf.get(<span class="jxr_string">"B"</span>));
-<a class="jxr_linenumber" name="147" href="#147">147</a>     assertEquals(<span class="jxr_string">"5"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
-<a class="jxr_linenumber" name="148" href="#148">148</a>   }
-<a class="jxr_linenumber" name="149" href="#149">149</a> }
+<a class="jxr_linenumber" name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> java.util.Iterator;
+<a class="jxr_linenumber" name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> java.util.Map;
+<a class="jxr_linenumber" name="25" href="#25">25</a>  
+<a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.conf.Configuration;
+<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.io.ImmutableBytesWritable;
+<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes;
+<a class="jxr_linenumber" name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.SmallTests;
+<a class="jxr_linenumber" name="30" href="#30">30</a>  
+<a class="jxr_linenumber" name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> org.junit.experimental.categories.Category;
+<a class="jxr_linenumber" name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> org.junit.Test;
+<a class="jxr_linenumber" name="33" href="#33">33</a>  
+<a class="jxr_linenumber" name="34" href="#34">34</a>  <strong class="jxr_keyword">import</strong> junit.framework.TestCase;
+<a class="jxr_linenumber" name="35" href="#35">35</a>  
+<a class="jxr_linenumber" name="36" href="#36">36</a>  @Category(SmallTests.<strong class="jxr_keyword">class</strong>)
+<a class="jxr_linenumber" name="37" href="#37">37</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/hadoop/hbase/TestCompoundConfiguration.html">TestCompoundConfiguration</a> <strong class="jxr_keyword">extends</strong> TestCase {
+<a class="jxr_linenumber" name="38" href="#38">38</a>    <strong class="jxr_keyword">private</strong> Configuration baseConf;
+<a class="jxr_linenumber" name="39" href="#39">39</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> baseConfSize;
+<a class="jxr_linenumber" name="40" href="#40">40</a>  
+<a class="jxr_linenumber" name="41" href="#41">41</a>    @Override
+<a class="jxr_linenumber" name="42" href="#42">42</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> setUp() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="43" href="#43">43</a>      baseConf = <strong class="jxr_keyword">new</strong> Configuration();
+<a class="jxr_linenumber" name="44" href="#44">44</a>      baseConf.set(<span class="jxr_string">"A"</span>, <span class="jxr_string">"1"</span>);
+<a class="jxr_linenumber" name="45" href="#45">45</a>      baseConf.setInt(<span class="jxr_string">"B"</span>, 2);
+<a class="jxr_linenumber" name="46" href="#46">46</a>      baseConf.set(<span class="jxr_string">"C"</span>, <span class="jxr_string">"3"</span>);
+<a class="jxr_linenumber" name="47" href="#47">47</a>      baseConfSize = baseConf.size();
+<a class="jxr_linenumber" name="48" href="#48">48</a>    }
+<a class="jxr_linenumber" name="49" href="#49">49</a>  
+<a class="jxr_linenumber" name="50" href="#50">50</a>    @Test
+<a class="jxr_linenumber" name="51" href="#51">51</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testBasicFunctionality() <strong class="jxr_keyword">throws</strong> ClassNotFoundException {
+<a class="jxr_linenumber" name="52" href="#52">52</a>      CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration()
+<a class="jxr_linenumber" name="53" href="#53">53</a>          .add(baseConf);
+<a class="jxr_linenumber" name="54" href="#54">54</a>      assertEquals(<span class="jxr_string">"1"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
+<a class="jxr_linenumber" name="55" href="#55">55</a>      assertEquals(2, compoundConf.getInt(<span class="jxr_string">"B"</span>, 0));
+<a class="jxr_linenumber" name="56" href="#56">56</a>      assertEquals(3, compoundConf.getInt(<span class="jxr_string">"C"</span>, 0));
+<a class="jxr_linenumber" name="57" href="#57">57</a>      assertEquals(0, compoundConf.getInt(<span class="jxr_string">"D"</span>, 0));
+<a class="jxr_linenumber" name="58" href="#58">58</a>  
+<a class="jxr_linenumber" name="59" href="#59">59</a>      assertEquals(CompoundConfiguration.<strong class="jxr_keyword">class</strong>, compoundConf
+<a class="jxr_linenumber" name="60" href="#60">60</a>          .getClassByName(CompoundConfiguration.<strong class="jxr_keyword">class</strong>.getName()));
+<a class="jxr_linenumber" name="61" href="#61">61</a>      <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="62" href="#62">62</a>        compoundConf.getClassByName(<span class="jxr_string">"bad_class_name"</span>);
+<a class="jxr_linenumber" name="63" href="#63">63</a>        fail(<span class="jxr_string">"Trying to load bad_class_name should throw an exception"</span>);
+<a class="jxr_linenumber" name="64" href="#64">64</a>      } <strong class="jxr_keyword">catch</strong> (ClassNotFoundException e) {
+<a class="jxr_linenumber" name="65" href="#65">65</a>        <em class="jxr_comment">// win!</em>
+<a class="jxr_linenumber" name="66" href="#66">66</a>      }
+<a class="jxr_linenumber" name="67" href="#67">67</a>    }
+<a class="jxr_linenumber" name="68" href="#68">68</a>  
+<a class="jxr_linenumber" name="69" href="#69">69</a>    @Test
+<a class="jxr_linenumber" name="70" href="#70">70</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testWithConfig() {
+<a class="jxr_linenumber" name="71" href="#71">71</a>      Configuration conf = <strong class="jxr_keyword">new</strong> Configuration();
+<a class="jxr_linenumber" name="72" href="#72">72</a>      conf.set(<span class="jxr_string">"B"</span>, <span class="jxr_string">"2b"</span>);
+<a class="jxr_linenumber" name="73" href="#73">73</a>      conf.set(<span class="jxr_string">"C"</span>, <span class="jxr_string">"33"</span>);
+<a class="jxr_linenumber" name="74" href="#74">74</a>      conf.set(<span class="jxr_string">"D"</span>, <span class="jxr_string">"4"</span>);
+<a class="jxr_linenumber" name="75" href="#75">75</a>  
+<a class="jxr_linenumber" name="76" href="#76">76</a>      CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration()
+<a class="jxr_linenumber" name="77" href="#77">77</a>          .add(baseConf)
+<a class="jxr_linenumber" name="78" href="#78">78</a>          .add(conf);
+<a class="jxr_linenumber" name="79" href="#79">79</a>      assertEquals(<span class="jxr_string">"1"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
+<a class="jxr_linenumber" name="80" href="#80">80</a>      assertEquals(<span class="jxr_string">"2b"</span>, compoundConf.get(<span class="jxr_string">"B"</span>));
+<a class="jxr_linenumber" name="81" href="#81">81</a>      assertEquals(33, compoundConf.getInt(<span class="jxr_string">"C"</span>, 0));
+<a class="jxr_linenumber" name="82" href="#82">82</a>      assertEquals(<span class="jxr_string">"4"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
+<a class="jxr_linenumber" name="83" href="#83">83</a>      assertEquals(4, compoundConf.getInt(<span class="jxr_string">"D"</span>, 0));
+<a class="jxr_linenumber" name="84" href="#84">84</a>      assertNull(compoundConf.get(<span class="jxr_string">"E"</span>));
+<a class="jxr_linenumber" name="85" href="#85">85</a>      assertEquals(6, compoundConf.getInt(<span class="jxr_string">"F"</span>, 6));
+<a class="jxr_linenumber" name="86" href="#86">86</a>      
+<a class="jxr_linenumber" name="87" href="#87">87</a>      <strong class="jxr_keyword">int</strong> cnt = 0;
+<a class="jxr_linenumber" name="88" href="#88">88</a>      <strong class="jxr_keyword">for</strong> (Map.Entry&lt;String,String&gt; entry : compoundConf) {
+<a class="jxr_linenumber" name="89" href="#89">89</a>        cnt++;
+<a class="jxr_linenumber" name="90" href="#90">90</a>        <strong class="jxr_keyword">if</strong> (entry.getKey().equals(<span class="jxr_string">"B"</span>)) assertEquals(<span class="jxr_string">"2b"</span>, entry.getValue());
+<a class="jxr_linenumber" name="91" href="#91">91</a>        <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (entry.getKey().equals(<span class="jxr_string">"G"</span>)) assertEquals(<strong class="jxr_keyword">null</strong>, entry.getValue());
+<a class="jxr_linenumber" name="92" href="#92">92</a>      }
+<a class="jxr_linenumber" name="93" href="#93">93</a>      <em class="jxr_comment">// verify that entries from ImmutableConfigMap's are merged in the iterator's view</em>
+<a class="jxr_linenumber" name="94" href="#94">94</a>      assertEquals(baseConfSize + 1, cnt);
+<a class="jxr_linenumber" name="95" href="#95">95</a>    }
+<a class="jxr_linenumber" name="96" href="#96">96</a>  
+<a class="jxr_linenumber" name="97" href="#97">97</a>    <strong class="jxr_keyword">private</strong> ImmutableBytesWritable strToIbw(String s) {
+<a class="jxr_linenumber" name="98" href="#98">98</a>      <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> ImmutableBytesWritable(Bytes.toBytes(s));
+<a class="jxr_linenumber" name="99" href="#99">99</a>    }
+<a class="jxr_linenumber" name="100" href="#100">100</a> 
+<a class="jxr_linenumber" name="101" href="#101">101</a>   @Test
+<a class="jxr_linenumber" name="102" href="#102">102</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testWithIbwMap() {
+<a class="jxr_linenumber" name="103" href="#103">103</a>     Map&lt;ImmutableBytesWritable, ImmutableBytesWritable&gt; map =
+<a class="jxr_linenumber" name="104" href="#104">104</a>       <strong class="jxr_keyword">new</strong> HashMap&lt;ImmutableBytesWritable, ImmutableBytesWritable&gt;();
+<a class="jxr_linenumber" name="105" href="#105">105</a>     map.put(strToIbw(<span class="jxr_string">"B"</span>), strToIbw(<span class="jxr_string">"2b"</span>));
+<a class="jxr_linenumber" name="106" href="#106">106</a>     map.put(strToIbw(<span class="jxr_string">"C"</span>), strToIbw(<span class="jxr_string">"33"</span>));
+<a class="jxr_linenumber" name="107" href="#107">107</a>     map.put(strToIbw(<span class="jxr_string">"D"</span>), strToIbw(<span class="jxr_string">"4"</span>));
+<a class="jxr_linenumber" name="108" href="#108">108</a>     <em class="jxr_comment">// unlike config, note that IBW Maps can accept null values</em>
+<a class="jxr_linenumber" name="109" href="#109">109</a>     map.put(strToIbw(<span class="jxr_string">"G"</span>), <strong class="jxr_keyword">null</strong>);
+<a class="jxr_linenumber" name="110" href="#110">110</a> 
+<a class="jxr_linenumber" name="111" href="#111">111</a>     CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration()
+<a class="jxr_linenumber" name="112" href="#112">112</a>       .add(baseConf)
+<a class="jxr_linenumber" name="113" href="#113">113</a>       .addWritableMap(map);
+<a class="jxr_linenumber" name="114" href="#114">114</a>     assertEquals(<span class="jxr_string">"1"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
+<a class="jxr_linenumber" name="115" href="#115">115</a>     assertEquals(<span class="jxr_string">"2b"</span>, compoundConf.get(<span class="jxr_string">"B"</span>));
+<a class="jxr_linenumber" name="116" href="#116">116</a>     assertEquals(33, compoundConf.getInt(<span class="jxr_string">"C"</span>, 0));
+<a class="jxr_linenumber" name="117" href="#117">117</a>     assertEquals(<span class="jxr_string">"4"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
+<a class="jxr_linenumber" name="118" href="#118">118</a>     assertEquals(4, compoundConf.getInt(<span class="jxr_string">"D"</span>, 0));
+<a class="jxr_linenumber" name="119" href="#119">119</a>     assertNull(compoundConf.get(<span class="jxr_string">"E"</span>));
+<a class="jxr_linenumber" name="120" href="#120">120</a>     assertEquals(6, compoundConf.getInt(<span class="jxr_string">"F"</span>, 6));
+<a class="jxr_linenumber" name="121" href="#121">121</a>     assertNull(compoundConf.get(<span class="jxr_string">"G"</span>));
+<a class="jxr_linenumber" name="122" href="#122">122</a>     
+<a class="jxr_linenumber" name="123" href="#123">123</a>     <strong class="jxr_keyword">int</strong> cnt = 0;
+<a class="jxr_linenumber" name="124" href="#124">124</a>     <strong class="jxr_keyword">for</strong> (Map.Entry&lt;String,String&gt; entry : compoundConf) {
+<a class="jxr_linenumber" name="125" href="#125">125</a>       cnt++;
+<a class="jxr_linenumber" name="126" href="#126">126</a>       <strong class="jxr_keyword">if</strong> (entry.getKey().equals(<span class="jxr_string">"B"</span>)) assertEquals(<span class="jxr_string">"2b"</span>, entry.getValue());
+<a class="jxr_linenumber" name="127" href="#127">127</a>       <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (entry.getKey().equals(<span class="jxr_string">"G"</span>)) assertEquals(<strong class="jxr_keyword">null</strong>, entry.getValue());
+<a class="jxr_linenumber" name="128" href="#128">128</a>     }
+<a class="jxr_linenumber" name="129" href="#129">129</a>     <em class="jxr_comment">// verify that entries from ImmutableConfigMap's are merged in the iterator's view</em>
+<a class="jxr_linenumber" name="130" href="#130">130</a>     assertEquals(baseConfSize + 2, cnt);
+<a class="jxr_linenumber" name="131" href="#131">131</a>   }
+<a class="jxr_linenumber" name="132" href="#132">132</a> 
+<a class="jxr_linenumber" name="133" href="#133">133</a>   @Test
+<a class="jxr_linenumber" name="134" href="#134">134</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testWithStringMap() {
+<a class="jxr_linenumber" name="135" href="#135">135</a>     Map&lt;String, String&gt; map = <strong class="jxr_keyword">new</strong> HashMap&lt;String, String&gt;();
+<a class="jxr_linenumber" name="136" href="#136">136</a>     map.put(<span class="jxr_string">"B"</span>, <span class="jxr_string">"2b"</span>);
+<a class="jxr_linenumber" name="137" href="#137">137</a>     map.put(<span class="jxr_string">"C"</span>, <span class="jxr_string">"33"</span>);
+<a class="jxr_linenumber" name="138" href="#138">138</a>     map.put(<span class="jxr_string">"D"</span>, <span class="jxr_string">"4"</span>);
+<a class="jxr_linenumber" name="139" href="#139">139</a>     <em class="jxr_comment">// unlike config, note that IBW Maps can accept null values</em>
+<a class="jxr_linenumber" name="140" href="#140">140</a>     map.put(<span class="jxr_string">"G"</span>, <strong class="jxr_keyword">null</strong>);
+<a class="jxr_linenumber" name="141" href="#141">141</a> 
+<a class="jxr_linenumber" name="142" href="#142">142</a>     CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration().addStringMap(map);
+<a class="jxr_linenumber" name="143" href="#143">143</a>     assertEquals(<span class="jxr_string">"2b"</span>, compoundConf.get(<span class="jxr_string">"B"</span>));
+<a class="jxr_linenumber" name="144" href="#144">144</a>     assertEquals(33, compoundConf.getInt(<span class="jxr_string">"C"</span>, 0));
+<a class="jxr_linenumber" name="145" href="#145">145</a>     assertEquals(<span class="jxr_string">"4"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
+<a class="jxr_linenumber" name="146" href="#146">146</a>     assertEquals(4, compoundConf.getInt(<span class="jxr_string">"D"</span>, 0));
+<a class="jxr_linenumber" name="147" href="#147">147</a>     assertNull(compoundConf.get(<span class="jxr_string">"E"</span>));
+<a class="jxr_linenumber" name="148" href="#148">148</a>     assertEquals(6, compoundConf.getInt(<span class="jxr_string">"F"</span>, 6));
+<a class="jxr_linenumber" name="149" href="#149">149</a>     assertNull(compoundConf.get(<span class="jxr_string">"G"</span>));
+<a class="jxr_linenumber" name="150" href="#150">150</a> 
+<a class="jxr_linenumber" name="151" href="#151">151</a>     <strong class="jxr_keyword">int</strong> cnt = 0;
+<a class="jxr_linenumber" name="152" href="#152">152</a>     <strong class="jxr_keyword">for</strong> (Map.Entry&lt;String,String&gt; entry : compoundConf) {
+<a class="jxr_linenumber" name="153" href="#153">153</a>       cnt++;
+<a class="jxr_linenumber" name="154" href="#154">154</a>       <strong class="jxr_keyword">if</strong> (entry.getKey().equals(<span class="jxr_string">"B"</span>)) assertEquals(<span class="jxr_string">"2b"</span>, entry.getValue());
+<a class="jxr_linenumber" name="155" href="#155">155</a>       <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (entry.getKey().equals(<span class="jxr_string">"G"</span>)) assertEquals(<strong class="jxr_keyword">null</strong>, entry.getValue());
+<a class="jxr_linenumber" name="156" href="#156">156</a>     }
+<a class="jxr_linenumber" name="157" href="#157">157</a>     <em class="jxr_comment">// verify that entries from ImmutableConfigMap's are merged in the iterator's view</em>
+<a class="jxr_linenumber" name="158" href="#158">158</a>     assertEquals(4, cnt);
+<a class="jxr_linenumber" name="159" href="#159">159</a>   }
+<a class="jxr_linenumber" name="160" href="#160">160</a> 
+<a class="jxr_linenumber" name="161" href="#161">161</a>   @Test
+<a class="jxr_linenumber" name="162" href="#162">162</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testLaterConfigsOverrideEarlier() {
+<a class="jxr_linenumber" name="163" href="#163">163</a>     Map&lt;String, String&gt; map1 = <strong class="jxr_keyword">new</strong> HashMap&lt;String, String&gt;();
+<a class="jxr_linenumber" name="164" href="#164">164</a>     map1.put(<span class="jxr_string">"A"</span>, <span class="jxr_string">"2"</span>);
+<a class="jxr_linenumber" name="165" href="#165">165</a>     map1.put(<span class="jxr_string">"D"</span>, <span class="jxr_string">"5"</span>);
+<a class="jxr_linenumber" name="166" href="#166">166</a>     Map&lt;String, String&gt; map2 = <strong class="jxr_keyword">new</strong> HashMap&lt;String, String&gt;();
+<a class="jxr_linenumber" name="167" href="#167">167</a>     String newValueForA = <span class="jxr_string">"3"</span>, newValueForB = <span class="jxr_string">"4"</span>;
+<a class="jxr_linenumber" name="168" href="#168">168</a>     map2.put(<span class="jxr_string">"A"</span>, newValueForA);
+<a class="jxr_linenumber" name="169" href="#169">169</a>     map2.put(<span class="jxr_string">"B"</span>, newValueForB);
+<a class="jxr_linenumber" name="170" href="#170">170</a> 
+<a class="jxr_linenumber" name="171" href="#171">171</a>     CompoundConfiguration compoundConf = <strong class="jxr_keyword">new</strong> CompoundConfiguration()
+<a class="jxr_linenumber" name="172" href="#172">172</a>       .addStringMap(map1).add(baseConf);
+<a class="jxr_linenumber" name="173" href="#173">173</a>     assertEquals(<span class="jxr_string">"1"</span>, compoundConf.get(<span class="jxr_string">"A"</span>));
+<a class="jxr_linenumber" name="174" href="#174">174</a>     assertEquals(<span class="jxr_string">"5"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
+<a class="jxr_linenumber" name="175" href="#175">175</a>     compoundConf.addStringMap(map2);
+<a class="jxr_linenumber" name="176" href="#176">176</a>     assertEquals(newValueForA, compoundConf.get(<span class="jxr_string">"A"</span>));
+<a class="jxr_linenumber" name="177" href="#177">177</a>     assertEquals(newValueForB, compoundConf.get(<span class="jxr_string">"B"</span>));
+<a class="jxr_linenumber" name="178" href="#178">178</a>     assertEquals(<span class="jxr_string">"5"</span>, compoundConf.get(<span class="jxr_string">"D"</span>));
+<a class="jxr_linenumber" name="179" href="#179">179</a> 
+<a class="jxr_linenumber" name="180" href="#180">180</a>     <strong class="jxr_keyword">int</strong> cnt = 0;
+<a class="jxr_linenumber" name="181" href="#181">181</a>     <strong class="jxr_keyword">for</strong> (Map.Entry&lt;String,String&gt; entry : compoundConf) {
+<a class="jxr_linenumber" name="182" href="#182">182</a>       cnt++;
+<a class="jxr_linenumber" name="183" href="#183">183</a>       <strong class="jxr_keyword">if</strong> (entry.getKey().equals(<span class="jxr_string">"A"</span>)) assertEquals(newValueForA, entry.getValue());
+<a class="jxr_linenumber" name="184" href="#184">184</a>       <strong class="jxr_keyword">else</strong> <strong class="jxr_keyword">if</strong> (entry.getKey().equals(<span class="jxr_string">"B"</span>)) assertEquals(newValueForB, entry.getValue());
+<a class="jxr_linenumber" name="185" href="#185">185</a>     }
+<a class="jxr_linenumber" name="186" href="#186">186</a>     <em class="jxr_comment">// verify that entries from ImmutableConfigMap's are merged in the iterator's view</em>
+<a class="jxr_linenumber" name="187" href="#187">187</a>     assertEquals(baseConfSize + 1, cnt);
+<a class="jxr_linenumber" name="188" href="#188">188</a>   }
+<a class="jxr_linenumber" name="189" href="#189">189</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/client/TestHCM.html
URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/client/TestHCM.html?rev=1465198&r1=1465197&r2=1465198&view=diff
==============================================================================
--- hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/client/TestHCM.html (original)
+++ hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/client/TestHCM.html Sat Apr  6 06:06:07 2013
@@ -28,43 +28,43 @@
 <a class="jxr_linenumber" name="18" href="#18">18</a>  <em class="jxr_comment"> */</em>
 <a class="jxr_linenumber" name="19" href="#19">19</a>  <strong class="jxr_keyword">package</strong> org.apache.hadoop.hbase.client;
 <a class="jxr_linenumber" name="20" href="#20">20</a>  
-<a class="jxr_linenumber" name="21" href="#21">21</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertFalse;
-<a class="jxr_linenumber" name="22" href="#22">22</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertNotNull;
-<a class="jxr_linenumber" name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertNull;
-<a class="jxr_linenumber" name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertTrue;
-<a class="jxr_linenumber" name="25" href="#25">25</a>  
-<a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> java.io.IOException;
-<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> java.lang.reflect.Field;
-<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> java.lang.reflect.Modifier;
-<a class="jxr_linenumber" name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> java.util.ArrayList;
-<a class="jxr_linenumber" name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> java.util.Arrays;
-<a class="jxr_linenumber" name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> java.util.HashMap;
-<a class="jxr_linenumber" name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> java.util.List;
-<a class="jxr_linenumber" name="33" href="#33">33</a>  <strong class="jxr_keyword">import</strong> java.util.Map;
-<a class="jxr_linenumber" name="34" href="#34">34</a>  <strong class="jxr_keyword">import</strong> java.util.Random;
-<a class="jxr_linenumber" name="35" href="#35">35</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.SynchronousQueue;
-<a class="jxr_linenumber" name="36" href="#36">36</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.ThreadPoolExecutor;
-<a class="jxr_linenumber" name="37" href="#37">37</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.TimeUnit;
-<a class="jxr_linenumber" name="38" href="#38">38</a>  
-<a class="jxr_linenumber" name="39" href="#39">39</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log;
-<a class="jxr_linenumber" name="40" href="#40">40</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory;
-<a class="jxr_linenumber" name="41" href="#41">41</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.conf.Configuration;
-<a class="jxr_linenumber" name="42" href="#42">42</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HBaseConfiguration;
-<a class="jxr_linenumber" name="43" href="#43">43</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HBaseTestingUtility;
-<a class="jxr_linenumber" name="44" href="#44">44</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HConstants;
-<a class="jxr_linenumber" name="45" href="#45">45</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HRegionLocation;
-<a class="jxr_linenumber" name="46" href="#46">46</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.MediumTests;
-<a class="jxr_linenumber" name="47" href="#47">47</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.ServerName;
-<a class="jxr_linenumber" name="48" href="#48">48</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.Waiter;
-<a class="jxr_linenumber" name="49" href="#49">49</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.client.HConnectionManager.HConnectionImplementation;
-<a class="jxr_linenumber" name="50" href="#50">50</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.client.HConnectionManager.HConnectionKey;
-<a class="jxr_linenumber" name="51" href="#51">51</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.exceptions.RegionServerStoppedException;
-<a class="jxr_linenumber" name="52" href="#52">52</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.exceptions.ZooKeeperConnectionException;
-<a class="jxr_linenumber" name="53" href="#53">53</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.master.ClusterStatusPublisher;
-<a class="jxr_linenumber" name="54" href="#54">54</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.master.HMaster;
-<a class="jxr_linenumber" name="55" href="#55">55</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.regionserver.HRegion;
-<a class="jxr_linenumber" name="56" href="#56">56</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.regionserver.HRegionServer;
-<a class="jxr_linenumber" name="57" href="#57">57</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes;
+<a class="jxr_linenumber" name="21" href="#21">21</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.*;
+<a class="jxr_linenumber" name="22" href="#22">22</a>  
+<a class="jxr_linenumber" name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> java.io.IOException;
+<a class="jxr_linenumber" name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> java.lang.reflect.Field;
+<a class="jxr_linenumber" name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> java.lang.reflect.Modifier;
+<a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> java.util.ArrayList;
+<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> java.util.Arrays;
+<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> java.util.HashMap;
+<a class="jxr_linenumber" name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> java.util.List;
+<a class="jxr_linenumber" name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> java.util.Map;
+<a class="jxr_linenumber" name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> java.util.Random;
+<a class="jxr_linenumber" name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.SynchronousQueue;
+<a class="jxr_linenumber" name="33" href="#33">33</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.ThreadPoolExecutor;
+<a class="jxr_linenumber" name="34" href="#34">34</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.TimeUnit;
+<a class="jxr_linenumber" name="35" href="#35">35</a>  
+<a class="jxr_linenumber" name="36" href="#36">36</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log;
+<a class="jxr_linenumber" name="37" href="#37">37</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory;
+<a class="jxr_linenumber" name="38" href="#38">38</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.conf.Configuration;
+<a class="jxr_linenumber" name="39" href="#39">39</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HBaseConfiguration;
+<a class="jxr_linenumber" name="40" href="#40">40</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HBaseTestingUtility;
+<a class="jxr_linenumber" name="41" href="#41">41</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HConstants;
+<a class="jxr_linenumber" name="42" href="#42">42</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HRegionInfo;
+<a class="jxr_linenumber" name="43" href="#43">43</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HRegionLocation;
+<a class="jxr_linenumber" name="44" href="#44">44</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.MediumTests;
+<a class="jxr_linenumber" name="45" href="#45">45</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.ServerName;
+<a class="jxr_linenumber" name="46" href="#46">46</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.Waiter;
+<a class="jxr_linenumber" name="47" href="#47">47</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.client.HConnectionManager.HConnectionImplementation;
+<a class="jxr_linenumber" name="48" href="#48">48</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.client.HConnectionManager.HConnectionKey;
+<a class="jxr_linenumber" name="49" href="#49">49</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.exceptions.RegionServerStoppedException;
+<a class="jxr_linenumber" name="50" href="#50">50</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.exceptions.ZooKeeperConnectionException;
+<a class="jxr_linenumber" name="51" href="#51">51</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.master.ClusterStatusPublisher;
+<a class="jxr_linenumber" name="52" href="#52">52</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.master.HMaster;
+<a class="jxr_linenumber" name="53" href="#53">53</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.regionserver.HRegion;
+<a class="jxr_linenumber" name="54" href="#54">54</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.regionserver.HRegionServer;
+<a class="jxr_linenumber" name="55" href="#55">55</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes;
+<a class="jxr_linenumber" name="56" href="#56">56</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.EnvironmentEdgeManager;
+<a class="jxr_linenumber" name="57" href="#57">57</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.ManualEnvironmentEdge;
 <a class="jxr_linenumber" name="58" href="#58">58</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.JVMClusterUtil;
 <a class="jxr_linenumber" name="59" href="#59">59</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Threads;
 <a class="jxr_linenumber" name="60" href="#60">60</a>  <strong class="jxr_keyword">import</strong> org.junit.AfterClass;
@@ -314,13 +314,13 @@
 <a class="jxr_linenumber" name="304" href="#304">304</a> 
 <a class="jxr_linenumber" name="305" href="#305">305</a>     <em class="jxr_comment">// Hijack the number of retry to fail immediately instead of retrying: there will be no new</em>
 <a class="jxr_linenumber" name="306" href="#306">306</a>     <em class="jxr_comment">//  connection to the master</em>
-<a class="jxr_linenumber" name="307" href="#307">307</a>     Field numRetries = conn.getClass().getDeclaredField(<span class="jxr_string">"numRetries"</span>);
-<a class="jxr_linenumber" name="308" href="#308">308</a>     numRetries.setAccessible(<strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="307" href="#307">307</a>     Field numTries = conn.getClass().getDeclaredField(<span class="jxr_string">"numTries"</span>);
+<a class="jxr_linenumber" name="308" href="#308">308</a>     numTries.setAccessible(<strong class="jxr_keyword">true</strong>);
 <a class="jxr_linenumber" name="309" href="#309">309</a>     Field modifiersField = Field.<strong class="jxr_keyword">class</strong>.getDeclaredField(<span class="jxr_string">"modifiers"</span>);
 <a class="jxr_linenumber" name="310" href="#310">310</a>     modifiersField.setAccessible(<strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="311" href="#311">311</a>     modifiersField.setInt(numRetries, numRetries.getModifiers() &amp; ~Modifier.FINAL);
-<a class="jxr_linenumber" name="312" href="#312">312</a>     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> prevNumRetriesVal = (Integer)numRetries.get(conn);
-<a class="jxr_linenumber" name="313" href="#313">313</a>     numRetries.set(conn, 1);
+<a class="jxr_linenumber" name="311" href="#311">311</a>     modifiersField.setInt(numTries, numTries.getModifiers() &amp; ~Modifier.FINAL);
+<a class="jxr_linenumber" name="312" href="#312">312</a>     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> prevNumRetriesVal = (Integer)numTries.get(conn);
+<a class="jxr_linenumber" name="313" href="#313">313</a>     numTries.set(conn, 1);
 <a class="jxr_linenumber" name="314" href="#314">314</a> 
 <a class="jxr_linenumber" name="315" href="#315">315</a>     <em class="jxr_comment">// We do a put and expect the cache to be updated, even if we don't retry</em>
 <a class="jxr_linenumber" name="316" href="#316">316</a>     LOG.info(<span class="jxr_string">"Put starting"</span>);
@@ -389,7 +389,7 @@
 <a class="jxr_linenumber" name="379" href="#379">379</a>       <span class="jxr_string">"Previous server was "</span>+destServer.getServerName().getHostAndPort(),
 <a class="jxr_linenumber" name="380" href="#380">380</a>       curServer.getServerName().getPort(), conn.getCachedLocation(TABLE_NAME, ROW).getPort());
 <a class="jxr_linenumber" name="381" href="#381">381</a> 
-<a class="jxr_linenumber" name="382" href="#382">382</a>     numRetries.set(conn, prevNumRetriesVal);
+<a class="jxr_linenumber" name="382" href="#382">382</a>     numTries.set(conn, prevNumRetriesVal);
 <a class="jxr_linenumber" name="383" href="#383">383</a>     table.close();
 <a class="jxr_linenumber" name="384" href="#384">384</a>   }
 <a class="jxr_linenumber" name="385" href="#385">385</a> 
@@ -715,13 +715,13 @@
 <a class="jxr_linenumber" name="705" href="#705">705</a>         conn.getCachedLocation(TABLE_NAME3, ROW_X).getPort() == destServerName.getPort());
 <a class="jxr_linenumber" name="706" href="#706">706</a> 
 <a class="jxr_linenumber" name="707" href="#707">707</a>     <em class="jxr_comment">// Hijack the number of retry to fail after 2 tries</em>
-<a class="jxr_linenumber" name="708" href="#708">708</a>     Field numRetries = conn.getClass().getDeclaredField(<span class="jxr_string">"numRetries"</span>);
-<a class="jxr_linenumber" name="709" href="#709">709</a>     numRetries.setAccessible(<strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="708" href="#708">708</a>     Field numTries = conn.getClass().getDeclaredField(<span class="jxr_string">"numTries"</span>);
+<a class="jxr_linenumber" name="709" href="#709">709</a>     numTries.setAccessible(<strong class="jxr_keyword">true</strong>);
 <a class="jxr_linenumber" name="710" href="#710">710</a>     Field modifiersField = Field.<strong class="jxr_keyword">class</strong>.getDeclaredField(<span class="jxr_string">"modifiers"</span>);
 <a class="jxr_linenumber" name="711" href="#711">711</a>     modifiersField.setAccessible(<strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="712" href="#712">712</a>     modifiersField.setInt(numRetries, numRetries.getModifiers() &amp; ~Modifier.FINAL);
-<a class="jxr_linenumber" name="713" href="#713">713</a>     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> prevNumRetriesVal = (Integer)numRetries.get(conn);
-<a class="jxr_linenumber" name="714" href="#714">714</a>     numRetries.set(conn, 2);
+<a class="jxr_linenumber" name="712" href="#712">712</a>     modifiersField.setInt(numTries, numTries.getModifiers() &amp; ~Modifier.FINAL);
+<a class="jxr_linenumber" name="713" href="#713">713</a>     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> prevNumRetriesVal = (Integer)numTries.get(conn);
+<a class="jxr_linenumber" name="714" href="#714">714</a>     numTries.set(conn, 2);
 <a class="jxr_linenumber" name="715" href="#715">715</a> 
 <a class="jxr_linenumber" name="716" href="#716">716</a>     Put put3 = <strong class="jxr_keyword">new</strong> Put(ROW_X);
 <a class="jxr_linenumber" name="717" href="#717">717</a>     put3.add(FAM_NAM, ROW_X, ROW_X);
@@ -732,13 +732,86 @@
 <a class="jxr_linenumber" name="722" href="#722">722</a>     table.batch(Lists.newArrayList(put4, put3)); <em class="jxr_comment">// first should be a valid row,</em>
 <a class="jxr_linenumber" name="723" href="#723">723</a>                                                  <em class="jxr_comment">// second we get RegionMovedException.</em>
 <a class="jxr_linenumber" name="724" href="#724">724</a> 
-<a class="jxr_linenumber" name="725" href="#725">725</a>     numRetries.set(conn, prevNumRetriesVal);
+<a class="jxr_linenumber" name="725" href="#725">725</a>     numTries.set(conn, prevNumRetriesVal);
 <a class="jxr_linenumber" name="726" href="#726">726</a>     table.close();
 <a class="jxr_linenumber" name="727" href="#727">727</a>     conn.close();
 <a class="jxr_linenumber" name="728" href="#728">728</a>   }
 <a class="jxr_linenumber" name="729" href="#729">729</a> 
-<a class="jxr_linenumber" name="730" href="#730">730</a> }
-<a class="jxr_linenumber" name="731" href="#731">731</a> 
+<a class="jxr_linenumber" name="730" href="#730">730</a>   @Test
+<a class="jxr_linenumber" name="731" href="#731">731</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testErrorBackoffTimeCalculation() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="732" href="#732">732</a>     <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> ANY_PAUSE = 1000;
+<a class="jxr_linenumber" name="733" href="#733">733</a>     HRegionInfo ri = <strong class="jxr_keyword">new</strong> HRegionInfo(TABLE_NAME);
+<a class="jxr_linenumber" name="734" href="#734">734</a>     HRegionLocation location = <strong class="jxr_keyword">new</strong> HRegionLocation(ri, <strong class="jxr_keyword">new</strong> ServerName(<span class="jxr_string">"127.0.0.1"</span>, 1, 0));
+<a class="jxr_linenumber" name="735" href="#735">735</a>     HRegionLocation diffLocation = <strong class="jxr_keyword">new</strong> HRegionLocation(ri, <strong class="jxr_keyword">new</strong> ServerName(<span class="jxr_string">"127.0.0.1"</span>, 2, 0));
+<a class="jxr_linenumber" name="736" href="#736">736</a> 
+<a class="jxr_linenumber" name="737" href="#737">737</a>     ManualEnvironmentEdge timeMachine = <strong class="jxr_keyword">new</strong> ManualEnvironmentEdge();
+<a class="jxr_linenumber" name="738" href="#738">738</a>     EnvironmentEdgeManager.injectEdge(timeMachine);
+<a class="jxr_linenumber" name="739" href="#739">739</a>     <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="740" href="#740">740</a>       <strong class="jxr_keyword">long</strong> timeBase = timeMachine.currentTimeMillis();
+<a class="jxr_linenumber" name="741" href="#741">741</a>       <strong class="jxr_keyword">long</strong> largeAmountOfTime = ANY_PAUSE * 1000;
+<a class="jxr_linenumber" name="742" href="#742">742</a>       HConnectionImplementation.ServerErrorTracker tracker =
+<a class="jxr_linenumber" name="743" href="#743">743</a>           <strong class="jxr_keyword">new</strong> HConnectionImplementation.ServerErrorTracker(largeAmountOfTime);
+<a class="jxr_linenumber" name="744" href="#744">744</a> 
+<a class="jxr_linenumber" name="745" href="#745">745</a>       <em class="jxr_comment">// The default backoff is 0.</em>
+<a class="jxr_linenumber" name="746" href="#746">746</a>       assertEquals(0, tracker.calculateBackoffTime(location, ANY_PAUSE));
+<a class="jxr_linenumber" name="747" href="#747">747</a> 
+<a class="jxr_linenumber" name="748" href="#748">748</a>       <em class="jxr_comment">// Check some backoff values from HConstants sequence.</em>
+<a class="jxr_linenumber" name="749" href="#749">749</a>       tracker.reportServerError(location);
+<a class="jxr_linenumber" name="750" href="#750">750</a>       assertEqualsWithJitter(ANY_PAUSE, tracker.calculateBackoffTime(location, ANY_PAUSE));
+<a class="jxr_linenumber" name="751" href="#751">751</a>       tracker.reportServerError(location);
+<a class="jxr_linenumber" name="752" href="#752">752</a>       tracker.reportServerError(location);
+<a class="jxr_linenumber" name="753" href="#753">753</a>       tracker.reportServerError(location);
+<a class="jxr_linenumber" name="754" href="#754">754</a>       assertEqualsWithJitter(ANY_PAUSE * 2, tracker.calculateBackoffTime(location, ANY_PAUSE));
+<a class="jxr_linenumber" name="755" href="#755">755</a> 
+<a class="jxr_linenumber" name="756" href="#756">756</a>       <em class="jxr_comment">// All of this shouldn't affect backoff for different location.</em>
+<a class="jxr_linenumber" name="757" href="#757">757</a> 
+<a class="jxr_linenumber" name="758" href="#758">758</a>       assertEquals(0, tracker.calculateBackoffTime(diffLocation, ANY_PAUSE));
+<a class="jxr_linenumber" name="759" href="#759">759</a>       tracker.reportServerError(diffLocation);
+<a class="jxr_linenumber" name="760" href="#760">760</a>       assertEqualsWithJitter(ANY_PAUSE, tracker.calculateBackoffTime(diffLocation, ANY_PAUSE));
+<a class="jxr_linenumber" name="761" href="#761">761</a> 
+<a class="jxr_linenumber" name="762" href="#762">762</a>       <em class="jxr_comment">// But should still work for a different region in the same location.</em>
+<a class="jxr_linenumber" name="763" href="#763">763</a>       HRegionInfo ri2 = <strong class="jxr_keyword">new</strong> HRegionInfo(TABLE_NAME2);
+<a class="jxr_linenumber" name="764" href="#764">764</a>       HRegionLocation diffRegion = <strong class="jxr_keyword">new</strong> HRegionLocation(ri2, location.getServerName());
+<a class="jxr_linenumber" name="765" href="#765">765</a>       assertEqualsWithJitter(ANY_PAUSE * 2, tracker.calculateBackoffTime(diffRegion, ANY_PAUSE));
+<a class="jxr_linenumber" name="766" href="#766">766</a> 
+<a class="jxr_linenumber" name="767" href="#767">767</a>       <em class="jxr_comment">// Check with different base.</em>
+<a class="jxr_linenumber" name="768" href="#768">768</a>       assertEqualsWithJitter(ANY_PAUSE * 4,
+<a class="jxr_linenumber" name="769" href="#769">769</a>           tracker.calculateBackoffTime(location, ANY_PAUSE * 2));
+<a class="jxr_linenumber" name="770" href="#770">770</a> 
+<a class="jxr_linenumber" name="771" href="#771">771</a>       <em class="jxr_comment">// See that time from last error is taken into account. Time shift is applied after jitter,</em>
+<a class="jxr_linenumber" name="772" href="#772">772</a>       <em class="jxr_comment">// so pass the original expected backoff as the base for jitter.</em>
+<a class="jxr_linenumber" name="773" href="#773">773</a>       <strong class="jxr_keyword">long</strong> timeShift = (<strong class="jxr_keyword">long</strong>)(ANY_PAUSE * 0.5);
+<a class="jxr_linenumber" name="774" href="#774">774</a>       timeMachine.setValue(timeBase + timeShift);
+<a class="jxr_linenumber" name="775" href="#775">775</a>       assertEqualsWithJitter(ANY_PAUSE * 2 - timeShift,
+<a class="jxr_linenumber" name="776" href="#776">776</a>         tracker.calculateBackoffTime(location, ANY_PAUSE), ANY_PAUSE * 2);
+<a class="jxr_linenumber" name="777" href="#777">777</a> 
+<a class="jxr_linenumber" name="778" href="#778">778</a>       <em class="jxr_comment">// However we should not go into negative.</em>
+<a class="jxr_linenumber" name="779" href="#779">779</a>       timeMachine.setValue(timeBase + ANY_PAUSE * 100);
+<a class="jxr_linenumber" name="780" href="#780">780</a>       assertEquals(0, tracker.calculateBackoffTime(location, ANY_PAUSE));
+<a class="jxr_linenumber" name="781" href="#781">781</a> 
+<a class="jxr_linenumber" name="782" href="#782">782</a>       <em class="jxr_comment">// We also should not go over the boundary; last retry would be on it.</em>
+<a class="jxr_linenumber" name="783" href="#783">783</a>       <strong class="jxr_keyword">long</strong> timeLeft = (<strong class="jxr_keyword">long</strong>)(ANY_PAUSE * 0.5);
+<a class="jxr_linenumber" name="784" href="#784">784</a>       timeMachine.setValue(timeBase + largeAmountOfTime - timeLeft);
+<a class="jxr_linenumber" name="785" href="#785">785</a>       assertTrue(tracker.canRetryMore());
+<a class="jxr_linenumber" name="786" href="#786">786</a>       tracker.reportServerError(location);
+<a class="jxr_linenumber" name="787" href="#787">787</a>       assertEquals(timeLeft, tracker.calculateBackoffTime(location, ANY_PAUSE));
+<a class="jxr_linenumber" name="788" href="#788">788</a>       timeMachine.setValue(timeBase + largeAmountOfTime);
+<a class="jxr_linenumber" name="789" href="#789">789</a>       assertFalse(tracker.canRetryMore());
+<a class="jxr_linenumber" name="790" href="#790">790</a>     } <strong class="jxr_keyword">finally</strong> {
+<a class="jxr_linenumber" name="791" href="#791">791</a>       EnvironmentEdgeManager.reset();
+<a class="jxr_linenumber" name="792" href="#792">792</a>     }
+<a class="jxr_linenumber" name="793" href="#793">793</a>   }
+<a class="jxr_linenumber" name="794" href="#794">794</a> 
+<a class="jxr_linenumber" name="795" href="#795">795</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> assertEqualsWithJitter(<strong class="jxr_keyword">long</strong> expected, <strong class="jxr_keyword">long</strong> actual) {
+<a class="jxr_linenumber" name="796" href="#796">796</a>     assertEqualsWithJitter(expected, actual, expected);
+<a class="jxr_linenumber" name="797" href="#797">797</a>   }
+<a class="jxr_linenumber" name="798" href="#798">798</a> 
+<a class="jxr_linenumber" name="799" href="#799">799</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> assertEqualsWithJitter(<strong class="jxr_keyword">long</strong> expected, <strong class="jxr_keyword">long</strong> actual, <strong class="jxr_keyword">long</strong> jitterBase) {
+<a class="jxr_linenumber" name="800" href="#800">800</a>     assertTrue(<span class="jxr_string">"Value not within jitter: "</span> + expected + <span class="jxr_string">" vs "</span> + actual,
+<a class="jxr_linenumber" name="801" href="#801">801</a>         Math.abs(actual - expected) &lt;= (0.01f * jitterBase));
+<a class="jxr_linenumber" name="802" href="#802">802</a>   }
+<a class="jxr_linenumber" name="803" href="#803">803</a> }
+<a class="jxr_linenumber" name="804" href="#804">804</a> 
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.html
URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.html?rev=1465198&r1=1465197&r2=1465198&view=diff
==============================================================================
--- hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.html (original)
+++ hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.html Sat Apr  6 06:06:07 2013
@@ -27,106 +27,85 @@
 <a class="jxr_linenumber" name="17" href="#17">17</a>  <em class="jxr_javadoccomment"> */</em>
 <a class="jxr_linenumber" name="18" href="#18">18</a>  <strong class="jxr_keyword">package</strong> org.apache.hadoop.hbase.client.replication;
 <a class="jxr_linenumber" name="19" href="#19">19</a>  
-<a class="jxr_linenumber" name="20" href="#20">20</a>  <strong class="jxr_keyword">import</strong> java.util.concurrent.atomic.AtomicBoolean;
-<a class="jxr_linenumber" name="21" href="#21">21</a>  
-<a class="jxr_linenumber" name="22" href="#22">22</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log;
-<a class="jxr_linenumber" name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory;
-<a class="jxr_linenumber" name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.conf.Configuration;
-<a class="jxr_linenumber" name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.fs.FileSystem;
-<a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.fs.Path;
-<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.*;
-<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.replication.regionserver.ReplicationSourceManager;
-<a class="jxr_linenumber" name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> org.junit.BeforeClass;
-<a class="jxr_linenumber" name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> org.junit.Test;
-<a class="jxr_linenumber" name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> org.junit.experimental.categories.Category;
-<a class="jxr_linenumber" name="32" href="#32">32</a>  
-<a class="jxr_linenumber" name="33" href="#33">33</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.fail;
-<a class="jxr_linenumber" name="34" href="#34">34</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertEquals;
-<a class="jxr_linenumber" name="35" href="#35">35</a>  
-<a class="jxr_linenumber" name="36" href="#36">36</a>  <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="37" href="#37">37</a>  <em class="jxr_javadoccomment"> * Unit testing of ReplicationAdmin</em>
-<a class="jxr_linenumber" name="38" href="#38">38</a>  <em class="jxr_javadoccomment"> */</em>
-<a class="jxr_linenumber" name="39" href="#39">39</a>  @Category(MediumTests.<strong class="jxr_keyword">class</strong>)
-<a class="jxr_linenumber" name="40" href="#40">40</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.html">TestReplicationAdmin</a> {
+<a class="jxr_linenumber" name="20" href="#20">20</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log;
+<a class="jxr_linenumber" name="21" href="#21">21</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory;
+<a class="jxr_linenumber" name="22" href="#22">22</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.conf.Configuration;
+<a class="jxr_linenumber" name="23" href="#23">23</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.*;
+<a class="jxr_linenumber" name="24" href="#24">24</a>  <strong class="jxr_keyword">import</strong> org.junit.BeforeClass;
+<a class="jxr_linenumber" name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.junit.Test;
+<a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> org.junit.experimental.categories.Category;
+<a class="jxr_linenumber" name="27" href="#27">27</a>  
+<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.fail;
+<a class="jxr_linenumber" name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertEquals;
+<a class="jxr_linenumber" name="30" href="#30">30</a>  
+<a class="jxr_linenumber" name="31" href="#31">31</a>  <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="32" href="#32">32</a>  <em class="jxr_javadoccomment"> * Unit testing of ReplicationAdmin</em>
+<a class="jxr_linenumber" name="33" href="#33">33</a>  <em class="jxr_javadoccomment"> */</em>
+<a class="jxr_linenumber" name="34" href="#34">34</a>  @Category(MediumTests.<strong class="jxr_keyword">class</strong>)
+<a class="jxr_linenumber" name="35" href="#35">35</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/hadoop/hbase/client/replication/TestReplicationAdmin.html">TestReplicationAdmin</a> {
+<a class="jxr_linenumber" name="36" href="#36">36</a>  
+<a class="jxr_linenumber" name="37" href="#37">37</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> Log LOG =
+<a class="jxr_linenumber" name="38" href="#38">38</a>        LogFactory.getLog(TestReplicationAdmin.<strong class="jxr_keyword">class</strong>);
+<a class="jxr_linenumber" name="39" href="#39">39</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">static</strong> <a href="../../../../../../org/apache/hadoop/hbase/HBaseTestingUtility.html">HBaseTestingUtility</a> TEST_UTIL =
+<a class="jxr_linenumber" name="40" href="#40">40</a>        <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/HBaseTestingUtility.html">HBaseTestingUtility</a>();
 <a class="jxr_linenumber" name="41" href="#41">41</a>  
-<a class="jxr_linenumber" name="42" href="#42">42</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> Log LOG =
-<a class="jxr_linenumber" name="43" href="#43">43</a>        LogFactory.getLog(TestReplicationAdmin.<strong class="jxr_keyword">class</strong>);
-<a class="jxr_linenumber" name="44" href="#44">44</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">static</strong> <a href="../../../../../../org/apache/hadoop/hbase/HBaseTestingUtility.html">HBaseTestingUtility</a> TEST_UTIL =
-<a class="jxr_linenumber" name="45" href="#45">45</a>        <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/HBaseTestingUtility.html">HBaseTestingUtility</a>();
+<a class="jxr_linenumber" name="42" href="#42">42</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String ID_ONE = <span class="jxr_string">"1"</span>;
+<a class="jxr_linenumber" name="43" href="#43">43</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String KEY_ONE = <span class="jxr_string">"127.0.0.1:2181:/hbase"</span>;
+<a class="jxr_linenumber" name="44" href="#44">44</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String ID_SECOND = <span class="jxr_string">"2"</span>;
+<a class="jxr_linenumber" name="45" href="#45">45</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String KEY_SECOND = <span class="jxr_string">"127.0.0.1:2181:/hbase2"</span>;
 <a class="jxr_linenumber" name="46" href="#46">46</a>  
-<a class="jxr_linenumber" name="47" href="#47">47</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String ID_ONE = <span class="jxr_string">"1"</span>;
-<a class="jxr_linenumber" name="48" href="#48">48</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String KEY_ONE = <span class="jxr_string">"127.0.0.1:2181:/hbase"</span>;
-<a class="jxr_linenumber" name="49" href="#49">49</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String ID_SECOND = <span class="jxr_string">"2"</span>;
-<a class="jxr_linenumber" name="50" href="#50">50</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> String KEY_SECOND = <span class="jxr_string">"127.0.0.1:2181:/hbase2"</span>;
-<a class="jxr_linenumber" name="51" href="#51">51</a>  
-<a class="jxr_linenumber" name="52" href="#52">52</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> ReplicationSourceManager manager;
-<a class="jxr_linenumber" name="53" href="#53">53</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> ReplicationAdmin admin;
-<a class="jxr_linenumber" name="54" href="#54">54</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> AtomicBoolean replicating = <strong class="jxr_keyword">new</strong> AtomicBoolean(<strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="55" href="#55">55</a>  
-<a class="jxr_linenumber" name="56" href="#56">56</a>    <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="57" href="#57">57</a>  <em class="jxr_javadoccomment">   * @throws java.lang.Exception</em>
-<a class="jxr_linenumber" name="58" href="#58">58</a>  <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="59" href="#59">59</a>    @BeforeClass
-<a class="jxr_linenumber" name="60" href="#60">60</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> setUpBeforeClass() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="61" href="#61">61</a>      TEST_UTIL.startMiniZKCluster();
-<a class="jxr_linenumber" name="62" href="#62">62</a>      Configuration conf = TEST_UTIL.getConfiguration();
-<a class="jxr_linenumber" name="63" href="#63">63</a>      conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, <strong class="jxr_keyword">true</strong>);
-<a class="jxr_linenumber" name="64" href="#64">64</a>      admin = <strong class="jxr_keyword">new</strong> ReplicationAdmin(conf);
-<a class="jxr_linenumber" name="65" href="#65">65</a>      Path oldLogDir = <strong class="jxr_keyword">new</strong> Path(TEST_UTIL.getDataTestDir(),
-<a class="jxr_linenumber" name="66" href="#66">66</a>          HConstants.HREGION_OLDLOGDIR_NAME);
-<a class="jxr_linenumber" name="67" href="#67">67</a>      Path logDir = <strong class="jxr_keyword">new</strong> Path(TEST_UTIL.getDataTestDir(),
-<a class="jxr_linenumber" name="68" href="#68">68</a>          HConstants.HREGION_LOGDIR_NAME);
-<a class="jxr_linenumber" name="69" href="#69">69</a>      manager = <strong class="jxr_keyword">new</strong> ReplicationSourceManager(admin.getReplicationZk(), conf,
-<a class="jxr_linenumber" name="70" href="#70">70</a>          <em class="jxr_comment">// The following stopper never stops so that we can respond</em>
-<a class="jxr_linenumber" name="71" href="#71">71</a>          <em class="jxr_comment">// to zk notification</em>
-<a class="jxr_linenumber" name="72" href="#72">72</a>          <strong class="jxr_keyword">new</strong> Stoppable() {
-<a class="jxr_linenumber" name="73" href="#73">73</a>            @Override
-<a class="jxr_linenumber" name="74" href="#74">74</a>            <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> stop(String why) {}
-<a class="jxr_linenumber" name="75" href="#75">75</a>            @Override
-<a class="jxr_linenumber" name="76" href="#76">76</a>            <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isStopped() {<strong class="jxr_keyword">return</strong> false;}
-<a class="jxr_linenumber" name="77" href="#77">77</a>          }, FileSystem.get(conf), replicating, logDir, oldLogDir);
-<a class="jxr_linenumber" name="78" href="#78">78</a>    }
-<a class="jxr_linenumber" name="79" href="#79">79</a>  
-<a class="jxr_linenumber" name="80" href="#80">80</a>    <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="81" href="#81">81</a>  <em class="jxr_javadoccomment">   * Simple testing of adding and removing peers, basically shows that</em>
-<a class="jxr_linenumber" name="82" href="#82">82</a>  <em class="jxr_javadoccomment">   * all interactions with ZK work</em>
-<a class="jxr_linenumber" name="83" href="#83">83</a>  <em class="jxr_javadoccomment">   * @throws Exception</em>
-<a class="jxr_linenumber" name="84" href="#84">84</a>  <em class="jxr_javadoccomment">   */</em>
-<a class="jxr_linenumber" name="85" href="#85">85</a>    @Test
-<a class="jxr_linenumber" name="86" href="#86">86</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testAddRemovePeer() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="87" href="#87">87</a>      assertEquals(0, manager.getSources().size());
-<a class="jxr_linenumber" name="88" href="#88">88</a>      <em class="jxr_comment">// Add a valid peer</em>
-<a class="jxr_linenumber" name="89" href="#89">89</a>      admin.addPeer(ID_ONE, KEY_ONE);
-<a class="jxr_linenumber" name="90" href="#90">90</a>      <em class="jxr_comment">// try adding the same (fails)</em>
-<a class="jxr_linenumber" name="91" href="#91">91</a>      <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="92" href="#92">92</a>        admin.addPeer(ID_ONE, KEY_ONE);
-<a class="jxr_linenumber" name="93" href="#93">93</a>      } <strong class="jxr_keyword">catch</strong> (IllegalArgumentException iae) {
-<a class="jxr_linenumber" name="94" href="#94">94</a>        <em class="jxr_comment">// OK!</em>
-<a class="jxr_linenumber" name="95" href="#95">95</a>      }
-<a class="jxr_linenumber" name="96" href="#96">96</a>      assertEquals(1, admin.getPeersCount());
-<a class="jxr_linenumber" name="97" href="#97">97</a>      <em class="jxr_comment">// Try to remove an inexisting peer</em>
-<a class="jxr_linenumber" name="98" href="#98">98</a>      <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="99" href="#99">99</a>        admin.removePeer(ID_SECOND);
-<a class="jxr_linenumber" name="100" href="#100">100</a>       fail();
-<a class="jxr_linenumber" name="101" href="#101">101</a>     } <strong class="jxr_keyword">catch</strong> (IllegalArgumentException iae) {
-<a class="jxr_linenumber" name="102" href="#102">102</a>       <em class="jxr_comment">// OK!</em>
-<a class="jxr_linenumber" name="103" href="#103">103</a>     }
-<a class="jxr_linenumber" name="104" href="#104">104</a>     assertEquals(1, admin.getPeersCount());
-<a class="jxr_linenumber" name="105" href="#105">105</a>     <em class="jxr_comment">// Add a second since multi-slave is supported</em>
-<a class="jxr_linenumber" name="106" href="#106">106</a>     <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="107" href="#107">107</a>       admin.addPeer(ID_SECOND, KEY_SECOND);
-<a class="jxr_linenumber" name="108" href="#108">108</a>     } <strong class="jxr_keyword">catch</strong> (IllegalStateException iae) {
-<a class="jxr_linenumber" name="109" href="#109">109</a>       fail();
-<a class="jxr_linenumber" name="110" href="#110">110</a>       <em class="jxr_comment">// OK!</em>
-<a class="jxr_linenumber" name="111" href="#111">111</a>     }
-<a class="jxr_linenumber" name="112" href="#112">112</a>     assertEquals(2, admin.getPeersCount());
-<a class="jxr_linenumber" name="113" href="#113">113</a>     <em class="jxr_comment">// Remove the first peer we added</em>
-<a class="jxr_linenumber" name="114" href="#114">114</a>     admin.removePeer(ID_ONE);
-<a class="jxr_linenumber" name="115" href="#115">115</a>     assertEquals(1, admin.getPeersCount());
-<a class="jxr_linenumber" name="116" href="#116">116</a>   }
-<a class="jxr_linenumber" name="117" href="#117">117</a> 
-<a class="jxr_linenumber" name="118" href="#118">118</a> }
-<a class="jxr_linenumber" name="119" href="#119">119</a> 
+<a class="jxr_linenumber" name="47" href="#47">47</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> ReplicationAdmin admin;
+<a class="jxr_linenumber" name="48" href="#48">48</a>  
+<a class="jxr_linenumber" name="49" href="#49">49</a>    <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="50" href="#50">50</a>  <em class="jxr_javadoccomment">   * @throws java.lang.Exception</em>
+<a class="jxr_linenumber" name="51" href="#51">51</a>  <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="52" href="#52">52</a>    @BeforeClass
+<a class="jxr_linenumber" name="53" href="#53">53</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> setUpBeforeClass() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="54" href="#54">54</a>      TEST_UTIL.startMiniZKCluster();
+<a class="jxr_linenumber" name="55" href="#55">55</a>      Configuration conf = TEST_UTIL.getConfiguration();
+<a class="jxr_linenumber" name="56" href="#56">56</a>      conf.setBoolean(HConstants.REPLICATION_ENABLE_KEY, <strong class="jxr_keyword">true</strong>);
+<a class="jxr_linenumber" name="57" href="#57">57</a>      admin = <strong class="jxr_keyword">new</strong> ReplicationAdmin(conf);
+<a class="jxr_linenumber" name="58" href="#58">58</a>    }
+<a class="jxr_linenumber" name="59" href="#59">59</a>  
+<a class="jxr_linenumber" name="60" href="#60">60</a>    <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="61" href="#61">61</a>  <em class="jxr_javadoccomment">   * Simple testing of adding and removing peers, basically shows that</em>
+<a class="jxr_linenumber" name="62" href="#62">62</a>  <em class="jxr_javadoccomment">   * all interactions with ZK work</em>
+<a class="jxr_linenumber" name="63" href="#63">63</a>  <em class="jxr_javadoccomment">   * @throws Exception</em>
+<a class="jxr_linenumber" name="64" href="#64">64</a>  <em class="jxr_javadoccomment">   */</em>
+<a class="jxr_linenumber" name="65" href="#65">65</a>    @Test
+<a class="jxr_linenumber" name="66" href="#66">66</a>    <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testAddRemovePeer() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="67" href="#67">67</a>      <em class="jxr_comment">// Add a valid peer</em>
+<a class="jxr_linenumber" name="68" href="#68">68</a>      admin.addPeer(ID_ONE, KEY_ONE);
+<a class="jxr_linenumber" name="69" href="#69">69</a>      <em class="jxr_comment">// try adding the same (fails)</em>
+<a class="jxr_linenumber" name="70" href="#70">70</a>      <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="71" href="#71">71</a>        admin.addPeer(ID_ONE, KEY_ONE);
+<a class="jxr_linenumber" name="72" href="#72">72</a>      } <strong class="jxr_keyword">catch</strong> (IllegalArgumentException iae) {
+<a class="jxr_linenumber" name="73" href="#73">73</a>        <em class="jxr_comment">// OK!</em>
+<a class="jxr_linenumber" name="74" href="#74">74</a>      }
+<a class="jxr_linenumber" name="75" href="#75">75</a>      assertEquals(1, admin.getPeersCount());
+<a class="jxr_linenumber" name="76" href="#76">76</a>      <em class="jxr_comment">// Try to remove an inexisting peer</em>
+<a class="jxr_linenumber" name="77" href="#77">77</a>      <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="78" href="#78">78</a>        admin.removePeer(ID_SECOND);
+<a class="jxr_linenumber" name="79" href="#79">79</a>        fail();
+<a class="jxr_linenumber" name="80" href="#80">80</a>      } <strong class="jxr_keyword">catch</strong> (IllegalArgumentException iae) {
+<a class="jxr_linenumber" name="81" href="#81">81</a>        <em class="jxr_comment">// OK!</em>
+<a class="jxr_linenumber" name="82" href="#82">82</a>      }
+<a class="jxr_linenumber" name="83" href="#83">83</a>      assertEquals(1, admin.getPeersCount());
+<a class="jxr_linenumber" name="84" href="#84">84</a>      <em class="jxr_comment">// Add a second since multi-slave is supported</em>
+<a class="jxr_linenumber" name="85" href="#85">85</a>      <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="86" href="#86">86</a>        admin.addPeer(ID_SECOND, KEY_SECOND);
+<a class="jxr_linenumber" name="87" href="#87">87</a>      } <strong class="jxr_keyword">catch</strong> (IllegalStateException iae) {
+<a class="jxr_linenumber" name="88" href="#88">88</a>        fail();
+<a class="jxr_linenumber" name="89" href="#89">89</a>        <em class="jxr_comment">// OK!</em>
+<a class="jxr_linenumber" name="90" href="#90">90</a>      }
+<a class="jxr_linenumber" name="91" href="#91">91</a>      assertEquals(2, admin.getPeersCount());
+<a class="jxr_linenumber" name="92" href="#92">92</a>      <em class="jxr_comment">// Remove the first peer we added</em>
+<a class="jxr_linenumber" name="93" href="#93">93</a>      admin.removePeer(ID_ONE);
+<a class="jxr_linenumber" name="94" href="#94">94</a>      assertEquals(1, admin.getPeersCount());
+<a class="jxr_linenumber" name="95" href="#95">95</a>    }
+<a class="jxr_linenumber" name="96" href="#96">96</a>  
+<a class="jxr_linenumber" name="97" href="#97">97</a>  }
+<a class="jxr_linenumber" name="98" href="#98">98</a>  
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>



Mime
View raw message