From 6ba290c4523883ba6c21ff946c879c15946d7495 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E6=B8=85?= <62982788+597365581@users.noreply.github.com> Date: Sat, 30 Jan 2021 16:06:20 +0800 Subject: [PATCH] Update ShellCommandExecutorTest.java update unit test --- .../shell/ShellCommandExecutorTest.java | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java index 5a848dfb68..3f65ec87f5 100644 --- a/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java +++ b/dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java @@ -28,6 +28,7 @@ import org.apache.dolphinscheduler.common.enums.ExecutionStatus; import org.apache.dolphinscheduler.common.utils.LoggerUtils; import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.dao.entity.TaskInstance; +import org.apache.dolphinscheduler.server.worker.task.AbstractCommandExecutor; import org.apache.dolphinscheduler.server.worker.task.AbstractTask; import org.apache.dolphinscheduler.server.worker.task.ShellCommandExecutor; import org.apache.dolphinscheduler.server.worker.task.TaskProps; @@ -172,4 +173,36 @@ public class ShellCommandExecutorTest { logger.error(e.getMessage()); } } + + @Test + public void testFindAppId(){ + Class shellCommandExecutorClass = ShellCommandExecutor.class; + try{ + Object instance = shellCommandExecutorClass.newInstance(); + + Method method = shellCommandExecutorClass.getDeclaredMethod("findAppId", new Class[]{String.class}); + method.setAccessible(true); + Object[] arg1s = {"11111"}; + ShellCommandExecutor result = (ShellCommandExecutor) method.invoke(instance, arg1s); + } + catch (Exception e){ + logger.error(e.getMessage()); + } + } + + @Test + public void testConvertFile2List(){ + Class shellCommandExecutorClass = AbstractCommandExecutor.class; + try{ + Object instance = shellCommandExecutorClass.newInstance(); + + Method method = shellCommandExecutorClass.getDeclaredMethod("convertFile2List", new Class[]{String.class}); + method.setAccessible(true); + Object[] arg1s = {"/opt/1.txt"}; + AbstractCommandExecutor result = (AbstractCommandExecutor) method.invoke(instance, arg1s); + } + catch (Exception e){ + logger.error(e.getMessage()); + } + } }