RexsterSettings { public String getPrimeCommand() { if (this.line.getCommand().hasOption(COMMAND_START)) { return COMMAND_START; } else if (this.line.getCommand().hasOption(COMMAND_VERSION)) { return COMMAND_VERSION; } else if (this.line.getCommand().hasOption(COMMAND_STOP)) { return COMMAND_STOP; } else if (this.line.getCommand().hasOption(COMMAND_STATUS)) { return COMMAND_STATUS; } else { return COMMAND_HELP; } } RexsterSettings(final String[] arguments); RexsterCommandLine getCommand(); String getPrimeCommand(); void printHelp(); boolean isDebug(); File getRexsterXmlFile(); RexsterProperties getProperties(); static final int DEFAULT_HTTP_PORT; static final int DEFAULT_SHUTDOWN_PORT; static final int DEFAULT_REXPRO_PORT; static final String DEFAULT_WEB_ROOT_PATH; static final String DEFAULT_BASE_URI; static final long DEFAULT_REXPRO_SESSION_MAX_IDLE; static final long DEFAULT_REXPRO_SESSION_CHECK_INTERVAL; static final long DEFAULT_CONFIG_CHECK_INTERVAL; static final String DEFAULT_HOST; static final String COMMAND_START; static final String COMMAND_VERSION; static final String COMMAND_STOP; static final String COMMAND_STATUS; static final String COMMAND_HELP; }
@Test public void getPrimeCommands() { final Map<String, String> commands = new HashMap<String, String>() {{ put("-s", RexsterSettings.COMMAND_START); put("-u", RexsterSettings.COMMAND_STATUS); put("-x", RexsterSettings.COMMAND_STOP); put("-v", RexsterSettings.COMMAND_VERSION); put("junk", RexsterSettings.COMMAND_HELP); }}; for (Map.Entry<String,String> entry : commands.entrySet()) { final RexsterSettings settings = new RexsterSettings(new String [] { entry.getKey() }); Assert.assertEquals(entry.getValue(), settings.getPrimeCommand()); } }