Package org.apache.hadoop.hbase
Class ConnectionRule
java.lang.Object
org.junit.rules.ExternalResource
org.apache.hadoop.hbase.ConnectionRule
- All Implemented Interfaces:
- org.junit.rules.TestRule
A 
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);
   }
 }
 - 
Field SummaryFieldsModifier and TypeFieldDescriptionprivate org.apache.hadoop.hbase.client.AsyncConnectionprivate final Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>>private org.apache.hadoop.hbase.client.Connectionprivate final Supplier<org.apache.hadoop.hbase.client.Connection>
- 
Constructor SummaryConstructorsModifierConstructorDescriptionprivateConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier, Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) 
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidafter()protected voidbefore()static ConnectionRulecreateAsyncConnectionRule(Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) static ConnectionRulecreateConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier) static ConnectionRulecreateConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier, Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) org.apache.hadoop.hbase.client.AsyncConnectionorg.apache.hadoop.hbase.client.ConnectionMethods inherited from class org.junit.rules.ExternalResourceapply
- 
Field Details- 
connectionSupplier
- 
asyncConnectionSupplierprivate final Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier
- 
connection
- 
asyncConnection
 
- 
- 
Constructor Details- 
ConnectionRuleprivate ConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier, Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) 
 
- 
- 
Method Details- 
createConnectionRulepublic static ConnectionRule createConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier) 
- 
createAsyncConnectionRulepublic static ConnectionRule createAsyncConnectionRule(Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) 
- 
createConnectionRulepublic static ConnectionRule createConnectionRule(Supplier<org.apache.hadoop.hbase.client.Connection> connectionSupplier, Supplier<CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>> asyncConnectionSupplier) 
- 
getConnection
- 
getAsyncConnection
- 
before- Overrides:
- beforein class- org.junit.rules.ExternalResource
- Throws:
- Throwable
 
- 
after- Overrides:
- afterin class- org.junit.rules.ExternalResource
 
 
-