geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kh...@apache.org
Subject [35/35] geode git commit: Fix type of results from SizeExportLogsFunction
Date Tue, 28 Mar 2017 16:47:03 GMT
Fix type of results from SizeExportLogsFunction


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

Branch: refs/heads/feature/GEODE-2420
Commit: 704fdbcb66bbf7dea842062e5626d63925c0f284
Parents: d1f4a0b
Author: Ken Howe <khowe@pivotal.io>
Authored: Tue Mar 28 09:44:04 2017 -0700
Committer: Ken Howe <khowe@pivotal.io>
Committed: Tue Mar 28 09:44:04 2017 -0700

----------------------------------------------------------------------
 .../cli/commands/ExportLogsCommand.java         | 20 ++++++++++++++++----
 .../cli/commands/ExportLogsIntegrationTest.java |  2 +-
 .../cli/commands/LogLevelInterceptorTest.java   |  2 +-
 3 files changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/704fdbcb/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 6e76da9..5ac7b76 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
@@ -26,6 +26,7 @@ import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.functions.ExportLogsFunction;
+import org.apache.geode.management.internal.cli.functions.ExportedLogsSizeDetail;
 import org.apache.geode.management.internal.cli.functions.SizeExportLogsFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
@@ -111,7 +112,7 @@ public class ExportLogsCommand implements CommandMarker {
       }
 
       if (true) {
-        // TODO: get unzipped sizes from all servers first
+        // TODO: get estimated size of exported logs from all servers first
         Map<String, Integer> fileSizesFromMembers = new HashMap<>();
         for (DistributedMember server : targetMembers) {
           SizeExportLogsFunction.Args
@@ -119,15 +120,26 @@ public class ExportLogsCommand implements CommandMarker {
               new SizeExportLogsFunction.Args(start, end, logLevel, onlyLogLevel, logsOnly,
                   statsOnly);
 
-          List<Long> results = (List<Long>)CliUtil.executeFunction(new SizeExportLogsFunction(),
args, server)
+          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);
+            estimatedSize = sizeInfo.getLogsSize();
+            diskAvailable = sizeInfo.getDiskAvailable();
+            diskSize = sizeInfo.getDiskSize();
+          } else {
+            estimatedSize = 0;
+          }
 
-          long estimatedSize = results.get(0);
 
           logger.info("Received file size from member {}: {}", server.getId(), estimatedSize);
         }
 
-        // TODO: Total all unzipped sizes
+        // TODO: Check log size limits on the locator
       }
 
       // get zipped files from all servers next

http://git-wip-us.apache.org/repos/asf/geode/blob/704fdbcb/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
index 268fa39..5ccee4b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsIntegrationTest.java
@@ -36,7 +36,7 @@ public class ExportLogsIntegrationTest {
   public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
 
   protected void connect() throws Exception {
-    gfsh.connectAndVerify(locator);
+    gfsh.connectAndVerify(locator.getPort(), GfshShellConnectionRule.PortType.locator);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/704fdbcb/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java
index 41b9715..bcbe07c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LogLevelInterceptorTest.java
@@ -41,7 +41,7 @@ public class LogLevelInterceptorTest {
 
   @Before
   public void before() {
-    interceptors.add(new ExportLogCommand.ExportLogsInterceptor());
+    interceptors.add(new ExportLogsInterceptor());
     interceptors.add(new ConfigCommands.AlterRuntimeInterceptor());
     interceptors.add(new MiscellaneousCommands.ChangeLogLevelInterceptor());
 


Mime
View raw message