You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2011/05/23 19:10:33 UTC

svn commit: r1126595 - in /hbase/branches/0.90/src: main/java/org/apache/hadoop/hbase/Abortable.java test/java/org/apache/hadoop/hbase/mapreduce/TestTableSplit.java

Author: stack
Date: Mon May 23 17:10:33 2011
New Revision: 1126595

URL: http://svn.apache.org/viewvc?rev=1126595&view=rev
Log:
HBASE-3908 TableSplit not implementing hashCode problem

Added:
    hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSplit.java
Modified:
    hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/Abortable.java

Modified: hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/Abortable.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/Abortable.java?rev=1126595&r1=1126594&r2=1126595&view=diff
==============================================================================
--- hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/Abortable.java (original)
+++ hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/Abortable.java Mon May 23 17:10:33 2011
@@ -34,4 +34,4 @@ public interface Abortable {
    * @param e Throwable that caused abort. Can be null.
    */
   public void abort(String why, Throwable e);
-}
\ No newline at end of file
+}

Added: hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSplit.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSplit.java?rev=1126595&view=auto
==============================================================================
--- hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSplit.java (added)
+++ hbase/branches/0.90/src/test/java/org/apache/hadoop/hbase/mapreduce/TestTableSplit.java Mon May 23 17:10:33 2011
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.mapreduce;
+
+import org.junit.Test;
+
+import java.util.HashSet;
+
+import static junit.framework.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class TestTableSplit {
+  @Test
+  public void testHashCode() {
+    TableSplit split1 = new TableSplit("table".getBytes(), "row-start".getBytes(), "row-end".getBytes(), "location");
+    TableSplit split2 = new TableSplit("table".getBytes(), "row-start".getBytes(), "row-end".getBytes(), "location");
+    assertEquals (split1, split2);
+    assertTrue   (split1.hashCode() == split2.hashCode());
+    HashSet<TableSplit> set = new HashSet<TableSplit>(2);
+    set.add(split1);
+    set.add(split2);
+    assertTrue(set.size() == 1);
+  }
+}