View Javadoc

1   /**
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   */
18  package org.apache.hadoop.hbase.regionserver.querymatcher;
19  
20  import org.apache.hadoop.conf.Configuration;
21  import org.apache.hadoop.hbase.HBaseConfiguration;
22  import org.apache.hadoop.hbase.KeyValue;
23  import org.apache.hadoop.hbase.KeyValue.KVComparator;
24  import org.apache.hadoop.hbase.client.Get;
25  import org.apache.hadoop.hbase.client.Scan;
26  import org.apache.hadoop.hbase.util.Bytes;
27  import org.junit.Before;
28  
29  public class AbstractTestScanQueryMatcher {
30  
31    protected Configuration conf;
32  
33    protected byte[] row1;
34    protected byte[] row2;
35    protected byte[] row3;
36    protected byte[] fam1;
37    protected byte[] fam2;
38    protected byte[] col1;
39    protected byte[] col2;
40    protected byte[] col3;
41    protected byte[] col4;
42    protected byte[] col5;
43  
44    protected byte[] data;
45  
46    protected Get get;
47  
48    protected long ttl = Long.MAX_VALUE;
49    protected KVComparator rowComparator;
50    protected Scan scan;
51  
52    @Before
53    public void setUp() throws Exception {
54      this.conf = HBaseConfiguration.create();
55      row1 = Bytes.toBytes("row1");
56      row2 = Bytes.toBytes("row2");
57      row3 = Bytes.toBytes("row3");
58      fam1 = Bytes.toBytes("fam1");
59      fam2 = Bytes.toBytes("fam2");
60      col1 = Bytes.toBytes("col1");
61      col2 = Bytes.toBytes("col2");
62      col3 = Bytes.toBytes("col3");
63      col4 = Bytes.toBytes("col4");
64      col5 = Bytes.toBytes("col5");
65  
66      data = Bytes.toBytes("data");
67  
68      // Create Get
69      get = new Get(row1);
70      get.addFamily(fam1);
71      get.addColumn(fam2, col2);
72      get.addColumn(fam2, col4);
73      get.addColumn(fam2, col5);
74      this.scan = new Scan(get);
75  
76      rowComparator = KeyValue.COMPARATOR;
77    }
78  }