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
7 changes: 1 addition & 6 deletions hbase-examples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,9 @@
<artifactId>junit-jupiter-params</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<artifactId>mockito-junit-jupiter</artifactId>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@

@InterfaceAudience.Private
public interface RowStatisticsRecorder {

void record(RowStatisticsImpl stats, Optional<byte[]> fullRegionName);
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,39 +17,34 @@
*/
package org.apache.hadoop.hbase.client.example;

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

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.util.ToolRunner;
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;

@Category({ ClientTests.class, MediumTests.class })
@Tag(ClientTests.TAG)
@Tag(MediumTests.TAG)
public class TestAsyncClientExample {

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

private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();

private static final TableName TABLE_NAME = TableName.valueOf("test");

@BeforeClass
@BeforeAll
public static void setUp() throws Exception {
UTIL.startMiniCluster(1);
UTIL.createTable(TABLE_NAME, Bytes.toBytes("d"));
}

@AfterClass
@AfterAll
public static void tearDown() throws Exception {
UTIL.shutdownMiniCluster();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
*/
package org.apache.hadoop.hbase.client.example;

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

import java.nio.charset.StandardCharsets;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.testclassification.ClientTests;
Expand All @@ -34,21 +33,17 @@
import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
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.ByteStreams;

@Category({ ClientTests.class, MediumTests.class })
@Tag(ClientTests.TAG)
@Tag(MediumTests.TAG)
public class TestHttpProxyExample {

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

private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();

private static final TableName TABLE_NAME = TableName.valueOf("test");
Expand All @@ -67,7 +62,7 @@ public class TestHttpProxyExample {

private static int PORT;

@BeforeClass
@BeforeAll
public static void setUp() throws Exception {
UTIL.startMiniCluster(1);
UTIL.createTable(TABLE_NAME, Bytes.toBytes(FAMILY));
Expand All @@ -76,7 +71,7 @@ public static void setUp() throws Exception {
PORT = PROXY.port();
}

@AfterClass
@AfterAll
public static void tearDown() throws Exception {
if (PROXY != null) {
PROXY.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,22 @@
*/
package org.apache.hadoop.hbase.client.example;

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

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.Table;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
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;

@Category({ ClientTests.class, MediumTests.class })
@Tag(ClientTests.TAG)
@Tag(MediumTests.TAG)
public class TestMultiThreadedClientExample {

private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
Expand All @@ -43,17 +42,13 @@ public class TestMultiThreadedClientExample {
private static byte[] familyName = Bytes.toBytes("d");
private static byte[] columnName = Bytes.toBytes("col");

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

@BeforeClass
@BeforeAll
public static void setup() throws Exception {
TEST_UTIL.startMiniCluster(1);
table = TEST_UTIL.createTable(MY_TABLE_NAME, familyName);
}

@AfterClass
@AfterAll
public static void tearDown() throws Exception {
TEST_UTIL.deleteTable(MY_TABLE_NAME);
TEST_UTIL.shutdownMiniCluster();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,22 @@
*/
package org.apache.hadoop.hbase.client.example;

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

import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.coprocessor.example.TestRefreshHFilesBase;
import org.apache.hadoop.hbase.regionserver.HRegion;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.util.ToolRunner;
import org.junit.BeforeClass;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category({ ClientTests.class, MediumTests.class })
@Tag(ClientTests.TAG)
@Tag(MediumTests.TAG)
public class TestRefreshHFilesClient extends TestRefreshHFilesBase {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestRefreshHFilesClient.class);

@BeforeClass
@BeforeAll
public static void setUp() {
setUp(HRegion.class.getName());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.util.CommonFSUtils;
import org.apache.hadoop.hbase.util.HFileTestUtil;
import org.junit.After;
import org.junit.jupiter.api.AfterEach;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -70,7 +70,7 @@ public static void setUp(String regionImpl) {
}
}

@After
@AfterEach
public void tearDown() throws Exception {
HTU.shutdownMiniCluster();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
*/
package org.apache.hadoop.hbase.coprocessor.example;

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

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder;
import org.apache.hadoop.hbase.client.RegionInfo;
Expand All @@ -38,15 +38,11 @@
import org.apache.hadoop.hbase.regionserver.RegionServerServices;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.wal.WAL;
import org.junit.ClassRule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;

@Category(MediumTests.class)
@Tag(MediumTests.TAG)
public class TestRefreshHFilesEndpoint extends TestRefreshHFilesBase {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestRefreshHFilesEndpoint.class);

@Test
public void testRefreshRegionHFilesEndpoint() throws Exception {
Expand All @@ -57,10 +53,10 @@ public void testRefreshRegionHFilesEndpoint() throws Exception {
assertEquals(4, HTU.getNumHFiles(TABLE_NAME, FAMILY));
}

@Test(expected = IOException.class)
@Test
public void testRefreshRegionHFilesEndpointWithException() throws IOException {
setUp(HRegionForRefreshHFilesEP.class.getName());
callRefreshRegionHFilesEndPoint();
assertThrows(IOException.class, () -> callRefreshRegionHFilesEndPoint());
}

private void callRefreshRegionHFilesEndPoint() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
*/
package org.apache.hadoop.hbase.coprocessor.example;

import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.jupiter.api.Assertions.assertArrayEquals;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName;
import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor;
Expand All @@ -39,19 +38,15 @@
import org.apache.hadoop.hbase.testclassification.CoprocessorTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
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;

@Category({ CoprocessorTests.class, MediumTests.class })
@Tag(CoprocessorTests.TAG)
@Tag(MediumTests.TAG)
public class TestScanModifyingObserver {

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

private static final HBaseTestingUtility UTIL = new HBaseTestingUtility();
private static final TableName NAME = TableName.valueOf("TestScanModifications");
private static final byte[] FAMILY = Bytes.toBytes("f");
Expand All @@ -63,7 +58,7 @@ public class TestScanModifyingObserver {
private static final byte[] EXPLICIT_VAL = Bytes.toBytes("provided");
private static final byte[] IMPLICIT_VAL = Bytes.toBytes("implicit");

@BeforeClass
@BeforeAll
public static void setUp() throws Exception {
UTIL.startMiniCluster(1);
UTIL.getAdmin()
Expand All @@ -74,7 +69,7 @@ public static void setUp() throws Exception {
.setColumnFamily(CFD).build());
}

@AfterClass
@AfterAll
public static void tearDown() throws Exception {
UTIL.shutdownMiniCluster();
}
Expand All @@ -101,7 +96,7 @@ public void test() throws IOException {
try (ResultScanner scanner = t.getScanner(s)) {
for (int i = 0; i < NUM_ROWS; i++) {
Result result = scanner.next();
assertNotNull("The " + (i + 1) + "th result was unexpectedly null", result);
assertNotNull(result, "The " + (i + 1) + "th result was unexpectedly null");
assertEquals(2, result.getFamilyMap(FAMILY).size());
assertArrayEquals(Bytes.toBytes(i + 1), result.getRow());
assertArrayEquals(EXPLICIT_VAL, result.getValue(FAMILY, EXPLICIT_QUAL));
Expand Down
Loading