public final 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 = ConnectionRule.createAsyncConnectionRule(miniClusterRule::createConnection); @ClassRule public static final TestRule rule = RuleChain.outerRule(miniClusterRule).around(connectionRule); } }
Modifier and Type | Field and Description |
---|---|
private org.apache.hadoop.hbase.client.AsyncConnection |
asyncConnection |
private Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> |
asyncConnectionSupplier |
private org.apache.hadoop.hbase.client.Connection |
connection |
private Supplier<org.apache.hadoop.hbase.client.Connection> |
connectionSupplier |
Modifier | Constructor and Description |
---|---|
private |
ConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier,
Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) |
Modifier and Type | Method and Description |
---|---|
protected void |
after() |
protected void |
before() |
static ConnectionRule |
createAsyncConnectionRule(Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) |
static ConnectionRule |
createConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier) |
static ConnectionRule |
createConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier,
Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) |
org.apache.hadoop.hbase.client.AsyncConnection |
getAsyncConnection() |
org.apache.hadoop.hbase.client.Connection |
getConnection() |
private final Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier
private final Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier
private org.apache.hadoop.hbase.client.Connection connection
private org.apache.hadoop.hbase.client.AsyncConnection asyncConnection
private ConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier, Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier)
public static ConnectionRule createConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier)
public static ConnectionRule createAsyncConnectionRule(Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier)
public static ConnectionRule createConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier, Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier)
public org.apache.hadoop.hbase.client.Connection getConnection()
public org.apache.hadoop.hbase.client.AsyncConnection getAsyncConnection()
protected void before() throws Throwable
before
in class org.junit.rules.ExternalResource
Throwable
protected void after()
after
in class org.junit.rules.ExternalResource
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.