This is an automated email from the ASF dual-hosted git repository.
zhangyue19921010 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hudi.git
The following commit(s) were added to refs/heads/master by this push:
new e4ec721a1ef6 Remove unnecessary "public" scope for some test classes
(#13565)
e4ec721a1ef6 is described below
commit e4ec721a1ef6964dcc0c90fb49b09d6fae2bcfc3
Author: Lin Liu <[email protected]>
AuthorDate: Sat Jul 19 18:03:38 2025 -0700
Remove unnecessary "public" scope for some test classes (#13565)
---
.../hudi/common/table/TestHoodieTableConfig.java | 30 +++++++++++-----------
.../common/table/TestHoodieTableMetaClient.java | 26 +++++++++----------
.../hudi/common/table/TestTableSchemaResolver.java | 8 +++---
.../hudi/common/table/TestTimelineUtils.java | 30 +++++++++++-----------
.../common/table/TestTimelineUtilsBackComp.java | 4 +--
5 files changed, 49 insertions(+), 49 deletions(-)
diff --git
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestHoodieTableConfig.java
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestHoodieTableConfig.java
index ecd09b5b01ad..2429a83ba0db 100644
---
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestHoodieTableConfig.java
+++
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestHoodieTableConfig.java
@@ -77,7 +77,7 @@ import static
org.junit.jupiter.params.provider.Arguments.arguments;
/**
* Tests {@link HoodieTableConfig}.
*/
-public class TestHoodieTableConfig extends HoodieCommonTestHarness {
+class TestHoodieTableConfig extends HoodieCommonTestHarness {
private HoodieStorage storage;
private StoragePath metaPath;
@@ -102,7 +102,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testCreate() throws IOException {
+ void testCreate() throws IOException {
assertTrue(
storage.exists(new StoragePath(metaPath,
HoodieTableConfig.HOODIE_PROPERTIES_FILE)));
HoodieTableConfig config = new HoodieTableConfig(storage, metaPath, null,
null, null);
@@ -110,7 +110,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testUpdate() throws IOException {
+ void testUpdate() throws IOException {
Properties updatedProps = new Properties();
updatedProps.setProperty(HoodieTableConfig.NAME.key(), "test-table2");
updatedProps.setProperty(HoodieTableConfig.PRECOMBINE_FIELD.key(),
"new_field");
@@ -125,7 +125,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testDelete() throws IOException {
+ void testDelete() throws IOException {
Set<String> deletedProps =
CollectionUtils.createSet(HoodieTableConfig.TIMELINE_HISTORY_PATH.key(),
"hoodie.invalid.config");
HoodieTableConfig.delete(storage, metaPath, deletedProps);
@@ -139,7 +139,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testReadsWhenPropsFileDoesNotExist() throws IOException {
+ void testReadsWhenPropsFileDoesNotExist() throws IOException {
storage.deleteFile(cfgPath);
assertThrows(HoodieIOException.class, () -> {
new HoodieTableConfig(storage, metaPath, null, null, null);
@@ -147,7 +147,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testReadsWithUpdateFailures() throws IOException {
+ void testReadsWithUpdateFailures() throws IOException {
HoodieTableConfig config = new HoodieTableConfig(storage, metaPath, null,
null, null);
storage.deleteFile(cfgPath);
try (OutputStream out = storage.create(backupCfgPath)) {
@@ -162,7 +162,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
@ParameterizedTest
@ValueSource(booleans = {true, false})
- public void testUpdateRecovery(boolean shouldPropsFileExist) throws
IOException {
+ void testUpdateRecovery(boolean shouldPropsFileExist) throws IOException {
HoodieTableConfig config = new HoodieTableConfig(storage, metaPath, null,
null, null);
if (!shouldPropsFileExist) {
storage.deleteFile(cfgPath);
@@ -179,7 +179,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testReadRetry() throws IOException {
+ void testReadRetry() throws IOException {
// When both the hoodie.properties and hoodie.properties.backup do not
exist then the read fails
storage.rename(cfgPath, new StoragePath(cfgPath.toString() + ".bak"));
assertThrows(HoodieIOException.class, () -> new HoodieTableConfig(storage,
metaPath, null, null, null));
@@ -205,7 +205,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testConcurrentlyUpdate() throws ExecutionException,
InterruptedException {
+ void testConcurrentlyUpdate() throws ExecutionException,
InterruptedException {
final ExecutorService executor = Executors.newFixedThreadPool(2);
Future updaterFuture = executor.submit(() -> {
for (int i = 0; i < 100; i++) {
@@ -230,7 +230,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
@ParameterizedTest
@EnumSource(value = HoodieTableVersion.class, names = {"SEVEN", "EIGHT"})
- public void testPartitionFields(HoodieTableVersion version) {
+ void testPartitionFields(HoodieTableVersion version) {
Properties updatedProps = new Properties();
updatedProps.setProperty(HoodieTableConfig.PARTITION_FIELDS.key(),
version.greaterThan(HoodieTableVersion.SEVEN) ? "p1:simple,p2:timestamp" :
"p1,p2");
updatedProps.setProperty(HoodieTableConfig.VERSION.key(),
String.valueOf(HoodieTableVersion.EIGHT.versionCode()));
@@ -245,7 +245,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
@ParameterizedTest
@ValueSource(strings = {"p1:simple,p2:timestamp", "p1,p2"})
- public void testPartitionFieldAPIs(String partitionFields) {
+ void testPartitionFieldAPIs(String partitionFields) {
Properties updatedProps = new Properties();
updatedProps.setProperty(HoodieTableConfig.PARTITION_FIELDS.key(),
partitionFields);
HoodieTableConfig.update(storage, metaPath, updatedProps);
@@ -259,7 +259,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testValidateConfigVersion() {
+ void testValidateConfigVersion() {
assertTrue(HoodieTableConfig.validateConfigVersion(HoodieTableConfig.INITIAL_VERSION,
HoodieTableVersion.EIGHT));
assertTrue(HoodieTableConfig.validateConfigVersion(ConfigProperty.key("").noDefaultValue().withDocumentation(""),
HoodieTableVersion.SIX));
@@ -267,7 +267,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testDropInvalidConfigs() {
+ void testDropInvalidConfigs() {
// test invalid configs are dropped
HoodieConfig config = new HoodieConfig();
config.setValue(HoodieTableConfig.VERSION,
String.valueOf(HoodieTableVersion.SIX.versionCode()));
@@ -288,7 +288,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
}
@Test
- public void testDefinedTableConfigs() {
+ void testDefinedTableConfigs() {
List<ConfigProperty<?>> configProperties =
HoodieTableConfig.definedTableConfigs();
assertEquals(41, configProperties.size());
configProperties.forEach(c -> {
@@ -442,7 +442,7 @@ public class TestHoodieTableConfig extends
HoodieCommonTestHarness {
@ParameterizedTest
@MethodSource("argumentsForInferringRecordMergeMode")
- public void testInferMergeMode(RecordMergeMode inputMergeMode, String
inputPayloadClass,
+ void testInferMergeMode(RecordMergeMode inputMergeMode, String
inputPayloadClass,
String inputMergeStrategy, String
orderingFieldName,
String shouldThrowString, RecordMergeMode
outputMergeMode,
String outputPayloadClass, String
outputMergeStrategy) throws IOException {
diff --git
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestHoodieTableMetaClient.java
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestHoodieTableMetaClient.java
index 3df19ac4e9d8..3ca65f15ef16 100644
---
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestHoodieTableMetaClient.java
+++
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestHoodieTableMetaClient.java
@@ -55,7 +55,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests hoodie table meta client {@link HoodieTableMetaClient}.
*/
-public class TestHoodieTableMetaClient extends HoodieCommonTestHarness {
+class TestHoodieTableMetaClient extends HoodieCommonTestHarness {
@BeforeEach
public void init() throws IOException {
@@ -68,7 +68,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void checkMetadata() {
+ void checkMetadata() {
assertEquals(HoodieTestUtils.RAW_TRIPS_TEST_NAME,
metaClient.getTableConfig().getTableName(),
"Table name should be raw_trips");
assertEquals(basePath, metaClient.getBasePath().toString(), "Basepath
should be the one assigned");
@@ -80,7 +80,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testSerDe() throws IOException {
+ void testSerDe() throws IOException {
// check if this object is serialized and de-serialized, we are able to
read from the file system
HoodieTableMetaClient deserializedMetaClient =
HoodieTestUtils.serializeDeserialize(metaClient,
HoodieTableMetaClient.class);
@@ -99,7 +99,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testCommitTimeline() throws IOException {
+ void testCommitTimeline() throws IOException {
HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
HoodieTimeline activeCommitTimeline =
activeTimeline.getCommitAndReplaceTimeline();
assertTrue(activeCommitTimeline.empty(), "Should be empty commit
timeline");
@@ -125,7 +125,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testEquals() throws IOException {
+ void testEquals() throws IOException {
HoodieTableMetaClient metaClient1 =
HoodieTestUtils.init(tempDir.toAbsolutePath().toString(), getTableType());
HoodieTableMetaClient metaClient2 =
HoodieTestUtils.init(tempDir.toAbsolutePath().toString(), getTableType());
assertEquals(metaClient1, metaClient2);
@@ -134,7 +134,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testToString() throws IOException {
+ void testToString() throws IOException {
HoodieTableMetaClient metaClient1 =
HoodieTestUtils.init(tempDir.toAbsolutePath().toString(), getTableType());
HoodieTableMetaClient metaClient2 =
HoodieTestUtils.init(tempDir.toAbsolutePath().toString(), getTableType());
assertEquals(metaClient1.toString(), metaClient2.toString());
@@ -142,7 +142,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testTableVersion() throws IOException {
+ void testTableVersion() throws IOException {
final String basePath = tempDir.toAbsolutePath() + Path.SEPARATOR + "t1";
HoodieTableMetaClient metaClient1 = HoodieTableMetaClient.newTableBuilder()
.setTableType(HoodieTableType.MERGE_ON_READ.name())
@@ -159,7 +159,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testGenerateFromAnotherMetaClient() throws IOException {
+ void testGenerateFromAnotherMetaClient() throws IOException {
final String basePath1 = tempDir.toAbsolutePath().toString() +
Path.SEPARATOR + "t2A";
final String basePath2 = tempDir.toAbsolutePath().toString() +
Path.SEPARATOR + "t2B";
@@ -179,7 +179,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testTableBuilderRequiresTableNameAndType() {
+ void testTableBuilderRequiresTableNameAndType() {
assertThrows(IllegalArgumentException.class, () -> {
HoodieTableMetaClient.builder()
.setConf(this.metaClient.getStorageConf())
@@ -198,7 +198,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testCreateMetaClientFromProperties() throws IOException {
+ void testCreateMetaClientFromProperties() throws IOException {
final String basePath = tempDir.toAbsolutePath().toString() +
Path.SEPARATOR + "t5";
Properties props = new Properties();
props.setProperty(HoodieTableConfig.NAME.key(), "test-table");
@@ -223,7 +223,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testCreateLayoutInStorage() throws IOException {
+ void testCreateLayoutInStorage() throws IOException {
final String basePath = tempDir.toAbsolutePath().toString() +
Path.SEPARATOR + "t6";
HoodieTableMetaClient metaClient1 = HoodieTableMetaClient.newTableBuilder()
.setTableType(HoodieTableType.COPY_ON_WRITE.name())
@@ -240,7 +240,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testGetIndexDefinitionPath() throws IOException {
+ void testGetIndexDefinitionPath() throws IOException {
final String basePath = tempDir.toAbsolutePath() + Path.SEPARATOR + "t7";
HoodieTableMetaClient metaClient = HoodieTableMetaClient.newTableBuilder()
.setTableType(HoodieTableType.COPY_ON_WRITE.name())
@@ -254,7 +254,7 @@ public class TestHoodieTableMetaClient extends
HoodieCommonTestHarness {
}
@Test
- public void testDeleteDefinition() throws IOException {
+ void testDeleteDefinition() throws IOException {
final String basePath = tempDir.toAbsolutePath() + Path.SEPARATOR + "t7";
HoodieTableMetaClient metaClient = HoodieTableMetaClient.newTableBuilder()
.setTableType(HoodieTableType.COPY_ON_WRITE.name())
diff --git
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTableSchemaResolver.java
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTableSchemaResolver.java
index c5e63e3761af..62942b5b742b 100644
---
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTableSchemaResolver.java
+++
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTableSchemaResolver.java
@@ -53,13 +53,13 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* Tests {@link TableSchemaResolver}.
*/
-public class TestTableSchemaResolver {
+class TestTableSchemaResolver {
@TempDir
- public java.nio.file.Path tempDir;
+ java.nio.file.Path tempDir;
@Test
- public void testRecreateSchemaWhenDropPartitionColumns() {
+ void testRecreateSchemaWhenDropPartitionColumns() {
Schema originSchema = new
Schema.Parser().parse(HoodieTestDataGenerator.TRIP_EXAMPLE_SCHEMA);
// case2
@@ -90,7 +90,7 @@ public class TestTableSchemaResolver {
}
@Test
- public void testReadSchemaFromLogFile() throws IOException,
URISyntaxException, InterruptedException {
+ void testReadSchemaFromLogFile() throws IOException, URISyntaxException,
InterruptedException {
String testDir = initTestDir("read_schema_from_log_file");
StoragePath partitionPath = new StoragePath(testDir, "partition1");
Schema expectedSchema = getSimpleSchema();
diff --git
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTimelineUtils.java
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTimelineUtils.java
index 82cee2e572fc..d07a0f3d1b40 100644
---
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTimelineUtils.java
+++
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTimelineUtils.java
@@ -87,21 +87,21 @@ import static org.mockito.Mockito.when;
/**
* Tests {@link TimelineUtils}.
*/
-public class TestTimelineUtils extends HoodieCommonTestHarness {
+class TestTimelineUtils extends HoodieCommonTestHarness {
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
initMetaClient();
}
@AfterEach
- public void tearDown() throws Exception {
+ void tearDown() throws Exception {
cleanMetaClient();
}
@ParameterizedTest
@ValueSource(booleans = {true, false})
- public void testGetPartitionsWithReplaceOrClusterCommits(boolean
withReplace) throws IOException {
+ void testGetPartitionsWithReplaceOrClusterCommits(boolean withReplace)
throws IOException {
HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
HoodieTimeline activeCommitTimeline =
activeTimeline.getCommitAndReplaceTimeline();
assertTrue(activeCommitTimeline.empty());
@@ -154,7 +154,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
}
@Test
- public void testGetPartitions() throws IOException {
+ void testGetPartitions() throws IOException {
HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
HoodieTimeline activeCommitTimeline =
activeTimeline.getCommitAndReplaceTimeline();
assertTrue(activeCommitTimeline.empty());
@@ -193,7 +193,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
}
@Test
- public void testGetPartitionsUnPartitioned() throws IOException {
+ void testGetPartitionsUnPartitioned() throws IOException {
HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
HoodieTimeline activeCommitTimeline =
activeTimeline.getCommitAndReplaceTimeline();
assertTrue(activeCommitTimeline.empty());
@@ -221,7 +221,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
}
@Test
- public void testRestoreInstants() throws Exception {
+ void testRestoreInstants() throws Exception {
HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
HoodieTimeline activeCommitTimeline =
activeTimeline.getCommitAndReplaceTimeline();
assertTrue(activeCommitTimeline.empty());
@@ -244,7 +244,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
}
@Test
- public void testGetExtraMetadata() throws Exception {
+ void testGetExtraMetadata() throws Exception {
String extraMetadataKey = "test_key";
String extraMetadataValue1 = "test_value1";
HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
@@ -295,7 +295,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
}
@Test
- public void testGetCommitsTimelineAfter() throws IOException {
+ void testGetCommitsTimelineAfter() throws IOException {
// Should only load active timeline
String startTs = "010";
HoodieTableMetaClient mockMetaClient = prepareMetaClient(
@@ -405,7 +405,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
return mockMetaClient;
}
- public void verifyTimeline(List<HoodieInstant> expectedInstants,
HoodieTimeline timeline) {
+ void verifyTimeline(List<HoodieInstant> expectedInstants, HoodieTimeline
timeline) {
assertEquals(
expectedInstants.stream().sorted().collect(Collectors.toList()),
timeline.getInstants().stream().sorted().collect(Collectors.toList())
@@ -413,7 +413,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
}
@Test
- public void testGetEarliestInstantForMetadataArchival() throws IOException {
+ void testGetEarliestInstantForMetadataArchival() throws IOException {
// Empty timeline
assertEquals(
Option.empty(),
@@ -530,8 +530,8 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
}
private HoodieReplaceCommitMetadata getReplaceCommitMetadata(String
basePath, String commitTs, String replacePartition, int replaceCount,
- String
newFilePartition, int newFileCount, Map<String, String> extraMetadata,
-
WriteOperationType operationType) {
+ String
newFilePartition, int newFileCount, Map<String, String> extraMetadata,
+
WriteOperationType operationType) {
HoodieReplaceCommitMetadata commit = new HoodieReplaceCommitMetadata();
commit.setOperationType(operationType);
for (int i = 1; i <= newFileCount; i++) {
@@ -555,7 +555,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
return commit;
}
- private Option<HoodieCleanMetadata> getCleanMetadata(String partition,
String time, boolean isPartitionDeleted) throws IOException {
+ private Option<HoodieCleanMetadata> getCleanMetadata(String partition,
String time, boolean isPartitionDeleted) {
Map<String, HoodieCleanPartitionMetadata> partitionToFilesCleaned = new
HashMap<>();
List<String> filesDeleted = new ArrayList<>();
filesDeleted.add("file-" + partition + "-" + time + "1");
@@ -580,7 +580,7 @@ public class TestTimelineUtils extends
HoodieCommonTestHarness {
}
@Test
- public void testGetDroppedPartitions() throws Exception {
+ void testGetDroppedPartitions() throws Exception {
HoodieActiveTimeline activeTimeline = metaClient.getActiveTimeline();
HoodieTimeline activeCommitTimeline =
activeTimeline.getCommitAndReplaceTimeline();
assertTrue(activeCommitTimeline.empty());
diff --git
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTimelineUtilsBackComp.java
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTimelineUtilsBackComp.java
index 6527ba82913b..9eb99809e479 100644
---
a/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTimelineUtilsBackComp.java
+++
b/hudi-hadoop-common/src/test/java/org/apache/hudi/common/table/TestTimelineUtilsBackComp.java
@@ -41,9 +41,9 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
-public class TestTimelineUtilsBackComp extends HoodieCommonTestHarness {
+class TestTimelineUtilsBackComp extends HoodieCommonTestHarness {
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
initPath();
}