You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by GitBox <gi...@apache.org> on 2022/08/22 05:31:04 UTC

[GitHub] [incubator-seatunnel] Hisoka-X commented on a diff in pull request #2470: [Improvement][Starter] Use the public CommandLine util class to parse the args

Hisoka-X commented on code in PR #2470:
URL: https://github.com/apache/incubator-seatunnel/pull/2470#discussion_r951026053


##########
seatunnel-core/seatunnel-core-flink/src/test/java/org/apache/seatunnel/core/flink/utils/CommandLineUtilsTest.java:
##########
@@ -17,67 +17,33 @@
 
 package org.apache.seatunnel.core.flink.utils;
 
+import org.apache.seatunnel.core.base.utils.CommandLineUtils;
 import org.apache.seatunnel.core.flink.args.FlinkCommandArgs;
 import org.apache.seatunnel.core.flink.config.FlinkJobType;
 import org.apache.seatunnel.core.flink.config.FlinkRunMode;
 
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.api.Test;
 
-import java.io.FileNotFoundException;
 import java.util.Arrays;
-import java.util.List;
 
 public class CommandLineUtilsTest {
-    static final String APP_CONF_PATH = ClassLoader.getSystemResource("app.conf").getPath();
-    static final String SQL_CONF_PATH = ClassLoader.getSystemResource("sql.conf").getPath();
 
     @Test
     public void testParseCommandArgs() {
         String[] args = {"--detached", "-c", "app.conf", "-ck", "-i", "city=shenyang", "-i", "date=20200202",
             "-r", "run-application", "--unkown", "unkown-command"};
-        FlinkCommandArgs flinkCommandArgs = CommandLineUtils.parseCommandArgs(args, FlinkJobType.JAR);
-        Assertions.assertEquals(flinkCommandArgs.getFlinkParams(), Arrays.asList("--detached", "--unkown", "unkown-command"));
+        FlinkCommandArgs flinkCommandArgs = CommandLineUtils.parse(args, new FlinkCommandArgs(), FlinkJobType.JAR.getType(), true);
+        Assertions.assertEquals(flinkCommandArgs.getOriginalParameters(), Arrays.asList("--detached", "--unkown", "unkown-command"));
         Assertions.assertEquals(flinkCommandArgs.getRunMode(), FlinkRunMode.APPLICATION_RUN);
         Assertions.assertEquals(flinkCommandArgs.getVariables(), Arrays.asList("city=shenyang", "date=20200202"));
 
         String[] args1 = {"--detached", "-c", "app.conf", "-ck", "-i", "city=shenyang", "-i", "date=20200202",
             "-r", "run-application", "--unkown", "unkown-command"};
-        flinkCommandArgs = CommandLineUtils.parseCommandArgs(args1, FlinkJobType.SQL);
-        Assertions.assertEquals(flinkCommandArgs.getFlinkParams(), Arrays.asList("--detached", "--unkown", "unkown-command"));
+        flinkCommandArgs = CommandLineUtils.parse(args1, new FlinkCommandArgs(), FlinkJobType.SQL.getType(), true);
+        Assertions.assertEquals(flinkCommandArgs.getOriginalParameters(), Arrays.asList("--detached", "--unkown", "unkown-command"));
         Assertions.assertEquals(flinkCommandArgs.getRunMode(), FlinkRunMode.APPLICATION_RUN);
         Assertions.assertEquals(flinkCommandArgs.getVariables(), Arrays.asList("city=shenyang", "date=20200202"));
     }
 
-    @Test

Review Comment:
   Why remove this test case?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org