Package org.apache.hadoop.hbase
Class MiniClusterExtension
java.lang.Object
org.apache.hadoop.hbase.MiniClusterExtension
- All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterAllCallback,org.junit.jupiter.api.extension.BeforeAllCallback,org.junit.jupiter.api.extension.Extension
public final class MiniClusterExtension
extends Object
implements org.junit.jupiter.api.extension.BeforeAllCallback, org.junit.jupiter.api.extension.AfterAllCallback
An
Extension that manages an instance of the SingleProcessHBaseCluster. Built on
top of an instance of HBaseTestingUtil, so be weary of intermixing direct use of that
class with this Extension.
Use in combination with ConnectionExtension, for example:
{
@code
public class TestMyClass {
@RegisterExtension
public static final MiniClusterExtension miniClusterExtension =
MiniClusterExtension.newBuilder().build();
@RegisterExtension
public final ConnectionExtension connectionExtension = ConnectionExtension
.createAsyncConnectionExtension(miniClusterExtension::createAsyncConnection);
}
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA builder for fluent composition of a newMiniClusterExtension. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate SingleProcessHBaseClusterprivate final StartTestingClusterOptionprivate final HBaseTestingUtilReturns the underlying instance ofHBaseTestingUtil -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateMiniClusterExtension(org.apache.hadoop.conf.Configuration conf, StartTestingClusterOption miniClusterOptions) -
Method Summary
Modifier and TypeMethodDescriptionvoidafterAll(org.junit.jupiter.api.extension.ExtensionContext context) voidbeforeAll(org.junit.jupiter.api.extension.ExtensionContext context) 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 MiniClusterExtension.Builder
-
Field Details
-
testingUtility
Returns the underlying instance ofHBaseTestingUtil -
miniClusterOptions
-
miniCluster
-
-
Constructor Details
-
MiniClusterExtension
private MiniClusterExtension(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. -
beforeAll
- Specified by:
beforeAllin interfaceorg.junit.jupiter.api.extension.BeforeAllCallback- Throws:
Exception
-
afterAll
- Specified by:
afterAllin interfaceorg.junit.jupiter.api.extension.AfterAllCallback
-