@Test(expected = IllegalArgumentException.class) public void testContextParserTestFailsNoTestDir() throws Exception { CiCommandLineParser contextParser = new CiCommandLineParser(); String[] clParams = ("--target target --mode TEST --deployDir " + tmpDir.getAbsolutePath() + " --workflowName workflow").split(" "); contextParser.parse(clParams); }
public CiCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptionsForParsing(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); if (!commandLine.hasOption(CLI_TARGET) || !commandLine.hasOption(CLI_MODE) || !commandLine.hasOption(CLI_WORKFLOW_NAME)) { printHelp(80, 5, 3, true, System.out); throw new RuntimeException("Wrong CelosCi configuration provided"); } String deployDir = commandLine.getOptionValue(CLI_DEPLOY_DIR); String mode = commandLine.getOptionValue(CLI_MODE); String workflowName = commandLine.getOptionValue(CLI_WORKFLOW_NAME); String targetUri = commandLine.getOptionValue(CLI_TARGET); String testCasesDir = commandLine.getOptionValue(CLI_TEST_CASES_DIR, DEFAULT_TEST_CASES_DIR); String hdfsRoot = commandLine.getOptionValue(CLI_HDFS_ROOT, Constants.DEFAULT_HDFS_ROOT); String celosServerUri = commandLine.getOptionValue(CLI_CELOS_SERVER); boolean keepTempData = Boolean.parseBoolean(System.getenv(KEEP_TEMP_DATA)); String userName = System.getenv(USERNAME_ENV_VAR); if (userName == null) { userName = System.getProperty("user.name"); } return new CiCommandLine(targetUri, mode, deployDir, workflowName, testCasesDir, userName, keepTempData, celosServerUri, hdfsRoot); }
CiCommandLineParser { public CiCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptionsForParsing(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); if (!commandLine.hasOption(CLI_TARGET) || !commandLine.hasOption(CLI_MODE) || !commandLine.hasOption(CLI_WORKFLOW_NAME)) { printHelp(80, 5, 3, true, System.out); throw new RuntimeException("Wrong CelosCi configuration provided"); } String deployDir = commandLine.getOptionValue(CLI_DEPLOY_DIR); String mode = commandLine.getOptionValue(CLI_MODE); String workflowName = commandLine.getOptionValue(CLI_WORKFLOW_NAME); String targetUri = commandLine.getOptionValue(CLI_TARGET); String testCasesDir = commandLine.getOptionValue(CLI_TEST_CASES_DIR, DEFAULT_TEST_CASES_DIR); String hdfsRoot = commandLine.getOptionValue(CLI_HDFS_ROOT, Constants.DEFAULT_HDFS_ROOT); String celosServerUri = commandLine.getOptionValue(CLI_CELOS_SERVER); boolean keepTempData = Boolean.parseBoolean(System.getenv(KEEP_TEMP_DATA)); String userName = System.getenv(USERNAME_ENV_VAR); if (userName == null) { userName = System.getProperty("user.name"); } return new CiCommandLine(targetUri, mode, deployDir, workflowName, testCasesDir, userName, keepTempData, celosServerUri, hdfsRoot); } }
CiCommandLineParser { public CiCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptionsForParsing(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); if (!commandLine.hasOption(CLI_TARGET) || !commandLine.hasOption(CLI_MODE) || !commandLine.hasOption(CLI_WORKFLOW_NAME)) { printHelp(80, 5, 3, true, System.out); throw new RuntimeException("Wrong CelosCi configuration provided"); } String deployDir = commandLine.getOptionValue(CLI_DEPLOY_DIR); String mode = commandLine.getOptionValue(CLI_MODE); String workflowName = commandLine.getOptionValue(CLI_WORKFLOW_NAME); String targetUri = commandLine.getOptionValue(CLI_TARGET); String testCasesDir = commandLine.getOptionValue(CLI_TEST_CASES_DIR, DEFAULT_TEST_CASES_DIR); String hdfsRoot = commandLine.getOptionValue(CLI_HDFS_ROOT, Constants.DEFAULT_HDFS_ROOT); String celosServerUri = commandLine.getOptionValue(CLI_CELOS_SERVER); boolean keepTempData = Boolean.parseBoolean(System.getenv(KEEP_TEMP_DATA)); String userName = System.getenv(USERNAME_ENV_VAR); if (userName == null) { userName = System.getProperty("user.name"); } return new CiCommandLine(targetUri, mode, deployDir, workflowName, testCasesDir, userName, keepTempData, celosServerUri, hdfsRoot); }  }
CiCommandLineParser { public CiCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptionsForParsing(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); if (!commandLine.hasOption(CLI_TARGET) || !commandLine.hasOption(CLI_MODE) || !commandLine.hasOption(CLI_WORKFLOW_NAME)) { printHelp(80, 5, 3, true, System.out); throw new RuntimeException("Wrong CelosCi configuration provided"); } String deployDir = commandLine.getOptionValue(CLI_DEPLOY_DIR); String mode = commandLine.getOptionValue(CLI_MODE); String workflowName = commandLine.getOptionValue(CLI_WORKFLOW_NAME); String targetUri = commandLine.getOptionValue(CLI_TARGET); String testCasesDir = commandLine.getOptionValue(CLI_TEST_CASES_DIR, DEFAULT_TEST_CASES_DIR); String hdfsRoot = commandLine.getOptionValue(CLI_HDFS_ROOT, Constants.DEFAULT_HDFS_ROOT); String celosServerUri = commandLine.getOptionValue(CLI_CELOS_SERVER); boolean keepTempData = Boolean.parseBoolean(System.getenv(KEEP_TEMP_DATA)); String userName = System.getenv(USERNAME_ENV_VAR); if (userName == null) { userName = System.getProperty("user.name"); } return new CiCommandLine(targetUri, mode, deployDir, workflowName, testCasesDir, userName, keepTempData, celosServerUri, hdfsRoot); }  CiCommandLine parse(final String[] commandLineArguments); Options constructOptionsForHelp(); Options constructOptionsForParsing(); void printHelp(
            final int printedRowWidth,
            final int spacesBeforeOption,
            final int spacesBeforeOptionDescription,
            final boolean displayUsage,
            final OutputStream out); }
CiCommandLineParser { public CiCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptionsForParsing(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); if (!commandLine.hasOption(CLI_TARGET) || !commandLine.hasOption(CLI_MODE) || !commandLine.hasOption(CLI_WORKFLOW_NAME)) { printHelp(80, 5, 3, true, System.out); throw new RuntimeException("Wrong CelosCi configuration provided"); } String deployDir = commandLine.getOptionValue(CLI_DEPLOY_DIR); String mode = commandLine.getOptionValue(CLI_MODE); String workflowName = commandLine.getOptionValue(CLI_WORKFLOW_NAME); String targetUri = commandLine.getOptionValue(CLI_TARGET); String testCasesDir = commandLine.getOptionValue(CLI_TEST_CASES_DIR, DEFAULT_TEST_CASES_DIR); String hdfsRoot = commandLine.getOptionValue(CLI_HDFS_ROOT, Constants.DEFAULT_HDFS_ROOT); String celosServerUri = commandLine.getOptionValue(CLI_CELOS_SERVER); boolean keepTempData = Boolean.parseBoolean(System.getenv(KEEP_TEMP_DATA)); String userName = System.getenv(USERNAME_ENV_VAR); if (userName == null) { userName = System.getProperty("user.name"); } return new CiCommandLine(targetUri, mode, deployDir, workflowName, testCasesDir, userName, keepTempData, celosServerUri, hdfsRoot); }  CiCommandLine parse(final String[] commandLineArguments); Options constructOptionsForHelp(); Options constructOptionsForParsing(); void printHelp(
            final int printedRowWidth,
            final int spacesBeforeOption,
            final int spacesBeforeOptionDescription,
            final boolean displayUsage,
            final OutputStream out);  }