Package org.apache.hadoop.hbase
Class MiniClusterRule
java.lang.Object
org.junit.rules.ExternalResource
org.apache.hadoop.hbase.MiniClusterRule
- All Implemented Interfaces:
org.junit.rules.TestRule
A
TestRule that manages an instance of the SingleProcessHBaseCluster. Can be used
in either the Rule or ClassRule positions. Built on top of an instance of
HBaseTestingUtil, so be weary of intermixing direct use of that class with this Rule.
Use in combination with ConnectionRule, for example:
{
@code
public class TestMyClass {
@ClassRule
public static final MiniClusterRule miniClusterRule = MiniClusterRule.newBuilder().build();
@Rule
public final ConnectionRule connectionRule =
ConnectionRule.createAsyncConnectionRule(miniClusterRule::createAsyncConnection);
}
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA builder for fluent composition of a newMiniClusterRule. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SingleProcessHBaseClusterprivate final StartTestingClusterOptionprivate final HBaseTestingUtil -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMiniClusterRule(org.apache.hadoop.conf.Configuration conf, StartTestingClusterOption miniClusterOptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()protected voidbefore()CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>Create aAsyncConnectionto the managedSingleProcessHBaseCluster.org.apache.hadoop.hbase.client.ConnectionCreate aConnectionto the managedSingleProcessHBaseCluster.Returns the underlying instance ofHBaseTestingUtilstatic MiniClusterRule.BuilderMethods inherited from class org.junit.rules.ExternalResource
apply
-
Field Details
-
testingUtility
-
miniClusterOptions
-
miniCluster
-
-
Constructor Details
-
MiniClusterRule
private MiniClusterRule(org.apache.hadoop.conf.Configuration conf, StartTestingClusterOption miniClusterOptions)
-
-
Method Details
-
newBuilder
-
getTestingUtility
Returns the underlying instance ofHBaseTestingUtil -
createConnection
Create aConnectionto the managedSingleProcessHBaseCluster. It's up to the caller toclose()the connection when finished. -
createAsyncConnection
Create aAsyncConnectionto the managedSingleProcessHBaseCluster. It's up to the caller toclose()the connection when finished. -
before
- Overrides:
beforein classorg.junit.rules.ExternalResource- Throws:
Throwable
-
after
- Overrides:
afterin classorg.junit.rules.ExternalResource
-