Browse Source

Update ShellCommandExecutorTest.java

update unit test
pull/3/MERGE
小清 4 years ago committed by GitHub
parent
commit
6ba290c452
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 33
      dolphinscheduler-server/src/test/java/org/apache/dolphinscheduler/server/worker/shell/ShellCommandExecutorTest.java

33
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<ShellCommandExecutor> 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<AbstractCommandExecutor> 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());
}
}
}

Loading…
Cancel
Save