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