Loading dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java +5 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.*; Loading Loading @@ -102,7 +103,11 @@ public class ExcelUtils { for (int i = 0; i < headerList.size(); i++) { sheet.setColumnWidth(i, headerList.get(i).length() * 800); } File file = new File(xlsFilePath); if (!file.exists()) { file.mkdirs(); } //setting file output Loading dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/ExcelUtilsTest.java +10 −0 Original line number Diff line number Diff line Loading @@ -89,4 +89,14 @@ public class ExcelUtilsTest { ExcelUtils.genExcelFile(incorrectContent1, title, xlsFilePath); } /** * Test GenExcelFile (check directory) */ @Test public void testGenExcelFileByCheckDir() { ExcelUtils.genExcelFile("[{\"a\": \"a\"},{\"a\": \"a\"}]", "t", "/tmp/xls"); File file = new File("/tmp/xls" + Constants.SINGLE_SLASH + "t" + Constants.EXCEL_SUFFIX_XLS); file.delete(); } } No newline at end of file dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java +1 −2 Original line number Diff line number Diff line Loading @@ -154,8 +154,7 @@ public class ResourcesController extends BaseController{ @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100"), @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType ="ResourceType"), @ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType ="String"), @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType ="String"), @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true,dataType = "MultipartFile") @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType ="String") }) @PostMapping(value = "/update") public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, Loading dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java +2 −8 Original line number Diff line number Diff line Loading @@ -352,13 +352,7 @@ public class OSUtils { return sb.toString(); } finally { if (br != null) { try { br.close(); } catch (Exception e) { logger.error(e.getMessage(), e); } } IOUtils.closeQuietly(br); } } Loading Loading @@ -408,7 +402,7 @@ public class OSUtils { * whether is windows * @return true if windows */ public static boolean isWindows() { ; public static boolean isWindows() { return getOSName().startsWith("Windows"); } Loading dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class OSUtilsTest { @Test public void cpuUsage() throws Exception { logger.info("cpuUsage : {}", OSUtils.cpuUsage()); Thread.sleep(1000l); Thread.sleep(1000L); logger.info("cpuUsage : {}", OSUtils.cpuUsage()); double cpuUsage = OSUtils.cpuUsage(); Loading Loading
dolphinscheduler-alert/src/main/java/org/apache/dolphinscheduler/alert/utils/ExcelUtils.java +5 −0 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ import org.apache.poi.ss.usermodel.HorizontalAlignment; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.*; Loading Loading @@ -102,7 +103,11 @@ public class ExcelUtils { for (int i = 0; i < headerList.size(); i++) { sheet.setColumnWidth(i, headerList.get(i).length() * 800); } File file = new File(xlsFilePath); if (!file.exists()) { file.mkdirs(); } //setting file output Loading
dolphinscheduler-alert/src/test/java/org/apache/dolphinscheduler/alert/utils/ExcelUtilsTest.java +10 −0 Original line number Diff line number Diff line Loading @@ -89,4 +89,14 @@ public class ExcelUtilsTest { ExcelUtils.genExcelFile(incorrectContent1, title, xlsFilePath); } /** * Test GenExcelFile (check directory) */ @Test public void testGenExcelFileByCheckDir() { ExcelUtils.genExcelFile("[{\"a\": \"a\"},{\"a\": \"a\"}]", "t", "/tmp/xls"); File file = new File("/tmp/xls" + Constants.SINGLE_SLASH + "t" + Constants.EXCEL_SUFFIX_XLS); file.delete(); } } No newline at end of file
dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/controller/ResourcesController.java +1 −2 Original line number Diff line number Diff line Loading @@ -154,8 +154,7 @@ public class ResourcesController extends BaseController{ @ApiImplicitParam(name = "id", value = "RESOURCE_ID", required = true, dataType ="Int", example = "100"), @ApiImplicitParam(name = "type", value = "RESOURCE_TYPE", required = true, dataType ="ResourceType"), @ApiImplicitParam(name = "name", value = "RESOURCE_NAME", required = true, dataType ="String"), @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType ="String"), @ApiImplicitParam(name = "file", value = "RESOURCE_FILE", required = true,dataType = "MultipartFile") @ApiImplicitParam(name = "description", value = "RESOURCE_DESC", dataType ="String") }) @PostMapping(value = "/update") public Result updateResource(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser, Loading
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java +2 −8 Original line number Diff line number Diff line Loading @@ -352,13 +352,7 @@ public class OSUtils { return sb.toString(); } finally { if (br != null) { try { br.close(); } catch (Exception e) { logger.error(e.getMessage(), e); } } IOUtils.closeQuietly(br); } } Loading Loading @@ -408,7 +402,7 @@ public class OSUtils { * whether is windows * @return true if windows */ public static boolean isWindows() { ; public static boolean isWindows() { return getOSName().startsWith("Windows"); } Loading
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java +1 −1 Original line number Diff line number Diff line Loading @@ -67,7 +67,7 @@ public class OSUtilsTest { @Test public void cpuUsage() throws Exception { logger.info("cpuUsage : {}", OSUtils.cpuUsage()); Thread.sleep(1000l); Thread.sleep(1000L); logger.info("cpuUsage : {}", OSUtils.cpuUsage()); double cpuUsage = OSUtils.cpuUsage(); Loading