StartJConsoleCommand extends OfflineGfshCommand { Process getProcess(String[] jconsoleCommandLine) throws IOException { return Runtime.getRuntime().exec(jconsoleCommandLine); }  @CliCommand(value = CliStrings.START_JCONSOLE, help = CliStrings.START_JCONSOLE__HELP) @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_MANAGER, CliStrings.TOPIC_GEODE_JMX, CliStrings.TOPIC_GEODE_M_AND_M}) ResultModel startJConsole(
      @CliOption(key = CliStrings.START_JCONSOLE__INTERVAL, unspecifiedDefaultValue = "4",
          help = CliStrings.START_JCONSOLE__INTERVAL__HELP) final int interval,
      @CliOption(key = CliStrings.START_JCONSOLE__NOTILE, specifiedDefaultValue = "true",
          unspecifiedDefaultValue = "false",
          help = CliStrings.START_JCONSOLE__NOTILE__HELP) final boolean notile,
      @CliOption(key = CliStrings.START_JCONSOLE__PLUGINPATH,
          help = CliStrings.START_JCONSOLE__PLUGINPATH__HELP) final String pluginpath,
      @CliOption(key = CliStrings.START_JCONSOLE__VERSION, specifiedDefaultValue = "true",
          unspecifiedDefaultValue = "false",
          help = CliStrings.START_JCONSOLE__VERSION__HELP) final boolean version,
      @CliOption(key = CliStrings.START_JCONSOLE__J, optionContext = GfshParser.J_OPTION_CONTEXT,
          help = CliStrings.START_JCONSOLE__J__HELP) final String[] jvmArgs);  }
@Test public void succcessOutput() throws Exception { gfshParser.executeAndAssertThat(command, "start jconsole") .containsOutput("some output"); verify(command, times(1)).getProcess(argumentCaptor.capture()); String[] commandString = argumentCaptor.getValue(); assertThat(commandString).hasSize(2); assertThat(commandString[0]).contains("jconsole"); assertThat(commandString[1]).isEqualTo("-interval=4"); }
@Test public void successWithServiceUrl() throws Exception { doReturn(new JMXServiceURL("service:jmx:rmi: doReturn(true).when(command).isConnectedAndReady(); gfshParser.executeAndAssertThat(command, "start jconsole") .containsOutput("some output"); verify(command, times(1)).getProcess(argumentCaptor.capture()); String[] commandString = argumentCaptor.getValue(); assertThat(commandString).hasSize(3); assertThat(commandString[0]).contains("jconsole"); assertThat(commandString[1]).isEqualTo("-interval=4"); assertThat(commandString[2]).isEqualTo("service:jmx:rmi: }