geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jensde...@apache.org
Subject [geode] branch develop updated: [GEODE-5971] Refactor offline disk store commands to extend SingleGfshCommand base type (#2794)
Date Wed, 07 Nov 2018 23:23:10 GMT
This is an automated email from the ASF dual-hosted git repository.

jensdeppe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new ae8abe2  [GEODE-5971] Refactor offline disk store commands to extend SingleGfshCommand
base type (#2794)
ae8abe2 is described below

commit ae8abe2beab527d6007bf3822cde6157ba8d6040
Author: Aditya Anchuri <aanchuri@pivotal.io>
AuthorDate: Wed Nov 7 15:23:00 2018 -0800

    [GEODE-5971] Refactor offline disk store commands to extend SingleGfshCommand base type
(#2794)
    
    
    Signed-off-by: Peter Tran <ptran@pivotal.io>
---
 ...itTest.java => CompactOfflineDiskStoreJUnitTest.java} |  2 +-
 .../org/apache/geode/internal/cache/OplogJUnitTest.java  | 12 ++++++------
 .../cli/commands/AlterOfflineDiskStoreCommand.java       |  3 ++-
 .../cli/commands/CompactOfflineDiskStoreCommand.java     |  3 ++-
 .../cli/commands/DescribeOfflineDiskStoreCommand.java    | 16 ++++++++--------
 .../cli/commands/ExportOfflineDiskStoreCommand.java      |  3 ++-
 .../cli/commands/UpgradeOfflineDiskStoreCommand.java     |  3 ++-
 7 files changed, 23 insertions(+), 19 deletions(-)

diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskOfflineCompactionJUnitTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/CompactOfflineDiskStoreJUnitTest.java
similarity index 99%
rename from geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskOfflineCompactionJUnitTest.java
rename to geode-core/src/integrationTest/java/org/apache/geode/internal/cache/CompactOfflineDiskStoreJUnitTest.java
index 10a4d26..7128a42 100644
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/DiskOfflineCompactionJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/CompactOfflineDiskStoreJUnitTest.java
@@ -46,7 +46,7 @@ import org.apache.geode.internal.cache.versions.RegionVersionHolder;
 /**
  * Tests offline compaction
  */
-public class DiskOfflineCompactionJUnitTest {
+public class CompactOfflineDiskStoreJUnitTest {
 
   // In this test, entry version, region version, member id, each will be 1 byte
   private static final int versionsize = 3;
diff --git a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogJUnitTest.java
b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogJUnitTest.java
index 7c41c5d..a08fa7e 100755
--- a/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogJUnitTest.java
+++ b/geode-core/src/integrationTest/java/org/apache/geode/internal/cache/OplogJUnitTest.java
@@ -1590,14 +1590,14 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
     final int extra_byte_num_per_entry =
         InternalDataSerializer.calculateBytesForTSandDSID(getDSID((LocalRegion) region));
     final int key3_size =
-        DiskOfflineCompactionJUnitTest.getSize4Create(extra_byte_num_per_entry, "key3", val);
+        CompactOfflineDiskStoreJUnitTest.getSize4Create(extra_byte_num_per_entry, "key3",
val);
     final int tombstone_key1 =
-        DiskOfflineCompactionJUnitTest.getSize4TombstoneWithKey(extra_byte_num_per_entry,
"key1");
+        CompactOfflineDiskStoreJUnitTest.getSize4TombstoneWithKey(extra_byte_num_per_entry,
"key1");
     final int tombstone_key2 =
-        DiskOfflineCompactionJUnitTest.getSize4TombstoneWithKey(extra_byte_num_per_entry,
"key2");
+        CompactOfflineDiskStoreJUnitTest.getSize4TombstoneWithKey(extra_byte_num_per_entry,
"key2");
 
     CountDownLatch putsCompleted = new CountDownLatch(1);
-    // TODO: move static methods from DiskOfflineCompactionJUnitTest to shared util class
+    // TODO: move static methods from CompactOfflineDiskStoreJUnitTest to shared util class
     StatSizeTestCacheObserverAdapter testObserver = new StatSizeTestCacheObserverAdapter(dr,
         key3_size, tombstone_key1, tombstone_key2, putsCompleted);
     CacheObserver old = CacheObserverHolder.setInstance(testObserver);
@@ -1991,10 +1991,10 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
         // _2.drf contained a rvvgc with drMap.size()==1
         int expectedDrfSize = Oplog.OPLOG_DISK_STORE_REC_SIZE + Oplog.OPLOG_MAGIC_SEQ_REC_SIZE
             + Oplog.OPLOG_GEMFIRE_VERSION_REC_SIZE
-            + DiskOfflineCompactionJUnitTest.getRVVSize(1, new int[] {0}, true);
+            + CompactOfflineDiskStoreJUnitTest.getRVVSize(1, new int[] {0}, true);
         int expectedCrfSize = Oplog.OPLOG_DISK_STORE_REC_SIZE + Oplog.OPLOG_MAGIC_SEQ_REC_SIZE
             + Oplog.OPLOG_GEMFIRE_VERSION_REC_SIZE
-            + DiskOfflineCompactionJUnitTest.getRVVSize(1, new int[] {1}, false)
+            + CompactOfflineDiskStoreJUnitTest.getRVVSize(1, new int[] {1}, false)
             + Oplog.OPLOG_NEW_ENTRY_BASE_REC_SIZE + key3Size + tombstoneKey1 + tombstoneKey2;
         int oplog2Size = expectedDrfSize + expectedCrfSize;
         if (after != oplog2Size) {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterOfflineDiskStoreCommand.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterOfflineDiskStoreCommand.java
index a5e3570..4ffcc63 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterOfflineDiskStoreCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterOfflineDiskStoreCommand.java
@@ -24,10 +24,11 @@ import org.apache.geode.cache.CacheExistsException;
 import org.apache.geode.cache.Region;
 import org.apache.geode.internal.cache.DiskStoreImpl;
 import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.SingleGfshCommand;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.model.ResultModel;
 
-public class AlterOfflineDiskStoreCommand extends InternalGfshCommand {
+public class AlterOfflineDiskStoreCommand extends SingleGfshCommand {
   @CliCommand(value = CliStrings.ALTER_DISK_STORE, help = CliStrings.ALTER_DISK_STORE__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})
   public ResultModel alterOfflineDiskStore(
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CompactOfflineDiskStoreCommand.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CompactOfflineDiskStoreCommand.java
index d70f4ed..3c1d974 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CompactOfflineDiskStoreCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CompactOfflineDiskStoreCommand.java
@@ -29,13 +29,14 @@ import org.springframework.shell.core.annotation.CliOption;
 
 import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.cli.SingleGfshCommand;
 import org.apache.geode.management.internal.cli.LogWrapper;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.model.InfoResultModel;
 import org.apache.geode.management.internal.cli.result.model.ResultModel;
 import org.apache.geode.management.internal.cli.util.DiskStoreCompacter;
 
-public class CompactOfflineDiskStoreCommand extends InternalGfshCommand {
+public class CompactOfflineDiskStoreCommand extends SingleGfshCommand {
   @CliCommand(value = CliStrings.COMPACT_OFFLINE_DISK_STORE,
       help = CliStrings.COMPACT_OFFLINE_DISK_STORE__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeOfflineDiskStoreCommand.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeOfflineDiskStoreCommand.java
index abaf367..e73d919 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeOfflineDiskStoreCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeOfflineDiskStoreCommand.java
@@ -26,15 +26,15 @@ import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.Region;
 import org.apache.geode.internal.cache.DiskStoreImpl;
 import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.cli.SingleGfshCommand;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
 
-public class DescribeOfflineDiskStoreCommand extends InternalGfshCommand {
+public class DescribeOfflineDiskStoreCommand extends SingleGfshCommand {
   @CliCommand(value = CliStrings.DESCRIBE_OFFLINE_DISK_STORE,
       help = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})
-  public Result describeOfflineDiskStore(
+  public ResultModel describeOfflineDiskStore(
       @CliOption(key = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__DISKSTORENAME, mandatory =
true,
           help = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__DISKSTORENAME__HELP) String diskStoreName,
       @CliOption(key = CliStrings.DESCRIBE_OFFLINE_DISK_STORE__DISKDIRS, mandatory = true,
@@ -51,24 +51,24 @@ public class DescribeOfflineDiskStoreCommand extends InternalGfshCommand
{
       }
 
       if (Region.SEPARATOR.equals(regionName)) {
-        return ResultBuilder.createUserErrorResult(CliStrings.INVALID_REGION_NAME);
+        return ResultModel.createError(CliStrings.INVALID_REGION_NAME);
       }
 
       ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
       PrintStream printStream = new PrintStream(outputStream);
 
       DiskStoreImpl.dumpInfo(printStream, diskStoreName, dirs, regionName, listPdxTypes);
-      return ResultBuilder.createInfoResult(outputStream.toString());
+      return ResultModel.createInfo(outputStream.toString());
     } catch (VirtualMachineError e) {
       SystemFailure.initiateFailure(e);
       throw e;
     } catch (Throwable th) {
       SystemFailure.checkFailure();
       if (th.getMessage() == null) {
-        return ResultBuilder.createGemFireErrorResult(
+        return ResultModel.createError(
             "An error occurred while describing offline disk stores: " + th);
       }
-      return ResultBuilder.createGemFireErrorResult(
+      return ResultModel.createError(
           "An error occurred while describing offline disk stores: " + th.getMessage());
     }
   }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportOfflineDiskStoreCommand.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportOfflineDiskStoreCommand.java
index bf20067..21a9aae 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportOfflineDiskStoreCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportOfflineDiskStoreCommand.java
@@ -23,11 +23,12 @@ import org.springframework.shell.core.annotation.CliOption;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.internal.cache.DiskStoreImpl;
 import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.cli.SingleGfshCommand;
 import org.apache.geode.management.internal.cli.LogWrapper;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.model.ResultModel;
 
-public class ExportOfflineDiskStoreCommand extends InternalGfshCommand {
+public class ExportOfflineDiskStoreCommand extends SingleGfshCommand {
   @CliCommand(value = CliStrings.EXPORT_OFFLINE_DISK_STORE,
       help = CliStrings.EXPORT_OFFLINE_DISK_STORE__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/UpgradeOfflineDiskStoreCommand.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/UpgradeOfflineDiskStoreCommand.java
index dcf15a7..7e48c08 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/UpgradeOfflineDiskStoreCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/UpgradeOfflineDiskStoreCommand.java
@@ -29,13 +29,14 @@ import org.springframework.shell.core.annotation.CliOption;
 
 import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.cli.SingleGfshCommand;
 import org.apache.geode.management.internal.cli.LogWrapper;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.model.InfoResultModel;
 import org.apache.geode.management.internal.cli.result.model.ResultModel;
 import org.apache.geode.management.internal.cli.util.DiskStoreUpgrader;
 
-public class UpgradeOfflineDiskStoreCommand extends InternalGfshCommand {
+public class UpgradeOfflineDiskStoreCommand extends SingleGfshCommand {
   @CliCommand(value = CliStrings.UPGRADE_OFFLINE_DISK_STORE,
       help = CliStrings.UPGRADE_OFFLINE_DISK_STORE__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GEODE_DISKSTORE})


Mime
View raw message