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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 package org
.apache
.hadoop
.hbase
.client
;
20 import java
.util
.ArrayList
;
21 import java
.util
.List
;
22 import java
.util
.concurrent
.ForkJoinPool
;
23 import java
.util
.function
.Supplier
;
24 import org
.apache
.hadoop
.hbase
.HBaseClassTestRule
;
25 import org
.apache
.hadoop
.hbase
.testclassification
.ClientTests
;
26 import org
.apache
.hadoop
.hbase
.testclassification
.LargeTests
;
27 import org
.junit
.ClassRule
;
28 import org
.junit
.experimental
.categories
.Category
;
29 import org
.junit
.runner
.RunWith
;
30 import org
.junit
.runners
.Parameterized
;
31 import org
.junit
.runners
.Parameterized
.Parameter
;
32 import org
.junit
.runners
.Parameterized
.Parameters
;
34 @RunWith(Parameterized
.class)
35 @Category({ LargeTests
.class, ClientTests
.class })
36 public class TestAsyncTableScanner
extends AbstractTestAsyncTableScan
{
39 public static final HBaseClassTestRule CLASS_RULE
=
40 HBaseClassTestRule
.forClass(TestAsyncTableScanner
.class);
43 public String tableType
;
46 public Supplier
<AsyncTable
<?
>> getTable
;
49 public String scanType
;
52 public Supplier
<Scan
> scanCreator
;
54 @Parameters(name
= "{index}: table={0}, scan={2}")
55 public static List
<Object
[]> params() {
56 return getTableAndScanCreatorParams();
60 protected Scan
createScan() {
61 return scanCreator
.get();
65 protected List
<Result
> doScan(Scan scan
) throws Exception
{
66 AsyncTable
<?
> table
= ASYNC_CONN
.getTable(TABLE_NAME
, ForkJoinPool
.commonPool());
67 List
<Result
> results
= new ArrayList
<>();
68 try (ResultScanner scanner
= table
.getScanner(scan
)) {
69 for (Result result
; (result
= scanner
.next()) != null;) {
73 if (scan
.getBatch() > 0) {
74 results
= convertFromBatchResult(results
);