-
Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-30011 Upgrade hbase-server to use junit5 Part1 #7947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
liuxiaocs7
wants to merge
1
commit into
apache:master
Choose a base branch
from
liuxiaocs7:HBASE-29998
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,423
−1,755
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,9 +17,9 @@ | |
| */ | ||
| package org.apache.hadoop.hbase.filter; | ||
|
|
||
| import static org.junit.Assert.assertNotNull; | ||
| import static org.junit.Assert.assertNull; | ||
| import static org.junit.Assert.assertTrue; | ||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
| import static org.junit.jupiter.api.Assertions.assertNull; | ||
| import static org.junit.jupiter.api.Assertions.assertTrue; | ||
|
|
||
| import java.io.IOException; | ||
| import java.util.ArrayList; | ||
|
|
@@ -36,40 +36,35 @@ | |
| import org.apache.hadoop.hbase.client.Table; | ||
| import org.apache.hadoop.hbase.client.TableDescriptor; | ||
| import org.apache.hadoop.hbase.client.TableDescriptorBuilder; | ||
| import org.apache.hadoop.hbase.testclassification.FilterTests; | ||
| 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.experimental.categories.Category; | ||
| import org.junit.jupiter.api.AfterAll; | ||
|
|
||
| /** | ||
| * By using this class as the super class of a set of tests you will have a HBase testing cluster | ||
| * available that is very suitable for writing tests for scanning and filtering against. | ||
| */ | ||
| @Category({ FilterTests.class, MediumTests.class }) | ||
| public class FilterTestingCluster { | ||
| private static final HBaseTestingUtil TEST_UTIL = new HBaseTestingUtil(); | ||
| private static Admin admin = null; | ||
| private static List<TableName> createdTables = new ArrayList<>(); | ||
|
|
||
| protected static void createTable(TableName tableName, String columnFamilyName) { | ||
| assertNotNull("HBaseAdmin is not initialized successfully.", admin); | ||
| assertNotNull(admin, "HBaseAdmin is not initialized successfully."); | ||
| TableDescriptor tableDescriptor = TableDescriptorBuilder.newBuilder(tableName) | ||
| .setColumnFamily(ColumnFamilyDescriptorBuilder.of(Bytes.toBytes(columnFamilyName))).build(); | ||
|
|
||
| try { | ||
| admin.createTable(tableDescriptor); | ||
| createdTables.add(tableName); | ||
| assertTrue("Fail to create the table", admin.tableExists(tableName)); | ||
| assertTrue(admin.tableExists(tableName), "Fail to create the table"); | ||
| } catch (IOException e) { | ||
| assertNull("Exception found while creating table", e); | ||
| assertNull(e, "Exception found while creating table"); | ||
| } | ||
| } | ||
|
|
||
| protected static Table openTable(TableName tableName) throws IOException { | ||
| Table table = TEST_UTIL.getConnection().getTable(tableName); | ||
| assertTrue("Fail to create the table", admin.tableExists(tableName)); | ||
| assertTrue(admin.tableExists(tableName), "Fail to create the table"); | ||
| return table; | ||
| } | ||
|
|
||
|
|
@@ -82,7 +77,7 @@ private static void deleteTables() { | |
| admin.deleteTable(tableName); | ||
| } | ||
| } catch (IOException e) { | ||
| assertNull("Exception found deleting the table", e); | ||
| assertNull(e, "Exception found deleting the table"); | ||
| } | ||
| } | ||
| } | ||
|
|
@@ -94,21 +89,20 @@ private static void initialize(Configuration conf) { | |
| try { | ||
| admin = TEST_UTIL.getAdmin(); | ||
| } catch (MasterNotRunningException e) { | ||
| assertNull("Master is not running", e); | ||
| assertNull(e, "Master is not running"); | ||
| } catch (ZooKeeperConnectionException e) { | ||
| assertNull("Cannot connect to ZooKeeper", e); | ||
| assertNull(e, "Cannot connect to ZooKeeper"); | ||
| } catch (IOException e) { | ||
| assertNull("IOException", e); | ||
| assertNull(e, "IOException"); | ||
| } | ||
| } | ||
|
|
||
| @BeforeClass | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No BeforeAll? |
||
| public static void setUp() throws Exception { | ||
| TEST_UTIL.startMiniCluster(1); | ||
| initialize(TEST_UTIL.getConfiguration()); | ||
| } | ||
|
|
||
| @AfterClass | ||
| @AfterAll | ||
| public static void tearDown() throws Exception { | ||
| deleteTables(); | ||
| TEST_UTIL.shutdownMiniCluster(); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing Tag?