ExportStackTraceCommand extends GfshCommand { String getHeaderMessage(StackTracesPerMember stackTracesPerMember) { String headerMessage = stackTracesPerMember.getMemberNameOrId(); Instant timestamp = stackTracesPerMember.getTimestamp(); if (timestamp != null) { headerMessage += " at " + formatter.format(timestamp); } return headerMessage; }  @CliCommand(value = CliStrings.EXPORT_STACKTRACE, help = CliStrings.EXPORT_STACKTRACE__HELP) @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DEBUG_UTIL}) @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER, operation = ResourcePermission.Operation.READ) ResultModel exportStackTrace(@CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
      optionContext = ConverterHint.ALL_MEMBER_IDNAME,
      help = CliStrings.EXPORT_STACKTRACE__HELP) String[] memberNameOrId,

      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
          optionContext = ConverterHint.ALL_MEMBER_IDNAME, help = CliStrings.GROUP) String[] group,

      @CliOption(key = CliStrings.EXPORT_STACKTRACE__FILE,
          help = CliStrings.EXPORT_STACKTRACE__FILE__HELP) String fileName,

      @CliOption(key = CliStrings.EXPORT_STACKTRACE__FAIL__IF__FILE__PRESENT,
          unspecifiedDefaultValue = "false", specifiedDefaultValue = "true",
          help = CliStrings.EXPORT_STACKTRACE__FAIL__IF__FILE__PRESENT__HELP) boolean failIfFilePresent); String writeStacksToFile(Map<String, byte[]> dumps, String fileName);  }
@Test public void getHeaderMessageWithTimestamp() throws IOException { Instant time = Instant.now(); StackTracesPerMember stackTracePerMember = new StackTracesPerMember("server", time, OSProcess.zipStacks()); String headerMessage = command.getHeaderMessage(stackTracePerMember); assertThat(headerMessage).isEqualTo("server at " + formatter.format(time)); }
@Test public void getHeaderMessageWithoutTimestamp() throws IOException { StackTracesPerMember stackTracePerMember = new StackTracesPerMember("server", null, OSProcess.zipStacks()); String headerMessage = command.getHeaderMessage(stackTracePerMember); assertThat(headerMessage).isEqualTo("server"); }