Author: stack
Date: Thu Apr 28 16:47:00 2011
New Revision: 1097541
URL: http://svn.apache.org/viewvc?rev=1097541&view=rev
Log:
HBASE-1502 Aftermath; fix up of broke tests. Fix TestHRegionLocation. I broke
it last night when I clarified HRegionLocation equality
Modified:
hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
Modified:
hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java?rev=1097541&r1=1097540&r2=1097541&view=diff
==============================================================================
--- hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
(original)
+++ hbase/trunk/src/test/java/org/apache/hadoop/hbase/TestHRegionLocation.java
Thu Apr 28 16:47:00 2011
@@ -27,6 +27,11 @@ import static org.junit.Assert.assertTru
import org.junit.Test;
public class TestHRegionLocation {
+ /**
+ * HRegionLocations are equal if they have the same 'location' -- i.e. host
and
+ * port -- even if they are carrying different regions. Verify that is
indeed
+ * the case.
+ */
@Test
public void testHashAndEqualsCode() {
ServerName hsa1 = new ServerName("localhost", 1234, -1L);
@@ -39,7 +44,14 @@ public class TestHRegionLocation {
HRegionLocation hrl3 = new HRegionLocation(HRegionInfo.ROOT_REGIONINFO,
hsa1.getHostname(), hsa1.getPort());
assertNotSame(hrl1, hrl3);
- assertFalse(hrl1.equals(hrl3));
+ // They are equal because they have same location even though they are
+ // carrying different regions.
+ assertTrue(hrl1.equals(hrl3));
+ ServerName hsa2 = new ServerName("localhost", 12345, -1L);
+ HRegionLocation hrl4 = new HRegionLocation(HRegionInfo.ROOT_REGIONINFO,
+ hsa2.getHostname(), hsa2.getPort());
+ // These have same HRI but different locations so should be different.
+ assertFalse(hrl3.equals(hrl4));
}
@Test