Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions hbase-testing-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@
<artifactId>mockito-core</artifactId>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.stephenc.findbugs</groupId>
<artifactId>findbugs-annotations</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,46 +17,42 @@
*/
package org.apache.hadoop.hbase;

import static org.junit.Assert.assertFalse;
import static org.junit.jupiter.api.Assertions.assertFalse;

import java.util.List;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

/**
* Make sure we can spin up a HBTU without a hbase-site.xml
*/
@Category({ MiscTests.class, MediumTests.class })
@Tag(MiscTests.TAG)
@Tag(MediumTests.TAG)
public class TestHBaseTestingUtilitySpinup {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestHBaseTestingUtilitySpinup.class);

private final static HBaseTestingUtility UTIL = new HBaseTestingUtility();

@BeforeClass
@BeforeAll
public static void beforeClass() throws Exception {
UTIL.startMiniCluster();
if (!UTIL.getHBaseCluster().waitForActiveAndReadyMaster(30000)) {
throw new RuntimeException("Active master not ready");
}
}

@AfterClass
@AfterAll
public static void afterClass() throws Exception {
UTIL.shutdownMiniCluster();
}

@Test
public void testGetMetaTableRows() throws Exception {
List<byte[]> results = UTIL.getMetaTableRows();
assertFalse("results should have some entries and is empty.", results.isEmpty());
assertFalse(results.isEmpty(), "results should have some entries and is empty.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
*/
package org.apache.hadoop.hbase.testing;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.util.Collection;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.Waiter;
import org.apache.hadoop.hbase.client.Admin;
Expand All @@ -33,44 +32,40 @@
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.util.DNS;
import org.apache.hadoop.hbase.util.DNS.ServerType;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import org.apache.hbase.thirdparty.com.google.common.collect.Iterables;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;

@Category({ MiscTests.class, LargeTests.class })
@Tag(MiscTests.TAG)
@Tag(LargeTests.TAG)
public class TestTestingHBaseCluster {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestTestingHBaseCluster.class);

private static TestingHBaseCluster CLUSTER;

private Connection conn;

private Admin admin;

@BeforeClass
@BeforeAll
public static void setUpBeforeClass() throws Exception {
CLUSTER = TestingHBaseCluster.create(TestingHBaseClusterOption.builder().numMasters(2)
.numRegionServers(3).numDataNodes(3).build());
}

@AfterClass
@AfterAll
public static void tearDownAfterClass() throws Exception {
if (CLUSTER.isClusterRunning()) {
CLUSTER.stop();
}
}

@Before
@BeforeEach
public void setUp() throws Exception {
if (!CLUSTER.isClusterRunning()) {
CLUSTER.start();
Expand All @@ -82,7 +77,7 @@ public void setUp() throws Exception {
admin = conn.getAdmin();
}

@After
@AfterEach
public void tearDown() throws Exception {
Closeables.close(admin, true);
Closeables.close(conn, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@
*/
package org.apache.hadoop.hbase.testing;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertSame;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertSame;

import java.io.IOException;
import java.util.List;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Admin;
Expand All @@ -39,21 +38,17 @@
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

import org.apache.hbase.thirdparty.com.google.common.io.Closeables;

@Category({ MiscTests.class, LargeTests.class })
@Tag(MiscTests.TAG)
@Tag(LargeTests.TAG)
public class TestTestingHBaseClusterImplForCPs {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestTestingHBaseClusterImplForCPs.class);

private static TestingHBaseCluster CLUSTER;

private static TableName NAME = TableName.valueOf("test");
Expand All @@ -64,7 +59,7 @@ public class TestTestingHBaseClusterImplForCPs {

private static Admin ADMIN;

@BeforeClass
@BeforeAll
public static void setUpBeforeClass() throws Exception {
CLUSTER = TestingHBaseCluster.create(TestingHBaseClusterOption.builder().numMasters(2)
.numRegionServers(3).numDataNodes(3).build());
Expand All @@ -76,7 +71,7 @@ public static void setUpBeforeClass() throws Exception {
ADMIN.balancerSwitch(false, true);
}

@AfterClass
@AfterAll
public static void tearDownAfterClass() throws Exception {
Closeables.close(ADMIN, true);
Closeables.close(CONN, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,19 @@
*/
package org.apache.hadoop.hbase.testing;

import static org.junit.Assert.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;

@Category({ MiscTests.class, LargeTests.class })
@Tag(MiscTests.TAG)
@Tag(LargeTests.TAG)
public class TestTestingHBaseClusterReplicationShareDfs
extends TestingHBaseClusterReplicationTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestTestingHBaseClusterReplicationShareDfs.class);

private HBaseTestingUtil util = new HBaseTestingUtil();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,19 @@
*/
package org.apache.hadoop.hbase.testing;

import static org.junit.Assert.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;

@Category({ MiscTests.class, LargeTests.class })
@Tag(MiscTests.TAG)
@Tag(LargeTests.TAG)
public class TestTestingHBaseClusterReplicationShareZk
extends TestingHBaseClusterReplicationTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestTestingHBaseClusterReplicationShareZk.class);

private HBaseTestingUtil util = new HBaseTestingUtil();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,19 @@
*/
package org.apache.hadoop.hbase.testing;

import static org.junit.Assert.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;

@Category({ MiscTests.class, LargeTests.class })
@Tag(MiscTests.TAG)
@Tag(LargeTests.TAG)
public class TestTestingHBaseClusterReplicationShareZkDfs
extends TestingHBaseClusterReplicationTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestTestingHBaseClusterReplicationShareZkDfs.class);

private HBaseTestingUtil util = new HBaseTestingUtil();

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,15 @@
*/
package org.apache.hadoop.hbase.testing;

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hbase.testclassification.MiscTests;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;

@Category({ MiscTests.class, LargeTests.class })
@Tag(MiscTests.TAG)
@Tag(LargeTests.TAG)
public class TestTestingHBaseClusterReplicationTwoClusters
extends TestingHBaseClusterReplicationTestBase {

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestTestingHBaseClusterReplicationTwoClusters.class);

@Override
protected void startClusters() throws Exception {
sourceCluster = TestingHBaseCluster.create(TestingHBaseClusterOption.builder().build());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/
package org.apache.hadoop.hbase.testing;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;

import java.io.IOException;
import org.apache.hadoop.hbase.HConstants;
Expand All @@ -35,9 +35,9 @@
import org.apache.hadoop.hbase.replication.ReplicationPeerConfig;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.zookeeper.ZKConfig;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.apache.hbase.thirdparty.com.google.common.io.Closeables;

Expand All @@ -64,7 +64,7 @@ private String getPeerClusterKey() {
return ZKConfig.getZooKeeperClusterKey(peerCluster.getConf());
}

@Before
@BeforeEach
public void setUp() throws Exception {
startClusters();
sourceConn = ConnectionFactory.createConnection(sourceCluster.getConf());
Expand All @@ -82,7 +82,7 @@ public void setUp() throws Exception {
}
}

@After
@AfterEach
public void tearDown() throws Exception {
Closeables.close(sourceConn, true);
Closeables.close(peerConn, true);
Expand Down