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
Modifier and TypeClassDescriptionstatic class
A builder for fluent composition of a newMiniClusterRule
. -
Field Summary
Modifier and TypeFieldDescriptionprivate MiniHBaseCluster
private final StartMiniClusterOption
private final HBaseTestingUtility
-
Constructor Summary
ModifierConstructorDescriptionprivate
MiniClusterRule
(org.apache.hadoop.conf.Configuration conf, StartMiniClusterOption miniClusterOptions) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
after()
protected void
before()
CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection>
Create aAsyncConnection
to the managedMiniHBaseCluster
.org.apache.hadoop.hbase.client.Connection
Create aConnection
to the managedMiniHBaseCluster
.Returns the underlying instance ofHBaseTestingUtility
static MiniClusterRule.Builder
Methods 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 aConnection
to the managedMiniHBaseCluster
. It's up to the caller toclose()
the connection when finished. -
createAsyncConnection
Create aAsyncConnection
to the managedMiniHBaseCluster
. It's up to the caller toclose()
the connection when finished. -
before
- Overrides:
before
in classorg.junit.rules.ExternalResource
- Throws:
Throwable
-
after
- Overrides:
after
in classorg.junit.rules.ExternalResource
-