@Override public void addGeneralOptions(Options baseOptions) { super.addGeneralOptions(baseOptions); }
public ClusterDescriptor<T> createClusterDescriptor() throws Exception { return activeCommandLine.createClusterDescriptor(commandLine); }
default CommandLine parseCommandLineOptions(String[] args, boolean stopAtNonOptions) throws CliArgsException { final Options options = new Options(); addGeneralOptions(options); addRunOptions(options); return CliFrontendParser.parse(options, args, stopAtNonOptions); } }
@Test(expected = CliArgsException.class) public void testCancelWithSavepointWithoutJobId() throws Exception { // Cancel with savepoint (with target directory), but no job ID String[] parameters = { "-s", "targetDirectory" }; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.cancel(parameters); }
@Test(expected = CliArgsException.class) public void testInvalidParallelismOption() throws Exception { // test configure parallelism with non integer value String[] parameters = {"-v", "-p", "text", getTestJarPath()}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.run(parameters); }
@Test(expected = CliArgsException.class) public void testMissingJobId() throws Exception { // test missing job id String[] parameters = {}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.stop(parameters); }
@Test(expected = CliArgsException.class) public void testUnrecognizedOption() throws Exception { String[] parameters = {"-v", "-l"}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.cancel(parameters); }
private static Options collectCommandLineOptions(List<CustomCommandLine<?>> commandLines) { final Options customOptions = new Options(); for (CustomCommandLine<?> customCommandLine : commandLines) { customCommandLine.addRunOptions(customOptions); } return CliFrontendParser.mergeOptions( CliFrontendParser.getRunCommandOptions(), customOptions); }
@Test(expected = CliArgsException.class) public void testUnrecognizedOption() throws Exception { String[] parameters = {"-v", "-k"}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.list(parameters); }
@Test public void testNonExistingFileWithoutArguments() throws Exception { String[] arguments = {"/some/none/existing/path"}; RunOptions options = CliFrontendParser.parseRunCommand(arguments); assertEquals(arguments[0], options.getJarFilePath()); assertArrayEquals(new String[0], options.getProgramArgs()); try { frontend.buildProgram(options); } catch (FileNotFoundException e) { // that's what we want } }
public static RunOptions parseRunCommand(String[] args) throws CliArgsException { try { DefaultParser parser = new DefaultParser(); CommandLine line = parser.parse(RUN_OPTIONS, args, true); return new RunOptions(line); } catch (ParseException e) { throw new CliArgsException(e.getMessage()); } }
static AbstractCustomCommandLine<?> getCli(Configuration configuration) { return new DefaultCLI(configuration); } }
public static void verifyCliFrontend( AbstractCustomCommandLine<?> cli, String[] parameters, int expectedParallelism, boolean logging, boolean isDetached) throws Exception { RunTestingCliFrontend testFrontend = new RunTestingCliFrontend(cli, expectedParallelism, logging, isDetached); testFrontend.run(parameters); // verifies the expected values (see below) }
@Test(expected = CliArgsException.class) public void testMissingJobId() throws Exception { String[] parameters = {}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.cancel(parameters); }
@Test(expected = CliArgsException.class) public void testUnrecognizedOption() throws Exception { // test unrecognized option String[] parameters = {"-v", "-l", "-a", "some", "program", "arguments"}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.run(parameters); }
@Test(expected = CliArgsException.class) public void testUnrecognizedOption() throws Exception { // test unrecognized option String[] parameters = { "-v", "-l" }; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.stop(parameters); }
@Test(expected = CliArgsException.class) public void testMissingOption() throws Exception { String[] parameters = {}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.cancel(parameters); }
@Test(expected = CliArgsException.class) public void testCancelWithSavepointWithoutParameters() throws Exception { // Cancel with savepoint (no target directory) and no job ID String[] parameters = { "-s" }; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.cancel(parameters); }
@Test(expected = CliArgsException.class) public void testParallelismWithOverflow() throws Exception { // test configure parallelism with overflow integer value String[] parameters = {"-v", "-p", "475871387138", getTestJarPath()}; Configuration configuration = new Configuration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.run(parameters); }
@Test(expected = CliArgsException.class) public void testUnrecognizedOption() throws Exception { String[] parameters = {"-v", "-l"}; Configuration configuration = getConfiguration(); CliFrontend testFrontend = new CliFrontend( configuration, Collections.singletonList(getCli(configuration))); testFrontend.cancel(parameters); }