1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.codec.prefixtree.row.data;
20
21 import java.util.List;
22
23 import org.apache.hadoop.hbase.KeyValue;
24 import org.apache.hadoop.hbase.codec.prefixtree.PrefixTreeBlockMeta;
25 import org.apache.hadoop.hbase.codec.prefixtree.row.BaseTestRowData;
26 import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellScannerPosition;
27 import org.apache.hadoop.hbase.codec.prefixtree.scanner.CellSearcher;
28 import org.apache.hadoop.hbase.util.Bytes;
29 import org.junit.Assert;
30
31 import com.google.common.collect.Lists;
32
33
34
35
36 public class TestRowDataDeeper extends BaseTestRowData{
37
38 static byte[]
39 cdc = Bytes.toBytes("cdc"),
40 cf6 = Bytes.toBytes("cf6"),
41 cfc = Bytes.toBytes("cfc"),
42 f = Bytes.toBytes("f"),
43 q = Bytes.toBytes("q"),
44 v = Bytes.toBytes("v");
45
46 static long
47 ts = 55L;
48
49 static List<KeyValue> d = Lists.newArrayList();
50 static{
51 d.add(new KeyValue(cdc, f, q, ts, v));
52 d.add(new KeyValue(cf6, f, q, ts, v));
53 d.add(new KeyValue(cfc, f, q, ts, v));
54 }
55
56 @Override
57 public List<KeyValue> getInputs() {
58 return d;
59 }
60
61 @Override
62 public void individualBlockMetaAssertions(PrefixTreeBlockMeta blockMeta) {
63
64
65
66 Assert.assertEquals(3, blockMeta.getRowTreeDepth());
67 }
68
69 @Override
70 public void individualSearcherAssertions(CellSearcher searcher) {
71
72
73
74
75 KeyValue cfcRow = KeyValue.createFirstOnRow(Bytes.toBytes("cfc"));
76 CellScannerPosition position = searcher.positionAtOrAfter(cfcRow);
77 Assert.assertEquals(CellScannerPosition.AFTER, position);
78 Assert.assertEquals(d.get(2), searcher.current());
79 searcher.previous();
80 Assert.assertEquals(d.get(1), searcher.current());
81 }
82 }
83
84