EBCLIOptions { public List<Cmd> getCommands() { return cmdList; } EBCLIOptions(String[] args); List<LoggerConfig> getHistoLoggerConfigs(); List<LoggerConfig> getStatsLoggerConfigs(); List<LoggerConfig> getClassicHistoConfigs(); List<Cmd> getCommands(); boolean wantsShowScript(); boolean wantsVersionCoords(); boolean isWantsVersionShort(); boolean wantsActivityTypes(); boolean wantsTopicalHelp(); String wantsTopicalHelpFor(); boolean wantsBasicHelp(); boolean wantsAdvancedHelp(); boolean wantsEnableChart(); boolean wantsDockerMetrics(); int getReportInterval(); String wantsReportGraphiteTo(); String wantsMetricsPrefix(); String wantsMetricsForActivity(); String getSessionName(); Level wantsConsoleLogLevel(); String getProgressSpec(); String wantsReportCsvTo(); String getLogsDirectory(); int getLogsMax(); String getLogsLevel(); boolean wantsInputTypes(); boolean wantsMarkerTypes(); boolean wantsToDumpCyclelog(); boolean wantsToImportCycleLog(); String[] getCyclelogImportOptions(); String[] getCycleLogExporterOptions(); String getConsoleLoggingPattern(); Map<String, Level> getLogLevelOverrides(); void setHistoLoggerConfigs(String pattern, String file, String interval); static final String docoptFileName; }
@Test public void shouldRecognizeActivities() { EBCLIOptions opts = new EBCLIOptions(new String[]{"start", "foo=wan", "start", "bar=lan"}); assertThat(opts.getCommands()).isNotNull(); assertThat(opts.getCommands().size()).isEqualTo(2); assertThat(opts.getCommands().get(0).getCmdSpec()).isEqualTo("foo=wan;"); assertThat(opts.getCommands().get(1).getCmdSpec()).isEqualTo("bar=lan;"); }
@Test public void shouldRecognizeScripts() { EBCLIOptions opts = new EBCLIOptions(new String[]{"script", "ascriptaone", "script", "ascriptatwo"}); assertThat(opts.getCommands()).isNotNull(); assertThat(opts.getCommands().size()).isEqualTo(2); assertThat(opts.getCommands().get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.script); assertThat(opts.getCommands().get(0).getCmdSpec()).isEqualTo("ascriptaone"); assertThat(opts.getCommands().get(1).getCmdType()).isEqualTo(EBCLIOptions.CmdType.script); assertThat(opts.getCommands().get(1).getCmdSpec()).isEqualTo("ascriptatwo"); }
@Test public void testShouldRecognizeScriptParams() { EBCLIOptions opts = new EBCLIOptions(new String[]{"script", "ascript", "param1=value1"}); assertThat(opts.getCommands().size()).isEqualTo(1); EBCLIOptions.Cmd cmd = opts.getCommands().get(0); assertThat(cmd.getCmdArgs().size()).isEqualTo(1); assertThat(cmd.getCmdArgs()).containsKey("param1"); assertThat(cmd.getCmdArgs().get("param1")).isEqualTo("value1"); }
@Test public void shouldRecognizeStartActivityCmd() { EBCLIOptions opts = new EBCLIOptions(new String[]{ "start", "type=woot" }); List<EBCLIOptions.Cmd> cmds = opts.getCommands(); assertThat(cmds).hasSize(1); assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.start); }
@Test public void shouldRecognizeRunActivityCmd() { EBCLIOptions opts = new EBCLIOptions(new String[]{ "run", "type=runwoot" }); List<EBCLIOptions.Cmd> cmds = opts.getCommands(); assertThat(cmds).hasSize(1); assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.run); }
@Test public void shouldRecognizeStopActivityCmd() { EBCLIOptions opts = new EBCLIOptions(new String[]{ "stop", "woah" }); List<EBCLIOptions.Cmd> cmds = opts.getCommands(); assertThat(cmds).hasSize(1); assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.stop); assertThat(cmds.get(0).getCmdSpec()).isEqualTo("woah"); }
@Test(expectedExceptions = InvalidParameterException.class) public void shouldThrowErrorForInvalidStopActivity() { EBCLIOptions opts = new EBCLIOptions(new String[]{ "stop", "woah=woah" }); List<EBCLIOptions.Cmd> cmds = opts.getCommands(); }
@Test public void shouldRecognizeAwaitActivityCmd() { EBCLIOptions opts = new EBCLIOptions(new String[]{ "await", "awaitme" }); List<EBCLIOptions.Cmd> cmds = opts.getCommands(); assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.await); assertThat(cmds.get(0).getCmdSpec()).isEqualTo("awaitme"); }
@Test(expectedExceptions = InvalidParameterException.class) public void shouldThrowErrorForInvalidAwaitActivity() { EBCLIOptions opts = new EBCLIOptions(new String[]{ "await", "awaitme=notvalid" }); List<EBCLIOptions.Cmd> cmds = opts.getCommands(); }
@Test public void shouldRecognizewaitMillisCmd() { EBCLIOptions opts = new EBCLIOptions(new String[]{ "waitmillis", "23234" }); List<EBCLIOptions.Cmd> cmds = opts.getCommands(); assertThat(cmds.get(0).getCmdType()).isEqualTo(EBCLIOptions.CmdType.waitmillis); assertThat(cmds.get(0).getCmdSpec()).isEqualTo("23234"); }
@Test(expectedExceptions = NumberFormatException.class) public void shouldThrowErrorForInvalidWaitMillisOperand() { EBCLIOptions opts = new EBCLIOptions(new String[]{ "waitmillis", "noway" }); List<EBCLIOptions.Cmd> cmds = opts.getCommands(); }