zhuangchong commented on code in PR #2470:
URL:
https://github.com/apache/incubator-seatunnel/pull/2470#discussion_r951455470
##########
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:
The CommandLineUtils.buildFlinkCommand method has been moved to the
FlinkStarter buildCommands method. The buildCommands method has a corresponding
test class, so this part of the test method has been deleted.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]