HBASE-13155 Fix TestPrefixTree (Duo Zhang)

This commit is contained in:
tedyu 2015-03-05 06:54:58 -08:00
parent 0c64a57e52
commit efb6e7005f
1 changed files with 12 additions and 11 deletions

View File

@ -86,19 +86,19 @@ public class TestPrefixTree {
@Test @Test
public void testHBASE11728() throws Exception { public void testHBASE11728() throws Exception {
Put put = new Put(Bytes.toBytes("a-b-0-0")); 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); region.put(put);
put = new Put(row1_bytes); put = new Put(row1_bytes);
put.add(fam, qual1, Bytes.toBytes("c1-value")); put.addColumn(fam, qual1, Bytes.toBytes("c1-value"));
region.put(put); region.put(put);
put = new Put(row2_bytes); put = new Put(row2_bytes);
put.add(fam, qual2, Bytes.toBytes("c2-value")); put.addColumn(fam, qual2, Bytes.toBytes("c2-value"));
region.put(put); region.put(put);
put = new Put(row3_bytes); 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); region.put(put);
put = new Put(row4_bytes); 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.put(put);
region.flushcache(); region.flushcache();
String[] rows = new String[3]; String[] rows = new String[3];
@ -135,7 +135,7 @@ public class TestPrefixTree {
scan.setStopRow(Bytes.toBytes("a-b-A-1:")); scan.setStopRow(Bytes.toBytes("a-b-A-1:"));
scanner = region.getScanner(scan); scanner = region.getScanner(scan);
for (int i = 1; i < 3; i++) { for (int i = 1; i < 3; i++) {
assertEquals(i < 2, scanner.next(cells)); assertEquals(i < 2, NextState.hasMoreValues(scanner.next(cells)));
CellScanner cellScanner = Result.create(cells).cellScanner(); CellScanner cellScanner = Result.create(cells).cellScanner();
while (cellScanner.advance()) { while (cellScanner.advance()) {
assertEquals(rows[i], Bytes.toString(cellScanner.current().getRowArray(), cellScanner assertEquals(rows[i], Bytes.toString(cellScanner.current().getRowArray(), cellScanner
@ -174,12 +174,13 @@ public class TestPrefixTree {
@Test @Test
public void testHBASE12817() throws IOException { public void testHBASE12817() throws IOException {
for (int i = 0; i < 100; i++) { 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("obj299")).addColumn(fam, qual1, Bytes.toBytes("whatever")));
region.put(new Put(Bytes.toBytes("obj29")).add(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")).add(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")).add(fam, qual1, Bytes.toBytes("whatever"))); region.put(new Put(Bytes.toBytes("obj3")).addColumn(fam, qual1, Bytes.toBytes("whatever")));
region.flushcache(); region.flushcache();
Scan scan = new Scan(Bytes.toBytes("obj29995")); Scan scan = new Scan(Bytes.toBytes("obj29995"));
RegionScanner scanner = region.getScanner(scan); RegionScanner scanner = region.getScanner(scan);