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 MiniHBaseCluster. Can be used in
either the Rule or ClassRule positions. Built on top of an instance of
HBaseTestingUtility, 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 MiniHBaseClusterprivate final StartMiniClusterOptionprivate final HBaseTestingUtility -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMiniClusterRule(org.apache.hadoop.conf.Configuration conf, StartMiniClusterOption miniClusterOptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafter()protected voidbefore()CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>Create aAsyncConnectionto the managedMiniHBaseCluster.org.apache.hadoop.hbase.client.ConnectionCreate aConnectionto the managedMiniHBaseCluster.Returns the underlying instance ofHBaseTestingUtilitystatic 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, StartMiniClusterOption miniClusterOptions)
-
-
Method Details
-
newBuilder
-
getTestingUtility
Returns the underlying instance ofHBaseTestingUtility -
createConnection
Create aConnectionto the managedMiniHBaseCluster. It's up to the caller toclose()the connection when finished. -
createAsyncConnection
Create aAsyncConnectionto the managedMiniHBaseCluster. 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
-