geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kh...@apache.org
Subject geode git commit: soptlessApply on changes to date
Date Tue, 28 Mar 2017 17:45:42 GMT
Repository: geode
Updated Branches:
  refs/heads/feature/GEODE-2420 704fdbcb6 -> fe9485fb6


soptlessApply on changes to date


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/fe9485fb
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/fe9485fb
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/fe9485fb

Branch: refs/heads/feature/GEODE-2420
Commit: fe9485fb6e08e936d4d528c56cfee987c8379d33
Parents: 704fdbc
Author: Ken Howe <khowe@pivotal.io>
Authored: Tue Mar 28 10:45:17 2017 -0700
Committer: Ken Howe <khowe@pivotal.io>
Committed: Tue Mar 28 10:45:17 2017 -0700

----------------------------------------------------------------------
 .../internal/cli/CliAroundInterceptor.java      |  1 +
 .../cli/commands/ExportLogsCommand.java         | 48 ++++++++---------
 .../cli/commands/ExportLogsInterceptor.java     |  4 +-
 .../cli/functions/SizeExportLogsFunction.java   | 10 ++--
 .../internal/cli/i18n/CliStrings.java           |  4 +-
 .../management/internal/cli/util/LogSizer.java  |  9 ++--
 .../cli/commands/ExportLogsCommandTest.java     | 13 +++--
 .../commands/ExportLogsFileSizeLimitTest.java   |  3 +-
 .../cli/commands/ExportLogsTestSuite.java       |  3 +-
 .../functions/ExportedLogsSizeDetailTest.java   | 55 ++++++++------------
 .../SizeExportLogsFunctionCacheTest.java        | 16 +++---
 .../SizeExportLogsFunctionFileTest.java         | 53 ++++++++++++-------
 .../cli/functions/SizeExportLogsTestSuite.java  |  6 ++-
 .../internal/cli/util/LogSizerTest.java         | 21 +++++---
 14 files changed, 135 insertions(+), 111 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliAroundInterceptor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliAroundInterceptor.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliAroundInterceptor.java
index f552460..7a95306 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliAroundInterceptor.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliAroundInterceptor.java
@@ -38,6 +38,7 @@ public interface CliAroundInterceptor {
 
   /**
    * called by the OperationInvoker after the command is executed
+   * 
    * @param tempFile if the command's isFileDownloadOverHttp is true, the is the File downloaded
    *        after the http response is processed.
    */

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommand.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommand.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommand.java
index 5ac7b76..5c04e6e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommand.java
@@ -115,19 +115,17 @@ public class ExportLogsCommand implements CommandMarker {
         // TODO: get estimated size of exported logs from all servers first
         Map<String, Integer> fileSizesFromMembers = new HashMap<>();
         for (DistributedMember server : targetMembers) {
-          SizeExportLogsFunction.Args
-              args =
-              new SizeExportLogsFunction.Args(start, end, logLevel, onlyLogLevel, logsOnly,
-                  statsOnly);
+          SizeExportLogsFunction.Args args = new SizeExportLogsFunction.Args(start, end,
logLevel,
+              onlyLogLevel, logsOnly, statsOnly);
 
-          List<Object> results = (List<Object>)CliUtil.executeFunction(new SizeExportLogsFunction(),
args, server)
-                  .getResult();
+          List<Object> results = (List<Object>) CliUtil
+              .executeFunction(new SizeExportLogsFunction(), args, server).getResult();
           long estimatedSize = 0;
           long diskAvailable = 0;
           long diskSize = 0;
           List<?> res = (List<?>) results.get(0);
           if (res.get(0) instanceof ExportedLogsSizeDetail) {
-            ExportedLogsSizeDetail sizeInfo = (ExportedLogsSizeDetail)res.get(0);
+            ExportedLogsSizeDetail sizeInfo = (ExportedLogsSizeDetail) res.get(0);
             estimatedSize = sizeInfo.getLogsSize();
             diskAvailable = sizeInfo.getDiskAvailable();
             diskSize = sizeInfo.getDiskSize();
@@ -191,12 +189,12 @@ public class ExportLogsCommand implements CommandMarker {
       ZipUtils.zipDirectory(exportedLogsDir, exportedLogsZipFile);
       FileUtils.deleteDirectory(tempDir.toFile());
 
-//      try {
-        isFileSizeCheckEnabledAndWithinLimit(parseFileSizeLimit(fileSizeLimit),
-            exportedLogsZipFile.toFile());
-//      } catch (IllegalArgumentException e) {
-//        return ResultBuilder.createUserErrorResult("TOO BIG: fileSizeLimit = " + fileSizeLimit);
-//      }
+      // try {
+      isFileSizeCheckEnabledAndWithinLimit(parseFileSizeLimit(fileSizeLimit),
+          exportedLogsZipFile.toFile());
+      // } catch (IllegalArgumentException e) {
+      // return ResultBuilder.createUserErrorResult("TOO BIG: fileSizeLimit = " + fileSizeLimit);
+      // }
 
       result = ResultBuilder.createInfoResult(exportedLogsZipFile.toString());
     } catch (Exception ex) {
@@ -234,10 +232,8 @@ public class ExportLogsCommand implements CommandMarker {
   }
 
   /**
-   * Throws IllegalArgumentException if file size is over fileSizeLimitBytes
-   * false == limit is zero
-   * true == file size is less than limit
-   * exception == file size is over limit
+   * Throws IllegalArgumentException if file size is over fileSizeLimitBytes false == limit
is zero
+   * true == file size is less than limit exception == file size is over limit
    */
   boolean isFileSizeCheckEnabledAndWithinLimit(int fileSizeLimitBytes, File file) {
     // TODO:GEODE-2420: warn user if exportedLogsZipFile size > threshold
@@ -247,7 +243,8 @@ public class ExportLogsCommand implements CommandMarker {
     if (FileUtils.sizeOf(file) < fileSizeLimitBytes) {
       return true;
     }
-    throw new IllegalArgumentException("TOO BIG: fileSizeLimit = " + fileSizeLimitBytes +
", fileSize = " + FileUtils.sizeOf(file)); // FileTooBigException
+    throw new IllegalArgumentException("TOO BIG: fileSizeLimit = " + fileSizeLimitBytes
+        + ", fileSize = " + FileUtils.sizeOf(file)); // FileTooBigException
   }
 
   static int parseSize(String diskSpaceLimit) {
@@ -265,15 +262,18 @@ public class ExportLogsCommand implements CommandMarker {
       throw new IllegalArgumentException();
     }
     switch (matcher.group(2).toLowerCase()) {
-      case "t": return (int)Math.pow(1024, 4);
-      case "g": return (int)Math.pow(1024, 3);
+      case "t":
+        return (int) Math.pow(1024, 4);
+      case "g":
+        return (int) Math.pow(1024, 3);
       case "m":
-      default: return (int)Math.pow(1024, 2);
+      default:
+        return (int) Math.pow(1024, 2);
     }
   }
 
-  static final int MEGABYTE = (int)Math.pow(1024, 2);
-  static final int GIGABYTE = (int)Math.pow(1024, 3);
-  static final int TERABYTE = (int)Math.pow(1024, 4);
+  static final int MEGABYTE = (int) Math.pow(1024, 2);
+  static final int GIGABYTE = (int) Math.pow(1024, 3);
+  static final int TERABYTE = (int) Math.pow(1024, 4);
 
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
index 8427c83..6484a77 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportLogsInterceptor.java
@@ -33,8 +33,8 @@ import java.time.LocalDateTime;
 import java.util.Map;
 
 /**
- * after the export logs, will need to copy the tempFile to the desired location and delete
the
- * temp file.
+ * after the export logs, will need to copy the tempFile to the desired location and delete
the temp
+ * file.
  */
 public class ExportLogsInterceptor extends AbstractCliAroundInterceptor {
   private static final Logger logger = LogService.getLogger();

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
index c9d734f..c3dfe7a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunction.java
@@ -48,9 +48,11 @@ public class SizeExportLogsFunction extends ExportLogsFunction implements
Functi
       Args args = (Args) context.getArguments();
       long diskAvailable = config.getLogFile().getUsableSpace();
       long diskSize = config.getLogFile().getTotalSpace();
-      long estimatedSize = estimateLogFileSize(cache.getMyId(), config.getLogFile(), config.getStatisticArchiveFile(),
args);
+      long estimatedSize = estimateLogFileSize(cache.getMyId(), config.getLogFile(),
+          config.getStatisticArchiveFile(), args);
 
-      context.getResultSender().lastResult(Arrays.asList(new ExportedLogsSizeDetail(estimatedSize,
diskAvailable, diskSize)));
+      context.getResultSender().lastResult(
+          Arrays.asList(new ExportedLogsSizeDetail(estimatedSize, diskAvailable, diskSize)));
 
     } catch (Exception e) {
       e.printStackTrace();
@@ -59,8 +61,8 @@ public class SizeExportLogsFunction extends ExportLogsFunction implements
Functi
     }
   }
 
-  long estimateLogFileSize(final DistributedMember member, final File logFile, final File
statArchive, final Args args)
-      throws ParseException, IOException {
+  long estimateLogFileSize(final DistributedMember member, final File logFile,
+      final File statArchive, final Args args) throws ParseException, IOException {
     LOGGER.info("SizeExportLogsFunction started for member {}", member);
 
     File baseLogFile = null;

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
index f5bc67f..dfc4cf1 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
@@ -1435,8 +1435,8 @@ public class CliStrings {
   public static final String EXPORT_LOGS__LOGSONLY__HELP = "Whether to only export logs";
   public static final String EXPORT_LOGS__STATSONLY__HELP = "Whether to only export statistics";
   public static final String EXPORT_LOGS__FILESIZELIMIT = "file-size-limit";
-  public static final String
-      EXPORT_LOGS__FILESIZELIMIT__HELP = "Limits size of the file that can be exported. Specify
zero for no limit. Value is in megabytes by default or [m|g|t] may be specified.";
+  public static final String EXPORT_LOGS__FILESIZELIMIT__HELP =
+      "Limits size of the file that can be exported. Specify zero for no limit. Value is
in megabytes by default or [m|g|t] may be specified.";
   public static final String EXPORT_LOGS__FILESIZELIMIT__SPECIFIED_DEFAULT = "0";
   public static final String EXPORT_LOGS__FILESIZELIMIT__UNSPECIFIED_DEFAULT = "100m";
 

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogSizer.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogSizer.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogSizer.java
index 03e25ea..0a799f6 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogSizer.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/LogSizer.java
@@ -45,8 +45,7 @@ public class LogSizer {
    * @param baseLogFile if not null, we will export the logs in that directory
    * @param baseStatsFile if not null, we will export stats in that directory
    */
-  public LogSizer(LogFilter logFilter, File baseLogFile, File baseStatsFile)
-      throws ParseException {
+  public LogSizer(LogFilter logFilter, File baseLogFile, File baseStatsFile) throws ParseException
{
     assert logFilter != null;
     this.logFilter = logFilter;
     this.baseLogFile = baseLogFile;
@@ -106,13 +105,11 @@ public class LogSizer {
   }
 
   private List<Path> findFiles(Path workingDir, Predicate<Path> fileSelector)
throws IOException {
-    Stream<Path> selectedFiles =
-        null;
+    Stream<Path> selectedFiles = null;
     if (!workingDir.toFile().isDirectory()) {
       return Collections.emptyList();
     }
-    selectedFiles =
-        Files.list(workingDir).filter(fileSelector).filter(this.logFilter::acceptsFile);
+    selectedFiles = Files.list(workingDir).filter(fileSelector).filter(this.logFilter::acceptsFile);
 
     return selectedFiles.collect(toList());
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommandTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommandTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommandTest.java
index 23ff3da..a3a0373 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsCommandTest.java
@@ -72,17 +72,24 @@ public class ExportLogsCommandTest {
 
   @Test
   public void parseByteMultiplier_illegalUnit_shouldThrow() throws Exception {
-    assertThatThrownBy(() -> ExportLogsCommand.parseByteMultiplier("1000q")).isInstanceOf(IllegalArgumentException.class);
+    assertThatThrownBy(() -> ExportLogsCommand.parseByteMultiplier("1000q"))
+        .isInstanceOf(IllegalArgumentException.class);
   }
 
   @Test
   public void parseSize_garbage_shouldThrow() throws Exception {
-    assertThatThrownBy(() -> ExportLogsCommand.parseSize("bizbap")).isInstanceOf(IllegalArgumentException.class);
+    assertThatThrownBy(() -> ExportLogsCommand.parseSize("bizbap"))
+        .isInstanceOf(IllegalArgumentException.class);
   }
 
   @Test
   public void parseByteMultiplier_garbage_shouldThrow() throws Exception {
-    assertThatThrownBy(() -> ExportLogsCommand.parseByteMultiplier("bizbap")).isInstanceOf(IllegalArgumentException.class);
+    assertThatThrownBy(() -> ExportLogsCommand.parseByteMultiplier("bizbap"))
+        .isInstanceOf(IllegalArgumentException.class);
   }
 
+  @Test
+  public void sizeFromMember_withinLimits() throws Exception {
+
+  }
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsFileSizeLimitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsFileSizeLimitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsFileSizeLimitTest.java
index 8a2685e..ec2bcfe 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsFileSizeLimitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsFileSizeLimitTest.java
@@ -53,7 +53,8 @@ public class ExportLogsFileSizeLimitTest {
 
     ExportLogsCommand exportLogsCommand = new ExportLogsCommand();
 
-    assertThatThrownBy(() -> exportLogsCommand.isFileSizeCheckEnabledAndWithinLimit(MEGABYTE,
file));
+    assertThatThrownBy(
+        () -> exportLogsCommand.isFileSizeCheckEnabledAndWithinLimit(MEGABYTE, file));
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsTestSuite.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsTestSuite.java
index 8d46c3b..90a92f3 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsTestSuite.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsTestSuite.java
@@ -20,7 +20,8 @@ import org.junit.runners.Suite;
 /**
  * All of the JUnit, DUnit and Integration tests for gfsh command export logs.
  */
-@Suite.SuiteClasses({ExportLogsCommandTest.class, ExportLogsFileSizeLimitTest.class, ExportLogsIntegrationTest.class,
ExportLogsDUnitTest.class,})
+@Suite.SuiteClasses({ExportLogsCommandTest.class, ExportLogsFileSizeLimitTest.class,
+    ExportLogsIntegrationTest.class, ExportLogsDUnitTest.class,})
 @RunWith(Suite.class)
 public class ExportLogsTestSuite {
 }

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeDetailTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeDetailTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeDetailTest.java
index 0a967a2..1eafce9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeDetailTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/ExportedLogsSizeDetailTest.java
@@ -16,9 +16,11 @@ package org.apache.geode.management.internal.cli.functions;
 
 import static org.assertj.core.api.Assertions.*;
 
+import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -26,7 +28,8 @@ import java.io.DataInputStream;
 import java.io.DataOutput;
 import java.io.DataOutputStream;
 
-public class ExportedLogsSizeDetailTest {
+@Category(UnitTest.class)
+class ExportedLogsSizeDetailTest {
   @Before
   public void setUp() throws Exception {
 
@@ -39,8 +42,7 @@ public class ExportedLogsSizeDetailTest {
 
   @Test
   public final void testExportedLogsSizeDetailConstructor() {
-    ExportedLogsSizeDetail sizeDetail =
-        new ExportedLogsSizeDetail(1L, 11L, 111L);
+    ExportedLogsSizeDetail sizeDetail = new ExportedLogsSizeDetail(1L, 11L, 111L);
     assertThat(sizeDetail).isNotNull();
     assertThat(sizeDetail.getLogsSize()).isEqualTo(1L);
     assertThat(sizeDetail.getDiskAvailable()).isEqualTo(11L);
@@ -58,10 +60,8 @@ public class ExportedLogsSizeDetailTest {
 
   @Test
   public void equals_returnsTrueForTwoInstancesWithTheSameFieldValues() throws Exception
{
-    ExportedLogsSizeDetail sizeDetail1 =
-        new ExportedLogsSizeDetail(2L, 22L, 222L);
-    ExportedLogsSizeDetail sizeDetail2 =
-        new ExportedLogsSizeDetail(2L, 22L, 222L);
+    ExportedLogsSizeDetail sizeDetail1 = new ExportedLogsSizeDetail(2L, 22L, 222L);
+    ExportedLogsSizeDetail sizeDetail2 = new ExportedLogsSizeDetail(2L, 22L, 222L);
     assertThat(sizeDetail1.equals(sizeDetail1)).isTrue();
     assertThat(sizeDetail1.equals(sizeDetail2)).isTrue();
     assertThat(sizeDetail2.equals(sizeDetail1)).isTrue();
@@ -69,46 +69,38 @@ public class ExportedLogsSizeDetailTest {
 
   @Test
   public void equals_returnsFalseWhenLogsSizeDiffers() throws Exception {
-    ExportedLogsSizeDetail sizeDetail1 =
-        new ExportedLogsSizeDetail(3L, 33L, 333L);
-    ExportedLogsSizeDetail sizeDetail2 =
-        new ExportedLogsSizeDetail(33L, 33L, 333L);
+    ExportedLogsSizeDetail sizeDetail1 = new ExportedLogsSizeDetail(3L, 33L, 333L);
+    ExportedLogsSizeDetail sizeDetail2 = new ExportedLogsSizeDetail(33L, 33L, 333L);
     assertThat(sizeDetail1.equals(sizeDetail2)).isFalse();
     assertThat(sizeDetail2.equals(sizeDetail1)).isFalse();
   }
 
   @Test
   public void equals_returnsFalseWhenAvailableDiskDiffers() throws Exception {
-    ExportedLogsSizeDetail sizeDetail1 =
-        new ExportedLogsSizeDetail(4L, 44L, 444L);
-    ExportedLogsSizeDetail sizeDetail2 =
-        new ExportedLogsSizeDetail(4L, 4L, 444L);
+    ExportedLogsSizeDetail sizeDetail1 = new ExportedLogsSizeDetail(4L, 44L, 444L);
+    ExportedLogsSizeDetail sizeDetail2 = new ExportedLogsSizeDetail(4L, 4L, 444L);
     assertThat(sizeDetail1.equals(sizeDetail2)).isFalse();
     assertThat(sizeDetail2.equals(sizeDetail1)).isFalse();
   }
 
   @Test
   public void equals_returnsFalseWheneDiskSizeDiffers() throws Exception {
-    ExportedLogsSizeDetail sizeDetail1 =
-        new ExportedLogsSizeDetail(5L, 55L, 555L);
-    ExportedLogsSizeDetail sizeDetail2 =
-        new ExportedLogsSizeDetail(5L, 55L, 55L);
+    ExportedLogsSizeDetail sizeDetail1 = new ExportedLogsSizeDetail(5L, 55L, 555L);
+    ExportedLogsSizeDetail sizeDetail2 = new ExportedLogsSizeDetail(5L, 55L, 55L);
     assertThat(sizeDetail1.equals(sizeDetail2)).isFalse();
     assertThat(sizeDetail2.equals(sizeDetail1)).isFalse();
   }
 
   @Test
   public void equals_returnsFalseForComparisonWithNullObject() throws Exception {
-    ExportedLogsSizeDetail sizeDetail1 =
-        new ExportedLogsSizeDetail(6L, 66L, 666L);
+    ExportedLogsSizeDetail sizeDetail1 = new ExportedLogsSizeDetail(6L, 66L, 666L);
     ExportedLogsSizeDetail sizeDetail2 = null;
     assertThat(sizeDetail1.equals(sizeDetail2)).isFalse();
   }
 
   @Test
   public final void testClassInequality() {
-    ExportedLogsSizeDetail sizeDeatai1 =
-        new ExportedLogsSizeDetail(7L, 77L, 777L);
+    ExportedLogsSizeDetail sizeDeatai1 = new ExportedLogsSizeDetail(7L, 77L, 777L);
     String sizeDetail2 = sizeDeatai1.toString();
     assertThat(sizeDeatai1.equals(sizeDetail2)).isFalse();
     assertThat(sizeDetail2.equals(sizeDeatai1)).isFalse();
@@ -117,10 +109,8 @@ public class ExportedLogsSizeDetailTest {
   @Test
   public void testHashCode() throws Exception {
     ExportedLogsSizeDetail sizeDetail1 = new ExportedLogsSizeDetail();
-    ExportedLogsSizeDetail sizeDetail2 =
-        new ExportedLogsSizeDetail(8L, 88L, 888L);
-    ExportedLogsSizeDetail sizeDetail3 =
-        new ExportedLogsSizeDetail(88L, 8L, 888L);
+    ExportedLogsSizeDetail sizeDetail2 = new ExportedLogsSizeDetail(8L, 88L, 888L);
+    ExportedLogsSizeDetail sizeDetail3 = new ExportedLogsSizeDetail(88L, 8L, 888L);
 
     assertThat(sizeDetail1.hashCode()).isNotEqualTo(sizeDetail2.hashCode());
     assertThat(sizeDetail1.hashCode()).isNotEqualTo(sizeDetail3.hashCode());
@@ -134,8 +124,7 @@ public class ExportedLogsSizeDetailTest {
 
   @Test
   public void deserialization_setsFieldsToOriginalUnserializedValues() throws Exception {
-    ExportedLogsSizeDetail sizeDetail =
-        new ExportedLogsSizeDetail(9L, 99L, 999L);
+    ExportedLogsSizeDetail sizeDetail = new ExportedLogsSizeDetail(9L, 99L, 999L);
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     DataOutput out = new DataOutputStream(baos);
     sizeDetail.toData(out);
@@ -147,10 +136,10 @@ public class ExportedLogsSizeDetailTest {
 
   @Test
   public void testToString() throws Exception {
-    ExportedLogsSizeDetail sizeDetail =
-        new ExportedLogsSizeDetail(10L, 100L, 1000L);
-    assertThat(sizeDetail.toString()).isEqualTo("[logsSize: 10, diskAvailable: 100, diskSize:
1000]");
+    ExportedLogsSizeDetail sizeDetail = new ExportedLogsSizeDetail(10L, 100L, 1000L);
+    assertThat(sizeDetail.toString())
+        .isEqualTo("[logsSize: 10, diskAvailable: 100, diskSize: 1000]");
 
   }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionCacheTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionCacheTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionCacheTest.java
index 4596a9a..4ea96e7 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionCacheTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionCacheTest.java
@@ -67,7 +67,7 @@ public class SizeExportLogsFunctionCacheTest {
     logFile = new File(dir, name + ".log");
     statFile = new File(dir, name + ".gfs");
 
-    this.nonFilteringArgs = new ExportLogsFunction.Args(null, null, null, false,false, false);
+    this.nonFilteringArgs = new ExportLogsFunction.Args(null, null, null, false, false, false);
     functionContext = new FunctionContextImpl("functionId", nonFilteringArgs, resultSender);
 
   }
@@ -91,7 +91,8 @@ public class SizeExportLogsFunctionCacheTest {
     TestResultSender resultSender = new TestResultSender();
     FunctionContext context = new FunctionContextImpl("functionId", nonFilteringArgs, resultSender);
 
-    // log and stat files sizes are not constant with a real cache running, so check for
the sizer estimate within a range
+    // log and stat files sizes are not constant with a real cache running, so check for
the sizer
+    // estimate within a range
     long initalFileSizes = FileUtils.sizeOf(logFile) + FileUtils.sizeOf(statFile);
     new SizeExportLogsFunction().execute(context);
     long finalFileSizes = FileUtils.sizeOf(logFile) + FileUtils.sizeOf(statFile);
@@ -117,15 +118,16 @@ public class SizeExportLogsFunctionCacheTest {
     getAndVerifySizeEstimate(resultSender, expectedSize, expectedSize);
   }
 
-    private void getAndVerifySizeEstimate(TestResultSender resultSender, long minExpected,
long maxExpected)
-      throws Throwable {
+  private void getAndVerifySizeEstimate(TestResultSender resultSender, long minExpected,
+      long maxExpected) throws Throwable {
     List<?> results = resultSender.getResults();
 
     assertThat(results).isNotNull();
     assertThat(results.size()).isEqualTo(1);
-    List<?> result = (List<?>)results.get(0);
+    List<?> result = (List<?>) results.get(0);
     assertThat(result).isNotNull();
-    assertThat(((ExportedLogsSizeDetail) result.get(0)).getLogsSize()).isGreaterThanOrEqualTo(minExpected).isLessThanOrEqualTo(maxExpected);
+    assertThat(((ExportedLogsSizeDetail) result.get(0)).getLogsSize())
+        .isGreaterThanOrEqualTo(minExpected).isLessThanOrEqualTo(maxExpected);
   }
 
   @Test
@@ -167,4 +169,4 @@ public class SizeExportLogsFunctionCacheTest {
       this.t = t;
     }
   }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionFileTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionFileTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionFileTest.java
index 3c1379d..87ad7d2 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionFileTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsFunctionFileTest.java
@@ -56,7 +56,7 @@ public class SizeExportLogsFunctionFileTest {
   public void before() throws Exception {
     this.dir = this.temporaryFolder.getRoot();
     this.member = mock(DistributedMember.class);
-    this.nonFilteringArgs = new Args(null, null, null, false,false, false);
+    this.nonFilteringArgs = new Args(null, null, null, false, false, false);
   }
 
   @After
@@ -66,40 +66,53 @@ public class SizeExportLogsFunctionFileTest {
 
   @Test
   public void bothFiles_returnsCombinedSize() throws Exception {
-    List<File> logFiles = createLogFiles(new File(dir.getName(), testName.getMethodName()),
1, 1,
-        FileUtils.ONE_KB);
+    List<File> logFiles =
+        createLogFiles(new File(dir.getName(), testName.getMethodName()), 1, 1, FileUtils.ONE_KB);
     File logFile = logFiles.get(0);
     long logFileSize = FileUtils.sizeOf(logFiles.get(0));
 
-    List<File> statFiles = createStatFiles(new File(dir.getName(), testName.getMethodName()),
1, 1, FileUtils.ONE_KB);
+    List<File> statFiles =
+        createStatFiles(new File(dir.getName(), testName.getMethodName()), 1, 1, FileUtils.ONE_KB);
     File statArchive = statFiles.get(0);
     long statFileSize = FileUtils.sizeOf(statArchive);
 
     SizeExportLogsFunction function = new SizeExportLogsFunction();
-    assertThat(function.estimateLogFileSize(this.member, logFile, statArchive, nonFilteringArgs)).isEqualTo(logFileSize
+ statFileSize);
+    assertThat(function.estimateLogFileSize(this.member, logFile, statArchive, nonFilteringArgs))
+        .isEqualTo(logFileSize + statFileSize);
   }
 
   private long expectedSize;
+
   @Test
   public void manyFiles_returnsCombinedSize() throws Exception {
     expectedSize = 0;
-    List<File> logFiles = createLogFiles(new File(dir.getName(), testName.getMethodName()),
1, 3, FileUtils.ONE_KB);
-    logFiles.forEach((file) -> {expectedSize += FileUtils.sizeOf(file);});
-
-    List<File> statFiles = createStatFiles(new File(dir.getName(), testName.getMethodName()),
1, 2, FileUtils.ONE_KB * 2);
-    statFiles.forEach((file) -> {expectedSize += FileUtils.sizeOf(file);});
+    List<File> logFiles =
+        createLogFiles(new File(dir.getName(), testName.getMethodName()), 1, 3, FileUtils.ONE_KB);
+    logFiles.forEach((file) -> {
+      expectedSize += FileUtils.sizeOf(file);
+    });
+
+    List<File> statFiles = createStatFiles(new File(dir.getName(), testName.getMethodName()),
1, 2,
+        FileUtils.ONE_KB * 2);
+    statFiles.forEach((file) -> {
+      expectedSize += FileUtils.sizeOf(file);
+    });
 
     SizeExportLogsFunction function = new SizeExportLogsFunction();
-    assertThat(function.estimateLogFileSize(this.member, logFiles.get(0), statFiles.get(0),
nonFilteringArgs)).isEqualTo(expectedSize);
+    assertThat(function.estimateLogFileSize(this.member, logFiles.get(0), statFiles.get(0),
+        nonFilteringArgs)).isEqualTo(expectedSize);
   }
 
   @Test
   public void emptyFiles_returnsZeroSize() throws Exception {
-    List<File> logFiles = createLogFiles(new File(dir.getName(), testName.getMethodName()),
1, 3, 0);
+    List<File> logFiles =
+        createLogFiles(new File(dir.getName(), testName.getMethodName()), 1, 3, 0);
 
-    List<File> statFiles = createStatFiles(new File(dir.getName(), testName.getMethodName()),
1, 2, 0);
+    List<File> statFiles =
+        createStatFiles(new File(dir.getName(), testName.getMethodName()), 1, 2, 0);
     SizeExportLogsFunction function = new SizeExportLogsFunction();
-    assertThat(function.estimateLogFileSize(this.member, logFiles.get(0), statFiles.get(0),
nonFilteringArgs)).isEqualTo(0);
+    assertThat(function.estimateLogFileSize(this.member, logFiles.get(0), statFiles.get(0),
+        nonFilteringArgs)).isEqualTo(0);
   }
 
   @Test
@@ -107,14 +120,17 @@ public class SizeExportLogsFunctionFileTest {
     File nullLogFile = new File(dir.getPath(), "nullLogFile");
     File nullStatFile = new File(dir.getPath(), "nullStatFile");
     SizeExportLogsFunction function = new SizeExportLogsFunction();
-    assertThat(function.estimateLogFileSize(this.member, nullLogFile, nullStatFile, nonFilteringArgs)).isEqualTo(0);
+    assertThat(
+        function.estimateLogFileSize(this.member, nullLogFile, nullStatFile, nonFilteringArgs))
+            .isEqualTo(0);
   }
 
   private List<File> createLogFiles(File logFile, int mainId, int numberOfFiles, long
sizeOfFile)
       throws IOException {
     List<File> files = new ArrayList<>();
     for (int i = 0; i < numberOfFiles; i++) {
-      String name = baseName(logFile.getName()) + "-" + formatId(mainId) + "-" + formatId(i+1)
+ ".log";
+      String name =
+          baseName(logFile.getName()) + "-" + formatId(mainId) + "-" + formatId(i + 1) +
".log";
       File file = createFile(name, sizeOfFile, true);
       files.add(file);
     }
@@ -125,7 +141,8 @@ public class SizeExportLogsFunctionFileTest {
       throws IOException {
     List<File> files = new ArrayList<>();
     for (int i = 0; i < numberOfFiles; i++) {
-      String name = baseName(logFile.getName()) + "-" + formatId(mainId) + "-" + formatId(i+1)
+ ".gfs";
+      String name =
+          baseName(logFile.getName()) + "-" + formatId(mainId) + "-" + formatId(i + 1) +
".gfs";
       File file = createFile(name, sizeOfFile, false);
       files.add(file);
     }
@@ -163,4 +180,4 @@ public class SizeExportLogsFunctionFileTest {
     writer.close();
   }
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsTestSuite.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsTestSuite.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsTestSuite.java
index 3481363..4b51466 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsTestSuite.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/SizeExportLogsTestSuite.java
@@ -13,6 +13,7 @@
  * the License.
  */
 package org.apache.geode.management.internal.cli.functions;
+
 import org.apache.geode.management.internal.cli.util.LogSizerTest;
 import org.junit.runner.RunWith;
 import org.junit.runners.Suite;
@@ -20,8 +21,9 @@ import org.junit.runners.Suite;
 /**
  * JUnit, DUnit and Integration tests for SizeExportLogsFunction.
  */
-@Suite.SuiteClasses({SizeExportLogsFunctionCacheTest.class, SizeExportLogsFunctionFileTest.class,
LogSizerTest.class, ExportedLogsSizeDetailTest.class})
+@Suite.SuiteClasses({SizeExportLogsFunctionCacheTest.class, SizeExportLogsFunctionFileTest.class,
+    LogSizerTest.class, ExportedLogsSizeDetailTest.class})
 @RunWith(Suite.class)
 public class SizeExportLogsTestSuite {
 
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/geode/blob/fe9485fb/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogSizerTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogSizerTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogSizerTest.java
index 988fa03..c7b3ab9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogSizerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/util/LogSizerTest.java
@@ -51,7 +51,7 @@ public class LogSizerTest {
   public void setUp() throws Exception {
     logFilter = mock(LogFilter.class);
     dir = temporaryFolder.getRoot();
-    nonFilteringArgs = new ExportLogsFunction.Args(null, null, null, false,false, false);
+    nonFilteringArgs = new ExportLogsFunction.Args(null, null, null, false, false, false);
 
   }
 
@@ -71,8 +71,10 @@ public class LogSizerTest {
 
     File mockStatFile = mock(File.class);
     File mockLogFile = mock(File.class);
-    when(mockLogFile.toPath()).thenReturn(new File("root" + separator + "parent" + separator
+ testName + ".log").toPath());
-    when(mockStatFile.toPath()).thenReturn(new File("root" + separator + "parent" + separator
+ testName + ".gfs").toPath());
+    when(mockLogFile.toPath()).thenReturn(
+        new File("root" + separator + "parent" + separator + testName + ".log").toPath());
+    when(mockStatFile.toPath()).thenReturn(
+        new File("root" + separator + "parent" + separator + testName + ".gfs").toPath());
     LogSizer sizer = new LogSizer(logFilter, mockLogFile, mockStatFile);
     assertThat(sizer.getFilteredSize()).isEqualTo(0L);
   }
@@ -82,13 +84,16 @@ public class LogSizerTest {
 
     File mockStatFile = mock(File.class);
     File mockLogFile = mock(File.class);
-    when(mockLogFile.toPath()).thenReturn(new File("root" + separator + "parent" + separator
+ testName + ".log").toPath());
-    when(mockStatFile.toPath()).thenReturn(new File("root" + separator + "parent" + separator
+ testName + ".gfs").toPath());
-    LogFilter logFilter = new LogFilter(nonFilteringArgs.getLogLevel(), nonFilteringArgs.isThisLogLevelOnly(),
-        nonFilteringArgs.getStartTime(), nonFilteringArgs.getEndTime());
+    when(mockLogFile.toPath()).thenReturn(
+        new File("root" + separator + "parent" + separator + testName + ".log").toPath());
+    when(mockStatFile.toPath()).thenReturn(
+        new File("root" + separator + "parent" + separator + testName + ".gfs").toPath());
+    LogFilter logFilter =
+        new LogFilter(nonFilteringArgs.getLogLevel(), nonFilteringArgs.isThisLogLevelOnly(),
+            nonFilteringArgs.getStartTime(), nonFilteringArgs.getEndTime());
 
     LogSizer sizer = new LogSizer(logFilter, mockLogFile, mockStatFile);
     assertThat(sizer.getFilteredSize()).isEqualTo(0L);
   }
 
-}
\ No newline at end of file
+}


Mime
View raw message