Class ConnectionRule

java.lang.Object
org.junit.rules.ExternalResource
org.apache.hadoop.hbase.ConnectionRule
All Implemented Interfaces:
org.junit.rules.TestRule

@Deprecated public final class ConnectionRule extends org.junit.rules.ExternalResource
Deprecated.
Use ConnectionExtension instead, once we finish the migration of JUnit5, which means we do not need ConnectionRule any more, we can remove these dependencies, see HBASE-23671 for more details.
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);
   }
 }