public class ConnectionRule extends org.junit.rules.ExternalResource
Rule that manages the lifecycle of an instance of AsyncConnection. Can be used
in either the Rule or ClassRule positions.
Use in combination with MiniClusterRule, for example:
{@code
public class TestMyClass {
private static final MiniClusterRule miniClusterRule = MiniClusterRule.newBuilder().build();
private static final ConnectionRule connectionRule =
new ConnectionRule(miniClusterRule::createConnection);| Modifier and Type | Field and Description |
|---|---|
private org.apache.hadoop.hbase.client.AsyncConnection |
connection |
private Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> |
connectionSupplier |
| Constructor and Description |
|---|
ConnectionRule(Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> connectionSupplier) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
after() |
protected void |
before() |
org.apache.hadoop.hbase.client.AsyncConnection |
getConnection() |
private final Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> connectionSupplier
private org.apache.hadoop.hbase.client.AsyncConnection connection
public ConnectionRule(Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> connectionSupplier)
public org.apache.hadoop.hbase.client.AsyncConnection getConnection()
protected void before() throws Throwable
before in class org.junit.rules.ExternalResourceThrowableprotected void after()
after in class org.junit.rules.ExternalResourceCopyright © 2007–2021 The Apache Software Foundation. All rights reserved.