use of org.apache.flink.client.cli.ProgramOptions in project flink by apache.
the class CliFrontendPackageProgramTest method testFileNotJarFile.
@Test
public void testFileNotJarFile() {
try {
CliFrontend frontend = new CliFrontend(CliFrontendTestUtils.getConfigDir());
ProgramOptions options = mock(ProgramOptions.class);
when(options.getJarFilePath()).thenReturn(getNonJarFilePath());
try {
frontend.buildProgram(options);
fail("should throw an exception");
} catch (ProgramInvocationException e) {
// that's what we want
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.client.cli.ProgramOptions in project flink by apache.
the class CliFrontendPackageProgramTest method testNonExistingJarFile.
@Test
public void testNonExistingJarFile() {
try {
CliFrontend frontend = new CliFrontend(CliFrontendTestUtils.getConfigDir());
ProgramOptions options = mock(ProgramOptions.class);
when(options.getJarFilePath()).thenReturn("/some/none/existing/path");
try {
frontend.buildProgram(options);
fail("should throw an exception");
} catch (FileNotFoundException e) {
// that's what we want
}
} catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}
}
use of org.apache.flink.client.cli.ProgramOptions in project flink by apache.
the class DefaultContext method createExecutionConfig.
private static Configuration createExecutionConfig(CommandLine commandLine, Options commandLineOptions, List<CustomCommandLine> availableCommandLines, List<URL> dependencies) throws FlinkException {
LOG.debug("Available commandline options: {}", commandLineOptions);
List<String> options = Stream.of(commandLine.getOptions()).map(o -> o.getOpt() + "=" + o.getValue()).collect(Collectors.toList());
LOG.debug("Instantiated commandline args: {}, options: {}", commandLine.getArgList(), options);
final CustomCommandLine activeCommandLine = findActiveCommandLine(availableCommandLines, commandLine);
LOG.debug("Available commandlines: {}, active commandline: {}", availableCommandLines, activeCommandLine);
Configuration executionConfig = activeCommandLine.toConfiguration(commandLine);
try {
final ProgramOptions programOptions = ProgramOptions.create(commandLine);
final ExecutionConfigAccessor executionConfigAccessor = ExecutionConfigAccessor.fromProgramOptions(programOptions, dependencies);
executionConfigAccessor.applyToConfiguration(executionConfig);
} catch (CliArgsException e) {
throw new SqlExecutionException("Invalid deployment run options.", e);
}
LOG.info("Executor config: {}", executionConfig);
return executionConfig;
}
Aggregations