This is an automated email from the ASF dual-hosted git repository.
vbalaji 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 7c59095 [HUDI-975] Add unit tests in TestHoodieTableFileSystemView to
test view for non-partitioned table (#1692)
7c59095 is described below
commit 7c59095314f5525590eea308084079a31bde3e17
Author: cxzl25 <[email protected]>
AuthorDate: Mon Jun 1 22:23:28 2020 +0800
[HUDI-975] Add unit tests in TestHoodieTableFileSystemView to test view for
non-partitioned table (#1692)
---
.../table/view/TestHoodieTableFileSystemView.java | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git
a/hudi-common/src/test/java/org/apache/hudi/common/table/view/TestHoodieTableFileSystemView.java
b/hudi-common/src/test/java/org/apache/hudi/common/table/view/TestHoodieTableFileSystemView.java
index d8b2adb..5e83379 100644
---
a/hudi-common/src/test/java/org/apache/hudi/common/table/view/TestHoodieTableFileSystemView.java
+++
b/hudi-common/src/test/java/org/apache/hudi/common/table/view/TestHoodieTableFileSystemView.java
@@ -48,6 +48,7 @@ import org.junit.jupiter.api.Test;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -103,13 +104,17 @@ public class TestHoodieTableFileSystemView extends
HoodieCommonTestHarness {
*/
@Test
public void testViewForFileSlicesWithNoBaseFile() throws Exception {
- testViewForFileSlicesWithNoBaseFile(1, 0);
+ testViewForFileSlicesWithNoBaseFile(1, 0, "2016/05/01");
}
- protected void testViewForFileSlicesWithNoBaseFile(int
expNumTotalFileSlices, int expNumTotalDataFiles)
- throws Exception {
- String partitionPath = "2016/05/01";
- new File(basePath + "/" + partitionPath).mkdirs();
+ @Test
+ public void testViewForFileSlicesWithNoBaseFileNonPartitioned() throws
Exception {
+ testViewForFileSlicesWithNoBaseFile(1, 0, "");
+ }
+
+ protected void testViewForFileSlicesWithNoBaseFile(int
expNumTotalFileSlices, int expNumTotalDataFiles,
+ String partitionPath) throws Exception {
+ Paths.get(basePath, partitionPath).toFile().mkdirs();
String fileId = UUID.randomUUID().toString();
String instantTime1 = "1";
@@ -119,8 +124,9 @@ public class TestHoodieTableFileSystemView extends
HoodieCommonTestHarness {
FSUtils.makeLogFileName(fileId, HoodieLogFile.DELTA_EXTENSION,
instantTime1, 0, TEST_WRITE_TOKEN);
String fileName2 =
FSUtils.makeLogFileName(fileId, HoodieLogFile.DELTA_EXTENSION,
instantTime1, 1, TEST_WRITE_TOKEN);
- new File(basePath + "/" + partitionPath + "/" + fileName1).createNewFile();
- new File(basePath + "/" + partitionPath + "/" + fileName2).createNewFile();
+
+ Paths.get(basePath, partitionPath, fileName1).toFile().createNewFile();
+ Paths.get(basePath, partitionPath, fileName2).toFile().createNewFile();
HoodieActiveTimeline commitTimeline = metaClient.getActiveTimeline();
HoodieInstant instant1 = new HoodieInstant(true,
HoodieTimeline.COMMIT_ACTION, instantTime1);
HoodieInstant deltaInstant2 = new HoodieInstant(true,
HoodieTimeline.DELTA_COMMIT_ACTION, deltaInstantTime1);