@Test public void testDefaults() throws Exception { ServerCommandLine cmdLine = new ServerCommandLineParser().parse(new String[] {"--port", "1337", "--db", tmpDir.getAbsolutePath() }); Assert.assertEquals(1337, cmdLine.getPort()); Assert.assertEquals(new File(Constants.DEFAULT_WORKFLOWS_DIR), cmdLine.getWorkflowsDir()); Assert.assertEquals(new File(Constants.DEFAULT_DEFAULTS_DIR), cmdLine.getDefaultsDir()); Assert.assertTrue(cmdLine.getDatabase() instanceof FileSystemStateDatabase); FileSystemStateDatabase db = (FileSystemStateDatabase) cmdLine.getDatabase(); Assert.assertEquals(db.getDir(), tmpDir); }
public ServerCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptions(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); Integer port = Integer.valueOf(getRequiredArgument(commandLine, CLI_PORT)); String defaultsDir = getDefault(commandLine, CLI_DEFAULTS_DIR, Constants.DEFAULT_DEFAULTS_DIR); String workflowsDir = getDefault(commandLine, CLI_WF_DIR, Constants.DEFAULT_WORKFLOWS_DIR); String logDir = getDefault(commandLine, CLI_LOG_DIR, Constants.DEFAULT_LOG_DIR); Integer autoSchedule = Integer.valueOf(getDefault(commandLine, CLI_AUTOSCHEDULE, "-1")); StateDatabase db = getStateDatabaseConfig(commandLine); return new ServerCommandLine(workflowsDir, defaultsDir, db, logDir, port, autoSchedule); }
ServerCommandLineParser { public ServerCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptions(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); Integer port = Integer.valueOf(getRequiredArgument(commandLine, CLI_PORT)); String defaultsDir = getDefault(commandLine, CLI_DEFAULTS_DIR, Constants.DEFAULT_DEFAULTS_DIR); String workflowsDir = getDefault(commandLine, CLI_WF_DIR, Constants.DEFAULT_WORKFLOWS_DIR); String logDir = getDefault(commandLine, CLI_LOG_DIR, Constants.DEFAULT_LOG_DIR); Integer autoSchedule = Integer.valueOf(getDefault(commandLine, CLI_AUTOSCHEDULE, "-1")); StateDatabase db = getStateDatabaseConfig(commandLine); return new ServerCommandLine(workflowsDir, defaultsDir, db, logDir, port, autoSchedule); } }
ServerCommandLineParser { public ServerCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptions(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); Integer port = Integer.valueOf(getRequiredArgument(commandLine, CLI_PORT)); String defaultsDir = getDefault(commandLine, CLI_DEFAULTS_DIR, Constants.DEFAULT_DEFAULTS_DIR); String workflowsDir = getDefault(commandLine, CLI_WF_DIR, Constants.DEFAULT_WORKFLOWS_DIR); String logDir = getDefault(commandLine, CLI_LOG_DIR, Constants.DEFAULT_LOG_DIR); Integer autoSchedule = Integer.valueOf(getDefault(commandLine, CLI_AUTOSCHEDULE, "-1")); StateDatabase db = getStateDatabaseConfig(commandLine); return new ServerCommandLine(workflowsDir, defaultsDir, db, logDir, port, autoSchedule); }  }
ServerCommandLineParser { public ServerCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptions(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); Integer port = Integer.valueOf(getRequiredArgument(commandLine, CLI_PORT)); String defaultsDir = getDefault(commandLine, CLI_DEFAULTS_DIR, Constants.DEFAULT_DEFAULTS_DIR); String workflowsDir = getDefault(commandLine, CLI_WF_DIR, Constants.DEFAULT_WORKFLOWS_DIR); String logDir = getDefault(commandLine, CLI_LOG_DIR, Constants.DEFAULT_LOG_DIR); Integer autoSchedule = Integer.valueOf(getDefault(commandLine, CLI_AUTOSCHEDULE, "-1")); StateDatabase db = getStateDatabaseConfig(commandLine); return new ServerCommandLine(workflowsDir, defaultsDir, db, logDir, port, autoSchedule); }  ServerCommandLine parse(final String[] commandLineArguments); Options constructOptions(); void printHelp(
            final int printedRowWidth,
            final int spacesBeforeOption,
            final int spacesBeforeOptionDescription,
            final boolean displayUsage,
            final OutputStream out); }
ServerCommandLineParser { public ServerCommandLine parse(final String[] commandLineArguments) throws Exception { final CommandLineParser cmdLineGnuParser = new GnuParser(); final Options gnuOptions = constructOptions(); CommandLine commandLine = cmdLineGnuParser.parse(gnuOptions, commandLineArguments); Integer port = Integer.valueOf(getRequiredArgument(commandLine, CLI_PORT)); String defaultsDir = getDefault(commandLine, CLI_DEFAULTS_DIR, Constants.DEFAULT_DEFAULTS_DIR); String workflowsDir = getDefault(commandLine, CLI_WF_DIR, Constants.DEFAULT_WORKFLOWS_DIR); String logDir = getDefault(commandLine, CLI_LOG_DIR, Constants.DEFAULT_LOG_DIR); Integer autoSchedule = Integer.valueOf(getDefault(commandLine, CLI_AUTOSCHEDULE, "-1")); StateDatabase db = getStateDatabaseConfig(commandLine); return new ServerCommandLine(workflowsDir, defaultsDir, db, logDir, port, autoSchedule); }  ServerCommandLine parse(final String[] commandLineArguments); Options constructOptions(); void printHelp(
            final int printedRowWidth,
            final int spacesBeforeOption,
            final int spacesBeforeOptionDescription,
            final boolean displayUsage,
            final OutputStream out); static final String DB_TYPE_FILESYSTEM; static final String DB_TYPE_JDBC; }