public final class MiniClusterRule extends org.junit.rules.ExternalResource
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 {
Modifier and Type | Class and Description |
---|---|
static class |
MiniClusterRule.Builder
A builder for fluent composition of a new
MiniClusterRule . |
Modifier and Type | Field and Description |
---|---|
private MiniHBaseCluster |
miniCluster |
private StartMiniClusterOption |
miniClusterOptions |
private HBaseTestingUtility |
testingUtility |
Modifier | Constructor and Description |
---|---|
private |
MiniClusterRule(org.apache.hadoop.conf.Configuration conf,
StartMiniClusterOption miniClusterOptions) |
Modifier and Type | Method and Description |
---|---|
protected void |
after() |
protected void |
before() |
CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection> |
createConnection()
Create a
AsyncConnection to the managed MiniHBaseCluster . |
HBaseTestingUtility |
getTestingUtility() |
static MiniClusterRule.Builder |
newBuilder() |
private final HBaseTestingUtility testingUtility
private final StartMiniClusterOption miniClusterOptions
private MiniHBaseCluster miniCluster
private MiniClusterRule(org.apache.hadoop.conf.Configuration conf, StartMiniClusterOption miniClusterOptions)
public static MiniClusterRule.Builder newBuilder()
public HBaseTestingUtility getTestingUtility()
HBaseTestingUtility
public CompletableFuture<org.apache.hadoop.hbase.client.AsyncConnection> createConnection()
AsyncConnection
to the managed MiniHBaseCluster
. It's up to the caller
to close()
the connection when finished.protected void before() throws Throwable
before
in class org.junit.rules.ExternalResource
Throwable
protected void after()
after
in class org.junit.rules.ExternalResource
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.