From c15e684bf91fffee4fb43e5a1440154a6db2d3db Mon Sep 17 00:00:00 2001 From: tedyu Date: Thu, 5 Mar 2015 06:55:36 -0800 Subject: [PATCH] HBASE-13155 Fix TestPrefixTree (Duo Zhang) --- .../hbase/io/encoding/TestPrefixTree.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestPrefixTree.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestPrefixTree.java index b9ada5a840c..6a64119e41e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestPrefixTree.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/io/encoding/TestPrefixTree.java @@ -87,19 +87,19 @@ public class TestPrefixTree { @Test public void testHBASE11728() throws Exception { Put put = new Put(Bytes.toBytes("a-b-0-0")); - put.add(fam, qual1, Bytes.toBytes("c1-value")); + put.addColumn(fam, qual1, Bytes.toBytes("c1-value")); region.put(put); put = new Put(row1_bytes); - put.add(fam, qual1, Bytes.toBytes("c1-value")); + put.addColumn(fam, qual1, Bytes.toBytes("c1-value")); region.put(put); put = new Put(row2_bytes); - put.add(fam, qual2, Bytes.toBytes("c2-value")); + put.addColumn(fam, qual2, Bytes.toBytes("c2-value")); region.put(put); put = new Put(row3_bytes); - put.add(fam, qual2, Bytes.toBytes("c2-value-2")); + put.addColumn(fam, qual2, Bytes.toBytes("c2-value-2")); region.put(put); put = new Put(row4_bytes); - put.add(fam, qual2, Bytes.toBytes("c2-value-3")); + put.addColumn(fam, qual2, Bytes.toBytes("c2-value-3")); region.put(put); region.flushcache(); String[] rows = new String[3]; @@ -136,9 +136,7 @@ public class TestPrefixTree { scan.setStopRow(Bytes.toBytes("a-b-A-1:")); scanner = region.getScanner(scan); for (int i = 1; i < 3; i++) { - // assertEquals(i < 2, scanner.next(cells)); - scanner.next(cells); - System.out.println(Result.create(cells)); + assertEquals(i < 2, NextState.hasMoreValues(scanner.next(cells))); CellScanner cellScanner = Result.create(cells).cellScanner(); while (cellScanner.advance()) { assertEquals(rows[i], Bytes.toString(cellScanner.current().getRowArray(), cellScanner @@ -177,12 +175,13 @@ public class TestPrefixTree { @Test public void testHBASE12817() throws IOException { for (int i = 0; i < 100; i++) { - region.put(new Put(Bytes.toBytes("obj" + (2900 + i))).add(fam, qual1, Bytes.toBytes(i))); + region + .put(new Put(Bytes.toBytes("obj" + (2900 + i))).addColumn(fam, qual1, Bytes.toBytes(i))); } - region.put(new Put(Bytes.toBytes("obj299")).add(fam, qual1, Bytes.toBytes("whatever"))); - region.put(new Put(Bytes.toBytes("obj29")).add(fam, qual1, Bytes.toBytes("whatever"))); - region.put(new Put(Bytes.toBytes("obj2")).add(fam, qual1, Bytes.toBytes("whatever"))); - region.put(new Put(Bytes.toBytes("obj3")).add(fam, qual1, Bytes.toBytes("whatever"))); + region.put(new Put(Bytes.toBytes("obj299")).addColumn(fam, qual1, Bytes.toBytes("whatever"))); + region.put(new Put(Bytes.toBytes("obj29")).addColumn(fam, qual1, Bytes.toBytes("whatever"))); + region.put(new Put(Bytes.toBytes("obj2")).addColumn(fam, qual1, Bytes.toBytes("whatever"))); + region.put(new Put(Bytes.toBytes("obj3")).addColumn(fam, qual1, Bytes.toBytes("whatever"))); region.flushcache(); Scan scan = new Scan(Bytes.toBytes("obj29995")); RegionScanner scanner = region.getScanner(scan);