View Javadoc

1   /**
2    *
3    * Licensed to the Apache Software Foundation (ASF) under one
4    * or more contributor license agreements.  See the NOTICE file
5    * distributed with this work for additional information
6    * regarding copyright ownership.  The ASF licenses this file
7    * to you under the Apache License, Version 2.0 (the
8    * "License"); you may not use this file except in compliance
9    * with the License.  You may obtain a copy of the License at
10   *
11   *     http://www.apache.org/licenses/LICENSE-2.0
12   *
13   * Unless required by applicable law or agreed to in writing, software
14   * distributed under the License is distributed on an "AS IS" BASIS,
15   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   * See the License for the specific language governing permissions and
17   * limitations under the License.
18   */
19  package org.apache.hadoop.hbase.mapreduce;
20  
21  import java.io.IOException;
22  import java.util.List;
23  
24  import org.apache.hadoop.hbase.HRegionLocation;
25  import org.apache.hadoop.hbase.client.HTable;
26  import org.apache.hadoop.hbase.testclassification.LargeTests;
27  import org.junit.Test;
28  import org.junit.experimental.categories.Category;
29  
30  /**
31   * TestTableInputFormatScan part 1.
32   * @see TestTableInputFormatScanBase
33   */
34  @Category(LargeTests.class)
35  public class TestTableInputFormatScan1 extends TestTableInputFormatScanBase {
36  
37    /**
38     * Tests a MR scan using specific start and stop rows.
39     *
40     * @throws IOException
41     * @throws ClassNotFoundException
42     * @throws InterruptedException
43     */
44    @Test
45    public void testScanEmptyToEmpty()
46    throws IOException, InterruptedException, ClassNotFoundException {
47      testScan(null, null, null);
48    }
49  
50    /**
51     * Tests a MR scan using specific start and stop rows.
52     *
53     * @throws IOException
54     * @throws ClassNotFoundException
55     * @throws InterruptedException
56     */
57    @Test
58    public void testScanEmptyToAPP()
59    throws IOException, InterruptedException, ClassNotFoundException {
60      testScan(null, "app", "apo");
61    }
62  
63    /**
64     * Tests a MR scan using specific start and stop rows.
65     *
66     * @throws IOException
67     * @throws ClassNotFoundException
68     * @throws InterruptedException
69     */
70    @Test
71    public void testScanEmptyToBBA()
72    throws IOException, InterruptedException, ClassNotFoundException {
73      testScan(null, "bba", "baz");
74    }
75  
76    /**
77     * Tests a MR scan using specific start and stop rows.
78     *
79     * @throws IOException
80     * @throws ClassNotFoundException
81     * @throws InterruptedException
82     */
83    @Test
84    public void testScanEmptyToBBB()
85    throws IOException, InterruptedException, ClassNotFoundException {
86      testScan(null, "bbb", "bba");
87    }
88  
89    /**
90     * Tests a MR scan using specific start and stop rows.
91     *
92     * @throws IOException
93     * @throws ClassNotFoundException
94     * @throws InterruptedException
95     */
96    @Test
97    public void testScanEmptyToOPP()
98    throws IOException, InterruptedException, ClassNotFoundException {
99      testScan(null, "opp", "opo");
100   }
101 
102   /**
103    * Tests a MR scan using specific number of mappers. The test table has 26 regions,
104    *
105    * @throws IOException
106    * @throws ClassNotFoundException
107    * @throws InterruptedException
108    */
109   @Test
110   public void testGetSplits() throws IOException, InterruptedException, ClassNotFoundException {
111     testNumOfSplits(1, 26);
112     testNumOfSplits(3, 78);
113   }
114 
115   /**
116    * Runs a MR to test TIF using specific number of mappers. The test table has 26 regions,
117    * @throws InterruptedException
118    * @throws IOException
119    * @throws ClassNotFoundException
120    */
121   @Test
122   public void testSpecifiedNumOfMappersMR()
123       throws InterruptedException, IOException, ClassNotFoundException {
124     testNumOfSplitsMR(2, 52);
125     testNumOfSplitsMR(4, 104);
126   }
127 
128   /**
129    * Test if autoBalance create correct splits
130    * @throws IOException
131    */
132   @Test
133   public void testAutoBalanceSplits() throws IOException {
134     testAutobalanceNumOfSplit();
135   }
136 }