ExportLogsCommand extends GfshCommand { static long parseByteMultiplier(String diskSpaceLimit) { Matcher matcher = DISK_SPACE_LIMIT_PATTERN.matcher(diskSpaceLimit); if (!matcher.matches()) { throw new IllegalArgumentException(); } switch (matcher.group(2).toLowerCase()) { case "k": return KILOBYTE; case "t": return TERABYTE; case "g": return GIGABYTE; case "m": default: return MEGABYTE; } }  @CliCommand(value = CliStrings.EXPORT_LOGS, help = CliStrings.EXPORT_LOGS__HELP) @CliMetaData(isFileDownloadOverHttp = true, interceptor = "org.apache.geode.management.internal.cli.commands.ExportLogsInterceptor", relatedTopic = {CliStrings.TOPIC_GEODE_SERVER, CliStrings.TOPIC_GEODE_DEBUG_UTIL}) @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER, operation = ResourcePermission.Operation.READ) ResultModel exportLogs(
      @CliOption(key = CliStrings.EXPORT_LOGS__DIR,
          help = CliStrings.EXPORT_LOGS__DIR__HELP) String dirName,
      @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
          optionContext = ConverterHint.MEMBERGROUP,
          help = CliStrings.EXPORT_LOGS__GROUP__HELP) String[] groups,
      @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
          optionContext = ConverterHint.ALL_MEMBER_IDNAME,
          help = CliStrings.EXPORT_LOGS__MEMBER__HELP) String[] memberIds,
      @CliOption(key = CliStrings.EXPORT_LOGS__LOGLEVEL,
          unspecifiedDefaultValue = DEFAULT_EXPORT_LOG_LEVEL,
          optionContext = ConverterHint.LOG_LEVEL,
          help = CliStrings.EXPORT_LOGS__LOGLEVEL__HELP) String logLevel,
      @CliOption(key = CliStrings.EXPORT_LOGS__UPTO_LOGLEVEL, unspecifiedDefaultValue = "false",
          help = CliStrings.EXPORT_LOGS__UPTO_LOGLEVEL__HELP) boolean onlyLogLevel,
      @CliOption(key = CliStrings.EXPORT_LOGS__MERGELOG, unspecifiedDefaultValue = "false",
          help = CliStrings.EXPORT_LOGS__MERGELOG__HELP) boolean mergeLog,
      @CliOption(key = CliStrings.EXPORT_LOGS__STARTTIME,
          help = CliStrings.EXPORT_LOGS__STARTTIME__HELP) String start,
      @CliOption(key = CliStrings.EXPORT_LOGS__ENDTIME,
          help = CliStrings.EXPORT_LOGS__ENDTIME__HELP) String end,
      @CliOption(key = CliStrings.EXPORT_LOGS__LOGSONLY, unspecifiedDefaultValue = "false",
          specifiedDefaultValue = "true",
          help = CliStrings.EXPORT_LOGS__LOGSONLY__HELP) boolean logsOnly,
      @CliOption(key = CliStrings.EXPORT_LOGS__STATSONLY, unspecifiedDefaultValue = "false",
          specifiedDefaultValue = "true",
          help = CliStrings.EXPORT_LOGS__STATSONLY__HELP) boolean statsOnly,
      @CliOption(key = CliStrings.EXPORT_LOGS__FILESIZELIMIT,
          unspecifiedDefaultValue = CliStrings.EXPORT_LOGS__FILESIZELIMIT__UNSPECIFIED_DEFAULT,
          specifiedDefaultValue = CliStrings.EXPORT_LOGS__FILESIZELIMIT__SPECIFIED_DEFAULT,
          help = CliStrings.EXPORT_LOGS__FILESIZELIMIT__HELP) String fileSizeLimit); static final String FORMAT; static final String ONLY_DATE_FORMAT; static final String DEFAULT_EXPORT_LOG_LEVEL; }
@Test public void parseByteMultiplier_sizeWithoutUnit_shouldReturnDefaultUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000")).isEqualTo(MEGABYTE); }
@Test public void parseByteMultiplier_sizeWith_k_shouldReturnUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000k")).isEqualTo(KILOBYTE); }
@Test public void parseByteMultiplier_sizeWith_m_shouldReturnUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000m")).isEqualTo(MEGABYTE); }
@Test public void parseByteMultiplier_sizeWith_g_shouldReturnUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000g")).isEqualTo(GIGABYTE); }
@Test public void parseByteMultiplier_sizeWith_t_shouldReturnUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000t")).isEqualTo(TERABYTE); }
@Test public void parseByteMultiplier_sizeWith_K_shouldReturnUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000K")).isEqualTo(KILOBYTE); }
@Test public void parseByteMultiplier_sizeWith_M_shouldReturnUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000M")).isEqualTo(MEGABYTE); }
@Test public void parseByteMultiplier_sizeWith_G_shouldReturnUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000G")).isEqualTo(GIGABYTE); }
@Test public void parseByteMultiplier_sizeWith_T_shouldReturnUnit() { assertThat(ExportLogsCommand.parseByteMultiplier("1000T")).isEqualTo(TERABYTE); }
@Test public void parseByteMultiplier_illegalUnit_shouldThrow() { assertThatThrownBy(() -> ExportLogsCommand.parseByteMultiplier("1000q")) .isInstanceOf(IllegalArgumentException.class); }
@Test public void parseByteMultiplier_garbage_shouldThrow() { assertThatThrownBy(() -> ExportLogsCommand.parseByteMultiplier("bizbap")) .isInstanceOf(IllegalArgumentException.class); }