-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix download url, prefix, create logic, add jsonIO util
- Loading branch information
Showing
13 changed files
with
119 additions
and
18 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains 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 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 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 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
1 change: 1 addition & 0 deletions
1
springWarehouse/src/main/resources/report/20231112-17-15-24_report.json
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"king","age":17} |
1 change: 1 addition & 0 deletions
1
springWarehouse/src/main/resources/report/20231112-18-00-25_report.json
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"king","age":17} |
1 change: 1 addition & 0 deletions
1
springWarehouse/src/main/resources/report/20231112-18-03-04_report.json
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"king","age":17} |
1 change: 1 addition & 0 deletions
1
springWarehouse/src/main/resources/report/20231112-18-13-33_report.json
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"king","age":17} |
1 change: 1 addition & 0 deletions
1
springWarehouse/src/main/resources/report/20231112-18-13-35_report.json
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"king","age":17} |
This file contains 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"king","age":17} |
This file contains 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
46 changes: 46 additions & 0 deletions
46
springWarehouse/src/test/java/com/yen/springWarehouse/util/FileUtilTest.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.yen.springWarehouse.util; | ||
|
||
import com.yen.springWarehouse.controller.DownloadController; | ||
import org.junit.jupiter.api.Test; | ||
|
||
import java.io.File; | ||
import java.net.URI; | ||
import java.net.URISyntaxException; | ||
import java.net.URL; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import static org.junit.jupiter.api.Assertions.*; | ||
|
||
class FileUtilTest { | ||
|
||
@Test | ||
public void testWriteJsonFile() throws URISyntaxException { | ||
|
||
String userDirectory = new File("").getAbsolutePath(); | ||
System.out.println(">>> current path = " + userDirectory); // >>> crrent path = /Users/yennanliu/SpringPlayground/springWarehouse | ||
String prefix = userDirectory + "/src/main/resources/report"; | ||
|
||
FileUtil fileUtil = new FileUtil(); | ||
String fileName = prefix + "/" + "test_output_2.json"; | ||
Map<String, Object> map = new HashMap<>(); | ||
map.put("name", "king"); | ||
map.put("age", 17); | ||
Boolean result = fileUtil.writeJsonFile(map, fileName); | ||
System.out.println("write json to : " + fileName); | ||
System.out.println(result); | ||
} | ||
|
||
@Test | ||
public void testWriteJsonFile2() throws URISyntaxException { | ||
|
||
URL url = this.getClass().getResource("/report"); | ||
File parentDirectory = new File(new URI(url.toString())); | ||
|
||
System.out.println("url = " + url); | ||
System.out.println("url.getPath() = " + url.getPath()); | ||
System.out.println("parentDirectory = " + parentDirectory); | ||
|
||
} | ||
|
||
} |