HBASE-22002 Remove the deprecated methods in Admin interface
[hbase.git] / hbase-server / src / test / java / org / apache / hadoop / hbase / client / TestAsyncTableScanner.java
blobf832cfd759a3c92138b68145c29e386db14700ee
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
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 {
38 @ClassRule
39 public static final HBaseClassTestRule CLASS_RULE =
40 HBaseClassTestRule.forClass(TestAsyncTableScanner.class);
42 @Parameter(0)
43 public String tableType;
45 @Parameter(1)
46 public Supplier<AsyncTable<?>> getTable;
48 @Parameter(2)
49 public String scanType;
51 @Parameter(3)
52 public Supplier<Scan> scanCreator;
54 @Parameters(name = "{index}: table={0}, scan={2}")
55 public static List<Object[]> params() {
56 return getTableAndScanCreatorParams();
59 @Override
60 protected Scan createScan() {
61 return scanCreator.get();
64 @Override
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;) {
70 results.add(result);
73 if (scan.getBatch() > 0) {
74 results = convertFromBatchResult(results);
76 return results;