HBase JUnit Rule

JUnit rule to start a temporary HBase cluster

License

License

Categories

Categories

JUnit Unit Testing
GroupId

GroupId

com.github.charithe
ArtifactId

ArtifactId

hbase-junit-rule
Last Version

Last Version

1.0.3
Release Date

Release Date

Type

Type

jar
Description

Description

HBase JUnit Rule
JUnit rule to start a temporary HBase cluster
Source Code Management

Source Code Management

https://github.com/charithe/hbase-junit

Download hbase-junit-rule

How to add to project

<!-- https://jarcasting.com/artifacts/com.github.charithe/hbase-junit-rule/ -->
<dependency>
    <groupId>com.github.charithe</groupId>
    <artifactId>hbase-junit-rule</artifactId>
    <version>1.0.3</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.charithe/hbase-junit-rule/
implementation 'com.github.charithe:hbase-junit-rule:1.0.3'
// https://jarcasting.com/artifacts/com.github.charithe/hbase-junit-rule/
implementation ("com.github.charithe:hbase-junit-rule:1.0.3")
'com.github.charithe:hbase-junit-rule:jar:1.0.3'
<dependency org="com.github.charithe" name="hbase-junit-rule" rev="1.0.3">
  <artifact name="hbase-junit-rule" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.charithe', module='hbase-junit-rule', version='1.0.3')
)
libraryDependencies += "com.github.charithe" % "hbase-junit-rule" % "1.0.3"
[com.github.charithe/hbase-junit-rule "1.0.3"]

Dependencies

compile (9)

Group / Artifact Type Version
org.apache.curator : curator-test jar 2.7.1
org.apache.hbase : hbase-testing-util jar 1.1.2
com.google.guava : guava jar 14.0
junit : junit jar 4.12
org.slf4j : slf4j-api jar 1.7.10
org.slf4j : log4j-over-slf4j jar 1.7.10
org.slf4j : jcl-over-slf4j jar 1.7.10
org.slf4j : jul-to-slf4j jar 1.7.10
org.slf4j : slf4j-simple jar 1.7.10

Project Modules

There are no modules declared in this project.

HBase JUnit Rule

JUnit rule to help spin up a HBase mini cluster during unit and integration tests. Works with HBase 1.0.0 and JUnit 4.12+.

Installation

Release are available from Maven Central.

<dependency>
    <groupId>com.github.charithe</groupId>
    <artifactId>hbase-junit-rule</artifactId>
    <version>1.0.2</version>
</dependency>

Usage

@ClassRule
public static HBaseJunitRule hBaseJunitRule = new HBaseJunitRule();

@Test
public void clusterId_notNull() throws IOException {
    Configuration conf = hBaseJunitRule.getHBaseConfiguration();
    try(Connection conn = ConnectionFactory.createConnection(conf)) {
        assertThat(conn.getAdmin().getClusterStatus().getClusterId(), is(notNullValue()));
    }
}

In cases where using the JUnit rule is infeasible, HBase mini cluster can be used as follows:

HBaseMiniClusterBooter miniCluster = new HBaseMiniClusterBooter();
try(Connection conn = ConnectionFactory.createConnection(miniCluster.getHBaseConfiguration()){
    ...
}

Versions

Version
1.0.3
1.0.2
1.0.1
1.0.0