You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ds...@apache.org on 2017/11/16 20:28:24 UTC

[geode] branch feature/GEODE-3940 updated (59b43c9 -> 11a385e)

This is an automated email from the ASF dual-hosted git repository.

dschneider pushed a change to branch feature/GEODE-3940
in repository https://gitbox.apache.org/repos/asf/geode.git.


    omit 59b43c9  Merge remote-tracking branch 'origin/develop' into feature/GEODE-3940
    omit 807dd93  updated sanctionedDataSerializables to deal with new backup names
    omit 65a2676  fixed package on excluded BackupLock
    omit 7fae1a1  GEODE-3961: Correct test after bad rebase.
    omit 69143c1  GEODE-3961: Refactor ShowMetricsCommand to handle --categories uniformly
    omit bd1c0ec  Remove todo with author name
    omit 1b985b0  GEODE-3898: fix merge conflict
    omit 9ebc4f7  Fix for GEODE-3898: Defined Indexes are not Persisted in Cluster Configuration. (#1022)
    omit ae03b84  GEODE-3973: have the cluster configuration start synchronously when starting a locator (#1050)
    omit 141c793  GEODE-2565: add if-exists option to DestoryGatewaySenderCommand (#1048)
    omit bd523c3  GEODE-3951: PULSE Logout exception when using the defaults. (#1041)
    omit abb39cf  GEODE-3970: Adjust default Travis _JAVA_OPTIONS (#1049)
    omit 576bf71  GEODE-3539: rename GfshShellConnectionRule to GfshCommandRule (#1051)
    omit 36a1165  Revert "GEODE-3592: remove getAnyInstance call (#1026)"
    omit fd3a3ee  fixed javadoc warning
    omit 65617ba  Merge remote-tracking branch 'origin/develop' into feature/GEODE-3940
    omit 7377e1b  GEODE-3940: fix deadlock in backup messages
    omit e67456d  GEODE-3539: cleanup GfshCommand and refactor tests
    omit 36408b7  GEODE-3872: simplify the Command result Assert (#1043)
    omit 3bc8c1a  GEODE-3592: remove getAnyInstance call (#1026)
    omit 8ca7000  GEODE-3593: remove call to getInstance (#1028)
    omit 369af90  GEODE-3594: remove calls of getInstance (#1029)
    omit cd81d55  GEODE-3595: remove getInstance calls (#1030)
    omit 66c3ba1  GEODE-3596: remove getInstanceCalls (#1032)
    omit 8987dc0  GEODE-3597: remove getInstance calls (#1033)
    omit d9393de  GEODE-3598: remove getInstance calls (#1035)
    omit 2d5d643  GEODE-3599: remove getInstance calls (#1037)
    omit 650ed4e  GEODE-3963: make DM.getCache thread safe
    omit c1c6e74  GEODE-3539: add more tests for get, put, locate entry commands (#1025)
    omit cb4f06c  GEODE-3601: remove getExisting call (#1036)
    omit 44f449c  GEODE-3591: remove getAnyInstance call (#1027)
    omit e2caeb5  GEODE-3335: Fix expected member count (#1034)
    omit 2c46f7d  GEODE-3957: User Guide - Strengthen anti-SYNCOOKIES host machine requ… (#1018)
     new 11a385e  GEODE-3940: fix deadlock in backup messages

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (59b43c9)
            \
             N -- N -- N   refs/heads/feature/GEODE-3940 (11a385e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:

-- 
To stop receiving notification emails like this one, please contact
['"commits@geode.apache.org" <co...@geode.apache.org>'].

[geode] 01/01: GEODE-3940: fix deadlock in backup messages

Posted by ds...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dschneider pushed a commit to branch feature/GEODE-3940
in repository https://gitbox.apache.org/repos/asf/geode.git

commit 11a385ef93268484df3bdc67e52a62a9aed40347
Author: Lynn Gallinat <lg...@pivotal.io>
AuthorDate: Fri Nov 3 17:09:42 2017 -0700

    GEODE-3940: fix deadlock in backup messages
    
    When backup sends FlushToDisk, PrepareBackup, and FinishBackup,
    it will no longer wait for all other members to respond before
    doing the same work on its own member.
    In addition to preventing a distributed deadlock, this will
    also improve how long it takes for a backup to complete.
    As part of this work the backup classes and tests have been
    moved into their own backup package.
---
 .travis.yml                                        |    4 +
 .../StartLocatorCommandIntegrationTest.java        |    6 +-
 .../StartServerCommandIntegrationTest.java         |    6 +-
 .../session/tests/TomcatClientServerTest.java      |    4 +-
 .../TomcatSessionBackwardsCompatibilityTest.java   |    4 +-
 .../source/subnavs/geode-subnav.erb                |    3 +
 .../admin/internal/AdminDistributedSystemImpl.java |    2 +-
 .../geode/admin/internal/FinishBackupRequest.java  |  174 ---
 .../geode/admin/internal/FinishBackupResponse.java |   76 -
 .../geode/admin/internal/FlushToDiskRequest.java   |   92 --
 .../geode/admin/internal/PrepareBackupRequest.java |  134 --
 .../org/apache/geode/distributed/internal/DM.java  |  162 ++-
 .../distributed/internal/DistributionManager.java  |   18 +-
 .../internal/DistributionMessageObserver.java      |   16 +-
 .../distributed/internal/InternalLocator.java      |   80 +-
 .../internal/LonerDistributionManager.java         |   41 +-
 .../org/apache/geode/internal/DSFIDFactory.java    |   19 +-
 .../geode/internal/DataSerializableFixedID.java    |    2 +-
 .../org/apache/geode/internal/SystemAdmin.java     |    2 +-
 .../admin/remote/AddHealthListenerRequest.java     |    2 +-
 .../admin/remote/AddHealthListenerResponse.java    |    4 +-
 .../admin/remote/AddStatListenerRequest.java       |    4 +-
 .../admin/remote/AddStatListenerResponse.java      |    4 +-
 .../admin/remote/AdminFailureResponse.java         |   36 +-
 .../admin/remote/AdminMultipleReplyProcessor.java  |   51 +-
 .../geode/internal/admin/remote/AdminRequest.java  |    5 +-
 .../internal/admin/remote/BridgeServerRequest.java |    4 +-
 .../admin/remote/BridgeServerResponse.java         |    4 +-
 .../internal/admin/remote/CacheConfigRequest.java  |    2 +-
 .../internal/admin/remote/CacheConfigResponse.java |    6 +-
 .../internal/admin/remote/CacheInfoRequest.java    |    4 +-
 .../internal/admin/remote/CacheInfoResponse.java   |    5 +-
 .../admin/remote/CancelStatListenerRequest.java    |    2 +-
 .../admin/remote/CancelStatListenerResponse.java   |    4 +-
 .../internal/admin/remote/CliLegacyMessage.java    |    3 +-
 .../internal/admin/remote/CompactRequest.java      |   13 +-
 .../admin/remote/DurableClientInfoRequest.java     |    4 +-
 .../admin/remote/DurableClientInfoResponse.java    |    6 +-
 .../admin/remote/FetchDistLockInfoRequest.java     |    4 +-
 .../admin/remote/FetchDistLockInfoResponse.java    |    3 +-
 .../admin/remote/FetchHealthDiagnosisRequest.java  |    2 +-
 .../admin/remote/FetchHealthDiagnosisResponse.java |    4 +-
 .../internal/admin/remote/FetchHostRequest.java    |    2 +-
 .../internal/admin/remote/FetchHostResponse.java   |    5 +-
 .../remote/FetchResourceAttributesRequest.java     |    2 +-
 .../remote/FetchResourceAttributesResponse.java    |   29 +-
 .../internal/admin/remote/FetchStatsRequest.java   |    2 +-
 .../internal/admin/remote/FetchStatsResponse.java  |   20 +-
 .../internal/admin/remote/FetchSysCfgRequest.java  |    2 +-
 .../internal/admin/remote/FetchSysCfgResponse.java |    3 +-
 .../internal/admin/remote/LicenseInfoRequest.java  |    4 +-
 .../internal/admin/remote/LicenseInfoResponse.java |    9 +-
 .../admin/remote/MissingPersistentIDsRequest.java  |   13 +-
 .../admin/remote/ObjectDetailsRequest.java         |    4 +-
 .../admin/remote/ObjectDetailsResponse.java        |    3 +-
 .../internal/admin/remote/ObjectNamesRequest.java  |    4 +-
 .../internal/admin/remote/ObjectNamesResponse.java |    3 +-
 .../remote/PrepareRevokePersistentIDRequest.java   |    3 +-
 .../admin/remote/RefreshMemberSnapshotRequest.java |    2 +-
 .../remote/RefreshMemberSnapshotResponse.java      |    5 +-
 .../admin/remote/RegionAttributesRequest.java      |    4 +-
 .../admin/remote/RegionAttributesResponse.java     |    4 +-
 .../geode/internal/admin/remote/RegionRequest.java |    4 +-
 .../internal/admin/remote/RegionResponse.java      |    2 +-
 .../internal/admin/remote/RegionSizeRequest.java   |    4 +-
 .../internal/admin/remote/RegionSizeResponse.java  |    3 +-
 .../admin/remote/RegionStatisticsRequest.java      |    2 +-
 .../admin/remote/RegionStatisticsResponse.java     |    4 +-
 .../admin/remote/RegionSubRegionSizeRequest.java   |    4 +-
 .../admin/remote/RegionSubRegionsSizeResponse.java |    7 +-
 .../admin/remote/RemoveHealthListenerRequest.java  |    2 +-
 .../admin/remote/RemoveHealthListenerResponse.java |    4 +-
 .../admin/remote/ResetHealthStatusRequest.java     |    4 +-
 .../admin/remote/ResetHealthStatusResponse.java    |    4 +-
 .../admin/remote/RevokePersistentIDRequest.java    |    3 +-
 .../internal/admin/remote/RootRegionRequest.java   |    2 +-
 .../internal/admin/remote/RootRegionResponse.java  |    5 +-
 .../internal/admin/remote/ShutdownAllRequest.java  |    4 +-
 .../internal/admin/remote/StoreSysCfgRequest.java  |    2 +-
 .../internal/admin/remote/StoreSysCfgResponse.java |    3 +-
 .../internal/admin/remote/SubRegionRequest.java    |    4 +-
 .../internal/admin/remote/SubRegionResponse.java   |    3 +-
 .../internal/admin/remote/TailLogRequest.java      |    2 +-
 .../internal/admin/remote/TailLogResponse.java     |    5 +-
 .../internal/admin/remote/VersionInfoRequest.java  |    4 +-
 .../internal/admin/remote/VersionInfoResponse.java |    3 +-
 .../internal/cache/CreateRegionProcessor.java      |    2 +-
 .../internal/cache/DestroyRegionOperation.java     |   12 +-
 .../geode/internal/cache/DirectoryHolder.java      |    2 +-
 .../geode/internal/cache/DiskStoreBackup.java      |    2 -
 .../geode/internal/cache/DiskStoreFactoryImpl.java |    1 +
 .../apache/geode/internal/cache/DiskStoreImpl.java |   10 +-
 .../internal/cache/DistributedCacheOperation.java  |    3 +-
 .../geode/internal/cache/GemFireCacheImpl.java     |   14 +-
 .../apache/geode/internal/cache/InternalCache.java |    1 +
 .../org/apache/geode/internal/cache/Oplog.java     |   22 +-
 .../internal/cache/PartitionedRegionDataStore.java |    1 +
 .../internal/cache/RemoteOperationMessage.java     |    4 +-
 .../cache/SearchLoadAndWriteProcessor.java         |   14 +-
 .../geode/internal/cache/StateFlushOperation.java  |    8 +-
 .../geode/internal/cache/TXCommitMessage.java      |    6 +-
 .../cache/backup}/BackupDataStoreHelper.java       |   21 +-
 .../cache/backup}/BackupDataStoreResult.java       |    2 +-
 .../{persistence => backup}/BackupInspector.java   |    2 +-
 .../internal/cache/{ => backup}/BackupLock.java    |   45 +-
 .../internal/cache/{ => backup}/BackupManager.java |   27 +-
 .../internal/cache/backup/BackupOperation.java     |   85 ++
 .../cache/backup/BackupReplyProcessor.java         |   59 +
 .../cache/backup/BackupResponse.java}              |   29 +-
 .../cache/backup/BackupResultCollector.java}       |   20 +-
 .../internal/cache/{ => backup}/BackupUtil.java    |    4 +-
 .../geode/internal/cache/backup/FinishBackup.java  |   47 +
 .../internal/cache/backup/FinishBackupFactory.java |   49 +
 .../cache/backup/FinishBackupOperation.java        |   75 +
 .../internal/cache/backup/FinishBackupRequest.java |  100 ++
 .../cache/backup/FlushToDisk.java}                 |   21 +-
 .../cache/backup/FlushToDiskFactory.java}          |   35 +-
 .../cache/backup/FlushToDiskOperation.java         |   87 ++
 .../cache/backup/FlushToDiskProcessor.java}        |   31 +-
 .../internal/cache/backup/FlushToDiskRequest.java  |   57 +
 .../cache/backup}/FlushToDiskResponse.java         |    2 +-
 .../cache/backup/PrepareBackup.java}               |   39 +-
 .../cache/backup/PrepareBackupFactory.java         |   45 +
 .../cache/backup/PrepareBackupOperation.java       |   64 +
 .../cache/backup/PrepareBackupRequest.java         |   73 +
 .../{persistence => backup}/RestoreScript.java     |    2 +-
 .../{persistence => backup}/ScriptGenerator.java   |    2 +-
 .../UnixBackupInspector.java                       |    2 +-
 .../UnixScriptGenerator.java                       |    5 +-
 .../WindowsBackupInspector.java                    |    2 +-
 .../WindowsScriptGenerator.java                    |    3 +-
 .../cache/persistence/MembershipFlushRequest.java  |    2 +-
 .../cache/persistence/MembershipViewRequest.java   |    2 +-
 .../cache/persistence/PersistentMemberManager.java |    8 +-
 .../persistence/PersistentStateQueryMessage.java   |    2 +-
 .../PrepareNewPersistentMemberMessage.java         |    2 +-
 .../persistence/RemovePersistentMemberMessage.java |    2 +-
 .../cache/tier/sockets/CacheClientProxy.java       |    3 +-
 .../tier/sockets/ClientInterestMessageImpl.java    |    6 +-
 .../internal/cache/xmlcache/CacheCreation.java     |    2 +-
 .../org/apache/geode/management/BackupStatus.java  |    7 +-
 .../internal/beans/DistributedSystemBridge.java    |    4 +-
 .../internal/beans/MemberMBeanBridge.java          |    2 +-
 .../geode/management/internal/cli/CliUtil.java     |   58 +-
 .../management/internal/cli/GfshParseResult.java   |    5 +
 .../geode/management/internal/cli/GfshParser.java  |    2 +-
 .../cli/commands/BackupDiskStoreCommand.java       |    2 +-
 .../cli/commands/CreateDefinedIndexesCommand.java  |   27 +-
 .../cli/commands/DescribeClientCommand.java        |  168 ++-
 .../cli/commands/DescribeConfigCommand.java        |   80 +-
 .../cli/commands/DescribeDiskStoreCommand.java     |   44 +-
 .../cli/commands/DescribeMemberCommand.java        |  112 +-
 .../cli/commands/DestroyFunctionCommand.java       |    2 +-
 .../cli/commands/DestroyGatewaySenderCommand.java  |   57 +-
 .../cli/commands/DestroyRegionCommand.java         |   55 +-
 .../internal/cli/commands/ExportDataCommand.java   |    6 +-
 .../internal/cli/commands/ExportLogsCommand.java   |   20 +-
 .../internal/cli/commands/GCCommand.java           |   62 +-
 .../cli/commands/GatewayCommandsUtils.java         |   17 -
 .../internal/cli/commands/GfshCommand.java         |  121 +-
 .../internal/cli/commands/HistoryCommand.java      |   12 +-
 .../internal/cli/commands/ImportDataCommand.java   |    6 +-
 .../internal/cli/commands/ListClientCommand.java   |  115 +-
 .../cli/commands/ListDiskStoresCommand.java        |   23 +-
 .../internal/cli/commands/ListGatewayCommand.java  |  101 +-
 .../internal/cli/commands/ListIndexCommand.java    |   20 +-
 .../commands/LoadBalanceGatewaySenderCommand.java  |   71 +-
 .../internal/cli/commands/LocateEntryCommand.java  |    2 +-
 .../cli/commands/PauseGatewaySenderCommand.java    |   74 +-
 .../internal/cli/commands/PutCommand.java          |    2 +-
 .../cli/commands/ResumeGatewaySenderCommand.java   |   70 +-
 .../internal/cli/commands/ShowLogCommand.java      |   59 +-
 .../internal/cli/commands/ShowMetricsCommand.java  | 1461 ++++++++------------
 .../cli/commands/ShowMetricsInterceptor.java       |  107 ++
 .../internal/cli/commands/ShutdownCommand.java     |    3 +-
 .../cli/commands/StartGatewayReceiverCommand.java  |   73 +-
 .../cli/commands/StartGatewaySenderCommand.java    |  145 +-
 .../internal/cli/commands/StartLocatorCommand.java |  344 +++--
 .../internal/cli/commands/StartServerCommand.java  |  388 +++---
 .../cli/commands/StatusGatewayReceiverCommand.java |   55 +-
 .../cli/commands/StatusGatewaySenderCommand.java   |   61 +-
 .../cli/commands/StopGatewayReceiverCommand.java   |   71 +-
 .../cli/commands/StopGatewaySenderCommand.java     |   65 +-
 .../commands/lifecycle/StartJConsoleCommand.java   |    2 +-
 .../commands/lifecycle/StartJVisualVMCommand.java  |    2 +-
 .../cli/commands/lifecycle/StartPulseCommand.java  |    2 +-
 .../cli/commands/lifecycle/StartVsdCommand.java    |    2 +-
 .../commands/lifecycle/StatusLocatorCommand.java   |   63 +-
 .../commands/lifecycle/StatusServerCommand.java    |   68 +-
 .../cli/commands/lifecycle/StopLocatorCommand.java |  107 +-
 .../cli/commands/lifecycle/StopServerCommand.java  |  101 +-
 ...Exception.java => EntityNotFoundException.java} |   32 +-
 .../cli/exceptions/IndexNotFoundException.java     |   33 -
 .../{CliException.java => UserErrorException.java} |   12 +-
 .../internal/cli/functions/CliFunctionResult.java  |   14 +
 .../functions/CreateDefinedIndexesFunction.java    |   83 +-
 .../cli/functions/DataCommandFunction.java         |    4 +-
 .../cli/functions/DescribeDiskStoreFunction.java   |    4 +-
 .../functions/GatewaySenderDestroyFunction.java    |   58 +-
 .../GatewaySenderDestroyFunctionArgs.java          |    8 +-
 .../cli/functions/RegionCreateFunction.java        |    3 +-
 .../cli/functions/RegionDestroyFunction.java       |   47 +-
 .../management/internal/cli/i18n/CliStrings.java   |    7 +-
 .../internal/cli/remote/CommandExecutor.java       |   39 +-
 .../cli/util/DiskStoreNotFoundException.java       |   47 -
 .../internal/cli/util/MemberNotFoundException.java |   47 -
 .../internal/messages/CompactRequest.java          |   12 +-
 .../BackupDistributedTest.java}                    |  590 ++++----
 .../BackupInspectorIntegrationTest.java            |    2 +-
 .../BackupIntegrationTest.java}                    |   29 +-
 .../internal/cache/backup/BackupLockTest.java      |  105 ++
 .../BackupPrepareAndFinishMsgDUnitTest.java        |   20 +-
 .../cache/backup/BackupReplyProcessorTest.java     |   90 ++
 .../cache/backup/FinishBackupFactoryTest.java      |   87 ++
 .../cache/backup/FinishBackupOperationTest.java    |  236 ++++
 .../cache/backup/FinishBackupRequestTest.java      |  117 ++
 .../cache/backup/FlushToDiskFactoryTest.java       |   83 ++
 .../cache/backup/FlushToDiskOperationTest.java     |  121 ++
 .../cache/backup/FlushToDiskRequestTest.java       |   82 ++
 .../IncrementalBackupDistributedTest.java}         |   17 +-
 ...titionedBackupPrepareAndFinishMsgDUnitTest.java |    5 +-
 .../cache/backup/PrepareBackupFactoryTest.java     |   85 ++
 .../cache/backup/PrepareBackupOperationTest.java   |  232 ++++
 .../cache/backup/PrepareBackupRequestTest.java     |   98 ++
 ...eplicateBackupPrepareAndFinishMsgDUnitTest.java |    5 +-
 .../UnixScriptGeneratorTest.java                   |    2 +-
 .../WindowsScriptGeneratorTest.java                |    2 +-
 .../ExtensionClusterConfigurationDUnitTest.java    |    4 +-
 .../geode/internal/cache/ha/Bug48571DUnitTest.java |   96 +-
 .../cache/partitioned/PersistPRKRFDUnitTest.java   |   36 +-
 ...sistentColocatedPartitionedRegionDUnitTest.java |  226 +--
 .../PersistentPartitionedRegionDUnitTest.java      |  118 +-
 .../PersistentPartitionedRegionTestBase.java       |  961 +++++--------
 ...tPartitionedRegionWithTransactionDUnitTest.java |   28 +-
 .../PersistentRecoveryOrderDUnitTest.java          |    2 +-
 .../management/RegionManagementDUnitTest.java      |   11 +-
 .../beans/DistributedSystemBridgeJUnitTest.java    |    8 +-
 .../management/internal/cli/CliUtilDUnitTest.java  |  481 ++-----
 .../management/internal/cli/NetstatDUnitTest.java  |   16 +-
 .../AlterRegionCommandIntegrationTest.java         |    6 +-
 .../commands/ChangeLogLevelCommandDUnitTest.java   |    8 +-
 .../cli/commands/ConcurrentDeployDUnitTest.java    |    8 +-
 .../CreateDefinedIndexesCommandDUnitTest.java      |  218 +++
 .../commands/CreateDefinedIndexesCommandTest.java  |  166 +++
 .../cli/commands/CreateRegionCommandDUnitTest.java |    4 +-
 .../CreateRegionCommandIntegrationTest.java        |    6 +-
 ...DeployCommandFunctionRegistrationDUnitTest.java |    4 +-
 .../commands/DeployCommandRedeployDUnitTest.java   |    4 +-
 .../cli/commands/DeployWithGroupsDUnitTest.java    |    4 +-
 ...a => DescribeConfigCommandIntegrationTest.java} |   33 +-
 .../cli/commands/DescribeConfigCommandTest.java    |   24 +-
 .../commands/DescribeMembersCommandDUnitTest.java  |    9 +-
 .../commands/DestroyGatewaySenderCommandTest.java  |  108 ++
 .../commands/DestroyIndexCommandsDUnitTest.java    |    4 +-
 .../commands/DestroyRegionCommandDUnitTest.java    |   39 +-
 .../cli/commands/DestroyRegionCommandTest.java     |   86 +-
 .../cli/commands/DiskStoreCommandsJUnitTest.java   |   75 +-
 .../ExecuteFunctionCommandSecurityTest.java        |   28 +-
 .../cli/commands/ExportDataCommandTest.java        |   27 +-
 .../cli/commands/ExportDataIntegrationTest.java    |   21 +-
 .../cli/commands/ExportLogsCommandTest.java        |   11 +-
 .../internal/cli/commands/ExportLogsDUnitTest.java |    4 +-
 .../cli/commands/ExportLogsIntegrationTest.java    |    4 +-
 .../commands/ExportLogsOnServerManagerDUnit.java   |    9 +-
 .../cli/commands/ExportLogsStatsDUnitTest.java     |    4 +-
 .../ExportLogsWithMemberGroupDUnitTest.java        |    4 +-
 .../cli/commands/FunctionCommandsDUnitTest.java    |    6 +-
 .../internal/cli/commands/GcCommandDUnitTest.java  |    8 +-
 .../cli/commands/GemfireDataCommandsDUnitTest.java |  822 +----------
 .../cli/commands/GetCommandIntegrationTest.java    |    6 +-
 .../cli/commands/GfshCommandIntegrationTest.java   |    6 +-
 .../cli/commands/GfshCommandJUnitTest.java         |  635 +--------
 .../cli/commands/ImportDataCommandTest.java        |   26 +-
 .../cli/commands/ImportDataIntegrationTest.java    |   28 +-
 .../cli/commands/IndexCommandsIntegrationTest.java |    6 +-
 .../IndexCommandsShareConfigurationDUnitTest.java  |    6 +-
 .../ListAndDescribeDiskStoreCommandsDUnitTest.java |    6 +-
 .../commands/ListAndDescribeRegionDUnitTest.java   |   30 +-
 .../cli/commands/ListIndexCommandDUnitTest.java    |    6 +-
 .../cli/commands/ListIndexCommandJUnitTest.java    |    2 +-
 .../cli/commands/ListMembersCommandDUnitTest.java  |    4 +-
 .../cli/commands/LocateEntryDUnitTest.java         |   96 ++
 .../cli/commands/PutCommandIntegrationTest.java    |   80 +-
 .../internal/cli/commands/QueryCommandTest.java    |    9 +-
 .../cli/commands/RemoveCommandDUnitTest.java       |    4 +-
 .../cli/commands/RemoveCommandJsonDUnitTest.java   |    4 +-
 .../cli/commands/ShowDeadlockDUnitTest.java        |    4 +-
 .../cli/commands/ShowLogCommandDUnitTest.java      |   11 +-
 .../ShowMetricsCommandIntegrationTest.java         |  171 +++
 .../cli/commands/ShowMetricsDUnitTest.java         |    8 +-
 ...andJUnitTest.java => ShowMetricsJUnitTest.java} |    8 +-
 .../commands/ShowMissingDiskStoresDUnitTest.java   |    8 +-
 .../cli/commands/ShutdownCommandDUnitTest.java     |    8 +-
 .../cli/commands/VersionCommandJUnitTest.java      |    4 +-
 .../GfshStatusCommandsIntegrationTest.java         |    4 +-
 .../geode/management/internal/cli/dto/Key.java}    |   25 +-
 .../geode/management/internal/cli/dto/Value.java}  |   18 +-
 .../cli/functions/CliFunctionResultTest.java}      |   28 +-
 .../CreateDefinedIndexesFunctionTest.java          |  226 +++
 .../DescribeDiskStoreFunctionJUnitTest.java        |   14 +-
 .../GatewaySenderDestroyFunctionTest.java          |   87 ++
 .../cli/functions/RegionDestroyFunctionTest.java   |   97 ++
 .../internal/cli/remote/CommandExecutorTest.java   |   79 +-
 .../cli/shell/GfshMultilineCommandTest.java        |    6 +-
 .../ClusterConfigDeployJarDUnitTest.java           |    4 +-
 .../ClusterConfigDistributionDUnitTest.java        |    4 +-
 .../ClusterConfigImportDUnitTest.java              |    4 +-
 .../ClusterConfigWithSecurityDUnitTest.java        |    4 +-
 .../ImportClusterConfigDistributedTest.java        |    4 +-
 .../ImportOldClusterConfigDUnitTest.java           |    4 +-
 .../security/GfshCommandsPostProcessorTest.java    |    7 +-
 .../security/GfshCommandsSecurityTest.java         |    6 +-
 .../internal/security/MultiUserDUnitTest.java      |   10 +-
 .../pdx/ClientsWithVersioningRetryDUnitTest.java   |    4 +-
 .../PDXGfshPostProcessorOnRemoteServerTest.java    |    6 +-
 .../geode/security/PDXPostProcessorDUnitTest.java  |    8 +-
 .../java/org/apache/geode/test/fake/Fakes.java     |    3 +
 ...ionRuleAssert.java => CommandResultAssert.java} |   86 +-
 ...eExecution.java => CommandResultExecution.java} |   19 +-
 ...ellConnectionRule.java => GfshCommandRule.java} |   16 +-
 .../geode/test/junit/rules/GfshParserRule.java     |    6 +
 .../apache/geode/codeAnalysis/excludedClasses.txt  |  216 +--
 .../codeAnalysis/sanctionedDataSerializables.txt   |    8 +-
 .../geode/codeAnalysis/sanctionedSerializables.txt |    7 +-
 .../BackupIntegrationTest.cache.xml}               |    0
 .../cli/commands/golden-help-offline.properties    |   10 +-
 .../system_requirements/host_machine.html.md.erb   |   11 +-
 .../monitor_tune/chapter_overview.html.md.erb      |    4 +
 .../disabling_tcp_syn_cookies.html.md.erb          |   42 +
 .../lucene/internal/cli/LuceneIndexCommands.java   |  101 +-
 .../lucene/LuceneCommandsSecurityDUnitTest.java    |   28 +-
 .../internal/cli/LuceneIndexCommandsDUnitTest.java |   15 +-
 .../internal/cli/LuceneIndexCommandsJUnitTest.java |   18 +-
 .../LuceneClusterConfigurationDUnitTest.java       |    4 +-
 .../pulse/internal/security/LogoutHandler.java     |   11 +-
 .../internal/security/LogoutHandlerUnitTest.java   |  103 ++
 ...teAndDestroyGatewaySenderCommandsDUnitTest.java |    4 +-
 .../CreateGatewayReceiverCommandDUnitTest.java     |    4 +-
 .../CreateGatewaySenderCommandDUnitTest.java       |    4 +-
 .../DestroyGatewaySenderCommandDUnitTest.java      |   69 +-
 .../PauseGatewaySenderCommandDUnitTest.java        |   30 +-
 .../ResumeGatewaySenderCommandDUnitTest.java       |   34 +-
 .../StartGatewayReceiverCommandDUnitTest.java      |   17 +-
 .../StartGatewaySenderCommandDUnitTest.java        |   16 +-
 .../StatusGatewayReceiverCommandDUnitTest.java     |    4 +-
 .../StatusGatewaySenderCommandDUnitTest.java       |    4 +-
 .../StopGatewayReceiverCommandDUnitTest.java       |   18 +-
 .../StopGatewaySenderCommandDUnitTest.java         |   17 +-
 .../wan/wancommand/WanCommandListDUnitTest.java    |    4 +-
 ...rConfigurationIndexWithFromClauseDUnitTest.java |   16 +-
 .../WANClusterConfigurationDUnitTest.java          |    4 +-
 .../cli/commands/AlterRuntimeCommandDUnitTest.java |  112 +-
 .../commands/ClusterConfigurationDUnitTest.java    |    6 +-
 .../internal/cli/commands/CommandOverHttpTest.java |    6 +-
 .../commands/ConnectCommandIntegrationTest.java    |    8 +-
 .../cli/commands/ConnectCommandWithSSLTest.java    |   70 +-
 .../commands/ConnectCommandWithSecurityTest.java   |   14 +-
 .../commands/DescribeConfigCommandDUnitTest.java   |    8 +-
 ...xecuteFunctionCommandWithSecurityDUnitTest.java |    8 +-
 .../cli/commands/ExportConfigCommandDUnitTest.java |    8 +-
 .../ExportLogsOverHttpIntegrationTest.java         |    4 +-
 .../commands/ExportLogsStatsOverHttpDUnitTest.java |    4 +-
 .../FunctionCommandsOverHttpDUnitTest.java         |    4 +-
 .../cli/commands/IndexCommandOverHttpTest.java     |    4 +-
 .../ListIndexCommandOverHttpDUnitTest.java         |    4 +-
 .../security/GfshCommandsOverHttpSecurityTest.java |    5 +-
 .../internal/security/LogNoPasswordTest.java       |    6 +-
 .../HttpOperationInvokerMBeanOperationTest.java    |    6 +-
 .../shell/HttpOperationInvokerSecurityTest.java    |   12 +-
 369 files changed, 8392 insertions(+), 7794 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index e61cde5..1173220 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -18,6 +18,10 @@ language: java
 jdk:
   - oraclejdk8
 
+# Update _JAVA_OPTIONS environment variable
+before_script:
+  - export _JAVA_OPTIONS='-Xmx1024m -Xms512m'
+
 before_cache:
   - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
 
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandIntegrationTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandIntegrationTest.java
index 6fa05c7..f8cd315 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandIntegrationTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommandIntegrationTest.java
@@ -29,7 +29,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
+import org.junit.rules.ExpectedException;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 
@@ -46,7 +46,7 @@ public class StartLocatorCommandIntegrationTest {
   public GfshParserRule commandRule = new GfshParserRule();
 
   @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+  public ExpectedException thrown = ExpectedException.none();
 
   private StartLocatorCommand spy;
 
@@ -58,6 +58,7 @@ public class StartLocatorCommandIntegrationTest {
 
   @Test
   public void startLocatorWorksWithNoOptions() throws Exception {
+    thrown.expect(NullPointerException.class);
     commandRule.executeCommandWithInstance(spy, "start locator");
 
     ArgumentCaptor<Properties> gemfirePropertiesCaptor = ArgumentCaptor.forClass(Properties.class);
@@ -74,6 +75,7 @@ public class StartLocatorCommandIntegrationTest {
     String startLocatorCommand = new CommandStringBuilder("start locator")
         .addOption(JMX_MANAGER_HOSTNAME_FOR_CLIENTS, FAKE_HOSTNAME).toString();
 
+    thrown.expect(NullPointerException.class);
     commandRule.executeCommandWithInstance(spy, startLocatorCommand);
 
     ArgumentCaptor<Properties> gemfirePropertiesCaptor = ArgumentCaptor.forClass(Properties.class);
diff --git a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandIntegrationTest.java b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandIntegrationTest.java
index 2a8807e..92f8749 100644
--- a/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandIntegrationTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/management/internal/cli/commands/StartServerCommandIntegrationTest.java
@@ -29,7 +29,7 @@ import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
-import org.junit.rules.TemporaryFolder;
+import org.junit.rules.ExpectedException;
 import org.mockito.ArgumentCaptor;
 import org.mockito.Mockito;
 
@@ -46,7 +46,7 @@ public class StartServerCommandIntegrationTest {
   public GfshParserRule commandRule = new GfshParserRule();
 
   @Rule
-  public TemporaryFolder temporaryFolder = new TemporaryFolder();
+  public ExpectedException thrown = ExpectedException.none();
 
   private StartServerCommand spy;
 
@@ -58,6 +58,7 @@ public class StartServerCommandIntegrationTest {
 
   @Test
   public void startServerWorksWithNoOptions() throws Exception {
+    thrown.expect(NullPointerException.class);
     commandRule.executeCommandWithInstance(spy, "start server");
 
     ArgumentCaptor<Properties> gemfirePropertiesCaptor = ArgumentCaptor.forClass(Properties.class);
@@ -74,6 +75,7 @@ public class StartServerCommandIntegrationTest {
     String startServerCommand = new CommandStringBuilder("start server")
         .addOption(JMX_MANAGER_HOSTNAME_FOR_CLIENTS, FAKE_HOSTNAME).toString();
 
+    thrown.expect(NullPointerException.class);
     commandRule.executeCommandWithInstance(spy, startServerCommand);
 
     ArgumentCaptor<Properties> gemfirePropertiesCaptor = ArgumentCaptor.forClass(Properties.class);
diff --git a/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatClientServerTest.java b/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatClientServerTest.java
index 4d7688a..cb94e74 100644
--- a/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatClientServerTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatClientServerTest.java
@@ -25,7 +25,7 @@ import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.DUnitEnv;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 /**
  * Setup class for Tomcat Client Server tests
@@ -39,7 +39,7 @@ public abstract class TomcatClientServerTest extends CargoTestBase {
   public transient TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   @Rule
-  public transient GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public transient GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public transient LocatorServerStartupRule locatorStartup = new LocatorServerStartupRule();
diff --git a/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatSessionBackwardsCompatibilityTest.java b/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatSessionBackwardsCompatibilityTest.java
index e38a374..aae71e4 100644
--- a/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatSessionBackwardsCompatibilityTest.java
+++ b/geode-assembly/src/test/java/org/apache/geode/session/tests/TomcatSessionBackwardsCompatibilityTest.java
@@ -38,7 +38,7 @@ import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.standalone.VersionManager;
 import org.apache.geode.test.junit.categories.BackwardCompatibilityTest;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
 
 /**
@@ -61,7 +61,7 @@ public class TomcatSessionBackwardsCompatibilityTest {
   }
 
   @Rule
-  public transient GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public transient GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder tempFolder = new TemporaryFolder();
diff --git a/geode-book/master_middleman/source/subnavs/geode-subnav.erb b/geode-book/master_middleman/source/subnavs/geode-subnav.erb
index dec2fc1..dfc2ee0 100644
--- a/geode-book/master_middleman/source/subnavs/geode-subnav.erb
+++ b/geode-book/master_middleman/source/subnavs/geode-subnav.erb
@@ -641,6 +641,9 @@ limitations under the License.
                         <a href="/docs/guide/<%=vars.product_version_nodot%>/managing/monitor_tune/chapter_overview.html">Performance Tuning and Configuration</a>
                         <ul>
                             <li>
+                                <a href="/docs/guide/<%=vars.product_version_nodot%>/managing/monitor_tune/disabling_tcp_syn_cookies.html">Disabling TCP SYN Cookies</a>
+                            </li>
+                            <li>
                                 <a href="/docs/guide/<%=vars.product_version_nodot%>/managing/monitor_tune/performance_on_vsphere.html">Improving Performance on vSphere</a>
                             </li>
                             <li class="has_submenu">
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/AdminDistributedSystemImpl.java b/geode-core/src/main/java/org/apache/geode/admin/internal/AdminDistributedSystemImpl.java
index 303fda8..8e23a31 100755
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/AdminDistributedSystemImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/admin/internal/AdminDistributedSystemImpl.java
@@ -38,7 +38,7 @@ import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.Banner;
 import org.apache.geode.internal.admin.*;
 import org.apache.geode.internal.admin.remote.*;
-import org.apache.geode.internal.cache.BackupUtil;
+import org.apache.geode.internal.cache.backup.BackupUtil;
 import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.InternalLogWriter;
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
deleted file mode 100644
index 12f5bb9..0000000
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupRequest.java
+++ /dev/null
@@ -1,174 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.admin.internal;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
-import org.apache.geode.CancelException;
-import org.apache.geode.DataSerializer;
-import org.apache.geode.cache.persistence.PersistentID;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.distributed.internal.DistributionMessage;
-import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.internal.admin.remote.AdminFailureResponse;
-import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
-import org.apache.geode.internal.admin.remote.AdminResponse;
-import org.apache.geode.internal.admin.remote.CliLegacyMessage;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-
-/**
- * A request send from an admin VM to all of the peers to indicate that that should complete the
- * backup operation.
- *
- *
- */
-public class FinishBackupRequest extends CliLegacyMessage {
-  private static final Logger logger = LogService.getLogger();
-
-  private File targetDir;
-  private File baselineDir;
-  private boolean abort;
-
-  public FinishBackupRequest() {
-    super();
-  }
-
-  public FinishBackupRequest(File targetDir, File baselineDir, boolean abort) {
-    this.targetDir = targetDir;
-    this.baselineDir = baselineDir;
-    this.abort = abort;
-  }
-
-  public static Map<DistributedMember, Set<PersistentID>> send(DM dm, Set recipients,
-      File targetDir, File baselineDir, boolean abort) {
-    FinishBackupRequest request = new FinishBackupRequest(targetDir, baselineDir, abort);
-    request.setRecipients(recipients);
-
-    FinishBackupReplyProcessor replyProcessor = new FinishBackupReplyProcessor(dm, recipients);
-    request.msgId = replyProcessor.getProcessorId();
-    dm.putOutgoing(request);
-    try {
-      replyProcessor.waitForReplies();
-    } catch (ReplyException e) {
-      if (!(e.getCause() instanceof CancelException)) {
-        throw e;
-      }
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-    AdminResponse response = request.createResponse((DistributionManager) dm);
-    response.setSender(dm.getDistributionManagerId());
-    replyProcessor.process(response);
-    return replyProcessor.results;
-  }
-
-  @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
-    InternalCache cache = dm.getCache();
-    HashSet<PersistentID> persistentIds;
-    if (cache == null || cache.getBackupManager() == null) {
-      persistentIds = new HashSet<PersistentID>();
-    } else {
-      try {
-        persistentIds = cache.getBackupManager().doBackup(targetDir, baselineDir, abort);
-      } catch (IOException e) {
-        logger.error(
-            LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), e);
-        return AdminFailureResponse.create(dm, getSender(), e);
-      }
-    }
-
-    return new FinishBackupResponse(this.getSender(), persistentIds);
-  }
-
-  public int getDSFID() {
-    return FINISH_BACKUP_REQUEST;
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    super.fromData(in);
-    targetDir = DataSerializer.readFile(in);
-    baselineDir = DataSerializer.readFile(in);
-    abort = DataSerializer.readBoolean(in);
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    super.toData(out);
-    DataSerializer.writeFile(targetDir, out);
-    DataSerializer.writeFile(baselineDir, out);
-    DataSerializer.writeBoolean(abort, out);
-  }
-
-  private static class FinishBackupReplyProcessor extends AdminMultipleReplyProcessor {
-    Map<DistributedMember, Set<PersistentID>> results =
-        Collections.synchronizedMap(new HashMap<DistributedMember, Set<PersistentID>>());
-
-    public FinishBackupReplyProcessor(DM dm, Collection initMembers) {
-      super(dm, initMembers);
-    }
-
-    @Override
-    protected boolean stopBecauseOfExceptions() {
-      return false;
-    }
-
-
-
-    @Override
-    protected int getAckWaitThreshold() {
-      // Disable the 15 second warning if the backup is taking a long time
-      return 0;
-    }
-
-    @Override
-    public long getAckSevereAlertThresholdMS() {
-      // Don't log severe alerts for backups either
-      return Long.MAX_VALUE;
-    }
-
-    @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof FinishBackupResponse) {
-        final HashSet<PersistentID> persistentIds = ((FinishBackupResponse) msg).getPersistentIds();
-        if (persistentIds != null && !persistentIds.isEmpty()) {
-          results.put(msg.getSender(), persistentIds);
-        }
-      }
-      super.process(msg, warn);
-    }
-
-
-
-  }
-}
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupResponse.java b/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupResponse.java
deleted file mode 100644
index 97fdb30..0000000
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FinishBackupResponse.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.admin.internal;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.util.HashSet;
-
-import org.apache.geode.DataSerializer;
-import org.apache.geode.cache.persistence.PersistentID;
-import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.admin.remote.AdminResponse;
-
-/**
- * The reply for a {@link FinishBackupRequest}. The reply contains the persistent ids of the disk
- * stores that were backed up on this member.
- *
- *
- */
-public class FinishBackupResponse extends AdminResponse {
-
-  private HashSet<PersistentID> persistentIds;
-
-  public FinishBackupResponse() {
-    super();
-  }
-
-  public FinishBackupResponse(InternalDistributedMember sender,
-      HashSet<PersistentID> persistentIds) {
-    this.setRecipient(sender);
-    this.persistentIds = persistentIds;
-  }
-
-  public HashSet<PersistentID> getPersistentIds() {
-    return persistentIds;
-  }
-
-  @Override
-  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
-    super.fromData(in);
-    persistentIds = DataSerializer.readHashSet(in);
-  }
-
-  @Override
-  public void toData(DataOutput out) throws IOException {
-    super.toData(out);
-    DataSerializer.writeHashSet(persistentIds, out);
-  }
-
-  @Override
-  protected Object clone() throws CloneNotSupportedException {
-    return super.clone();
-  }
-
-  public int getDSFID() {
-    return FINISH_BACKUP_RESPONSE;
-  }
-
-  @Override
-  public String toString() {
-    return getClass().getName() + ": " + persistentIds;
-  }
-}
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
deleted file mode 100644
index 3a0048a..0000000
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskRequest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.admin.internal;
-
-import java.util.Collection;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
-import org.apache.geode.CancelException;
-import org.apache.geode.cache.DiskStore;
-import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
-import org.apache.geode.internal.admin.remote.AdminResponse;
-import org.apache.geode.internal.admin.remote.CliLegacyMessage;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.logging.LogService;
-
-/**
- * A request to from an admin VM to all non admin members to start a backup. In the prepare phase of
- * the backup, the members will suspend bucket destroys to make sure buckets aren't missed during
- * the backup.
- */
-public class FlushToDiskRequest extends CliLegacyMessage {
-  private static final Logger logger = LogService.getLogger();
-
-  public FlushToDiskRequest() {
-    // nothing
-  }
-
-  public static void send(DM dm, Set recipients) {
-    FlushToDiskRequest request = new FlushToDiskRequest();
-    request.setRecipients(recipients);
-
-    FlushToDiskProcessor replyProcessor = new FlushToDiskProcessor(dm, recipients);
-    request.msgId = replyProcessor.getProcessorId();
-    dm.putOutgoing(request);
-    try {
-      replyProcessor.waitForReplies();
-    } catch (ReplyException e) {
-      if (!(e.getCause() instanceof CancelException)) {
-        throw e;
-      }
-    } catch (InterruptedException e) {
-      logger.debug(e);
-    }
-    AdminResponse response = request.createResponse((DistributionManager) dm);
-    response.setSender(dm.getDistributionManagerId());
-    replyProcessor.process(response);
-  }
-
-  @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
-    InternalCache cache = dm.getCache();
-    if (cache != null) {
-      cache.listDiskStoresIncludingRegionOwned().forEach(DiskStore::flush);
-    }
-
-    return new FlushToDiskResponse(this.getSender());
-  }
-
-  @Override
-  public int getDSFID() {
-    return FLUSH_TO_DISK_REQUEST;
-  }
-
-  private static class FlushToDiskProcessor extends AdminMultipleReplyProcessor {
-    public FlushToDiskProcessor(DM dm, Collection initMembers) {
-      super(dm, initMembers);
-    }
-
-    @Override
-    protected boolean stopBecauseOfExceptions() {
-      return false;
-    }
-  }
-}
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java b/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
deleted file mode 100644
index 869f774..0000000
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupRequest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.admin.internal;
-
-import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.logging.log4j.Logger;
-
-import org.apache.geode.CancelException;
-import org.apache.geode.cache.persistence.PersistentID;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.distributed.internal.DistributionManager;
-import org.apache.geode.distributed.internal.DistributionMessage;
-import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.internal.admin.remote.AdminFailureResponse;
-import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
-import org.apache.geode.internal.admin.remote.AdminResponse;
-import org.apache.geode.internal.admin.remote.CliLegacyMessage;
-import org.apache.geode.internal.cache.BackupManager;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.i18n.LocalizedStrings;
-import org.apache.geode.internal.logging.LogService;
-import org.apache.geode.internal.logging.log4j.LocalizedMessage;
-
-/**
- * A request to from an admin VM to all non admin members to start a backup. In the prepare phase of
- * the backup, the members will suspend bucket destroys to make sure buckets aren't missed during
- * the backup.
- *
- *
- */
-public class PrepareBackupRequest extends CliLegacyMessage {
-  private static final Logger logger = LogService.getLogger();
-
-  public PrepareBackupRequest() {
-
-  }
-
-  public static Map<DistributedMember, Set<PersistentID>> send(DM dm, Set recipients) {
-    PrepareBackupRequest request = new PrepareBackupRequest();
-    request.setRecipients(recipients);
-
-    PrepareBackupReplyProcessor replyProcessor = new PrepareBackupReplyProcessor(dm, recipients);
-    request.msgId = replyProcessor.getProcessorId();
-    dm.putOutgoing(request);
-    try {
-      replyProcessor.waitForReplies();
-    } catch (ReplyException e) {
-      if (!(e.getCause() instanceof CancelException)) {
-        throw e;
-      }
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-    AdminResponse response = request.createResponse((DistributionManager) dm);
-    response.setSender(dm.getDistributionManagerId());
-    replyProcessor.process(response);
-    return replyProcessor.results;
-  }
-
-  @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
-    InternalCache cache = dm.getCache();
-    HashSet<PersistentID> persistentIds;
-    if (cache == null) {
-      persistentIds = new HashSet<>();
-    } else {
-      try {
-        BackupManager manager = cache.startBackup(getSender());
-        persistentIds = manager.prepareForBackup();
-      } catch (IOException e) {
-        logger.error(
-            LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), e);
-        return AdminFailureResponse.create(dm, getSender(), e);
-      }
-    }
-
-
-    return new PrepareBackupResponse(this.getSender(), persistentIds);
-  }
-
-  public int getDSFID() {
-    return PREPARE_BACKUP_REQUEST;
-  }
-
-  private static class PrepareBackupReplyProcessor extends AdminMultipleReplyProcessor {
-    Map<DistributedMember, Set<PersistentID>> results =
-        Collections.synchronizedMap(new HashMap<DistributedMember, Set<PersistentID>>());
-
-    public PrepareBackupReplyProcessor(DM dm, Collection initMembers) {
-      super(dm, initMembers);
-    }
-
-    @Override
-    protected boolean stopBecauseOfExceptions() {
-      return false;
-    }
-
-    @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof PrepareBackupResponse) {
-        final HashSet<PersistentID> persistentIds =
-            ((PrepareBackupResponse) msg).getPersistentIds();
-        if (persistentIds != null && !persistentIds.isEmpty()) {
-          results.put(msg.getSender(), persistentIds);
-        }
-      }
-      super.process(msg, warn);
-    }
-
-
-
-  }
-}
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java
index 1ce7421..31f2154 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DM.java
@@ -24,6 +24,9 @@ import java.util.Set;
 import java.util.concurrent.ExecutorService;
 
 import org.apache.geode.CancelCriterion;
+import org.apache.geode.admin.GemFireHealthConfig;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.Role;
 import org.apache.geode.distributed.internal.locks.ElderState;
@@ -37,31 +40,31 @@ import org.apache.geode.internal.cache.InternalCache;
  */
 public interface DM extends ReplySender {
 
-  public boolean shutdownInProgress();
+  boolean shutdownInProgress();
 
   /**
    * Returns the current "cache time" in milliseconds since the epoch. The "cache time" takes into
    * account skew among the local clocks on the various machines involved in the cache.
    */
-  public long cacheTimeMillis();
+  long cacheTimeMillis();
 
   /**
    * Returns the id of this distribution manager.
    */
-  public InternalDistributedMember getDistributionManagerId();
+  InternalDistributedMember getDistributionManagerId();
 
   /**
    * Get a set of all other members (both admin ones and normal).
    *
    * @since GemFire 5.7
    */
-  public Set getAllOtherMembers();
+  Set getAllOtherMembers();
 
   /**
    * Returns the ID in the membership view that is equal to the argument. If the ID is not in the
    * view, the argument is returned.
    */
-  public InternalDistributedMember getCanonicalId(DistributedMember id);
+  InternalDistributedMember getCanonicalId(DistributedMember id);
 
   /**
    * removes members that have older versions from the given collection, typically a Set from a
@@ -69,7 +72,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 8.0
    */
-  public void retainMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
+  void retainMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
       Version version);
 
   /**
@@ -78,20 +81,20 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 8.0
    */
-  public void removeMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
+  void removeMembersWithSameOrNewerVersion(Collection<InternalDistributedMember> members,
       Version version);
 
   /**
    * Returns an unmodifiable set containing the identities of all of the known distribution
    * managers. As of 7.0 this includes locators since they have a cache.
    */
-  public Set getDistributionManagerIds();
+  Set getDistributionManagerIds();
 
   /**
    * Returns an unmodifiable set containing the identities of all of the known "normal" distribution
    * managers. This does not include locators or admin members.
    */
-  public Set getNormalDistributionManagerIds();
+  Set getNormalDistributionManagerIds();
 
   /**
    * Returns an unmodifiable set containing the identities of all of the known distribution managers
@@ -99,22 +102,22 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 5.7
    */
-  public Set getDistributionManagerIdsIncludingAdmin();
+  Set getDistributionManagerIdsIncludingAdmin();
 
   /**
    * Returns a private-memory list containing getDistributionManagerIds() minus our id.
    */
-  public Set getOtherDistributionManagerIds();
+  Set getOtherDistributionManagerIds();
 
   /**
    * Returns a private-memory list containing getNormalDistributionManagerIds() minus our id.
    */
-  public Set getOtherNormalDistributionManagerIds();
+  Set getOtherNormalDistributionManagerIds();
 
   /**
    * Add a membership listener and return other DistribtionManagerIds as an atomic operation
    */
-  public Set addMembershipListenerAndGetDistributionManagerIds(MembershipListener l);
+  Set addMembershipListenerAndGetDistributionManagerIds(MembershipListener l);
 
   /**
    * Add a membership listener for all members and return other DistribtionManagerIds as an atomic
@@ -122,19 +125,19 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 5.7
    */
-  public Set addAllMembershipListenerAndGetAllIds(MembershipListener l);
+  Set addAllMembershipListenerAndGetAllIds(MembershipListener l);
 
   /**
    * Returns the identity of this <code>DistributionManager</code>
    */
-  public InternalDistributedMember getId();
+  InternalDistributedMember getId();
 
   /**
    * Return true if no other distribution manager was in this group when he joined.
    *
    * @since GemFire 4.0
    */
-  public boolean isAdam();
+  boolean isAdam();
 
   /**
    * Returns the identity of the oldest DM in this group.
@@ -144,19 +147,19 @@ public interface DM extends ReplySender {
    * @return the elder member, possibly null
    * @since GemFire 4.0
    */
-  public InternalDistributedMember getElderId();
+  InternalDistributedMember getElderId();
 
   /**
    * Return true if this is the oldest DM in this group.
    *
    * @since GemFire 5.0
    */
-  public boolean isElder();
+  boolean isElder();
 
   /**
    * Return true if this DM is a loner that is not part of a real distributed system.
    */
-  public boolean isLoner();
+  boolean isLoner();
 
   /**
    * Returns the elder state or null if this DM is not the elder.
@@ -169,14 +172,14 @@ public interface DM extends ReplySender {
    * @throws IllegalStateException if elder try lock fails
    * @since GemFire 4.0
    */
-  public ElderState getElderState(boolean force, boolean useTryLock);
+  ElderState getElderState(boolean force, boolean useTryLock);
 
   /**
    * Returns the id of the underlying distribution channel used for communication.
    *
    * @since GemFire 3.0
    */
-  public long getChannelId();
+  long getChannelId();
 
   /**
    * Adds a message to the outgoing queue. Note that <code>message</code> should not be modified
@@ -187,7 +190,7 @@ public interface DM extends ReplySender {
    * @throws NotSerializableException If <code>message</code> cannot be serialized
    * @see #putOutgoing(DistributionMessage)
    */
-  public Set putOutgoingUserData(DistributionMessage message) throws NotSerializableException;
+  Set putOutgoingUserData(DistributionMessage message) throws NotSerializableException;
 
   /**
    * Sends a message, guaranteed to be serialized
@@ -196,24 +199,24 @@ public interface DM extends ReplySender {
    * @param msg
    * @return recipients who did not receive the message
    */
-  public Set putOutgoing(DistributionMessage msg);
+  Set putOutgoing(DistributionMessage msg);
 
   /**
    * Returns the distributed system to which this distribution manager is connected.
    */
-  public InternalDistributedSystem getSystem();
+  InternalDistributedSystem getSystem();
 
   /**
    * Adds a <code>MembershipListener</code> to this distribution manager.
    */
-  public void addMembershipListener(MembershipListener l);
+  void addMembershipListener(MembershipListener l);
 
   /**
    * Removes a <code>MembershipListener</code> from this distribution manager.
    *
    * @throws IllegalArgumentException <code>l</code> was not registered on this distribution manager
    */
-  public void removeMembershipListener(MembershipListener l);
+  void removeMembershipListener(MembershipListener l);
 
   /**
    * Removes a <code>MembershipListener</code> listening for all members from this distribution
@@ -222,11 +225,11 @@ public interface DM extends ReplySender {
    * @throws IllegalArgumentException <code>l</code> was not registered on this distribution manager
    * @since GemFire 5.7
    */
-  public void removeAllMembershipListener(MembershipListener l);
+  void removeAllMembershipListener(MembershipListener l);
 
-  public void addAdminConsole(InternalDistributedMember id);
+  void addAdminConsole(InternalDistributedMember id);
 
-  public DMStats getStats();
+  DMStats getStats();
 
   /**
    * Used to get the DistributionConfig so that Connection can figure out if it is configured for
@@ -234,7 +237,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 4.2.1
    */
-  public DistributionConfig getConfig();
+  DistributionConfig getConfig();
 
   /**
    * Makes note of a distribution manager that has shut down. Invokes the appropriate listeners.
@@ -243,28 +246,27 @@ public interface DM extends ReplySender {
    *
    * @see ShutdownMessage#process
    */
-  public void handleManagerDeparture(InternalDistributedMember theId, boolean crashed,
-      String reason);
+  void handleManagerDeparture(InternalDistributedMember theId, boolean crashed, String reason);
 
   /**
    * getThreadPool gets this distribution manager's message-processing thread pool
    */
-  public ExecutorService getThreadPool();
+  ExecutorService getThreadPool();
 
   /**
    * Return the high-priority message-processing executor
    */
-  public ExecutorService getHighPriorityThreadPool();
+  ExecutorService getHighPriorityThreadPool();
 
   /**
    * Return the waiting message-processing executor
    */
-  public ExecutorService getWaitingThreadPool();
+  ExecutorService getWaitingThreadPool();
 
   /**
    * Return the special waiting message-processing executor
    */
-  public ExecutorService getPrMetaDataCleanupThreadPool();
+  ExecutorService getPrMetaDataCleanupThreadPool();
 
   /**
    * gets this distribution manager's message-processing executor for ordered (i.e. serialized)
@@ -272,13 +274,13 @@ public interface DM extends ReplySender {
    */
   // public Executor getSerialExecutor();
 
-  public void close();
+  void close();
 
   /**
    * Returns the ordered list of current DistributionManagers in oldest-to-youngest order. Added for
    * DLockGrantor
    */
-  public List<InternalDistributedMember> getViewMembers();
+  List<InternalDistributedMember> getViewMembers();
 
   /**
    * Returns the oldest member in the given set of distribution managers. The current implementation
@@ -288,27 +290,27 @@ public interface DM extends ReplySender {
    * @throws NoSuchElementException when none of the given members is actually a member of the
    *         distributed system.
    */
-  public DistributedMember getOldestMember(Collection members) throws NoSuchElementException;
+  DistributedMember getOldestMember(Collection members) throws NoSuchElementException;
 
   /**
    * @return Set of Admin VM nodes
    */
-  public Set getAdminMemberSet();
+  Set getAdminMemberSet();
 
   /** Throws ShutdownException if closeInProgress returns true. */
-  public void throwIfDistributionStopped();
+  void throwIfDistributionStopped();
 
   /** Returns count of members filling the specified role */
-  public int getRoleCount(Role role);
+  int getRoleCount(Role role);
 
   /** Returns true if at least one member is filling the specified role */
-  public boolean isRolePresent(Role role);
+  boolean isRolePresent(Role role);
 
   /** Returns a set of all roles currently in the distributed system. */
-  public Set getAllRoles();
+  Set getAllRoles();
 
   /** Returns true if id is a current member of the distributed system */
-  public boolean isCurrentMember(InternalDistributedMember id);
+  boolean isCurrentMember(InternalDistributedMember id);
 
   /**
    * Remove given member from list of members who are pending a startup reply
@@ -316,37 +318,37 @@ public interface DM extends ReplySender {
    * @param m the member
    * @param departed true if we're removing them due to membership
    */
-  public void removeUnfinishedStartup(InternalDistributedMember m, boolean departed);
+  void removeUnfinishedStartup(InternalDistributedMember m, boolean departed);
 
-  public void setUnfinishedStartups(Collection s);
+  void setUnfinishedStartups(Collection s);
 
   /**
    * Return the CancelCriterion for this DM.
    *
    * @return CancelCriterion for this DM
    */
-  public CancelCriterion getCancelCriterion();
+  CancelCriterion getCancelCriterion();
 
   /**
    * Return the membership manager for this DM
    *
    * @return the membership manager
    */
-  public MembershipManager getMembershipManager();
+  MembershipManager getMembershipManager();
 
   /**
    * Set the root cause for DM failure
    *
    * @param t the underlying failure
    */
-  public void setRootCause(Throwable t);
+  void setRootCause(Throwable t);
 
   /**
    * Return the underlying root cause for DM failure, possibly null
    *
    * @return the underlying root cause
    */
-  public Throwable getRootCause();
+  Throwable getRootCause();
 
   /**
    * Return all members that are on the the this host
@@ -354,27 +356,25 @@ public interface DM extends ReplySender {
    * @return set of {@link InternalDistributedMember} including this VM
    * @since GemFire 5.9
    */
-  public Set<InternalDistributedMember> getMembersInThisZone();
+  Set<InternalDistributedMember> getMembersInThisZone();
 
   /**
    * Acquire a permit to request a GII from another member
    */
-  public void acquireGIIPermitUninterruptibly();
+  void acquireGIIPermitUninterruptibly();
 
   /**
    * Release a permit to request a GII from another member.
    */
-  public void releaseGIIPermit();
+  void releaseGIIPermit();
 
-  public int getDistributedSystemId();
+  int getDistributedSystemId();
 
-  public boolean enforceUniqueZone();
+  boolean enforceUniqueZone();
 
-  public Set<InternalDistributedMember> getMembersInSameZone(
-      InternalDistributedMember acceptedMember);
+  Set<InternalDistributedMember> getMembersInSameZone(InternalDistributedMember acceptedMember);
 
-  public boolean areInSameZone(InternalDistributedMember member1,
-      InternalDistributedMember member2);
+  boolean areInSameZone(InternalDistributedMember member1, InternalDistributedMember member2);
 
   /**
    * Returns true is the two members are on the same equivalent host machine based on overlapping IP
@@ -383,12 +383,11 @@ public interface DM extends ReplySender {
    * @param member1 First member
    * @param member2 Second member
    */
-  public boolean areOnEquivalentHost(InternalDistributedMember member1,
-      InternalDistributedMember member2);
+  boolean areOnEquivalentHost(InternalDistributedMember member1, InternalDistributedMember member2);
 
-  public Set<InetAddress> getEquivalents(InetAddress in);
+  Set<InetAddress> getEquivalents(InetAddress in);
 
-  public Set<DistributedMember> getGroupMembers(String group);
+  Set<DistributedMember> getGroupMembers(String group);
 
   /**
    * Adds the entry in hostedLocators for a member with one or more hosted locators. The value is a
@@ -402,7 +401,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 6.6.3
    */
-  public void addHostedLocators(InternalDistributedMember member, Collection<String> locators,
+  void addHostedLocators(InternalDistributedMember member, Collection<String> locators,
       boolean isSharedConfigurationEnabled);
 
 
@@ -415,7 +414,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 6.6.3
    */
-  public Collection<String> getHostedLocators(InternalDistributedMember member);
+  Collection<String> getHostedLocators(InternalDistributedMember member);
 
   /**
    * Gets the map of all members hosting locators. The key is the member, and the value is a
@@ -428,7 +427,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 6.6.3
    */
-  public Map<InternalDistributedMember, Collection<String>> getAllHostedLocators();
+  Map<InternalDistributedMember, Collection<String>> getAllHostedLocators();
 
   /**
    * Gets the map of all members hosting locators with shared configuration. The key is the member,
@@ -439,7 +438,7 @@ public interface DM extends ReplySender {
    *
    * @since GemFire 8.0
    */
-  public Map<InternalDistributedMember, Collection<String>> getAllHostedLocatorsWithSharedConfiguration();
+  Map<InternalDistributedMember, Collection<String>> getAllHostedLocatorsWithSharedConfiguration();
 
   /****
    * Determines if the distributed system has the shared configuration service enabled or not.
@@ -447,24 +446,45 @@ public interface DM extends ReplySender {
    * @return true if the distributed system was started or had a locator with
    *         enable-cluster-configuration = true
    */
-  public boolean isSharedConfigurationServiceEnabledForDS();
+  boolean isSharedConfigurationServiceEnabledForDS();
 
   /**
    * Forces use of UDP for communications in the current thread. UDP is connectionless, so no tcp/ip
    * connections will be created or used for messaging until this setting is released with
    * releaseUDPMessagingForCurrentThread.
    */
-  public void forceUDPMessagingForCurrentThread();
+  void forceUDPMessagingForCurrentThread();
 
   /**
    * Releases use of UDP for all communications in the current thread, as established by
    * forceUDPMessagingForCurrentThread.
    */
-  public void releaseUDPMessagingForCurrentThread();
+  void releaseUDPMessagingForCurrentThread();
 
   int getDMType();
 
+  /**
+   * The returned cache will be null if the cache does not yet exist. Note that the returned cache
+   * may be one that is already closed. Callers of GemFireCacheImpl.getInstance() should try to use
+   * this method.
+   */
   InternalCache getCache();
 
+  /**
+   * Returns an existing non-closed cache associated with this DM. Callers of
+   * CacheFactory.getAnyInstance(), CacheFactory.getInstance(DistributedSystem) or
+   * GemFireCacheImpl.getExisting() should try to use this method.
+   *
+   * @throws CacheClosedException if a cache has not yet been associated with this DM or it has been
+   *         {@link Cache#isClosed closed}.
+   */
+  InternalCache getExistingCache();
+
   void setCache(InternalCache instance);
+
+  HealthMonitor getHealthMonitor(InternalDistributedMember owner);
+
+  void removeHealthMonitor(InternalDistributedMember owner, int theId);
+
+  void createHealthMonitor(InternalDistributedMember owner, GemFireHealthConfig cfg);
 }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
index 339d673..6130e12 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionManager.java
@@ -53,6 +53,7 @@ import org.apache.geode.SystemConnectException;
 import org.apache.geode.SystemFailure;
 import org.apache.geode.ToDataException;
 import org.apache.geode.admin.GemFireHealthConfig;
+import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DistributedSystemDisconnectedException;
 import org.apache.geode.distributed.Locator;
@@ -3939,7 +3940,7 @@ public class DistributionManager implements DM {
   /* -----------------------------Health Monitor------------------------------ */
   private final ConcurrentMap hmMap = new ConcurrentHashMap();
 
-  private InternalCache cache;
+  private volatile InternalCache cache;
 
   /**
    * Returns the health monitor for this distribution manager and owner.
@@ -4820,4 +4821,19 @@ public class DistributionManager implements DM {
   public InternalCache getCache() {
     return this.cache;
   }
+
+  @Override
+  public InternalCache getExistingCache() {
+    InternalCache result = this.cache;
+    if (result == null) {
+      throw new CacheClosedException(
+          LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString());
+    }
+    result.getCancelCriterion().checkCancelInProgress(null);
+    if (result.isClosed()) {
+      throw result.getCacheClosedException(
+          LocalizedStrings.CacheFactory_THE_CACHE_HAS_BEEN_CLOSED.toLocalizedString(), null);
+    }
+    return result;
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessageObserver.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessageObserver.java
index e918e12..72e4811 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessageObserver.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/DistributionMessageObserver.java
@@ -14,11 +14,8 @@
  */
 package org.apache.geode.distributed.internal;
 
-
 /**
  * This class is a test hook to intercept DistributionMessages in the VM receiving the message.
- *
- *
  */
 public abstract class DistributionMessageObserver {
 
@@ -27,7 +24,6 @@ public abstract class DistributionMessageObserver {
   /**
    * Set the instance of the observer. Setting to null will clear the observer.
    *
-   * @param instance
    * @return the old observer, or null if there was no old observer.
    */
   public static DistributionMessageObserver setInstance(DistributionMessageObserver instance) {
@@ -47,7 +43,7 @@ public abstract class DistributionMessageObserver {
    * @param message The message itself
    */
   public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) {
-
+    // override as needed
   }
 
   /**
@@ -57,16 +53,16 @@ public abstract class DistributionMessageObserver {
    * @param message The message itself
    */
   public void afterProcessMessage(DistributionManager dm, DistributionMessage message) {
-
+    // override as needed
   }
 
   /**
    * Called just before a message is distributed.
    *
-   * @param dm the distribution manager that's sending the messsage
-   * @param msg the message itself
+   * @param dm the distribution manager that's sending the message
+   * @param message the message itself
    */
-  public void beforeSendMessage(DistributionManager dm, DistributionMessage msg) {
-
+  public void beforeSendMessage(DistributionManager dm, DistributionMessage message) {
+    // override as needed
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
index 942bbf2..73b971e 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/InternalLocator.java
@@ -602,31 +602,6 @@ public class InternalLocator extends Locator implements ConnectListener {
         s);
   }
 
-  class SharedConfigurationRunnable implements Runnable {
-
-    private final InternalLocator locator = InternalLocator.this;
-
-    @Override
-    public void run() {
-      try {
-        if (this.locator.sharedConfig == null) {
-          // locator.sharedConfig will already be created in case of auto-reconnect
-          this.locator.sharedConfig = new ClusterConfigurationService(locator.myCache);
-        }
-        this.locator.sharedConfig.initSharedConfiguration(this.locator.loadFromSharedConfigDir());
-        this.locator.installSharedConfigDistribution();
-        logger.info(
-            "Cluster configuration service start up completed successfully and is now running ....");
-      } catch (CancelException | LockServiceDestroyedException e) {
-        if (logger.isDebugEnabled()) {
-          logger.debug("Cluster configuration start up was cancelled", e);
-        }
-      } catch (Exception e) {
-        logger.error(e.getMessage(), e);
-      }
-    }
-  }
-
   /**
    * Start a distributed system whose life cycle is managed by this locator. When the locator is
    * stopped, this distributed system will be disconnected. If a distributed system already exists,
@@ -722,7 +697,7 @@ public class InternalLocator extends Locator implements ConnectListener {
     }
     startJmxManagerLocationService(internalCache);
 
-    startSharedConfigurationService(internalCache);
+    startSharedConfigurationService();
   }
 
   /**
@@ -1089,19 +1064,13 @@ public class InternalLocator extends Locator implements ConnectListener {
       this.myCache = newCache;
       this.myDs.setDependentLocator(this);
       logger.info("Locator restart: initializing TcpServer");
-      if (isSharedConfigurationEnabled()) {
-        this.sharedConfig = new ClusterConfigurationService(newCache);
-      }
+
       this.server.restarting(newSystem, newCache, this.sharedConfig);
       if (this.productUseLog.isClosed()) {
         this.productUseLog.reopen();
       }
       this.productUseLog.monitorUse(newSystem);
-      this.isSharedConfigurationStarted = true;
-      if (isSharedConfigurationEnabled()) {
-        ExecutorService es = newCache.getDistributionManager().getThreadPool();
-        es.execute(new SharedConfigurationRunnable());
-      }
+      startSharedConfigurationService();
       if (!this.server.isAlive()) {
         logger.info("Locator restart: starting TcpServer");
         startTcpServer();
@@ -1378,20 +1347,41 @@ public class InternalLocator extends Locator implements ConnectListener {
     }
   }
 
-  private void startSharedConfigurationService(InternalCache internalCache) {
+  private void startSharedConfigurationService() {
     installSharedConfigHandler();
 
-    if (this.config.getEnableClusterConfiguration() && !this.isSharedConfigurationStarted) {
-      if (!isDedicatedLocator()) {
-        logger.info("Cluster configuration service not enabled as it is only supported "
-            + "in dedicated locators");
-        return;
-      }
-
-      ExecutorService es = internalCache.getDistributionManager().getThreadPool();
-      es.execute(new SharedConfigurationRunnable());
-    } else {
+    if (!config.getEnableClusterConfiguration()) {
       logger.info("Cluster configuration service is disabled");
+      return;
+    }
+
+    if (isSharedConfigurationStarted) {
+      logger.info("Cluster configuration service is already started.");
+      return;
+    }
+
+    if (!isDedicatedLocator()) {
+      logger.info("Cluster configuration service not enabled as it is only supported "
+          + "in dedicated locators");
+      return;
+    }
+
+    try {
+      if (this.locator.sharedConfig == null) {
+        // locator.sharedConfig will already be created in case of auto-reconnect
+        this.locator.sharedConfig = new ClusterConfigurationService(locator.myCache);
+      }
+      this.locator.sharedConfig.initSharedConfiguration(this.locator.loadFromSharedConfigDir());
+      this.locator.installSharedConfigDistribution();
+      logger.info(
+          "Cluster configuration service start up completed successfully and is now running ....");
+      isSharedConfigurationStarted = true;
+    } catch (CancelException | LockServiceDestroyedException e) {
+      if (logger.isDebugEnabled()) {
+        logger.debug("Cluster configuration start up was cancelled", e);
+      }
+    } catch (Exception e) {
+      logger.error(e.getMessage(), e);
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
index 8bbe019..142f72c 100644
--- a/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
+++ b/geode-core/src/main/java/org/apache/geode/distributed/internal/LonerDistributionManager.java
@@ -22,6 +22,8 @@ import java.util.concurrent.*;
 
 import org.apache.geode.CancelCriterion;
 import org.apache.geode.InternalGemFireError;
+import org.apache.geode.admin.GemFireHealthConfig;
+import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.DurableClientAttributes;
 import org.apache.geode.distributed.Role;
@@ -1249,7 +1251,7 @@ public class LonerDistributionManager implements DM {
   }
 
   private final Stopper stopper = new Stopper();
-  private InternalCache cache;
+  private volatile InternalCache cache;
 
   public CancelCriterion getCancelCriterion() {
     return stopper;
@@ -1379,12 +1381,45 @@ public class LonerDistributionManager implements DM {
   }
 
   @Override
+  public void setCache(InternalCache instance) {
+    this.cache = instance;
+  }
+
+  @Override
   public InternalCache getCache() {
     return this.cache;
   }
 
   @Override
-  public void setCache(InternalCache instance) {
-    this.cache = instance;
+  public InternalCache getExistingCache() {
+    InternalCache result = this.cache;
+    if (result == null) {
+      throw new CacheClosedException(
+          LocalizedStrings.CacheFactory_A_CACHE_HAS_NOT_YET_BEEN_CREATED.toLocalizedString());
+    }
+    result.getCancelCriterion().checkCancelInProgress(null);
+    if (result.isClosed()) {
+      throw result.getCacheClosedException(
+          LocalizedStrings.CacheFactory_THE_CACHE_HAS_BEEN_CLOSED.toLocalizedString(), null);
+    }
+    return result;
+  }
+
+  @Override
+  public HealthMonitor getHealthMonitor(InternalDistributedMember owner) {
+    throw new UnsupportedOperationException(
+        "getHealthMonitor is not supported by " + getClass().getSimpleName());
+  }
+
+  @Override
+  public void removeHealthMonitor(InternalDistributedMember owner, int theId) {
+    throw new UnsupportedOperationException(
+        "removeHealthMonitor is not supported by " + getClass().getSimpleName());
+  }
+
+  @Override
+  public void createHealthMonitor(InternalDistributedMember owner, GemFireHealthConfig cfg) {
+    throw new UnsupportedOperationException(
+        "createHealthMonitor is not supported by " + getClass().getSimpleName());
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java b/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
index f8c8d80..c02be89 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DSFIDFactory.java
@@ -24,12 +24,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
 
 import org.apache.geode.DataSerializer;
 import org.apache.geode.InternalGemFireError;
-import org.apache.geode.admin.internal.FinishBackupRequest;
-import org.apache.geode.admin.internal.FinishBackupResponse;
-import org.apache.geode.admin.internal.FlushToDiskRequest;
-import org.apache.geode.admin.internal.FlushToDiskResponse;
-import org.apache.geode.admin.internal.PrepareBackupRequest;
-import org.apache.geode.admin.internal.PrepareBackupResponse;
 import org.apache.geode.admin.internal.SystemMemberCacheEventProcessor;
 import org.apache.geode.admin.jmx.internal.StatAlertNotification;
 import org.apache.geode.cache.InterestResultPolicy;
@@ -281,6 +275,11 @@ import org.apache.geode.internal.cache.UpdateAttributesProcessor;
 import org.apache.geode.internal.cache.UpdateEntryVersionOperation.UpdateEntryVersionMessage;
 import org.apache.geode.internal.cache.UpdateOperation;
 import org.apache.geode.internal.cache.VMCachedDeserializable;
+import org.apache.geode.internal.cache.backup.BackupResponse;
+import org.apache.geode.internal.cache.backup.FinishBackupRequest;
+import org.apache.geode.internal.cache.backup.FlushToDiskRequest;
+import org.apache.geode.internal.cache.backup.FlushToDiskResponse;
+import org.apache.geode.internal.cache.backup.PrepareBackupRequest;
 import org.apache.geode.internal.cache.compression.SnappyCompressedCachedDeserializable;
 import org.apache.geode.internal.cache.control.ResourceAdvisor.ResourceManagerProfile;
 import org.apache.geode.internal.cache.control.ResourceAdvisor.ResourceProfileMessage;
@@ -874,9 +873,13 @@ public class DSFIDFactory implements DataSerializableFixedID {
     registerDSFID(CLIENT_MEMBERSHIP_MESSAGE, ClientMembershipMessage.class);
     registerDSFID(END_BUCKET_CREATION_MESSAGE, EndBucketCreationMessage.class);
     registerDSFID(PREPARE_BACKUP_REQUEST, PrepareBackupRequest.class);
-    registerDSFID(PREPARE_BACKUP_RESPONSE, PrepareBackupResponse.class);
+    registerDSFID(BACKUP_RESPONSE, BackupResponse.class); // in older versions this was
+                                                          // FinishBackupResponse which is
+                                                          // compatible
     registerDSFID(FINISH_BACKUP_REQUEST, FinishBackupRequest.class);
-    registerDSFID(FINISH_BACKUP_RESPONSE, FinishBackupResponse.class);
+    registerDSFID(FINISH_BACKUP_RESPONSE, BackupResponse.class); // for backwards compatibility map
+                                                                 // FINISH_BACKUP_RESPONSE to
+                                                                 // BackupResponse
     registerDSFID(COMPACT_REQUEST, CompactRequest.class);
     registerDSFID(COMPACT_RESPONSE, CompactResponse.class);
     registerDSFID(FLOW_CONTROL_PERMIT_MESSAGE, FlowControlPermitMessage.class);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/DataSerializableFixedID.java b/geode-core/src/main/java/org/apache/geode/internal/DataSerializableFixedID.java
index e7a319e..d81f067 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/DataSerializableFixedID.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/DataSerializableFixedID.java
@@ -727,7 +727,7 @@ public interface DataSerializableFixedID extends SerializationVersions {
   public static final short FINISH_BACKUP_REQUEST = 2114;
   public static final short FINISH_BACKUP_RESPONSE = 2115;
   public static final short PREPARE_BACKUP_REQUEST = 2116;
-  public static final short PREPARE_BACKUP_RESPONSE = 2117;
+  public static final short BACKUP_RESPONSE = 2117;
   public static final short COMPACT_REQUEST = 2118;
   public static final short COMPACT_RESPONSE = 2119;
   public static final short FLOW_CONTROL_PERMIT_MESSAGE = 2120;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java b/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java
index 2f1eda9..d6660b2 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/SystemAdmin.java
@@ -75,8 +75,8 @@ import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.distributed.internal.tcpserver.TcpClient;
 import org.apache.geode.internal.admin.remote.TailLogResponse;
-import org.apache.geode.internal.cache.BackupUtil;
 import org.apache.geode.internal.cache.DiskStoreImpl;
+import org.apache.geode.internal.cache.backup.BackupUtil;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.DateFormatter;
 import org.apache.geode.internal.logging.MergeLogFiles;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerRequest.java
index 795b00c..4ffe064 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerRequest.java
@@ -57,7 +57,7 @@ public class AddHealthListenerRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return AddHealthListenerResponse.create(dm, this.getSender(), this.cfg);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerResponse.java
index 3fda3f7..50aed79 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddHealthListenerResponse.java
@@ -35,8 +35,8 @@ public class AddHealthListenerResponse extends AdminResponse {
    * Returns a <code>AddHealthListenerResponse</code> that will be returned to the specified
    * recipient.
    */
-  public static AddHealthListenerResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, GemFireHealthConfig cfg) {
+  public static AddHealthListenerResponse create(DM dm, InternalDistributedMember recipient,
+      GemFireHealthConfig cfg) {
     AddHealthListenerResponse m = new AddHealthListenerResponse();
     m.setRecipient(recipient);
     dm.createHealthMonitor(recipient, cfg);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerRequest.java
index 2165ee8..37111dc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerRequest.java
@@ -47,9 +47,11 @@ public class AddStatListenerRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return AddStatListenerResponse.create(dm, this.getSender(), this.resourceId, this.statName);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerResponse.java
index b5f52a9..19b430e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AddStatListenerResponse.java
@@ -34,8 +34,8 @@ public class AddStatListenerResponse extends AdminResponse {
    * Returns a <code>AddStatListenerResponse</code> that will be returned to the specified
    * recipient. The message will contains a copy of the local manager's system config.
    */
-  public static AddStatListenerResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, long resourceId, String statName) {
+  public static AddStatListenerResponse create(DM dm, InternalDistributedMember recipient,
+      long resourceId, String statName) {
     AddStatListenerResponse m = new AddStatListenerResponse();
     m.setRecipient(recipient);
     GemFireStatSampler sampler = null;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminFailureResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminFailureResponse.java
index fc5556b..b709cf5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminFailureResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminFailureResponse.java
@@ -12,40 +12,38 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-
 package org.apache.geode.internal.admin.remote;
 
-import java.io.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 
-import org.apache.geode.*;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.distributed.internal.membership.*;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 
 /**
  * A response to a failed request.
  */
 public class AdminFailureResponse extends AdminResponse {
-  // instance variables
-  Exception cause;
+
+  private Exception cause;
 
   /**
-   * Returns a <code>AdminFailureResponse</code> that will be returned to the specified recipient.
-   * The message will contains a copy of the local manager's system config.
+   * Returns a {@code AdminFailureResponse} that will be returned to the specified recipient. The
+   * message will contains a copy of the local manager's system config.
    */
-  public static AdminFailureResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Exception cause) {
-    AdminFailureResponse m = new AdminFailureResponse();
-    m.setRecipient(recipient);
-    m.cause = cause;
-    return m;
+  public static AdminFailureResponse create(InternalDistributedMember recipient, Exception cause) {
+    AdminFailureResponse message = new AdminFailureResponse();
+    message.setRecipient(recipient);
+    message.cause = cause;
+    return message;
   }
 
-  // instance methods
   public Exception getCause() {
     return this.cause;
   }
 
+  @Override
   public int getDSFID() {
     return ADMIN_FAILURE_RESPONSE;
   }
@@ -59,11 +57,11 @@ public class AdminFailureResponse extends AdminResponse {
   @Override
   public void fromData(DataInput in) throws IOException, ClassNotFoundException {
     super.fromData(in);
-    this.cause = (Exception) DataSerializer.readObject(in);
+    this.cause = DataSerializer.readObject(in);
   }
 
   @Override
   public String toString() {
-    return "AdminFailureResponse from " + this.getRecipient() + " cause=" + this.cause;
+    return "AdminFailureResponse from " + getRecipient() + " cause=" + this.cause;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminMultipleReplyProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminMultipleReplyProcessor.java
index 95efbe7..3a5cff9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminMultipleReplyProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminMultipleReplyProcessor.java
@@ -16,21 +16,15 @@ package org.apache.geode.internal.admin.remote;
 
 import java.util.Collection;
 
-import org.apache.geode.CancelCriterion;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionMessage;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.distributed.internal.ReplyProcessor21;
-import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-
 
 /**
  * TODO prpersist. This code really needs to be merged with the AdminReplyProcessor. However, we're
  * getting close to the release and I don't want to mess with all of the admin code right now. We
  * need this class to handle failures from admin messages that expect replies from multiple members.
- *
  */
 public class AdminMultipleReplyProcessor extends ReplyProcessor21 {
 
@@ -38,47 +32,16 @@ public class AdminMultipleReplyProcessor extends ReplyProcessor21 {
     super(dm, initMembers);
   }
 
-  public AdminMultipleReplyProcessor(DM dm, InternalDistributedMember member) {
-    super(dm, member);
-  }
-
-  public AdminMultipleReplyProcessor(DM dm, InternalDistributedSystem system,
-      Collection initMembers, CancelCriterion cancelCriterion, boolean register) {
-    super(dm, system, initMembers, cancelCriterion, register);
-  }
-
-  public AdminMultipleReplyProcessor(InternalDistributedSystem system, Collection initMembers,
-      CancelCriterion cancelCriterion) {
-    super(system, initMembers, cancelCriterion);
-  }
-
-  public AdminMultipleReplyProcessor(InternalDistributedSystem system, Collection initMembers) {
-    super(system, initMembers);
-  }
-
-  public AdminMultipleReplyProcessor(InternalDistributedSystem system,
-      InternalDistributedMember member, CancelCriterion cancelCriterion) {
-    super(system, member, cancelCriterion);
-  }
-
-  public AdminMultipleReplyProcessor(InternalDistributedSystem system,
-      InternalDistributedMember member) {
-    super(system, member);
-  }
-
   @Override
-  protected void process(DistributionMessage msg, boolean warn) {
-    if (msg instanceof AdminFailureResponse) {
-      Exception ex = ((AdminFailureResponse) msg).getCause();
+  protected void process(DistributionMessage message, boolean warn) {
+    if (message instanceof AdminFailureResponse) {
+      Exception ex = ((AdminFailureResponse) message).getCause();
       if (ex != null) {
-        ReplyException rex = new ReplyException(ex);
-        rex.setSenderIfNull(msg.getSender());
-        processException(msg, rex);
+        ReplyException replyException = new ReplyException(ex);
+        replyException.setSenderIfNull(message.getSender());
+        processException(message, replyException);
       }
     }
-    super.process(msg, warn);
+    super.process(message, warn);
   }
-
-
-
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminRequest.java
index 6ea7de6..58c078b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/AdminRequest.java
@@ -24,6 +24,7 @@ import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.DataSerializer;
 import org.apache.geode.admin.RuntimeAdminException;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.PooledDistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
@@ -134,7 +135,7 @@ public abstract class AdminRequest extends PooledDistributionMessage {
       cpMgr.jumpToModifiedClassLoader(modifiedClasspath);
       response = createResponse(dm);
     } catch (Exception ex) {
-      response = AdminFailureResponse.create(dm, this.getSender(), ex);
+      response = AdminFailureResponse.create(this.getSender(), ex);
     } finally {
       cpMgr.revertToOldClassLoader();
     }
@@ -150,7 +151,7 @@ public abstract class AdminRequest extends PooledDistributionMessage {
   /**
    * Must return a proper response to this request.
    */
-  protected abstract AdminResponse createResponse(DistributionManager dm);
+  protected abstract AdminResponse createResponse(DM dm);
 
   @Override
   public void toData(DataOutput out) throws IOException {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerRequest.java
index 04c4233..853d5bf 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerRequest.java
@@ -17,7 +17,7 @@ package org.apache.geode.internal.admin.remote;
 import java.io.*;
 
 import org.apache.geode.DataSerializer;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.internal.admin.CacheInfo;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 
@@ -132,7 +132,7 @@ public class BridgeServerRequest extends AdminRequest {
    * Creates a <Code>BridgeServerResponse</code> to this request
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return BridgeServerResponse.create(dm, this);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
index ddc102d..6e9b32d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/BridgeServerResponse.java
@@ -22,7 +22,7 @@ import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.server.CacheServer;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.CacheServerImpl;
 import org.apache.geode.internal.cache.InternalCache;
@@ -44,7 +44,7 @@ public class BridgeServerResponse extends AdminResponse {
   /**
    * Creates a {@code BridgeServerResponse} in response to the given request.
    */
-  static BridgeServerResponse create(DistributionManager dm, BridgeServerRequest request) {
+  static BridgeServerResponse create(DM dm, BridgeServerRequest request) {
     BridgeServerResponse m = new BridgeServerResponse();
     m.setRecipient(request.getSender());
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigRequest.java
index dba5810..d833507 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigRequest.java
@@ -53,7 +53,7 @@ public class CacheConfigRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return CacheConfigResponse.create(dm, this.getSender(), this.cacheId, this.attributeCode,
         this.newValue);
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
index 0aae5ff..098d3f1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheConfigResponse.java
@@ -21,7 +21,7 @@ import java.io.IOException;
 import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.cache.InternalCache;
@@ -45,8 +45,8 @@ public class CacheConfigResponse extends AdminResponse {
   /**
    * Returns a {@code CacheConfigResponse} that will be returned to the specified recipient.
    */
-  public static CacheConfigResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int cacheId, byte attributeCode, int newValue) {
+  public static CacheConfigResponse create(DM dm, InternalDistributedMember recipient, int cacheId,
+      byte attributeCode, int newValue) {
     CacheConfigResponse m = new CacheConfigResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoRequest.java
index db13737..2692d28 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoRequest.java
@@ -42,9 +42,11 @@ public class CacheInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return CacheInfoResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
index f6191c5..bc79498 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CacheInfoResponse.java
@@ -21,7 +21,7 @@ import java.io.IOException;
 import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 
@@ -37,8 +37,7 @@ public class CacheInfoResponse extends AdminResponse {
   /**
    * Returns a {@code CacheInfoResponse} that will be returned to the specified recipient.
    */
-  public static CacheInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static CacheInfoResponse create(DM dm, InternalDistributedMember recipient) {
     CacheInfoResponse m = new CacheInfoResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerRequest.java
index 0602fc4..2ac6121 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerRequest.java
@@ -47,7 +47,7 @@ public class CancelStatListenerRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return CancelStatListenerResponse.create(dm, this.getSender(), this.listenerId);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerResponse.java
index d105fa3..73058bb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CancelStatListenerResponse.java
@@ -34,8 +34,8 @@ public class CancelStatListenerResponse extends AdminResponse {
    * Returns a <code>CancelStatListenerResponse</code> that will be returned to the specified
    * recipient. The message will contains a copy of the local manager's system config.
    */
-  public static CancelStatListenerResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int listenerId) {
+  public static CancelStatListenerResponse create(DM dm, InternalDistributedMember recipient,
+      int listenerId) {
     CancelStatListenerResponse m = new CancelStatListenerResponse();
     m.setRecipient(recipient);
     GemFireStatSampler sampler = null;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CliLegacyMessage.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CliLegacyMessage.java
index 3e0fc6e..47bf5ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CliLegacyMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CliLegacyMessage.java
@@ -40,7 +40,7 @@ public abstract class CliLegacyMessage extends AdminRequest {
     } catch (Exception ex) {
       logger.error(
           LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, this.getClass()), ex);
-      response = AdminFailureResponse.create(dm, this.getSender(), ex);
+      response = AdminFailureResponse.create(this.getSender(), ex);
 
     }
     if (response != null) { // cancellations result in null response
@@ -51,5 +51,4 @@ public abstract class CliLegacyMessage extends AdminRequest {
           LocalizedStrings.AdminRequest_RESPONSE_TO__0__WAS_CANCELLED, this.getClass().getName()));
     }
   }
-
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
index 96c87e2..df197f6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/CompactRequest.java
@@ -35,7 +35,6 @@ import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.internal.cache.DiskStoreImpl;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.util.ArrayUtils;
@@ -81,7 +80,7 @@ public class CompactRequest extends CliLegacyMessage {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     InternalCache cache = dm.getCache();
     HashSet<PersistentID> compactedStores = new HashSet<>();
     if (cache != null && !cache.isClosed()) {
@@ -135,14 +134,14 @@ public class CompactRequest extends CliLegacyMessage {
     }
 
     @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof CompactResponse) {
-        final Set<PersistentID> persistentIds = ((CompactResponse) msg).getPersistentIds();
+    protected void process(DistributionMessage message, boolean warn) {
+      if (message instanceof CompactResponse) {
+        final Set<PersistentID> persistentIds = ((CompactResponse) message).getPersistentIds();
         if (persistentIds != null && !persistentIds.isEmpty()) {
-          this.results.put(msg.getSender(), persistentIds);
+          this.results.put(message.getSender(), persistentIds);
         }
       }
-      super.process(msg, warn);
+      super.process(message, warn);
     }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoRequest.java
index a079d25..5d8abd0 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoRequest.java
@@ -55,8 +55,10 @@ public class DurableClientInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return DurableClientInfoResponse.create(dm, this.getSender(), this);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
index 98837c5..f44109c 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/DurableClientInfoResponse.java
@@ -20,7 +20,7 @@ import java.io.IOException;
 
 import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.CacheServerImpl;
 import org.apache.geode.internal.cache.InternalCache;
@@ -40,8 +40,8 @@ public class DurableClientInfoResponse extends AdminResponse {
   /**
    * Returns a {@code DurableClientInfoResponse} that will be returned to the specified recipient.
    */
-  public static DurableClientInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, DurableClientInfoRequest request) {
+  public static DurableClientInfoResponse create(DM dm, InternalDistributedMember recipient,
+      DurableClientInfoRequest request) {
     DurableClientInfoResponse m = new DurableClientInfoResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoRequest.java
index 0e394ae..5a3500f 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoRequest.java
@@ -37,9 +37,11 @@ public class FetchDistLockInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return FetchDistLockInfoResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoResponse.java
index 4492fb8..5804e65 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchDistLockInfoResponse.java
@@ -35,8 +35,7 @@ public class FetchDistLockInfoResponse extends AdminResponse {
    * recipient. The message will contains a copy of the local manager's distributed lock service
    * information.
    */
-  public static FetchDistLockInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static FetchDistLockInfoResponse create(DM dm, InternalDistributedMember recipient) {
     FetchDistLockInfoResponse m = new FetchDistLockInfoResponse();
     InternalDistributedMember id = dm.getDistributionManagerId();
     Set entries = DLockService.snapshotAllServices().entrySet();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisRequest.java
index 37d0a33..05141b4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisRequest.java
@@ -51,7 +51,7 @@ public class FetchHealthDiagnosisRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return FetchHealthDiagnosisResponse.create(dm, this.getSender(), this.id, this.healthCode);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisResponse.java
index 1585907..e134f19 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHealthDiagnosisResponse.java
@@ -36,8 +36,8 @@ public class FetchHealthDiagnosisResponse extends AdminResponse {
    * Returns a <code>FetchHealthDiagnosisResponse</code> that will be returned to the specified
    * recipient.
    */
-  public static FetchHealthDiagnosisResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int id, GemFireHealth.Health healthCode) {
+  public static FetchHealthDiagnosisResponse create(DM dm, InternalDistributedMember recipient,
+      int id, GemFireHealth.Health healthCode) {
     FetchHealthDiagnosisResponse m = new FetchHealthDiagnosisResponse();
     m.setRecipient(recipient);
     {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostRequest.java
index ee3d8b6..f27aa66 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostRequest.java
@@ -41,7 +41,7 @@ public class FetchHostRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return FetchHostResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
index f41f0ac..e568a47 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchHostResponse.java
@@ -27,8 +27,8 @@ import java.net.UnknownHostException;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.internal.cache.CacheServerLauncher;
@@ -59,8 +59,7 @@ public class FetchHostResponse extends AdminResponse {
    * Returns a <code>FetchHostResponse</code> that will be returned to the specified recipient. The
    * message will contains a copy of this vm's local host.
    */
-  public static FetchHostResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static FetchHostResponse create(DM dm, InternalDistributedMember recipient) {
     FetchHostResponse m = new FetchHostResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesRequest.java
index 308a759..ed1095a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesRequest.java
@@ -38,7 +38,7 @@ public class FetchResourceAttributesRequest extends AdminRequest {
   }
 
   @Override
-  public AdminResponse createResponse(DistributionManager dm) {
+  public AdminResponse createResponse(DM dm) {
     return FetchResourceAttributesResponse.create(dm, this.getSender(), resourceUniqueId);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesResponse.java
index 7f2be75..709a89d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchResourceAttributesResponse.java
@@ -12,23 +12,26 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
-
 package org.apache.geode.internal.admin.remote;
 
-import java.io.*;
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
 
-import org.apache.geode.*;
-import org.apache.geode.distributed.internal.*;
-import org.apache.geode.distributed.internal.membership.*;
+import org.apache.geode.DataSerializer;
+import org.apache.geode.StatisticDescriptor;
+import org.apache.geode.Statistics;
+import org.apache.geode.StatisticsType;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 
 public class FetchResourceAttributesResponse extends AdminResponse {
 
-  // instance variables
   private RemoteStat[] stats;
 
-  public static FetchResourceAttributesResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, long rsrcUniqueId) {
+  public static FetchResourceAttributesResponse create(DM dm, InternalDistributedMember recipient,
+      long rsrcUniqueId) {
     FetchResourceAttributesResponse m = new FetchResourceAttributesResponse();
     m.setRecipient(recipient);
     Statistics s = null;
@@ -53,9 +56,11 @@ public class FetchResourceAttributesResponse extends AdminResponse {
   }
 
   /**
-   * Constructor required by <code>DataSerializable</code>
+   * Constructor required by {@code DataSerializable}
    */
-  public FetchResourceAttributesResponse() {}
+  public FetchResourceAttributesResponse() {
+    // nothing
+  }
 
   public int getDSFID() {
     return FETCH_RESOURCE_ATTRIBUTES_RESPONSE;
@@ -75,6 +80,6 @@ public class FetchResourceAttributesResponse extends AdminResponse {
 
   @Override
   public String toString() {
-    return "FetchResourceAttributesResponse from " + this.getRecipient();
+    return "FetchResourceAttributesResponse from " + getRecipient();
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsRequest.java
index dc98cae..8cd6d1c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsRequest.java
@@ -40,7 +40,7 @@ public class FetchStatsRequest extends AdminRequest {
   }
 
   @Override
-  public AdminResponse createResponse(DistributionManager dm) {
+  public AdminResponse createResponse(DM dm) {
     return FetchStatsResponse.create(dm, this.getSender(), this.statisticsTypeName);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java
index f9a861c..665f6c4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchStatsResponse.java
@@ -18,23 +18,19 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.ConcurrentModificationException;
-import java.util.Iterator;
 import java.util.List;
 
 import org.apache.geode.DataSerializer;
 import org.apache.geode.Statistics;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.InternalDistributedSystem.StatisticsVisitor;
-import org.apache.geode.distributed.internal.membership.*;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 
 /**
- * Provides a response of remote statistic resources for a <code>FetchStatsRequest</code>
- *
+ * Provides a response of remote statistic resources for a {@code FetchStatsRequest}
  */
 public class FetchStatsResponse extends AdminResponse {
 
-  // instance variables
   private RemoteStatResource[] stats;
 
   /**
@@ -44,12 +40,11 @@ public class FetchStatsResponse extends AdminResponse {
    * @param recipient the recipient who made the original request
    * @return response containing all remote stat resources
    */
-  public static FetchStatsResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, final String statisticsTypeName) {
-    // LogWriterI18n log = dm.getLogger();
+  public static FetchStatsResponse create(DM dm, InternalDistributedMember recipient,
+      final String statisticsTypeName) {
     FetchStatsResponse m = new FetchStatsResponse();
     m.setRecipient(recipient);
-    final List<RemoteStatResource> statList = new ArrayList<RemoteStatResource>();
+    List<RemoteStatResource> statList = new ArrayList<RemoteStatResource>();
     // get vm-local stats
     // call visitStatistics to fix for bug 40358
     if (statisticsTypeName == null) {
@@ -72,7 +67,6 @@ public class FetchStatsResponse extends AdminResponse {
     return m;
   }
 
-
   @Override
   public boolean sendViaUDP() {
     return true;
@@ -130,7 +124,7 @@ public class FetchStatsResponse extends AdminResponse {
    */
   @Override
   public String toString() {
-    return "FetchStatsResponse from " + this.getRecipient() + " stats.length=" + stats.length;
+    return "FetchStatsResponse from " + getRecipient() + " stats.length=" + stats.length;
   }
 
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgRequest.java
index fa1288f..33d78ff 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgRequest.java
@@ -48,7 +48,7 @@ public class FetchSysCfgRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return FetchSysCfgResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgResponse.java
index 57d58c1..e5405bc 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/FetchSysCfgResponse.java
@@ -34,8 +34,7 @@ public class FetchSysCfgResponse extends AdminResponse {
    * Returns a <code>FetchSysCfgResponse</code> that will be returned to the specified recipient.
    * The message will contains a copy of the local manager's config.
    */
-  public static FetchSysCfgResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static FetchSysCfgResponse create(DM dm, InternalDistributedMember recipient) {
     FetchSysCfgResponse m = new FetchSysCfgResponse();
     m.setRecipient(recipient);
     Config conf = dm.getSystem().getConfig();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoRequest.java
index 22a5f67..11877d1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoRequest.java
@@ -40,9 +40,11 @@ public class LicenseInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return LicenseInfoResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoResponse.java
index ba05780..edc63d8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/LicenseInfoResponse.java
@@ -22,26 +22,23 @@ import java.util.Properties;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.logging.LogService;
 
-
 /**
  * A message that is sent in response to a {@link LicenseInfoRequest}.
  */
 public class LicenseInfoResponse extends AdminResponse {
   private static final Logger logger = LogService.getLogger();
 
-  // instance variables
   private Properties p;
 
-
   /**
-   * Returns a <code>LicenseInfoResponse</code> that will be returned to the specified recipient.
+   * Returns a {@code LicenseInfoResponse} that will be returned to the specified recipient.
    */
-  public static LicenseInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static LicenseInfoResponse create(DM dm, InternalDistributedMember recipient) {
     LicenseInfoResponse m = new LicenseInfoResponse();
     m.setRecipient(recipient);
     m.p = new Properties();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
index 68ac778..e273824 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/MissingPersistentIDsRequest.java
@@ -30,7 +30,6 @@ import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.ReplyException;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.persistence.PersistentMemberID;
 import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
@@ -78,7 +77,7 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     Set<PersistentID> missingIds = new HashSet<>();
     Set<PersistentID> localPatterns = new HashSet<>();
     InternalCache cache = dm.getCache();
@@ -124,12 +123,12 @@ public class MissingPersistentIDsRequest extends CliLegacyMessage {
     }
 
     @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof MissingPersistentIDsResponse) {
-        this.missing.addAll(((MissingPersistentIDsResponse) msg).getMissingIds());
-        this.existing.addAll(((MissingPersistentIDsResponse) msg).getLocalIds());
+    protected void process(DistributionMessage message, boolean warn) {
+      if (message instanceof MissingPersistentIDsResponse) {
+        this.missing.addAll(((MissingPersistentIDsResponse) message).getMissingIds());
+        this.existing.addAll(((MissingPersistentIDsResponse) message).getLocalIds());
       }
-      super.process(msg, warn);
+      super.process(message, warn);
     }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsRequest.java
index 36dba51..1dd5c26 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsRequest.java
@@ -56,9 +56,11 @@ public class ObjectDetailsRequest extends RegionAdminRequest implements Cancella
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     CancellationRegistry.getInstance().registerMessage(this);
     resp = ObjectDetailsResponse.create(dm, this.getSender());
     if (cancelled) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsResponse.java
index aeb33e5..490a3b1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectDetailsResponse.java
@@ -38,8 +38,7 @@ public class ObjectDetailsResponse extends AdminResponse implements Cancellable
    * Returns a <code>ObjectValueResponse</code> that will be returned to the specified recipient.
    * The message will contains a copy of the local manager's system config.
    */
-  public static ObjectDetailsResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static ObjectDetailsResponse create(DM dm, InternalDistributedMember recipient) {
     ObjectDetailsResponse m = new ObjectDetailsResponse();
     m.setRecipient(recipient);
     return m;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesRequest.java
index c51cb2b..5987340 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesRequest.java
@@ -44,9 +44,11 @@ public class ObjectNamesRequest extends RegionAdminRequest implements Cancellabl
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     CancellationRegistry.getInstance().registerMessage(this);
     resp = ObjectNamesResponse.create(dm, this.getSender());
     if (cancelled) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesResponse.java
index 3f02d0b..c916f0d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ObjectNamesResponse.java
@@ -36,8 +36,7 @@ public class ObjectNamesResponse extends AdminResponse implements Cancellable {
    * Returns a <code>ObjectNamesResponse</code> that will be returned to the specified recipient.
    * The message will contains a copy of the local manager's system config.
    */
-  public static ObjectNamesResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static ObjectNamesResponse create(DM dm, InternalDistributedMember recipient) {
     ObjectNamesResponse m = new ObjectNamesResponse();
     m.setRecipient(recipient);
     return m;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
index ac9fdbc..6a84143 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/PrepareRevokePersistentIDRequest.java
@@ -27,7 +27,6 @@ import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
 import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
@@ -90,7 +89,7 @@ public class PrepareRevokePersistentIDRequest extends CliLegacyMessage {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     InternalCache cache = dm.getCache();
     if (cache != null && !cache.isClosed()) {
       PersistentMemberManager mm = cache.getPersistentMemberManager();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotRequest.java
index 0de8b79..5d76bbb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotRequest.java
@@ -41,7 +41,7 @@ public class RefreshMemberSnapshotRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return RefreshMemberSnapshotResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
index 9e973f9..bf0bd6c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RefreshMemberSnapshotResponse.java
@@ -22,7 +22,7 @@ import org.apache.geode.DataSerializer;
 import org.apache.geode.admin.GemFireMemberStatus;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 
@@ -38,8 +38,7 @@ public class RefreshMemberSnapshotResponse extends AdminResponse {
    * Returns a {@code FetchSysCfgResponse} that will be returned to the specified recipient. The
    * message will contains a copy of the local manager's config.
    */
-  public static RefreshMemberSnapshotResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static RefreshMemberSnapshotResponse create(DM dm, InternalDistributedMember recipient) {
     RefreshMemberSnapshotResponse m = new RefreshMemberSnapshotResponse();
     m.setRecipient(recipient);
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesRequest.java
index 9cf6d3c..16ce17c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesRequest.java
@@ -42,9 +42,11 @@ public class RegionAttributesRequest extends RegionAdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return RegionAttributesResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem()));
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesResponse.java
index f618826..abd2b77 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionAttributesResponse.java
@@ -34,8 +34,8 @@ public class RegionAttributesResponse extends AdminResponse {
    * Returns a <code>RegionAttributesResponse</code> that will be returned to the specified
    * recipient. The message will contains a copy of the local manager's system config.
    */
-  public static RegionAttributesResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Region r) {
+  public static RegionAttributesResponse create(DM dm, InternalDistributedMember recipient,
+      Region r) {
     RegionAttributesResponse m = new RegionAttributesResponse();
     m.setRecipient(recipient);
     m.attributes = new RemoteRegionAttributes(r.getAttributes());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionRequest.java
index ebd176e..596c59c 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionRequest.java
@@ -111,9 +111,11 @@ public class RegionRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     // nothing needs to be done. If we got this far then a cache must exist.
     return RegionResponse.create(dm, this.getSender(), this);
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionResponse.java
index e444be8..5faefe1 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionResponse.java
@@ -48,7 +48,7 @@ public class RegionResponse extends AdminResponse {
    * Returns a <code>RegionResponse</code> that will be returned to the specified recipient. The
    * message will contains a copy of the local manager's system config.
    */
-  public static RegionResponse create(DistributionManager dm, InternalDistributedMember recipient,
+  public static RegionResponse create(DM dm, InternalDistributedMember recipient,
       RegionRequest request) {
     RegionResponse m = new RegionResponse();
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeRequest.java
index 73a5b50..94902a4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeRequest.java
@@ -40,9 +40,11 @@ public class RegionSizeRequest extends RegionAdminRequest implements Cancellable
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     Assert.assertTrue(this.getSender() != null);
     CancellationRegistry.getInstance().registerMessage(this);
     resp = RegionSizeResponse.create(dm, this.getSender());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeResponse.java
index 69fbec4..883c1d7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSizeResponse.java
@@ -35,8 +35,7 @@ public class RegionSizeResponse extends AdminResponse implements Cancellable {
   /**
    * Returns a <code>RegionSizeResponse</code> that will be returned to the specified recipient.
    */
-  public static RegionSizeResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static RegionSizeResponse create(DM dm, InternalDistributedMember recipient) {
     RegionSizeResponse m = new RegionSizeResponse();
     m.setRecipient(recipient);
     return m;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsRequest.java
index 4799b91..e8cc225 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsRequest.java
@@ -44,7 +44,7 @@ public class RegionStatisticsRequest extends RegionAdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return RegionStatisticsResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem()));
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsResponse.java
index 9197eda..4778d15 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionStatisticsResponse.java
@@ -34,8 +34,8 @@ public class RegionStatisticsResponse extends AdminResponse {
    * Returns a <code>RegionStatisticsResponse</code> that will be returned to the specified
    * recipient. The message will contains a copy of the local manager's system config.
    */
-  public static RegionStatisticsResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Region r) {
+  public static RegionStatisticsResponse create(DM dm, InternalDistributedMember recipient,
+      Region r) {
     RegionStatisticsResponse m = new RegionStatisticsResponse();
     m.setRecipient(recipient);
     m.regionStatistics = new RemoteCacheStatistics(r.getStatistics());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionSizeRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionSizeRequest.java
index 2306bca..13123d9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionSizeRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionSizeRequest.java
@@ -18,7 +18,7 @@ import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 
 /**
  * Admin request to transfer region info for a member
@@ -38,7 +38,7 @@ public class RegionSubRegionSizeRequest extends AdminRequest implements Cancella
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     CancellationRegistry.getInstance().registerMessage(this);
 
     resp = RegionSubRegionsSizeResponse.create(dm, this.getSender());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
index 5e24f63..2ee08cd 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RegionSubRegionsSizeResponse.java
@@ -26,7 +26,7 @@ import org.apache.geode.admin.RegionSubRegionSnapshot;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
@@ -54,8 +54,7 @@ public class RegionSubRegionsSizeResponse extends AdminResponse implements Cance
    * Returns a {@code RegionSubRegionsSizeResponse} that will be returned to the specified
    * recipient. The message will contains a copy of the region snapshot
    */
-  public static RegionSubRegionsSizeResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static RegionSubRegionsSizeResponse create(DM dm, InternalDistributedMember recipient) {
     RegionSubRegionsSizeResponse m = new RegionSubRegionsSizeResponse();
     m.setRecipient(recipient);
     m.snapshot = null;
@@ -64,7 +63,7 @@ public class RegionSubRegionsSizeResponse extends AdminResponse implements Cance
     return m;
   }
 
-  void populateSnapshot(DistributionManager dm) {
+  void populateSnapshot(DM dm) {
     if (this.cancelled) {
       return;
     }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerRequest.java
index 3a615a5..2225bde 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerRequest.java
@@ -48,7 +48,7 @@ public class RemoveHealthListenerRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return RemoveHealthListenerResponse.create(dm, this.getSender(), this.id);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerResponse.java
index eeb85b2..9c44464 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RemoveHealthListenerResponse.java
@@ -33,8 +33,8 @@ public class RemoveHealthListenerResponse extends AdminResponse {
    * Returns a <code>RemoveHealthListenerResponse</code> that will be returned to the specified
    * recipient.
    */
-  public static RemoveHealthListenerResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int id) {
+  public static RemoveHealthListenerResponse create(DM dm, InternalDistributedMember recipient,
+      int id) {
     RemoveHealthListenerResponse m = new RemoveHealthListenerResponse();
     m.setRecipient(recipient);
     dm.removeHealthMonitor(recipient, id);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusRequest.java
index 709f069..7a75c36 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusRequest.java
@@ -46,9 +46,11 @@ public class ResetHealthStatusRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return ResetHealthStatusResponse.create(dm, this.getSender(), this.id);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusResponse.java
index 0659b9c..b5a5c22 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ResetHealthStatusResponse.java
@@ -33,8 +33,8 @@ public class ResetHealthStatusResponse extends AdminResponse {
    * Returns a <code>ResetHealthStatusResponse</code> that will be returned to the specified
    * recipient.
    */
-  public static ResetHealthStatusResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, int id) {
+  public static ResetHealthStatusResponse create(DM dm, InternalDistributedMember recipient,
+      int id) {
     ResetHealthStatusResponse m = new ResetHealthStatusResponse();
     m.setRecipient(recipient);
     {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
index f425a2b..feb638e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RevokePersistentIDRequest.java
@@ -26,7 +26,6 @@ import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.internal.InternalDataSerializer;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
 import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
@@ -74,7 +73,7 @@ public class RevokePersistentIDRequest extends CliLegacyMessage {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     InternalCache cache = dm.getCache();
     if (cache != null && !cache.isClosed()) {
       PersistentMemberManager mm = cache.getPersistentMemberManager();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionRequest.java
index f6332dd..392fe6b 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionRequest.java
@@ -45,7 +45,7 @@ public class RootRegionRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     // nothing needs to be done. If we got this far then a cache must exist.
     return RootRegionResponse.create(dm, this.getSender());
   }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
index 3dad8f7..64bd67d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/RootRegionResponse.java
@@ -25,8 +25,8 @@ import org.apache.geode.CancelException;
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
 import org.apache.geode.cache.Region;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.admin.GemFireVM;
 import org.apache.geode.internal.cache.InternalCache;
@@ -43,8 +43,7 @@ public class RootRegionResponse extends AdminResponse {
    * Returns a {@code RootRegionResponse} that will be returned to the specified recipient. The
    * message will contains a copy of the local manager's system config.
    */
-  public static RootRegionResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static RootRegionResponse create(DM dm, InternalDistributedMember recipient) {
     RootRegionResponse m = new RootRegionResponse();
     try {
       InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
index b7b2c30..3023a37 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/ShutdownAllRequest.java
@@ -87,7 +87,7 @@ public class ShutdownAllRequest extends AdminRequest {
           if (logger.isDebugEnabled()) {
             logger.debug("caught exception while processing shutdownAll locally", ex);
           }
-          response = AdminFailureResponse.create(dism, myId, ex);
+          response = AdminFailureResponse.create(myId, ex);
         }
         response.setSender(myId);
         replyProcessor.process(response);
@@ -173,7 +173,7 @@ public class ShutdownAllRequest extends AdminRequest {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     boolean isToShutdown = hasCache();
     if (isToShutdown) {
       boolean isSuccess = false;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgRequest.java
index f05cf9d..b3c6fd3 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgRequest.java
@@ -50,7 +50,7 @@ public class StoreSysCfgRequest extends AdminRequest {
    * Must return a proper response to this request.
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return StoreSysCfgResponse.create(dm, this.getSender(), this.sc);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgResponse.java
index 6cbb08d..bf6c41a 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/StoreSysCfgResponse.java
@@ -35,8 +35,7 @@ public class StoreSysCfgResponse extends AdminResponse {
    * Returns a <code>StoreSysCfgResponse</code> that states that a given set of distribution
    * managers are known by <code>dm</code> to be started.
    */
-  public static StoreSysCfgResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Config sc) {
+  public static StoreSysCfgResponse create(DM dm, InternalDistributedMember recipient, Config sc) {
     StoreSysCfgResponse m = new StoreSysCfgResponse();
     m.setRecipient(recipient);
     InternalDistributedSystem sys = dm.getSystem();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionRequest.java
index 6641941..8f0e88e 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionRequest.java
@@ -42,9 +42,11 @@ public class SubRegionRequest extends RegionAdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return SubRegionResponse.create(dm, this.getSender(), this.getRegion(dm.getSystem()));
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionResponse.java
index 513a1fe..e049318 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/SubRegionResponse.java
@@ -37,8 +37,7 @@ public class SubRegionResponse extends AdminResponse {
    * Returns a <code>SubRegionResponse</code> that will be returned to the specified recipient. The
    * message will contains a copy of the local manager's system config.
    */
-  public static SubRegionResponse create(DistributionManager dm,
-      InternalDistributedMember recipient, Region r) {
+  public static SubRegionResponse create(DM dm, InternalDistributedMember recipient, Region r) {
     SubRegionResponse m = new SubRegionResponse();
     m.setRecipient(recipient);
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogRequest.java
index e79b99c..d911b08 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogRequest.java
@@ -28,7 +28,7 @@ public class TailLogRequest extends AdminRequest {
   }
 
   @Override
-  public AdminResponse createResponse(DistributionManager dm) {
+  public AdminResponse createResponse(DM dm) {
     return TailLogResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogResponse.java
index 137c8ba..6e7ee03 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/TailLogResponse.java
@@ -21,8 +21,8 @@ import java.io.*;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.DataSerializer;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.distributed.internal.DistributionManager;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.i18n.LocalizedStrings;
@@ -38,8 +38,7 @@ public class TailLogResponse extends AdminResponse {
   private String tail;
   private String childTail;
 
-  public static TailLogResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static TailLogResponse create(DM dm, InternalDistributedMember recipient) {
     TailLogResponse m = new TailLogResponse();
     m.setRecipient(recipient);
     try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoRequest.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoRequest.java
index db4fa42..25ff383 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoRequest.java
@@ -42,9 +42,11 @@ public class VersionInfoRequest extends AdminRequest {
 
   /**
    * Must return a proper response to this request.
+   *
+   * @param dm
    */
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     return VersionInfoResponse.create(dm, this.getSender());
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoResponse.java b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoResponse.java
index e8a87ed..f67f8e6 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/admin/remote/VersionInfoResponse.java
@@ -36,8 +36,7 @@ public class VersionInfoResponse extends AdminResponse {
   /**
    * Returns a <code>VersionInfoResponse</code> that will be returned to the specified recipient.
    */
-  public static VersionInfoResponse create(DistributionManager dm,
-      InternalDistributedMember recipient) {
+  public static VersionInfoResponse create(DM dm, InternalDistributedMember recipient) {
     VersionInfoResponse m = new VersionInfoResponse();
     m.setRecipient(recipient);
     m.verInfo = GemFireVersion.asString();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
index 5680472..94abc68 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/CreateRegionProcessor.java
@@ -344,7 +344,7 @@ public class CreateRegionProcessor implements ProfileExchangeProcessor {
         // get the region from the path, but do NOT wait on initialization,
         // otherwise we could have a distributed deadlock
 
-        InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
+        InternalCache cache = dm.getExistingCache();
 
         // Fix for bug 42051 - Discover any regions that are in the process
         // of being destroyed
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
index e923678..1e24588 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DestroyRegionOperation.java
@@ -166,7 +166,6 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
         public void run() {
           final int oldLevel =
               LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
-          // do this before CacheFactory.getInstance for bug 33471
 
           Throwable thr = null;
           try {
@@ -177,9 +176,8 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
               boolean waitForBucketInitializationToComplete = true;
               CacheDistributionAdvisee advisee = null;
               try {
-                advisee =
-                    PartitionedRegionHelper.getProxyBucketRegion(GemFireCacheImpl.getInstance(),
-                        regionPath, waitForBucketInitializationToComplete);
+                advisee = PartitionedRegionHelper.getProxyBucketRegion(dm.getCache(), regionPath,
+                    waitForBucketInitializationToComplete);
               } catch (PRLocallyDestroyedException ignore) {
                 // region not found - it's been destroyed
               } catch (RegionDestroyedException ignore) {
@@ -202,7 +200,7 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
             } // lclRegion == null
 
             // refetch to use special destroy region logic
-            final LocalRegion lr = getRegionFromPath(dm.getSystem(), lclRgn.getFullPath());
+            final LocalRegion lr = getRegionFromPath(dm, lclRgn.getFullPath());
             if (lr == null) {
               if (logger.isDebugEnabled())
                 logger.debug("{} region not found, nothing to do", this);
@@ -295,12 +293,12 @@ public class DestroyRegionOperation extends DistributedCacheOperation {
       }
     }
 
-    protected LocalRegion getRegionFromPath(InternalDistributedSystem sys, String path) {
+    protected LocalRegion getRegionFromPath(DistributionManager dm, String path) {
       // allow a destroyed region to be returned if we're dealing with a
       // shared region, since another cache may
       // have already destroyed it in shared memory, in which our listeners
       // still need to be called and java region object cleaned up.
-      InternalCache cache = (InternalCache) CacheFactory.getInstance(sys);
+      InternalCache cache = dm.getExistingCache();
 
       // only get the region while holding the appropriate destroy lock.
       // this prevents us from getting a "stale" region
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DirectoryHolder.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DirectoryHolder.java
index 16b3baf..335aa1a 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DirectoryHolder.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DirectoryHolder.java
@@ -91,7 +91,7 @@ public class DirectoryHolder {
     return dir;
   }
 
-  int getArrayIndex() {
+  public int getArrayIndex() {
     return this.index;
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java
index 9b005ff..b4428e8 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreBackup.java
@@ -19,8 +19,6 @@ import java.util.Arrays;
 import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.geode.internal.cache.persistence.BackupInspector;
-
 /**
  * This class manages the state of the backup of an individual disk store. It holds the list of
  * oplogs that still need to be backed up, along with the lists of oplog files that should be
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
index d09e70e..ce52220 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreFactoryImpl.java
@@ -21,6 +21,7 @@ import org.apache.geode.GemFireIOException;
 import org.apache.geode.cache.DiskStore;
 import org.apache.geode.cache.DiskStoreFactory;
 import org.apache.geode.distributed.internal.ResourceEvent;
+import org.apache.geode.internal.cache.backup.BackupManager;
 import org.apache.geode.internal.cache.xmlcache.CacheCreation;
 import org.apache.geode.internal.cache.xmlcache.CacheXml;
 import org.apache.geode.internal.cache.xmlcache.DiskStoreAttributesCreation;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java
index cc66ca7..3bf13ea 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DiskStoreImpl.java
@@ -80,6 +80,8 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.i18n.StringId;
 import org.apache.geode.internal.Version;
 import org.apache.geode.internal.cache.ExportDiskRegion.ExportWriter;
+import org.apache.geode.internal.cache.backup.BackupLock;
+import org.apache.geode.internal.cache.backup.BackupManager;
 import org.apache.geode.internal.cache.entries.DiskEntry;
 import org.apache.geode.internal.cache.entries.DiskEntry.Helper.ValueWrapper;
 import org.apache.geode.internal.cache.entries.DiskEntry.RecoveredEntry;
@@ -2027,7 +2029,7 @@ public class DiskStoreImpl implements DiskStore {
     return this.directories[this.infoFileDirIndex];
   }
 
-  int getInforFileDirIndex() {
+  public int getInforFileDirIndex() {
     return this.infoFileDirIndex;
   }
 
@@ -2694,7 +2696,7 @@ public class DiskStoreImpl implements DiskStore {
   /**
    * Get all of the oplogs
    */
-  Oplog[] getAllOplogsForBackup() {
+  public Oplog[] getAllOplogsForBackup() {
     return persistentOplogs.getAllOplogs();
   }
 
@@ -2939,7 +2941,7 @@ public class DiskStoreImpl implements DiskStore {
   public static class KillCompactorException extends RuntimeException {
   }
 
-  DiskInitFile getDiskInitFile() {
+  public DiskInitFile getDiskInitFile() {
     return this.initFile;
   }
 
@@ -4325,7 +4327,7 @@ public class DiskStoreImpl implements DiskStore {
    * Wait for any current operations in the delayed write pool. Completion of this method ensures
    * that the writes have completed or the pool was shutdown
    */
-  protected void waitForDelayedWrites() {
+  public void waitForDelayedWrites() {
     Future<?> lastWriteTask = lastDelayedWrite;
     if (lastWriteTask != null) {
       try {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
index fb29e11..505c618 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/DistributedCacheOperation.java
@@ -1063,7 +1063,7 @@ public abstract class DistributedCacheOperation {
 
     protected LocalRegion getLocalRegionForProcessing(DistributionManager dm) {
       Assert.assertTrue(this.regionPath != null, "regionPath was null");
-      InternalCache gfc = (InternalCache) CacheFactory.getInstance(dm.getSystem());
+      InternalCache gfc = dm.getExistingCache();
       return gfc.getRegionByPathForProcessing(this.regionPath);
     }
 
@@ -1078,7 +1078,6 @@ public abstract class DistributedCacheOperation {
 
       EntryLogger.setSource(this.getSender(), "p2p");
       boolean resetOldLevel = true;
-      // do this before CacheFactory.getInstance for bug 33471
       int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
       try {
         if (dm.getDMType() == DistributionManager.ADMIN_ONLY_DM_TYPE) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
index e8aac76..bbf79bf 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/GemFireCacheImpl.java
@@ -134,9 +134,7 @@ import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.cache.query.internal.DefaultQuery;
 import org.apache.geode.cache.query.internal.DefaultQueryService;
 import org.apache.geode.cache.query.internal.InternalQueryService;
-import org.apache.geode.cache.query.internal.MethodInvocationAuthorizer;
 import org.apache.geode.cache.query.internal.QueryMonitor;
-import org.apache.geode.cache.query.internal.RestrictedMethodInvocationAuthorizer;
 import org.apache.geode.cache.query.internal.cq.CqService;
 import org.apache.geode.cache.query.internal.cq.CqServiceProvider;
 import org.apache.geode.cache.server.CacheServer;
@@ -174,6 +172,7 @@ import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.internal.SystemTimer;
+import org.apache.geode.internal.cache.backup.BackupManager;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceType;
 import org.apache.geode.internal.cache.control.ResourceAdvisor;
@@ -676,7 +675,12 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
   /** Map of Futures used to track Regions that are being reinitialized */
   private final ConcurrentMap reinitializingRegions = new ConcurrentHashMap();
 
-  /** Returns the last created instance of GemFireCache */
+  /**
+   * Returns the last created instance of GemFireCache
+   *
+   * @deprecated use DM.getCache instead
+   */
+  @Deprecated
   public static GemFireCacheImpl getInstance() {
     return instance;
   }
@@ -695,7 +699,9 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
    *
    * @return the existing cache
    * @throws CacheClosedException if an existing cache can not be found.
+   * @deprecated use DM.getExistingCache instead.
    */
+  @Deprecated
   public static GemFireCacheImpl getExisting() {
     final GemFireCacheImpl result = instance;
     if (result != null && !result.isClosing) {
@@ -715,7 +721,9 @@ public class GemFireCacheImpl implements InternalCache, InternalClientCache, Has
    * @param reason the reason an existing cache is being requested.
    * @return the existing cache
    * @throws CacheClosedException if an existing cache can not be found.
+   * @deprecated use DM.getExistingCache instead.
    */
+  @Deprecated
   public static GemFireCacheImpl getExisting(String reason) {
     GemFireCacheImpl result = getInstance();
     if (result == null) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
index 58ab77d..9ec1fd0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/InternalCache.java
@@ -52,6 +52,7 @@ import org.apache.geode.distributed.internal.DistributionAdvisor;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.SystemTimer;
+import org.apache.geode.internal.cache.backup.BackupManager;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.control.ResourceAdvisor;
 import org.apache.geode.internal.cache.event.EventTrackerExpiryTask;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java b/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
index 9c3e52b..9b4ed10 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/Oplog.java
@@ -27,10 +27,8 @@ import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InterruptedIOException;
-import java.io.SyncFailedException;
 import java.nio.ByteBuffer;
 import java.nio.channels.ClosedChannelException;
-import java.nio.file.Files;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -55,7 +53,6 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
 import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
 import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
 import it.unimi.dsi.fastutil.objects.ObjectIterator;
-import org.apache.commons.io.FileUtils;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.CancelException;
@@ -84,6 +81,7 @@ import org.apache.geode.internal.cache.DiskInitFile.DiskRegionFlag;
 import org.apache.geode.internal.cache.DiskStoreImpl.OplogCompactor;
 import org.apache.geode.internal.cache.DiskStoreImpl.OplogEntryIdSet;
 import org.apache.geode.internal.cache.DistributedRegion.DiskPosition;
+import org.apache.geode.internal.cache.backup.BackupManager;
 import org.apache.geode.internal.cache.entries.DiskEntry;
 import org.apache.geode.internal.cache.entries.DiskEntry.Helper.Flushable;
 import org.apache.geode.internal.cache.entries.DiskEntry.Helper.ValueWrapper;
@@ -688,6 +686,10 @@ public class Oplog implements CompactableOplog, Flushable {
     }
   }
 
+  public Object getLock() {
+    return lock;
+  }
+
   public void replaceIncompatibleEntry(DiskRegionView dr, DiskEntry old, DiskEntry repl) {
     boolean useNextOplog = false;
     // No need to get the backup lock prior to synchronizing (correct lock order) since the
@@ -1173,11 +1175,11 @@ public class Oplog implements CompactableOplog, Flushable {
     }
   }
 
-  File getCrfFile() {
+  public File getCrfFile() {
     return this.crf.f;
   }
 
-  File getDrfFile() {
+  public File getDrfFile() {
     return this.drf.f;
   }
 
@@ -1187,7 +1189,7 @@ public class Oplog implements CompactableOplog, Flushable {
    *
    * @param oplogFileNames a Set of operation log file names.
    */
-  Set<String> gatherMatchingOplogFiles(Set<String> oplogFileNames) {
+  public Set<String> gatherMatchingOplogFiles(Set<String> oplogFileNames) {
     Set<String> matchingFiles = new HashSet<>();
 
     // CRF match?
@@ -1221,7 +1223,7 @@ public class Oplog implements CompactableOplog, Flushable {
    * @return a map of baslineline oplog files to copy. May be empty if total current set for this
    *         oplog does not match the baseline.
    */
-  Map<File, File> mapBaseline(Collection<File> baselineOplogFiles) {
+  public Map<File, File> mapBaseline(Collection<File> baselineOplogFiles) {
     // Map of baseline oplog file name to oplog file
     Map<String, File> baselineOplogMap =
         TransformUtils.transformAndMap(baselineOplogFiles, TransformUtils.fileNameTransformer);
@@ -4233,7 +4235,7 @@ public class Oplog implements CompactableOplog, Flushable {
     }
   }
 
-  File getKrfFile() {
+  public File getKrfFile() {
     return new File(this.diskFile.getPath() + KRF_FILE_EXT);
   }
 
@@ -5822,7 +5824,7 @@ public class Oplog implements CompactableOplog, Flushable {
     return this.crf.channel;
   }
 
-  DirectoryHolder getDirectoryHolder() {
+  public DirectoryHolder getDirectoryHolder() {
     return this.dirHolder;
   }
 
@@ -7751,7 +7753,7 @@ public class Oplog implements CompactableOplog, Flushable {
     }
   }
 
-  void finishKrf() {
+  public void finishKrf() {
     createKrf(false);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
index a4cf98a..33d03ba 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/PartitionedRegionDataStore.java
@@ -77,6 +77,7 @@ import org.apache.geode.internal.cache.BucketRegion.RawValue;
 import org.apache.geode.internal.cache.LocalRegion.RegionPerfStats;
 import org.apache.geode.internal.cache.PartitionedRegion.BucketLock;
 import org.apache.geode.internal.cache.PartitionedRegion.SizeEntry;
+import org.apache.geode.internal.cache.backup.BackupManager;
 import org.apache.geode.internal.cache.execute.BucketMovedException;
 import org.apache.geode.internal.cache.execute.FunctionStats;
 import org.apache.geode.internal.cache.execute.PartitionedRegionFunctionResultSender;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java
index b73f2af..76e3d2e 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/RemoteOperationMessage.java
@@ -167,7 +167,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
    * check to see if the cache is closing
    */
   public boolean checkCacheClosing(DistributionManager dm) {
-    InternalCache cache = GemFireCacheImpl.getInstance();
+    InternalCache cache = dm.getCache();
     return cache == null || cache.isClosed();
   }
 
@@ -307,7 +307,7 @@ public abstract class RemoteOperationMessage extends DistributionMessage
   }
 
   InternalCache getCache(final DistributionManager dm) {
-    return (InternalCache) CacheFactory.getInstance(dm.getSystem());
+    return dm.getExistingCache();
   }
 
   /**
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
index 552048c..f7e8506 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/SearchLoadAndWriteProcessor.java
@@ -1271,7 +1271,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
   }
 
   private int getSearchTimeout() {
-    return region.getCache().getSearchTimeout(); // CacheFactory.getInstance(((DistributedRegion)this.region).getSystem()).getSearchTimeout();
+    return region.getCache().getSearchTimeout();
   }
 
   private void resetResults() {
@@ -1504,7 +1504,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
       try {
         // check to see if we would have to wait on initialization latch (if global)
         // if so abort and reply with null
-        InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
+        InternalCache cache = dm.getExistingCache();
         if (cache.isGlobalRegionInitializing(this.regionName)) {
           replyWithNull(dm);
           if (logger.isDebugEnabled()) {
@@ -1513,8 +1513,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
           return;
         }
 
-        LocalRegion region =
-            (LocalRegion) CacheFactory.getInstance(dm.getSystem()).getRegion(this.regionName);
+        LocalRegion region = (LocalRegion) dm.getExistingCache().getRegion(this.regionName);
         Object o = null;
 
         if (region != null) {
@@ -1850,8 +1849,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
 
       int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
       try {
-        LocalRegion region =
-            (LocalRegion) CacheFactory.getInstance(dm.getSystem()).getRegion(this.regionName);
+        LocalRegion region = (LocalRegion) dm.getExistingCache().getRegion(this.regionName);
         if (region != null) {
           setClearCountReference(region);
           try {
@@ -2210,7 +2208,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
       long startTime = dm.cacheTimeMillis();
       int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
       try {
-        InternalCache gfc = (InternalCache) CacheFactory.getInstance(dm.getSystem());
+        InternalCache gfc = dm.getExistingCache();
         LocalRegion region = (LocalRegion) gfc.getRegion(this.regionName);
         if (region != null && region.isInitialized()
             && (dm.cacheTimeMillis() - startTime < timeoutMs)) {
@@ -2467,7 +2465,7 @@ public class SearchLoadAndWriteProcessor implements MembershipListener {
       long startTime = dm.cacheTimeMillis();
       int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
       try {
-        InternalCache gfc = (InternalCache) CacheFactory.getInstance(dm.getSystem());
+        InternalCache gfc = dm.getExistingCache();
         LocalRegion region = (LocalRegion) gfc.getRegion(this.regionName);
         if (region != null && region.isInitialized()
             && (dm.cacheTimeMillis() - startTime < timeoutMs)) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
index 6509dea..fc3f075 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/StateFlushOperation.java
@@ -311,11 +311,9 @@ public class StateFlushOperation {
       if (region != null) {
         return region;
       }
-      // set the init level requirement so that we don't hang in CacheFactory.getInstance() (bug
-      // 36175)
       int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
       try {
-        InternalCache gfc = (InternalCache) CacheFactory.getInstance(dm.getSystem());
+        InternalCache gfc = dm.getExistingCache();
         Region r = gfc.getRegionByPathForProcessing(this.regionPath);
         if (r instanceof DistributedRegion) {
           region = (DistributedRegion) r;
@@ -328,11 +326,9 @@ public class StateFlushOperation {
 
     /** returns a set of all DistributedRegions for allRegions processing */
     private Set<DistributedRegion> getAllRegions(DistributionManager dm) {
-      // set the init level requirement so that we don't hang in CacheFactory.getInstance() (bug
-      // 36175)
       int oldLevel = LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
       try {
-        InternalCache cache = (InternalCache) CacheFactory.getInstance(dm.getSystem());
+        InternalCache cache = dm.getExistingCache();
         Set<DistributedRegion> result = new HashSet();
         for (LocalRegion r : cache.getAllRegions()) {
           // it's important not to check if the cache is closing, so access
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java
index c927239..fb5b6c5 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/TXCommitMessage.java
@@ -598,14 +598,13 @@ public class TXCommitMessage extends PooledDistributionMessage
     if (logger.isDebugEnabled()) {
       logger.debug("begin processing TXCommitMessage for {}", this.txIdent);
     }
-    // do this before CacheFactory.getInstance for bug 33471
     final int oldLevel =
         LocalRegion.setThreadInitLevelRequirement(LocalRegion.BEFORE_INITIAL_IMAGE);
     boolean forceListener = false; // this gets flipped if we need to fire tx listener
     // it needs to default to false because we don't want to fire listeners on pr replicates
     try {
       TXRmtEvent txEvent = null;
-      final Cache cache = CacheFactory.getInstance(dm.getSystem());
+      final Cache cache = dm.getExistingCache();
       if (cache == null) {
         addProcessingException(new CacheClosedException());
         // return ... this cache is closed so we can't do anything.
@@ -1300,8 +1299,7 @@ public class TXCommitMessage extends PooledDistributionMessage
         PartitionedRegion pr = (PartitionedRegion) r;
         BucketRegion br = pr.getBucketRegion(entryOp.key);
         Set bucketOwners = br.getBucketOwners();
-        InternalDistributedMember thisMember =
-            GemFireCacheImpl.getExisting().getDistributionManager().getId();
+        InternalDistributedMember thisMember = this.r.getDistributionManager().getId();
         if (bucketOwners.contains(thisMember)) {
           return;
         }
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/BackupDataStoreHelper.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupDataStoreHelper.java
similarity index 70%
rename from geode-core/src/main/java/org/apache/geode/admin/internal/BackupDataStoreHelper.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupDataStoreHelper.java
index 551aaa1..d5d5386 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/BackupDataStoreHelper.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupDataStoreHelper.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.admin.internal;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.File;
 import java.util.Map;
@@ -26,25 +26,28 @@ import org.apache.geode.internal.Assert;
 
 public class BackupDataStoreHelper {
 
-  public static String LOCK_SERVICE_NAME = BackupDataStoreHelper.class.getSimpleName();
-
-  private static String LOCK_NAME = LOCK_SERVICE_NAME + "_token";
-
-  private static Object LOCK_SYNC = new Object();
+  public static final String LOCK_SERVICE_NAME = BackupDataStoreHelper.class.getSimpleName();
+  private static final String LOCK_NAME = LOCK_SERVICE_NAME + "_token";
+  private static final Object LOCK_SYNC = new Object();
+  private static final FlushToDiskFactory flushToDiskFactory = new FlushToDiskFactory();
+  private static final PrepareBackupFactory prepareBackupFactory = new PrepareBackupFactory();
+  private static final FinishBackupFactory finishBackupFactory = new FinishBackupFactory();
 
   @SuppressWarnings("rawtypes")
   public static BackupDataStoreResult backupAllMembers(DM dm, Set recipients, File targetDir,
       File baselineDir) {
-    FlushToDiskRequest.send(dm, recipients);
+    new FlushToDiskOperation(dm, dm.getId(), dm.getCache(), recipients, flushToDiskFactory).send();
 
     boolean abort = true;
     Map<DistributedMember, Set<PersistentID>> successfulMembers;
     Map<DistributedMember, Set<PersistentID>> existingDataStores;
     try {
-      existingDataStores = PrepareBackupRequest.send(dm, recipients);
+      existingDataStores = new PrepareBackupOperation(dm, dm.getId(), dm.getCache(), recipients,
+          prepareBackupFactory).send();
       abort = false;
     } finally {
-      successfulMembers = FinishBackupRequest.send(dm, recipients, targetDir, baselineDir, abort);
+      successfulMembers = new FinishBackupOperation(dm, dm.getId(), dm.getCache(), recipients,
+          targetDir, baselineDir, abort, finishBackupFactory).send();
     }
     return new BackupDataStoreResult(existingDataStores, successfulMembers);
   }
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/BackupDataStoreResult.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupDataStoreResult.java
similarity index 97%
rename from geode-core/src/main/java/org/apache/geode/admin/internal/BackupDataStoreResult.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupDataStoreResult.java
index eae674b..294c71a 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/BackupDataStoreResult.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupDataStoreResult.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.admin.internal;
+package org.apache.geode.internal.cache.backup;
 
 import java.util.Map;
 import java.util.Set;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupInspector.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupInspector.java
similarity index 99%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupInspector.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupInspector.java
index 8c707f8..80d9673 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/BackupInspector.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupInspector.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.BufferedReader;
 import java.io.File;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupLock.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupLock.java
similarity index 76%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/BackupLock.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupLock.java
index 1c130bf..29d6976 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupLock.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupLock.java
@@ -12,8 +12,9 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache;
+package org.apache.geode.internal.cache.backup;
 
+import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 
@@ -21,29 +22,29 @@ import java.util.concurrent.locks.ReentrantLock;
  * A lock used for the backup process. This is a reentrant lock that provides a "backup" mode, where
  * the lock is held by a "backup thread" which can be assigned later than the time we lock.
  *
- * We need this because our backup process is two phase. In the first phase we aquire the lock and
+ * <p>
+ * We need this because our backup process is two phase. In the first phase we acquire the lock and
  * in the second phase we actually do the backup. During the second phase we need to reenter the
  * lock and release it with a different thread.
- *
  */
 public class BackupLock extends ReentrantLock {
 
-  private final ThreadLocal<Boolean> isBackupThread = new ThreadLocal<Boolean>();
-  boolean isBackingUp;
-  Condition backupDone = super.newCondition();
+  private final ThreadLocal<Boolean> isBackupThread = new ThreadLocal<>();
+  private boolean isBackingUp;
+  private Condition backupDone = super.newCondition();
 
   // test hook
-  private BackupLockTestHook hook = null;
+  private final AtomicReference<BackupLockTestHook> hook = new AtomicReference<>();
 
   public interface BackupLockTestHook {
     /**
      * Test hook called before the wait for backup to complete
      */
-    public void beforeWaitForBackupCompletion();
+    void beforeWaitForBackupCompletion();
   }
 
   public void setBackupLockTestHook(BackupLockTestHook testHook) {
-    hook = testHook;
+    hook.set(testHook);
   }
 
   public void lockForBackup() {
@@ -52,23 +53,37 @@ public class BackupLock extends ReentrantLock {
     super.unlock();
   }
 
-  public void setBackupThread() {
+  void setBackupThread() {
     isBackupThread.set(true);
   }
 
   public void unlockForBackup() {
     super.lock();
     isBackingUp = false;
-    isBackupThread.set(false);
+    isBackupThread.remove();
     backupDone.signalAll();
     super.unlock();
   }
 
-  public boolean isCurrentThreadDoingBackup() {
+  boolean isCurrentThreadDoingBackup() {
     Boolean result = isBackupThread.get();
     return (result != null) && result;
   }
 
+  /**
+   * For testing only
+   */
+  boolean isBackingUp() {
+    return isBackingUp;
+  }
+
+  /**
+   * For testing only
+   */
+  boolean hasThreadLocal() {
+    return isBackupThread.get() != null;
+  }
+
   @Override
   public void unlock() {
     // The backup thread does not need to unlock this lock since it never gets the lock. It is the
@@ -80,7 +95,6 @@ public class BackupLock extends ReentrantLock {
 
   /**
    * Acquire this lock, waiting for a backup to finish the first phase.
-   *
    */
   @Override
   public void lock() {
@@ -89,8 +103,9 @@ public class BackupLock extends ReentrantLock {
     if (!isCurrentThreadDoingBackup()) {
       super.lock();
       while (isBackingUp) {
-        if (hook != null) {
-          hook.beforeWaitForBackupCompletion();
+        BackupLockTestHook testHook = hook.get();
+        if (testHook != null) {
+          testHook.beforeWaitForBackupCompletion();
         }
         backupDone.awaitUninterruptibly();
       }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupManager.java
similarity index 96%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/BackupManager.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupManager.java
index 70a4345..f773b21 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupManager.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.File;
 import java.io.FileOutputStream;
@@ -42,8 +42,12 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.internal.DeployedJar;
 import org.apache.geode.internal.JarDeployer;
-import org.apache.geode.internal.cache.persistence.BackupInspector;
-import org.apache.geode.internal.cache.persistence.RestoreScript;
+import org.apache.geode.internal.cache.DirectoryHolder;
+import org.apache.geode.internal.cache.DiskStoreBackup;
+import org.apache.geode.internal.cache.DiskStoreImpl;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.Oplog;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 
@@ -51,7 +55,7 @@ import org.apache.geode.internal.logging.LogService;
  * This class manages the state an logic to backup a single cache.
  */
 public class BackupManager implements MembershipListener {
-  private static final Logger logger = LogService.getLogger(BackupManager.class);
+  private static final Logger logger = LogService.getLogger();
 
   static final String INCOMPLETE_BACKUP_FILE = "INCOMPLETE_BACKUP_FILE";
 
@@ -311,7 +315,7 @@ public class BackupManager implements MembershipListener {
         }
 
         // Get an appropriate lock object for each set of oplogs.
-        Object childLock = childOplog.lock;
+        Object childLock = childOplog.getLock();
 
         // TODO - We really should move this lock into the disk store, but
         // until then we need to do this magic to make sure we're actually
@@ -354,18 +358,16 @@ public class BackupManager implements MembershipListener {
           diskStore.getPersistentOplogSet().forceRoll(null);
 
           if (logger.isDebugEnabled()) {
-            logger.debug("done snaphotting for disk store {}", diskStore.getName());
+            logger.debug("done backing up disk store {}", diskStore.getName());
           }
           break;
         }
       }
       done = true;
     } finally {
-      if (!done) {
-        if (backup != null) {
-          backupByDiskStore.remove(diskStore);
-          backup.cleanup();
-        }
+      if (!done && backup != null) {
+        backupByDiskStore.remove(diskStore);
+        backup.cleanup();
       }
     }
     return backup;
@@ -583,13 +585,14 @@ public class BackupManager implements MembershipListener {
   }
 
   private void backupFile(File targetDir, File file) throws IOException {
-    if (file != null && file.exists())
+    if (file != null && file.exists()) {
       try {
         Files.createLink(targetDir.toPath().resolve(file.getName()), file.toPath());
       } catch (IOException | UnsupportedOperationException e) {
         logger.warn("Unable to create hard link for + {}. Reverting to file copy", targetDir);
         FileUtils.copyFileToDirectory(file, targetDir);
       }
+    }
   }
 
   private String cleanSpecialCharacters(String string) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupOperation.java
new file mode 100644
index 0000000..dc5f77b
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupOperation.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.CancelException;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.logging.LogService;
+
+abstract class BackupOperation implements BackupResultCollector {
+  private static final Logger logger = LogService.getLogger();
+
+  private final DM dm;
+  private final Map<DistributedMember, Set<PersistentID>> results =
+      Collections.synchronizedMap(new HashMap<DistributedMember, Set<PersistentID>>());
+
+  protected BackupOperation(DM dm) {
+    this.dm = dm;
+  }
+
+  abstract ReplyProcessor21 createReplyProcessor();
+
+  abstract DistributionMessage createDistributionMessage(ReplyProcessor21 replyProcessor);
+
+  abstract void processLocally();
+
+  Map<DistributedMember, Set<PersistentID>> send() {
+    ReplyProcessor21 replyProcessor = createReplyProcessor();
+
+    dm.putOutgoing(createDistributionMessage(replyProcessor));
+
+    processLocally();
+
+    try {
+      replyProcessor.waitForReplies();
+    } catch (ReplyException e) {
+      if (!(e.getCause() instanceof CancelException)) {
+        throw e;
+      }
+    } catch (InterruptedException e) {
+      logger.warn(e.getMessage(), e);
+    }
+
+    return getResults();
+  }
+
+  @Override
+  public void addToResults(InternalDistributedMember member, Set<PersistentID> persistentIds) {
+    if (persistentIds != null && !persistentIds.isEmpty()) {
+      results.put(member, persistentIds);
+    }
+  }
+
+  Map<DistributedMember, Set<PersistentID>> getResults() {
+    return this.results;
+  }
+
+  protected DM getDistributionManager() {
+    return this.dm;
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupReplyProcessor.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupReplyProcessor.java
new file mode 100644
index 0000000..c42bfcc
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupReplyProcessor.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.util.Set;
+
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
+
+class BackupReplyProcessor extends AdminMultipleReplyProcessor {
+
+  private final BackupResultCollector resultCollector;
+
+  BackupReplyProcessor(BackupResultCollector resultCollector, DM dm,
+      Set<InternalDistributedMember> recipients) {
+    super(dm, recipients);
+    this.resultCollector = resultCollector;
+  }
+
+  @Override
+  protected boolean stopBecauseOfExceptions() {
+    return false;
+  }
+
+  @Override
+  protected int getAckWaitThreshold() {
+    // Disable the 15 second warning if the backup is taking a long time
+    return 0;
+  }
+
+  @Override
+  public long getAckSevereAlertThresholdMS() {
+    // Don't log severe alerts for backups either
+    return Long.MAX_VALUE;
+  }
+
+  @Override
+  protected void process(DistributionMessage message, boolean warn) {
+    if (message instanceof BackupResponse) {
+      BackupResponse response = (BackupResponse) message;
+      resultCollector.addToResults(response.getSender(), response.getPersistentIds());
+    }
+    super.process(message, warn);
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupResponse.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupResponse.java
similarity index 75%
rename from geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupResponse.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupResponse.java
index 745e3ed..9f9243e 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/PrepareBackupResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupResponse.java
@@ -12,12 +12,13 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.admin.internal;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.DataInput;
 import java.io.DataOutput;
 import java.io.IOException;
 import java.util.HashSet;
+import java.util.Set;
 
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.persistence.PersistentID;
@@ -25,25 +26,22 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.internal.admin.remote.AdminResponse;
 
 /**
- * The response to the {@link PrepareBackupRequest}
- *
- *
+ * The response to a {@link PrepareBackupRequest} or {@link FinishBackupRequest}.
  */
-public class PrepareBackupResponse extends AdminResponse {
+public class BackupResponse extends AdminResponse {
 
   private HashSet<PersistentID> persistentIds;
 
-  public PrepareBackupResponse() {
+  public BackupResponse() {
     super();
   }
 
-  public PrepareBackupResponse(InternalDistributedMember sender,
-      HashSet<PersistentID> persistentIds) {
-    this.setRecipient(sender);
+  public BackupResponse(InternalDistributedMember sender, HashSet<PersistentID> persistentIds) {
+    setRecipient(sender);
     this.persistentIds = persistentIds;
   }
 
-  public HashSet<PersistentID> getPersistentIds() {
+  public Set<PersistentID> getPersistentIds() {
     return persistentIds;
   }
 
@@ -53,24 +51,15 @@ public class PrepareBackupResponse extends AdminResponse {
     persistentIds = DataSerializer.readHashSet(in);
   }
 
-
-
   @Override
   public void toData(DataOutput out) throws IOException {
     super.toData(out);
     DataSerializer.writeHashSet(persistentIds, out);
   }
 
-
-
   @Override
-  protected Object clone() throws CloneNotSupportedException {
-    // TODO Auto-generated method stub
-    return super.clone();
-  }
-
   public int getDSFID() {
-    return PREPARE_BACKUP_RESPONSE;
+    return BACKUP_RESPONSE;
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupResultCollector.java
similarity index 67%
copy from geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
copy to geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupResultCollector.java
index 361cf63..d4ab322 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupResultCollector.java
@@ -12,21 +12,13 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.management.internal.cli.functions;
+package org.apache.geode.internal.cache.backup;
 
-import java.io.Serializable;
+import java.util.Set;
 
-public class GatewaySenderDestroyFunctionArgs implements Serializable {
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 
-  private static final long serialVersionUID = 3848480256348119530L;
-  private String id;
-
-
-  public GatewaySenderDestroyFunctionArgs(String id) {
-    this.id = id;
-  }
-
-  public String getId() {
-    return id;
-  }
+interface BackupResultCollector {
+  void addToResults(InternalDistributedMember member, Set<PersistentID> persistentIds);
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupUtil.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupUtil.java
similarity index 94%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/BackupUtil.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupUtil.java
index e9ae635..264879d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/BackupUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/BackupUtil.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.File;
 import java.text.SimpleDateFormat;
@@ -20,8 +20,6 @@ import java.util.Date;
 import java.util.Set;
 
 import org.apache.geode.admin.internal.AdminDistributedSystemImpl;
-import org.apache.geode.admin.internal.BackupDataStoreHelper;
-import org.apache.geode.admin.internal.BackupDataStoreResult;
 import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.internal.i18n.LocalizedStrings;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackup.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackup.java
new file mode 100644
index 0000000..f9d5813
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackup.java
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.internal.cache.InternalCache;
+
+class FinishBackup {
+
+  private final InternalCache cache;
+  private final File targetDir;
+  private final File baselineDir;
+  private final boolean abort;
+
+  FinishBackup(InternalCache cache, File targetDir, File baselineDir, boolean abort) {
+    this.cache = cache;
+    this.targetDir = targetDir;
+    this.baselineDir = baselineDir;
+    this.abort = abort;
+  }
+
+  HashSet<PersistentID> run() throws IOException {
+    HashSet<PersistentID> persistentIds;
+    if (cache == null || cache.getBackupManager() == null) {
+      persistentIds = new HashSet<>();
+    } else {
+      persistentIds = cache.getBackupManager().doBackup(targetDir, baselineDir, abort);
+    }
+    return persistentIds;
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupFactory.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupFactory.java
new file mode 100644
index 0000000..b4b40d9
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupFactory.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+
+class FinishBackupFactory {
+
+  BackupReplyProcessor createReplyProcessor(BackupResultCollector resultCollector, DM dm,
+      Set<InternalDistributedMember> recipients) {
+    return new BackupReplyProcessor(resultCollector, dm, recipients);
+  }
+
+  FinishBackupRequest createRequest(InternalDistributedMember sender,
+      Set<InternalDistributedMember> recipients, int processorId, File targetDir, File baselineDir,
+      boolean abort) {
+    return new FinishBackupRequest(sender, recipients, processorId, targetDir, baselineDir, abort,
+        this);
+  }
+
+  FinishBackup createFinishBackup(InternalCache cache, File targetDir, File baselineDir,
+      boolean abort) {
+    return new FinishBackup(cache, targetDir, baselineDir, abort);
+  }
+
+  BackupResponse createBackupResponse(InternalDistributedMember sender,
+      HashSet<PersistentID> persistentIds) {
+    return new BackupResponse(sender, persistentIds);
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupOperation.java
new file mode 100644
index 0000000..468dba8
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupOperation.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogService;
+
+class FinishBackupOperation extends BackupOperation {
+  private static final Logger logger = LogService.getLogger();
+
+  private final InternalDistributedMember member;
+  private final InternalCache cache;
+  private final Set<InternalDistributedMember> recipients;
+  private final File targetDir;
+  private final File baselineDir;
+  private final boolean abort;
+  private final FinishBackupFactory finishBackupFactory;
+
+  FinishBackupOperation(DM dm, InternalDistributedMember member, InternalCache cache,
+      Set<InternalDistributedMember> recipients, File targetDir, File baselineDir, boolean abort,
+      FinishBackupFactory FinishBackupFactory) {
+    super(dm);
+    this.member = member;
+    this.cache = cache;
+    this.recipients = recipients;
+    this.targetDir = targetDir;
+    this.baselineDir = baselineDir;
+    this.abort = abort;
+    this.finishBackupFactory = FinishBackupFactory;
+  }
+
+  @Override
+  ReplyProcessor21 createReplyProcessor() {
+    return finishBackupFactory.createReplyProcessor(this, getDistributionManager(), recipients);
+  }
+
+  @Override
+  DistributionMessage createDistributionMessage(ReplyProcessor21 replyProcessor) {
+    return finishBackupFactory.createRequest(member, recipients, replyProcessor.getProcessorId(),
+        targetDir, baselineDir, abort);
+  }
+
+  @Override
+  void processLocally() {
+    try {
+      addToResults(member,
+          finishBackupFactory.createFinishBackup(cache, targetDir, baselineDir, abort).run());
+    } catch (IOException e) {
+      logger.fatal("Failed to FinishBackup in " + member, e);
+    }
+  }
+
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupRequest.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupRequest.java
new file mode 100644
index 0000000..32cc12a
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FinishBackupRequest.java
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.DataSerializer;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminFailureResponse;
+import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.admin.remote.CliLegacyMessage;
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.log4j.LocalizedMessage;
+
+/**
+ * A request send from an admin VM to all of the peers to indicate that that should complete the
+ * backup operation.
+ */
+public class FinishBackupRequest extends CliLegacyMessage {
+  private static final Logger logger = LogService.getLogger();
+
+  private final transient FinishBackupFactory finishBackupFactory;
+
+  private File targetDir;
+  private File baselineDir;
+  private boolean abort;
+
+  public FinishBackupRequest() {
+    this.finishBackupFactory = new FinishBackupFactory();
+  }
+
+  FinishBackupRequest(InternalDistributedMember sender, Set<InternalDistributedMember> recipients,
+      int processorId, File targetDir, File baselineDir, boolean abort,
+      FinishBackupFactory finishBackupFactory) {
+    setSender(sender);
+    setRecipients(recipients);
+    this.msgId = processorId;
+    this.finishBackupFactory = finishBackupFactory;
+    this.targetDir = targetDir;
+    this.baselineDir = baselineDir;
+    this.abort = abort;
+  }
+
+  @Override
+  protected AdminResponse createResponse(DM dm) {
+    HashSet<PersistentID> persistentIds;
+    try {
+      persistentIds = finishBackupFactory
+          .createFinishBackup(dm.getCache(), this.targetDir, this.baselineDir, this.abort).run();
+    } catch (IOException e) {
+      logger.error(LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, getClass()), e);
+      return AdminFailureResponse.create(getSender(), e);
+    }
+    return finishBackupFactory.createBackupResponse(getSender(), persistentIds);
+  }
+
+  @Override
+  public int getDSFID() {
+    return FINISH_BACKUP_REQUEST;
+  }
+
+  @Override
+  public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+    super.fromData(in);
+    targetDir = DataSerializer.readFile(in);
+    baselineDir = DataSerializer.readFile(in);
+    abort = DataSerializer.readBoolean(in);
+  }
+
+  @Override
+  public void toData(DataOutput out) throws IOException {
+    super.toData(out);
+    DataSerializer.writeFile(targetDir, out);
+    DataSerializer.writeFile(baselineDir, out);
+    DataSerializer.writeBoolean(abort, out);
+  }
+
+}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDisk.java
similarity index 67%
copy from geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
copy to geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDisk.java
index 361cf63..8149d34 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDisk.java
@@ -12,21 +12,22 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.management.internal.cli.functions;
+package org.apache.geode.internal.cache.backup;
 
-import java.io.Serializable;
+import org.apache.geode.cache.DiskStore;
+import org.apache.geode.internal.cache.InternalCache;
 
-public class GatewaySenderDestroyFunctionArgs implements Serializable {
+class FlushToDisk {
 
-  private static final long serialVersionUID = 3848480256348119530L;
-  private String id;
+  private final InternalCache cache;
 
-
-  public GatewaySenderDestroyFunctionArgs(String id) {
-    this.id = id;
+  FlushToDisk(InternalCache cache) {
+    this.cache = cache;
   }
 
-  public String getId() {
-    return id;
+  void run() {
+    if (cache != null) {
+      cache.listDiskStoresIncludingRegionOwned().forEach(DiskStore::flush);
+    }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskFactory.java
similarity index 51%
copy from geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java
copy to geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskFactory.java
index a85a6aa..9d91997 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskFactory.java
@@ -12,32 +12,33 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.admin.internal;
+package org.apache.geode.internal.cache.backup;
 
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.cache.InternalCache;
 
-/**
- * The response to the {@link FlushToDiskRequest}
- *
- *
- */
-public class FlushToDiskResponse extends AdminResponse {
+class FlushToDiskFactory {
 
-  public FlushToDiskResponse() {
-    super();
+  FlushToDiskProcessor createReplyProcessor(DM dm, Set<InternalDistributedMember> recipients) {
+    return new FlushToDiskProcessor(dm, recipients);
   }
 
-  public FlushToDiskResponse(InternalDistributedMember sender) {
-    this.setRecipient(sender);
+  FlushToDiskRequest createRequest(InternalDistributedMember sender,
+      Set<InternalDistributedMember> recipients, int processorId) {
+    return new FlushToDiskRequest(sender, recipients, processorId, this);
   }
 
-  public int getDSFID() {
-    return FLUSH_TO_DISK_RESPONSE;
+  FlushToDisk createFlushToDisk(InternalCache cache) {
+    return new FlushToDisk(cache);
   }
 
-  @Override
-  public String toString() {
-    return getClass().getName();
+  FlushToDiskResponse createResponse(InternalDistributedMember sender) {
+    return new FlushToDiskResponse(sender);
   }
+
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskOperation.java
new file mode 100644
index 0000000..afeda08
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskOperation.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.CancelException;
+import org.apache.geode.cache.DiskStore;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.admin.remote.CliLegacyMessage;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogService;
+
+/**
+ * A Operation to from an admin VM to all non admin members to start a backup. In the prepare phase
+ * of the backup, the members will suspend bucket destroys to make sure buckets aren't missed during
+ * the backup.
+ */
+public class FlushToDiskOperation {
+  private static final Logger logger = LogService.getLogger();
+
+  private final DM dm;
+  private final InternalDistributedMember member;
+  private final InternalCache cache;
+  private final Set<InternalDistributedMember> recipients;
+  private final FlushToDiskFactory flushToDiskFactory;
+
+  FlushToDiskOperation(DM dm, InternalDistributedMember member, InternalCache cache,
+      Set<InternalDistributedMember> recipients, FlushToDiskFactory flushToDiskFactory) {
+    this.flushToDiskFactory = flushToDiskFactory;
+    this.dm = dm;
+    this.member = member;
+    this.recipients = recipients;
+    this.cache = cache;
+  }
+
+  void send() {
+    ReplyProcessor21 replyProcessor = createReplyProcessor();
+
+    dm.putOutgoing(createDistributionMessage(replyProcessor));
+
+    processLocally();
+
+    try {
+      replyProcessor.waitForReplies();
+    } catch (ReplyException e) {
+      if (!(e.getCause() instanceof CancelException)) {
+        throw e;
+      }
+    } catch (InterruptedException e) {
+      logger.warn(e.getMessage(), e);
+    }
+  }
+
+  private ReplyProcessor21 createReplyProcessor() {
+    return this.flushToDiskFactory.createReplyProcessor(dm, recipients);
+  }
+
+  private DistributionMessage createDistributionMessage(ReplyProcessor21 replyProcessor) {
+    return this.flushToDiskFactory.createRequest(member, recipients,
+        replyProcessor.getProcessorId());
+  }
+
+  private void processLocally() {
+    flushToDiskFactory.createFlushToDisk(cache).run();
+  }
+
+}
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskProcessor.java
similarity index 57%
copy from geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java
copy to geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskProcessor.java
index a85a6aa..0839ccc 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskProcessor.java
@@ -12,32 +12,27 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.admin.internal;
+package org.apache.geode.internal.cache.backup;
 
-import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.admin.remote.AdminResponse;
+import java.util.Collection;
 
-/**
- * The response to the {@link FlushToDiskRequest}
- *
- *
- */
-public class FlushToDiskResponse extends AdminResponse {
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.internal.admin.remote.AdminMultipleReplyProcessor;
 
-  public FlushToDiskResponse() {
-    super();
-  }
+class FlushToDiskProcessor extends AdminMultipleReplyProcessor {
 
-  public FlushToDiskResponse(InternalDistributedMember sender) {
-    this.setRecipient(sender);
+  FlushToDiskProcessor(DM dm, Collection initMembers) {
+    super(dm, initMembers);
   }
 
-  public int getDSFID() {
-    return FLUSH_TO_DISK_RESPONSE;
+  @Override
+  protected boolean stopBecauseOfExceptions() {
+    return false;
   }
 
   @Override
-  public String toString() {
-    return getClass().getName();
+  protected void process(DistributionMessage message, boolean warn) {
+    super.process(message, warn);
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskRequest.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskRequest.java
new file mode 100644
index 0000000..f421447
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskRequest.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.util.Set;
+
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.admin.remote.CliLegacyMessage;
+
+/**
+ * A request to from an admin VM to all non admin members to start a backup. In the prepare phase of
+ * the backup, the members will suspend bucket destroys to make sure buckets aren't missed during
+ * the backup.
+ */
+public class FlushToDiskRequest extends CliLegacyMessage {
+
+  private final FlushToDiskFactory flushToDiskFactory;
+
+  public FlushToDiskRequest() {
+    super();
+    this.flushToDiskFactory = new FlushToDiskFactory();
+  }
+
+  FlushToDiskRequest(InternalDistributedMember sender, Set<InternalDistributedMember> recipients,
+      int processorId, FlushToDiskFactory flushToDiskFactory) {
+    this.setSender(sender);
+    setRecipients(recipients);
+    this.msgId = processorId;
+    this.flushToDiskFactory = flushToDiskFactory;
+  }
+
+  @Override
+  public int getDSFID() {
+    return FLUSH_TO_DISK_REQUEST;
+  }
+
+  @Override
+  protected AdminResponse createResponse(DM dm) {
+    flushToDiskFactory.createFlushToDisk(dm.getCache()).run();
+    return flushToDiskFactory.createResponse(getSender());
+  }
+
+}
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskResponse.java
similarity index 96%
copy from geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java
copy to geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskResponse.java
index a85a6aa..89b1b71 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/FlushToDiskResponse.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.admin.internal;
+package org.apache.geode.internal.cache.backup;
 
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
 import org.apache.geode.internal.admin.remote.AdminResponse;
diff --git a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackup.java
similarity index 55%
rename from geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackup.java
index a85a6aa..de71173 100644
--- a/geode-core/src/main/java/org/apache/geode/admin/internal/FlushToDiskResponse.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackup.java
@@ -12,32 +12,33 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.admin.internal;
+package org.apache.geode.internal.cache.backup;
 
+import java.io.IOException;
+import java.util.HashSet;
+
+import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.cache.InternalCache;
 
-/**
- * The response to the {@link FlushToDiskRequest}
- *
- *
- */
-public class FlushToDiskResponse extends AdminResponse {
+class PrepareBackup {
 
-  public FlushToDiskResponse() {
-    super();
-  }
+  private final InternalDistributedMember member;
+  private final InternalCache cache;
 
-  public FlushToDiskResponse(InternalDistributedMember sender) {
-    this.setRecipient(sender);
+  PrepareBackup(InternalDistributedMember member, InternalCache cache) {
+    this.member = member;
+    this.cache = cache;
   }
 
-  public int getDSFID() {
-    return FLUSH_TO_DISK_RESPONSE;
+  HashSet<PersistentID> run() throws IOException {
+    HashSet<PersistentID> persistentIds;
+    if (cache == null) {
+      persistentIds = new HashSet<>();
+    } else {
+      persistentIds = cache.startBackup(member).prepareForBackup();
+    }
+    return persistentIds;
   }
 
-  @Override
-  public String toString() {
-    return getClass().getName();
-  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupFactory.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupFactory.java
new file mode 100644
index 0000000..eebc439
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupFactory.java
@@ -0,0 +1,45 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+
+class PrepareBackupFactory {
+
+  BackupReplyProcessor createReplyProcessor(BackupResultCollector resultCollector, DM dm,
+      Set<InternalDistributedMember> recipients) {
+    return new BackupReplyProcessor(resultCollector, dm, recipients);
+  }
+
+  PrepareBackupRequest createRequest(InternalDistributedMember sender,
+      Set<InternalDistributedMember> recipients, int processorId) {
+    return new PrepareBackupRequest(sender, recipients, processorId, this);
+  }
+
+  PrepareBackup createPrepareBackup(InternalDistributedMember member, InternalCache cache) {
+    return new PrepareBackup(member, cache);
+  }
+
+  BackupResponse createBackupResponse(InternalDistributedMember sender,
+      HashSet<PersistentID> persistentIds) {
+    return new BackupResponse(sender, persistentIds);
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupOperation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupOperation.java
new file mode 100644
index 0000000..b9d377c
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupOperation.java
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.ReplyProcessor21;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.logging.LogService;
+
+class PrepareBackupOperation extends BackupOperation {
+  private static final Logger logger = LogService.getLogger();
+
+  private final InternalDistributedMember member;
+  private final InternalCache cache;
+  private final Set<InternalDistributedMember> recipients;
+  private final PrepareBackupFactory prepareBackupFactory;
+
+  PrepareBackupOperation(DM dm, InternalDistributedMember member, InternalCache cache,
+      Set<InternalDistributedMember> recipients, PrepareBackupFactory prepareBackupFactory) {
+    super(dm);
+    this.member = member;
+    this.cache = cache;
+    this.recipients = recipients;
+    this.prepareBackupFactory = prepareBackupFactory;
+  }
+
+  @Override
+  ReplyProcessor21 createReplyProcessor() {
+    return prepareBackupFactory.createReplyProcessor(this, getDistributionManager(), recipients);
+  }
+
+  @Override
+  DistributionMessage createDistributionMessage(ReplyProcessor21 replyProcessor) {
+    return prepareBackupFactory.createRequest(member, recipients, replyProcessor.getProcessorId());
+  }
+
+  @Override
+  void processLocally() {
+    try {
+      addToResults(member, prepareBackupFactory.createPrepareBackup(member, cache).run());
+    } catch (IOException e) {
+      logger.fatal("Failed to PrepareBackup in " + member, e);
+    }
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupRequest.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupRequest.java
new file mode 100644
index 0000000..ccbf1d1
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/PrepareBackupRequest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminFailureResponse;
+import org.apache.geode.internal.admin.remote.AdminResponse;
+import org.apache.geode.internal.admin.remote.CliLegacyMessage;
+import org.apache.geode.internal.i18n.LocalizedStrings;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.internal.logging.log4j.LocalizedMessage;
+
+/**
+ * A request to from an admin VM to all non admin members to start a backup. In the prepare phase of
+ * the backup, the members will suspend bucket destroys to make sure buckets aren't missed during
+ * the backup.
+ */
+public class PrepareBackupRequest extends CliLegacyMessage {
+  private static final Logger logger = LogService.getLogger();
+
+  private final transient PrepareBackupFactory prepareBackupFactory;
+
+  public PrepareBackupRequest() {
+    this.prepareBackupFactory = new PrepareBackupFactory();
+  }
+
+  PrepareBackupRequest(InternalDistributedMember sender, Set<InternalDistributedMember> recipients,
+      int msgId, PrepareBackupFactory prepareBackupFactory) {
+    setSender(sender);
+    setRecipients(recipients);
+    this.msgId = msgId;
+    this.prepareBackupFactory = prepareBackupFactory;
+  }
+
+  @Override
+  protected AdminResponse createResponse(DM dm) {
+    HashSet<PersistentID> persistentIds;
+    try {
+      persistentIds = prepareBackupFactory
+          .createPrepareBackup(dm.getDistributionManagerId(), dm.getCache()).run();
+    } catch (IOException e) {
+      logger.error(LocalizedMessage.create(LocalizedStrings.CliLegacyMessage_ERROR, getClass()), e);
+      return AdminFailureResponse.create(getSender(), e);
+    }
+    return prepareBackupFactory.createBackupResponse(getSender(), persistentIds);
+  }
+
+  @Override
+  public int getDSFID() {
+    return PREPARE_BACKUP_REQUEST;
+  }
+
+}
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/RestoreScript.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/RestoreScript.java
similarity index 99%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/persistence/RestoreScript.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/RestoreScript.java
index a3bd455..cd9d160 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/RestoreScript.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/RestoreScript.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.BufferedWriter;
 import java.io.File;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/ScriptGenerator.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/ScriptGenerator.java
similarity index 96%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/persistence/ScriptGenerator.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/ScriptGenerator.java
index 286caa1..7804d13 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/ScriptGenerator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/ScriptGenerator.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.BufferedWriter;
 import java.io.File;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/UnixBackupInspector.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/UnixBackupInspector.java
similarity index 97%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/persistence/UnixBackupInspector.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/UnixBackupInspector.java
index 2e0921b..cc14cb4 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/UnixBackupInspector.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/UnixBackupInspector.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.BufferedReader;
 import java.io.File;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/UnixScriptGenerator.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/UnixScriptGenerator.java
similarity index 93%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/persistence/UnixScriptGenerator.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/UnixScriptGenerator.java
index a7969e1..ee9a53d 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/UnixScriptGenerator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/UnixScriptGenerator.java
@@ -12,12 +12,15 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.IOException;
 
+import org.apache.geode.internal.cache.backup.RestoreScript;
+import org.apache.geode.internal.cache.backup.ScriptGenerator;
+
 class UnixScriptGenerator implements ScriptGenerator {
 
   private static final String SCRIPT_FILE_NAME = "restore.sh";
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/WindowsBackupInspector.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/WindowsBackupInspector.java
similarity index 98%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/persistence/WindowsBackupInspector.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/WindowsBackupInspector.java
index 13d4959..2d5adf7 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/WindowsBackupInspector.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/WindowsBackupInspector.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.BufferedReader;
 import java.io.File;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/WindowsScriptGenerator.java b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/WindowsScriptGenerator.java
similarity index 97%
rename from geode-core/src/main/java/org/apache/geode/internal/cache/persistence/WindowsScriptGenerator.java
rename to geode-core/src/main/java/org/apache/geode/internal/cache/backup/WindowsScriptGenerator.java
index 5327ae0..7f35691 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/WindowsScriptGenerator.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/backup/WindowsScriptGenerator.java
@@ -12,12 +12,11 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.IOException;
-import java.io.PrintWriter;
 
 class WindowsScriptGenerator implements ScriptGenerator {
 
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipFlushRequest.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipFlushRequest.java
index 2a30856..25980d9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipFlushRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipFlushRequest.java
@@ -73,7 +73,7 @@ public class MembershipFlushRequest extends PooledDistributionMessage implements
       // get the region from the path, but do NOT wait on initialization,
       // otherwise we could have a distributed deadlock
 
-      Cache cache = CacheFactory.getInstance(dm.getSystem());
+      Cache cache = dm.getExistingCache();
       PartitionedRegion region = (PartitionedRegion) cache.getRegion(this.regionPath);
       if (region != null && region.getRegionAdvisor().isInitialized()) {
         ProxyBucketRegion[] proxyBuckets = region.getRegionAdvisor().getProxyBucketArray();
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipViewRequest.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipViewRequest.java
index 420d256..82dc815 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipViewRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/MembershipViewRequest.java
@@ -108,7 +108,7 @@ public class MembershipViewRequest extends DistributionMessage implements Messag
       // get the region from the path, but do NOT wait on initialization,
       // otherwise we could have a distributed deadlock
 
-      Cache cache = CacheFactory.getInstance(dm.getSystem());
+      Cache cache = dm.getExistingCache();
       Region region = cache.getRegion(this.regionPath);
       PersistenceAdvisor persistenceAdvisor = null;
       if (region instanceof DistributedRegion) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentMemberManager.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentMemberManager.java
index e0f6173..34b1ecb 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentMemberManager.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentMemberManager.java
@@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.logging.log4j.Logger;
 
 import org.apache.geode.cache.persistence.RevokedPersistentDataException;
-import org.apache.geode.distributed.internal.DistributionManager;
+import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.MembershipListener;
 import org.apache.geode.distributed.internal.ProfileListener;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
@@ -164,7 +164,7 @@ public class PersistentMemberManager {
    * @return true if this member is not currently running the chosen disk store. false if the revoke
    *         should be aborted because the disk store is already running.
    */
-  public boolean prepareRevoke(PersistentMemberPattern pattern, DistributionManager dm,
+  public boolean prepareRevoke(PersistentMemberPattern pattern, DM dm,
       InternalDistributedMember sender) {
     if (logger.isDebugEnabled()) {
       logger.debug("Preparing revoke if pattern {}", pattern);
@@ -232,10 +232,10 @@ public class PersistentMemberManager {
   public class PendingRevokeListener implements MembershipListener {
     InternalDistributedMember sender;
     private PersistentMemberPattern pattern;
-    private DistributionManager dm;
+    private DM dm;
 
     public PendingRevokeListener(PersistentMemberPattern pattern, InternalDistributedMember sender,
-        DistributionManager dm) {
+        DM dm) {
       this.dm = dm;
       this.pattern = pattern;
       this.sender = sender;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentStateQueryMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentStateQueryMessage.java
index 018325d..e87fd46 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentStateQueryMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PersistentStateQueryMessage.java
@@ -101,7 +101,7 @@ public class PersistentStateQueryMessage extends HighPriorityDistributionMessage
       // get the region from the path, but do NOT wait on initialization,
       // otherwise we could have a distributed deadlock
 
-      Cache cache = CacheFactory.getInstance(dm.getSystem());
+      Cache cache = dm.getExistingCache();
       Region region = cache.getRegion(this.regionPath);
       PersistenceAdvisor persistenceAdvisor = null;
       if (region instanceof DistributedRegion) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PrepareNewPersistentMemberMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PrepareNewPersistentMemberMessage.java
index 5029bb0..f0385d9 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PrepareNewPersistentMemberMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/PrepareNewPersistentMemberMessage.java
@@ -91,7 +91,7 @@ public class PrepareNewPersistentMemberMessage extends HighPriorityDistributionM
       // get the region from the path, but do NOT wait on initialization,
       // otherwise we could have a distributed deadlock
 
-      Cache cache = CacheFactory.getInstance(dm.getSystem());
+      Cache cache = dm.getExistingCache();
       Region region = cache.getRegion(this.regionPath);
       PersistenceAdvisor persistenceAdvisor = null;
       if (region instanceof DistributedRegion) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/RemovePersistentMemberMessage.java b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/RemovePersistentMemberMessage.java
index a035c74..0d67ca0 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/RemovePersistentMemberMessage.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/persistence/RemovePersistentMemberMessage.java
@@ -95,7 +95,7 @@ public class RemovePersistentMemberMessage extends HighPriorityDistributionMessa
       // get the region from the path, but do NOT wait on initialization,
       // otherwise we could have a distributed deadlock
 
-      Cache cache = CacheFactory.getInstance(dm.getSystem());
+      Cache cache = dm.getExistingCache();
       Region region = cache.getRegion(this.regionPath);
       PersistenceAdvisor persistenceAdvisor = null;
       if (region instanceof DistributedRegion) {
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
index 0394f65..fee23ae 100644
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/CacheClientProxy.java
@@ -1150,7 +1150,8 @@ public class CacheClientProxy implements ClientSession {
     if (Version.GFE_701.compareTo(this.clientVersion) > 0
         && message.getKeyOfInterest() instanceof List) {
       for (Iterator i = ((List) message.getKeyOfInterest()).iterator(); i.hasNext();) {
-        this._messageDispatcher.enqueueMessage(new ClientInterestMessageImpl(message, i.next()));
+        this._messageDispatcher.enqueueMessage(
+            new ClientInterestMessageImpl(getCache().getDistributedSystem(), message, i.next()));
       }
     } else {
       this._messageDispatcher.enqueueMessage(message);
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientInterestMessageImpl.java b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientInterestMessageImpl.java
index 3fbd30a..f1b82d1 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientInterestMessageImpl.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/ClientInterestMessageImpl.java
@@ -19,6 +19,7 @@ import java.io.*;
 
 import org.apache.geode.DataSerializer;
 import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.internal.DataSerializableFixedID;
 import org.apache.geode.internal.Version;
 import org.apache.geode.internal.cache.EventID;
@@ -109,8 +110,9 @@ public class ClientInterestMessageImpl implements ClientMessage {
     this.action = action;
   }
 
-  public ClientInterestMessageImpl(ClientInterestMessageImpl message, Object keyOfInterest) {
-    this.eventId = new EventID(CacheFactory.getAnyInstance().getDistributedSystem());
+  public ClientInterestMessageImpl(DistributedSystem distributedSystem,
+      ClientInterestMessageImpl message, Object keyOfInterest) {
+    this.eventId = new EventID(distributedSystem);
     this.regionName = message.regionName;
     this.keyOfInterest = keyOfInterest;
     this.interestType = message.interestType;
diff --git a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
index 2319776..e9267ad 100755
--- a/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
+++ b/geode-core/src/main/java/org/apache/geode/internal/cache/xmlcache/CacheCreation.java
@@ -103,7 +103,6 @@ import org.apache.geode.distributed.internal.membership.InternalDistributedMembe
 import org.apache.geode.i18n.LogWriterI18n;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.SystemTimer;
-import org.apache.geode.internal.cache.BackupManager;
 import org.apache.geode.internal.cache.CacheConfig;
 import org.apache.geode.internal.cache.CachePerfStats;
 import org.apache.geode.internal.cache.CacheServerImpl;
@@ -128,6 +127,7 @@ import org.apache.geode.internal.cache.RegionListener;
 import org.apache.geode.internal.cache.TXEntryStateFactory;
 import org.apache.geode.internal.cache.TXManagerImpl;
 import org.apache.geode.internal.cache.TombstoneService;
+import org.apache.geode.internal.cache.backup.BackupManager;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.control.ResourceAdvisor;
 import org.apache.geode.internal.cache.event.EventTrackerExpiryTask;
diff --git a/geode-core/src/main/java/org/apache/geode/management/BackupStatus.java b/geode-core/src/main/java/org/apache/geode/management/BackupStatus.java
index 9ac5b50..fb78607 100644
--- a/geode-core/src/main/java/org/apache/geode/management/BackupStatus.java
+++ b/geode-core/src/main/java/org/apache/geode/management/BackupStatus.java
@@ -19,14 +19,11 @@ import java.util.Set;
 
 import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.internal.cache.BackupUtil;
 
 /**
- * The status of a backup operation, returned by
- * {@link BackupUtil#backupAllMembers(DM, java.io.File,java.io.File)}.
+ * The status of a backup operation.
  *
- * @since GemFire 6.5
+ * @since Geode 1.4
  */
 public interface BackupStatus {
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
index 1bf5215..7cd6665 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/DistributedSystemBridge.java
@@ -44,8 +44,6 @@ import javax.management.ObjectName;
 import org.apache.commons.lang.StringUtils;
 import org.apache.logging.log4j.Logger;
 
-import org.apache.geode.admin.internal.BackupDataStoreHelper;
-import org.apache.geode.admin.internal.BackupDataStoreResult;
 import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.DM;
@@ -58,6 +56,8 @@ import org.apache.geode.internal.admin.remote.RevokePersistentIDRequest;
 import org.apache.geode.internal.admin.remote.ShutdownAllRequest;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.backup.BackupDataStoreHelper;
+import org.apache.geode.internal.cache.backup.BackupDataStoreResult;
 import org.apache.geode.internal.cache.persistence.PersistentMemberPattern;
 import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
index 0afdfd1..2a6565a 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/beans/MemberMBeanBridge.java
@@ -63,7 +63,6 @@ import org.apache.geode.distributed.internal.locks.DLockStats;
 import org.apache.geode.internal.Assert;
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.internal.PureJavaMode;
-import org.apache.geode.internal.cache.BackupManager;
 import org.apache.geode.internal.cache.CachePerfStats;
 import org.apache.geode.internal.cache.DirectoryHolder;
 import org.apache.geode.internal.cache.DiskDirectoryStats;
@@ -74,6 +73,7 @@ import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.LocalRegion;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionStats;
+import org.apache.geode.internal.cache.backup.BackupManager;
 import org.apache.geode.internal.cache.control.ResourceManagerStats;
 import org.apache.geode.internal.cache.execute.FunctionServiceStats;
 import org.apache.geode.internal.cache.lru.LRUStatistics;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
index 2358cb7..7e4ae04 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
@@ -34,8 +34,6 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
 import java.util.Set;
 import java.util.stream.Collectors;
 import java.util.zip.DataFormatException;
@@ -62,7 +60,7 @@ import org.apache.geode.management.DistributedRegionMXBean;
 import org.apache.geode.management.ManagementService;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.MBeanJMXAdapter;
-import org.apache.geode.management.internal.cli.functions.MembersForRegionFunction;
+import org.apache.geode.management.internal.cli.exceptions.UserErrorException;
 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.shell.Gfsh;
@@ -291,7 +289,7 @@ public class CliUtil {
     }
 
     if ((members.length > 0) && (groups.length > 0)) {
-      throw new IllegalArgumentException(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
+      throw new UserErrorException(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
     }
 
     if (members.length == 0 && groups.length == 0) {
@@ -303,7 +301,7 @@ public class CliUtil {
     for (String memberNameOrId : members) {
       for (DistributedMember member : membersToConsider) {
         if (memberNameOrId.equalsIgnoreCase(member.getId())
-            || memberNameOrId.equals(member.getName())) {
+            || memberNameOrId.equalsIgnoreCase(member.getName())) {
           matchingMembers.add(member);
         }
       }
@@ -327,7 +325,7 @@ public class CliUtil {
       Set<DistributedMember> memberSet = CliUtil.getAllMembers(cache);
       for (DistributedMember member : memberSet) {
         if (memberNameOrId.equalsIgnoreCase(member.getId())
-            || memberNameOrId.equals(member.getName())) {
+            || memberNameOrId.equalsIgnoreCase(member.getName())) {
           memberFound = member;
           break;
         }
@@ -692,52 +690,4 @@ public class CliUtil {
     return buffer.toString();
   }
 
-  public static Set<DistributedMember> getMembersForeRegionViaFunction(InternalCache cache,
-      String regionPath, boolean returnAll) {
-    try {
-      Set<DistributedMember> regionMembers = new HashSet<>();
-      MembersForRegionFunction membersForRegionFunction = new MembersForRegionFunction();
-      FunctionService.registerFunction(membersForRegionFunction);
-      Set<DistributedMember> targetMembers = CliUtil.getAllMembers(cache);
-      List<?> resultList = (List<?>) CliUtil
-          .executeFunction(membersForRegionFunction, regionPath, targetMembers).getResult();
-
-      for (Object object : resultList) {
-        try {
-          if (object instanceof Exception) {
-            LogWrapper.getInstance().warning(
-                "Exception in getMembersForeRegionViaFunction " + ((Throwable) object).getMessage(),
-                ((Throwable) object));
-            continue;
-          } else if (object instanceof Throwable) {
-            LogWrapper.getInstance().warning(
-                "Exception in getMembersForeRegionViaFunction " + ((Throwable) object).getMessage(),
-                ((Throwable) object));
-            continue;
-          }
-          if (object != null) {
-            Map<String, String> memberDetails = (Map<String, String>) object;
-            for (Entry<String, String> entry : memberDetails.entrySet()) {
-              Set<DistributedMember> dsMems = CliUtil.getAllMembers(cache);
-              for (DistributedMember mem : dsMems) {
-                if (mem.getId().equals(entry.getKey())) {
-                  regionMembers.add(mem);
-                  if (!returnAll) {
-                    return regionMembers;
-                  }
-                }
-              }
-            }
-          }
-        } catch (Exception ex) {
-          LogWrapper.getInstance().warning("getMembersForeRegionViaFunction exception " + ex);
-        }
-      }
-      return regionMembers;
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning("getMembersForeRegionViaFunction exception " + e);
-      return null;
-    }
-  }
-
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParseResult.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParseResult.java
index b3fd0fa..08d7a08 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParseResult.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParseResult.java
@@ -128,4 +128,9 @@ public class GfshParseResult extends ParseResult {
     }
     return null;
   }
+
+  @Override
+  public String toString() {
+    return this.userInput;
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java
index 9cebc63..4fc7d4e 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/GfshParser.java
@@ -282,7 +282,7 @@ public class GfshParser extends SimpleParser {
   /**
    * @param buffer use the buffer to find the completion candidates
    *
-   *        Note the cursor maynot be the size the buffer
+   *        Note the cursor may not be the size the buffer
    */
   private List<Completion> getCandidates(String buffer) {
     List<Completion> candidates = new ArrayList<>();
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/BackupDiskStoreCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/BackupDiskStoreCommand.java
index 26f7d8b..8eb9bf8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/BackupDiskStoreCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/BackupDiskStoreCommand.java
@@ -25,8 +25,8 @@ import org.springframework.shell.core.annotation.CliOption;
 import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.internal.cache.BackupUtil;
 import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.internal.cache.backup.BackupUtil;
 import org.apache.geode.management.BackupStatus;
 import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.Result;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommand.java
index 0b34a26..da67ad3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommand.java
@@ -15,12 +15,12 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
+import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeSet;
-import java.util.concurrent.atomic.AtomicReference;
 
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
@@ -30,7 +30,6 @@ import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.management.cli.CliMetaData;
 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.CliFunctionResult;
 import org.apache.geode.management.internal.cli.functions.CreateDefinedIndexesFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
@@ -61,7 +60,7 @@ public class CreateDefinedIndexesCommand implements GfshCommand {
           help = CliStrings.CREATE_DEFINED_INDEXES__GROUP__HELP) final String[] group) {
 
     Result result;
-    AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
+    List<XmlEntity> xmlEntities = new ArrayList<>();
 
     if (IndexDefinition.indexDefinitions.isEmpty()) {
       final InfoResultData infoResult = ResultBuilder.createInfoResultData();
@@ -70,13 +69,13 @@ public class CreateDefinedIndexesCommand implements GfshCommand {
     }
 
     try {
-      final Set<DistributedMember> targetMembers = CliUtil.findMembers(group, memberNameOrID);
+      final Set<DistributedMember> targetMembers = findMembers(group, memberNameOrID);
 
       if (targetMembers.isEmpty()) {
         return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
       }
 
-      final ResultCollector<?, ?> rc = CliUtil.executeFunction(createDefinedIndexesFunction,
+      final ResultCollector<?, ?> rc = executeFunction(createDefinedIndexesFunction,
           IndexDefinition.indexDefinitions, targetMembers);
 
       final List<Object> funcResults = (List<Object>) rc.getResult();
@@ -90,8 +89,11 @@ public class CreateDefinedIndexesCommand implements GfshCommand {
           if (cliFunctionResult.isSuccessful()) {
             successfulMembers.add(cliFunctionResult.getMemberIdOrName());
 
-            if (xmlEntity.get() == null) {
-              xmlEntity.set(cliFunctionResult.getXmlEntity());
+            // Only add the XmlEntity if it wasn't previously added from the result of another
+            // successful member.
+            XmlEntity resultEntity = cliFunctionResult.getXmlEntity();
+            if ((null != resultEntity) && (!xmlEntities.contains(resultEntity))) {
+              xmlEntities.add(cliFunctionResult.getXmlEntity());
             }
           } else {
             final String exceptionMessage = cliFunctionResult.getMessage();
@@ -100,12 +102,18 @@ public class CreateDefinedIndexesCommand implements GfshCommand {
             if (failedMembers == null) {
               failedMembers = new TreeSet<>();
             }
+
             failedMembers.add(cliFunctionResult.getMemberIdOrName());
             indexOpFailMap.put(exceptionMessage, failedMembers);
           }
         }
       }
 
+      // TODO: GEODE-3916.
+      // The index creation might succeed in some members and fail in others, the current logic only
+      // reports to the user the members on which the operation was successful, giving no details
+      // about the failures. We should report the exact details of what failed/succeeded, and
+      // where/why.
       if (!successfulMembers.isEmpty()) {
         final InfoResultData infoResult = ResultBuilder.createInfoResultData();
         infoResult.addLine(CliStrings.CREATE_DEFINED_INDEXES__SUCCESS__MSG);
@@ -143,10 +151,11 @@ public class CreateDefinedIndexesCommand implements GfshCommand {
       result = ResultBuilder.createGemFireErrorResult(e.getMessage());
     }
 
-    if (xmlEntity.get() != null) {
+    for (XmlEntity xmlEntity : xmlEntities) {
       persistClusterConfiguration(result,
-          () -> getSharedConfiguration().addXmlEntity(xmlEntity.get(), group));
+          () -> getSharedConfiguration().addXmlEntity(xmlEntity, group));
     }
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeClientCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeClientCommand.java
index 9b37f12..d8135f0 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeClientCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeClientCommand.java
@@ -50,7 +50,7 @@ public class DescribeClientCommand implements GfshCommand {
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
   public Result describeClient(@CliOption(key = CliStrings.DESCRIBE_CLIENT__ID, mandatory = true,
-      help = CliStrings.DESCRIBE_CLIENT__ID__HELP) String clientId) {
+      help = CliStrings.DESCRIBE_CLIENT__ID__HELP) String clientId) throws Exception {
     Result result;
 
     if (clientId.startsWith("\"")) {
@@ -65,111 +65,97 @@ public class DescribeClientCommand implements GfshCommand {
       clientId = clientId.substring(0, clientId.length() - 2);
     }
 
-    try {
-      CompositeResultData compositeResultData = ResultBuilder.createCompositeResultData();
-      CompositeResultData.SectionResultData sectionResult =
-          compositeResultData.addSection("InfoSection");
-      InternalCache cache = getCache();
-
-      ManagementService service = ManagementService.getExistingManagementService(cache);
-      ObjectName[] cacheServers = service.getDistributedSystemMXBean().listCacheServerObjectNames();
-      if (cacheServers.length == 0) {
-        return ResultBuilder.createGemFireErrorResult(
-            CliStrings.format(CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_SERVER_LIST));
-      }
+    CompositeResultData compositeResultData = ResultBuilder.createCompositeResultData();
+    CompositeResultData.SectionResultData sectionResult =
+        compositeResultData.addSection("InfoSection");
+    InternalCache cache = getCache();
+
+    ManagementService service = ManagementService.getExistingManagementService(cache);
+    ObjectName[] cacheServers = service.getDistributedSystemMXBean().listCacheServerObjectNames();
+    if (cacheServers.length == 0) {
+      return ResultBuilder.createGemFireErrorResult(
+          CliStrings.format(CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_SERVER_LIST));
+    }
+
+    ClientHealthStatus clientHealthStatus = null;
 
-      ClientHealthStatus clientHealthStatus = null;
-
-      for (ObjectName objName : cacheServers) {
-        CacheServerMXBean serverMbean = service.getMBeanInstance(objName, CacheServerMXBean.class);
-        List<String> listOfClient =
-            new ArrayList<>(Arrays.asList((String[]) serverMbean.getClientIds()));
-        if (listOfClient.contains(clientId)) {
-          if (clientHealthStatus == null) {
-            try {
-              clientHealthStatus = serverMbean.showClientStats(clientId);
-              if (clientHealthStatus == null) {
-                return ResultBuilder.createGemFireErrorResult(CliStrings.format(
-                    CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_STATS_FOR_CLIENT_0, clientId));
-              }
-            } catch (Exception eee) {
+    for (ObjectName objName : cacheServers) {
+      CacheServerMXBean serverMbean = service.getMBeanInstance(objName, CacheServerMXBean.class);
+      List<String> listOfClient =
+          new ArrayList<>(Arrays.asList((String[]) serverMbean.getClientIds()));
+      if (listOfClient.contains(clientId)) {
+        if (clientHealthStatus == null) {
+          try {
+            clientHealthStatus = serverMbean.showClientStats(clientId);
+            if (clientHealthStatus == null) {
               return ResultBuilder.createGemFireErrorResult(CliStrings.format(
-                  CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_STATS_FOR_CLIENT_0_REASON_1,
-                  clientId, eee.getMessage()));
+                  CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_STATS_FOR_CLIENT_0, clientId));
             }
+          } catch (Exception eee) {
+            return ResultBuilder.createGemFireErrorResult(CliStrings.format(
+                CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_STATS_FOR_CLIENT_0_REASON_1, clientId,
+                eee.getMessage()));
           }
         }
       }
+    }
 
-      if (clientHealthStatus == null) {
-        return ResultBuilder.createGemFireErrorResult(
-            CliStrings.format(CliStrings.DESCRIBE_CLIENT__CLIENT__ID__NOT__FOUND__0, clientId));
-      }
+    if (clientHealthStatus == null) {
+      return ResultBuilder.createGemFireErrorResult(
+          CliStrings.format(CliStrings.DESCRIBE_CLIENT__CLIENT__ID__NOT__FOUND__0, clientId));
+    }
 
-      Set<DistributedMember> dsMembers = CliUtil.getAllMembers(cache);
-      String isDurable = null;
-      List<String> primaryServers = new ArrayList<>();
-      List<String> secondaryServers = new ArrayList<>();
-
-      if (dsMembers.size() > 0) {
-        ContinuousQueryFunction continuousQueryFunction = new ContinuousQueryFunction();
-        FunctionService.registerFunction(continuousQueryFunction);
-        List<?> resultList = (List<?>) CliUtil
-            .executeFunction(continuousQueryFunction, clientId, dsMembers).getResult();
-        for (Object aResultList : resultList) {
-          try {
-            Object object = aResultList;
-            if (object instanceof Throwable) {
-              LogWrapper.getInstance().warning(
-                  "Exception in Describe Client " + ((Throwable) object).getMessage(),
-                  ((Throwable) object));
-              continue;
+    Set<DistributedMember> dsMembers = CliUtil.getAllMembers(cache);
+    String isDurable = null;
+    List<String> primaryServers = new ArrayList<>();
+    List<String> secondaryServers = new ArrayList<>();
+
+    if (dsMembers.size() > 0) {
+      ContinuousQueryFunction continuousQueryFunction = new ContinuousQueryFunction();
+      FunctionService.registerFunction(continuousQueryFunction);
+      List<?> resultList = (List<?>) CliUtil
+          .executeFunction(continuousQueryFunction, clientId, dsMembers).getResult();
+      for (Object aResultList : resultList) {
+        Object object = aResultList;
+        if (object instanceof Throwable) {
+          LogWrapper.getInstance().warning(
+              "Exception in Describe Client " + ((Throwable) object).getMessage(),
+              ((Throwable) object));
+          continue;
+        }
+
+        if (object != null) {
+          ContinuousQueryFunction.ClientInfo objectResult =
+              (ContinuousQueryFunction.ClientInfo) object;
+          isDurable = objectResult.isDurable;
+
+          if (objectResult.primaryServer != null && objectResult.primaryServer.length() > 0) {
+            if (primaryServers.size() == 0) {
+              primaryServers.add(objectResult.primaryServer);
+            } else {
+              primaryServers.add(" ,");
+              primaryServers.add(objectResult.primaryServer);
             }
+          }
 
-            if (object != null) {
-              ContinuousQueryFunction.ClientInfo objectResult =
-                  (ContinuousQueryFunction.ClientInfo) object;
-              isDurable = objectResult.isDurable;
-
-              if (objectResult.primaryServer != null && objectResult.primaryServer.length() > 0) {
-                if (primaryServers.size() == 0) {
-                  primaryServers.add(objectResult.primaryServer);
-                } else {
-                  primaryServers.add(" ,");
-                  primaryServers.add(objectResult.primaryServer);
-                }
-              }
-
-              if (objectResult.secondaryServer != null
-                  && objectResult.secondaryServer.length() > 0) {
-                if (secondaryServers.size() == 0) {
-                  secondaryServers.add(objectResult.secondaryServer);
-                } else {
-                  secondaryServers.add(" ,");
-                  secondaryServers.add(objectResult.secondaryServer);
-                }
-              }
+          if (objectResult.secondaryServer != null && objectResult.secondaryServer.length() > 0) {
+            if (secondaryServers.size() == 0) {
+              secondaryServers.add(objectResult.secondaryServer);
+            } else {
+              secondaryServers.add(" ,");
+              secondaryServers.add(objectResult.secondaryServer);
             }
-          } catch (Exception e) {
-            LogWrapper.getInstance().info(CliStrings.DESCRIBE_CLIENT_ERROR_FETCHING_STATS_0 + " :: "
-                + CliUtil.stackTraceAsString(e));
-            return ResultBuilder.createGemFireErrorResult(CliStrings
-                .format(CliStrings.DESCRIBE_CLIENT_ERROR_FETCHING_STATS_0, e.getMessage()));
           }
         }
-
-        buildTableResult(sectionResult, clientHealthStatus, isDurable, primaryServers,
-            secondaryServers);
-        result = ResultBuilder.buildResult(compositeResultData);
-      } else {
-        return ResultBuilder.createGemFireErrorResult(CliStrings.DESCRIBE_CLIENT_NO_MEMBERS);
       }
-    } catch (Exception e) {
-      LogWrapper.getInstance()
-          .info("Error in describe clients. stack trace" + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings
-          .format(CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_CLIENT_0, e.getMessage()));
+
+      buildTableResult(sectionResult, clientHealthStatus, isDurable, primaryServers,
+          secondaryServers);
+      result = ResultBuilder.buildResult(compositeResultData);
+    } else {
+      return ResultBuilder.createGemFireErrorResult(CliStrings.DESCRIBE_CLIENT_NO_MEMBERS);
     }
+
     LogWrapper.getInstance().info("describe client result " + result);
     return result;
   }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommand.java
index b7b1f08..b826918 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommand.java
@@ -29,7 +29,6 @@ import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.management.cli.CliMetaData;
 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.domain.MemberConfigurationInfo;
 import org.apache.geode.management.internal.cli.functions.GetMemberConfigInformationFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
@@ -60,58 +59,51 @@ public class DescribeConfigCommand implements GfshCommand {
       DistributedMember targetMember = null;
 
       if (memberNameOrId != null && !memberNameOrId.isEmpty()) {
-        targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
+        targetMember = getMember(memberNameOrId);
       }
-      if (targetMember != null) {
-        ResultCollector<?, ?> rc =
-            executeFunction(getMemberConfigFunction, hideDefaults, targetMember);
-        ArrayList<?> output = (ArrayList<?>) rc.getResult();
-        Object obj = output.get(0);
 
-        if (obj != null && obj instanceof MemberConfigurationInfo) {
-          MemberConfigurationInfo memberConfigInfo = (MemberConfigurationInfo) obj;
+      ResultCollector<?, ?> rc =
+          executeFunction(getMemberConfigFunction, hideDefaults, targetMember);
+      ArrayList<?> output = (ArrayList<?>) rc.getResult();
+      Object obj = output.get(0);
 
-          CompositeResultData crd = ResultBuilder.createCompositeResultData();
-          crd.setHeader(
-              CliStrings.format(CliStrings.DESCRIBE_CONFIG__HEADER__TEXT, memberNameOrId));
+      if (obj != null && obj instanceof MemberConfigurationInfo) {
+        MemberConfigurationInfo memberConfigInfo = (MemberConfigurationInfo) obj;
 
-          List<String> jvmArgsList = memberConfigInfo.getJvmInputArguments();
-          TabularResultData jvmInputArgs = crd.addSection().addSection().addTable();
+        CompositeResultData crd = ResultBuilder.createCompositeResultData();
+        crd.setHeader(CliStrings.format(CliStrings.DESCRIBE_CONFIG__HEADER__TEXT, memberNameOrId));
 
-          for (String jvmArg : jvmArgsList) {
-            jvmInputArgs.accumulate("JVM command line arguments", jvmArg);
-          }
+        List<String> jvmArgsList = memberConfigInfo.getJvmInputArguments();
+        TabularResultData jvmInputArgs = crd.addSection().addSection().addTable();
 
-          addSection(crd, memberConfigInfo.getGfePropsSetUsingApi(),
-              "GemFire properties defined using the API");
-          addSection(crd, memberConfigInfo.getGfePropsRuntime(),
-              "GemFire properties defined at the runtime");
-          addSection(crd, memberConfigInfo.getGfePropsSetFromFile(),
-              "GemFire properties defined with the property file");
-          addSection(crd, memberConfigInfo.getGfePropsSetWithDefaults(),
-              "GemFire properties using default values");
-          addSection(crd, memberConfigInfo.getCacheAttributes(), "Cache attributes");
-
-          List<Map<String, String>> cacheServerAttributesList =
-              memberConfigInfo.getCacheServerAttributes();
-
-          if (cacheServerAttributesList != null && !cacheServerAttributesList.isEmpty()) {
-            CompositeResultData.SectionResultData cacheServerSection = crd.addSection();
-            cacheServerSection.setHeader("Cache-server attributes");
-
-            for (Map<String, String> cacheServerAttributes : cacheServerAttributesList) {
-              addSubSection(cacheServerSection, cacheServerAttributes);
-            }
-          }
-          result = ResultBuilder.buildResult(crd);
+        for (String jvmArg : jvmArgsList) {
+          jvmInputArgs.accumulate("JVM command line arguments", jvmArg);
         }
 
-      } else {
-        ErrorResultData erd = ResultBuilder.createErrorResultData();
-        erd.addLine(CliStrings.format(CliStrings.DESCRIBE_CONFIG__MEMBER__NOT__FOUND,
-            new Object[] {memberNameOrId}));
-        result = ResultBuilder.buildResult(erd);
+        addSection(crd, memberConfigInfo.getGfePropsSetUsingApi(),
+            "GemFire properties defined using the API");
+        addSection(crd, memberConfigInfo.getGfePropsRuntime(),
+            "GemFire properties defined at the runtime");
+        addSection(crd, memberConfigInfo.getGfePropsSetFromFile(),
+            "GemFire properties defined with the property file");
+        addSection(crd, memberConfigInfo.getGfePropsSetWithDefaults(),
+            "GemFire properties using default values");
+        addSection(crd, memberConfigInfo.getCacheAttributes(), "Cache attributes");
+
+        List<Map<String, String>> cacheServerAttributesList =
+            memberConfigInfo.getCacheServerAttributes();
+
+        if (cacheServerAttributesList != null && !cacheServerAttributesList.isEmpty()) {
+          CompositeResultData.SectionResultData cacheServerSection = crd.addSection();
+          cacheServerSection.setHeader("Cache-server attributes");
+
+          for (Map<String, String> cacheServerAttributes : cacheServerAttributesList) {
+            addSubSection(cacheServerSection, cacheServerAttributes);
+          }
+        }
+        result = ResultBuilder.buildResult(crd);
       }
+
     } catch (FunctionInvocationTargetException e) {
       result = ResultBuilder.createGemFireErrorResult(CliStrings
           .format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.DESCRIBE_CONFIG));
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
index 4efd973..cdb7d27 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeDiskStoreCommand.java
@@ -21,8 +21,6 @@ import java.util.List;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
-import org.apache.geode.cache.execute.FunctionInvocationTargetException;
 import org.apache.geode.cache.execute.ResultCollector;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.lang.ClassUtils;
@@ -30,13 +28,12 @@ import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
 import org.apache.geode.management.internal.cli.functions.DescribeDiskStoreFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.CompositeResultData;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.management.internal.cli.util.DiskStoreNotFoundException;
-import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -52,26 +49,13 @@ public class DescribeDiskStoreCommand implements GfshCommand {
       @CliOption(key = CliStrings.DESCRIBE_DISK_STORE__NAME, mandatory = true,
           optionContext = ConverterHint.DISKSTORE,
           help = CliStrings.DESCRIBE_DISK_STORE__NAME__HELP) final String diskStoreName) {
-    try {
-      return toCompositeResult(getDiskStoreDescription(memberName, diskStoreName));
-    } catch (DiskStoreNotFoundException | MemberNotFoundException e) {
-      return ResultBuilder.createShellClientErrorResult(e.getMessage());
-    } catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings
-          .format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.DESCRIBE_DISK_STORE));
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      return ResultBuilder
-          .createGemFireErrorResult(String.format(CliStrings.DESCRIBE_DISK_STORE__ERROR_MESSAGE,
-              memberName, diskStoreName, toString(t, isDebugging())));
-    }
+
+    return toCompositeResult(getDiskStoreDescription(memberName, diskStoreName));
+
   }
 
   DiskStoreDetails getDiskStoreDescription(final String memberName, final String diskStoreName) {
-    final DistributedMember member = getMember(getCache(), memberName);
+    final DistributedMember member = getMember(memberName);
 
     final ResultCollector<?, ?> resultCollector =
         getMembersFunctionExecutor(Collections.singleton(member)).setArguments(diskStoreName)
@@ -81,8 +65,8 @@ public class DescribeDiskStoreCommand implements GfshCommand {
 
     if (result instanceof DiskStoreDetails) { // disk store details in hand...
       return (DiskStoreDetails) result;
-    } else if (result instanceof DiskStoreNotFoundException) { // bad disk store name...
-      throw (DiskStoreNotFoundException) result;
+    } else if (result instanceof EntityNotFoundException) { // bad disk store name...
+      throw (EntityNotFoundException) result;
     } else { // unknown and unexpected return type...
       final Throwable cause = (result instanceof Throwable ? (Throwable) result : null);
 
@@ -117,9 +101,8 @@ public class DescribeDiskStoreCommand implements GfshCommand {
     diskStoreSection.addData("Member ID", diskStoreDetails.getMemberId());
     diskStoreSection.addData("Member Name", diskStoreDetails.getMemberName());
     diskStoreSection.addData("Allow Force Compaction",
-        toString(diskStoreDetails.isAllowForceCompaction(), "Yes", "No"));
-    diskStoreSection.addData("Auto Compaction",
-        toString(diskStoreDetails.isAutoCompact(), "Yes", "No"));
+        diskStoreDetails.isAllowForceCompaction() ? "Yes" : "No");
+    diskStoreSection.addData("Auto Compaction", diskStoreDetails.isAutoCompact() ? "Yes" : "No");
     diskStoreSection.addData("Compaction Threshold", diskStoreDetails.getCompactionThreshold());
     diskStoreSection.addData("Max Oplog Size", diskStoreDetails.getMaxOplogSize());
     diskStoreSection.addData("Queue Size", diskStoreDetails.getQueueSize());
@@ -130,7 +113,7 @@ public class DescribeDiskStoreCommand implements GfshCommand {
     diskStoreSection.addData("Disk Usage Critical Percentage",
         diskStoreDetails.getDiskUsageCriticalPercentage());
     diskStoreSection.addData("PDX Serialization Meta-Data Stored",
-        toString(diskStoreDetails.isPdxSerializationMetaDataStored(), "Yes", "No"));
+        diskStoreDetails.isPdxSerializationMetaDataStored() ? "Yes" : "No");
 
     final TabularResultData diskDirTable = diskStoreData.addSection().addTable();
 
@@ -144,9 +127,8 @@ public class DescribeDiskStoreCommand implements GfshCommand {
     for (DiskStoreDetails.RegionDetails regionDetails : diskStoreDetails.iterateRegions()) {
       regionTable.accumulate("Region Path", regionDetails.getFullPath());
       regionTable.accumulate("Region Name", regionDetails.getName());
-      regionTable.accumulate("Persistent", toString(regionDetails.isPersistent(), "Yes", "No"));
-      regionTable.accumulate("Overflow To Disk",
-          toString(regionDetails.isOverflowToDisk(), "Yes", "No"));
+      regionTable.accumulate("Persistent", regionDetails.isPersistent() ? "Yes" : "No");
+      regionTable.accumulate("Overflow To Disk", regionDetails.isOverflowToDisk() ? "Yes" : "No");
     }
 
     final TabularResultData cacheServerTable = diskStoreData.addSection().addTable();
@@ -162,7 +144,7 @@ public class DescribeDiskStoreCommand implements GfshCommand {
 
     for (DiskStoreDetails.GatewayDetails gatewayDetails : diskStoreDetails.iterateGateways()) {
       gatewayTable.accumulate("Gateway ID", gatewayDetails.getId());
-      gatewayTable.accumulate("Persistent", toString(gatewayDetails.isPersistent(), "Yes", "No"));
+      gatewayTable.accumulate("Persistent", gatewayDetails.isPersistent() ? "Yes" : "No");
     }
 
     final TabularResultData asyncEventQueueTable = diskStoreData.addSection().addTable();
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeMemberCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeMemberCommand.java
index dfe2a57..9aec188 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeMemberCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DescribeMemberCommand.java
@@ -52,75 +52,67 @@ public class DescribeMemberCommand implements GfshCommand {
     Result result = null;
 
     try {
-      DistributedMember memberToBeDescribed =
-          CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
-
-      if (memberToBeDescribed != null) {
-        ResultCollector<?, ?> rc = executeFunction(getMemberInformation, null, memberToBeDescribed);
-
-        ArrayList<?> output = (ArrayList<?>) rc.getResult();
-        Object obj = output.get(0);
-
-        if (obj != null && (obj instanceof MemberInformation)) {
-
-          CompositeResultData crd = ResultBuilder.createCompositeResultData();
-
-          MemberInformation memberInformation = (MemberInformation) obj;
-          memberInformation.setName(memberToBeDescribed.getName());
-          memberInformation.setId(memberToBeDescribed.getId());
-          memberInformation.setHost(memberToBeDescribed.getHost());
-          memberInformation.setProcessId("" + memberToBeDescribed.getProcessId());
-
-          CompositeResultData.SectionResultData section = crd.addSection();
-          section.addData("Name", memberInformation.getName());
-          section.addData("Id", memberInformation.getId());
-          section.addData("Host", memberInformation.getHost());
-          section.addData("Regions",
-              CliUtil.convertStringSetToString(memberInformation.getHostedRegions(), '\n'));
-          section.addData("PID", memberInformation.getProcessId());
-          section.addData("Groups", memberInformation.getGroups());
-          section.addData("Used Heap", memberInformation.getHeapUsage() + "M");
-          section.addData("Max Heap", memberInformation.getMaxHeapSize() + "M");
-
-          String offHeapMemorySize = memberInformation.getOffHeapMemorySize();
-          if (offHeapMemorySize != null && !offHeapMemorySize.isEmpty()) {
-            section.addData("Off Heap Size", offHeapMemorySize);
-          }
-
-          section.addData("Working Dir", memberInformation.getWorkingDirPath());
-          section.addData("Log file", memberInformation.getLogFilePath());
+      DistributedMember memberToBeDescribed = getMember(memberNameOrId);
+
+      ResultCollector<?, ?> rc = executeFunction(getMemberInformation, null, memberToBeDescribed);
+
+      ArrayList<?> output = (ArrayList<?>) rc.getResult();
+      Object obj = output.get(0);
+
+      if (obj != null && (obj instanceof MemberInformation)) {
+        CompositeResultData crd = ResultBuilder.createCompositeResultData();
+
+        MemberInformation memberInformation = (MemberInformation) obj;
+        memberInformation.setName(memberToBeDescribed.getName());
+        memberInformation.setId(memberToBeDescribed.getId());
+        memberInformation.setHost(memberToBeDescribed.getHost());
+        memberInformation.setProcessId("" + memberToBeDescribed.getProcessId());
+
+        CompositeResultData.SectionResultData section = crd.addSection();
+        section.addData("Name", memberInformation.getName());
+        section.addData("Id", memberInformation.getId());
+        section.addData("Host", memberInformation.getHost());
+        section.addData("Regions",
+            CliUtil.convertStringSetToString(memberInformation.getHostedRegions(), '\n'));
+        section.addData("PID", memberInformation.getProcessId());
+        section.addData("Groups", memberInformation.getGroups());
+        section.addData("Used Heap", memberInformation.getHeapUsage() + "M");
+        section.addData("Max Heap", memberInformation.getMaxHeapSize() + "M");
+
+        String offHeapMemorySize = memberInformation.getOffHeapMemorySize();
+        if (offHeapMemorySize != null && !offHeapMemorySize.isEmpty()) {
+          section.addData("Off Heap Size", offHeapMemorySize);
+        }
 
-          section.addData("Locators", memberInformation.getLocators());
+        section.addData("Working Dir", memberInformation.getWorkingDirPath());
+        section.addData("Log file", memberInformation.getLogFilePath());
 
-          if (memberInformation.isServer()) {
-            CompositeResultData.SectionResultData clientServiceSection = crd.addSection();
-            List<CacheServerInfo> csList = memberInformation.getCacheServeInfo();
+        section.addData("Locators", memberInformation.getLocators());
 
-            if (csList != null) {
-              Iterator<CacheServerInfo> iters = csList.iterator();
-              clientServiceSection.setHeader("Cache Server Information");
+        if (memberInformation.isServer()) {
+          CompositeResultData.SectionResultData clientServiceSection = crd.addSection();
+          List<CacheServerInfo> csList = memberInformation.getCacheServeInfo();
 
-              while (iters.hasNext()) {
-                CacheServerInfo cacheServerInfo = iters.next();
-                clientServiceSection.addData("Server Bind", cacheServerInfo.getBindAddress());
-                clientServiceSection.addData("Server Port", cacheServerInfo.getPort());
-                clientServiceSection.addData("Running", cacheServerInfo.isRunning());
-              }
+          if (csList != null) {
+            Iterator<CacheServerInfo> iters = csList.iterator();
+            clientServiceSection.setHeader("Cache Server Information");
 
-              clientServiceSection.addData("Client Connections",
-                  memberInformation.getClientCount());
+            while (iters.hasNext()) {
+              CacheServerInfo cacheServerInfo = iters.next();
+              clientServiceSection.addData("Server Bind", cacheServerInfo.getBindAddress());
+              clientServiceSection.addData("Server Port", cacheServerInfo.getPort());
+              clientServiceSection.addData("Running", cacheServerInfo.isRunning());
             }
-          }
-          result = ResultBuilder.buildResult(crd);
 
-        } else {
-          result = ResultBuilder.createInfoResult(CliStrings.format(
-              CliStrings.DESCRIBE_MEMBER__MSG__INFO_FOR__0__COULD_NOT_BE_RETRIEVED,
-              new Object[] {memberNameOrId}));
+            clientServiceSection.addData("Client Connections", memberInformation.getClientCount());
+          }
         }
+        result = ResultBuilder.buildResult(crd);
+
       } else {
-        result = ResultBuilder.createInfoResult(CliStrings
-            .format(CliStrings.DESCRIBE_MEMBER__MSG__NOT_FOUND, new Object[] {memberNameOrId}));
+        result = ResultBuilder.createInfoResult(
+            CliStrings.format(CliStrings.DESCRIBE_MEMBER__MSG__INFO_FOR__0__COULD_NOT_BE_RETRIEVED,
+                new Object[] {memberNameOrId}));
       }
     } catch (CacheClosedException ignored) {
     } catch (Exception e) {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
index f36c154..81dfc2b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyFunctionCommand.java
@@ -72,7 +72,7 @@ public class DestroyFunctionCommand implements GfshCommand {
         return results;
       } else if (memberId != null) {
         // execute on member
-        dsMembers.add(getMember(cache, memberId));
+        dsMembers.add(getMember(memberId));
         @SuppressWarnings("unchecked")
         Result results = executeFunction(cache, dsMembers, functionId);
         return results;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommand.java
index 97b4a95..83dc1a9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommand.java
@@ -18,16 +18,16 @@ package org.apache.geode.management.internal.cli.commands;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.logging.log4j.Logger;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
 import org.apache.geode.cache.execute.ResultCollector;
 import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.cli.CliMetaData;
 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.LogWrapper;
 import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
 import org.apache.geode.management.internal.cli.functions.GatewaySenderDestroyFunction;
 import org.apache.geode.management.internal.cli.functions.GatewaySenderDestroyFunctionArgs;
@@ -38,6 +38,8 @@ import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
 public class DestroyGatewaySenderCommand implements GfshCommand {
+  private static final Logger logger = LogService.getLogger();
+
   @CliCommand(value = CliStrings.DESTROY_GATEWAYSENDER,
       help = CliStrings.DESTROY_GATEWAYSENDER__HELP)
   @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
@@ -52,39 +54,34 @@ public class DestroyGatewaySenderCommand implements GfshCommand {
           help = CliStrings.DESTROY_GATEWAYSENDER__MEMBER__HELP) String[] onMember,
       @CliOption(key = CliStrings.DESTROY_GATEWAYSENDER__ID, mandatory = true,
           optionContext = ConverterHint.GATEWAY_SENDER_ID,
-          help = CliStrings.DESTROY_GATEWAYSENDER__ID__HELP) String id) {
-    Result result;
-    try {
-      GatewaySenderDestroyFunctionArgs gatewaySenderDestroyFunctionArgs =
-          new GatewaySenderDestroyFunctionArgs(id);
+          help = CliStrings.DESTROY_GATEWAYSENDER__ID__HELP) String id,
+      @CliOption(key = CliStrings.IFEXISTS, help = CliStrings.IFEXISTS_HELP,
+          specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") boolean ifExist) {
 
-      Set<DistributedMember> membersToDestroyGatewaySenderOn =
-          CliUtil.findMembers(onGroups, onMember);
+    GatewaySenderDestroyFunctionArgs gatewaySenderDestroyFunctionArgs =
+        new GatewaySenderDestroyFunctionArgs(id, ifExist);
 
-      if (membersToDestroyGatewaySenderOn.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    Set<DistributedMember> members = getMembers(onGroups, onMember);
+
+    ResultCollector<?, ?> resultCollector = executeFunction(GatewaySenderDestroyFunction.INSTANCE,
+        gatewaySenderDestroyFunctionArgs, members);
 
-      ResultCollector<?, ?> resultCollector =
-          CliUtil.executeFunction(GatewaySenderDestroyFunction.INSTANCE,
-              gatewaySenderDestroyFunctionArgs, membersToDestroyGatewaySenderOn);
-      @SuppressWarnings("unchecked")
-      List<CliFunctionResult> gatewaySenderDestroyResults =
-          (List<CliFunctionResult>) resultCollector.getResult();
+    List<CliFunctionResult> functionResults = (List<CliFunctionResult>) resultCollector.getResult();
 
-      TabularResultData tabularResultData = ResultBuilder.createTabularResultData();
-      final String errorPrefix = "ERROR: ";
-      for (CliFunctionResult gatewaySenderDestroyResult : gatewaySenderDestroyResults) {
-        boolean success = gatewaySenderDestroyResult.isSuccessful();
-        tabularResultData.accumulate("Member", gatewaySenderDestroyResult.getMemberIdOrName());
-        tabularResultData.accumulate("Status",
-            (success ? "" : errorPrefix) + gatewaySenderDestroyResult.getMessage());
+    TabularResultData tabularResultData = ResultBuilder.createTabularResultData();
+    boolean errorOccurred = false;
+    for (CliFunctionResult functionResult : functionResults) {
+      tabularResultData.accumulate("Member", functionResult.getMemberIdOrName());
+      if (functionResult.isSuccessful()) {
+        tabularResultData.accumulate("Status", functionResult.getMessage());
+      } else {
+        // if result has exception, it will be logged by the server before throwing it.
+        // so we don't need to log it here anymore.
+        tabularResultData.accumulate("Status", "ERROR: " + functionResult.getErrorMessage());
+        errorOccurred = true;
       }
-      result = ResultBuilder.buildResult(tabularResultData);
-    } catch (IllegalArgumentException e) {
-      LogWrapper.getInstance().info(e.getMessage());
-      result = ResultBuilder.createUserErrorResult(e.getMessage());
     }
-    return result;
+    tabularResultData.setStatus(errorOccurred ? Result.Status.ERROR : Result.Status.OK);
+    return ResultBuilder.buildResult(tabularResultData);
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommand.java
index 821eb64..13947ec 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommand.java
@@ -26,8 +26,6 @@ import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.management.cli.CliMetaData;
 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.LogWrapper;
 import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
 import org.apache.geode.management.internal.cli.functions.RegionDestroyFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
@@ -45,10 +43,10 @@ public class DestroyRegionCommand implements GfshCommand {
       @CliOption(key = CliStrings.DESTROY_REGION__REGION, optionContext = ConverterHint.REGION_PATH,
           mandatory = true, help = CliStrings.DESTROY_REGION__REGION__HELP) String regionPath,
       @CliOption(key = CliStrings.IFEXISTS, help = CliStrings.IFEXISTS_HELP,
-          specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") boolean ifExists) {
+          specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") boolean ifExists)
+      throws Throwable {
 
     // regionPath should already be converted to have "/" in front of it.
-    Result result;
     AtomicReference<XmlEntity> xmlEntity = new AtomicReference<>();
 
     Set<DistributedMember> regionMembersList = findMembersForRegion(getCache(), regionPath);
@@ -63,45 +61,40 @@ public class DestroyRegionCommand implements GfshCommand {
       }
     }
 
-    CliFunctionResult destroyRegionResult;
-
     ResultCollector<?, ?> resultCollector =
-        CliUtil.executeFunction(RegionDestroyFunction.INSTANCE, regionPath, regionMembersList);
+        executeFunction(RegionDestroyFunction.INSTANCE, regionPath, regionMembersList);
     List<CliFunctionResult> resultsList = (List<CliFunctionResult>) resultCollector.getResult();
-    String message =
-        CliStrings.format(CliStrings.DESTROY_REGION__MSG__REGION_0_1_DESTROYED, regionPath, "");
 
-    // Only if there is an error is this set to false
-    boolean isRegionDestroyed = true;
-    for (CliFunctionResult aResultsList : resultsList) {
-      destroyRegionResult = aResultsList;
-      if (destroyRegionResult.isSuccessful()) {
-        xmlEntity.set(destroyRegionResult.getXmlEntity());
-      } else if (destroyRegionResult.getThrowable() != null) {
-        Throwable t = destroyRegionResult.getThrowable();
-        LogWrapper.getInstance().info(t.getMessage(), t);
-        message = CliStrings.format(
-            CliStrings.DESTROY_REGION__MSG__ERROR_OCCURRED_WHILE_DESTROYING_0_REASON_1, regionPath,
-            t.getMessage());
-        isRegionDestroyed = false;
+    // destroy is called on each member, if any error happens in any one of the member, we should
+    // deem the destroy not successful.
+    String errorMessage = null;
+    for (CliFunctionResult functionResult : resultsList) {
+      if (functionResult.isSuccessful()) {
+        xmlEntity.set(functionResult.getXmlEntity());
       } else {
-        message = CliStrings.format(
-            CliStrings.DESTROY_REGION__MSG__UNKNOWN_RESULT_WHILE_DESTROYING_REGION_0_REASON_1,
-            regionPath, destroyRegionResult.getMessage());
-        isRegionDestroyed = false;
+        if (functionResult.getThrowable() != null) {
+          throw functionResult.getThrowable();
+        }
+        if (functionResult.getMessage() != null) {
+          errorMessage = functionResult.getMessage();
+        } else {
+          errorMessage = "Destroy failed on one member";
+        }
+        // if any error occurred, break out without looking further
+        break;
       }
     }
-    if (isRegionDestroyed) {
-      result = ResultBuilder.createInfoResult(message);
-    } else {
-      result = ResultBuilder.createUserErrorResult(message);
+
+    if (errorMessage != null) {
+      return ResultBuilder.createGemFireErrorResult(errorMessage);
     }
 
+    Result result =
+        ResultBuilder.createInfoResult(String.format("\"%s\" destroyed successfully.", regionPath));
     if (xmlEntity.get() != null) {
       persistClusterConfiguration(result,
           () -> getSharedConfiguration().deleteXmlEntity(xmlEntity.get(), null));
     }
-
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportDataCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportDataCommand.java
index 5f7a6d1..9c5a41b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportDataCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ExportDataCommand.java
@@ -56,11 +56,7 @@ public class ExportDataCommand implements GfshCommand {
           help = CliStrings.EXPORT_DATA__PARALLEL_HELP) boolean parallel) {
 
     getSecurityService().authorize(Resource.DATA, Operation.READ, regionName);
-    final DistributedMember targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
-    if (targetMember == null) {
-      return ResultBuilder.createUserErrorResult(
-          CliStrings.format(CliStrings.EXPORT_DATA__MEMBER__NOT__FOUND, memberNameOrId));
-    }
+    final DistributedMember targetMember = getMember(memberNameOrId);
 
     Optional<Result> validationResult = validatePath(filePath, dirPath, parallel);
     if (validationResult.isPresent()) {
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 20cbeac..90b6fc6 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
@@ -39,7 +39,6 @@ import org.apache.geode.management.ManagementException;
 import org.apache.geode.management.cli.CliMetaData;
 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.SizeExportLogsFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
@@ -97,17 +96,14 @@ public class ExportLogsCommand implements GfshCommand {
       @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) {
+          help = CliStrings.EXPORT_LOGS__FILESIZELIMIT__HELP) String fileSizeLimit)
+      throws Exception {
 
     long totalEstimatedExportSize = 0;
     Result result;
     InternalCache cache = getCache();
     try {
-      Set<DistributedMember> targetMembers = getMembers(groups, memberIds);
-
-      if (targetMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+      Set<DistributedMember> targetMembers = getMembersIncludingLocators(groups, memberIds);
 
       long userSpecifiedLimit = parseFileSizeLimit(fileSizeLimit);
       if (userSpecifiedLimit > 0) {
@@ -201,9 +197,6 @@ public class ExportLogsCommand implements GfshCommand {
       FileUtils.deleteDirectory(tempDir.toFile());
 
       result = new CommandResult(exportedLogsZipFile);
-    } catch (Exception ex) {
-      logger.error(ex.getMessage(), ex);
-      result = ResultBuilder.createGemFireErrorResult(ex.getMessage());
     } finally {
       ExportLogsFunction.destroyExportLogsRegion(cache);
     }
@@ -216,13 +209,6 @@ public class ExportLogsCommand implements GfshCommand {
   /**
    * Wrapper to enable stubbing of static method call for unit testing
    */
-  Set<DistributedMember> getMembers(String[] groups, String[] memberIds) {
-    return CliUtil.findMembersIncludingLocators(groups, memberIds);
-  }
-
-  /**
-   * Wrapper to enable stubbing of static method call for unit testing
-   */
   ResultCollector estimateLogSize(SizeExportLogsFunction.Args args, DistributedMember member) {
     return executeFunction(new SizeExportLogsFunction(), args, member);
   }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GCCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GCCommand.java
index 4884d6d..9a039bd 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GCCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GCCommand.java
@@ -57,11 +57,7 @@ public class GCCommand implements GfshCommand {
     resultTable.setHeader(headerText);
     Set<DistributedMember> dsMembers = new HashSet<>();
     if (memberId != null && memberId.length() > 0) {
-      DistributedMember member = CliUtil.getDistributedMemberByNameOrId(memberId);
-      if (member == null) {
-        return ResultBuilder
-            .createGemFireErrorResult(memberId + CliStrings.GC__MSG__MEMBER_NOT_FOUND);
-      }
+      DistributedMember member = getMember(memberId);
       dsMembers.add(member);
       result = executeAndBuildResult(resultTable, dsMembers);
     } else if (groups != null && groups.length > 0) {
@@ -82,42 +78,38 @@ public class GCCommand implements GfshCommand {
 
   private Result executeAndBuildResult(TabularResultData resultTable,
       Set<DistributedMember> dsMembers) {
-    try {
-      List<?> resultList;
-      Function garbageCollectionFunction = new GarbageCollectionFunction();
-      resultList =
-          (List<?>) CliUtil.executeFunction(garbageCollectionFunction, null, dsMembers).getResult();
 
-      for (Object object : resultList) {
-        if (object instanceof Exception) {
-          LogWrapper.getInstance().fine("Exception in GC " + ((Throwable) object).getMessage(),
-              ((Throwable) object));
-          continue;
-        } else if (object instanceof Throwable) {
-          LogWrapper.getInstance().fine("Exception in GC " + ((Throwable) object).getMessage(),
-              ((Throwable) object));
-          continue;
-        }
+    List<?> resultList;
+    Function garbageCollectionFunction = new GarbageCollectionFunction();
+    resultList =
+        (List<?>) CliUtil.executeFunction(garbageCollectionFunction, null, dsMembers).getResult();
 
-        if (object != null) {
-          if (object instanceof String) {
-            // unexpected exception string - cache may be closed or something
-            return ResultBuilder.createUserErrorResult((String) object);
-          } else {
-            Map<String, String> resultMap = (Map<String, String>) object;
-            toTabularResultData(resultTable, resultMap.get("MemberId"),
-                resultMap.get("HeapSizeBeforeGC"), resultMap.get("HeapSizeAfterGC"),
-                resultMap.get("TimeSpentInGC"));
-          }
+    for (Object object : resultList) {
+      if (object instanceof Exception) {
+        LogWrapper.getInstance().fine("Exception in GC " + ((Throwable) object).getMessage(),
+            ((Throwable) object));
+        continue;
+      } else if (object instanceof Throwable) {
+        LogWrapper.getInstance().fine("Exception in GC " + ((Throwable) object).getMessage(),
+            ((Throwable) object));
+        continue;
+      }
+
+      if (object != null) {
+        if (object instanceof String) {
+          // unexpected exception string - cache may be closed or something
+          return ResultBuilder.createUserErrorResult((String) object);
         } else {
-          LogWrapper.getInstance().fine("ResultMap was null ");
+          Map<String, String> resultMap = (Map<String, String>) object;
+          toTabularResultData(resultTable, resultMap.get("MemberId"),
+              resultMap.get("HeapSizeBeforeGC"), resultMap.get("HeapSizeAfterGC"),
+              resultMap.get("TimeSpentInGC"));
         }
+      } else {
+        LogWrapper.getInstance().fine("ResultMap was null ");
       }
-    } catch (Exception e) {
-      String stack = CliUtil.stackTraceAsString(e);
-      LogWrapper.getInstance().info("GC exception is " + stack);
-      return ResultBuilder.createGemFireErrorResult(e.getMessage() + ": " + stack);
     }
+
     return ResultBuilder.buildResult(resultTable);
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GatewayCommandsUtils.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GatewayCommandsUtils.java
index d6e03c1..2e317cb 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GatewayCommandsUtils.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GatewayCommandsUtils.java
@@ -15,12 +15,6 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.CliUtil;
-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.CommandResultException;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
 
 public class GatewayCommandsUtils {
@@ -32,15 +26,4 @@ public class GatewayCommandsUtils {
     resultData.accumulate("Result", Status);
     resultData.accumulate("Message", message);
   }
-
-  static Result handleCommandResultException(CommandResultException crex) {
-    Result result;
-    if (crex.getResult() != null) {
-      result = crex.getResult();
-    } else {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(crex));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + crex.getMessage());
-    }
-    return result;
-  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GfshCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GfshCommand.java
index 5e2f2d8..134a153 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GfshCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/GfshCommand.java
@@ -14,13 +14,9 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
-import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.util.Collections;
-import java.util.HashSet;
 import java.util.Set;
 
-import org.apache.commons.lang.StringUtils;
 import org.springframework.shell.core.CommandMarker;
 
 import org.apache.geode.cache.CacheFactory;
@@ -33,47 +29,23 @@ import org.apache.geode.distributed.internal.ClusterConfigurationService;
 import org.apache.geode.distributed.internal.InternalLocator;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.security.SecurityService;
-import org.apache.geode.management.cli.CliMetaData;
+import org.apache.geode.management.ManagementService;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
-import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
 
 /**
  * Encapsulates common functionality for implementing command classes for the Geode shell (gfsh).
+ * this provides wrapper around the static methods in CliUtils for easy mock of the commands
  *
- * @see org.apache.geode.cache.Cache
- * @see org.apache.geode.cache.execute.FunctionService
- * @see org.apache.geode.distributed.DistributedMember
- * @see org.apache.geode.management.internal.cli.shell.Gfsh
- * @see org.springframework.shell.core.CommandMarker
+ * this class should not have much implementation of its own other then those tested in
+ * GfshCommandJUnitTest
  */
 @SuppressWarnings("unused")
 public interface GfshCommand extends CommandMarker {
 
-  default String convertDefaultValue(final String from, final String to) {
-    return CliMetaData.ANNOTATION_DEFAULT_VALUE.equals(from) ? to : from;
-  }
-
-  default String toString(final Boolean condition, final String trueValue,
-      final String falseValue) {
-    return Boolean.TRUE.equals(condition) ? StringUtils.defaultIfBlank(trueValue, "true")
-        : StringUtils.defaultIfBlank(falseValue, "false");
-  }
-
-  default String toString(final Throwable t, final boolean printStackTrace) {
-    String message = t.getMessage();
-
-    if (printStackTrace) {
-      StringWriter writer = new StringWriter();
-      t.printStackTrace(new PrintWriter(writer));
-      message = writer.toString();
-    }
-
-    return message;
-  }
-
   default boolean isConnectedAndReady() {
     return getGfsh() != null && getGfsh().isConnectedAndReady();
   }
@@ -104,7 +76,6 @@ public interface GfshCommand extends CommandMarker {
     return getGfsh() != null;
   }
 
-
   default InternalCache getCache() {
     return (InternalCache) CacheFactory.getAnyInstance();
   }
@@ -117,42 +88,84 @@ public interface GfshCommand extends CommandMarker {
     return Gfsh.getCurrentInstance();
   }
 
-  @SuppressWarnings("deprecated")
-  default DistributedMember getMember(final InternalCache cache, final String memberName) {
-    for (final DistributedMember member : getMembers(cache)) {
-      if (memberName.equalsIgnoreCase(member.getName())
-          || memberName.equalsIgnoreCase(member.getId())) {
-        return member;
-      }
+  /**
+   * this either returns a non-null member or throw an exception if member is not found.
+   */
+  default DistributedMember getMember(final String memberName) {
+    DistributedMember member = findMember(memberName);
+
+    if (member == null) {
+      throw new EntityNotFoundException(
+          CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, memberName));
     }
+    return member;
+  }
 
-    throw new MemberNotFoundException(
-        CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, memberName));
+  /**
+   * this will return the member found or null if no member with that name
+   */
+  default DistributedMember findMember(final String memberName) {
+    return CliUtil.getDistributedMemberByNameOrId(memberName);
+  }
+
+  /**
+   * Gets all members in the GemFire distributed system/cache, including locators
+   */
+  default Set<DistributedMember> getAllMembers(final InternalCache cache) {
+    return CliUtil.getAllMembers(cache);
   }
 
   /**
-   * Gets all members in the GemFire distributed system/cache.
-   *
-   * @param cache the GemFire cache.
-   * @return all members in the GemFire distributed system/cache.
-   * @see org.apache.geode.management.internal.cli.CliUtil#getAllMembers(org.apache.geode.internal.cache.InternalCache)
-   * @deprecated use CliUtil.getAllMembers(org.apache.geode.cache.Cache) instead
+   * Get All members, exclusing locators
    */
-  @Deprecated
-  default Set<DistributedMember> getMembers(final InternalCache cache) {
-    Set<DistributedMember> members = new HashSet<>(cache.getMembers());
-    members.add(cache.getDistributedSystem().getDistributedMember());
-    return members;
+  default Set<DistributedMember> getAllNormalMembers(InternalCache cache) {
+    return CliUtil.getAllNormalMembers(cache);
   }
 
   default Execution getMembersFunctionExecutor(final Set<DistributedMember> members) {
     return FunctionService.onMembers(members);
   }
 
+  /**
+   * if no members matches these names, an empty set would return
+   */
   default Set<DistributedMember> findMembers(String[] groups, String[] members) {
     return CliUtil.findMembers(groups, members);
   }
 
+  /**
+   * if no members matches these names, a UserErrorException will be thrown
+   */
+  default Set<DistributedMember> getMembers(String[] groups, String[] members) {
+    Set<DistributedMember> matchingMembers = findMembers(groups, members);
+    if (matchingMembers.size() == 0) {
+      throw new EntityNotFoundException(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
+    return matchingMembers;
+  }
+
+  /**
+   * if no members matches these names, an empty set would return
+   */
+  default Set<DistributedMember> findMembersIncludingLocators(String[] groups, String[] members) {
+    return CliUtil.findMembersIncludingLocators(groups, members);
+  }
+
+  /**
+   * if no members matches these names, a UserErrorException will be thrown
+   */
+  default Set<DistributedMember> getMembersIncludingLocators(String[] groups, String[] members) {
+    Set<DistributedMember> matchingMembers = findMembersIncludingLocators(groups, members);
+    if (matchingMembers.size() == 0) {
+      throw new EntityNotFoundException(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
+    return matchingMembers;
+  }
+
+  default ManagementService getManagementService() {
+    return ManagementService.getExistingManagementService(getCache());
+  }
+
   default Set<DistributedMember> findMembersForRegion(InternalCache cache, String regionPath) {
     return CliUtil.getRegionAssociatedMembers(regionPath, cache, true);
   }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/HistoryCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/HistoryCommand.java
index aad046b..30bc4b4 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/HistoryCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/HistoryCommand.java
@@ -27,9 +27,7 @@ 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.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.GfshParser;
-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.ErrorResultData;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
@@ -128,14 +126,8 @@ public class HistoryCommand implements GfshCommand {
   }
 
   private Result executeClearHistory() {
-    try {
-      Gfsh gfsh = Gfsh.getCurrentInstance();
-      gfsh.clearHistory();
-    } catch (Exception e) {
-      LogWrapper.getInstance().info(CliUtil.stackTraceAsString(e));
-      return ResultBuilder
-          .createGemFireErrorResult("Exception occurred while clearing history " + e.getMessage());
-    }
+    Gfsh gfsh = Gfsh.getCurrentInstance();
+    gfsh.clearHistory();
     return ResultBuilder.createInfoResult(CliStrings.HISTORY__MSG__CLEARED_HISTORY);
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ImportDataCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ImportDataCommand.java
index 7e4f1d7..608b888 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ImportDataCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ImportDataCommand.java
@@ -57,11 +57,7 @@ public class ImportDataCommand implements GfshCommand {
 
     getSecurityService().authorize(Resource.DATA, Operation.WRITE, regionName);
 
-    final DistributedMember targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
-    if (targetMember == null) {
-      return ResultBuilder.createUserErrorResult(
-          CliStrings.format(CliStrings.IMPORT_DATA__MEMBER__NOT__FOUND, memberNameOrId));
-    }
+    final DistributedMember targetMember = getMember(memberNameOrId);
 
     Optional<Result> validationResult = validatePath(filePath, dirPath, parallel);
     if (validationResult.isPresent()) {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListClientCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListClientCommand.java
index c2b6425..3f76b2c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListClientCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListClientCommand.java
@@ -29,7 +29,6 @@ import org.apache.geode.management.CacheServerMXBean;
 import org.apache.geode.management.ManagementService;
 import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.CliUtil;
 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.CompositeResultData;
@@ -43,83 +42,75 @@ public class ListClientCommand implements GfshCommand {
   @CliMetaData(relatedTopic = {CliStrings.TOPIC_CLIENT})
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
-  public Result listClient() {
+  public Result listClient() throws Exception {
     Result result;
+    CompositeResultData compositeResultData = ResultBuilder.createCompositeResultData();
+    CompositeResultData.SectionResultData section = compositeResultData.addSection("section1");
 
-    try {
-      CompositeResultData compositeResultData = ResultBuilder.createCompositeResultData();
-      CompositeResultData.SectionResultData section = compositeResultData.addSection("section1");
+    TabularResultData resultTable = section.addTable("TableForClientList");
+    String headerText = "ClientList";
+    resultTable = resultTable.setHeader(headerText);
 
-      TabularResultData resultTable = section.addTable("TableForClientList");
-      String headerText = "ClientList";
-      resultTable = resultTable.setHeader(headerText);
+    InternalCache cache = getCache();
+    ManagementService service = ManagementService.getExistingManagementService(cache);
+    ObjectName[] cacheServers = service.getDistributedSystemMXBean().listCacheServerObjectNames();
 
-      InternalCache cache = getCache();
-      ManagementService service = ManagementService.getExistingManagementService(cache);
-      ObjectName[] cacheServers = service.getDistributedSystemMXBean().listCacheServerObjectNames();
-
-      if (cacheServers.length == 0) {
-        return ResultBuilder.createGemFireErrorResult(
-            CliStrings.format(CliStrings.LIST_CLIENT_COULD_NOT_RETRIEVE_SERVER_LIST));
-      }
+    if (cacheServers.length == 0) {
+      return ResultBuilder.createGemFireErrorResult(
+          CliStrings.format(CliStrings.LIST_CLIENT_COULD_NOT_RETRIEVE_SERVER_LIST));
+    }
 
-      Map<String, List<String>> clientServerMap = new HashMap<>();
+    Map<String, List<String>> clientServerMap = new HashMap<>();
 
-      for (ObjectName objName : cacheServers) {
-        CacheServerMXBean serverMbean = service.getMBeanInstance(objName, CacheServerMXBean.class);
-        String[] listOfClient = serverMbean.getClientIds();
+    for (ObjectName objName : cacheServers) {
+      CacheServerMXBean serverMbean = service.getMBeanInstance(objName, CacheServerMXBean.class);
+      String[] listOfClient = serverMbean.getClientIds();
 
-        if (listOfClient == null || listOfClient.length == 0) {
-          continue;
-        }
+      if (listOfClient == null || listOfClient.length == 0) {
+        continue;
+      }
 
 
-        for (String clientName : listOfClient) {
-          String serverDetails = "member=" + objName.getKeyProperty("member") + ",port="
-              + objName.getKeyProperty("port");
-          if (clientServerMap.containsKey(clientName)) {
-            List<String> listServers = clientServerMap.get(clientName);
-            listServers.add(serverDetails);
-          } else {
-            List<String> listServer = new ArrayList<>();
-            listServer.add(serverDetails);
-            clientServerMap.put(clientName, listServer);
-          }
+      for (String clientName : listOfClient) {
+        String serverDetails = "member=" + objName.getKeyProperty("member") + ",port="
+            + objName.getKeyProperty("port");
+        if (clientServerMap.containsKey(clientName)) {
+          List<String> listServers = clientServerMap.get(clientName);
+          listServers.add(serverDetails);
+        } else {
+          List<String> listServer = new ArrayList<>();
+          listServer.add(serverDetails);
+          clientServerMap.put(clientName, listServer);
         }
       }
+    }
 
-      if (clientServerMap.size() == 0) {
-        return ResultBuilder.createGemFireErrorResult(
-            CliStrings.format(CliStrings.LIST_COULD_NOT_RETRIEVE_CLIENT_LIST));
-      }
+    if (clientServerMap.size() == 0) {
+      return ResultBuilder.createGemFireErrorResult(
+          CliStrings.format(CliStrings.LIST_COULD_NOT_RETRIEVE_CLIENT_LIST));
+    }
 
-      String memberSeparator = ";  ";
-
-      for (Map.Entry<String, List<String>> pairs : clientServerMap.entrySet()) {
-        String client = pairs.getKey();
-        List<String> servers = pairs.getValue();
-        StringBuilder serverListForClient = new StringBuilder();
-        int serversSize = servers.size();
-        int i = 0;
-        for (String server : servers) {
-          serverListForClient.append(server);
-          if (i < serversSize - 1) {
-            serverListForClient.append(memberSeparator);
-          }
-          i++;
+    String memberSeparator = ";  ";
+
+    for (Map.Entry<String, List<String>> pairs : clientServerMap.entrySet()) {
+      String client = pairs.getKey();
+      List<String> servers = pairs.getValue();
+      StringBuilder serverListForClient = new StringBuilder();
+      int serversSize = servers.size();
+      int i = 0;
+      for (String server : servers) {
+        serverListForClient.append(server);
+        if (i < serversSize - 1) {
+          serverListForClient.append(memberSeparator);
         }
-        resultTable.accumulate(CliStrings.LIST_CLIENT_COLUMN_Clients, client);
-        resultTable.accumulate(CliStrings.LIST_CLIENT_COLUMN_SERVERS,
-            serverListForClient.toString());
+        i++;
       }
-      result = ResultBuilder.buildResult(compositeResultData);
-
-    } catch (Exception e) {
-      LogWrapper.getInstance()
-          .warning("Error in list clients. stack trace" + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings
-          .format(CliStrings.LIST_CLIENT_COULD_NOT_RETRIEVE_CLIENT_LIST_0, e.getMessage()));
+      resultTable.accumulate(CliStrings.LIST_CLIENT_COLUMN_Clients, client);
+      resultTable.accumulate(CliStrings.LIST_CLIENT_COLUMN_SERVERS, serverListForClient.toString());
     }
+    result = ResultBuilder.buildResult(compositeResultData);
+
+
 
     LogWrapper.getInstance().info("list client result " + result);
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListDiskStoresCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListDiskStoresCommand.java
index 5444c4d..e65d4fb 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListDiskStoresCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListDiskStoresCommand.java
@@ -22,9 +22,7 @@ import java.util.Set;
 
 import org.springframework.shell.core.annotation.CliCommand;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.FunctionInvocationTargetException;
 import org.apache.geode.cache.execute.ResultCollector;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.cache.execute.AbstractExecution;
@@ -45,25 +43,12 @@ public class ListDiskStoresCommand implements GfshCommand {
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
   public Result listDiskStores() {
-    try {
-      Set<DistributedMember> dataMembers = DiskStoreCommandsUtils.getNormalMembers(getCache());
+    Set<DistributedMember> dataMembers = DiskStoreCommandsUtils.getNormalMembers(getCache());
 
-      if (dataMembers.isEmpty()) {
-        return ResultBuilder.createInfoResult(CliStrings.NO_CACHING_MEMBERS_FOUND_MESSAGE);
-      }
-
-      return toTabularResult(getDiskStoreListing(dataMembers));
-    } catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings
-          .format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.LIST_DISK_STORE));
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      return ResultBuilder.createGemFireErrorResult(
-          String.format(CliStrings.LIST_DISK_STORE__ERROR_MESSAGE, toString(t, isDebugging())));
+    if (dataMembers.isEmpty()) {
+      return ResultBuilder.createInfoResult(CliStrings.NO_CACHING_MEMBERS_FOUND_MESSAGE);
     }
+    return toTabularResult(getDiskStoreListing(dataMembers));
   }
 
   @SuppressWarnings("unchecked")
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommand.java
index 81fa027..24b2efd 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommand.java
@@ -35,8 +35,6 @@ import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.MBeanJMXAdapter;
 import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.management.internal.cli.CliUtil;
-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.CompositeResultData;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
@@ -55,71 +53,66 @@ public class ListGatewayCommand implements GfshCommand {
           help = CliStrings.LIST_GATEWAY__MEMBER__HELP) String[] onMember,
       @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
           optionContext = ConverterHint.MEMBERGROUP,
-          help = CliStrings.LIST_GATEWAY__GROUP__HELP) String[] onGroup) {
+          help = CliStrings.LIST_GATEWAY__GROUP__HELP) String[] onGroup)
+      throws Exception {
 
     Result result;
     InternalCache cache = getCache();
-    try {
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    Set<DistributedMember> dsMembers = findMembers(onGroup, onMember);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
 
-      Map<String, Map<String, GatewaySenderMXBean>> gatewaySenderBeans = new TreeMap<>();
-      Map<String, GatewayReceiverMXBean> gatewayReceiverBeans = new TreeMap<>();
+    Map<String, Map<String, GatewaySenderMXBean>> gatewaySenderBeans = new TreeMap<>();
+    Map<String, GatewayReceiverMXBean> gatewayReceiverBeans = new TreeMap<>();
 
-      DistributedSystemMXBean dsMXBean = service.getDistributedSystemMXBean();
-      for (DistributedMember member : dsMembers) {
-        String memberName = member.getName();
-        String memberNameOrId =
-            (memberName != null && !memberName.isEmpty()) ? memberName : member.getId();
-        ObjectName gatewaySenderObjectNames[] =
-            dsMXBean.listGatewaySenderObjectNames(memberNameOrId);
-        // gateway senders : a member can have multiple gateway senders defined
-        // on it
-        if (gatewaySenderObjectNames != null) {
-          for (ObjectName name : gatewaySenderObjectNames) {
-            GatewaySenderMXBean senderBean = service.getMBeanProxy(name, GatewaySenderMXBean.class);
-            if (senderBean != null) {
-              if (gatewaySenderBeans.containsKey(senderBean.getSenderId())) {
-                Map<String, GatewaySenderMXBean> memberToBeanMap =
-                    gatewaySenderBeans.get(senderBean.getSenderId());
-                memberToBeanMap.put(member.getId(), senderBean);
-              } else {
-                Map<String, GatewaySenderMXBean> memberToBeanMap = new TreeMap<>();
-                memberToBeanMap.put(member.getId(), senderBean);
-                gatewaySenderBeans.put(senderBean.getSenderId(), memberToBeanMap);
-              }
+    DistributedSystemMXBean dsMXBean = service.getDistributedSystemMXBean();
+    for (DistributedMember member : dsMembers) {
+      String memberName = member.getName();
+      String memberNameOrId =
+          (memberName != null && !memberName.isEmpty()) ? memberName : member.getId();
+      ObjectName gatewaySenderObjectNames[] = dsMXBean.listGatewaySenderObjectNames(memberNameOrId);
+      // gateway senders : a member can have multiple gateway senders defined
+      // on it
+      if (gatewaySenderObjectNames != null) {
+        for (ObjectName name : gatewaySenderObjectNames) {
+          GatewaySenderMXBean senderBean = service.getMBeanProxy(name, GatewaySenderMXBean.class);
+          if (senderBean != null) {
+            if (gatewaySenderBeans.containsKey(senderBean.getSenderId())) {
+              Map<String, GatewaySenderMXBean> memberToBeanMap =
+                  gatewaySenderBeans.get(senderBean.getSenderId());
+              memberToBeanMap.put(member.getId(), senderBean);
+            } else {
+              Map<String, GatewaySenderMXBean> memberToBeanMap = new TreeMap<>();
+              memberToBeanMap.put(member.getId(), senderBean);
+              gatewaySenderBeans.put(senderBean.getSenderId(), memberToBeanMap);
             }
           }
         }
-        // gateway receivers : a member can have only one gateway receiver
-        ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
-        if (gatewayReceiverObjectName != null) {
-          GatewayReceiverMXBean receiverBean;
-          receiverBean =
-              service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
-          if (receiverBean != null) {
-            gatewayReceiverBeans.put(member.getId(), receiverBean);
-          }
-        }
       }
-      if (gatewaySenderBeans.isEmpty() && gatewayReceiverBeans.isEmpty()) {
-        return ResultBuilder
-            .createUserErrorResult(CliStrings.GATEWAYS_ARE_NOT_AVAILABLE_IN_CLUSTER);
+      // gateway receivers : a member can have only one gateway receiver
+      ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
+      if (gatewayReceiverObjectName != null) {
+        GatewayReceiverMXBean receiverBean;
+        receiverBean =
+            service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
+        if (receiverBean != null) {
+          gatewayReceiverBeans.put(member.getId(), receiverBean);
+        }
       }
-      CompositeResultData crd = ResultBuilder.createCompositeResultData();
-      crd.setHeader(CliStrings.HEADER_GATEWAYS);
-      accumulateListGatewayResult(crd, gatewaySenderBeans, gatewayReceiverBeans);
-      result = ResultBuilder.buildResult(crd);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
     }
+    if (gatewaySenderBeans.isEmpty() && gatewayReceiverBeans.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.GATEWAYS_ARE_NOT_AVAILABLE_IN_CLUSTER);
+    }
+    CompositeResultData crd = ResultBuilder.createCompositeResultData();
+    crd.setHeader(CliStrings.HEADER_GATEWAYS);
+    accumulateListGatewayResult(crd, gatewaySenderBeans, gatewayReceiverBeans);
+    result = ResultBuilder.buildResult(crd);
+
     return result;
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListIndexCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListIndexCommand.java
index 48eee68..663d185 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListIndexCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListIndexCommand.java
@@ -23,9 +23,7 @@ import java.util.Set;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.FunctionInvocationTargetException;
 import org.apache.geode.cache.execute.ResultCollector;
 import org.apache.geode.internal.cache.execute.AbstractExecution;
 import org.apache.geode.internal.lang.StringUtils;
@@ -48,20 +46,8 @@ public class ListIndexCommand implements GfshCommand {
   public Result listIndex(@CliOption(key = CliStrings.LIST_INDEX__STATS,
       specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
       help = CliStrings.LIST_INDEX__STATS__HELP) final boolean showStats) {
-    try {
-      return toTabularResult(getIndexListing(), showStats);
-    } catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(
-          CliStrings.format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.LIST_INDEX));
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      getCache().getLogger().error(t);
-      return ResultBuilder.createGemFireErrorResult(
-          String.format(CliStrings.LIST_INDEX__ERROR_MESSAGE, toString(t, isDebugging())));
-    }
+
+    return toTabularResult(getIndexListing(), showStats);
   }
 
   private Result toTabularResult(final List<IndexDetails> indexDetailsList,
@@ -103,7 +89,7 @@ public class ListIndexCommand implements GfshCommand {
   }
 
   List<IndexDetails> getIndexListing() {
-    final Execution functionExecutor = getMembersFunctionExecutor(getMembers(getCache()));
+    final Execution functionExecutor = getMembersFunctionExecutor(getAllMembers(getCache()));
 
     if (functionExecutor instanceof AbstractExecution) {
       ((AbstractExecution) functionExecutor).setIgnoreDepartedMembers(true);
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LoadBalanceGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LoadBalanceGatewaySenderCommand.java
index c076ba2..b091de5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LoadBalanceGatewaySenderCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LoadBalanceGatewaySenderCommand.java
@@ -31,7 +31,6 @@ import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.management.internal.cli.CliUtil;
-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.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
@@ -54,49 +53,43 @@ public class LoadBalanceGatewaySenderCommand implements GfshCommand {
       senderId = senderId.trim();
     }
 
-    try {
-      InternalCache cache = getCache();
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
-      TabularResultData resultData = ResultBuilder.createTabularResultData();
-      Set<DistributedMember> dsMembers = CliUtil.getAllNormalMembers(cache);
+    InternalCache cache = getCache();
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    TabularResultData resultData = ResultBuilder.createTabularResultData();
+    Set<DistributedMember> dsMembers = CliUtil.getAllNormalMembers(cache);
 
-      if (dsMembers.isEmpty()) {
-        result = ResultBuilder.createInfoResult(CliStrings.GATEWAY_MSG_MEMBERS_NOT_FOUND);
-      } else {
-        boolean gatewaySenderExists = false;
-        for (DistributedMember member : dsMembers) {
-          GatewaySenderMXBean bean;
-          if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
-            bean = service.getLocalGatewaySenderMXBean(senderId);
-          } else {
-            ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
-            bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
-          }
-          if (bean != null) {
-            gatewaySenderExists = true;
-            bean.rebalance();
-            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                CliStrings.GATEWAY_OK,
-                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_REBALANCED_ON_MEMBER_1, senderId,
-                    member.getId()));
-          } else {
-            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                CliStrings.GATEWAY_ERROR,
-                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1,
-                    senderId, member.getId()));
-          }
+    if (dsMembers.isEmpty()) {
+      result = ResultBuilder.createInfoResult(CliStrings.GATEWAY_MSG_MEMBERS_NOT_FOUND);
+    } else {
+      boolean gatewaySenderExists = false;
+      for (DistributedMember member : dsMembers) {
+        GatewaySenderMXBean bean;
+        if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
+          bean = service.getLocalGatewaySenderMXBean(senderId);
+        } else {
+          ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
+          bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
         }
-        if (gatewaySenderExists) {
-          result = ResultBuilder.buildResult(resultData);
+        if (bean != null) {
+          gatewaySenderExists = true;
+          bean.rebalance();
+          GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+              CliStrings.GATEWAY_OK, CliStrings.format(
+                  CliStrings.GATEWAY_SENDER_0_IS_REBALANCED_ON_MEMBER_1, senderId, member.getId()));
         } else {
-          result = ResultBuilder.createInfoResult(CliStrings.format(
-              CliStrings.GATEWAY_SENDER_0_IS_NOT_FOUND_ON_ANY_MEMBER, new Object[] {senderId}));
+          GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+              CliStrings.GATEWAY_ERROR,
+              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+                  member.getId()));
         }
       }
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
+      if (gatewaySenderExists) {
+        result = ResultBuilder.buildResult(resultData);
+      } else {
+        result = ResultBuilder.createInfoResult(CliStrings.format(
+            CliStrings.GATEWAY_SENDER_0_IS_NOT_FOUND_ON_ANY_MEMBER, new Object[] {senderId}));
+      }
     }
 
     return result;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LocateEntryCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LocateEntryCommand.java
index 1d1aa4b..dcccffc 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LocateEntryCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/LocateEntryCommand.java
@@ -49,7 +49,7 @@ public class LocateEntryCommand implements GfshCommand {
       @CliOption(key = {CliStrings.LOCATE_ENTRY__VALUEKLASS},
           help = CliStrings.LOCATE_ENTRY__VALUEKLASS__HELP) String valueClass,
       @CliOption(key = {CliStrings.LOCATE_ENTRY__RECURSIVE},
-          help = CliStrings.LOCATE_ENTRY__RECURSIVE__HELP,
+          help = CliStrings.LOCATE_ENTRY__RECURSIVE__HELP, specifiedDefaultValue = "true",
           unspecifiedDefaultValue = "false") boolean recursive) {
 
     getSecurityService().authorize(Resource.DATA, Operation.READ, regionPath, key);
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PauseGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PauseGatewaySenderCommand.java
index 60124eb..8ee9e8f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PauseGatewaySenderCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PauseGatewaySenderCommand.java
@@ -30,8 +30,6 @@ import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.management.internal.cli.CliUtil;
-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.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
@@ -61,59 +59,55 @@ public class PauseGatewaySenderCommand implements GfshCommand {
       senderId = senderId.trim();
     }
 
-    try {
-      InternalCache cache = getCache();
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    InternalCache cache = getCache();
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      GatewaySenderMXBean bean;
+    GatewaySenderMXBean bean;
 
-      TabularResultData resultData = ResultBuilder.createTabularResultData();
+    TabularResultData resultData = ResultBuilder.createTabularResultData();
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    Set<DistributedMember> dsMembers = findMembers(onGroup, onMember);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
 
-      for (DistributedMember member : dsMembers) {
-        if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
-          bean = service.getLocalGatewaySenderMXBean(senderId);
-        } else {
-          ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
-          bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
-        }
-        if (bean != null) {
-          if (bean.isRunning()) {
-            if (bean.isPaused()) {
-              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                  CliStrings.GATEWAY_ERROR,
-                  CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_ALREADY_PAUSED_ON_MEMBER_1,
-                      senderId, member.getId()));
-            } else {
-              bean.pause();
-              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                  CliStrings.GATEWAY_OK, CliStrings.format(
-                      CliStrings.GATEWAY_SENDER_0_IS_PAUSED_ON_MEMBER_1, senderId, member.getId()));
-            }
-          } else {
+    for (DistributedMember member : dsMembers) {
+      if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
+        bean = service.getLocalGatewaySenderMXBean(senderId);
+      } else {
+        ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
+        bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
+      }
+      if (bean != null) {
+        if (bean.isRunning()) {
+          if (bean.isPaused()) {
             GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
                 CliStrings.GATEWAY_ERROR,
-                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, senderId,
-                    member.getId()));
+                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_ALREADY_PAUSED_ON_MEMBER_1,
+                    senderId, member.getId()));
+          } else {
+            bean.pause();
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_OK, CliStrings.format(
+                    CliStrings.GATEWAY_SENDER_0_IS_PAUSED_ON_MEMBER_1, senderId, member.getId()));
           }
         } else {
           GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
               CliStrings.GATEWAY_ERROR,
-              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, senderId,
                   member.getId()));
         }
+      } else {
+        GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+            CliStrings.GATEWAY_ERROR,
+            CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+                member.getId()));
       }
-      result = ResultBuilder.buildResult(resultData);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
     }
+    result = ResultBuilder.buildResult(resultData);
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PutCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PutCommand.java
index ca167a9..af35e7c 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PutCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/PutCommand.java
@@ -53,7 +53,7 @@ public class PutCommand implements GfshCommand {
       @CliOption(key = {CliStrings.PUT__VALUEKLASS},
           help = CliStrings.PUT__VALUEKLASS__HELP) String valueClass,
       @CliOption(key = {CliStrings.PUT__PUTIFABSENT}, help = CliStrings.PUT__PUTIFABSENT__HELP,
-          unspecifiedDefaultValue = "false") boolean putIfAbsent) {
+          specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") boolean putIfAbsent) {
 
     InternalCache cache = getCache();
     cache.getSecurityService().authorize(Resource.DATA, Operation.WRITE, regionPath);
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ResumeGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ResumeGatewaySenderCommand.java
index b6a49c9..3407027 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ResumeGatewaySenderCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ResumeGatewaySenderCommand.java
@@ -31,7 +31,6 @@ import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.management.internal.cli.CliUtil;
-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.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
@@ -60,60 +59,55 @@ public class ResumeGatewaySenderCommand implements GfshCommand {
       senderId = senderId.trim();
     }
 
-    try {
-      InternalCache cache = getCache();
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    InternalCache cache = getCache();
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      GatewaySenderMXBean bean;
+    GatewaySenderMXBean bean;
 
-      TabularResultData resultData = ResultBuilder.createTabularResultData();
+    TabularResultData resultData = ResultBuilder.createTabularResultData();
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
 
-      for (DistributedMember member : dsMembers) {
-        if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
-          bean = service.getLocalGatewaySenderMXBean(senderId);
-        } else {
-          ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
-          bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
-        }
-        if (bean != null) {
-          if (bean.isRunning()) {
-            if (bean.isPaused()) {
-              bean.resume();
-              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                  CliStrings.GATEWAY_OK,
-                  CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_RESUMED_ON_MEMBER_1, senderId,
-                      member.getId()));
-            } else {
-              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                  CliStrings.GATEWAY_ERROR,
-                  CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_PAUSED_ON_MEMBER_1, senderId,
-                      member.getId()));
-            }
+    for (DistributedMember member : dsMembers) {
+      if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
+        bean = service.getLocalGatewaySenderMXBean(senderId);
+      } else {
+        ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
+        bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
+      }
+      if (bean != null) {
+        if (bean.isRunning()) {
+          if (bean.isPaused()) {
+            bean.resume();
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_OK, CliStrings.format(
+                    CliStrings.GATEWAY_SENDER_0_IS_RESUMED_ON_MEMBER_1, senderId, member.getId()));
           } else {
             GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
                 CliStrings.GATEWAY_ERROR,
-                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, senderId,
+                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_PAUSED_ON_MEMBER_1, senderId,
                     member.getId()));
           }
         } else {
           GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
               CliStrings.GATEWAY_ERROR,
-              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, senderId,
                   member.getId()));
         }
+      } else {
+        GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+            CliStrings.GATEWAY_ERROR,
+            CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+                member.getId()));
       }
-      result = ResultBuilder.buildResult(resultData);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
     }
+    result = ResultBuilder.buildResult(resultData);
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowLogCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowLogCommand.java
index 9694ad2..0701469 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowLogCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowLogCommand.java
@@ -29,7 +29,6 @@ import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.ManagementConstants;
 import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.ErrorResultData;
 import org.apache.geode.management.internal.cli.result.InfoResultData;
@@ -48,47 +47,33 @@ public class ShowLogCommand implements GfshCommand {
       @CliOption(key = CliStrings.SHOW_LOG_LINE_NUM, unspecifiedDefaultValue = "0",
           help = CliStrings.SHOW_LOG_LINE_NUM_HELP) int numberOfLines) {
     Result result;
-    try {
-      InternalCache cache = getCache();
 
-      DistributedMember targetMember = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
-      if (targetMember == null) {
-        ErrorResultData errorResultData =
-            ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT)
-                .addLine(memberNameOrId + " " + CliStrings.SHOW_LOG_MSG_MEMBER_NOT_FOUND);
-        return (ResultBuilder.buildResult(errorResultData));
-      }
-
-      MemberMXBean targetMemberMXBean = getMemberMxBean(cache, targetMember);
+    InternalCache cache = getCache();
+    DistributedMember targetMember = getMember(memberNameOrId);
+    MemberMXBean targetMemberMXBean = getMemberMxBean(cache, targetMember);
 
-      if (numberOfLines > ManagementConstants.MAX_SHOW_LOG_LINES) {
-        numberOfLines = ManagementConstants.MAX_SHOW_LOG_LINES;
-      }
-      if (numberOfLines == 0 || numberOfLines < 0) {
-        numberOfLines = ManagementConstants.DEFAULT_SHOW_LOG_LINES;
-      }
-      InfoResultData resultData = ResultBuilder.createInfoResultData();
-      if (targetMemberMXBean != null) {
-        String log = targetMemberMXBean.showLog(numberOfLines);
-        if (log != null) {
-          resultData.addLine(log);
-        } else {
-          resultData.addLine(CliStrings.SHOW_LOG_NO_LOG);
-        }
+    if (numberOfLines > ManagementConstants.MAX_SHOW_LOG_LINES) {
+      numberOfLines = ManagementConstants.MAX_SHOW_LOG_LINES;
+    }
+    if (numberOfLines == 0 || numberOfLines < 0) {
+      numberOfLines = ManagementConstants.DEFAULT_SHOW_LOG_LINES;
+    }
+    InfoResultData resultData = ResultBuilder.createInfoResultData();
+    if (targetMemberMXBean != null) {
+      String log = targetMemberMXBean.showLog(numberOfLines);
+      if (log != null) {
+        resultData.addLine(log);
       } else {
-        ErrorResultData errorResultData =
-            ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT)
-                .addLine(memberNameOrId + CliStrings.SHOW_LOG_MSG_MEMBER_NOT_FOUND);
-        return (ResultBuilder.buildResult(errorResultData));
+        resultData.addLine(CliStrings.SHOW_LOG_NO_LOG);
       }
-
-      result = ResultBuilder.buildResult(resultData);
-
-    } catch (Exception e) {
-      result = ResultBuilder
-          .createGemFireErrorResult(CliStrings.SHOW_LOG_ERROR + CliUtil.stackTraceAsString(e));
+    } else {
+      ErrorResultData errorResultData =
+          ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT)
+              .addLine(memberNameOrId + CliStrings.SHOW_LOG_MSG_MEMBER_NOT_FOUND);
+      return (ResultBuilder.buildResult(errorResultData));
     }
-    return result;
+
+    return ResultBuilder.buildResult(resultData);
   }
 
   public MemberMXBean getMemberMxBean(InternalCache cache, DistributedMember targetMember) {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java
index 74f88ce..bf303f5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommand.java
@@ -15,21 +15,22 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import java.util.Collections;
-import java.util.HashMap;
+import java.util.Arrays;
 import java.util.HashSet;
-import java.util.Map;
+import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 import javax.management.ObjectName;
 
-import org.apache.logging.log4j.Logger;
+import org.apache.commons.lang.ArrayUtils;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.CacheServerMXBean;
 import org.apache.geode.management.DistributedRegionMXBean;
 import org.apache.geode.management.DistributedSystemMXBean;
@@ -42,9 +43,6 @@ import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.MBeanJMXAdapter;
 import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
-import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.GfshParseResult;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.CompositeResultData;
 import org.apache.geode.management.internal.cli.result.ErrorResultData;
@@ -56,11 +54,51 @@ import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
 public class ShowMetricsCommand implements GfshCommand {
-  private static final Logger logger = LogService.getLogger();
+  enum Category {
+    cache,
+    cacheserver,
+    callback,
+    cluster,
+    communication,
+    diskstore,
+    distribution,
+    eviction,
+    function,
+    jvm,
+    lock,
+    offheap,
+    member,
+    notification,
+    partition,
+    query,
+    region,
+    serialization,
+    transaction
+  }
+
+  static final List<Category> REGION_METRIC_CATEGORIES = Arrays.asList(Category.callback,
+      Category.diskstore, Category.eviction, Category.partition, Category.region);
+
+  static final List<Category> SYSTEM_METRIC_CATEGORIES =
+      Arrays.asList(Category.cache, Category.cluster, Category.diskstore, Category.query);
+
+  static final List<Category> SYSTEM_REGION_METRIC_CATEGORIES = Arrays.asList(Category.callback,
+      Category.cluster, Category.diskstore, Category.eviction, Category.partition, Category.region);
+
+  static final List<Category> MEMBER_METRIC_CATEGORIES =
+      Arrays.asList(Category.communication, Category.diskstore, Category.distribution,
+          Category.eviction, Category.function, Category.jvm, Category.lock, Category.member,
+          Category.offheap, Category.region, Category.serialization, Category.transaction);
+
+  static final List<Category> MEMBER_WITH_PORT_METRIC_CATEGORIES =
+      Arrays.asList(Category.cacheserver, Category.communication, Category.diskstore,
+          Category.distribution, Category.eviction, Category.function, Category.jvm, Category.lock,
+          Category.member, Category.notification, Category.offheap, Category.query, Category.region,
+          Category.serialization, Category.transaction);
 
   @CliCommand(value = CliStrings.SHOW_METRICS, help = CliStrings.SHOW_METRICS__HELP)
   @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_STATISTICS},
-      interceptor = "org.apache.geode.management.internal.cli.commands.ShowMetricsCommand$Interceptor")
+      interceptor = "org.apache.geode.management.internal.cli.commands.ShowMetricsInterceptor")
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
   public Result showMetrics(
@@ -71,75 +109,30 @@ public class ShowMetricsCommand implements GfshCommand {
       @CliOption(key = {CliStrings.SHOW_METRICS__FILE},
           help = CliStrings.SHOW_METRICS__FILE__HELP) String export_to_report_to,
       @CliOption(key = {CliStrings.SHOW_METRICS__CACHESERVER__PORT},
-          help = CliStrings.SHOW_METRICS__CACHESERVER__PORT__HELP) String cacheServerPortString,
+          help = CliStrings.SHOW_METRICS__CACHESERVER__PORT__HELP) Integer rawCacheServerPort,
       @CliOption(key = {CliStrings.SHOW_METRICS__CATEGORY},
           help = CliStrings.SHOW_METRICS__CATEGORY__HELP) String[] categories) {
 
-    Result result;
-    DistributedMember member = null;
-    if (memberNameOrId != null) {
-      member = CliUtil.getDistributedMemberByNameOrId(memberNameOrId);
-      if (member == null) {
-        return ResultBuilder.createGemFireErrorResult(
-            CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, memberNameOrId));
-      }
-    }
-
-    if (regionName != null) {
-      if (memberNameOrId != null) {
-        result = ResultBuilder.buildResult(
-            getRegionMetricsFromMember(regionName, member, export_to_report_to, categories));
-      } else {
-        result = ResultBuilder
-            .buildResult(getDistributedRegionMetrics(regionName, export_to_report_to, categories));
-      }
+    DistributedMember member = memberNameOrId == null ? null : getMember(memberNameOrId);
+    StringBuilder csvBuilder =
+        StringUtils.isEmpty(export_to_report_to) ? null : prepareCsvBuilder();
+
+    ResultData resultData;
+    if (regionName != null && memberNameOrId != null) {
+      resultData = getRegionMetricsFromMember(regionName, member, export_to_report_to, categories,
+          csvBuilder);
+    } else if (regionName != null) {
+      resultData =
+          getDistributedRegionMetrics(regionName, export_to_report_to, categories, csvBuilder);
     } else if (memberNameOrId != null) {
-      int cacheServerPort = -1;
-      if (cacheServerPortString != null) {
-        cacheServerPort = Integer.parseInt(cacheServerPortString);
-      }
-      result = ResultBuilder
-          .buildResult(getMemberMetrics(member, export_to_report_to, categories, cacheServerPort));
+      int cacheServerPort = rawCacheServerPort == null ? -1 : rawCacheServerPort;
+      resultData =
+          getMemberMetrics(member, export_to_report_to, categories, cacheServerPort, csvBuilder);
     } else {
-      result = ResultBuilder.buildResult(getSystemWideMetrics(export_to_report_to, categories));
+      resultData = getSystemWideMetrics(export_to_report_to, categories, csvBuilder);
     }
 
-    return result;
-  }
-
-  public static class Interceptor extends AbstractCliAroundInterceptor {
-    @Override
-    public Result preExecution(GfshParseResult parseResult) {
-      String export_to_report_to = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__FILE);
-      if (export_to_report_to != null && !export_to_report_to.endsWith(".csv")) {
-        return ResultBuilder
-            .createUserErrorResult(CliStrings.format(CliStrings.INVALID_FILE_EXTENSION, ".csv"));
-      }
-
-      String regionName = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__REGION);
-      String port = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__CACHESERVER__PORT);
-
-      if (port != null) {
-        try {
-          Integer.parseInt(port);
-        } catch (NumberFormatException nfe) {
-          return ResultBuilder.createUserErrorResult("Invalid port");
-        }
-      }
-
-      if (regionName != null && port != null) {
-        return ResultBuilder.createUserErrorResult(
-            CliStrings.SHOW_METRICS__CANNOT__USE__REGION__WITH__CACHESERVERPORT);
-      }
-
-      String member = parseResult.getParamValueAsString(CliStrings.MEMBER);
-      if (port != null && member == null) {
-        return ResultBuilder
-            .createUserErrorResult(CliStrings.SHOW_METRICS__CANNOT__USE__CACHESERVERPORT);
-      }
-
-      return ResultBuilder.createInfoResult("OK");
-    }
+    return ResultBuilder.buildResult(resultData);
   }
 
   /**
@@ -148,101 +141,33 @@ public class ShowMetricsCommand implements GfshCommand {
    * @return ResultData with required System wide statistics or ErrorResultData if DS MBean is not
    *         found to gather metrics
    */
-  private ResultData getSystemWideMetrics(String export_to_report_to, String[] categoriesArr) {
+  private ResultData getSystemWideMetrics(String export_to_report_to, String[] categoriesArr,
+      StringBuilder csvBuilder) {
     final InternalCache cache = getCache();
     final ManagementService managementService = ManagementService.getManagementService(cache);
     DistributedSystemMXBean dsMxBean = managementService.getDistributedSystemMXBean();
-    StringBuilder csvBuilder = null;
-    if (dsMxBean != null) {
-
-      if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
-        csvBuilder = new StringBuilder();
-        csvBuilder.append("Category");
-        csvBuilder.append(',');
-        csvBuilder.append(CliStrings.SHOW_METRICS__METRIC__HEADER);
-        csvBuilder.append(',');
-        csvBuilder.append(CliStrings.SHOW_METRICS__VALUE__HEADER);
-        csvBuilder.append('\n');
-      }
-
-      CompositeResultData crd = ResultBuilder.createCompositeResultData();
-      CompositeResultData.SectionResultData section = crd.addSection();
-      TabularResultData metricsTable = section.addTable();
-      Map<String, Boolean> categoriesMap = getSystemMetricsCategories();
-
-      if (categoriesArr != null && categoriesArr.length != 0) {
-        Set<String> categories = createSet(categoriesArr);
-        Set<String> checkSet = new HashSet<>(categoriesMap.keySet());
-        Set<String> userCategories = getSetDifference(categories, checkSet);
-
-        // Checking if the categories specified by the user are valid or not
-
-        if (userCategories.isEmpty()) {
-          for (String category : checkSet) {
-            categoriesMap.put(category, false);
-          }
-          for (String category : categories) {
-            categoriesMap.put(category.toLowerCase(), true);
-          }
-        } else {
-          StringBuilder sb = new StringBuilder();
-          sb.append("Invalid Categories\n");
-
-          for (String category : userCategories) {
-            sb.append(category);
-            sb.append('\n');
-          }
-          return ResultBuilder.createErrorResultData().addLine(sb.toString());
-        }
-      }
-      metricsTable.setHeader("Cluster-wide Metrics");
-
-      if (categoriesMap.get("cluster")) {
-        writeToTableAndCsv(metricsTable, "cluster", "totalHeapSize", dsMxBean.getTotalHeapSize(),
-            csvBuilder);
-      }
+    if (dsMxBean == null) {
+      String errorMessage =
+          CliStrings.format(CliStrings.SHOW_METRICS__ERROR, "Distributed System MBean not found");
+      return ResultBuilder.createErrorResultData().addLine(errorMessage);
+    }
 
-      if (categoriesMap.get("cache")) {
-        writeToTableAndCsv(metricsTable, "cache", "totalRegionEntryCount",
-            dsMxBean.getTotalRegionEntryCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalRegionCount", dsMxBean.getTotalRegionCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalMissCount", dsMxBean.getTotalMissCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalHitCount", dsMxBean.getTotalHitCount(),
-            csvBuilder);
-      }
+    CompositeResultData crd = ResultBuilder.createCompositeResultData();
+    CompositeResultData.SectionResultData section = crd.addSection();
+    TabularResultData metricsTable = section.addTable();
 
-      if (categoriesMap.get("diskstore")) {
-        writeToTableAndCsv(metricsTable, "diskstore", "totalDiskUsage",
-            dsMxBean.getTotalDiskUsage(), csvBuilder); // deadcoded to workaround bug 46397
-        writeToTableAndCsv(metricsTable, ""/* 46608 */, "diskReadsRate",
-            dsMxBean.getDiskReadsRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "diskWritesRate", dsMxBean.getDiskWritesRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "flushTimeAvgLatency",
-            dsMxBean.getDiskFlushAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalBackupInProgress",
-            dsMxBean.getTotalBackupInProgress(), csvBuilder);
-      }
+    Set<Category> categoriesToDisplay = ArrayUtils.isNotEmpty(categoriesArr)
+        ? getCategorySet(categoriesArr) : new HashSet<>(SYSTEM_METRIC_CATEGORIES);
 
-      if (categoriesMap.get("query")) {
-        writeToTableAndCsv(metricsTable, "query", "activeCQCount", dsMxBean.getActiveCQCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "queryRequestRate", dsMxBean.getQueryRequestRate(),
-            csvBuilder);
-      }
-      if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
-        crd.addAsFile(export_to_report_to, csvBuilder.toString(),
-            "Cluster wide metrics exported to {0}.", false);
-      }
+    metricsTable.setHeader("Cluster-wide Metrics");
 
-      return crd;
-    } else {
-      String errorMessage =
-          CliStrings.format(CliStrings.SHOW_METRICS__ERROR, "Distributed System MBean not found");
-      return ResultBuilder.createErrorResultData().addLine(errorMessage);
+    writeSystemWideMetricValues(dsMxBean, csvBuilder, metricsTable, categoriesToDisplay);
+    if (StringUtils.isNotEmpty(export_to_report_to)) {
+      crd.addAsFile(export_to_report_to, csvBuilder.toString(),
+          "Cluster wide metrics exported to {0}.", false);
     }
+
+    return crd;
   }
 
   /**
@@ -253,8 +178,8 @@ public class ShowMetricsCommand implements GfshCommand {
    * @throws ResultDataException if building result fails
    */
   private ResultData getMemberMetrics(DistributedMember distributedMember,
-      String export_to_report_to, String[] categoriesArr, int cacheServerPort)
-      throws ResultDataException {
+      String export_to_report_to, String[] categoriesArr, int cacheServerPort,
+      StringBuilder csvBuilder) throws ResultDataException {
     final InternalCache cache = getCache();
     final SystemManagementService managementService =
         (SystemManagementService) ManagementService.getManagementService(cache);
@@ -265,352 +190,48 @@ public class ShowMetricsCommand implements GfshCommand {
     ObjectName csMxBeanName;
     CacheServerMXBean csMxBean = null;
 
-    if (memberMxBean != null) {
-
-      if (cacheServerPort != -1) {
-        csMxBeanName =
-            managementService.getCacheServerMBeanName(cacheServerPort, distributedMember);
-        csMxBean = managementService.getMBeanInstance(csMxBeanName, CacheServerMXBean.class);
-
-        if (csMxBean == null) {
-          ErrorResultData erd = ResultBuilder.createErrorResultData();
-          erd.addLine(CliStrings.format(CliStrings.SHOW_METRICS__CACHE__SERVER__NOT__FOUND,
-              cacheServerPort, MBeanJMXAdapter.getMemberNameOrId(distributedMember)));
-          return erd;
-        }
-      }
-
-      JVMMetrics jvmMetrics = memberMxBean.showJVMMetrics();
-
-      CompositeResultData crd = ResultBuilder.createCompositeResultData();
-      CompositeResultData.SectionResultData section = crd.addSection();
-      TabularResultData metricsTable = section.addTable();
-      metricsTable.setHeader("Member Metrics");
-      StringBuilder csvBuilder = null;
-
-      if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
-        csvBuilder = new StringBuilder();
-        csvBuilder.append("Category");
-        csvBuilder.append(',');
-        csvBuilder.append(CliStrings.SHOW_METRICS__METRIC__HEADER);
-        csvBuilder.append(',');
-        csvBuilder.append(CliStrings.SHOW_METRICS__VALUE__HEADER);
-        csvBuilder.append('\n');
-      }
-
-      Map<String, Boolean> categoriesMap = getMemberMetricsCategories();
-
-      if (categoriesArr != null && categoriesArr.length != 0) {
-        Set<String> categories = createSet(categoriesArr);
-        Set<String> checkSet = new HashSet<>(categoriesMap.keySet());
-        Set<String> userCategories = getSetDifference(categories, checkSet);
-
-        // Checking if the categories specified by the user are valid or not
-        if (userCategories.isEmpty()) {
-          for (String category : checkSet) {
-            categoriesMap.put(category, false);
-          }
-          for (String category : categories) {
-            categoriesMap.put(category.toLowerCase(), true);
-          }
-        } else {
-          StringBuilder sb = new StringBuilder();
-          sb.append("Invalid Categories\n");
-
-          for (String category : userCategories) {
-            sb.append(category);
-            sb.append('\n');
-          }
-          return ResultBuilder.createErrorResultData().addLine(sb.toString());
-        }
-      }
-
-      /*
-       * Member Metrics
-       */
-      // member, jvm, region, serialization, communication, function, transaction, diskstore, lock,
-      // eviction, distribution
-      if (categoriesMap.get("member")) {
-        writeToTableAndCsv(metricsTable, "member", "upTime", memberMxBean.getMemberUpTime(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "cpuUsage", memberMxBean.getCpuUsage(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "currentHeapSize", memberMxBean.getCurrentHeapSize(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "maximumHeapSize", memberMxBean.getMaximumHeapSize(),
-            csvBuilder);
-      }
-      /*
-       * JVM Metrics
-       */
-      if (categoriesMap.get("jvm")) {
-        writeToTableAndCsv(metricsTable, "jvm ", "jvmThreads ", jvmMetrics.getTotalThreads(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "fileDescriptorLimit",
-            memberMxBean.getFileDescriptorLimit(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalFileDescriptorOpen",
-            memberMxBean.getTotalFileDescriptorOpen(), csvBuilder);
-      }
-      /*
-       * Member wide region metrics
-       */
-      if (categoriesMap.get("region")) {
-        writeToTableAndCsv(metricsTable, "region ", "totalRegionCount ",
-            memberMxBean.getTotalRegionCount(), csvBuilder);
-        String[] regionNames = memberMxBean.listRegions();
-        if (regionNames != null) {
-          for (int i = 0; i < regionNames.length; i++) {
-            if (i == 0) {
-              writeToTableAndCsv(metricsTable, "listOfRegions", regionNames[i].substring(1),
-                  csvBuilder);
-            } else {
-              writeToTableAndCsv(metricsTable, "", regionNames[i].substring(1), csvBuilder);
-            }
-          }
-        }
-
-        String[] rootRegionNames = memberMxBean.getRootRegionNames();
-        if (rootRegionNames != null) {
-          for (int i = 0; i < rootRegionNames.length; i++) {
-            if (i == 0) {
-              writeToTableAndCsv(metricsTable, "rootRegions", rootRegionNames[i], csvBuilder);
-            } else {
-              writeToTableAndCsv(metricsTable, "", rootRegionNames[i], csvBuilder);
-            }
-          }
-        }
-        writeToTableAndCsv(metricsTable, "", "totalRegionEntryCount",
-            memberMxBean.getTotalRegionEntryCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalBucketCount", memberMxBean.getTotalBucketCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalPrimaryBucketCount",
-            memberMxBean.getTotalPrimaryBucketCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "getsAvgLatency", memberMxBean.getGetsAvgLatency(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putsAvgLatency", memberMxBean.getPutsAvgLatency(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "createsRate", memberMxBean.getCreatesRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "destroyRate", memberMxBean.getDestroysRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putAllAvgLatency", memberMxBean.getPutAllAvgLatency(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalMissCount", memberMxBean.getTotalMissCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalHitCount", memberMxBean.getTotalHitCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "getsRate", memberMxBean.getGetsRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putsRate", memberMxBean.getPutsRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "cacheWriterCallsAvgLatency",
-            memberMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency",
-            memberMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalLoadsCompleted",
-            memberMxBean.getTotalLoadsCompleted(), csvBuilder);
-      }
-
-      /*
-       * SERIALIZATION
-       */
-      if (categoriesMap.get("serialization")) {
-        writeToTableAndCsv(metricsTable, "serialization", "serializationRate",
-            memberMxBean.getSerializationRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "serializationLatency",
-            memberMxBean.getSerializationRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "deserializationRate",
-            memberMxBean.getDeserializationRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "deserializationLatency",
-            memberMxBean.getDeserializationLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "deserializationAvgLatency",
-            memberMxBean.getDeserializationAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "PDXDeserializationAvgLatency",
-            memberMxBean.getPDXDeserializationAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "PDXDeserializationRate",
-            memberMxBean.getPDXDeserializationRate(), csvBuilder);
-      }
+    if (memberMxBean == null) {
+      String errorMessage = CliStrings.format(CliStrings.SHOW_METRICS__ERROR, "Member MBean for "
+          + MBeanJMXAdapter.getMemberNameOrId(distributedMember) + " not found");
+      return ResultBuilder.createErrorResultData().addLine(errorMessage);
+    }
 
-      /*
-       * Communication Metrics
-       */
-      if (categoriesMap.get("communication")) {
-        writeToTableAndCsv(metricsTable, "communication", "bytesSentRate",
-            memberMxBean.getBytesSentRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "bytesReceivedRate",
-            memberMxBean.getBytesReceivedRate(), csvBuilder);
-        String[] connectedGatewayReceivers = memberMxBean.listConnectedGatewayReceivers();
-        writeToTableAndCsv(metricsTable, "connectedGatewayReceivers", connectedGatewayReceivers,
-            csvBuilder);
-
-        String[] connectedGatewaySenders = memberMxBean.listConnectedGatewaySenders();
-        writeToTableAndCsv(metricsTable, "connectedGatewaySenders", connectedGatewaySenders,
-            csvBuilder);
-      }
+    if (cacheServerPort != -1) {
+      csMxBeanName = managementService.getCacheServerMBeanName(cacheServerPort, distributedMember);
+      csMxBean = managementService.getMBeanInstance(csMxBeanName, CacheServerMXBean.class);
 
-      /*
-       * Member wide function metrics
-       */
-      if (categoriesMap.get("function")) {
-        writeToTableAndCsv(metricsTable, "function", "numRunningFunctions",
-            memberMxBean.getNumRunningFunctions(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "functionExecutionRate",
-            memberMxBean.getFunctionExecutionRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "numRunningFunctionsHavingResults",
-            memberMxBean.getNumRunningFunctionsHavingResults(), csvBuilder);
+      if (csMxBean == null) {
+        ErrorResultData erd = ResultBuilder.createErrorResultData();
+        erd.addLine(CliStrings.format(CliStrings.SHOW_METRICS__CACHE__SERVER__NOT__FOUND,
+            cacheServerPort, MBeanJMXAdapter.getMemberNameOrId(distributedMember)));
+        return erd;
       }
+    }
 
-      /*
-       * totalTransactionsCount currentTransactionalThreadIds transactionCommitsAvgLatency
-       * transactionCommittedTotalCount transactionRolledBackTotalCount transactionCommitsRate
-       */
-      if (categoriesMap.get("transaction")) {
-        writeToTableAndCsv(metricsTable, "transaction", "totalTransactionsCount",
-            memberMxBean.getTotalTransactionsCount(), csvBuilder);
-
-        writeToTableAndCsv(metricsTable, "", "transactionCommitsAvgLatency",
-            memberMxBean.getTransactionCommitsAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "transactionCommittedTotalCount",
-            memberMxBean.getTransactionCommittedTotalCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "transactionRolledBackTotalCount",
-            memberMxBean.getTransactionRolledBackTotalCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "transactionCommitsRate",
-            memberMxBean.getTransactionCommitsRate(), csvBuilder);
-      }
-      /*
-       * Member wide disk metrics
-       */
-      if (categoriesMap.get("diskstore")) {
-        writeToTableAndCsv(metricsTable, "diskstore", "totalDiskUsage",
-            memberMxBean.getTotalDiskUsage(), csvBuilder); // deadcoded to workaround bug 46397
-        writeToTableAndCsv(metricsTable, ""/* 46608 */, "diskReadsRate",
-            memberMxBean.getDiskReadsRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "diskWritesRate", memberMxBean.getDiskWritesRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "flushTimeAvgLatency",
-            memberMxBean.getDiskFlushAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalQueueSize",
-            memberMxBean.getTotalDiskTasksWaiting(), csvBuilder); // deadcoded to workaround bug
-        // 46397
-        writeToTableAndCsv(metricsTable, "", "totalBackupInProgress",
-            memberMxBean.getTotalBackupInProgress(), csvBuilder);
-      }
-      /*
-       * Member wide Lock
-       */
-      if (categoriesMap.get("lock")) {
-        writeToTableAndCsv(metricsTable, "lock", "lockWaitsInProgress",
-            memberMxBean.getLockWaitsInProgress(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalLockWaitTime",
-            memberMxBean.getTotalLockWaitTime(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalNumberOfLockService",
-            memberMxBean.getTotalNumberOfLockService(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "requestQueues", memberMxBean.getLockRequestQueues(),
-            csvBuilder);
-      }
-      /*
-       * Eviction
-       */
-      if (categoriesMap.get("eviction")) {
-        writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate",
-            memberMxBean.getLruEvictionRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "lruDestroyRate", memberMxBean.getLruDestroyRate(),
-            csvBuilder);
-      }
-      /*
-       * Distribution
-       */
-      if (categoriesMap.get("distribution")) {
-        writeToTableAndCsv(metricsTable, "distribution", "getInitialImagesInProgress",
-            memberMxBean.getInitialImagesInProgress(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "getInitialImageTime",
-            memberMxBean.getInitialImageTime(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "getInitialImageKeysReceived",
-            memberMxBean.getInitialImageKeysReceived(), csvBuilder);
-      }
+    JVMMetrics jvmMetrics = memberMxBean.showJVMMetrics();
 
-      /*
-       * OffHeap
-       */
-      if (categoriesMap.get("offheap")) {
-        writeToTableAndCsv(metricsTable, "offheap", "maxMemory", memberMxBean.getOffHeapMaxMemory(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "freeMemory", memberMxBean.getOffHeapFreeMemory(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "usedMemory", memberMxBean.getOffHeapUsedMemory(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "objects", memberMxBean.getOffHeapObjects(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "fragmentation",
-            memberMxBean.getOffHeapFragmentation(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "compactionTime",
-            memberMxBean.getOffHeapCompactionTime(), csvBuilder);
-      }
+    CompositeResultData crd = ResultBuilder.createCompositeResultData();
+    CompositeResultData.SectionResultData section = crd.addSection();
+    TabularResultData metricsTable = section.addTable();
+    metricsTable.setHeader("Member Metrics");
 
-      /*
-       * CacheServer stats
-       */
-      if (csMxBean != null) {
-        writeToTableAndCsv(metricsTable, "cache-server", "clientConnectionCount",
-            csMxBean.getClientConnectionCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "hostnameForClients", csMxBean.getHostNameForClients(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "getRequestAvgLatency",
-            csMxBean.getGetRequestAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putRequestAvgLatency",
-            csMxBean.getPutRequestAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalConnectionsTimedOut",
-            csMxBean.getTotalConnectionsTimedOut(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "threadQueueSize", csMxBean.getPutRequestAvgLatency(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "connectionThreads", csMxBean.getConnectionThreads(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "connectionLoad", csMxBean.getConnectionLoad(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "loadPerConnection", csMxBean.getLoadPerConnection(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "queueLoad", csMxBean.getQueueLoad(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "loadPerQueue", csMxBean.getLoadPerQueue(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "getRequestRate", csMxBean.getGetRequestRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putRequestRate", csMxBean.getPutRequestRate(),
-            csvBuilder);
-
-        /*
-         * Notification
-         */
-        writeToTableAndCsv(metricsTable, "notification", "numClientNotificationRequests",
-            csMxBean.getNumClientNotificationRequests(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "clientNotificationRate",
-            csMxBean.getClientNotificationRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "clientNotificationAvgLatency",
-            csMxBean.getClientNotificationAvgLatency(), csvBuilder);
-
-        /*
-         * Query
-         */
-        writeToTableAndCsv(metricsTable, "query", "activeCQCount", csMxBean.getActiveCQCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "query", "queryRequestRate",
-            csMxBean.getQueryRequestRate(), csvBuilder);
-
-        writeToTableAndCsv(metricsTable, "", "indexCount", csMxBean.getIndexCount(), csvBuilder);
-
-        String[] indexList = csMxBean.getIndexList();
-        writeToTableAndCsv(metricsTable, "index list", indexList, csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalIndexMaintenanceTime",
-            csMxBean.getTotalIndexMaintenanceTime(), csvBuilder);
-      }
+    List<Category> fullCategories =
+        csMxBean != null ? MEMBER_WITH_PORT_METRIC_CATEGORIES : MEMBER_METRIC_CATEGORIES;
+    Set<Category> categoriesToDisplay = ArrayUtils.isNotEmpty(categoriesArr)
+        ? getCategorySet(categoriesArr) : new HashSet<>(fullCategories);
 
-      if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
-        crd.addAsFile(export_to_report_to, csvBuilder != null ? csvBuilder.toString() : null,
-            "Member metrics exported to {0}.", false);
-      }
-      return crd;
+    writeMemberMetricValues(memberMxBean, jvmMetrics, metricsTable, csvBuilder,
+        categoriesToDisplay);
+    if (csMxBean != null) {
+      writeCacheServerMetricValues(csMxBean, metricsTable, csvBuilder, categoriesToDisplay);
+    }
 
-    } else {
-      String errorMessage = CliStrings.format(CliStrings.SHOW_METRICS__ERROR, "Member MBean for "
-          + MBeanJMXAdapter.getMemberNameOrId(distributedMember) + " not found");
-      return ResultBuilder.createErrorResultData().addLine(errorMessage);
+    if (StringUtils.isNotEmpty(export_to_report_to)) {
+      crd.addAsFile(export_to_report_to, csvBuilder != null ? csvBuilder.toString() : null,
+          "Member metrics exported to {0}.", false);
     }
+    return crd;
+
   }
 
   /**
@@ -620,155 +241,37 @@ public class ShowMetricsCommand implements GfshCommand {
    * @throws ResultDataException if building result fails
    */
   private ResultData getDistributedRegionMetrics(String regionName, String export_to_report_to,
-      String[] categoriesArr) throws ResultDataException {
+      String[] categoriesArr, StringBuilder csvBuilder) throws ResultDataException {
 
     final InternalCache cache = getCache();
     final ManagementService managementService = ManagementService.getManagementService(cache);
 
     DistributedRegionMXBean regionMxBean = managementService.getDistributedRegionMXBean(regionName);
 
-    if (regionMxBean != null) {
-      CompositeResultData crd = ResultBuilder.createCompositeResultData();
-      CompositeResultData.SectionResultData section = crd.addSection();
-      TabularResultData metricsTable = section.addTable();
-      metricsTable.setHeader("Cluster-wide Region Metrics");
-      StringBuilder csvBuilder = null;
-
-      if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
-        csvBuilder = new StringBuilder();
-        csvBuilder.append("Category");
-        csvBuilder.append(',');
-        csvBuilder.append(CliStrings.SHOW_METRICS__METRIC__HEADER);
-        csvBuilder.append(',');
-        csvBuilder.append(CliStrings.SHOW_METRICS__VALUE__HEADER);
-        csvBuilder.append('\n');
-      }
-
-      Map<String, Boolean> categoriesMap = getSystemRegionMetricsCategories();
-
-      if (categoriesArr != null && categoriesArr.length != 0) {
-        Set<String> categories = createSet(categoriesArr);
-        Set<String> checkSet = new HashSet<>(categoriesMap.keySet());
-        Set<String> userCategories = getSetDifference(categories, checkSet);
-
-        // Checking if the categories specified by the user are valid or not
-        if (userCategories.isEmpty()) {
-          for (String category : checkSet) {
-            categoriesMap.put(category, false);
-          }
-          for (String category : categories) {
-            categoriesMap.put(category.toLowerCase(), true);
-          }
-        } else {
-          StringBuilder sb = new StringBuilder();
-          sb.append("Invalid Categories\n");
-
-          for (String category : userCategories) {
-            sb.append(category);
-            sb.append('\n');
-          }
-          return ResultBuilder.createErrorResultData().addLine(sb.toString());
-        }
-      }
-      /*
-       * General System metrics
-       */
-      // cluster, region, partition , diskstore, callback, eviction
-      if (categoriesMap.get("cluster")) {
-        writeToTableAndCsv(metricsTable, "cluster", "member count", regionMxBean.getMemberCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "region entry count",
-            regionMxBean.getSystemRegionEntryCount(), csvBuilder);
-      }
-
-      if (categoriesMap.get("region")) {
-        writeToTableAndCsv(metricsTable, "region", "lastModifiedTime",
-            regionMxBean.getLastModifiedTime(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "lastAccessedTime", regionMxBean.getLastAccessedTime(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "missCount", regionMxBean.getMissCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "hitCount", regionMxBean.getHitCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "hitRatio", regionMxBean.getHitRatio(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "getsRate", regionMxBean.getGetsRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putsRate", regionMxBean.getPutsRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "createsRate", regionMxBean.getCreatesRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "destroyRate", regionMxBean.getDestroyRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putAllRate", regionMxBean.getPutAllRate(),
-            csvBuilder);
-      }
-
-      if (categoriesMap.get("partition")) {
-        writeToTableAndCsv(metricsTable, "partition", "putLocalRate",
-            regionMxBean.getPutLocalRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putRemoteRate", regionMxBean.getPutRemoteRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putRemoteLatency", regionMxBean.getPutRemoteLatency(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putRemoteAvgLatency",
-            regionMxBean.getPutRemoteAvgLatency(), csvBuilder);
-
-        writeToTableAndCsv(metricsTable, "", "bucketCount", regionMxBean.getBucketCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "primaryBucketCount",
-            regionMxBean.getPrimaryBucketCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "numBucketsWithoutRedundancy",
-            regionMxBean.getNumBucketsWithoutRedundancy(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalBucketSize", regionMxBean.getTotalBucketSize(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "averageBucketSize", regionMxBean.getAvgBucketSize(),
-            csvBuilder);
-      }
-      /*
-       * Disk store
-       */
-      if (categoriesMap.get("diskstore")) {
-        writeToTableAndCsv(metricsTable, "diskstore", "totalEntriesOnlyOnDisk",
-            regionMxBean.getTotalEntriesOnlyOnDisk(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "diskReadsRate", regionMxBean.getDiskReadsRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "diskWritesRate", regionMxBean.getDiskWritesRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalDiskWriteInProgress",
-            regionMxBean.getTotalDiskWritesProgress(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "diskTaskWaiting", regionMxBean.getDiskTaskWaiting(),
-            csvBuilder);
-
-      }
-      /*
-       * LISTENER
-       */
-      if (categoriesMap.get("callback")) {
-        writeToTableAndCsv(metricsTable, "callback", "cacheWriterCallsAvgLatency",
-            regionMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency",
-            regionMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
-      }
-
-      /*
-       * Eviction
-       */
-      if (categoriesMap.get("eviction")) {
-        writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate",
-            regionMxBean.getLruEvictionRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "lruDestroyRate", regionMxBean.getLruDestroyRate(),
-            csvBuilder);
-      }
-
-      if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
-        crd.addAsFile(export_to_report_to, csvBuilder != null ? csvBuilder.toString() : null,
-            "Aggregate Region Metrics exported to {0}.", false);
-      }
-
-      return crd;
-    } else {
+    if (regionMxBean == null) {
       ErrorResultData erd = ResultBuilder.createErrorResultData();
       String errorMessage = CliStrings.format(CliStrings.SHOW_METRICS__ERROR,
           "Distributed Region MBean for " + regionName + " not found");
       erd.addLine(errorMessage);
       return erd;
     }
+
+    CompositeResultData crd = ResultBuilder.createCompositeResultData();
+    CompositeResultData.SectionResultData section = crd.addSection();
+    TabularResultData metricsTable = section.addTable();
+    metricsTable.setHeader("Cluster-wide Region Metrics");
+
+    Set<Category> categoriesToDisplay = ArrayUtils.isNotEmpty(categoriesArr)
+        ? getCategorySet(categoriesArr) : new HashSet<>(SYSTEM_REGION_METRIC_CATEGORIES);
+
+    writeSystemRegionMetricValues(regionMxBean, metricsTable, csvBuilder, categoriesToDisplay);
+
+    if (StringUtils.isNotEmpty(export_to_report_to)) {
+      crd.addAsFile(export_to_report_to, csvBuilder != null ? csvBuilder.toString() : null,
+          "Aggregate Region Metrics exported to {0}.", false);
+    }
+
+    return crd;
   }
 
   /**
@@ -779,8 +282,8 @@ public class ShowMetricsCommand implements GfshCommand {
    * @throws ResultDataException if building result fails
    */
   private ResultData getRegionMetricsFromMember(String regionName,
-      DistributedMember distributedMember, String export_to_report_to, String[] categoriesArr)
-      throws ResultDataException {
+      DistributedMember distributedMember, String export_to_report_to, String[] categoriesArr,
+      StringBuilder csvBuilder) throws ResultDataException {
 
     final InternalCache cache = getCache();
     final SystemManagementService managementService =
@@ -791,136 +294,7 @@ public class ShowMetricsCommand implements GfshCommand {
     RegionMXBean regionMxBean =
         managementService.getMBeanInstance(regionMBeanName, RegionMXBean.class);
 
-    if (regionMxBean != null) {
-      CompositeResultData crd = ResultBuilder.createCompositeResultData();
-      CompositeResultData.SectionResultData section = crd.addSection();
-      TabularResultData metricsTable = section.addTable();
-      metricsTable.setHeader("Metrics for region:" + regionName + " On Member "
-          + MBeanJMXAdapter.getMemberNameOrId(distributedMember));
-      StringBuilder csvBuilder = null;
-
-      if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
-        csvBuilder = new StringBuilder();
-        csvBuilder.append("Category");
-        csvBuilder.append(',');
-        csvBuilder.append(CliStrings.SHOW_METRICS__METRIC__HEADER);
-        csvBuilder.append(',');
-        csvBuilder.append(CliStrings.SHOW_METRICS__VALUE__HEADER);
-        csvBuilder.append('\n');
-      }
-
-      /*
-       * Region Metrics
-       */
-      Map<String, Boolean> categoriesMap = getRegionMetricsCategories();
-
-      if (categoriesArr != null && categoriesArr.length != 0) {
-        Set<String> categories = createSet(categoriesArr);
-        Set<String> checkSet = new HashSet<>(categoriesMap.keySet());
-        Set<String> userCategories = getSetDifference(categories, checkSet);
-
-        // Checking if the categories specified by the user are valid or not
-        if (userCategories.isEmpty()) {
-          for (String category : checkSet) {
-            categoriesMap.put(category, false);
-          }
-          for (String category : categories) {
-            categoriesMap.put(category.toLowerCase(), true);
-          }
-        } else {
-          StringBuilder sb = new StringBuilder();
-          sb.append("Invalid Categories\n");
-
-          for (String category : userCategories) {
-            sb.append(category);
-            sb.append('\n');
-          }
-          return ResultBuilder.createErrorResultData().addLine(sb.toString());
-        }
-      }
-
-      if (categoriesMap.get("region")) {
-        writeToTableAndCsv(metricsTable, "region", "lastModifiedTime",
-            regionMxBean.getLastModifiedTime(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "lastAccessedTime", regionMxBean.getLastAccessedTime(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "missCount", regionMxBean.getMissCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "hitCount", regionMxBean.getHitCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "hitRatio", regionMxBean.getHitRatio(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "getsRate", regionMxBean.getGetsRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putsRate", regionMxBean.getPutsRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "createsRate", regionMxBean.getCreatesRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "destroyRate", regionMxBean.getDestroyRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putAllRate", regionMxBean.getPutAllRate(),
-            csvBuilder);
-      }
-
-      if (categoriesMap.get("partition")) {
-        writeToTableAndCsv(metricsTable, "partition", "putLocalRate",
-            regionMxBean.getPutLocalRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putRemoteRate", regionMxBean.getPutRemoteRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putRemoteLatency", regionMxBean.getPutRemoteLatency(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "putRemoteAvgLatency",
-            regionMxBean.getPutRemoteAvgLatency(), csvBuilder);
-
-        writeToTableAndCsv(metricsTable, "", "bucketCount", regionMxBean.getBucketCount(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "primaryBucketCount",
-            regionMxBean.getPrimaryBucketCount(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "configuredRedundancy",
-            regionMxBean.getConfiguredRedundancy(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "actualRedundancy", regionMxBean.getActualRedundancy(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "numBucketsWithoutRedundancy",
-            regionMxBean.getNumBucketsWithoutRedundancy(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalBucketSize", regionMxBean.getTotalBucketSize(),
-            csvBuilder);
-      }
-      /*
-       * Disk store
-       */
-      if (categoriesMap.get("diskstore")) {
-        writeToTableAndCsv(metricsTable, "diskstore", "totalEntriesOnlyOnDisk",
-            regionMxBean.getTotalEntriesOnlyOnDisk(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "diskReadsRate", "" + regionMxBean.getDiskReadsRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "diskWritesRate", regionMxBean.getDiskWritesRate(),
-            csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "totalDiskWriteInProgress",
-            regionMxBean.getTotalDiskWritesProgress(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "diskTaskWaiting", regionMxBean.getDiskTaskWaiting(),
-            csvBuilder);
-      }
-      /*
-       * LISTENER
-       */
-      if (categoriesMap.get("callback")) {
-        writeToTableAndCsv(metricsTable, "callback", "cacheWriterCallsAvgLatency",
-            regionMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency",
-            regionMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
-      }
-
-      /*
-       * Eviction
-       */
-      if (categoriesMap.get("eviction")) {
-        writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate",
-            regionMxBean.getLruEvictionRate(), csvBuilder);
-        writeToTableAndCsv(metricsTable, "", "lruDestroyRate", regionMxBean.getLruDestroyRate(),
-            csvBuilder);
-      }
-      if (export_to_report_to != null && !export_to_report_to.isEmpty()) {
-        crd.addAsFile(export_to_report_to, csvBuilder != null ? csvBuilder.toString() : null,
-            "Region Metrics exported to {0}.", false);
-      }
-
-      return crd;
-    } else {
+    if (regionMxBean == null) {
       ErrorResultData erd = ResultBuilder.createErrorResultData();
       String errorMessage = CliStrings.format(CliStrings.SHOW_METRICS__ERROR,
           "Region MBean for " + regionName + " on member "
@@ -928,154 +302,469 @@ public class ShowMetricsCommand implements GfshCommand {
       erd.addLine(errorMessage);
       return erd;
     }
-  }
 
-  /***
-   * Writes an entry to a TabularResultData and writes a comma separated entry to a string builder
-   */
-  private void writeToTableAndCsv(TabularResultData metricsTable, String type, String metricName,
-      long metricValue, StringBuilder csvBuilder) {
-    metricsTable.accumulate(CliStrings.SHOW_METRICS__TYPE__HEADER, type);
-    metricsTable.accumulate(CliStrings.SHOW_METRICS__METRIC__HEADER, metricName);
-    metricsTable.accumulate(CliStrings.SHOW_METRICS__VALUE__HEADER, metricValue);
+    CompositeResultData crd = ResultBuilder.createCompositeResultData();
+    CompositeResultData.SectionResultData section = crd.addSection();
+    TabularResultData metricsTable = section.addTable();
+    metricsTable.setHeader("Metrics for region:" + regionName + " On Member "
+        + MBeanJMXAdapter.getMemberNameOrId(distributedMember));
 
-    if (csvBuilder != null) {
-      csvBuilder.append(type);
-      csvBuilder.append(',');
-      csvBuilder.append(metricName);
-      csvBuilder.append(',');
-      csvBuilder.append(metricValue);
-      csvBuilder.append('\n');
+    Set<Category> categoriesToDisplay = ArrayUtils.isNotEmpty(categoriesArr)
+        ? getCategorySet(categoriesArr) : new HashSet<>(REGION_METRIC_CATEGORIES);
+
+    writeRegionMetricValues(regionMxBean, metricsTable, csvBuilder, categoriesToDisplay);
+    if (StringUtils.isNotEmpty(export_to_report_to)) {
+      crd.addAsFile(export_to_report_to, csvBuilder != null ? csvBuilder.toString() : null,
+          "Region Metrics exported to {0}.", false);
     }
+
+    return crd;
   }
 
-  private void writeToTableAndCsv(TabularResultData metricsTable, String type, String metricName,
-      double metricValue, StringBuilder csvBuilder) {
-    metricsTable.accumulate(CliStrings.SHOW_METRICS__TYPE__HEADER, type);
-    metricsTable.accumulate(CliStrings.SHOW_METRICS__METRIC__HEADER, metricName);
-    metricsTable.accumulate(CliStrings.SHOW_METRICS__VALUE__HEADER, metricValue);
+  private void writeSystemWideMetricValues(DistributedSystemMXBean dsMxBean,
+      StringBuilder csvBuilder, TabularResultData metricsTable, Set<Category> categoriesToDisplay) {
+    if (categoriesToDisplay.contains(Category.cluster)) {
+      writeToTableAndCsv(metricsTable, "cluster", "totalHeapSize", dsMxBean.getTotalHeapSize(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.cache)) {
+      writeToTableAndCsv(metricsTable, "cache", "totalRegionEntryCount",
+          dsMxBean.getTotalRegionEntryCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalRegionCount", dsMxBean.getTotalRegionCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalMissCount", dsMxBean.getTotalMissCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalHitCount", dsMxBean.getTotalHitCount(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.diskstore)) {
+      writeToTableAndCsv(metricsTable, "diskstore", "totalDiskUsage", dsMxBean.getTotalDiskUsage(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskReadsRate", dsMxBean.getDiskReadsRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskWritesRate", dsMxBean.getDiskWritesRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "flushTimeAvgLatency", dsMxBean.getDiskFlushAvgLatency(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalBackupInProgress",
+          dsMxBean.getTotalBackupInProgress(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.query)) {
+      writeToTableAndCsv(metricsTable, "query", "activeCQCount", dsMxBean.getActiveCQCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "queryRequestRate", dsMxBean.getQueryRequestRate(),
+          csvBuilder);
+    }
+  }
 
-    if (csvBuilder != null) {
-      csvBuilder.append(type);
-      csvBuilder.append(',');
-      csvBuilder.append(metricName);
-      csvBuilder.append(',');
-      csvBuilder.append(metricValue);
-      csvBuilder.append('\n');
+  private void writeMemberMetricValues(MemberMXBean memberMxBean, JVMMetrics jvmMetrics,
+      TabularResultData metricsTable, StringBuilder csvBuilder, Set<Category> categoriesToDisplay) {
+    if (categoriesToDisplay.contains(Category.member)) {
+      writeToTableAndCsv(metricsTable, "member", "upTime", memberMxBean.getMemberUpTime(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "cpuUsage", memberMxBean.getCpuUsage(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "currentHeapSize", memberMxBean.getCurrentHeapSize(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "maximumHeapSize", memberMxBean.getMaximumHeapSize(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.jvm)) {
+      writeToTableAndCsv(metricsTable, "jvm", "jvmThreads ", jvmMetrics.getTotalThreads(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "fileDescriptorLimit",
+          memberMxBean.getFileDescriptorLimit(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalFileDescriptorOpen",
+          memberMxBean.getTotalFileDescriptorOpen(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.region)) {
+      writeToTableAndCsv(metricsTable, "region", "totalRegionCount ",
+          memberMxBean.getTotalRegionCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "listOfRegions",
+          Arrays.stream(memberMxBean.listRegions()).map(s -> s.substring(1)).toArray(String[]::new),
+          csvBuilder);
+
+      writeToTableAndCsv(metricsTable, "", "rootRegions", memberMxBean.getRootRegionNames(),
+          csvBuilder);
+
+      writeToTableAndCsv(metricsTable, "", "totalRegionEntryCount",
+          memberMxBean.getTotalRegionEntryCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalBucketCount", memberMxBean.getTotalBucketCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalPrimaryBucketCount",
+          memberMxBean.getTotalPrimaryBucketCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "getsAvgLatency", memberMxBean.getGetsAvgLatency(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putsAvgLatency", memberMxBean.getPutsAvgLatency(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "createsRate", memberMxBean.getCreatesRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "destroyRate", memberMxBean.getDestroysRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putAllAvgLatency", memberMxBean.getPutAllAvgLatency(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalMissCount", memberMxBean.getTotalMissCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalHitCount", memberMxBean.getTotalHitCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "getsRate", memberMxBean.getGetsRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putsRate", memberMxBean.getPutsRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "cacheWriterCallsAvgLatency",
+          memberMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency",
+          memberMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalLoadsCompleted",
+          memberMxBean.getTotalLoadsCompleted(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.serialization)) {
+      writeToTableAndCsv(metricsTable, "serialization", "serializationRate",
+          memberMxBean.getSerializationRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "serializationLatency",
+          memberMxBean.getSerializationRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "deserializationRate",
+          memberMxBean.getDeserializationRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "deserializationLatency",
+          memberMxBean.getDeserializationLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "deserializationAvgLatency",
+          memberMxBean.getDeserializationAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "PDXDeserializationAvgLatency",
+          memberMxBean.getPDXDeserializationAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "PDXDeserializationRate",
+          memberMxBean.getPDXDeserializationRate(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.communication)) {
+      writeToTableAndCsv(metricsTable, "communication", "bytesSentRate",
+          memberMxBean.getBytesSentRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "bytesReceivedRate", memberMxBean.getBytesReceivedRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "connectedGatewayReceivers",
+          memberMxBean.listConnectedGatewayReceivers(), csvBuilder);
+
+      writeToTableAndCsv(metricsTable, "", "connectedGatewaySenders",
+          memberMxBean.listConnectedGatewaySenders(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.function)) {
+      writeToTableAndCsv(metricsTable, "function", "numRunningFunctions",
+          memberMxBean.getNumRunningFunctions(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "functionExecutionRate",
+          memberMxBean.getFunctionExecutionRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "numRunningFunctionsHavingResults",
+          memberMxBean.getNumRunningFunctionsHavingResults(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.transaction)) {
+      writeToTableAndCsv(metricsTable, "transaction", "totalTransactionsCount",
+          memberMxBean.getTotalTransactionsCount(), csvBuilder);
+
+      writeToTableAndCsv(metricsTable, "", "transactionCommitsAvgLatency",
+          memberMxBean.getTransactionCommitsAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "transactionCommittedTotalCount",
+          memberMxBean.getTransactionCommittedTotalCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "transactionRolledBackTotalCount",
+          memberMxBean.getTransactionRolledBackTotalCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "transactionCommitsRate",
+          memberMxBean.getTransactionCommitsRate(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.diskstore)) {
+      writeToTableAndCsv(metricsTable, "diskstore", "totalDiskUsage",
+          memberMxBean.getTotalDiskUsage(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskReadsRate", memberMxBean.getDiskReadsRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskWritesRate", memberMxBean.getDiskWritesRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "flushTimeAvgLatency",
+          memberMxBean.getDiskFlushAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalQueueSize",
+          memberMxBean.getTotalDiskTasksWaiting(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalBackupInProgress",
+          memberMxBean.getTotalBackupInProgress(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.lock)) {
+      writeToTableAndCsv(metricsTable, "lock", "lockWaitsInProgress",
+          memberMxBean.getLockWaitsInProgress(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalLockWaitTime", memberMxBean.getTotalLockWaitTime(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalNumberOfLockService",
+          memberMxBean.getTotalNumberOfLockService(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "requestQueues", memberMxBean.getLockRequestQueues(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.eviction)) {
+      writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate",
+          memberMxBean.getLruEvictionRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "lruDestroyRate", memberMxBean.getLruDestroyRate(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.distribution)) {
+      writeToTableAndCsv(metricsTable, "distribution", "getInitialImagesInProgress",
+          memberMxBean.getInitialImagesInProgress(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "getInitialImageTime",
+          memberMxBean.getInitialImageTime(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "getInitialImageKeysReceived",
+          memberMxBean.getInitialImageKeysReceived(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.offheap)) {
+      writeToTableAndCsv(metricsTable, "offheap", "maxMemory", memberMxBean.getOffHeapMaxMemory(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "freeMemory", memberMxBean.getOffHeapFreeMemory(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "usedMemory", memberMxBean.getOffHeapUsedMemory(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "objects", memberMxBean.getOffHeapObjects(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "fragmentation", memberMxBean.getOffHeapFragmentation(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "compactionTime",
+          memberMxBean.getOffHeapCompactionTime(), csvBuilder);
     }
   }
 
-  private Set<String> createSet(String[] categories) {
-    Set<String> categoriesSet = new HashSet<>();
-    Collections.addAll(categoriesSet, categories);
-    return categoriesSet;
+  private void writeCacheServerMetricValues(CacheServerMXBean csMxBean,
+      TabularResultData metricsTable, StringBuilder csvBuilder, Set<Category> categoriesToDisplay) {
+    if (categoriesToDisplay.contains(Category.cacheserver)) {
+
+      writeToTableAndCsv(metricsTable, "cacheserver", "clientConnectionCount",
+          csMxBean.getClientConnectionCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "hostnameForClients", csMxBean.getHostNameForClients(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "getRequestAvgLatency",
+          csMxBean.getGetRequestAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putRequestAvgLatency",
+          csMxBean.getPutRequestAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalConnectionsTimedOut",
+          csMxBean.getTotalConnectionsTimedOut(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "threadQueueSize", csMxBean.getPutRequestAvgLatency(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "connectionThreads", csMxBean.getConnectionThreads(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "connectionLoad", csMxBean.getConnectionLoad(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "loadPerConnection", csMxBean.getLoadPerConnection(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "queueLoad", csMxBean.getQueueLoad(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "loadPerQueue", csMxBean.getLoadPerQueue(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "getRequestRate", csMxBean.getGetRequestRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putRequestRate", csMxBean.getPutRequestRate(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.notification)) {
+      writeToTableAndCsv(metricsTable, "notification", "numClientNotificationRequests",
+          csMxBean.getNumClientNotificationRequests(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "clientNotificationRate",
+          csMxBean.getClientNotificationRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "clientNotificationAvgLatency",
+          csMxBean.getClientNotificationAvgLatency(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.query)) {
+      writeToTableAndCsv(metricsTable, "query", "activeCQCount", csMxBean.getActiveCQCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "queryRequestRate", csMxBean.getQueryRequestRate(),
+          csvBuilder);
+
+      writeToTableAndCsv(metricsTable, "", "indexCount", csMxBean.getIndexCount(), csvBuilder);
+
+      writeToTableAndCsv(metricsTable, "", "index list", csMxBean.getIndexList(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalIndexMaintenanceTime",
+          csMxBean.getTotalIndexMaintenanceTime(), csvBuilder);
+    }
   }
 
-  private Set<String> getSetDifference(Set<String> set1, Set<String> set2) {
-    Set<String> setDifference = new HashSet<>();
-    for (String element : set1) {
-      if (!(set2.contains(element.toLowerCase()))) {
-        setDifference.add(element);
-      }
+  private void writeSystemRegionMetricValues(DistributedRegionMXBean regionMxBean,
+      TabularResultData metricsTable, StringBuilder csvBuilder, Set<Category> categoriesToDisplay) {
+    if (categoriesToDisplay.contains(Category.cluster)) {
+      writeToTableAndCsv(metricsTable, "cluster", "member count", regionMxBean.getMemberCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "region entry count",
+          regionMxBean.getSystemRegionEntryCount(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.region)) {
+      writeToTableAndCsv(metricsTable, "region", "lastModifiedTime",
+          regionMxBean.getLastModifiedTime(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "lastAccessedTime", regionMxBean.getLastAccessedTime(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "missCount", regionMxBean.getMissCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "hitCount", regionMxBean.getHitCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "hitRatio", regionMxBean.getHitRatio(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "getsRate", regionMxBean.getGetsRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putsRate", regionMxBean.getPutsRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "createsRate", regionMxBean.getCreatesRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "destroyRate", regionMxBean.getDestroyRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putAllRate", regionMxBean.getPutAllRate(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.partition)) {
+      writeToTableAndCsv(metricsTable, "partition", "putLocalRate", regionMxBean.getPutLocalRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putRemoteRate", regionMxBean.getPutRemoteRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putRemoteLatency", regionMxBean.getPutRemoteLatency(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putRemoteAvgLatency",
+          regionMxBean.getPutRemoteAvgLatency(), csvBuilder);
+
+      writeToTableAndCsv(metricsTable, "", "bucketCount", regionMxBean.getBucketCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "primaryBucketCount",
+          regionMxBean.getPrimaryBucketCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "numBucketsWithoutRedundancy",
+          regionMxBean.getNumBucketsWithoutRedundancy(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalBucketSize", regionMxBean.getTotalBucketSize(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "averageBucketSize", regionMxBean.getAvgBucketSize(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.diskstore)) {
+      writeToTableAndCsv(metricsTable, "diskstore", "totalEntriesOnlyOnDisk",
+          regionMxBean.getTotalEntriesOnlyOnDisk(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskReadsRate", regionMxBean.getDiskReadsRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskWritesRate", regionMxBean.getDiskWritesRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalDiskWriteInProgress",
+          regionMxBean.getTotalDiskWritesProgress(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskTaskWaiting", regionMxBean.getDiskTaskWaiting(),
+          csvBuilder);
+
+    }
+    if (categoriesToDisplay.contains(Category.callback)) {
+      writeToTableAndCsv(metricsTable, "callback", "cacheWriterCallsAvgLatency",
+          regionMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency",
+          regionMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.eviction)) {
+      writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate",
+          regionMxBean.getLruEvictionRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "lruDestroyRate", regionMxBean.getLruDestroyRate(),
+          csvBuilder);
     }
-    return setDifference;
   }
 
-  private void writeToTableAndCsv(TabularResultData metricsTable, String metricName,
-      String[] metricValue, StringBuilder csvBuilder) {
-    if (metricValue != null) {
-      for (int i = 0; i < metricValue.length; i++) {
-        if (i == 0) {
-          writeToTableAndCsv(metricsTable, metricName, metricValue[i], csvBuilder);
-        } else {
-          writeToTableAndCsv(metricsTable, "", metricValue[i], csvBuilder);
-        }
-      }
+  private void writeRegionMetricValues(RegionMXBean regionMxBean, TabularResultData metricsTable,
+      StringBuilder csvBuilder, Set<Category> categoriesToDisplay) {
+    if (categoriesToDisplay.contains(Category.region)) {
+      writeToTableAndCsv(metricsTable, "region", "lastModifiedTime",
+          regionMxBean.getLastModifiedTime(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "lastAccessedTime", regionMxBean.getLastAccessedTime(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "missCount", regionMxBean.getMissCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "hitCount", regionMxBean.getHitCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "hitRatio", regionMxBean.getHitRatio(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "getsRate", regionMxBean.getGetsRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putsRate", regionMxBean.getPutsRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "createsRate", regionMxBean.getCreatesRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "destroyRate", regionMxBean.getDestroyRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putAllRate", regionMxBean.getPutAllRate(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.partition)) {
+      writeToTableAndCsv(metricsTable, "partition", "putLocalRate", regionMxBean.getPutLocalRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putRemoteRate", regionMxBean.getPutRemoteRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putRemoteLatency", regionMxBean.getPutRemoteLatency(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "putRemoteAvgLatency",
+          regionMxBean.getPutRemoteAvgLatency(), csvBuilder);
+
+      writeToTableAndCsv(metricsTable, "", "bucketCount", regionMxBean.getBucketCount(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "primaryBucketCount",
+          regionMxBean.getPrimaryBucketCount(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "configuredRedundancy",
+          regionMxBean.getConfiguredRedundancy(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "actualRedundancy", regionMxBean.getActualRedundancy(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "numBucketsWithoutRedundancy",
+          regionMxBean.getNumBucketsWithoutRedundancy(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalBucketSize", regionMxBean.getTotalBucketSize(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.diskstore)) {
+      writeToTableAndCsv(metricsTable, "diskstore", "totalEntriesOnlyOnDisk",
+          regionMxBean.getTotalEntriesOnlyOnDisk(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskReadsRate", "" + regionMxBean.getDiskReadsRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskWritesRate", regionMxBean.getDiskWritesRate(),
+          csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "totalDiskWriteInProgress",
+          regionMxBean.getTotalDiskWritesProgress(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "diskTaskWaiting", regionMxBean.getDiskTaskWaiting(),
+          csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.callback)) {
+      writeToTableAndCsv(metricsTable, "callback", "cacheWriterCallsAvgLatency",
+          regionMxBean.getCacheWriterCallsAvgLatency(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "cacheListenerCallsAvgLatency",
+          regionMxBean.getCacheListenerCallsAvgLatency(), csvBuilder);
+    }
+    if (categoriesToDisplay.contains(Category.eviction)) {
+      writeToTableAndCsv(metricsTable, "eviction", "lruEvictionRate",
+          regionMxBean.getLruEvictionRate(), csvBuilder);
+      writeToTableAndCsv(metricsTable, "", "lruDestroyRate", regionMxBean.getLruDestroyRate(),
+          csvBuilder);
     }
   }
 
-  /**
-   * Writes to a TabularResultData and also appends a CSV string to a String builder
-   */
-  private void writeToTableAndCsv(TabularResultData metricsTable, String metricName,
+  private void writeToTableAndCsv(TabularResultData metricsTable, String type, String metricName,
       String metricValue, StringBuilder csvBuilder) {
-    metricsTable.accumulate(CliStrings.SHOW_METRICS__TYPE__HEADER, "");
+    metricsTable.accumulate(CliStrings.SHOW_METRICS__TYPE__HEADER, type);
     metricsTable.accumulate(CliStrings.SHOW_METRICS__METRIC__HEADER, metricName);
     metricsTable.accumulate(CliStrings.SHOW_METRICS__VALUE__HEADER, metricValue);
 
-    if (csvBuilder != null) {
-      csvBuilder.append("");
-      csvBuilder.append(',');
-      csvBuilder.append(metricName);
-      csvBuilder.append(',');
-      csvBuilder.append(metricValue);
-      csvBuilder.append('\n');
+    writeToCsvIfNecessary(type, metricName, String.valueOf(metricValue), csvBuilder);
+  }
+
+  private void writeToTableAndCsv(TabularResultData metricsTable, String type, String metricName,
+      String[] metricValue, StringBuilder csvBuilder) {
+    if (ArrayUtils.isEmpty(metricValue)) {
+      return;
+    }
+
+    for (int i = 0; i < metricValue.length; i++) {
+      if (i == 0) {
+        writeToTableAndCsv(metricsTable, type, metricName, metricValue[i], csvBuilder);
+      } else {
+        writeToTableAndCsv(metricsTable, "", "", metricValue[i], csvBuilder);
+      }
     }
   }
 
-  /**
-   * Defines and returns map of categories for Region Metrics
-   *
-   * @return map with categories for region metrics and display flag set to true
-   */
-  private Map<String, Boolean> getRegionMetricsCategories() {
-    Map<String, Boolean> categories = new HashMap<>();
-
-    categories.put("region", true);
-    categories.put("partition", true);
-    categories.put("diskstore", true);
-    categories.put("callback", true);
-    categories.put("gatewayreceiver", true);
-    categories.put("distribution", true);
-    categories.put("query", true);
-    categories.put("eviction", true);
-    return categories;
+  private void writeToTableAndCsv(TabularResultData metricsTable, String type, String metricName,
+      long metricValue, StringBuilder csvBuilder) {
+    writeToTableAndCsv(metricsTable, type, metricName, String.valueOf(metricValue), csvBuilder);
   }
 
-  /**
-   * Defines and returns map of categories for System metrics.
-   *
-   * @return map with categories for system metrics and display flag set to true
-   */
-  private Map<String, Boolean> getSystemMetricsCategories() {
-    Map<String, Boolean> categories = new HashMap<>();
-    categories.put("cluster", true);
-    categories.put("cache", true);
-    categories.put("diskstore", true);
-    categories.put("query", true);
-    return categories;
+  private void writeToTableAndCsv(TabularResultData metricsTable, String type, String metricName,
+      double metricValue, StringBuilder csvBuilder) {
+    writeToTableAndCsv(metricsTable, type, metricName, String.valueOf(metricValue), csvBuilder);
   }
 
-  /**
-   * Defines and returns map of categories for system-wide region metrics
-   *
-   * @return map with categories for system wide region metrics and display flag set to true
-   */
-  private Map<String, Boolean> getSystemRegionMetricsCategories() {
-    Map<String, Boolean> categories = getRegionMetricsCategories();
-    categories.put("cluster", true);
-    return categories;
+  private StringBuilder prepareCsvBuilder() {
+    StringBuilder csvBuilder = new StringBuilder();
+    csvBuilder.append(CliStrings.SHOW_METRICS__TYPE__HEADER);
+    csvBuilder.append(',');
+    csvBuilder.append(CliStrings.SHOW_METRICS__METRIC__HEADER);
+    csvBuilder.append(',');
+    csvBuilder.append(CliStrings.SHOW_METRICS__VALUE__HEADER);
+    csvBuilder.append('\n');
+    return csvBuilder;
   }
 
-  /**
-   * Defines and returns map of categories for member metrics
-   *
-   * @return map with categories for member metrics and display flag set to true
-   */
-  private Map<String, Boolean> getMemberMetricsCategories() {
-    Map<String, Boolean> categories = new HashMap<>();
-    categories.put("member", true);
-    categories.put("jvm", true);
-    categories.put("region", true);
-    categories.put("serialization", true);
-    categories.put("communication", true);
-    categories.put("function", true);
-    categories.put("transaction", true);
-    categories.put("diskstore", true);
-    categories.put("lock", true);
-    categories.put("eviction", true);
-    categories.put("distribution", true);
-    categories.put("offheap", true);
-    return categories;
+  private void writeToCsvIfNecessary(String type, String metricName, String metricValue,
+      StringBuilder csvBuilder) {
+    if (csvBuilder != null) {
+      csvBuilder.append(type);
+      csvBuilder.append(',');
+      csvBuilder.append(metricName);
+      csvBuilder.append(',');
+      csvBuilder.append(metricValue);
+      csvBuilder.append('\n');
+    }
+  }
+
+  private Set<Category> getCategorySet(String[] categories) {
+    return Stream.of(categories).map(String::toLowerCase).map(Category::valueOf)
+        .collect(Collectors.toSet());
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsInterceptor.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsInterceptor.java
new file mode 100644
index 0000000..97a49a5
--- /dev/null
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShowMetricsInterceptor.java
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.commons.lang.StringUtils;
+
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
+import org.apache.geode.management.internal.cli.GfshParseResult;
+import org.apache.geode.management.internal.cli.commands.ShowMetricsCommand.Category;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+
+public class ShowMetricsInterceptor extends AbstractCliAroundInterceptor {
+  @Override
+  public Result preExecution(GfshParseResult parseResult) {
+    String export_to_report_to = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__FILE);
+    if (export_to_report_to != null && !export_to_report_to.endsWith(".csv")) {
+      return ResultBuilder
+          .createUserErrorResult(CliStrings.format(CliStrings.INVALID_FILE_EXTENSION, ".csv"));
+    }
+
+    String regionName = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__REGION);
+    String port = parseResult.getParamValueAsString(CliStrings.SHOW_METRICS__CACHESERVER__PORT);
+    String member = parseResult.getParamValueAsString(CliStrings.MEMBER);
+    String[] categoryArgs = (String[]) parseResult.getParamValue(CliStrings.SHOW_METRICS__CATEGORY);
+
+    if (regionName != null && port != null) {
+      return ResultBuilder.createUserErrorResult(
+          CliStrings.SHOW_METRICS__CANNOT__USE__REGION__WITH__CACHESERVERPORT);
+    }
+
+    if (port != null && member == null) {
+      return ResultBuilder
+          .createUserErrorResult(CliStrings.SHOW_METRICS__CANNOT__USE__CACHESERVERPORT);
+    }
+
+    if (categoryArgs != null) {
+      boolean regionProvided = regionName != null;
+      boolean portProvided = port != null;
+      boolean memberProvided = member != null;
+      List<String> validCategories =
+          getValidCategoriesAsStrings(regionProvided, memberProvided, portProvided);
+      Set<String> userCategories = new HashSet<>(Arrays.asList(categoryArgs));
+      userCategories.removeAll(validCategories);
+      if (!userCategories.isEmpty()) {
+        return getInvalidCategoryResult(userCategories);
+      }
+    }
+
+    return ResultBuilder.createInfoResult("OK");
+  }
+
+  static List<Category> getValidCategories(boolean regionProvided, boolean memberProvided,
+      boolean portProvided) {
+    if (regionProvided && memberProvided) {
+      return ShowMetricsCommand.REGION_METRIC_CATEGORIES;
+    }
+    if (regionProvided) {
+      return ShowMetricsCommand.SYSTEM_REGION_METRIC_CATEGORIES;
+    }
+    if (memberProvided && portProvided) {
+      return ShowMetricsCommand.MEMBER_WITH_PORT_METRIC_CATEGORIES;
+    }
+    if (memberProvided) {
+      return ShowMetricsCommand.MEMBER_METRIC_CATEGORIES;
+    }
+    return ShowMetricsCommand.SYSTEM_METRIC_CATEGORIES;
+  }
+
+  static List<String> getValidCategoriesAsStrings(boolean regionProvided, boolean memberProvided,
+      boolean portProvided) {
+
+    return getValidCategories(regionProvided, memberProvided, portProvided).stream().map(Enum::name)
+        .collect(Collectors.toList());
+  }
+
+
+  private CommandResult getInvalidCategoryResult(Set<String> invalidCategories) {
+    StringBuilder sb = new StringBuilder();
+    sb.append("Invalid Categories\n");
+    for (String category : invalidCategories) {
+      sb.append(category);
+      sb.append('\n');
+    }
+    return ResultBuilder.createUserErrorResult(sb.toString());
+  }
+}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShutdownCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShutdownCommand.java
index 3ed8b40..3c71bd1 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShutdownCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ShutdownCommand.java
@@ -63,7 +63,6 @@ public class ShutdownCommand implements GfshCommand {
           specifiedDefaultValue = "true",
           help = CliStrings.INCLUDE_LOCATORS_HELP) boolean shutdownLocators) {
     try {
-
       if (userSpecifiedTimeout < Integer.parseInt(DEFAULT_TIME_OUT)) {
         return ResultBuilder.createInfoResult(CliStrings.SHUTDOWN__MSG__IMPROPER_TIMEOUT);
       }
@@ -82,7 +81,7 @@ public class ShutdownCommand implements GfshCommand {
 
       String managerName = cache.getJmxManagerAdvisor().getDistributionManager().getId().getId();
 
-      final DistributedMember manager = CliUtil.getDistributedMemberByNameOrId(managerName);
+      final DistributedMember manager = getMember(managerName);
 
       dataNodes.remove(manager);
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewayReceiverCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewayReceiverCommand.java
index b3402f5..d220374 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewayReceiverCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewayReceiverCommand.java
@@ -32,9 +32,7 @@ import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.MBeanJMXAdapter;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.management.internal.cli.CliUtil;
-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.CommandResultException;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.management.internal.security.ResourceOperation;
@@ -53,47 +51,41 @@ public class StartGatewayReceiverCommand implements GfshCommand {
 
       @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
           optionContext = ConverterHint.MEMBERIDNAME,
-          help = CliStrings.START_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember) {
+          help = CliStrings.START_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember)
+      throws Exception {
     Result result;
 
-    try {
-      InternalCache cache = getCache();
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    InternalCache cache = getCache();
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      GatewayReceiverMXBean receiverBean;
+    GatewayReceiverMXBean receiverBean;
 
-      TabularResultData resultData = ResultBuilder.createTabularResultData();
+    TabularResultData resultData = ResultBuilder.createTabularResultData();
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
 
-      for (DistributedMember member : dsMembers) {
-        ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
-
-        if (gatewayReceiverObjectName != null) {
-          receiverBean =
-              service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
-          if (receiverBean != null) {
-            if (receiverBean.isRunning()) {
-              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                  CliStrings.GATEWAY_ERROR,
-                  CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_ALREADY_STARTED_ON_MEMBER_0,
-                      new Object[] {member.getId()}));
-            } else {
-              receiverBean.start();
-              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                  CliStrings.GATEWAY_OK,
-                  CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_STARTED_ON_MEMBER_0,
-                      new Object[] {member.getId()}));
-            }
-          } else {
+    for (DistributedMember member : dsMembers) {
+      ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
+
+      if (gatewayReceiverObjectName != null) {
+        receiverBean =
+            service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
+        if (receiverBean != null) {
+          if (receiverBean.isRunning()) {
             GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
                 CliStrings.GATEWAY_ERROR,
-                CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0,
+                CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_ALREADY_STARTED_ON_MEMBER_0,
+                    new Object[] {member.getId()}));
+          } else {
+            receiverBean.start();
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_OK,
+                CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_STARTED_ON_MEMBER_0,
                     new Object[] {member.getId()}));
           }
         } else {
@@ -102,14 +94,15 @@ public class StartGatewayReceiverCommand implements GfshCommand {
               CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0,
                   new Object[] {member.getId()}));
         }
+      } else {
+        GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+            CliStrings.GATEWAY_ERROR,
+            CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0,
+                new Object[] {member.getId()}));
       }
-      result = ResultBuilder.buildResult(resultData);
-    } catch (CommandResultException crex) {
-      result = GatewayCommandsUtils.handleCommandResultException(crex);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
     }
+    result = ResultBuilder.buildResult(resultData);
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java
index 986260a..7ea8b07 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java
@@ -40,8 +40,6 @@ import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.SystemManagementService;
-import org.apache.geode.management.internal.cli.CliUtil;
-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.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
@@ -69,99 +67,94 @@ public class StartGatewaySenderCommand implements GfshCommand {
     Result result;
     final String id = senderId.trim();
 
-    try {
-      final InternalCache cache = getCache();
-      final SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    final InternalCache cache = getCache();
+    final SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      TabularResultData resultData = ResultBuilder.createTabularResultData();
+    TabularResultData resultData = ResultBuilder.createTabularResultData();
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    Set<DistributedMember> dsMembers = findMembers(onGroup, onMember);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
 
-      ExecutorService execService = Executors.newCachedThreadPool(new ThreadFactory() {
-        AtomicInteger threadNum = new AtomicInteger();
+    ExecutorService execService = Executors.newCachedThreadPool(new ThreadFactory() {
+      AtomicInteger threadNum = new AtomicInteger();
 
-        public Thread newThread(final Runnable r) {
-          Thread result =
-              new Thread(r, "Start Sender Command Thread " + threadNum.incrementAndGet());
-          result.setDaemon(true);
-          return result;
-        }
-      });
+      public Thread newThread(final Runnable r) {
+        Thread result = new Thread(r, "Start Sender Command Thread " + threadNum.incrementAndGet());
+        result.setDaemon(true);
+        return result;
+      }
+    });
 
-      List<Callable<List>> callables = new ArrayList<>();
+    List<Callable<List>> callables = new ArrayList<>();
 
-      for (final DistributedMember member : dsMembers) {
+    for (final DistributedMember member : dsMembers) {
 
-        callables.add(() -> {
+      callables.add(() -> {
 
-          GatewaySenderMXBean bean;
-          ArrayList<String> statusList = new ArrayList<>();
-          if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
-            bean = service.getLocalGatewaySenderMXBean(id);
-          } else {
-            ObjectName objectName = service.getGatewaySenderMBeanName(member, id);
-            bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
-          }
-          if (bean != null) {
-            if (bean.isRunning()) {
-              statusList.add(member.getId());
-              statusList.add(CliStrings.GATEWAY_ERROR);
-              statusList.add(CliStrings.format(
-                  CliStrings.GATEWAY_SENDER_0_IS_ALREADY_STARTED_ON_MEMBER_1, id, member.getId()));
-            } else {
-              bean.start();
-              statusList.add(member.getId());
-              statusList.add(CliStrings.GATEWAY_OK);
-              statusList.add(CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_STARTED_ON_MEMBER_1,
-                  id, member.getId()));
-            }
-          } else {
+        GatewaySenderMXBean bean;
+        ArrayList<String> statusList = new ArrayList<>();
+        if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
+          bean = service.getLocalGatewaySenderMXBean(id);
+        } else {
+          ObjectName objectName = service.getGatewaySenderMBeanName(member, id);
+          bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
+        }
+        if (bean != null) {
+          if (bean.isRunning()) {
             statusList.add(member.getId());
             statusList.add(CliStrings.GATEWAY_ERROR);
             statusList.add(CliStrings.format(
-                CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, id, member.getId()));
+                CliStrings.GATEWAY_SENDER_0_IS_ALREADY_STARTED_ON_MEMBER_1, id, member.getId()));
+          } else {
+            bean.start();
+            statusList.add(member.getId());
+            statusList.add(CliStrings.GATEWAY_OK);
+            statusList.add(CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_STARTED_ON_MEMBER_1, id,
+                member.getId()));
           }
-          return statusList;
+        } else {
+          statusList.add(member.getId());
+          statusList.add(CliStrings.GATEWAY_ERROR);
+          statusList.add(CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1,
+              id, member.getId()));
+        }
+        return statusList;
 
-        });
-      }
+      });
+    }
 
-      Iterator<DistributedMember> memberIterator = dsMembers.iterator();
-      List<Future<List>> futures = null;
+    Iterator<DistributedMember> memberIterator = dsMembers.iterator();
+    List<Future<List>> futures = null;
 
-      try {
-        futures = execService.invokeAll(callables);
-      } catch (InterruptedException ite) {
-        GatewayCommandsUtils.accumulateStartResult(resultData, null, CliStrings.GATEWAY_ERROR,
-            CliStrings.format(CliStrings.GATEWAY_SENDER_0_COULD_NOT_BE_INVOKED_DUE_TO_1, id,
-                ite.getMessage()));
-      }
+    try {
+      futures = execService.invokeAll(callables);
+    } catch (InterruptedException ite) {
+      GatewayCommandsUtils.accumulateStartResult(resultData, null, CliStrings.GATEWAY_ERROR,
+          CliStrings.format(CliStrings.GATEWAY_SENDER_0_COULD_NOT_BE_INVOKED_DUE_TO_1, id,
+              ite.getMessage()));
+    }
 
-      for (Future<List> future : futures) {
-        DistributedMember member = memberIterator.next();
-        List<String> memberStatus;
-        try {
-          memberStatus = future.get();
-          GatewayCommandsUtils.accumulateStartResult(resultData, memberStatus.get(0),
-              memberStatus.get(1), memberStatus.get(2));
-        } catch (InterruptedException | ExecutionException ite) {
-          GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-              CliStrings.GATEWAY_ERROR,
-              CliStrings.format(CliStrings.GATEWAY_SENDER_0_COULD_NOT_BE_STARTED_ON_MEMBER_DUE_TO_1,
-                  id, ite.getMessage()));
-        }
+    for (Future<List> future : futures) {
+      DistributedMember member = memberIterator.next();
+      List<String> memberStatus;
+      try {
+        memberStatus = future.get();
+        GatewayCommandsUtils.accumulateStartResult(resultData, memberStatus.get(0),
+            memberStatus.get(1), memberStatus.get(2));
+      } catch (InterruptedException | ExecutionException ite) {
+        GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+            CliStrings.GATEWAY_ERROR,
+            CliStrings.format(CliStrings.GATEWAY_SENDER_0_COULD_NOT_BE_STARTED_ON_MEMBER_DUE_TO_1,
+                id, ite.getMessage()));
       }
-      execService.shutdown();
-      result = ResultBuilder.buildResult(resultData);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
     }
+    execService.shutdown();
+    result = ResultBuilder.buildResult(resultData);
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java
index 6020eca..1e6f5da 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartLocatorCommand.java
@@ -28,13 +28,11 @@ import javax.net.ssl.SSLException;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.distributed.AbstractLauncher;
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.distributed.LocatorLauncher;
 import org.apache.geode.distributed.ServerLauncher;
 import org.apache.geode.internal.OSProcess;
-import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.lang.StringUtils;
 import org.apache.geode.internal.lang.SystemUtils;
 import org.apache.geode.internal.process.ProcessStreamReader;
@@ -119,219 +117,193 @@ public class StartLocatorCommand implements GfshCommand {
       @CliOption(key = CliStrings.START_LOCATOR__HTTP_SERVICE_PORT,
           help = CliStrings.START_LOCATOR__HTTP_SERVICE_PORT__HELP) final Integer httpServicePort,
       @CliOption(key = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS,
-          help = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS__HELP) final String httpServiceBindAddress) {
-    try {
-      if (StringUtils.isBlank(memberName)) {
-        // when the user doesn't give us a name, we make one up!
-        memberName = StartMemberUtils.getNameGenerator().generate('-');
-      }
+          help = CliStrings.START_LOCATOR__HTTP_SERVICE_BIND_ADDRESS__HELP) final String httpServiceBindAddress)
+      throws Exception {
+    if (StringUtils.isBlank(memberName)) {
+      // when the user doesn't give us a name, we make one up!
+      memberName = StartMemberUtils.getNameGenerator().generate('-');
+    }
 
-      workingDirectory = StartMemberUtils.resolveWorkingDir(workingDirectory, memberName);
+    workingDirectory = StartMemberUtils.resolveWorkingDir(workingDirectory, memberName);
 
-      if (gemfirePropertiesFile != null && !gemfirePropertiesFile.exists()) {
-        return ResultBuilder.createUserErrorResult(
-            CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY,
-                gemfirePropertiesFile.getAbsolutePath()));
-      }
+    if (gemfirePropertiesFile != null && !gemfirePropertiesFile.exists()) {
+      return ResultBuilder.createUserErrorResult(
+          CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY,
+              gemfirePropertiesFile.getAbsolutePath()));
+    }
 
-      if (gemfireSecurityPropertiesFile != null && !gemfireSecurityPropertiesFile.exists()) {
-        return ResultBuilder.createUserErrorResult(
-            CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
-                gemfireSecurityPropertiesFile.getAbsolutePath()));
-      }
+    if (gemfireSecurityPropertiesFile != null && !gemfireSecurityPropertiesFile.exists()) {
+      return ResultBuilder.createUserErrorResult(
+          CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
+              gemfireSecurityPropertiesFile.getAbsolutePath()));
+    }
 
-      File locatorPidFile = new File(workingDirectory, ProcessType.LOCATOR.getPidFileName());
-
-      final int oldPid = StartMemberUtils.readPid(locatorPidFile);
-
-      Properties gemfireProperties = new Properties();
-
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.GROUPS,
-          group);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOCATORS,
-          locators);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOG_LEVEL,
-          logLevel);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.MCAST_ADDRESS, mcastBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_PORT,
-          mcastPort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, enableSharedConfiguration);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.LOAD_CLUSTER_CONFIGURATION_FROM_DIR,
-          loadSharedConfigurationFromDirectory);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.CLUSTER_CONFIGURATION_DIR, clusterConfigDir);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.HTTP_SERVICE_PORT, httpServicePort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS, httpServiceBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.JMX_MANAGER_HOSTNAME_FOR_CLIENTS, jmxManagerHostnameForClients);
-
-      // read the OSProcess enable redirect system property here
-      // TODO: replace with new GFSH argument
-      final boolean redirectOutput =
-          Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY);
-      LocatorLauncher.Builder locatorLauncherBuilder =
-          new LocatorLauncher.Builder().setBindAddress(bindAddress).setForce(force).setPort(port)
-              .setRedirectOutput(redirectOutput).setWorkingDirectory(workingDirectory);
-      if (hostnameForClients != null) {
-        locatorLauncherBuilder.setHostnameForClients(hostnameForClients);
-      }
-      if (memberName != null) {
-        locatorLauncherBuilder.setMemberName(memberName);
+    File locatorPidFile = new File(workingDirectory, ProcessType.LOCATOR.getPidFileName());
+
+    final int oldPid = StartMemberUtils.readPid(locatorPidFile);
+
+    Properties gemfireProperties = new Properties();
+
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.GROUPS, group);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOCATORS,
+        locators);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOG_LEVEL,
+        logLevel);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_ADDRESS,
+        mcastBindAddress);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_PORT,
+        mcastPort);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.ENABLE_CLUSTER_CONFIGURATION, enableSharedConfiguration);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.LOAD_CLUSTER_CONFIGURATION_FROM_DIR,
+        loadSharedConfigurationFromDirectory);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.CLUSTER_CONFIGURATION_DIR, clusterConfigDir);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.HTTP_SERVICE_PORT, httpServicePort);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS, httpServiceBindAddress);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.JMX_MANAGER_HOSTNAME_FOR_CLIENTS, jmxManagerHostnameForClients);
+
+    // read the OSProcess enable redirect system property here
+    // TODO: replace with new GFSH argument
+    final boolean redirectOutput = Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY);
+    LocatorLauncher.Builder locatorLauncherBuilder =
+        new LocatorLauncher.Builder().setBindAddress(bindAddress).setForce(force).setPort(port)
+            .setRedirectOutput(redirectOutput).setWorkingDirectory(workingDirectory);
+    if (hostnameForClients != null) {
+      locatorLauncherBuilder.setHostnameForClients(hostnameForClients);
+    }
+    if (memberName != null) {
+      locatorLauncherBuilder.setMemberName(memberName);
+    }
+    LocatorLauncher locatorLauncher = locatorLauncherBuilder.build();
+
+    String[] locatorCommandLine = createStartLocatorCommandLine(locatorLauncher,
+        gemfirePropertiesFile, gemfireSecurityPropertiesFile, gemfireProperties, classpath,
+        includeSystemClasspath, jvmArgsOpts, initialHeap, maxHeap);
+
+    final Process locatorProcess = new ProcessBuilder(locatorCommandLine)
+        .directory(new File(locatorLauncher.getWorkingDirectory())).start();
+
+    locatorProcess.getInputStream().close();
+    locatorProcess.getOutputStream().close();
+
+    // fix TRAC bug #51967 by using NON_BLOCKING on Windows
+    final ProcessStreamReader.ReadingMode readingMode = SystemUtils.isWindows()
+        ? ProcessStreamReader.ReadingMode.NON_BLOCKING : ProcessStreamReader.ReadingMode.BLOCKING;
+
+    final StringBuffer message = new StringBuffer(); // need thread-safe StringBuffer
+    ProcessStreamReader.InputListener inputListener = line -> {
+      message.append(line);
+      if (readingMode == ProcessStreamReader.ReadingMode.BLOCKING) {
+        message.append(StringUtils.LINE_SEPARATOR);
       }
-      LocatorLauncher locatorLauncher = locatorLauncherBuilder.build();
+    };
 
-      String[] locatorCommandLine = createStartLocatorCommandLine(locatorLauncher,
-          gemfirePropertiesFile, gemfireSecurityPropertiesFile, gemfireProperties, classpath,
-          includeSystemClasspath, jvmArgsOpts, initialHeap, maxHeap);
+    ProcessStreamReader stderrReader = new ProcessStreamReader.Builder(locatorProcess)
+        .inputStream(locatorProcess.getErrorStream()).inputListener(inputListener)
+        .readingMode(readingMode).continueReadingMillis(2 * 1000).build().start();
 
-      final Process locatorProcess = new ProcessBuilder(locatorCommandLine)
-          .directory(new File(locatorLauncher.getWorkingDirectory())).start();
+    LocatorLauncher.LocatorState locatorState;
 
-      locatorProcess.getInputStream().close();
-      locatorProcess.getOutputStream().close();
+    String previousLocatorStatusMessage = null;
 
-      // fix TRAC bug #51967 by using NON_BLOCKING on Windows
-      final ProcessStreamReader.ReadingMode readingMode = SystemUtils.isWindows()
-          ? ProcessStreamReader.ReadingMode.NON_BLOCKING : ProcessStreamReader.ReadingMode.BLOCKING;
+    LauncherSignalListener locatorSignalListener = new LauncherSignalListener();
 
-      final StringBuffer message = new StringBuffer(); // need thread-safe StringBuffer
-      ProcessStreamReader.InputListener inputListener = line -> {
-        message.append(line);
-        if (readingMode == ProcessStreamReader.ReadingMode.BLOCKING) {
-          message.append(StringUtils.LINE_SEPARATOR);
-        }
-      };
+    final boolean registeredLocatorSignalListener =
+        getGfsh().getSignalHandler().registerListener(locatorSignalListener);
 
-      ProcessStreamReader stderrReader = new ProcessStreamReader.Builder(locatorProcess)
-          .inputStream(locatorProcess.getErrorStream()).inputListener(inputListener)
-          .readingMode(readingMode).continueReadingMillis(2 * 1000).build().start();
+    try {
+      getGfsh().logInfo(String.format(CliStrings.START_LOCATOR__RUN_MESSAGE, IOUtils
+          .tryGetCanonicalPathElseGetAbsolutePath(new File(locatorLauncher.getWorkingDirectory()))),
+          null);
 
-      LocatorLauncher.LocatorState locatorState;
+      do {
+        if (locatorProcess.isAlive()) {
+          Gfsh.print(".");
 
-      String previousLocatorStatusMessage = null;
+          synchronized (this) {
+            TimeUnit.MILLISECONDS.timedWait(this, 500);
+          }
 
-      LauncherSignalListener locatorSignalListener = new LauncherSignalListener();
+          locatorState = LocatorLauncher.LocatorState.fromDirectory(workingDirectory, memberName);
 
-      final boolean registeredLocatorSignalListener =
-          getGfsh().getSignalHandler().registerListener(locatorSignalListener);
+          String currentLocatorStatusMessage = locatorState.getStatusMessage();
 
-      try {
-        getGfsh().logInfo(String.format(CliStrings.START_LOCATOR__RUN_MESSAGE,
-            IOUtils.tryGetCanonicalPathElseGetAbsolutePath(
-                new File(locatorLauncher.getWorkingDirectory()))),
-            null);
-
-        do {
-          if (locatorProcess.isAlive()) {
-            Gfsh.print(".");
-
-            synchronized (this) {
-              TimeUnit.MILLISECONDS.timedWait(this, 500);
-            }
-
-            locatorState = LocatorLauncher.LocatorState.fromDirectory(workingDirectory, memberName);
-
-            String currentLocatorStatusMessage = locatorState.getStatusMessage();
-
-            if (locatorState.isStartingOrNotResponding()
-                && !(StringUtils.isBlank(currentLocatorStatusMessage)
-                    || currentLocatorStatusMessage.equalsIgnoreCase(previousLocatorStatusMessage)
-                    || currentLocatorStatusMessage.trim().toLowerCase().equals("null"))) {
-              Gfsh.println();
-              Gfsh.println(currentLocatorStatusMessage);
-              previousLocatorStatusMessage = currentLocatorStatusMessage;
-            }
-          } else {
-            final int exitValue = locatorProcess.exitValue();
-
-            return ResultBuilder.createShellClientErrorResult(
-                String.format(CliStrings.START_LOCATOR__PROCESS_TERMINATED_ABNORMALLY_ERROR_MESSAGE,
-                    exitValue, locatorLauncher.getWorkingDirectory(), message.toString()));
+          if (locatorState.isStartingOrNotResponding()
+              && !(StringUtils.isBlank(currentLocatorStatusMessage)
+                  || currentLocatorStatusMessage.equalsIgnoreCase(previousLocatorStatusMessage)
+                  || currentLocatorStatusMessage.trim().toLowerCase().equals("null"))) {
+            Gfsh.println();
+            Gfsh.println(currentLocatorStatusMessage);
+            previousLocatorStatusMessage = currentLocatorStatusMessage;
           }
-        } while (!(registeredLocatorSignalListener && locatorSignalListener.isSignaled())
-            && locatorState.isStartingOrNotResponding());
-      } finally {
-        // stop will close
-        stderrReader.stopAsync(StartMemberUtils.PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS);
-
-        // ErrorStream
-        getGfsh().getSignalHandler().unregisterListener(locatorSignalListener);
-      }
+        } else {
+          final int exitValue = locatorProcess.exitValue();
 
-      Gfsh.println();
+          return ResultBuilder.createShellClientErrorResult(
+              String.format(CliStrings.START_LOCATOR__PROCESS_TERMINATED_ABNORMALLY_ERROR_MESSAGE,
+                  exitValue, locatorLauncher.getWorkingDirectory(), message.toString()));
+        }
+      } while (!(registeredLocatorSignalListener && locatorSignalListener.isSignaled())
+          && locatorState.isStartingOrNotResponding());
+    } finally {
+      // stop will close
+      stderrReader.stopAsync(StartMemberUtils.PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS);
 
-      final boolean asyncStart =
-          (registeredLocatorSignalListener && locatorSignalListener.isSignaled()
-              && ServerLauncher.ServerState.isStartingNotRespondingOrNull(locatorState));
+      // ErrorStream
+      getGfsh().getSignalHandler().unregisterListener(locatorSignalListener);
+    }
 
-      InfoResultData infoResultData = ResultBuilder.createInfoResultData();
+    Gfsh.println();
 
-      if (asyncStart) {
-        infoResultData.addLine(
-            String.format(CliStrings.ASYNC_PROCESS_LAUNCH_MESSAGE, CliStrings.LOCATOR_TERM_NAME));
-        return ResultBuilder.buildResult(infoResultData);
-      }
+    final boolean asyncStart =
+        (registeredLocatorSignalListener && locatorSignalListener.isSignaled()
+            && ServerLauncher.ServerState.isStartingNotRespondingOrNull(locatorState));
 
-      infoResultData.addLine(locatorState.toString());
-      String locatorHostName;
-      InetAddress bindAddr = locatorLauncher.getBindAddress();
-      if (bindAddr != null) {
-        locatorHostName = bindAddr.getCanonicalHostName();
-      } else {
-        locatorHostName = StringUtils.defaultIfBlank(locatorLauncher.getHostnameForClients(),
-            HostUtils.getLocalHost());
-      }
+    InfoResultData infoResultData = ResultBuilder.createInfoResultData();
+
+    if (asyncStart) {
+      infoResultData.addLine(
+          String.format(CliStrings.ASYNC_PROCESS_LAUNCH_MESSAGE, CliStrings.LOCATOR_TERM_NAME));
+      return ResultBuilder.buildResult(infoResultData);
+    }
 
-      int locatorPort = Integer.parseInt(locatorState.getPort());
+    infoResultData.addLine(locatorState.toString());
+    String locatorHostName;
+    InetAddress bindAddr = locatorLauncher.getBindAddress();
+    if (bindAddr != null) {
+      locatorHostName = bindAddr.getCanonicalHostName();
+    } else {
+      locatorHostName = StringUtils.defaultIfBlank(locatorLauncher.getHostnameForClients(),
+          HostUtils.getLocalHost());
+    }
 
+    int locatorPort = Integer.parseInt(locatorState.getPort());
 
-      ConnectCommand connectCommand = new ConnectCommand();
-      Properties configProperties = connectCommand.resolveSslProperties(getGfsh(), false,
-          gemfirePropertiesFile, gemfireSecurityPropertiesFile);
 
-      // AUTO-CONNECT
-      // If the connect succeeds add the connected message to the result,
-      // Else, ask the user to use the "connect" command to connect to the Locator.
-      if (shouldAutoConnect(connect)) {
-        doAutoConnect(locatorHostName, locatorPort, configProperties, infoResultData);
-      }
+    ConnectCommand connectCommand = new ConnectCommand();
+    Properties configProperties = connectCommand.resolveSslProperties(getGfsh(), false,
+        gemfirePropertiesFile, gemfireSecurityPropertiesFile);
 
-      // Report on the state of the Shared Configuration service if enabled...
-      if (enableSharedConfiguration) {
-        infoResultData.addLine(ClusterConfigurationStatusRetriever.fromLocator(locatorHostName,
-            locatorPort, configProperties));
-      }
+    // AUTO-CONNECT
+    // If the connect succeeds add the connected message to the result,
+    // Else, ask the user to use the "connect" command to connect to the Locator.
+    if (shouldAutoConnect(connect)) {
+      doAutoConnect(locatorHostName, locatorPort, configProperties, infoResultData);
+    }
 
-      return ResultBuilder.buildResult(infoResultData);
-    } catch (IllegalArgumentException e) {
-      String message = e.getMessage();
-      if (message != null && message.matches(
-          LocalizedStrings.Launcher_Builder_UNKNOWN_HOST_ERROR_MESSAGE.toLocalizedString(".+"))) {
-        message =
-            CliStrings.format(CliStrings.LAUNCHERLIFECYCLECOMMANDS__MSG__FAILED_TO_START_0_REASON_1,
-                CliStrings.LOCATOR_TERM_NAME, message);
-      }
-      return ResultBuilder.createUserErrorResult(message);
-    } catch (IllegalStateException e) {
-      return ResultBuilder.createUserErrorResult(e.getMessage());
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      String errorMessage = String.format(CliStrings.START_LOCATOR__GENERAL_ERROR_MESSAGE,
-          StringUtils.defaultIfBlank(workingDirectory, memberName),
-          HostUtils.getLocatorId(bindAddress, port), this.toString(t, getGfsh().getDebug()));
-      getGfsh().logToFile(errorMessage, t);
-      return ResultBuilder.createShellClientErrorResult(errorMessage);
-    } finally {
-      Gfsh.redirectInternalJavaLoggers();
+    // Report on the state of the Shared Configuration service if enabled...
+    if (enableSharedConfiguration) {
+      infoResultData.addLine(ClusterConfigurationStatusRetriever.fromLocator(locatorHostName,
+          locatorPort, configProperties));
     }
+
+    return ResultBuilder.buildResult(infoResultData);
+
   }
 
   // TODO should we connect implicitly when in non-interactive, headless mode (e.g. gfsh -e "start
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
index 8080e3f..3522701 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StartServerCommand.java
@@ -26,13 +26,11 @@ import javax.management.MalformedObjectNameException;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.server.CacheServer;
 import org.apache.geode.distributed.AbstractLauncher;
 import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.distributed.ServerLauncher;
 import org.apache.geode.internal.OSProcess;
-import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.lang.StringUtils;
 import org.apache.geode.internal.lang.SystemUtils;
 import org.apache.geode.internal.process.ProcessStreamReader;
@@ -176,243 +174,221 @@ public class StartServerCommand implements GfshCommand {
           help = CliStrings.START_SERVER__USERNAME__HELP) final String userName,
       @CliOption(key = CliStrings.START_SERVER__PASSWORD, unspecifiedDefaultValue = "",
           help = CliStrings.START_SERVER__PASSWORD__HELP) String passwordToUse)
+      throws Exception
   // NOTICE: keep the parameters in alphabetical order based on their CliStrings.START_SERVER_* text
   {
-    try {
-      if (StringUtils.isBlank(memberName)) {
-        // when the user doesn't give us a name, we make one up!
-        memberName = StartMemberUtils.getNameGenerator().generate('-');
-      }
 
-      // prompt for password is username is specified in the command
-      if (StringUtils.isNotBlank(userName)) {
-        if (StringUtils.isBlank(passwordToUse)) {
-          passwordToUse = getGfsh().readPassword(CliStrings.START_SERVER__PASSWORD + ": ");
-        }
-        if (StringUtils.isBlank(passwordToUse)) {
-          return ResultBuilder.createConnectionErrorResult(
-              CliStrings.START_SERVER__MSG__PASSWORD_MUST_BE_SPECIFIED);
-        }
+    if (StringUtils.isBlank(memberName)) {
+      // when the user doesn't give us a name, we make one up!
+      memberName = StartMemberUtils.getNameGenerator().generate('-');
+    }
+
+    // prompt for password is username is specified in the command
+    if (StringUtils.isNotBlank(userName)) {
+      if (StringUtils.isBlank(passwordToUse)) {
+        passwordToUse = getGfsh().readPassword(CliStrings.START_SERVER__PASSWORD + ": ");
+      }
+      if (StringUtils.isBlank(passwordToUse)) {
+        return ResultBuilder
+            .createConnectionErrorResult(CliStrings.START_SERVER__MSG__PASSWORD_MUST_BE_SPECIFIED);
       }
+    }
 
-      workingDirectory = StartMemberUtils.resolveWorkingDir(workingDirectory, memberName);
+    workingDirectory = StartMemberUtils.resolveWorkingDir(workingDirectory, memberName);
 
-      cacheXmlPathname = CliUtil.resolvePathname(cacheXmlPathname);
+    cacheXmlPathname = CliUtil.resolvePathname(cacheXmlPathname);
 
-      if (StringUtils.isNotBlank(cacheXmlPathname)
-          && !IOUtils.isExistingPathname(cacheXmlPathname)) {
-        return ResultBuilder.createUserErrorResult(
-            CliStrings.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname));
-      }
+    if (StringUtils.isNotBlank(cacheXmlPathname) && !IOUtils.isExistingPathname(cacheXmlPathname)) {
+      return ResultBuilder.createUserErrorResult(
+          CliStrings.format(CliStrings.CACHE_XML_NOT_FOUND_MESSAGE, cacheXmlPathname));
+    }
 
-      if (gemfirePropertiesFile != null && !gemfirePropertiesFile.exists()) {
-        return ResultBuilder.createUserErrorResult(
-            CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY,
-                gemfirePropertiesFile.getAbsolutePath()));
-      }
+    if (gemfirePropertiesFile != null && !gemfirePropertiesFile.exists()) {
+      return ResultBuilder.createUserErrorResult(
+          CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, StringUtils.EMPTY,
+              gemfirePropertiesFile.getAbsolutePath()));
+    }
 
-      if (gemfireSecurityPropertiesFile != null && !gemfireSecurityPropertiesFile.exists()) {
-        return ResultBuilder.createUserErrorResult(
-            CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
-                gemfireSecurityPropertiesFile.getAbsolutePath()));
-      }
+    if (gemfireSecurityPropertiesFile != null && !gemfireSecurityPropertiesFile.exists()) {
+      return ResultBuilder.createUserErrorResult(
+          CliStrings.format(CliStrings.GEODE_0_PROPERTIES_1_NOT_FOUND_MESSAGE, "Security ",
+              gemfireSecurityPropertiesFile.getAbsolutePath()));
+    }
 
-      File serverPidFile = new File(workingDirectory, ProcessType.SERVER.getPidFileName());
-
-      final int oldPid = StartMemberUtils.readPid(serverPidFile);
-
-      Properties gemfireProperties = new Properties();
-
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.BIND_ADDRESS,
-          bindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.CACHE_XML_FILE, cacheXmlPathname);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.ENABLE_TIME_STATISTICS, enableTimeStatistics);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.GROUPS,
-          group);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.JMX_MANAGER_HOSTNAME_FOR_CLIENTS, jmxManagerHostnameForClients);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOCATORS,
-          locators);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.LOCATOR_WAIT_TIME, locatorWaitTime);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOG_LEVEL,
-          logLevel);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.MCAST_ADDRESS, mcastBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_PORT,
-          mcastPort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.MEMCACHED_PORT, memcachedPort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.MEMCACHED_PROTOCOL, memcachedProtocol);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.MEMCACHED_BIND_ADDRESS, memcachedBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.REDIS_PORT,
-          redisPort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.REDIS_BIND_ADDRESS, redisBindAddress);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.REDIS_PASSWORD, redisPassword);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statisticsArchivePathname);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.USE_CLUSTER_CONFIGURATION, requestSharedConfiguration);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOCK_MEMORY,
-          lockMemory);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.OFF_HEAP_MEMORY_SIZE, offHeapMemorySize);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.START_DEV_REST_API, startRestApi);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.HTTP_SERVICE_PORT, httpServicePort);
-      StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
-          ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS, httpServiceBindAddress);
-      // if username is specified in the command line, it will overwrite what's set in the
-      // properties file
-      if (StringUtils.isNotBlank(userName)) {
-        gemfireProperties.setProperty(ResourceConstants.USER_NAME, userName);
-        gemfireProperties.setProperty(ResourceConstants.PASSWORD, passwordToUse);
-      }
+    File serverPidFile = new File(workingDirectory, ProcessType.SERVER.getPidFileName());
+
+    final int oldPid = StartMemberUtils.readPid(serverPidFile);
+
+    Properties gemfireProperties = new Properties();
+
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.BIND_ADDRESS,
+        bindAddress);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.CACHE_XML_FILE,
+        cacheXmlPathname);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.ENABLE_TIME_STATISTICS, enableTimeStatistics);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.GROUPS, group);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.JMX_MANAGER_HOSTNAME_FOR_CLIENTS, jmxManagerHostnameForClients);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOCATORS,
+        locators);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.LOCATOR_WAIT_TIME, locatorWaitTime);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOG_LEVEL,
+        logLevel);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_ADDRESS,
+        mcastBindAddress);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MCAST_PORT,
+        mcastPort);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.MEMCACHED_PORT,
+        memcachedPort);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.MEMCACHED_PROTOCOL, memcachedProtocol);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.MEMCACHED_BIND_ADDRESS, memcachedBindAddress);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.REDIS_PORT,
+        redisPort);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.REDIS_BIND_ADDRESS, redisBindAddress);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.REDIS_PASSWORD,
+        redisPassword);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.STATISTIC_ARCHIVE_FILE, statisticsArchivePathname);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.USE_CLUSTER_CONFIGURATION, requestSharedConfiguration);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties, ConfigurationProperties.LOCK_MEMORY,
+        lockMemory);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.OFF_HEAP_MEMORY_SIZE, offHeapMemorySize);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.START_DEV_REST_API, startRestApi);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.HTTP_SERVICE_PORT, httpServicePort);
+    StartMemberUtils.setPropertyIfNotNull(gemfireProperties,
+        ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS, httpServiceBindAddress);
+    // if username is specified in the command line, it will overwrite what's set in the
+    // properties file
+    if (StringUtils.isNotBlank(userName)) {
+      gemfireProperties.setProperty(ResourceConstants.USER_NAME, userName);
+      gemfireProperties.setProperty(ResourceConstants.PASSWORD, passwordToUse);
+    }
 
-      // read the OSProcess enable redirect system property here -- TODO: replace with new GFSH
-      // argument
-      final boolean redirectOutput =
-          Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY);
-
-      ServerLauncher.Builder serverLauncherBuilder = new ServerLauncher.Builder()
-          .setAssignBuckets(assignBuckets).setDisableDefaultServer(disableDefaultServer)
-          .setForce(force).setRebalance(rebalance).setRedirectOutput(redirectOutput)
-          .setServerBindAddress(serverBindAddress).setServerPort(serverPort)
-          .setSpringXmlLocation(springXmlLocation).setWorkingDirectory(workingDirectory)
-          .setCriticalHeapPercentage(criticalHeapPercentage)
-          .setEvictionHeapPercentage(evictionHeapPercentage)
-          .setCriticalOffHeapPercentage(criticalOffHeapPercentage)
-          .setEvictionOffHeapPercentage(evictionOffHeapPercentage).setMaxConnections(maxConnections)
-          .setMaxMessageCount(maxMessageCount).setMaxThreads(maxThreads)
-          .setMessageTimeToLive(messageTimeToLive).setSocketBufferSize(socketBufferSize);
-      if (hostNameForClients != null) {
-        serverLauncherBuilder.setHostNameForClients(hostNameForClients);
-      }
-      if (memberName != null) {
-        serverLauncherBuilder.setMemberName(memberName);
-      }
-      ServerLauncher serverLauncher = serverLauncherBuilder.build();
+    // read the OSProcess enable redirect system property here -- TODO: replace with new GFSH
+    // argument
+    final boolean redirectOutput = Boolean.getBoolean(OSProcess.ENABLE_OUTPUT_REDIRECTION_PROPERTY);
+
+    ServerLauncher.Builder serverLauncherBuilder = new ServerLauncher.Builder()
+        .setAssignBuckets(assignBuckets).setDisableDefaultServer(disableDefaultServer)
+        .setForce(force).setRebalance(rebalance).setRedirectOutput(redirectOutput)
+        .setServerBindAddress(serverBindAddress).setServerPort(serverPort)
+        .setSpringXmlLocation(springXmlLocation).setWorkingDirectory(workingDirectory)
+        .setCriticalHeapPercentage(criticalHeapPercentage)
+        .setEvictionHeapPercentage(evictionHeapPercentage)
+        .setCriticalOffHeapPercentage(criticalOffHeapPercentage)
+        .setEvictionOffHeapPercentage(evictionOffHeapPercentage).setMaxConnections(maxConnections)
+        .setMaxMessageCount(maxMessageCount).setMaxThreads(maxThreads)
+        .setMessageTimeToLive(messageTimeToLive).setSocketBufferSize(socketBufferSize);
+    if (hostNameForClients != null) {
+      serverLauncherBuilder.setHostNameForClients(hostNameForClients);
+    }
+    if (memberName != null) {
+      serverLauncherBuilder.setMemberName(memberName);
+    }
+    ServerLauncher serverLauncher = serverLauncherBuilder.build();
 
-      String[] serverCommandLine = createStartServerCommandLine(serverLauncher,
-          gemfirePropertiesFile, gemfireSecurityPropertiesFile, gemfireProperties, classpath,
-          includeSystemClasspath, jvmArgsOpts, disableExitWhenOutOfMemory, initialHeap, maxHeap);
+    String[] serverCommandLine = createStartServerCommandLine(serverLauncher, gemfirePropertiesFile,
+        gemfireSecurityPropertiesFile, gemfireProperties, classpath, includeSystemClasspath,
+        jvmArgsOpts, disableExitWhenOutOfMemory, initialHeap, maxHeap);
 
-      if (getGfsh().getDebug()) {
-        getGfsh().logInfo(StringUtils.join(serverCommandLine, StringUtils.SPACE), null);
-      }
+    if (getGfsh().getDebug()) {
+      getGfsh().logInfo(StringUtils.join(serverCommandLine, StringUtils.SPACE), null);
+    }
 
-      Process serverProcess = new ProcessBuilder(serverCommandLine)
-          .directory(new File(serverLauncher.getWorkingDirectory())).start();
+    Process serverProcess = new ProcessBuilder(serverCommandLine)
+        .directory(new File(serverLauncher.getWorkingDirectory())).start();
 
-      serverProcess.getInputStream().close();
-      serverProcess.getOutputStream().close();
+    serverProcess.getInputStream().close();
+    serverProcess.getOutputStream().close();
 
-      // fix TRAC bug #51967 by using NON_BLOCKING on Windows
-      final ProcessStreamReader.ReadingMode readingMode = SystemUtils.isWindows()
-          ? ProcessStreamReader.ReadingMode.NON_BLOCKING : ProcessStreamReader.ReadingMode.BLOCKING;
+    // fix TRAC bug #51967 by using NON_BLOCKING on Windows
+    final ProcessStreamReader.ReadingMode readingMode = SystemUtils.isWindows()
+        ? ProcessStreamReader.ReadingMode.NON_BLOCKING : ProcessStreamReader.ReadingMode.BLOCKING;
 
-      final StringBuffer message = new StringBuffer(); // need thread-safe StringBuffer
-      ProcessStreamReader.InputListener inputListener = line -> {
-        message.append(line);
-        if (readingMode == ProcessStreamReader.ReadingMode.BLOCKING) {
-          message.append(StringUtils.LINE_SEPARATOR);
-        }
-      };
+    final StringBuffer message = new StringBuffer(); // need thread-safe StringBuffer
+    ProcessStreamReader.InputListener inputListener = line -> {
+      message.append(line);
+      if (readingMode == ProcessStreamReader.ReadingMode.BLOCKING) {
+        message.append(StringUtils.LINE_SEPARATOR);
+      }
+    };
 
-      ProcessStreamReader stderrReader = new ProcessStreamReader.Builder(serverProcess)
-          .inputStream(serverProcess.getErrorStream()).inputListener(inputListener)
-          .readingMode(readingMode).continueReadingMillis(2 * 1000).build().start();
+    ProcessStreamReader stderrReader = new ProcessStreamReader.Builder(serverProcess)
+        .inputStream(serverProcess.getErrorStream()).inputListener(inputListener)
+        .readingMode(readingMode).continueReadingMillis(2 * 1000).build().start();
 
-      ServerLauncher.ServerState serverState;
+    ServerLauncher.ServerState serverState;
 
-      String previousServerStatusMessage = null;
+    String previousServerStatusMessage = null;
 
-      LauncherSignalListener serverSignalListener = new LauncherSignalListener();
+    LauncherSignalListener serverSignalListener = new LauncherSignalListener();
 
-      final boolean registeredServerSignalListener =
-          getGfsh().getSignalHandler().registerListener(serverSignalListener);
+    final boolean registeredServerSignalListener =
+        getGfsh().getSignalHandler().registerListener(serverSignalListener);
 
-      try {
-        getGfsh().logInfo(String.format(CliStrings.START_SERVER__RUN_MESSAGE,
-            IOUtils.tryGetCanonicalPathElseGetAbsolutePath(
-                new File(serverLauncher.getWorkingDirectory()))),
-            null);
+    try {
+      getGfsh().logInfo(String.format(CliStrings.START_SERVER__RUN_MESSAGE, IOUtils
+          .tryGetCanonicalPathElseGetAbsolutePath(new File(serverLauncher.getWorkingDirectory()))),
+          null);
 
-        serverState = ServerLauncher.ServerState.fromDirectory(workingDirectory, memberName);
-        do {
-          if (serverProcess.isAlive()) {
-            Gfsh.print(".");
+      serverState = ServerLauncher.ServerState.fromDirectory(workingDirectory, memberName);
+      do {
+        if (serverProcess.isAlive()) {
+          Gfsh.print(".");
 
-            synchronized (this) {
-              TimeUnit.MILLISECONDS.timedWait(this, 500);
-            }
+          synchronized (this) {
+            TimeUnit.MILLISECONDS.timedWait(this, 500);
+          }
 
-            serverState = ServerLauncher.ServerState.fromDirectory(workingDirectory, memberName);
+          serverState = ServerLauncher.ServerState.fromDirectory(workingDirectory, memberName);
 
-            String currentServerStatusMessage = serverState.getStatusMessage();
+          String currentServerStatusMessage = serverState.getStatusMessage();
 
-            if (serverState.isStartingOrNotResponding()
-                && !(StringUtils.isBlank(currentServerStatusMessage)
-                    || currentServerStatusMessage.equalsIgnoreCase(previousServerStatusMessage)
-                    || currentServerStatusMessage.trim().toLowerCase().equals("null"))) {
-              Gfsh.println();
-              Gfsh.println(currentServerStatusMessage);
-              previousServerStatusMessage = currentServerStatusMessage;
-            }
-          } else {
-            final int exitValue = serverProcess.exitValue();
+          if (serverState.isStartingOrNotResponding()
+              && !(StringUtils.isBlank(currentServerStatusMessage)
+                  || currentServerStatusMessage.equalsIgnoreCase(previousServerStatusMessage)
+                  || currentServerStatusMessage.trim().toLowerCase().equals("null"))) {
+            Gfsh.println();
+            Gfsh.println(currentServerStatusMessage);
+            previousServerStatusMessage = currentServerStatusMessage;
+          }
+        } else {
+          final int exitValue = serverProcess.exitValue();
 
-            return ResultBuilder.createShellClientErrorResult(
-                String.format(CliStrings.START_SERVER__PROCESS_TERMINATED_ABNORMALLY_ERROR_MESSAGE,
-                    exitValue, serverLauncher.getWorkingDirectory(), message.toString()));
+          return ResultBuilder.createShellClientErrorResult(
+              String.format(CliStrings.START_SERVER__PROCESS_TERMINATED_ABNORMALLY_ERROR_MESSAGE,
+                  exitValue, serverLauncher.getWorkingDirectory(), message.toString()));
 
-          }
-        } while (!(registeredServerSignalListener && serverSignalListener.isSignaled())
-            && serverState.isStartingOrNotResponding());
-      } finally {
-        stderrReader.stopAsync(StartMemberUtils.PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS); // stop
-                                                                                                  // will
-                                                                                                  // close
-        // ErrorStream
-        getGfsh().getSignalHandler().unregisterListener(serverSignalListener);
-      }
+        }
+      } while (!(registeredServerSignalListener && serverSignalListener.isSignaled())
+          && serverState.isStartingOrNotResponding());
+    } finally {
+      stderrReader.stopAsync(StartMemberUtils.PROCESS_STREAM_READER_ASYNC_STOP_TIMEOUT_MILLIS); // stop
+                                                                                                // will
+                                                                                                // close
+      // ErrorStream
+      getGfsh().getSignalHandler().unregisterListener(serverSignalListener);
+    }
 
-      Gfsh.println();
+    Gfsh.println();
 
-      final boolean asyncStart =
-          ServerLauncher.ServerState.isStartingNotRespondingOrNull(serverState);
+    final boolean asyncStart =
+        ServerLauncher.ServerState.isStartingNotRespondingOrNull(serverState);
 
-      if (asyncStart) { // async start
-        Gfsh.print(String.format(CliStrings.ASYNC_PROCESS_LAUNCH_MESSAGE, SERVER_TERM_NAME));
-        return ResultBuilder.createInfoResult("");
-      } else {
-        return ResultBuilder.createInfoResult(serverState.toString());
-      }
-    } catch (IllegalArgumentException e) {
-      String message = e.getMessage();
-      if (message != null && message.matches(
-          LocalizedStrings.Launcher_Builder_UNKNOWN_HOST_ERROR_MESSAGE.toLocalizedString(".+"))) {
-        message =
-            CliStrings.format(CliStrings.LAUNCHERLIFECYCLECOMMANDS__MSG__FAILED_TO_START_0_REASON_1,
-                SERVER_TERM_NAME, message);
-      }
-      return ResultBuilder.createUserErrorResult(message);
-    } catch (IllegalStateException e) {
-      return ResultBuilder.createUserErrorResult(e.getMessage());
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      return ResultBuilder.createShellClientErrorResult(String.format(
-          CliStrings.START_SERVER__GENERAL_ERROR_MESSAGE, this.toString(t, getGfsh().getDebug())));
+    if (asyncStart) { // async start
+      Gfsh.print(String.format(CliStrings.ASYNC_PROCESS_LAUNCH_MESSAGE, SERVER_TERM_NAME));
+      return ResultBuilder.createInfoResult("");
+    } else {
+      return ResultBuilder.createInfoResult(serverState.toString());
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewayReceiverCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewayReceiverCommand.java
index c1fdaaf..a8829d3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewayReceiverCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewayReceiverCommand.java
@@ -32,7 +32,6 @@ import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.MBeanJMXAdapter;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.management.internal.cli.CliUtil;
-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.CompositeResultData;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
@@ -56,43 +55,39 @@ public class StatusGatewayReceiverCommand implements GfshCommand {
 
     Result result;
 
-    try {
-      InternalCache cache = getCache();
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    InternalCache cache = getCache();
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      CompositeResultData crd = ResultBuilder.createCompositeResultData();
-      TabularResultData availableReceiverData =
-          crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
-              .addTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+    CompositeResultData crd = ResultBuilder.createCompositeResultData();
+    TabularResultData availableReceiverData =
+        crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER_AVAILABLE)
+            .addTable(CliStrings.TABLE_GATEWAY_RECEIVER);
 
-      TabularResultData notAvailableReceiverData =
-          crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE)
-              .addTable(CliStrings.TABLE_GATEWAY_RECEIVER);
+    TabularResultData notAvailableReceiverData =
+        crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE)
+            .addTable(CliStrings.TABLE_GATEWAY_RECEIVER);
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
 
-      for (DistributedMember member : dsMembers) {
-        ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
-        if (gatewayReceiverObjectName != null) {
-          GatewayReceiverMXBean receiverBean =
-              service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
-          if (receiverBean != null) {
-            buildReceiverStatus(member.getId(), receiverBean, availableReceiverData);
-            continue;
-          }
+    for (DistributedMember member : dsMembers) {
+      ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
+      if (gatewayReceiverObjectName != null) {
+        GatewayReceiverMXBean receiverBean =
+            service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
+        if (receiverBean != null) {
+          buildReceiverStatus(member.getId(), receiverBean, availableReceiverData);
+          continue;
         }
-        buildReceiverStatus(member.getId(), null, notAvailableReceiverData);
       }
-      result = ResultBuilder.buildResult(crd);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
+      buildReceiverStatus(member.getId(), null, notAvailableReceiverData);
     }
+    result = ResultBuilder.buildResult(crd);
+
     return result;
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewaySenderCommand.java
index f694705..c0ce5d8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewaySenderCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StatusGatewaySenderCommand.java
@@ -31,7 +31,6 @@ import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.management.internal.cli.CliUtil;
-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.CompositeResultData;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
@@ -60,46 +59,42 @@ public class StatusGatewaySenderCommand implements GfshCommand {
     if (senderId != null) {
       senderId = senderId.trim();
     }
-    try {
-      InternalCache cache = getCache();
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      GatewaySenderMXBean bean;
+    InternalCache cache = getCache();
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      CompositeResultData crd = ResultBuilder.createCompositeResultData();
-      TabularResultData availableSenderData =
-          crd.addSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE)
-              .addTable(CliStrings.TABLE_GATEWAY_SENDER);
+    GatewaySenderMXBean bean;
 
-      TabularResultData notAvailableSenderData =
-          crd.addSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE)
-              .addTable(CliStrings.TABLE_GATEWAY_SENDER);
+    CompositeResultData crd = ResultBuilder.createCompositeResultData();
+    TabularResultData availableSenderData =
+        crd.addSection(CliStrings.SECTION_GATEWAY_SENDER_AVAILABLE)
+            .addTable(CliStrings.TABLE_GATEWAY_SENDER);
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    TabularResultData notAvailableSenderData =
+        crd.addSection(CliStrings.SECTION_GATEWAY_SENDER_NOT_AVAILABLE)
+            .addTable(CliStrings.TABLE_GATEWAY_SENDER);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
 
-      for (DistributedMember member : dsMembers) {
-        if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
-          bean = service.getLocalGatewaySenderMXBean(senderId);
-        } else {
-          ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
-          bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
-        }
-        if (bean != null) {
-          buildSenderStatus(member.getId(), bean, availableSenderData);
-        } else {
-          buildSenderStatus(member.getId(), bean, notAvailableSenderData);
-        }
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
+
+    for (DistributedMember member : dsMembers) {
+      if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
+        bean = service.getLocalGatewaySenderMXBean(senderId);
+      } else {
+        ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
+        bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
+      }
+      if (bean != null) {
+        buildSenderStatus(member.getId(), bean, availableSenderData);
+      } else {
+        buildSenderStatus(member.getId(), bean, notAvailableSenderData);
       }
-      result = ResultBuilder.buildResult(crd);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
     }
+    result = ResultBuilder.buildResult(crd);
     return result;
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewayReceiverCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewayReceiverCommand.java
index 49b2454..e183b20 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewayReceiverCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewayReceiverCommand.java
@@ -32,9 +32,7 @@ import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.MBeanJMXAdapter;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.management.internal.cli.CliUtil;
-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.CommandResultException;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.management.internal.security.ResourceOperation;
@@ -51,48 +49,42 @@ public class StopGatewayReceiverCommand implements GfshCommand {
 
       @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
           optionContext = ConverterHint.MEMBERIDNAME,
-          help = CliStrings.STOP_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember) {
+          help = CliStrings.STOP_GATEWAYRECEIVER__MEMBER__HELP) String[] onMember)
+      throws Exception {
 
     Result result;
 
-    try {
-      InternalCache cache = getCache();
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    InternalCache cache = getCache();
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      GatewayReceiverMXBean receiverBean;
+    GatewayReceiverMXBean receiverBean;
 
-      TabularResultData resultData = ResultBuilder.createTabularResultData();
+    TabularResultData resultData = ResultBuilder.createTabularResultData();
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
+
+    for (DistributedMember member : dsMembers) {
+      ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
 
-      for (DistributedMember member : dsMembers) {
-        ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
-
-        if (gatewayReceiverObjectName != null) {
-          receiverBean =
-              service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
-          if (receiverBean != null) {
-            if (receiverBean.isRunning()) {
-              receiverBean.stop();
-              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                  CliStrings.GATEWAY_OK,
-                  CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_STOPPED_ON_MEMBER_0,
-                      new Object[] {member.getId()}));
-            } else {
-              GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                  CliStrings.GATEWAY_ERROR,
-                  CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_RUNNING_ON_MEMBER_0,
-                      new Object[] {member.getId()}));
-            }
+      if (gatewayReceiverObjectName != null) {
+        receiverBean =
+            service.getMBeanProxy(gatewayReceiverObjectName, GatewayReceiverMXBean.class);
+        if (receiverBean != null) {
+          if (receiverBean.isRunning()) {
+            receiverBean.stop();
+            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+                CliStrings.GATEWAY_OK,
+                CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_STOPPED_ON_MEMBER_0,
+                    new Object[] {member.getId()}));
           } else {
             GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
                 CliStrings.GATEWAY_ERROR,
-                CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0,
+                CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_RUNNING_ON_MEMBER_0,
                     new Object[] {member.getId()}));
           }
         } else {
@@ -101,14 +93,15 @@ public class StopGatewayReceiverCommand implements GfshCommand {
               CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0,
                   new Object[] {member.getId()}));
         }
+      } else {
+        GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+            CliStrings.GATEWAY_ERROR,
+            CliStrings.format(CliStrings.GATEWAY_RECEIVER_IS_NOT_AVAILABLE_ON_MEMBER_0,
+                new Object[] {member.getId()}));
       }
-      result = ResultBuilder.buildResult(resultData);
-    } catch (CommandResultException crex) {
-      result = GatewayCommandsUtils.handleCommandResultException(crex);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
     }
+    result = ResultBuilder.buildResult(resultData);
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewaySenderCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewaySenderCommand.java
index 5b20f1e..cc67fc4 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewaySenderCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/StopGatewaySenderCommand.java
@@ -31,7 +31,6 @@ import org.apache.geode.management.cli.ConverterHint;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.management.internal.cli.CliUtil;
-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.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
@@ -61,53 +60,49 @@ public class StopGatewaySenderCommand implements GfshCommand {
       senderId = senderId.trim();
     }
 
-    try {
-      InternalCache cache = getCache();
-      SystemManagementService service =
-          (SystemManagementService) ManagementService.getExistingManagementService(cache);
+    InternalCache cache = getCache();
+    SystemManagementService service =
+        (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
-      GatewaySenderMXBean bean;
+    GatewaySenderMXBean bean;
 
-      TabularResultData resultData = ResultBuilder.createTabularResultData();
+    TabularResultData resultData = ResultBuilder.createTabularResultData();
 
-      Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
+    Set<DistributedMember> dsMembers = CliUtil.findMembers(onGroup, onMember);
 
-      if (dsMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    if (dsMembers.isEmpty()) {
+      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
+
+    for (DistributedMember member : dsMembers) {
+      if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
+        bean = service.getLocalGatewaySenderMXBean(senderId);
+      } else {
+        ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
+        bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
       }
+      if (bean != null) {
+        if (bean.isRunning()) {
+          bean.stop();
+          GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+              CliStrings.GATEWAY_OK, CliStrings.format(
+                  CliStrings.GATEWAY_SENDER_0_IS_STOPPED_ON_MEMBER_1, senderId, member.getId()));
 
-      for (DistributedMember member : dsMembers) {
-        if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) {
-          bean = service.getLocalGatewaySenderMXBean(senderId);
-        } else {
-          ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId);
-          bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class);
-        }
-        if (bean != null) {
-          if (bean.isRunning()) {
-            bean.stop();
-            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                CliStrings.GATEWAY_OK, CliStrings.format(
-                    CliStrings.GATEWAY_SENDER_0_IS_STOPPED_ON_MEMBER_1, senderId, member.getId()));
-
-          } else {
-            GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
-                CliStrings.GATEWAY_ERROR,
-                CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, senderId,
-                    member.getId()));
-          }
         } else {
           GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
               CliStrings.GATEWAY_ERROR,
-              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+              CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_RUNNING_ON_MEMBER_1, senderId,
                   member.getId()));
         }
+      } else {
+        GatewayCommandsUtils.accumulateStartResult(resultData, member.getId(),
+            CliStrings.GATEWAY_ERROR,
+            CliStrings.format(CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, senderId,
+                member.getId()));
       }
-      result = ResultBuilder.buildResult(resultData);
-    } catch (Exception e) {
-      LogWrapper.getInstance().warning(CliStrings.GATEWAY_ERROR + CliUtil.stackTraceAsString(e));
-      result = ResultBuilder.createGemFireErrorResult(CliStrings.GATEWAY_ERROR + e.getMessage());
     }
+    result = ResultBuilder.buildResult(resultData);
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJConsoleCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJConsoleCommand.java
index 1bcbbae..0e27bfd 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJConsoleCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJConsoleCommand.java
@@ -108,7 +108,7 @@ public class StartJConsoleCommand implements GfshCommand {
     } catch (Throwable t) {
       SystemFailure.checkFailure();
       return ResultBuilder.createShellClientErrorResult(
-          String.format(CliStrings.START_JCONSOLE__CATCH_ALL_ERROR_MESSAGE, toString(t, false)));
+          String.format(CliStrings.START_JCONSOLE__CATCH_ALL_ERROR_MESSAGE, t.getMessage()));
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJVisualVMCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJVisualVMCommand.java
index 699a482..48a711f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJVisualVMCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartJVisualVMCommand.java
@@ -72,7 +72,7 @@ public class StartJVisualVMCommand implements GfshCommand {
     } catch (Throwable t) {
       SystemFailure.checkFailure();
       return ResultBuilder.createShellClientErrorResult(
-          String.format(CliStrings.START_JVISUALVM__ERROR_MESSAGE, toString(t, false)));
+          String.format(CliStrings.START_JVISUALVM__ERROR_MESSAGE, t.getMessage()));
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java
index fbf32d8..f07a90f 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartPulseCommand.java
@@ -81,7 +81,7 @@ public class StartPulseCommand implements GfshCommand {
     } catch (Throwable t) {
       SystemFailure.checkFailure();
       return ResultBuilder.createShellClientErrorResult(
-          String.format(CliStrings.START_PULSE__ERROR, toString(t, false)));
+          String.format(CliStrings.START_PULSE__ERROR, t.getMessage()));
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartVsdCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartVsdCommand.java
index 7719611..36b5614 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartVsdCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StartVsdCommand.java
@@ -85,7 +85,7 @@ public class StartVsdCommand implements GfshCommand {
     } catch (Throwable t) {
       SystemFailure.checkFailure();
       return ResultBuilder.createShellClientErrorResult(
-          String.format(CliStrings.START_VSD__ERROR_MESSAGE, toString(t, false)));
+          String.format(CliStrings.START_VSD__ERROR_MESSAGE, t.getMessage()));
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusLocatorCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusLocatorCommand.java
index 06f8350..fac8ad2 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusLocatorCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusLocatorCommand.java
@@ -16,18 +16,15 @@ package org.apache.geode.management.internal.cli.commands.lifecycle;
 
 import static org.apache.geode.management.internal.cli.i18n.CliStrings.LOCATOR_TERM_NAME;
 import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getMemberMXBean;
-import static org.apache.geode.management.internal.cli.util.HostUtils.getLocatorId;
 
 import java.io.IOException;
 
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.distributed.AbstractLauncher;
 import org.apache.geode.distributed.LocatorLauncher;
 import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.lang.SystemUtils;
 import org.apache.geode.management.MemberMXBean;
 import org.apache.geode.management.cli.CliMetaData;
 import org.apache.geode.management.cli.ConverterHint;
@@ -53,49 +50,39 @@ public class StatusLocatorCommand implements GfshCommand {
       @CliOption(key = CliStrings.STATUS_LOCATOR__PID,
           help = CliStrings.STATUS_LOCATOR__PID__HELP) final Integer pid,
       @CliOption(key = CliStrings.STATUS_LOCATOR__DIR,
-          help = CliStrings.STATUS_LOCATOR__DIR__HELP) final String workingDirectory) {
-    try {
-      if (StringUtils.isNotBlank(member)) {
-        if (isConnectedAndReady()) {
-          final MemberMXBean locatorProxy = getMemberMXBean(member);
+          help = CliStrings.STATUS_LOCATOR__DIR__HELP) final String workingDirectory)
+      throws Exception {
 
-          if (locatorProxy != null) {
-            LocatorLauncher.LocatorState state =
-                LocatorLauncher.LocatorState.fromJson(locatorProxy.status());
-            return createStatusLocatorResult(state);
-          } else {
-            return ResultBuilder.createUserErrorResult(CliStrings.format(
-                CliStrings.STATUS_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
-          }
+    if (StringUtils.isNotBlank(member)) {
+      if (isConnectedAndReady()) {
+        final MemberMXBean locatorProxy = getMemberMXBean(member);
+
+        if (locatorProxy != null) {
+          LocatorLauncher.LocatorState state =
+              LocatorLauncher.LocatorState.fromJson(locatorProxy.status());
+          return createStatusLocatorResult(state);
         } else {
           return ResultBuilder.createUserErrorResult(CliStrings.format(
-              CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, LOCATOR_TERM_NAME));
+              CliStrings.STATUS_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
         }
       } else {
-        final LocatorLauncher locatorLauncher =
-            new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.STATUS)
-                .setBindAddress(locatorHost).setDebug(isDebugging()).setPid(pid)
-                .setPort(locatorPort).setWorkingDirectory(workingDirectory).build();
+        return ResultBuilder.createUserErrorResult(CliStrings.format(
+            CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, LOCATOR_TERM_NAME));
+      }
+    } else {
+      final LocatorLauncher locatorLauncher =
+          new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.STATUS)
+              .setBindAddress(locatorHost).setDebug(isDebugging()).setPid(pid).setPort(locatorPort)
+              .setWorkingDirectory(workingDirectory).build();
 
-        final LocatorLauncher.LocatorState status = locatorLauncher.status();
-        if (status.getStatus().equals(AbstractLauncher.Status.NOT_RESPONDING)
-            || status.getStatus().equals(AbstractLauncher.Status.STOPPED)) {
-          return ResultBuilder.createShellClientErrorResult(status.toString());
-        }
-        return createStatusLocatorResult(status);
+      final LocatorLauncher.LocatorState status = locatorLauncher.status();
+      if (status.getStatus().equals(AbstractLauncher.Status.NOT_RESPONDING)
+          || status.getStatus().equals(AbstractLauncher.Status.STOPPED)) {
+        return ResultBuilder.createShellClientErrorResult(status.toString());
       }
-    } catch (IllegalArgumentException | IllegalStateException e) {
-      return ResultBuilder.createUserErrorResult(e.getMessage());
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      return ResultBuilder.createShellClientErrorResult(String.format(
-          CliStrings.STATUS_LOCATOR__GENERAL_ERROR_MESSAGE, getLocatorId(locatorHost, locatorPort),
-          StringUtils.defaultIfBlank(workingDirectory, SystemUtils.CURRENT_DIRECTORY),
-          toString(t, getGfsh().getDebug())));
+      return createStatusLocatorResult(status);
     }
+
   }
 
   protected Result createStatusLocatorResult(final LocatorLauncher.LocatorState state)
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusServerCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusServerCommand.java
index 43374ab..0a7fb8b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusServerCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StatusServerCommand.java
@@ -16,10 +16,11 @@ package org.apache.geode.management.internal.cli.commands.lifecycle;
 
 import static org.apache.geode.management.internal.cli.shell.MXBeanProvider.getMemberMXBean;
 
+import java.io.IOException;
+
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.distributed.AbstractLauncher;
 import org.apache.geode.distributed.ServerLauncher;
 import org.apache.geode.internal.lang.StringUtils;
@@ -42,52 +43,41 @@ public class StatusServerCommand implements GfshCommand {
       @CliOption(key = CliStrings.STATUS_SERVER__PID,
           help = CliStrings.STATUS_SERVER__PID__HELP) final Integer pid,
       @CliOption(key = CliStrings.STATUS_SERVER__DIR,
-          help = CliStrings.STATUS_SERVER__DIR__HELP) final String workingDirectory) {
-    try {
-      if (StringUtils.isNotBlank(member)) {
-        if (isConnectedAndReady()) {
-          final MemberMXBean serverProxy = getMemberMXBean(member);
+          help = CliStrings.STATUS_SERVER__DIR__HELP) final String workingDirectory)
+      throws IOException {
+
+    if (StringUtils.isNotBlank(member)) {
+      if (isConnectedAndReady()) {
+        final MemberMXBean serverProxy = getMemberMXBean(member);
 
-          if (serverProxy != null) {
-            return ResultBuilder.createInfoResult(
-                ServerLauncher.ServerState.fromJson(serverProxy.status()).toString());
-          } else {
-            return ResultBuilder.createUserErrorResult(CliStrings.format(
-                CliStrings.STATUS_SERVER__NO_SERVER_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
-          }
+        if (serverProxy != null) {
+          return ResultBuilder.createInfoResult(
+              ServerLauncher.ServerState.fromJson(serverProxy.status()).toString());
         } else {
           return ResultBuilder.createUserErrorResult(CliStrings
-              .format(CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Cache Server"));
+              .format(CliStrings.STATUS_SERVER__NO_SERVER_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
         }
       } else {
-        final ServerLauncher serverLauncher = new ServerLauncher.Builder()
-            .setCommand(ServerLauncher.Command.STATUS).setDebug(isDebugging())
-            // NOTE since we do not know whether the "CacheServer" was enabled or not on the GemFire
-            // server when it was started,
-            // set the disableDefaultServer property in the ServerLauncher.Builder to default status
-            // to the MemberMBean
-            // TODO fix this hack! (how, the 'start server' loop needs it)
-            .setDisableDefaultServer(true).setPid(pid).setWorkingDirectory(workingDirectory)
-            .build();
+        return ResultBuilder.createUserErrorResult(CliStrings
+            .format(CliStrings.STATUS_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Cache Server"));
+      }
+    } else {
+      final ServerLauncher serverLauncher = new ServerLauncher.Builder()
+          .setCommand(ServerLauncher.Command.STATUS).setDebug(isDebugging())
+          // NOTE since we do not know whether the "CacheServer" was enabled or not on the GemFire
+          // server when it was started,
+          // set the disableDefaultServer property in the ServerLauncher.Builder to default status
+          // to the MemberMBean
+          // TODO fix this hack! (how, the 'start server' loop needs it)
+          .setDisableDefaultServer(true).setPid(pid).setWorkingDirectory(workingDirectory).build();
 
-        final ServerLauncher.ServerState status = serverLauncher.status();
+      final ServerLauncher.ServerState status = serverLauncher.status();
 
-        if (status.getStatus().equals(AbstractLauncher.Status.NOT_RESPONDING)
-            || status.getStatus().equals(AbstractLauncher.Status.STOPPED)) {
-          return ResultBuilder.createGemFireErrorResult(status.toString());
-        }
-        return ResultBuilder.createInfoResult(status.toString());
+      if (status.getStatus().equals(AbstractLauncher.Status.NOT_RESPONDING)
+          || status.getStatus().equals(AbstractLauncher.Status.STOPPED)) {
+        return ResultBuilder.createGemFireErrorResult(status.toString());
       }
-    } catch (IllegalArgumentException | IllegalStateException e) {
-
-      return ResultBuilder.createUserErrorResult(e.getMessage());
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      return ResultBuilder.createShellClientErrorResult(String.format(
-          CliStrings.STATUS_SERVER__GENERAL_ERROR_MESSAGE, toString(t, getGfsh().getDebug())));
+      return ResultBuilder.createInfoResult(status.toString());
     }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommand.java
index ec3583c..e435b6e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopLocatorCommand.java
@@ -22,7 +22,6 @@ import java.util.concurrent.TimeUnit;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.distributed.AbstractLauncher;
 import org.apache.geode.distributed.LocatorLauncher;
 import org.apache.geode.internal.lang.StringUtils;
@@ -49,77 +48,65 @@ public class StopLocatorCommand implements GfshCommand {
       @CliOption(key = CliStrings.STOP_LOCATOR__PID,
           help = CliStrings.STOP_LOCATOR__PID__HELP) final Integer pid,
       @CliOption(key = CliStrings.STOP_LOCATOR__DIR,
-          help = CliStrings.STOP_LOCATOR__DIR__HELP) final String workingDirectory) {
-    LocatorLauncher.LocatorState locatorState;
-
-    try {
-      if (StringUtils.isNotBlank(member)) {
-        if (isConnectedAndReady()) {
-          final MemberMXBean locatorProxy = getMemberMXBean(member);
+          help = CliStrings.STOP_LOCATOR__DIR__HELP) final String workingDirectory)
+      throws Exception {
 
-          if (locatorProxy != null) {
-            if (!locatorProxy.isLocator()) {
-              throw new IllegalStateException(
-                  CliStrings.format(CliStrings.STOP_LOCATOR__NOT_LOCATOR_ERROR_MESSAGE, member));
-            }
+    LocatorLauncher.LocatorState locatorState;
+    if (StringUtils.isNotBlank(member)) {
+      if (isConnectedAndReady()) {
+        final MemberMXBean locatorProxy = getMemberMXBean(member);
 
-            if (locatorProxy.isServer()) {
-              throw new IllegalStateException(CliStrings
-                  .format(CliStrings.STOP_LOCATOR__LOCATOR_IS_CACHE_SERVER_ERROR_MESSAGE, member));
-            }
+        if (locatorProxy != null) {
+          if (!locatorProxy.isLocator()) {
+            throw new IllegalStateException(
+                CliStrings.format(CliStrings.STOP_LOCATOR__NOT_LOCATOR_ERROR_MESSAGE, member));
+          }
 
-            locatorState = LocatorLauncher.LocatorState.fromJson(locatorProxy.status());
-            locatorProxy.shutDownMember();
-          } else {
-            return ResultBuilder.createUserErrorResult(CliStrings.format(
-                CliStrings.STOP_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
+          if (locatorProxy.isServer()) {
+            throw new IllegalStateException(CliStrings
+                .format(CliStrings.STOP_LOCATOR__LOCATOR_IS_CACHE_SERVER_ERROR_MESSAGE, member));
           }
+
+          locatorState = LocatorLauncher.LocatorState.fromJson(locatorProxy.status());
+          locatorProxy.shutDownMember();
         } else {
-          return ResultBuilder.createUserErrorResult(CliStrings.format(
-              CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, LOCATOR_TERM_NAME));
+          return ResultBuilder.createUserErrorResult(CliStrings
+              .format(CliStrings.STOP_LOCATOR__NO_LOCATOR_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
         }
       } else {
-        final LocatorLauncher locatorLauncher =
-            new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.STOP)
-                .setDebug(isDebugging()).setPid(pid).setWorkingDirectory(workingDirectory).build();
-
-        locatorState = locatorLauncher.status();
-        locatorLauncher.stop();
+        return ResultBuilder.createUserErrorResult(CliStrings
+            .format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, LOCATOR_TERM_NAME));
       }
+    } else {
+      final LocatorLauncher locatorLauncher =
+          new LocatorLauncher.Builder().setCommand(LocatorLauncher.Command.STOP)
+              .setDebug(isDebugging()).setPid(pid).setWorkingDirectory(workingDirectory).build();
+
+      locatorState = locatorLauncher.status();
+      locatorLauncher.stop();
+    }
 
-      if (AbstractLauncher.Status.ONLINE.equals(locatorState.getStatus())) {
-        getGfsh().logInfo(
-            String.format(CliStrings.STOP_LOCATOR__STOPPING_LOCATOR_MESSAGE,
-                locatorState.getWorkingDirectory(), locatorState.getServiceLocation(),
-                locatorState.getMemberName(), locatorState.getPid(), locatorState.getLogFile()),
-            null);
+    if (AbstractLauncher.Status.ONLINE.equals(locatorState.getStatus())) {
+      getGfsh().logInfo(
+          String.format(CliStrings.STOP_LOCATOR__STOPPING_LOCATOR_MESSAGE,
+              locatorState.getWorkingDirectory(), locatorState.getServiceLocation(),
+              locatorState.getMemberName(), locatorState.getPid(), locatorState.getLogFile()),
+          null);
 
-        StopWatch stopWatch = new StopWatch(true);
-        while (locatorState.isVmWithProcessIdRunning()) {
-          Gfsh.print(".");
-          if (stopWatch.elapsedTimeMillis() > WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS) {
-            break;
-          }
-          synchronized (this) {
-            TimeUnit.MILLISECONDS.timedWait(this, 500);
-          }
+      StopWatch stopWatch = new StopWatch(true);
+      while (locatorState.isVmWithProcessIdRunning()) {
+        Gfsh.print(".");
+        if (stopWatch.elapsedTimeMillis() > WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS) {
+          break;
+        }
+        synchronized (this) {
+          TimeUnit.MILLISECONDS.timedWait(this, 500);
         }
-
-        return ResultBuilder.createInfoResult(StringUtils.EMPTY);
-      } else {
-        return ResultBuilder.createUserErrorResult(locatorState.toString());
       }
-    } catch (IllegalArgumentException | IllegalStateException e) {
-      return ResultBuilder.createUserErrorResult(e.getMessage());
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      return ResultBuilder.createShellClientErrorResult(String.format(
-          CliStrings.STOP_LOCATOR__GENERAL_ERROR_MESSAGE, toString(t, getGfsh().getDebug())));
-    } finally {
-      Gfsh.redirectInternalJavaLoggers();
+
+      return ResultBuilder.createInfoResult(StringUtils.EMPTY);
+    } else {
+      return ResultBuilder.createUserErrorResult(locatorState.toString());
     }
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopServerCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopServerCommand.java
index 526dcd8..ba05073 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopServerCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/lifecycle/StopServerCommand.java
@@ -21,7 +21,6 @@ import java.util.concurrent.TimeUnit;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.distributed.AbstractLauncher;
 import org.apache.geode.distributed.ServerLauncher;
 import org.apache.geode.internal.lang.StringUtils;
@@ -47,73 +46,61 @@ public class StopServerCommand implements GfshCommand {
       @CliOption(key = CliStrings.STOP_SERVER__PID,
           help = CliStrings.STOP_SERVER__PID__HELP) final Integer pid,
       @CliOption(key = CliStrings.STOP_SERVER__DIR,
-          help = CliStrings.STOP_SERVER__DIR__HELP) final String workingDirectory) {
+          help = CliStrings.STOP_SERVER__DIR__HELP) final String workingDirectory)
+      throws Exception {
     ServerLauncher.ServerState serverState;
 
-    try {
-      if (StringUtils.isNotBlank(member)) {
-        if (!isConnectedAndReady()) {
-          return ResultBuilder.createUserErrorResult(CliStrings
-              .format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Cache Server"));
-        }
-
-        final MemberMXBean serverProxy = getMemberMXBean(member);
+    if (StringUtils.isNotBlank(member)) {
+      if (!isConnectedAndReady()) {
+        return ResultBuilder.createUserErrorResult(CliStrings
+            .format(CliStrings.STOP_SERVICE__GFSH_NOT_CONNECTED_ERROR_MESSAGE, "Cache Server"));
+      }
 
-        if (serverProxy != null) {
-          if (!serverProxy.isServer()) {
-            throw new IllegalStateException(CliStrings
-                .format(CliStrings.STOP_SERVER__MEMBER_IS_NOT_SERVER_ERROR_MESSAGE, member));
-          }
+      final MemberMXBean serverProxy = getMemberMXBean(member);
 
-          serverState = ServerLauncher.ServerState.fromJson(serverProxy.status());
-          serverProxy.shutDownMember();
-        } else {
-          return ResultBuilder.createUserErrorResult(CliStrings
-              .format(CliStrings.STOP_SERVER__NO_SERVER_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
+      if (serverProxy != null) {
+        if (!serverProxy.isServer()) {
+          throw new IllegalStateException(CliStrings
+              .format(CliStrings.STOP_SERVER__MEMBER_IS_NOT_SERVER_ERROR_MESSAGE, member));
         }
 
+        serverState = ServerLauncher.ServerState.fromJson(serverProxy.status());
+        serverProxy.shutDownMember();
       } else {
-        final ServerLauncher serverLauncher =
-            new ServerLauncher.Builder().setCommand(ServerLauncher.Command.STOP)
-                .setDebug(isDebugging()).setPid(pid).setWorkingDirectory(workingDirectory).build();
-
-        serverState = serverLauncher.status();
-        serverLauncher.stop();
+        return ResultBuilder.createUserErrorResult(CliStrings
+            .format(CliStrings.STOP_SERVER__NO_SERVER_FOUND_FOR_MEMBER_ERROR_MESSAGE, member));
       }
 
-      if (AbstractLauncher.Status.ONLINE.equals(serverState.getStatus())) {
-        getGfsh().logInfo(
-            String.format(CliStrings.STOP_SERVER__STOPPING_SERVER_MESSAGE,
-                serverState.getWorkingDirectory(), serverState.getServiceLocation(),
-                serverState.getMemberName(), serverState.getPid(), serverState.getLogFile()),
-            null);
-
-        StopWatch stopWatch = new StopWatch(true);
-        while (serverState.isVmWithProcessIdRunning()) {
-          Gfsh.print(".");
-          if (stopWatch.elapsedTimeMillis() > WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS) {
-            break;
-          }
-          synchronized (this) {
-            TimeUnit.MILLISECONDS.timedWait(this, 500);
-          }
-        }
+    } else {
+      final ServerLauncher serverLauncher =
+          new ServerLauncher.Builder().setCommand(ServerLauncher.Command.STOP)
+              .setDebug(isDebugging()).setPid(pid).setWorkingDirectory(workingDirectory).build();
 
-        return ResultBuilder.createInfoResult(StringUtils.EMPTY);
-      } else {
-        return ResultBuilder.createUserErrorResult(serverState.toString());
+      serverState = serverLauncher.status();
+      serverLauncher.stop();
+    }
+
+    if (AbstractLauncher.Status.ONLINE.equals(serverState.getStatus())) {
+      getGfsh().logInfo(
+          String.format(CliStrings.STOP_SERVER__STOPPING_SERVER_MESSAGE,
+              serverState.getWorkingDirectory(), serverState.getServiceLocation(),
+              serverState.getMemberName(), serverState.getPid(), serverState.getLogFile()),
+          null);
+
+      StopWatch stopWatch = new StopWatch(true);
+      while (serverState.isVmWithProcessIdRunning()) {
+        Gfsh.print(".");
+        if (stopWatch.elapsedTimeMillis() > WAITING_FOR_STOP_TO_MAKE_PID_GO_AWAY_TIMEOUT_MILLIS) {
+          break;
+        }
+        synchronized (this) {
+          TimeUnit.MILLISECONDS.timedWait(this, 500);
+        }
       }
-    } catch (IllegalArgumentException | IllegalStateException e) {
-      return ResultBuilder.createUserErrorResult(e.getMessage());
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      return ResultBuilder.createShellClientErrorResult(String.format(
-          CliStrings.STOP_SERVER__GENERAL_ERROR_MESSAGE, toString(t, getGfsh().getDebug())));
-    } finally {
-      Gfsh.redirectInternalJavaLoggers();
+
+      return ResultBuilder.createInfoResult(StringUtils.EMPTY);
+    } else {
+      return ResultBuilder.createUserErrorResult(serverState.toString());
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/CreateSubregionException.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/EntityNotFoundException.java
similarity index 63%
rename from geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/CreateSubregionException.java
rename to geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/EntityNotFoundException.java
index 9aaf247..3f4f173 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/CreateSubregionException.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/EntityNotFoundException.java
@@ -12,27 +12,35 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
+
 package org.apache.geode.management.internal.cli.exceptions;
 
-/**
- * Indicates inability to create a Subregion of a region.
- *
- * @since GemFire 8.0
- */
-// TODO - Abhishek - Include in GemFire Exception Enhancements
-public class CreateSubregionException extends RuntimeException {
+import org.apache.geode.GemFireException;
 
-  private static final long serialVersionUID = 4387344870743824916L;
+public class EntityNotFoundException extends GemFireException {
 
-  public CreateSubregionException(String message, Throwable cause) {
-    super(message, cause);
+  private boolean statusOK;
+
+  public EntityNotFoundException() {}
+
+  public EntityNotFoundException(String message) {
+    super(message);
   }
 
-  public CreateSubregionException(String message) {
+  public EntityNotFoundException(String message, boolean statusOK) {
     super(message);
+    this.statusOK = statusOK;
   }
 
-  public CreateSubregionException(Throwable cause) {
+  public EntityNotFoundException(Throwable cause) {
     super(cause);
   }
+
+  public EntityNotFoundException(String message, Throwable cause) {
+    super(message, cause);
+  }
+
+  public boolean isStatusOK() {
+    return statusOK;
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/IndexNotFoundException.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/IndexNotFoundException.java
deleted file mode 100644
index 402285b..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/IndexNotFoundException.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-package org.apache.geode.management.internal.cli.exceptions;
-
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-
-public class IndexNotFoundException extends Exception {
-
-  private static final long serialVersionUID = 1L;
-  final String indexName;
-  final String message;
-
-  public IndexNotFoundException(final String indexName) {
-    this.indexName = indexName;
-    this.message = CliStrings.format("Index \" {0} \" not found", indexName);
-  }
-
-  public String getMessage() {
-    return this.message;
-  }
-}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/CliException.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/UserErrorException.java
similarity index 78%
rename from geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/CliException.java
rename to geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/UserErrorException.java
index 97ea785..0039c85 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/CliException.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/exceptions/UserErrorException.java
@@ -14,22 +14,24 @@
  */
 package org.apache.geode.management.internal.cli.exceptions;
 
-public abstract class CliException extends Exception {
+import org.apache.geode.GemFireException;
+
+public class UserErrorException extends GemFireException {
   private static final long serialVersionUID = -7603040667204839200L;
 
-  public CliException() {
+  public UserErrorException() {
     this(null, null);
   }
 
-  public CliException(String message) {
+  public UserErrorException(String message) {
     this(message, null);
   }
 
-  public CliException(Throwable cause) {
+  public UserErrorException(Throwable cause) {
     super(null, cause);
   }
 
-  public CliException(String message, Throwable cause) {
+  public UserErrorException(String message, Throwable cause) {
     super(message, cause);
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java
index 57589ef..4bbf389 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CliFunctionResult.java
@@ -117,6 +117,20 @@ public class CliFunctionResult implements Comparable<CliFunctionResult>, DataSer
     return (String) this.serializables[0];
   }
 
+  public String getErrorMessage() {
+    // if message is not null, use that
+    if (getMessage() != null) {
+      return getMessage();
+    }
+
+    // otherwise use exception's message
+    if (throwable != null) {
+      return throwable.getMessage();
+    }
+
+    return null;
+  }
+
   public Serializable[] getSerializables() {
     return this.serializables;
   }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java
index 1f30db6..5d9a294 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunction.java
@@ -14,6 +14,8 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -21,32 +23,47 @@ import java.util.Set;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.execute.FunctionAdapter;
 import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.ResultSender;
 import org.apache.geode.cache.query.Index;
 import org.apache.geode.cache.query.IndexType;
 import org.apache.geode.cache.query.MultiIndexCreationException;
 import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.internal.InternalEntity;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
 import org.apache.geode.management.internal.cli.domain.IndexInfo;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 
 public class CreateDefinedIndexesFunction extends FunctionAdapter implements InternalEntity {
-
   private static final long serialVersionUID = 1L;
 
   @Override
+  public String getId() {
+    return CreateDefinedIndexesFunction.class.getName();
+  }
+
+  XmlEntity createXmlEntity(final String regionName) {
+    return new XmlEntity(CacheXml.REGION, "name", regionName);
+  }
+
+  @Override
   public void execute(FunctionContext context) {
-    String memberId = null;
-    List<Index> indexes = null;
     Cache cache;
+    String memberId = null;
+    boolean lastResultSent = Boolean.FALSE;
+
     try {
       cache = context.getCache();
-      memberId = cache.getDistributedSystem().getDistributedMember().getId();
+      ResultSender sender = context.getResultSender();
       QueryService queryService = cache.getQueryService();
+      memberId = cache.getDistributedSystem().getDistributedMember().getId();
       Set<IndexInfo> indexDefinitions = (Set<IndexInfo>) context.getArguments();
+
       for (IndexInfo indexDefinition : indexDefinitions) {
         String indexName = indexDefinition.getIndexName();
-        String indexedExpression = indexDefinition.getIndexedExpression();
         String regionPath = indexDefinition.getRegionPath();
+        String indexedExpression = indexDefinition.getIndexedExpression();
+
         if (indexDefinition.getIndexType() == IndexType.PRIMARY_KEY) {
           queryService.defineKeyIndex(indexName, indexedExpression, regionPath);
         } else if (indexDefinition.getIndexType() == IndexType.HASH) {
@@ -55,26 +72,54 @@ public class CreateDefinedIndexesFunction extends FunctionAdapter implements Int
           queryService.defineIndex(indexName, indexedExpression, regionPath);
         }
       }
-      indexes = queryService.createDefinedIndexes();
-      context.getResultSender().lastResult(new CliFunctionResult(memberId));
-    } catch (MultiIndexCreationException e) {
+
+      List<Index> indexes = queryService.createDefinedIndexes();
+      // Build the results with one XmlEntity per region.
+      List<String> processedRegions = new ArrayList<>();
+      List<CliFunctionResult> functionResults = new ArrayList<>();
+
+      for (Index index : indexes) {
+        String regionName = index.getRegion().getName();
+
+        if (!processedRegions.contains(regionName)) {
+          XmlEntity xmlEntity = createXmlEntity(regionName);
+          functionResults.add(new CliFunctionResult(memberId, xmlEntity));
+          processedRegions.add(regionName);
+        }
+      }
+
+      for (Iterator<CliFunctionResult> iterator = functionResults.iterator(); iterator.hasNext();) {
+        CliFunctionResult cliFunctionResult = iterator.next();
+
+        if (iterator.hasNext()) {
+          sender.sendResult(cliFunctionResult);
+        } else {
+          sender.lastResult(cliFunctionResult);
+          lastResultSent = Boolean.TRUE;
+        }
+      }
+
+      if (!lastResultSent) {
+        // No indexes were created and no exceptions were thrown during the process.
+        // We still need to make sure the function returns to the caller.
+        sender.lastResult(
+            new CliFunctionResult(memberId, true, CliStrings.DEFINE_INDEX__FAILURE__MSG));
+      }
+    } catch (MultiIndexCreationException multiIndexCreationException) {
       StringBuffer sb = new StringBuffer();
       sb.append("Index creation failed for indexes: ").append("\n");
-      for (Map.Entry<String, Exception> failedIndex : e.getExceptionsMap().entrySet()) {
+      for (Map.Entry<String, Exception> failedIndex : multiIndexCreationException.getExceptionsMap()
+          .entrySet()) {
         sb.append(failedIndex.getKey()).append(" : ").append(failedIndex.getValue().getMessage())
             .append("\n");
       }
-      context.getResultSender().lastResult(new CliFunctionResult(memberId, e, sb.toString()));
-    } catch (Exception e) {
+      context.getResultSender()
+          .lastResult(new CliFunctionResult(memberId, multiIndexCreationException, sb.toString()));
+    } catch (Exception exception) {
       String exceptionMessage = CliStrings.format(CliStrings.EXCEPTION_CLASS_AND_MESSAGE,
-          e.getClass().getName(), e.getMessage());
-      context.getResultSender().lastResult(new CliFunctionResult(memberId, e, exceptionMessage));
+          exception.getClass().getName(), exception.getMessage());
+      context.getResultSender()
+          .lastResult(new CliFunctionResult(memberId, exception, exceptionMessage));
     }
   }
-
-  @Override
-  public String getId() {
-    return CreateDefinedIndexesFunction.class.getName();
-  }
-
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
index ba791f6..9e51ec8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DataCommandFunction.java
@@ -28,7 +28,7 @@ import org.json.JSONArray;
 
 import org.apache.geode.cache.DataPolicy;
 import org.apache.geode.cache.Region;
-import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.partition.PartitionRegionHelper;
 import org.apache.geode.cache.query.FunctionDomainException;
@@ -65,7 +65,7 @@ import org.apache.geode.pdx.PdxInstance;
 /**
  * @since GemFire 7.0
  */
-public class DataCommandFunction extends FunctionAdapter implements InternalEntity {
+public class DataCommandFunction implements Function, InternalEntity {
   private static final Logger logger = LogService.getLogger();
 
   private static final long serialVersionUID = 1L;
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
index 1bbc3b5..f8668c0 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunction.java
@@ -40,7 +40,7 @@ import org.apache.geode.internal.lang.ObjectUtils;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.util.ArrayUtils;
 import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
-import org.apache.geode.management.internal.cli.util.DiskStoreNotFoundException;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
 
 /**
  * The DescribeDiskStoreFunction class is an implementation of a GemFire Function used to collect
@@ -120,7 +120,7 @@ public class DescribeDiskStoreFunction extends FunctionAdapter implements Intern
           context.getResultSender().lastResult(diskStoreDetails);
         } else {
           context.getResultSender()
-              .sendException(new DiskStoreNotFoundException(
+              .sendException(new EntityNotFoundException(
                   String.format("A disk store with name (%1$s) was not found on member (%2$s).",
                       diskStoreName, memberName)));
         }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
index fc3ec6b..f99592e 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
@@ -14,23 +14,16 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-import org.apache.logging.log4j.Logger;
-
 import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.cache.execute.ResultSender;
 import org.apache.geode.cache.wan.GatewaySender;
 import org.apache.geode.internal.InternalEntity;
-import org.apache.geode.internal.cache.wan.GatewaySenderException;
-import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.cli.CliUtil;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
 
-public class GatewaySenderDestroyFunction extends FunctionAdapter implements InternalEntity {
+public class GatewaySenderDestroyFunction implements Function, InternalEntity {
   private static final long serialVersionUID = 1L;
-
-  private static final Logger logger = LogService.getLogger();
   private static final String ID = GatewaySenderDestroyFunction.class.getName();
   public static GatewaySenderDestroyFunction INSTANCE = new GatewaySenderDestroyFunction();
 
@@ -45,41 +38,28 @@ public class GatewaySenderDestroyFunction extends FunctionAdapter implements Int
     GatewaySenderDestroyFunctionArgs gatewaySenderDestroyFunctionArgs =
         (GatewaySenderDestroyFunctionArgs) context.getArguments();
 
-    try {
-      GatewaySender gatewaySender =
-          cache.getGatewaySender(gatewaySenderDestroyFunctionArgs.getId());
-      if (gatewaySender != null) {
-        gatewaySender.stop();
-        gatewaySender.destroy();
+    String senderId = gatewaySenderDestroyFunctionArgs.getId();
+    boolean ifExists = gatewaySenderDestroyFunctionArgs.isIfExists();
+    GatewaySender gatewaySender = cache.getGatewaySender(senderId);
+    if (gatewaySender == null) {
+      String message = "Gateway sender " + senderId + " not found.";
+      if (ifExists) {
+        resultSender
+            .lastResult(new CliFunctionResult(memberNameOrId, true, "Skipping: " + message));
       } else {
-        throw new GatewaySenderException(
-            "GateWaySender with Id  " + gatewaySenderDestroyFunctionArgs.getId() + " not found");
-      }
-      resultSender.lastResult(new CliFunctionResult(memberNameOrId, true,
-          CliStrings.format(CliStrings.DESTROY_GATEWAYSENDER__MSG__GATEWAYSENDER_0_DESTROYED_ON_1,
-              new Object[] {gatewaySenderDestroyFunctionArgs.getId(), memberNameOrId})));
-
-    } catch (GatewaySenderException gse) {
-      resultSender.lastResult(handleException(memberNameOrId, gse.getMessage(), gse));
-    } catch (Exception e) {
-      String exceptionMsg = e.getMessage();
-      if (exceptionMsg == null) {
-        exceptionMsg = CliUtil.stackTraceAsString(e);
+        resultSender.lastResult(new CliFunctionResult(memberNameOrId, false, message));
       }
-      resultSender.lastResult(handleException(memberNameOrId, exceptionMsg, e));
+      return;
     }
-  }
 
-  private CliFunctionResult handleException(final String memberNameOrId, final String exceptionMsg,
-      final Exception e) {
-    if (e != null && logger.isDebugEnabled()) {
-      logger.debug(e.getMessage(), e);
-    }
-    if (exceptionMsg != null) {
-      return new CliFunctionResult(memberNameOrId, false, exceptionMsg);
+    try {
+      gatewaySender.stop();
+      gatewaySender.destroy();
+      resultSender.lastResult(new CliFunctionResult(memberNameOrId, true,
+          String.format("GatewaySender \"%s\" destroyed on \"%s\"", senderId, memberNameOrId)));
+    } catch (Exception e) {
+      resultSender.lastResult(new CliFunctionResult(memberNameOrId, e, ""));
     }
-
-    return new CliFunctionResult(memberNameOrId);
   }
 
   @Override
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
index 361cf63..648e8bf 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
@@ -20,13 +20,19 @@ public class GatewaySenderDestroyFunctionArgs implements Serializable {
 
   private static final long serialVersionUID = 3848480256348119530L;
   private String id;
+  private boolean ifExists;
 
 
-  public GatewaySenderDestroyFunctionArgs(String id) {
+  public GatewaySenderDestroyFunctionArgs(String id, boolean ifExists) {
     this.id = id;
+    this.ifExists = ifExists;
   }
 
   public String getId() {
     return id;
   }
+
+  public boolean isIfExists() {
+    return ifExists;
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
index e524c2d..55344d4 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionCreateFunction.java
@@ -44,7 +44,6 @@ import org.apache.geode.internal.i18n.LocalizedStrings;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.commands.RegionCommandsUtils;
-import org.apache.geode.management.internal.cli.exceptions.CreateSubregionException;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.util.RegionPath;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
@@ -105,7 +104,7 @@ public class RegionCreateFunction implements Function, InternalEntity {
                 new Object[] {String.valueOf(RegionCommandsUtils.PERSISTENT_OVERFLOW_SHORTCUTS)});
       }
       resultSender.lastResult(handleException(memberNameOrId, exceptionMsg, null/* do not log */));
-    } catch (IllegalArgumentException | CreateSubregionException e) {
+    } catch (IllegalArgumentException e) {
       resultSender.lastResult(handleException(memberNameOrId, e.getMessage(), e));
     } catch (RegionExistsException e) {
       String exceptionMsg =
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java
index d7cf091..1aae338 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunction.java
@@ -20,7 +20,6 @@ import org.apache.geode.cache.execute.Function;
 import org.apache.geode.cache.execute.FunctionContext;
 import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.cache.xmlcache.CacheXml;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 
 /**
@@ -44,29 +43,35 @@ public class RegionDestroyFunction implements Function, InternalEntity {
     String regionPath = null;
     try {
       String functionId = context.getFunctionId();
-      if (getId().equals(functionId)) {
-        Object arguments = context.getArguments();
-        if (arguments != null) {
-          regionPath = (String) arguments;
-          Cache cache = context.getCache();
-          Region<?, ?> region = cache.getRegion(regionPath);
-          region.destroyRegion();
-          String regionName =
-              regionPath.startsWith(Region.SEPARATOR) ? regionPath.substring(1) : regionPath;
-          XmlEntity xmlEntity = new XmlEntity(CacheXml.REGION, "name", regionName);
-          context.getResultSender().lastResult(new CliFunctionResult("", xmlEntity, regionPath));
-        }
+      Object arguments = context.getArguments();
+
+      if (!getId().equals(functionId) || arguments == null) {
+        context.getResultSender().lastResult(new CliFunctionResult("", false,
+            "Function Id mismatch or arguments is not available."));
+        return;
+      }
+
+      regionPath = (String) arguments;
+      Cache cache = context.getCache();
+      Region<?, ?> region = cache.getRegion(regionPath);
+      // if the region is a distributed region, and is already destroyed by another member
+      if (region == null) {
+        context.getResultSender().lastResult(new CliFunctionResult("", true, "SUCCESS"));
+        return;
       }
-      context.getResultSender().lastResult(new CliFunctionResult("", false, "FAILURE"));
-    } catch (IllegalStateException e) {
-      context.getResultSender().lastResult(new CliFunctionResult("", e, null));
+
+      region.destroyRegion();
+      String regionName =
+          regionPath.startsWith(Region.SEPARATOR) ? regionPath.substring(1) : regionPath;
+      XmlEntity xmlEntity = new XmlEntity(CacheXml.REGION, "name", regionName);
+      context.getResultSender().lastResult(new CliFunctionResult("", xmlEntity, regionPath));
+
+    } catch (IllegalStateException ex) {
+      // user is trying to destroy something that can't destroyed.
+      context.getResultSender().lastResult(new CliFunctionResult("", false, ex.getMessage()));
     } catch (Exception ex) {
       context.getResultSender()
-          .lastResult(new CliFunctionResult("",
-              new RuntimeException(CliStrings.format(
-                  CliStrings.DESTROY_REGION__MSG__ERROR_WHILE_DESTROYING_REGION_0_REASON_1,
-                  new Object[] {regionPath, ex.getMessage()})),
-              null));
+          .lastResult(new CliFunctionResult("", ex, "failed to destroy " + regionPath));
     }
   }
 
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 69dfc31..0e27fba 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
@@ -2033,9 +2033,10 @@ public class CliStrings {
   public static final String SHOW_METRICS__CATEGORY__HELP =
       "Categories available based upon the parameters specified are:\n"
           + "- no parameters specified: cluster, cache, diskstore, query\n"
-          + "- region specified: cluster, region, partition, diskstore, callback, eviction\n"
-          + "- member specified: member, jvm, region, serialization, communication, function, transaction, diskstore, lock, eviction, distribution, offheap\n"
-          + "- member and region specified: region, partition, diskstore, callback, eviction";
+          + "- region specified: callback, cluster, diskstore, eviction, partition, region\n"
+          + "- member specified: communication, diskstore, distribution, eviction, function, jvm, lock, member, offheap, region, serialization, transaction\n"
+          + "- member and port specified: cacheserver, communication, diskstore, distribution, eviction, function, jvm, lock, member, notification, offheap, query, region, serialization, transaction\n"
+          + "- member and region specified: callback, diskstore, eviction, partition, region";
   public static final String SHOW_METRICS__FILE = "file";
   public static final String SHOW_METRICS__FILE__HELP =
       "Name of the file to which metrics will be written.";
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/remote/CommandExecutor.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/remote/CommandExecutor.java
index 0ea9764..d4f5218 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/remote/CommandExecutor.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/remote/CommandExecutor.java
@@ -14,12 +14,14 @@
  */
 package org.apache.geode.management.internal.cli.remote;
 
-import org.apache.commons.lang.exception.ExceptionUtils;
 import org.apache.logging.log4j.Logger;
 import org.springframework.shell.event.ParseResult;
 import org.springframework.util.ReflectionUtils;
 
+import org.apache.geode.SystemFailure;
 import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
+import org.apache.geode.management.internal.cli.exceptions.UserErrorException;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.security.NotAuthorizedException;
 
@@ -40,14 +42,45 @@ public class CommandExecutor {
         return ResultBuilder.createGemFireErrorResult("Command returned null: " + parseResult);
       }
       return result;
-    } catch (NotAuthorizedException e) {
+    }
+
+    // for Authorization Exception, we need to throw them for higher level code to catch
+    catch (NotAuthorizedException e) {
       logger.error("Not authorized to execute \"" + parseResult + "\".", e);
       throw e;
-    } catch (Exception e) {
+    }
+
+    // for these exceptions, needs to create a UserErrorResult (still reported as error by gfsh)
+    // no need to log since this is a user error
+    catch (UserErrorException | IllegalStateException | IllegalArgumentException e) {
+      return ResultBuilder.createUserErrorResult(e.getMessage());
+    }
+
+    // if entity not found, depending on the thrower's intention, report either as success or error
+    // no need to log since this is a user error
+    catch (EntityNotFoundException e) {
+      if (e.isStatusOK()) {
+        return ResultBuilder.createInfoResult("Skipping: " + e.getMessage());
+      } else {
+        return ResultBuilder.createUserErrorResult(e.getMessage());
+      }
+    }
+
+    // all other exceptions, log it and build an error result.
+    catch (Exception e) {
       logger.error("Could not execute \"" + parseResult + "\".", e);
       return ResultBuilder.createGemFireErrorResult(
           "Error while processing command <" + parseResult + "> Reason : " + e.getMessage());
     }
+
+    // for errors more lower-level than Exception, just throw them.
+    catch (VirtualMachineError e) {
+      SystemFailure.initiateFailure(e);
+      throw e;
+    } catch (Throwable t) {
+      SystemFailure.checkFailure();
+      throw t;
+    }
   }
 
   protected Object invokeCommand(ParseResult parseResult) {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/DiskStoreNotFoundException.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/DiskStoreNotFoundException.java
deleted file mode 100644
index 1887f88..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/DiskStoreNotFoundException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.util;
-
-import org.apache.geode.GemFireException;
-
-/**
- * The DiskStoreNotFoundException is a GemFireException class indicating that a disk store by name
- * could not be found on a member specified by name!
- * </p>
- *
- * @see org.apache.geode.GemFireException
- * @since GemFire 7.0
- */
-// TODO this GemFireException should be moved to a more appropriate package!
-@SuppressWarnings("unused")
-public class DiskStoreNotFoundException extends GemFireException {
-  private static final long serialVersionUID = -5184836041554948093L;
-
-  public DiskStoreNotFoundException() {}
-
-  public DiskStoreNotFoundException(final String message) {
-    super(message);
-  }
-
-  public DiskStoreNotFoundException(final Throwable cause) {
-    super(cause);
-  }
-
-  public DiskStoreNotFoundException(final String message, final Throwable cause) {
-    super(message, cause);
-  }
-
-}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/MemberNotFoundException.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/MemberNotFoundException.java
deleted file mode 100644
index 47837a9..0000000
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/util/MemberNotFoundException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
- * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance with the License. You may obtain a
- * copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the License
- * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
- * or implied. See the License for the specific language governing permissions and limitations under
- * the License.
- */
-
-package org.apache.geode.management.internal.cli.util;
-
-import org.apache.geode.GemFireException;
-
-/**
- * The MemberNotFoundException is a GemFirException indicating that a member by name could not be
- * found in the GemFire distributed system.
- * </p>
- *
- * @see org.apache.geode.GemFireException
- * @since GemFire 7.0
- */
-// TODO this GemFireException should be moved to a more appropriate package!
-@SuppressWarnings("unused")
-public class MemberNotFoundException extends GemFireException {
-  private static final long serialVersionUID = 5686788909239181174L;
-
-  public MemberNotFoundException() {}
-
-  public MemberNotFoundException(final String message) {
-    super(message);
-  }
-
-  public MemberNotFoundException(final Throwable cause) {
-    super(cause);
-  }
-
-  public MemberNotFoundException(final String message, final Throwable cause) {
-    super(message, cause);
-  }
-
-}
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/messages/CompactRequest.java b/geode-core/src/main/java/org/apache/geode/management/internal/messages/CompactRequest.java
index 2b22d27..72cb1d8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/messages/CompactRequest.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/messages/CompactRequest.java
@@ -95,7 +95,7 @@ public class CompactRequest extends AdminRequest {
   }
 
   @Override
-  protected AdminResponse createResponse(DistributionManager dm) {
+  protected AdminResponse createResponse(DM dm) {
     PersistentID compactedDiskStore = compactDiskStore(this.diskStoreName);
 
     return new CompactResponse(this.getSender(), compactedDiskStore);
@@ -159,14 +159,14 @@ public class CompactRequest extends AdminRequest {
     }
 
     @Override
-    protected void process(DistributionMessage msg, boolean warn) {
-      if (msg instanceof CompactResponse) {
-        final PersistentID persistentId = ((CompactResponse) msg).getPersistentId();
+    protected void process(DistributionMessage message, boolean warn) {
+      if (message instanceof CompactResponse) {
+        final PersistentID persistentId = ((CompactResponse) message).getPersistentId();
         if (persistentId != null) {
-          results.put(msg.getSender(), persistentId);
+          results.put(message.getSender(), persistentId);
         }
       }
-      super.process(msg, warn);
+      super.process(message, warn);
     }
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupDistributedTest.java
similarity index 59%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/BackupDUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupDistributedTest.java
index 9c45e2d..aa05da6 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupDistributedTest.java
@@ -12,8 +12,13 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache;
+package org.apache.geode.internal.cache.backup;
 
+import static org.apache.geode.test.dunit.Host.getHost;
+import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
+import static org.apache.geode.test.dunit.Invoke.invokeInEveryVM;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
@@ -25,25 +30,26 @@ import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintStream;
-import java.io.Serializable;
+import java.io.UncheckedIOException;
 import java.nio.file.Files;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.Set;
 import java.util.TreeSet;
 import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.TimeUnit;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.regex.Pattern;
 
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+import junitparams.naming.TestCaseName;
 import org.apache.commons.io.FileUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
+import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
 
-import org.apache.geode.admin.internal.PrepareBackupRequest;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.DataPolicy;
 import org.apache.geode.cache.DiskStore;
@@ -61,46 +67,62 @@ import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionMessageObserver;
 import org.apache.geode.distributed.internal.ReplyMessage;
 import org.apache.geode.internal.admin.remote.AdminFailureResponse;
+import org.apache.geode.internal.cache.DestroyRegionOperation.DestroyRegionMessage;
+import org.apache.geode.internal.cache.DiskRegion;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.partitioned.PersistentPartitionedRegionTestBase;
 import org.apache.geode.management.BackupStatus;
-import org.apache.geode.test.dunit.Assert;
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.DUnitEnv;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.IgnoredException;
-import org.apache.geode.test.dunit.Invoke;
 import org.apache.geode.test.dunit.SerializableCallable;
 import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.junit.categories.DistributedTest;
 
+/**
+ * Additional tests to consider adding:
+ * <ul>
+ * <li>Test default disk store.
+ * <li>Test backing up and recovering while a bucket move is in progress.
+ * <li>Test backing up and recovering while ops are in progress?
+ * </ul>
+ */
 @Category(DistributedTest.class)
-public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
-  Logger logger = LogManager.getLogger(BackupDUnitTest.class);
+@RunWith(JUnitParamsRunner.class)
+@SuppressWarnings("serial")
+public class BackupDistributedTest extends PersistentPartitionedRegionTestBase {
 
-  private static final long MAX_WAIT_SECONDS = 30;
   private VM vm0;
   private VM vm1;
+  private VM vm2;
+  private VM vm3;
+
+  @Before
+  public void setUp() throws Exception {
+    vm0 = getHost(0).getVM(0);
+    vm1 = getHost(0).getVM(1);
+    vm2 = getHost(0).getVM(2);
+    vm3 = getHost(0).getVM(3);
+  }
 
   @Override
   public final void preTearDownCacheTestCase() throws Exception {
+    vm0.invoke(() -> {
+      DistributionMessageObserver.setInstance(null);
+      disconnectFromDS();
+    });
+
     StringBuilder failures = new StringBuilder();
     delete(getBackupDir(), failures);
     if (failures.length() > 0) {
-      logger.error(failures.toString());
+      // logger.error(failures.toString());
     }
   }
 
   @Test
-  public void testBackupPR() throws Throwable {
-    Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-    VM vm2 = host.getVM(2);
-
-    logger.info("Creating region in VM0");
+  public void testBackupPR() throws Exception {
     createPersistentRegion(vm0);
-    logger.info("Creating region in VM1");
     createPersistentRegion(vm1);
 
     long lm0 = setBackupFiles(vm0);
@@ -110,11 +132,12 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     createData(vm0, 0, 5, "B", "region2");
 
     BackupStatus status = backup(vm2);
-    assertEquals(2, status.getBackedUpDiskStores().size());
-    assertEquals(Collections.emptySet(), status.getOfflineDiskStores());
+    assertThat(status.getBackedUpDiskStores()).hasSize(2);
+    assertThat(status.getOfflineDiskStores()).isEmpty();
 
     Collection<File> files = FileUtils.listFiles(getBackupDir(), new String[] {"txt"}, true);
-    assertEquals(4, files.size());
+    assertThat(files).hasSize(4);
+
     deleteOldUserUserFile(vm0);
     deleteOldUserUserFile(vm1);
     validateBackupComplete();
@@ -122,22 +145,14 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     createData(vm0, 0, 5, "C", "region1");
     createData(vm0, 0, 5, "C", "region2");
 
-    assertEquals(2, status.getBackedUpDiskStores().size());
-    assertEquals(Collections.emptySet(), status.getOfflineDiskStores());
+    assertThat(status.getBackedUpDiskStores()).hasSize(2);
+    assertThat(status.getOfflineDiskStores()).isEmpty();
 
     closeCache(vm0);
     closeCache(vm1);
 
-    // Destroy the current data
-    Invoke.invokeInEveryVM(new SerializableRunnable("Clean disk dirs") {
-      public void run() {
-        try {
-          cleanDiskDirs();
-        } catch (IOException e) {
-          throw new RuntimeException(e);
-        }
-      }
-    });
+    // destroy the current data
+    cleanDiskDirsInEveryVM();
 
     restoreBackup(2);
 
@@ -150,44 +165,35 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
   }
 
   /**
-   * Test of bug 42419
+   * Test of bug 42419.
+   *
+   * <p>
+   * TRAC 42419: backed up disk stores map contains null key instead of member; cannot restore
+   * backup files
    */
   @Test
-  public void testBackupFromMemberWithDiskStore() throws Throwable {
-    Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-
-    logger.info("Creating region in VM0");
+  public void testBackupFromMemberWithDiskStore() throws Exception {
     createPersistentRegion(vm0);
-    logger.info("Creating region in VM1");
     createPersistentRegion(vm1);
 
     createData(vm0, 0, 5, "A", "region1");
     createData(vm0, 0, 5, "B", "region2");
 
     BackupStatus status = backup(vm1);
-    assertEquals(2, status.getBackedUpDiskStores().size());
+    assertThat(status.getBackedUpDiskStores()).hasSize(2);
+
     for (DistributedMember key : status.getBackedUpDiskStores().keySet()) {
-      assertNotNull(key);
+      assertThat(key).isNotNull();
     }
-    assertEquals(Collections.emptySet(), status.getOfflineDiskStores());
+    assertThat(status.getOfflineDiskStores()).isEmpty();
 
     validateBackupComplete();
 
     closeCache(vm0);
     closeCache(vm1);
 
-    // Destroy the current data
-    Invoke.invokeInEveryVM(new SerializableRunnable("Clean disk dirs") {
-      public void run() {
-        try {
-          cleanDiskDirs();
-        } catch (IOException e) {
-          throw new RuntimeException(e);
-        }
-      }
-    });
+    // destroy the current data
+    invokeInEveryVM("cleanDiskDirs", () -> cleanDiskDirs());
 
     restoreBackup(2);
 
@@ -197,34 +203,21 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     checkData(vm0, 0, 5, "B", "region2");
   }
 
-  private void createPersistentRegionsAsync() throws java.util.concurrent.ExecutionException,
-      InterruptedException, java.util.concurrent.TimeoutException {
-    logger.info("Creating region in VM0");
-    AsyncInvocation async0 = createPersistentRegionAsync(vm0);
-    logger.info("Creating region in VM1");
-    AsyncInvocation async1 = createPersistentRegionAsync(vm1);
-    async0.get(MAX_WAIT_SECONDS, TimeUnit.SECONDS);
-    async1.get(MAX_WAIT_SECONDS, TimeUnit.SECONDS);
-  }
-
   /**
    * Test for bug 42419
+   *
+   * <p>
+   * TRAC 42419: backed up disk stores map contains null key instead of member; cannot restore
+   * backup files
    */
   @Test
-  public void testBackupWhileBucketIsCreated() throws Throwable {
-    Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-    final VM vm2 = host.getVM(2);
-
-    logger.info("Creating region in VM0");
+  public void testBackupWhileBucketIsCreated() throws Exception {
     createPersistentRegion(vm0);
 
     // create a bucket on vm0
     createData(vm0, 0, 1, "A", "region1");
 
     // create the pr on vm1, which won't have any buckets
-    logger.info("Creating region in VM1");
     createPersistentRegion(vm1);
 
     CompletableFuture<BackupStatus> backupStatusFuture =
@@ -234,29 +227,21 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     CompletableFuture.allOf(backupStatusFuture, createDataFuture);
 
     BackupStatus status = backupStatusFuture.get();
-    assertEquals(2, status.getBackedUpDiskStores().size());
-    assertEquals(Collections.emptySet(), status.getOfflineDiskStores());
+    assertThat(status.getBackedUpDiskStores()).hasSize(2);
+    assertThat(status.getOfflineDiskStores()).isEmpty();
 
     validateBackupComplete();
 
     createData(vm0, 0, 5, "C", "region1");
 
-    assertEquals(2, status.getBackedUpDiskStores().size());
-    assertEquals(Collections.emptySet(), status.getOfflineDiskStores());
+    assertThat(status.getBackedUpDiskStores()).hasSize(2);
+    assertThat(status.getOfflineDiskStores()).isEmpty();
 
     closeCache(vm0);
     closeCache(vm1);
 
-    // Destroy the current data
-    Invoke.invokeInEveryVM(new SerializableRunnable("Clean disk dirs") {
-      public void run() {
-        try {
-          cleanDiskDirs();
-        } catch (IOException e) {
-          throw new RuntimeException(e);
-        }
-      }
-    });
+    // destroy the current data
+    invokeInEveryVM("cleanDiskDirs", () -> cleanDiskDirs());
 
     restoreBackup(2);
 
@@ -265,93 +250,82 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     checkData(vm0, 0, 1, "A", "region1");
   }
 
+  /**
+   * Test for bug 42420. Invoke a backup when a bucket is in the middle of being moved.
+   *
+   * <p>
+   * TRAC 42420: Online backup files sometimes cannot be restored
+   */
   @Test
-  public void testBackupWhileBucketIsMovedBackupBeforeSendDestroy() throws Throwable {
-    Host host = Host.getHost(0);
-    final VM vm2 = host.getVM(2);
+  @Parameters({"BEFORE_SENDING_DESTROYREGIONMESSAGE", "BEFORE_PROCESSING_REPLYMESSAGE"})
+  @TestCaseName("{method}({params})")
+  public void testWhileBucketIsMovedBackup(final WhenToInvokeBackup whenToInvokeBackup)
+      throws Exception {
+    vm0.invoke("Add listener to invoke backup", () -> {
+      disconnectFromDS();
 
-    DistributionMessageObserver observer = new SerializableDistributionMessageObserver() {
-      private volatile boolean done;
+      // This listener will wait for a response to the
+      // destroy region message, and then trigger a backup.
+      // That will backup before this member has finished destroying
+      // a bucket, but after the peer has removed the bucket.
+      DistributionMessageObserver.setInstance(createTestHookToBackup(whenToInvokeBackup));
+    });
 
-      @Override
-      public void beforeSendMessage(DistributionManager dm, DistributionMessage msg) {
+    createPersistentRegion(vm0);
 
-        // The bucket move will send a destroy region message.
-        if (msg instanceof DestroyRegionOperation.DestroyRegionMessage && !done) {
-          backup(vm2);
-          done = true;
-        }
-      }
-    };
+    // create twos bucket on vm0
+    createData(vm0, 0, 2, "A", "region1");
 
-    backupWhileBucketIsMoved(observer);
-  }
+    // create the pr on vm1, which won't have any buckets
+    createPersistentRegion(vm1);
 
-  @Test
-  public void testBackupWhileBucketIsMovedBackupAfterSendDestroy() throws Throwable {
-    Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-    final VM vm2 = host.getVM(2);
+    // Perform a rebalance. This will trigger the backup in the middle of the bucket move.
+    vm0.invoke("Do rebalance", () -> {
+      RebalanceOperation op = getCache().getResourceManager().createRebalanceFactory().start();
+      RebalanceResults results;
+      try {
+        results = op.getResults();
+        assertEquals(1, results.getTotalBucketTransfersCompleted());
+      } catch (InterruptedException e) {
+        throw new RuntimeException(e);
+      }
+    });
 
-    DistributionMessageObserver observer = new SerializableDistributionMessageObserver() {
-      private volatile boolean done;
-      private AtomicInteger count = new AtomicInteger();
-      private volatile int replyId = -0xBAD;
+    validateBackupComplete();
 
-      @Override
-      public void beforeSendMessage(DistributionManager dm, DistributionMessage msg) {
+    createData(vm0, 0, 5, "C", "region1");
 
-        // The bucket move will send a destroy region message.
-        if (msg instanceof DestroyRegionOperation.DestroyRegionMessage && !done) {
-          this.replyId = msg.getProcessorId();
-        }
-      }
+    closeCache(vm0);
+    closeCache(vm1);
 
-      @Override
-      public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) {
-        if (message instanceof ReplyMessage && replyId != -0xBAD
-            && replyId == message.getProcessorId() && !done
-        // we need two replies
-            && count.incrementAndGet() == 2) {
-          backup(vm2);
-          done = true;
-        }
+    // Destroy the current data
+    invokeInEveryVM("Clean disk dirs", () -> {
+      try {
+        cleanDiskDirs();
+      } catch (IOException e) {
+        throw new RuntimeException(e);
       }
-    };
+    });
 
-    backupWhileBucketIsMoved(observer);
+    restoreBackup(2);
+
+    createPersistentRegionsAsync();
+
+    checkData(vm0, 0, 2, "A", "region1");
   }
 
   @Test
-  public void testBackupStatusCleanedUpAfterFailureOnOneMember() throws Throwable {
-    IgnoredException.addIgnoredException("Uncaught exception");
-    IgnoredException.addIgnoredException("Stop processing");
-    Host host = Host.getHost(0);
-    final VM vm0 = host.getVM(0);
-    VM vm1 = host.getVM(1);
-    final VM vm2 = host.getVM(2);
-
-    // Create an observer that will fail a backup
-    // When this member receives a prepare
-    DistributionMessageObserver observer = new SerializableDistributionMessageObserver() {
-      @Override
-      public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) {
-        if (message instanceof PrepareBackupRequest) {
-          DistributionMessageObserver.setInstance(null);
-          IOException exception = new IOException("Backup in progess");
-          AdminFailureResponse response =
-              AdminFailureResponse.create(dm, message.getSender(), exception);
-          response.setMsgId(((PrepareBackupRequest) message).getMsgId());
-          dm.putOutgoing(response);
-          throw new RuntimeException("Stop processing");
-        }
-      }
-    };
+  public void testBackupStatusCleanedUpAfterFailureOnOneMember() throws Exception {
+    addIgnoredException("Uncaught exception");
+    addIgnoredException("Stop processing");
+
+    String exceptionMessage = "Backup in progress";
 
     vm0.invoke(() -> {
       disconnectFromDS();
-      DistributionMessageObserver.setInstance(observer);
+      // create an observer that will fail a backup when this member receives a prepare
+      DistributionMessageObserver.setInstance(
+          createTestHookToThrowIOExceptionBeforeProcessingPrepareBackupRequest(exceptionMessage));
     });
 
     createPersistentRegion(vm0);
@@ -360,149 +334,37 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     createData(vm0, 0, 5, "A", "region1");
     createData(vm0, 0, 5, "B", "region2");
 
-    try {
-      backup(vm2);
-      fail("Backup should have failed with in progress exception");
-    } catch (Exception expected) {
-      // that's ok, hte backup should have failed
-    }
+    assertThatThrownBy(() -> backup(vm2)).hasRootCauseInstanceOf(IOException.class);
 
-    // A second backup should succeed because the observer
-    // has been cleared and the backup state should be cleared.
+    // second backup should succeed because the observer and backup state has been cleared
     BackupStatus status = backup(vm2);
-    assertEquals(2, status.getBackedUpDiskStores().size());
-    assertEquals(Collections.emptySet(), status.getOfflineDiskStores());
-
-
-  }
-
-  /**
-   * Test for bug 42420. Invoke a backup when a bucket is in the middle of being moved.
-   *
-   * @param observer - a message observer that triggers at the backup at the correct time.
-   */
-  private void backupWhileBucketIsMoved(final DistributionMessageObserver observer)
-      throws Throwable {
-    Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-
-    vm0.invoke(new SerializableRunnable("Add listener to invoke backup") {
-
-      public void run() {
-        disconnectFromDS();
-
-        // This listener will wait for a response to the
-        // destroy region message, and then trigger a backup.
-        // That will backup before this member has finished destroying
-        // a bucket, but after the peer has removed the bucket.
-        DistributionMessageObserver.setInstance(observer);
-      }
-    });
-    try {
-
-      logger.info("Creating region in VM0");
-      createPersistentRegion(vm0);
-
-      // create twos bucket on vm0
-      createData(vm0, 0, 2, "A", "region1");
-
-      // create the pr on vm1, which won't have any buckets
-      logger.info("Creating region in VM1");
-
-      createPersistentRegion(vm1);
-
-      // Perform a rebalance. This will trigger the backup in the middle
-      // of the bucket move.
-      vm0.invoke(new SerializableRunnable("Do rebalance") {
-
-        public void run() {
-          Cache cache = getCache();
-          RebalanceOperation op = cache.getResourceManager().createRebalanceFactory().start();
-          RebalanceResults results;
-          try {
-            results = op.getResults();
-            assertEquals(1, results.getTotalBucketTransfersCompleted());
-          } catch (Exception e) {
-            Assert.fail("interupted", e);
-          }
-        }
-      });
-
-      validateBackupComplete();
-
-      createData(vm0, 0, 5, "C", "region1");
-
-      closeCache(vm0);
-      closeCache(vm1);
-
-      // Destroy the current data
-      Invoke.invokeInEveryVM(new SerializableRunnable("Clean disk dirs") {
-        public void run() {
-          try {
-            cleanDiskDirs();
-          } catch (IOException e) {
-            throw new RuntimeException(e);
-          }
-        }
-      });
-
-      restoreBackup(2);
-
-      createPersistentRegionsAsync();
-
-      checkData(vm0, 0, 2, "A", "region1");
-    } finally {
-      // cleanup the distribution message observer
-      vm0.invoke(new SerializableRunnable() {
-        public void run() {
-          DistributionMessageObserver.setInstance(null);
-          disconnectFromDS();
-        }
-      });
-    }
+    assertThat(status.getBackedUpDiskStores()).hasSize(2);
+    assertThat(status.getOfflineDiskStores()).isEmpty();
   }
 
   /**
    * Make sure we don't report members without persistent data as backed up.
    */
   @Test
-  public void testBackupOverflow() throws Throwable {
-    Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-    VM vm2 = host.getVM(2);
-
-    logger.info("Creating region in VM0");
+  public void testBackupOverflow() throws Exception {
     createPersistentRegion(vm0);
-    logger.info("Creating region in VM1");
     createOverflowRegion(vm1);
 
     createData(vm0, 0, 5, "A", "region1");
     createData(vm0, 0, 5, "B", "region2");
 
     BackupStatus status = backup(vm2);
-    assertEquals("Backed up disk stores  " + status, 1, status.getBackedUpDiskStores().size());
-    assertEquals(2, status.getBackedUpDiskStores().values().iterator().next().size());
-    assertEquals(Collections.emptySet(), status.getOfflineDiskStores());
+    assertThat(status.getBackedUpDiskStores()).hasSize(1);
+    assertThat(status.getBackedUpDiskStores().values().iterator().next()).hasSize(2);
+    assertThat(status.getOfflineDiskStores()).isEmpty();
 
     validateBackupComplete();
-
   }
 
   @Test
-  public void testBackupPRWithOfflineMembers() throws Throwable {
-    Host host = Host.getHost(0);
-    vm0 = host.getVM(0);
-    vm1 = host.getVM(1);
-    VM vm2 = host.getVM(2);
-    VM vm3 = host.getVM(3);
-
-    logger.info("Creating region in VM0");
+  public void testBackupPRWithOfflineMembers() throws Exception {
     createPersistentRegion(vm0);
-    logger.info("Creating region in VM1");
     createPersistentRegion(vm1);
-    logger.info("Creating region in VM2");
     createPersistentRegion(vm2);
 
     createData(vm0, 0, 5, "A", "region1");
@@ -511,15 +373,98 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     closeCache(vm2);
 
     BackupStatus status = backup(vm3);
-    assertEquals(2, status.getBackedUpDiskStores().size());
-    assertEquals(2, status.getOfflineDiskStores().size());
+    assertThat(status.getBackedUpDiskStores()).hasSize(2);
+    assertThat(status.getOfflineDiskStores()).hasSize(2);
   }
 
-  // TODO
-  // Test default disk store.
-  // Test backing up and recovering while a bucket move is in progress.
-  // Test backing up and recovering while ops are in progress?
+  private DistributionMessageObserver createTestHookToBackup(
+      WhenToInvokeBackup backupInvocationTestHook) {
+    switch (backupInvocationTestHook) {
+      case BEFORE_SENDING_DESTROYREGIONMESSAGE:
+        return createTestHookToBackupBeforeSendingDestroyRegionMessage(() -> backup(vm2));
+      case BEFORE_PROCESSING_REPLYMESSAGE:
+        return createTestHookToBackupBeforeProcessingReplyMessage(() -> backup(vm2));
+      default:
+        throw new AssertionError("Invalid backupInvocationTestHook " + backupInvocationTestHook);
+    }
+  }
+
+  private DistributionMessageObserver createTestHookToBackupBeforeProcessingReplyMessage(
+      Runnable task) {
+    return new DistributionMessageObserver() {
+      private volatile boolean done;
+      private final AtomicInteger count = new AtomicInteger();
+      private volatile int replyId = -0xBAD;
 
+      @Override
+      public void beforeSendMessage(DistributionManager dm, DistributionMessage message) {
+        // the bucket move will send a destroy region message.
+        if (message instanceof DestroyRegionMessage && !done) {
+          this.replyId = message.getProcessorId();
+        }
+      }
+
+      @Override
+      public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) {
+        if (message instanceof ReplyMessage && replyId != -0xBAD
+            && replyId == message.getProcessorId() && !done && count.incrementAndGet() == 2) {
+          task.run();
+          done = true;
+        }
+      }
+    };
+  }
+
+  private DistributionMessageObserver createTestHookToBackupBeforeSendingDestroyRegionMessage(
+      Runnable task) {
+    return new DistributionMessageObserver() {
+      private volatile boolean done;
+
+      @Override
+      public void beforeSendMessage(DistributionManager dm, DistributionMessage message) {
+        // the bucket move will send a destroy region message.
+        if (message instanceof DestroyRegionMessage && !done) {
+          task.run();
+          done = true;
+        }
+      }
+    };
+  }
+
+  private void cleanDiskDirsInEveryVM() {
+    invokeInEveryVM("cleanDiskDirsInEveryVM", () -> {
+      try {
+        cleanDiskDirs();
+      } catch (IOException e) {
+        throw new UncheckedIOException(e);
+      }
+    });
+  }
+
+  private DistributionMessageObserver createTestHookToThrowIOExceptionBeforeProcessingPrepareBackupRequest(
+      final String exceptionMessage) {
+    return new DistributionMessageObserver() {
+      @Override
+      public void beforeProcessMessage(DistributionManager dm, DistributionMessage message) {
+        if (message instanceof PrepareBackupRequest) {
+          DistributionMessageObserver.setInstance(null);
+          IOException exception = new IOException(exceptionMessage);
+          AdminFailureResponse response =
+              AdminFailureResponse.create(message.getSender(), exception);
+          response.setMsgId(((PrepareBackupRequest) message).getMsgId());
+          dm.putOutgoing(response);
+          throw new RuntimeException("Stop processing");
+        }
+      }
+    };
+  }
+
+  private void createPersistentRegionsAsync() throws ExecutionException, InterruptedException {
+    AsyncInvocation async0 = createPersistentRegionAsync(vm0);
+    AsyncInvocation async1 = createPersistentRegionAsync(vm1);
+    async0.await();
+    async1.await();
+  }
 
   private void validateBackupComplete() {
     File backupDir = getBackupDir();
@@ -529,19 +474,13 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     assertTrue(files.length == 0);
   }
 
-  private void createPersistentRegion(VM vm) throws Throwable {
-    AsyncInvocation future = createPersistentRegionAsync(vm);
-    future.get(MAX_WAIT_SECONDS, TimeUnit.SECONDS);
-    if (future.isAlive()) {
-      fail("Region not created within" + MAX_WAIT_SECONDS);
-    }
-    if (future.exceptionOccurred()) {
-      throw new RuntimeException(future.getException());
-    }
+  private void createPersistentRegion(VM vm) throws Exception {
+    createPersistentRegionAsync(vm).await();
   }
 
   private void deleteOldUserUserFile(final VM vm) {
     SerializableRunnable validateUserFileBackup = new SerializableRunnable("set user backups") {
+      @Override
       public void run() {
         try {
           FileUtils.deleteDirectory(new File("userbackup_" + vm.getId()));
@@ -555,6 +494,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
 
   private long setBackupFiles(final VM vm) {
     SerializableCallable setUserBackups = new SerializableCallable("set user backups") {
+      @Override
       public Object call() {
         final int pid = DUnitEnv.get().getPid();
         File vmdir = new File("userbackup_" + pid);
@@ -587,6 +527,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
 
   private void verifyUserFileRestored(VM vm, final long lm) {
     vm.invoke(new SerializableRunnable() {
+      @Override
       public void run() {
         final int pid = DUnitEnv.get().getPid();
         File vmdir = new File("userbackup_" + pid);
@@ -615,6 +556,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
 
   private AsyncInvocation createPersistentRegionAsync(final VM vm) {
     SerializableRunnable createRegion = new SerializableRunnable("Create persistent region") {
+      @Override
       public void run() {
         Cache cache = getCache();
         DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -644,6 +586,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
 
   private void createOverflowRegion(final VM vm) {
     SerializableRunnable createRegion = new SerializableRunnable("Create persistent region") {
+      @Override
       public void run() {
         Cache cache = getCache();
         DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -663,14 +606,17 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     vm.invoke(createRegion);
   }
 
+  @Override
   protected void createData(VM vm, final int startKey, final int endKey, final String value) {
-    createData(vm, startKey, endKey, value, PR_REGION_NAME);
+    createData(vm, startKey, endKey, value, getPartitionedRegionName());
   }
 
+  @Override
   protected void createData(VM vm, final int startKey, final int endKey, final String value,
       final String regionName) {
     SerializableRunnable createData = new SerializableRunnable() {
 
+      @Override
       public void run() {
         Cache cache = getCache();
         Region region = cache.getRegion(regionName);
@@ -683,14 +629,17 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     vm.invoke(createData);
   }
 
-  protected void checkData(VM vm0, final int startKey, final int endKey, final String value) {
-    checkData(vm0, startKey, endKey, value, PR_REGION_NAME);
+  @Override
+  protected void checkData(VM vm, final int startKey, final int endKey, final String value) {
+    checkData(vm, startKey, endKey, value, getPartitionedRegionName());
   }
 
-  protected void checkData(VM vm0, final int startKey, final int endKey, final String value,
+  @Override
+  protected void checkData(VM vm, final int startKey, final int endKey, final String value,
       final String regionName) {
     SerializableRunnable checkData = new SerializableRunnable() {
 
+      @Override
       public void run() {
         Cache cache = getCache();
         Region region = cache.getRegion(regionName);
@@ -701,11 +650,13 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
       }
     };
 
-    vm0.invoke(checkData);
+    vm.invoke(checkData);
   }
 
+  @Override
   protected void closeCache(final VM vm) {
     SerializableRunnable closeCache = new SerializableRunnable("close cache") {
+      @Override
       public void run() {
         Cache cache = getCache();
         cache.close();
@@ -714,13 +665,16 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     vm.invoke(closeCache);
   }
 
-  protected Set<Integer> getBucketList(VM vm0) {
-    return getBucketList(vm0, PR_REGION_NAME);
+  @Override
+  protected Set<Integer> getBucketList(VM vm) {
+    return getBucketList(vm, getPartitionedRegionName());
   }
 
-  protected Set<Integer> getBucketList(VM vm0, final String regionName) {
+  @Override
+  protected Set<Integer> getBucketList(VM vm, final String regionName) {
     SerializableCallable getBuckets = new SerializableCallable("get buckets") {
 
+      @Override
       public Object call() throws Exception {
         Cache cache = getCache();
         PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
@@ -728,7 +682,7 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
       }
     };
 
-    return (Set<Integer>) vm0.invoke(getBuckets);
+    return (Set<Integer>) vm.invoke(getBuckets);
   }
 
   private File[] getDiskDirs(String dsName) {
@@ -743,9 +697,22 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
     return DataPolicy.PERSISTENT_PARTITION;
   }
 
-  private static class SerializableDistributionMessageObserver extends DistributionMessageObserver
-      implements Serializable {
-
+  void checkRecoveredFromDisk(VM vm, final int bucketId, final boolean recoveredLocally) {
+    vm.invoke(new SerializableRunnable("check recovered from disk") {
+      @Override
+      public void run() {
+        Cache cache = getCache();
+        PartitionedRegion region = (PartitionedRegion) cache.getRegion(getPartitionedRegionName());
+        DiskRegion disk = region.getRegionAdvisor().getBucket(bucketId).getDiskRegion();
+        if (recoveredLocally) {
+          assertEquals(0, disk.getStats().getRemoteInitializations());
+          assertEquals(1, disk.getStats().getLocalInitializations());
+        } else {
+          assertEquals(1, disk.getStats().getRemoteInitializations());
+          assertEquals(0, disk.getStats().getLocalInitializations());
+        }
+      }
+    });
   }
 
   /**
@@ -754,8 +721,9 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
    * much as possible.
    */
   public static void delete(File file, StringBuilder failures) {
-    if (!file.exists())
+    if (!file.exists()) {
       return;
+    }
 
     if (file.isDirectory()) {
       File[] fileList = file.listFiles();
@@ -775,4 +743,8 @@ public class BackupDUnitTest extends PersistentPartitionedRegionTestBase {
       }
     }
   }
+
+  enum WhenToInvokeBackup {
+    BEFORE_SENDING_DESTROYREGIONMESSAGE, BEFORE_PROCESSING_REPLYMESSAGE
+  }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/BackupInspectorIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupInspectorIntegrationTest.java
similarity index 99%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/persistence/BackupInspectorIntegrationTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupInspectorIntegrationTest.java
index 704a6e1..1a2be04 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/BackupInspectorIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupInspectorIntegrationTest.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupIntegrationTest.java
similarity index 93%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupIntegrationTest.java
index af85980..ee58738 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/BackupJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupIntegrationTest.java
@@ -12,13 +12,16 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache;
+package org.apache.geode.internal.cache.backup;
 
 import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -51,10 +54,12 @@ import org.apache.geode.cache.EvictionAction;
 import org.apache.geode.cache.EvictionAttributes;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.internal.cache.DiskStoreImpl;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 
 @Category(IntegrationTest.class)
-public class BackupJUnitTest {
+public class BackupIntegrationTest {
 
   private static final String DISK_STORE_NAME = "diskStore";
   private GemFireCacheImpl cache = null;
@@ -68,7 +73,7 @@ public class BackupJUnitTest {
   private final Random random = new Random();
 
   private String getName() {
-    return "BackupJUnitTest_" + System.identityHashCode(this);
+    return "BackupIntegrationTest_" + System.identityHashCode(this);
   }
 
   @Before
@@ -79,7 +84,7 @@ public class BackupJUnitTest {
       String tmpDirName = System.getProperty("java.io.tmpdir");
       tmpDir = new File(tmpDirName == null ? "" : tmpDirName);
       try {
-        URL url = BackupJUnitTest.class.getResource("BackupJUnitTest.cache.xml");
+        URL url = BackupIntegrationTest.class.getResource("BackupIntegrationTest.cache.xml");
         cacheXmlFile = new File(url.toURI().getPath());
       } catch (URISyntaxException e) {
         throw new ExceptionInInitializerError(e);
@@ -99,7 +104,7 @@ public class BackupJUnitTest {
     diskDirs[1].mkdir();
   }
 
-  private void createCache() throws IOException {
+  private void createCache() {
     cache = (GemFireCacheImpl) new CacheFactory(props).create();
   }
 
@@ -119,15 +124,15 @@ public class BackupJUnitTest {
   }
 
   @Test
-  public void testBackupAndRecover() throws IOException, InterruptedException {
+  public void testBackupAndRecover() throws Exception {
     backupAndRecover(() -> {
       createDiskStore();
-      return BackupJUnitTest.this.createRegion();
+      return createRegion();
     });
   }
 
   @Test
-  public void testBackupAndRecoverOldConfig() throws IOException, InterruptedException {
+  public void testBackupAndRecoverOldConfig() throws Exception {
     backupAndRecover(() -> {
       createDiskStore();
       RegionFactory regionFactory = cache.createRegionFactory();
@@ -227,7 +232,7 @@ public class BackupJUnitTest {
 
 
   @Test
-  public void testBackupEmptyDiskStore() throws IOException, InterruptedException {
+  public void testBackupEmptyDiskStore() throws Exception {
     createDiskStore();
 
     BackupManager backup =
@@ -239,7 +244,7 @@ public class BackupJUnitTest {
   }
 
   @Test
-  public void testBackupOverflowOnlyDiskStore() throws IOException, InterruptedException {
+  public void testBackupOverflowOnlyDiskStore() throws Exception {
     createDiskStore();
     Region region = createOverflowRegion();
     // Put another key to make sure we restore
@@ -258,7 +263,7 @@ public class BackupJUnitTest {
 
 
   @Test
-  public void testCompactionDuringBackup() throws IOException, InterruptedException {
+  public void testCompactionDuringBackup() throws Exception {
     DiskStoreFactory dsf = cache.createDiskStoreFactory();
     dsf.setDiskDirs(diskDirs);
     dsf.setMaxOplogSize(1);
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupLockTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupLockTest.java
new file mode 100644
index 0000000..9f1c82b
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupLockTest.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.awaitility.Awaitility.await;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class BackupLockTest {
+
+  private BackupLock backupLock;
+  private ExecutorService executor;
+
+  @Before
+  public void setUp() throws Exception {
+    backupLock = new BackupLock();
+    executor = Executors.newSingleThreadExecutor();
+  }
+
+  @Test
+  public void lockShouldBlockUntilLockForBackup() throws Exception {
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    AtomicBoolean beforeLock = new AtomicBoolean();
+    AtomicBoolean afterLock = new AtomicBoolean();
+
+    backupLock.setBackupLockTestHook(() -> beforeLock.set(true));
+
+    executor.submit(() -> {
+      backupLock.lock(); // beforeLock is set inside lock() method
+      afterLock.set(true);
+    });
+
+    await().atMost(10, SECONDS).until(() -> assertThat(beforeLock).isTrue());
+    assertThat(afterLock).isFalse();
+
+    backupLock.unlockForBackup();
+    await().atMost(10, SECONDS).until(() -> assertThat(afterLock).isTrue());
+  }
+
+  @Test
+  public void otherThreadShouldBeAbleToUnlockForBackup() throws Exception {
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    await().atMost(10, SECONDS).until(() -> assertThat(backupLock.isBackingUp()).isTrue());
+    assertThat(backupLock.isCurrentThreadDoingBackup()).isTrue();
+
+    executor.submit(() -> {
+      assertThat(backupLock.isCurrentThreadDoingBackup()).isFalse();
+      backupLock.unlockForBackup();
+    });
+
+    await().atMost(10, SECONDS).until(() -> assertThat(backupLock.isBackingUp()).isFalse());
+  }
+
+  @Test
+  public void isCurrentThreadDoingBackupShouldBeSetAndUnset() throws Exception {
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    assertThat(backupLock.isCurrentThreadDoingBackup()).isTrue();
+
+    backupLock.unlockForBackup();
+
+    assertThat(backupLock.isCurrentThreadDoingBackup()).isFalse();
+  }
+
+  @Test
+  public void threadLocalShouldNotLeak() throws Exception {
+    backupLock.lockForBackup();
+    backupLock.setBackupThread();
+
+    assertThat(backupLock.hasThreadLocal()).isTrue();
+
+    backupLock.unlockForBackup();
+
+    assertThat(backupLock.hasThreadLocal()).isFalse();
+  }
+
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/BackupPrepareAndFinishMsgDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupPrepareAndFinishMsgDUnitTest.java
similarity index 93%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/persistence/BackupPrepareAndFinishMsgDUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupPrepareAndFinishMsgDUnitTest.java
index 2dfc16c..f48f7f3 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/BackupPrepareAndFinishMsgDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupPrepareAndFinishMsgDUnitTest.java
@@ -12,13 +12,11 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
 import java.io.File;
 import java.util.ArrayList;
@@ -40,8 +38,6 @@ import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.admin.internal.FinishBackupRequest;
-import org.apache.geode.admin.internal.PrepareBackupRequest;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.DiskStore;
 import org.apache.geode.cache.DiskStoreFactory;
@@ -55,13 +51,13 @@ import org.apache.geode.cache.query.QueryInvocationTargetException;
 import org.apache.geode.cache.query.TypeMismatchException;
 import org.apache.geode.cache30.CacheTestCase;
 import org.apache.geode.distributed.internal.DM;
-import org.apache.geode.internal.cache.BackupLock;
 import org.apache.geode.internal.cache.DiskStoreImpl;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.test.junit.categories.DistributedTest;
 
 @Category({DistributedTest.class})
 public abstract class BackupPrepareAndFinishMsgDUnitTest extends CacheTestCase {
+
   // Although this test does not make use of other members, the current member needs to be
   // a distributed member (rather than local) because it sends prepare and finish backup messages
   private static final String TEST_REGION_NAME = "TestRegion";
@@ -141,24 +137,28 @@ public abstract class BackupPrepareAndFinishMsgDUnitTest extends CacheTestCase {
     DM dm = GemFireCacheImpl.getInstance().getDistributionManager();
     Set recipients = dm.getOtherDistributionManagerIds();
     Future<Void> future = null;
-    PrepareBackupRequest.send(dm, recipients);
+    new PrepareBackupOperation(dm, dm.getId(), dm.getCache(), recipients,
+        new PrepareBackupFactory()).send();
     waitingForBackupLockCount = 0;
     future = CompletableFuture.runAsync(function);
     Awaitility.await().atMost(5, TimeUnit.SECONDS)
         .until(() -> assertTrue(waitingForBackupLockCount == 1));
-    FinishBackupRequest.send(dm, recipients, diskDirs[0], null, false);
+    new FinishBackupOperation(dm, dm.getId(), dm.getCache(), recipients, diskDirs[0], null, false,
+        new FinishBackupFactory()).send();
     future.get(5, TimeUnit.SECONDS);
   }
 
   private void doReadActionsAndVerifyCompletion() {
     DM dm = GemFireCacheImpl.getInstance().getDistributionManager();
     Set recipients = dm.getOtherDistributionManagerIds();
-    PrepareBackupRequest.send(dm, recipients);
+    new PrepareBackupOperation(dm, dm.getId(), dm.getCache(), recipients,
+        new PrepareBackupFactory()).send();
     waitingForBackupLockCount = 0;
     List<CompletableFuture<?>> futureList = doReadActions();
     CompletableFuture.allOf(futureList.toArray(new CompletableFuture<?>[futureList.size()]));
     assertTrue(waitingForBackupLockCount == 0);
-    FinishBackupRequest.send(dm, recipients, diskDirs[0], null, false);
+    new FinishBackupOperation(dm, dm.getId(), dm.getCache(), recipients, diskDirs[0], null, false,
+        new FinishBackupFactory()).send();
   }
 
   private void verifyKeyValuePair(Integer key, Integer expectedValue) {
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupReplyProcessorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupReplyProcessorTest.java
new file mode 100644
index 0000000..e014852
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/BackupReplyProcessorTest.java
@@ -0,0 +1,90 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.DistributionMessage;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class BackupReplyProcessorTest {
+
+  private BackupReplyProcessor backupReplyProcessor;
+
+  private BackupResultCollector resultCollector;
+  private DM dm;
+  private InternalDistributedSystem system;
+  private InternalDistributedMember sender;
+
+  private Set<InternalDistributedMember> recipients;
+  private Set<PersistentID> persistentIds;
+
+  private BackupResponse backupResponse;
+  private DistributionMessage nonBackupResponse;
+
+  @Before
+  public void setUp() throws Exception {
+    resultCollector = mock(BackupResultCollector.class);
+    dm = mock(DM.class);
+    system = mock(InternalDistributedSystem.class);
+    backupResponse = mock(BackupResponse.class);
+    nonBackupResponse = mock(DistributionMessage.class);
+    sender = mock(InternalDistributedMember.class);
+
+    recipients = new HashSet<>();
+    persistentIds = new HashSet<>();
+
+    when(dm.getSystem()).thenReturn(system);
+    when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class));
+    when(backupResponse.getSender()).thenReturn(sender);
+    when(backupResponse.getPersistentIds()).thenReturn(persistentIds);
+    when(nonBackupResponse.getSender()).thenReturn(sender);
+
+    backupReplyProcessor = new BackupReplyProcessor(resultCollector, dm, recipients);
+  }
+
+  @Test
+  public void stopBecauseOfExceptionsReturnsFalse() throws Exception {
+    assertThat(backupReplyProcessor.stopBecauseOfExceptions()).isFalse();
+  }
+
+  @Test
+  public void processBackupResponseAddsSenderToResults() throws Exception {
+    backupReplyProcessor.process(backupResponse, false);
+
+    verify(resultCollector, times(1)).addToResults(eq(sender), eq(persistentIds));
+  }
+
+  @Test
+  public void processNonBackupResponseDoesNotAddSenderToResults() throws Exception {
+    backupReplyProcessor.process(nonBackupResponse, false);
+
+    verify(resultCollector, times(0)).addToResults(eq(sender), eq(persistentIds));
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupFactoryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupFactoryTest.java
new file mode 100644
index 0000000..ce2e7f4
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupFactoryTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class FinishBackupFactoryTest {
+
+  private FinishBackupFactory finishBackupFactory;
+
+  private BackupResultCollector resultCollector;
+  private DM dm;
+  private InternalDistributedMember sender;
+  private Set<InternalDistributedMember> recipients;
+  private InternalDistributedMember member;
+  private InternalCache cache;
+
+  @Before
+  public void setUp() throws Exception {
+    resultCollector = mock(BackupResultCollector.class);
+    dm = mock(DM.class);
+    sender = mock(InternalDistributedMember.class);
+    member = mock(InternalDistributedMember.class);
+    cache = mock(InternalCache.class);
+
+    recipients = new HashSet<>();
+
+    when(dm.getSystem()).thenReturn(mock(InternalDistributedSystem.class));
+    when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class));
+
+    finishBackupFactory = new FinishBackupFactory();
+  }
+
+  @Test
+  public void createReplyProcessorReturnsBackupReplyProcessor() throws Exception {
+    assertThat(finishBackupFactory.createReplyProcessor(resultCollector, dm, recipients))
+        .isInstanceOf(BackupReplyProcessor.class);
+  }
+
+  @Test
+  public void createRequestReturnsFinishBackupRequest() throws Exception {
+    assertThat(finishBackupFactory.createRequest(sender, recipients, 1, new File("targetDir"),
+        new File("baselineDir"), false)).isInstanceOf(FinishBackupRequest.class);
+  }
+
+  @Test
+  public void createFinishBackupReturnsFinishBackup() throws Exception {
+    assertThat(finishBackupFactory.createFinishBackup(cache, new File("targetDir"),
+        new File("baselineDir"), false)).isInstanceOf(FinishBackup.class);
+  }
+
+  @Test
+  public void createBackupResponseReturnsBackupResponse() {
+    assertThat(finishBackupFactory.createBackupResponse(member, null))
+        .isInstanceOf(BackupResponse.class);
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupOperationTest.java
new file mode 100644
index 0000000..c0972e8
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupOperationTest.java
@@ -0,0 +1,236 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.InOrder;
+import org.mockito.stubbing.Answer;
+
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class FinishBackupOperationTest {
+
+  private DM dm;
+  private InternalCache cache;
+  private Set<InternalDistributedMember> recipients;
+
+  private InternalDistributedMember sender;
+  private InternalDistributedMember member1;
+  private InternalDistributedMember member2;
+
+  private File targetDir = new File("targetDir");
+  private File baselineDir = new File("baselineDir");
+  private boolean abort = false;
+
+  private FinishBackupFactory finishBackupFactory;
+  private BackupReplyProcessor finishBackupReplyProcessor;
+  private FinishBackupRequest finishBackupRequest;
+  private FinishBackup finishBackup;
+
+  private FinishBackupOperation finishBackupOperation;
+
+  @Before
+  public void setUp() throws Exception {
+    dm = mock(DM.class);
+    cache = mock(InternalCache.class);
+
+    finishBackupReplyProcessor = mock(BackupReplyProcessor.class);
+    finishBackupRequest = mock(FinishBackupRequest.class);
+    finishBackup = mock(FinishBackup.class);
+
+    finishBackupFactory = mock(FinishBackupFactory.class);
+
+    sender = mock(InternalDistributedMember.class, "sender");
+    member1 = mock(InternalDistributedMember.class, "member1");
+    member2 = mock(InternalDistributedMember.class, "member2");
+    recipients = new HashSet<>();
+
+    finishBackupOperation = new FinishBackupOperation(dm, sender, cache, recipients, targetDir,
+        baselineDir, abort, finishBackupFactory);
+
+    when(finishBackupReplyProcessor.getProcessorId()).thenReturn(42);
+
+    when(
+        finishBackupFactory.createReplyProcessor(eq(finishBackupOperation), eq(dm), eq(recipients)))
+            .thenReturn(finishBackupReplyProcessor);
+    when(finishBackupFactory.createRequest(eq(sender), eq(recipients), eq(42), eq(targetDir),
+        eq(baselineDir), eq(abort))).thenReturn(finishBackupRequest);
+    when(finishBackupFactory.createFinishBackup(eq(cache), eq(targetDir), eq(baselineDir),
+        eq(abort))).thenReturn(finishBackup);
+  }
+
+  @Test
+  public void sendShouldSendfinishBackupMessage() throws Exception {
+    finishBackupOperation.send();
+
+    verify(dm, times(1)).putOutgoing(finishBackupRequest);
+  }
+
+  @Test
+  public void sendReturnsResultsForRemoteRecipient() throws Exception {
+    HashSet<PersistentID> persistentIdsForMember1 = new HashSet<>();
+    persistentIdsForMember1.add(mock(PersistentID.class));
+    doAnswer(invokeAddToResults(new MemberWithPersistentIds(member1, persistentIdsForMember1)))
+        .when(finishBackupReplyProcessor).waitForReplies();
+
+    assertThat(finishBackupOperation.send()).containsOnlyKeys(member1)
+        .containsValues(persistentIdsForMember1);
+  }
+
+  @Test
+  public void sendReturnsResultsForLocalMember() throws Exception {
+    HashSet<PersistentID> persistentIdsForSender = new HashSet<>();
+    persistentIdsForSender.add(mock(PersistentID.class));
+    when(finishBackup.run()).thenReturn(persistentIdsForSender);
+
+    assertThat(finishBackupOperation.send()).containsOnlyKeys(sender)
+        .containsValue(persistentIdsForSender);
+  }
+
+  @Test
+  public void sendReturnsResultsForAllMembers() throws Exception {
+    HashSet<PersistentID> persistentIdsForMember1 = new HashSet<>();
+    persistentIdsForMember1.add(mock(PersistentID.class));
+
+    HashSet<PersistentID> persistentIdsForMember2 = new HashSet<>();
+    persistentIdsForMember2.add(mock(PersistentID.class));
+
+    MemberWithPersistentIds[] ids = new MemberWithPersistentIds[] {
+        new MemberWithPersistentIds(member1, persistentIdsForMember1),
+        new MemberWithPersistentIds(member2, persistentIdsForMember2)};
+
+    doAnswer(invokeAddToResults(ids)).when(finishBackupReplyProcessor).waitForReplies();
+
+    HashSet<PersistentID> persistentIdsForSender = new HashSet<>();
+    persistentIdsForSender.add(mock(PersistentID.class));
+    when(finishBackup.run()).thenReturn(persistentIdsForSender);
+
+    assertThat(finishBackupOperation.send()).containsOnlyKeys(member1, member2, sender)
+        .containsValues(persistentIdsForSender, persistentIdsForMember1, persistentIdsForMember2);
+  }
+
+  @Test
+  public void getResultsShouldReturnEmptyMapByDefault() throws Exception {
+    assertThat(finishBackupOperation.getResults()).isEmpty();
+  }
+
+  @Test
+  public void addToResultsWithNullShouldBeNoop() throws Exception {
+    finishBackupOperation.addToResults(member1, null);
+    assertThat(finishBackupOperation.getResults()).isEmpty();
+  }
+
+  @Test
+  public void addToResultsWithEmptySetShouldBeNoop() throws Exception {
+    finishBackupOperation.addToResults(member1, new HashSet<>());
+    assertThat(finishBackupOperation.getResults()).isEmpty();
+  }
+
+  @Test
+  public void addToResultsShouldShowUpInGetResults() throws Exception {
+    HashSet<PersistentID> persistentIdsForMember1 = new HashSet<>();
+    persistentIdsForMember1.add(mock(PersistentID.class));
+    finishBackupOperation.addToResults(member1, persistentIdsForMember1);
+    assertThat(finishBackupOperation.getResults()).containsOnlyKeys(member1)
+        .containsValue(persistentIdsForMember1);
+  }
+
+  @Test
+  public void sendShouldHandleIOExceptionThrownFromRun() throws Exception {
+    when(finishBackup.run()).thenThrow(new IOException("expected exception"));
+    finishBackupOperation.send();
+  }
+
+  @Test(expected = RuntimeException.class)
+  public void sendShouldThrowNonIOExceptionThrownFromRun() throws Exception {
+    when(finishBackup.run()).thenThrow(new RuntimeException("expected exception"));
+    finishBackupOperation.send();
+  }
+
+  @Test
+  public void sendShouldHandleCancelExceptionFromWaitForReplies() throws Exception {
+    ReplyException replyException =
+        new ReplyException("expected exception", new CacheClosedException("expected exception"));
+    doThrow(replyException).when(finishBackupReplyProcessor).waitForReplies();
+    finishBackupOperation.send();
+  }
+
+  @Test
+  public void sendShouldHandleInterruptedExceptionFromWaitForReplies() throws Exception {
+    doThrow(new InterruptedException("expected exception")).when(finishBackupReplyProcessor)
+        .waitForReplies();
+    finishBackupOperation.send();
+  }
+
+  @Test(expected = ReplyException.class)
+  public void sendShouldThrowReplyExceptionWithNoCauseFromWaitForReplies() throws Exception {
+    doThrow(new ReplyException("expected exception")).when(finishBackupReplyProcessor)
+        .waitForReplies();
+    finishBackupOperation.send();
+  }
+
+  @Test(expected = ReplyException.class)
+  public void sendShouldThrowReplyExceptionWithCauseThatIsNotACancelFromWaitForReplies()
+      throws Exception {
+    doThrow(new ReplyException("expected exception", new RuntimeException("expected")))
+        .when(finishBackupReplyProcessor).waitForReplies();
+    finishBackupOperation.send();
+  }
+
+  @Test
+  public void sendShouldfinishForBackupInLocalMemberBeforeWaitingForReplies() throws Exception {
+    InOrder inOrder = inOrder(finishBackup, finishBackupReplyProcessor);
+    finishBackupOperation.send();
+
+    inOrder.verify(finishBackup, times(1)).run();
+    inOrder.verify(finishBackupReplyProcessor, times(1)).waitForReplies();
+  }
+
+  private Answer<Object> invokeAddToResults(MemberWithPersistentIds... memberWithPersistentIds) {
+    return invocation -> {
+      for (MemberWithPersistentIds ids : memberWithPersistentIds) {
+        finishBackupOperation.addToResults(ids.member, ids.persistentIds);
+      }
+      return null;
+    };
+  }
+
+  private static class MemberWithPersistentIds {
+    InternalDistributedMember member;
+    HashSet<PersistentID> persistentIds;
+
+    MemberWithPersistentIds(InternalDistributedMember member, HashSet<PersistentID> persistentIds) {
+      this.member = member;
+      this.persistentIds = persistentIds;
+    }
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupRequestTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupRequestTest.java
new file mode 100644
index 0000000..5e1a5a1
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FinishBackupRequestTest.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminFailureResponse;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class FinishBackupRequestTest {
+
+  private FinishBackupRequest finishBackupRequest;
+
+  private DM dm;
+  private InternalCache cache;
+  private BackupManager backupManager;
+  private int processorId = 79;
+  private File targetDir;
+  private File baselineDir;
+  private boolean abort;
+  private FinishBackupFactory finishBackupFactory;
+  private InternalDistributedMember sender;
+  private Set<InternalDistributedMember> recipients;
+  private HashSet<PersistentID> persistentIds;
+  private FinishBackup finishBackup;
+
+  @Before
+  public void setUp() throws Exception {
+    // mocks here
+    dm = mock(DM.class);
+    cache = mock(InternalCache.class);
+    backupManager = mock(BackupManager.class);
+    targetDir = mock(File.class);
+    baselineDir = mock(File.class);
+    abort = false;
+
+    when(dm.getCache()).thenReturn(cache);
+    when(dm.getDistributionManagerId()).thenReturn(sender);
+    when(cache.getBackupManager()).thenReturn(backupManager);
+
+    sender = mock(InternalDistributedMember.class);
+
+    recipients = new HashSet<>();
+    persistentIds = new HashSet<>();
+
+    finishBackup = mock(FinishBackup.class);
+    when(finishBackup.run()).thenReturn(persistentIds);
+
+    finishBackupFactory = mock(FinishBackupFactory.class);
+    when(finishBackupFactory.createFinishBackup(eq(cache), eq(targetDir), eq(baselineDir),
+        eq(abort))).thenReturn(finishBackup);
+    when(finishBackupFactory.createBackupResponse(eq(sender), eq(persistentIds)))
+        .thenReturn(mock(BackupResponse.class));
+
+
+    finishBackupRequest = new FinishBackupRequest(sender, recipients, processorId, targetDir,
+        baselineDir, false, finishBackupFactory);
+  }
+
+  @Test
+  public void usesFactoryToCreateFinishBackup() throws Exception {
+    finishBackupRequest.createResponse(dm);
+
+    verify(finishBackupFactory, times(1)).createFinishBackup(eq(cache), eq(targetDir),
+        eq(baselineDir), eq(abort));
+  }
+
+  @Test
+  public void usesFactoryToCreateBackupResponse() throws Exception {
+    finishBackupRequest.createResponse(dm);
+
+    verify(finishBackupFactory, times(1)).createBackupResponse(eq(sender), eq(persistentIds));
+  }
+
+  @Test
+  public void returnsBackupResponse() throws Exception {
+    assertThat(finishBackupRequest.createResponse(dm)).isInstanceOf(BackupResponse.class);
+  }
+
+  @Test
+  public void returnsAdminFailureResponseWhenFinishBackupThrowsIOException() throws Exception {
+    when(finishBackup.run()).thenThrow(new IOException());
+
+    assertThat(finishBackupRequest.createResponse(dm)).isInstanceOf(AdminFailureResponse.class);
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskFactoryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskFactoryTest.java
new file mode 100644
index 0000000..cfb62ab
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskFactoryTest.java
@@ -0,0 +1,83 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.io.File;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class FlushToDiskFactoryTest {
+
+  private FlushToDiskFactory flushToDiskFactory;
+
+  private DM dm;
+  private InternalDistributedMember sender;
+  private Set<InternalDistributedMember> recipients;
+  private InternalDistributedMember member;
+  private InternalCache cache;
+
+  @Before
+  public void setUp() throws Exception {
+    dm = mock(DM.class);
+    sender = mock(InternalDistributedMember.class);
+    member = mock(InternalDistributedMember.class);
+    cache = mock(InternalCache.class);
+
+    recipients = new HashSet<>();
+
+    when(dm.getSystem()).thenReturn(mock(InternalDistributedSystem.class));
+    when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class));
+
+    flushToDiskFactory = new FlushToDiskFactory();
+  }
+
+  @Test
+  public void createReplyProcessorReturnsFlushToDiskReplyProcessor() throws Exception {
+    assertThat(flushToDiskFactory.createReplyProcessor(dm, recipients))
+        .isInstanceOf(FlushToDiskProcessor.class);
+  }
+
+  @Test
+  public void createRequestReturnsFlushToDiskRequest() throws Exception {
+    assertThat(flushToDiskFactory.createRequest(sender, recipients, 1))
+        .isInstanceOf(FlushToDiskRequest.class);
+  }
+
+  @Test
+  public void createFlushToDiskReturnsFlushToDisk() throws Exception {
+    assertThat(flushToDiskFactory.createFlushToDisk(cache)).isInstanceOf(FlushToDisk.class);
+  }
+
+  @Test
+  public void createResponseReturnsFlushToDiskResponse() {
+    assertThat(flushToDiskFactory.createResponse(member)).isInstanceOf(FlushToDiskResponse.class);
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskOperationTest.java
new file mode 100644
index 0000000..a79b43f
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskOperationTest.java
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.mockito.Mockito.*;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.InOrder;
+
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class FlushToDiskOperationTest {
+
+  private DM dm;
+  private InternalCache cache;
+  private Set<InternalDistributedMember> recipients;
+
+  private InternalDistributedMember sender;
+
+  private FlushToDiskFactory flushToDiskFactory;
+  private FlushToDiskProcessor flushToDiskReplyProcessor;
+  private FlushToDiskRequest flushToDiskRequest;
+  private FlushToDisk flushToDisk;
+
+  private FlushToDiskOperation flushToDiskOperation;
+
+  @Before
+  public void setUp() throws Exception {
+    dm = mock(DM.class);
+    cache = mock(InternalCache.class);
+
+    flushToDiskReplyProcessor = mock(FlushToDiskProcessor.class);
+    flushToDiskRequest = mock(FlushToDiskRequest.class);
+    flushToDisk = mock(FlushToDisk.class);
+
+    flushToDiskFactory = mock(FlushToDiskFactory.class);
+
+    sender = mock(InternalDistributedMember.class, "sender");
+    recipients = new HashSet<>();
+
+    flushToDiskOperation =
+        new FlushToDiskOperation(dm, sender, cache, recipients, flushToDiskFactory);
+
+    when(flushToDiskReplyProcessor.getProcessorId()).thenReturn(42);
+
+    when(flushToDiskFactory.createReplyProcessor(eq(dm), eq(recipients)))
+        .thenReturn(flushToDiskReplyProcessor);
+    when(flushToDiskFactory.createRequest(eq(sender), eq(recipients), eq(42)))
+        .thenReturn(flushToDiskRequest);
+    when(flushToDiskFactory.createFlushToDisk(eq(cache))).thenReturn(flushToDisk);
+  }
+
+  @Test
+  public void sendShouldSendFlushToDiskMessage() throws Exception {
+    flushToDiskOperation.send();
+
+    verify(dm, times(1)).putOutgoing(flushToDiskRequest);
+  }
+
+  @Test
+  public void sendShouldHandleCancelExceptionFromWaitForReplies() throws Exception {
+    ReplyException replyException =
+        new ReplyException("expected exception", new CacheClosedException("expected exception"));
+    doThrow(replyException).when(flushToDiskReplyProcessor).waitForReplies();
+    flushToDiskOperation.send();
+  }
+
+  @Test
+  public void sendShouldHandleInterruptedExceptionFromWaitForReplies() throws Exception {
+    doThrow(new InterruptedException("expected exception")).when(flushToDiskReplyProcessor)
+        .waitForReplies();
+    flushToDiskOperation.send();
+  }
+
+  @Test(expected = ReplyException.class)
+  public void sendShouldThrowReplyExceptionWithNoCauseFromWaitForReplies() throws Exception {
+    doThrow(new ReplyException("expected exception")).when(flushToDiskReplyProcessor)
+        .waitForReplies();
+    flushToDiskOperation.send();
+  }
+
+  @Test(expected = ReplyException.class)
+  public void sendShouldThrowReplyExceptionWithCauseThatIsNotACancelFromWaitForReplies()
+      throws Exception {
+    doThrow(new ReplyException("expected exception", new RuntimeException("expected")))
+        .when(flushToDiskReplyProcessor).waitForReplies();
+    flushToDiskOperation.send();
+  }
+
+  @Test
+  public void sendShouldProcessLocallyBeforeWaitingForReplies() throws Exception {
+    InOrder inOrder = inOrder(flushToDisk, flushToDiskReplyProcessor);
+    flushToDiskOperation.send();
+
+    inOrder.verify(flushToDisk, times(1)).run();
+    inOrder.verify(flushToDiskReplyProcessor, times(1)).waitForReplies();
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskRequestTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskRequestTest.java
new file mode 100644
index 0000000..113bb70
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/FlushToDiskRequestTest.java
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class FlushToDiskRequestTest {
+
+  private FlushToDiskRequest flushToDiskRequest;
+
+  private DM dm;
+  private Set<InternalDistributedMember> recipients;
+  private int msgId;
+  private FlushToDiskFactory flushToDiskFactory;
+  private InternalDistributedMember sender;
+  private InternalCache cache;
+  private FlushToDisk flushToDisk;
+
+  @Before
+  public void setUp() throws Exception {
+    dm = mock(DM.class);
+    sender = mock(InternalDistributedMember.class);
+    cache = mock(InternalCache.class);
+    flushToDiskFactory = mock(FlushToDiskFactory.class);
+    flushToDisk = mock(FlushToDisk.class);
+
+    msgId = 42;
+    recipients = new HashSet<>();
+
+    when(dm.getCache()).thenReturn(cache);
+    when(dm.getDistributionManagerId()).thenReturn(sender);
+    when(flushToDiskFactory.createFlushToDisk(eq(cache))).thenReturn(flushToDisk);
+    when(flushToDiskFactory.createResponse(eq(sender))).thenReturn(mock(FlushToDiskResponse.class));
+
+    flushToDiskRequest = new FlushToDiskRequest(sender, recipients, msgId, flushToDiskFactory);
+  }
+
+  @Test
+  public void usesFactoryToCreateFlushToDisk() throws Exception {
+    flushToDiskRequest.createResponse(dm);
+
+    verify(flushToDiskFactory, times(1)).createFlushToDisk(eq(cache));
+  }
+
+  @Test
+  public void usesFactoryToCreateResponse() throws Exception {
+    flushToDiskRequest.createResponse(dm);
+
+    verify(flushToDiskFactory, times(1)).createResponse(eq(sender));
+  }
+
+  @Test
+  public void returnsFlushToDiskResponse() throws Exception {
+    assertThat(flushToDiskRequest.createResponse(dm)).isInstanceOf(FlushToDiskResponse.class);
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/IncrementalBackupDistributedTest.java
similarity index 98%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/IncrementalBackupDistributedTest.java
index cc245f6..69b6478 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/IncrementalBackupDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/IncrementalBackupDistributedTest.java
@@ -12,10 +12,13 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache;
+package org.apache.geode.internal.cache.backup;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
+import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.BufferedReader;
 import java.io.File;
@@ -51,6 +54,8 @@ import org.apache.geode.distributed.DistributedSystem;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.internal.ClassPathLoader;
 import org.apache.geode.internal.DeployedJar;
+import org.apache.geode.internal.cache.DiskStoreImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.util.IOUtils;
 import org.apache.geode.internal.util.TransformUtils;
 import org.apache.geode.management.BackupStatus;
@@ -71,7 +76,7 @@ import org.apache.geode.test.junit.categories.DistributedTest;
  */
 @Category(DistributedTest.class)
 @SuppressWarnings("serial")
-public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
+public class IncrementalBackupDistributedTest extends JUnit4CacheTestCase {
   /**
    * Data load increment.
    */
@@ -124,7 +129,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
    * @param message a message to log.
    */
   private void log(String message) {
-    LogWriterUtils.getLogWriter().info("[IncrementalBackupDUnitTest] " + message);
+    LogWriterUtils.getLogWriter().info("[IncrementalBackupDistributedTest] " + message);
   }
 
   /**
@@ -354,7 +359,7 @@ public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
 
       @Override
       public String description() {
-        return "[IncrementalBackupDUnitTest] Waiting for missing member " + id;
+        return "[IncrementalBackupDistributedTest] Waiting for missing member " + id;
       }
     }, 10000, 500, false);
 
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PartitionedBackupPrepareAndFinishMsgDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PartitionedBackupPrepareAndFinishMsgDUnitTest.java
similarity index 85%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PartitionedBackupPrepareAndFinishMsgDUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/PartitionedBackupPrepareAndFinishMsgDUnitTest.java
index 4b42c21..b734286 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PartitionedBackupPrepareAndFinishMsgDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PartitionedBackupPrepareAndFinishMsgDUnitTest.java
@@ -12,17 +12,16 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionShortcut;
 
 public class PartitionedBackupPrepareAndFinishMsgDUnitTest
     extends BackupPrepareAndFinishMsgDUnitTest {
-  private static final RegionShortcut REGION_TYPE = RegionShortcut.PARTITION_PERSISTENT;
 
   @Override
   public Region<Integer, Integer> createRegion() {
-    return createRegion(REGION_TYPE);
+    return createRegion(RegionShortcut.PARTITION_PERSISTENT);
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupFactoryTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupFactoryTest.java
new file mode 100644
index 0000000..41431a3
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupFactoryTest.java
@@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class PrepareBackupFactoryTest {
+
+  private PrepareBackupFactory prepareBackupFactory;
+
+  private BackupResultCollector resultCollector;
+  private DM dm;
+  private InternalDistributedMember sender;
+  private Set<InternalDistributedMember> recipients;
+  private InternalDistributedMember member;
+  private InternalCache cache;
+
+  @Before
+  public void setUp() throws Exception {
+    resultCollector = mock(BackupResultCollector.class);
+    dm = mock(DM.class);
+    sender = mock(InternalDistributedMember.class);
+    member = mock(InternalDistributedMember.class);
+    cache = mock(InternalCache.class);
+
+    recipients = new HashSet<>();
+
+    when(dm.getSystem()).thenReturn(mock(InternalDistributedSystem.class));
+    when(dm.getCancelCriterion()).thenReturn(mock(CancelCriterion.class));
+
+    prepareBackupFactory = new PrepareBackupFactory();
+  }
+
+  @Test
+  public void createReplyProcessorReturnsBackupReplyProcessor() throws Exception {
+    assertThat(prepareBackupFactory.createReplyProcessor(resultCollector, dm, recipients))
+        .isInstanceOf(BackupReplyProcessor.class);
+  }
+
+  @Test
+  public void createRequestReturnsPrepareBackupRequest() throws Exception {
+    assertThat(prepareBackupFactory.createRequest(sender, recipients, 1))
+        .isInstanceOf(PrepareBackupRequest.class);
+  }
+
+  @Test
+  public void createPrepareBackupReturnsPrepareBackup() throws Exception {
+    assertThat(prepareBackupFactory.createPrepareBackup(member, cache))
+        .isInstanceOf(PrepareBackup.class);
+  }
+
+  @Test
+  public void createBackupResponseReturnsBackupResponse() {
+    assertThat(prepareBackupFactory.createBackupResponse(member, null))
+        .isInstanceOf(BackupResponse.class);
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupOperationTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupOperationTest.java
new file mode 100644
index 0000000..2e4246a
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupOperationTest.java
@@ -0,0 +1,232 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.InOrder;
+import org.mockito.stubbing.Answer;
+
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.ReplyException;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class PrepareBackupOperationTest {
+
+  private DM dm;
+  private InternalCache cache;
+  private Set<InternalDistributedMember> recipients;
+
+  private InternalDistributedMember sender;
+  private InternalDistributedMember member1;
+  private InternalDistributedMember member2;
+
+  private PrepareBackupFactory prepareBackupFactory;
+  private BackupReplyProcessor prepareBackupReplyProcessor;
+  private PrepareBackupRequest prepareBackupRequest;
+  private PrepareBackup prepareBackup;
+
+  private PrepareBackupOperation prepareBackupOperation;
+
+  @Before
+  public void setUp() throws Exception {
+    dm = mock(DM.class);
+    cache = mock(InternalCache.class);
+
+    prepareBackupReplyProcessor = mock(BackupReplyProcessor.class);
+    prepareBackupRequest = mock(PrepareBackupRequest.class);
+    prepareBackup = mock(PrepareBackup.class);
+
+    prepareBackupFactory = mock(PrepareBackupFactory.class);
+
+    sender = mock(InternalDistributedMember.class, "sender");
+    member1 = mock(InternalDistributedMember.class, "member1");
+    member2 = mock(InternalDistributedMember.class, "member2");
+    recipients = new HashSet<>();
+
+    prepareBackupOperation =
+        new PrepareBackupOperation(dm, sender, cache, recipients, prepareBackupFactory);
+
+    when(prepareBackupReplyProcessor.getProcessorId()).thenReturn(42);
+
+    when(prepareBackupFactory.createReplyProcessor(eq(prepareBackupOperation), eq(dm),
+        eq(recipients))).thenReturn(prepareBackupReplyProcessor);
+    when(prepareBackupFactory.createRequest(eq(sender), eq(recipients), eq(42)))
+        .thenReturn(prepareBackupRequest);
+    when(prepareBackupFactory.createPrepareBackup(eq(sender), eq(cache))).thenReturn(prepareBackup);
+  }
+
+  @Test
+  public void sendShouldSendPrepareBackupMessage() throws Exception {
+    prepareBackupOperation.send();
+
+    verify(dm, times(1)).putOutgoing(prepareBackupRequest);
+  }
+
+  @Test
+  public void sendReturnsResultsForRemoteRecipient() throws Exception {
+    HashSet<PersistentID> persistentIdsForMember1 = new HashSet<>();
+    persistentIdsForMember1.add(mock(PersistentID.class));
+    doAnswer(invokeAddToResults(new MemberWithPersistentIds(member1, persistentIdsForMember1)))
+        .when(prepareBackupReplyProcessor).waitForReplies();
+
+    assertThat(prepareBackupOperation.send()).containsOnlyKeys(member1)
+        .containsValues(persistentIdsForMember1);
+  }
+
+  @Test
+  public void sendReturnsResultsForLocalMember() throws Exception {
+    HashSet<PersistentID> persistentIdsForSender = new HashSet<>();
+    persistentIdsForSender.add(mock(PersistentID.class));
+    when(prepareBackup.run()).thenReturn(persistentIdsForSender);
+
+    assertThat(prepareBackupOperation.send()).containsOnlyKeys(sender)
+        .containsValue(persistentIdsForSender);
+  }
+
+  @Test
+  public void sendReturnsResultsForAllMembers() throws Exception {
+    HashSet<PersistentID> persistentIdsForMember1 = new HashSet<>();
+    persistentIdsForMember1.add(mock(PersistentID.class));
+
+    HashSet<PersistentID> persistentIdsForMember2 = new HashSet<>();
+    persistentIdsForMember2.add(mock(PersistentID.class));
+
+    MemberWithPersistentIds[] ids = new MemberWithPersistentIds[] {
+        new MemberWithPersistentIds(member1, persistentIdsForMember1),
+        new MemberWithPersistentIds(member2, persistentIdsForMember2)};
+
+    doAnswer(invokeAddToResults(ids)).when(prepareBackupReplyProcessor).waitForReplies();
+
+    // prepareBackupOperation.addToResults(ids[0].member, ids[0].persistentIds);
+    // prepareBackupOperation.addToResults(ids[1].member, ids[1].persistentIds);
+
+    HashSet<PersistentID> persistentIdsForSender = new HashSet<>();
+    persistentIdsForSender.add(mock(PersistentID.class));
+    when(prepareBackup.run()).thenReturn(persistentIdsForSender);
+
+    assertThat(prepareBackupOperation.send()).containsOnlyKeys(member1, member2, sender)
+        .containsValues(persistentIdsForSender, persistentIdsForMember1, persistentIdsForMember2);
+  }
+
+  @Test
+  public void getResultsShouldReturnEmptyMapByDefault() throws Exception {
+    assertThat(prepareBackupOperation.getResults()).isEmpty();
+  }
+
+  @Test
+  public void addToResultsWithNullShouldBeNoop() throws Exception {
+    prepareBackupOperation.addToResults(member1, null);
+    assertThat(prepareBackupOperation.getResults()).isEmpty();
+  }
+
+  @Test
+  public void addToResultsWithEmptySetShouldBeNoop() throws Exception {
+    prepareBackupOperation.addToResults(member1, new HashSet<>());
+    assertThat(prepareBackupOperation.getResults()).isEmpty();
+  }
+
+  @Test
+  public void addToResultsShouldShowUpInGetResults() throws Exception {
+    HashSet<PersistentID> persistentIdsForMember1 = new HashSet<>();
+    persistentIdsForMember1.add(mock(PersistentID.class));
+    prepareBackupOperation.addToResults(member1, persistentIdsForMember1);
+    assertThat(prepareBackupOperation.getResults()).containsOnlyKeys(member1)
+        .containsValue(persistentIdsForMember1);
+  }
+
+  @Test
+  public void sendShouldHandleIOExceptionThrownFromRun() throws Exception {
+    when(prepareBackup.run()).thenThrow(new IOException("expected exception"));
+    prepareBackupOperation.send();
+  }
+
+  @Test(expected = RuntimeException.class)
+  public void sendShouldThrowNonIOExceptionThrownFromRun() throws Exception {
+    when(prepareBackup.run()).thenThrow(new RuntimeException("expected exception"));
+    prepareBackupOperation.send();
+  }
+
+  @Test
+  public void sendShouldHandleCancelExceptionFromWaitForReplies() throws Exception {
+    ReplyException replyException =
+        new ReplyException("expected exception", new CacheClosedException("expected exception"));
+    doThrow(replyException).when(prepareBackupReplyProcessor).waitForReplies();
+    prepareBackupOperation.send();
+  }
+
+  @Test
+  public void sendShouldHandleInterruptedExceptionFromWaitForReplies() throws Exception {
+    doThrow(new InterruptedException("expected exception")).when(prepareBackupReplyProcessor)
+        .waitForReplies();
+    prepareBackupOperation.send();
+  }
+
+  @Test(expected = ReplyException.class)
+  public void sendShouldThrowReplyExceptionWithNoCauseFromWaitForReplies() throws Exception {
+    doThrow(new ReplyException("expected exception")).when(prepareBackupReplyProcessor)
+        .waitForReplies();
+    prepareBackupOperation.send();
+  }
+
+  @Test(expected = ReplyException.class)
+  public void sendShouldThrowReplyExceptionWithCauseThatIsNotACancelFromWaitForReplies()
+      throws Exception {
+    doThrow(new ReplyException("expected exception", new RuntimeException("expected")))
+        .when(prepareBackupReplyProcessor).waitForReplies();
+    prepareBackupOperation.send();
+  }
+
+  @Test
+  public void sendShouldPrepareForBackupInLocalMemberBeforeWaitingForReplies() throws Exception {
+    InOrder inOrder = inOrder(prepareBackup, prepareBackupReplyProcessor);
+    prepareBackupOperation.send();
+
+    inOrder.verify(prepareBackup, times(1)).run();
+    inOrder.verify(prepareBackupReplyProcessor, times(1)).waitForReplies();
+  }
+
+  private Answer<Object> invokeAddToResults(MemberWithPersistentIds... memberWithPersistentIds) {
+    return invocation -> {
+      for (MemberWithPersistentIds ids : memberWithPersistentIds) {
+        prepareBackupOperation.addToResults(ids.member, ids.persistentIds);
+      }
+      return null;
+    };
+  }
+
+  private static class MemberWithPersistentIds {
+    InternalDistributedMember member;
+    HashSet<PersistentID> persistentIds;
+
+    MemberWithPersistentIds(InternalDistributedMember member, HashSet<PersistentID> persistentIds) {
+      this.member = member;
+      this.persistentIds = persistentIds;
+    }
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupRequestTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupRequestTest.java
new file mode 100644
index 0000000..f1700bc
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/PrepareBackupRequestTest.java
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.backup;
+
+import static org.assertj.core.api.Assertions.*;
+import static org.mockito.Mockito.*;
+
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.persistence.PersistentID;
+import org.apache.geode.distributed.internal.DM;
+import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
+import org.apache.geode.internal.admin.remote.AdminFailureResponse;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class PrepareBackupRequestTest {
+
+  private PrepareBackupRequest prepareBackupRequest;
+
+  private DM dm;
+  private Set<InternalDistributedMember> recipients;
+  private int msgId;
+  private PrepareBackupFactory prepareBackupFactory;
+  private InternalDistributedMember sender;
+  private InternalCache cache;
+  private HashSet<PersistentID> persistentIds;
+  private PrepareBackup prepareBackup;
+
+  @Before
+  public void setUp() throws Exception {
+    dm = mock(DM.class);
+    sender = mock(InternalDistributedMember.class);
+    cache = mock(InternalCache.class);
+    prepareBackupFactory = mock(PrepareBackupFactory.class);
+    prepareBackup = mock(PrepareBackup.class);
+
+    msgId = 42;
+    recipients = new HashSet<>();
+    persistentIds = new HashSet<>();
+
+    when(dm.getCache()).thenReturn(cache);
+    when(dm.getDistributionManagerId()).thenReturn(sender);
+    when(prepareBackupFactory.createPrepareBackup(eq(sender), eq(cache))).thenReturn(prepareBackup);
+    when(prepareBackupFactory.createBackupResponse(eq(sender), eq(persistentIds)))
+        .thenReturn(mock(BackupResponse.class));
+    when(prepareBackup.run()).thenReturn(persistentIds);
+
+    prepareBackupRequest =
+        new PrepareBackupRequest(sender, recipients, msgId, prepareBackupFactory);
+  }
+
+  @Test
+  public void usesFactoryToCreatePrepareBackup() throws Exception {
+    prepareBackupRequest.createResponse(dm);
+
+    verify(prepareBackupFactory, times(1)).createPrepareBackup(eq(sender), eq(cache));
+  }
+
+  @Test
+  public void usesFactoryToCreateBackupResponse() throws Exception {
+    prepareBackupRequest.createResponse(dm);
+
+    verify(prepareBackupFactory, times(1)).createBackupResponse(eq(sender), eq(persistentIds));
+  }
+
+  @Test
+  public void returnsBackupResponse() throws Exception {
+    assertThat(prepareBackupRequest.createResponse(dm)).isInstanceOf(BackupResponse.class);
+  }
+
+  @Test
+  public void returnsAdminFailureResponseWhenPrepareBackupThrowsIOException() throws Exception {
+    when(prepareBackup.run()).thenThrow(new IOException());
+
+    assertThat(prepareBackupRequest.createResponse(dm)).isInstanceOf(AdminFailureResponse.class);
+  }
+
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/ReplicateBackupPrepareAndFinishMsgDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/ReplicateBackupPrepareAndFinishMsgDUnitTest.java
similarity index 85%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/persistence/ReplicateBackupPrepareAndFinishMsgDUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/ReplicateBackupPrepareAndFinishMsgDUnitTest.java
index 3f0ba7d..aa097c1 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/ReplicateBackupPrepareAndFinishMsgDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/ReplicateBackupPrepareAndFinishMsgDUnitTest.java
@@ -12,17 +12,16 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionShortcut;
 
 public class ReplicateBackupPrepareAndFinishMsgDUnitTest
     extends BackupPrepareAndFinishMsgDUnitTest {
-  private static final RegionShortcut REGION_TYPE = RegionShortcut.REPLICATE_PERSISTENT;
 
   @Override
   public Region<Integer, Integer> createRegion() {
-    return createRegion(REGION_TYPE);
+    return createRegion(RegionShortcut.REPLICATE_PERSISTENT);
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/UnixScriptGeneratorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/UnixScriptGeneratorTest.java
similarity index 98%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/persistence/UnixScriptGeneratorTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/UnixScriptGeneratorTest.java
index b665b64..1b13cbf 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/UnixScriptGeneratorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/UnixScriptGeneratorTest.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/WindowsScriptGeneratorTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/WindowsScriptGeneratorTest.java
similarity index 98%
rename from geode-core/src/test/java/org/apache/geode/internal/cache/persistence/WindowsScriptGeneratorTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/cache/backup/WindowsScriptGeneratorTest.java
index fba97bc..59abacf 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/WindowsScriptGeneratorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/backup/WindowsScriptGeneratorTest.java
@@ -12,7 +12,7 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.internal.cache.persistence;
+package org.apache.geode.internal.cache.backup;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/extension/ExtensionClusterConfigurationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/extension/ExtensionClusterConfigurationDUnitTest.java
index 8fb5feb..8cfd624 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/extension/ExtensionClusterConfigurationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/extension/ExtensionClusterConfigurationDUnitTest.java
@@ -38,7 +38,7 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category({DistributedTest.class})
 @SuppressWarnings("serial")
@@ -48,7 +48,7 @@ public class ExtensionClusterConfigurationDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private static final String REPLICATE_REGION = "ReplicateRegion1";
 
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java
index 2d15649..65110ff 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ha/Bug48571DUnitTest.java
@@ -82,11 +82,11 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
   @Override
   public final void preTearDown() throws Exception {
     reset();
-    server.invoke(() -> Bug48571DUnitTest.reset());
-    client.invoke(() -> Bug48571DUnitTest.reset());
+    server.invoke(Bug48571DUnitTest::reset);
+    client.invoke(Bug48571DUnitTest::reset);
   }
 
-  public static void reset() throws Exception {
+  private static void reset() {
     lastKeyReceived = false;
     numOfCreates = 0;
     numOfUpdates = 0;
@@ -97,49 +97,47 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
     }
   }
 
-  private static void verifyProxyHasBeenPaused() {
-    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
-      CacheClientNotifier ccn = CacheClientNotifier.getInstance();
-      Collection<CacheClientProxy> ccProxies = ccn.getClientProxies();
-      boolean pausedFlag = false;
-      Iterator<CacheClientProxy> itr = ccProxies.iterator();
-
-      while (itr.hasNext()) {
-        CacheClientProxy ccp = itr.next();
-        System.out.println("proxy status " + ccp.getState());
-        if (ccp.isPaused()) {
-          pausedFlag = true;
-          break;
-        }
-      }
-      assertEquals("Proxy has not been paused in 1 minute", true, pausedFlag);
-    });
-  }
-
   @Test
   public void testStatsMatchWithSize() throws Exception {
     IgnoredException.addIgnoredException("Unexpected IOException||Connection reset");
     // start a server
-    int port = (Integer) server.invoke(() -> Bug48571DUnitTest.createServerCache());
+    int port = server.invoke(Bug48571DUnitTest::createServerCache);
     // create durable client, with durable RI
     client.invoke(() -> Bug48571DUnitTest.createClientCache(client.getHost(), port));
     // do puts on server from three different threads, pause after 500 puts each.
-    server.invoke(() -> Bug48571DUnitTest.doPuts());
+    server.invoke(Bug48571DUnitTest::doPuts);
     // close durable client
-    client.invoke(() -> Bug48571DUnitTest.closeClientCache());
+    client.invoke(Bug48571DUnitTest::closeClientCache);
 
-    server.invoke("verifyProxyHasBeenPaused", () -> verifyProxyHasBeenPaused());
+    server.invoke("verifyProxyHasBeenPaused", Bug48571DUnitTest::verifyProxyHasBeenPaused);
     // resume puts on server, add another 100.
-    server.invoke(() -> Bug48571DUnitTest.resumePuts());
+    server.invoke(Bug48571DUnitTest::resumePuts);
     // start durable client
     client.invoke(() -> Bug48571DUnitTest.createClientCache(client.getHost(), port));
     // wait for full queue dispatch
-    client.invoke(() -> Bug48571DUnitTest.waitForLastKey());
+    client.invoke(Bug48571DUnitTest::waitForLastKey);
     // verify the stats
-    server.invoke(() -> Bug48571DUnitTest.verifyStats());
+    server.invoke(Bug48571DUnitTest::verifyStats);
   }
 
-  public static int createServerCache() throws Exception {
+  private static void verifyProxyHasBeenPaused() {
+    Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
+      CacheClientNotifier ccn = CacheClientNotifier.getInstance();
+      Collection<CacheClientProxy> ccProxies = ccn.getClientProxies();
+      boolean pausedFlag = false;
+
+      for (CacheClientProxy ccp : ccProxies) {
+        System.out.println("proxy status " + ccp.getState());
+        if (ccp.isPaused()) {
+          pausedFlag = true;
+          break;
+        }
+      }
+      assertEquals("Proxy has not been paused in 1 minute", true, pausedFlag);
+    });
+  }
+
+  private static int createServerCache() throws Exception {
     Properties props = new Properties();
     props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
     props.setProperty(LOG_FILE, "server_" + OSProcess.getId() + ".log");
@@ -163,11 +161,11 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
     return server1.getPort();
   }
 
-  public static void closeClientCache() throws Exception {
+  private static void closeClientCache() {
     cache.close(true);
   }
 
-  public static void createClientCache(Host host, Integer port) throws Exception {
+  private static void createClientCache(Host host, Integer port) {
 
     Properties props = new Properties();
     props.setProperty(MCAST_PORT, "0");
@@ -203,7 +201,7 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
       }
 
       public void afterCreate(EntryEvent<String, String> event) {
-        if (((String) event.getKey()).equals("last_key")) {
+        if (event.getKey().equals("last_key")) {
           lastKeyReceived = true;
         }
         cache.getLoggerI18n().fine("Create Event: " + event.getKey() + ", " + event.getNewValue());
@@ -221,27 +219,21 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
     cache.readyForEvents();
   }
 
-  public static void doPuts() throws Exception {
+  private static void doPuts() throws Exception {
     final Region<String, String> r = cache.getRegion(region);
-    Thread t1 = new Thread(new Runnable() {
-      public void run() {
-        for (int i = 0; i < 500; i++) {
-          r.put("T1_KEY_" + i, "VALUE_" + i);
-        }
+    Thread t1 = new Thread(() -> {
+      for (int i = 0; i < 500; i++) {
+        r.put("T1_KEY_" + i, "VALUE_" + i);
       }
     });
-    Thread t2 = new Thread(new Runnable() {
-      public void run() {
-        for (int i = 0; i < 500; i++) {
-          r.put("T2_KEY_" + i, "VALUE_" + i);
-        }
+    Thread t2 = new Thread(() -> {
+      for (int i = 0; i < 500; i++) {
+        r.put("T2_KEY_" + i, "VALUE_" + i);
       }
     });
-    Thread t3 = new Thread(new Runnable() {
-      public void run() {
-        for (int i = 0; i < 500; i++) {
-          r.put("T3_KEY_" + i, "VALUE_" + i);
-        }
+    Thread t3 = new Thread(() -> {
+      for (int i = 0; i < 500; i++) {
+        r.put("T3_KEY_" + i, "VALUE_" + i);
       }
     });
 
@@ -254,7 +246,7 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
     t3.join();
   }
 
-  public static void resumePuts() {
+  private static void resumePuts() {
     Region<String, String> r = cache.getRegion(region);
     for (int i = 0; i < 100; i++) {
       r.put("NEWKEY_" + i, "NEWVALUE_" + i);
@@ -262,7 +254,7 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
     r.put("last_key", "last_value");
   }
 
-  public static void waitForLastKey() {
+  private static void waitForLastKey() {
     WaitCriterion wc = new WaitCriterion() {
       @Override
       public boolean done() {
@@ -277,7 +269,7 @@ public class Bug48571DUnitTest extends JUnit4DistributedTestCase {
     Wait.waitForCriterion(wc, 60 * 1000, 500, true);
   }
 
-  public static void verifyStats() throws Exception {
+  private static void verifyStats() {
     Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
       CacheClientNotifier ccn = CacheClientNotifier.getInstance();
       CacheClientProxy ccp = ccn.getClientProxies().iterator().next();
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistPRKRFDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistPRKRFDUnitTest.java
index edc068f..e8fb004 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistPRKRFDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistPRKRFDUnitTest.java
@@ -21,6 +21,7 @@ import java.util.Properties;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheClosedException;
 import org.apache.geode.cache.CacheException;
 import org.apache.geode.cache.Declarable;
@@ -28,16 +29,17 @@ import org.apache.geode.cache.EntryEvent;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.util.CacheWriterAdapter;
 import org.apache.geode.cache30.CacheSerializableRunnable;
+import org.apache.geode.internal.cache.DiskRegion;
 import org.apache.geode.internal.cache.DiskStoreImpl;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.IgnoredException;
+import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.ThreadUtils;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.Wait;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
 import org.apache.geode.test.junit.categories.DistributedTest;
 
 /**
@@ -66,7 +68,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
     createData(vm0, 0, 10, "a");
     vm0.invoke(new CacheSerializableRunnable(title + "server add writer") {
       public void run2() throws CacheException {
-        Region region = getRootRegion(PR_REGION_NAME);
+        Region region = getRootRegion(getPartitionedRegionName());
         // let the region to hold on the put until diskstore is closed
         if (!DiskStoreImpl.KRF_DEBUG) {
           region.getAttributesMutator().setCacheWriter(new MyWriter());
@@ -77,7 +79,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
     // create test
     AsyncInvocation async1 = vm0.invokeAsync(new CacheSerializableRunnable(title + "async create") {
       public void run2() throws CacheException {
-        Region region = getRootRegion(PR_REGION_NAME);
+        Region region = getRootRegion(getPartitionedRegionName());
         IgnoredException expect = IgnoredException.addIgnoredException("CacheClosedException");
         try {
           region.put(10, "b");
@@ -111,7 +113,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
     createPR(vm0, 0);
     vm0.invoke(new CacheSerializableRunnable(title + "server add writer") {
       public void run2() throws CacheException {
-        Region region = getRootRegion(PR_REGION_NAME);
+        Region region = getRootRegion(getPartitionedRegionName());
         // let the region to hold on the put until diskstore is closed
         if (!DiskStoreImpl.KRF_DEBUG) {
           region.getAttributesMutator().setCacheWriter(new MyWriter());
@@ -120,7 +122,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
     });
     async1 = vm0.invokeAsync(new CacheSerializableRunnable(title + "async update") {
       public void run2() throws CacheException {
-        Region region = getRootRegion(PR_REGION_NAME);
+        Region region = getRootRegion(getPartitionedRegionName());
         IgnoredException expect = IgnoredException.addIgnoredException("CacheClosedException");
         try {
           region.put(1, "b");
@@ -154,7 +156,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
     createPR(vm0, 0);
     vm0.invoke(new CacheSerializableRunnable(title + "server add writer") {
       public void run2() throws CacheException {
-        Region region = getRootRegion(PR_REGION_NAME);
+        Region region = getRootRegion(getPartitionedRegionName());
         // let the region to hold on the put until diskstore is closed
         if (!DiskStoreImpl.KRF_DEBUG) {
           region.getAttributesMutator().setCacheWriter(new MyWriter());
@@ -163,7 +165,7 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
     });
     async1 = vm0.invokeAsync(new CacheSerializableRunnable(title + "async destroy") {
       public void run2() throws CacheException {
-        Region region = getRootRegion(PR_REGION_NAME);
+        Region region = getRootRegion(getPartitionedRegionName());
         IgnoredException expect = IgnoredException.addIgnoredException("CacheClosedException");
         try {
           region.destroy(2, "b");
@@ -197,6 +199,24 @@ public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
     closeCache(vm0);
   }
 
+  void checkRecoveredFromDisk(VM vm, final int bucketId, final boolean recoveredLocally) {
+    vm.invoke(new SerializableRunnable("check recovered from disk") {
+      @Override
+      public void run() {
+        Cache cache = getCache();
+        PartitionedRegion region = (PartitionedRegion) cache.getRegion(getPartitionedRegionName());
+        DiskRegion disk = region.getRegionAdvisor().getBucket(bucketId).getDiskRegion();
+        if (recoveredLocally) {
+          assertEquals(0, disk.getStats().getRemoteInitializations());
+          assertEquals(1, disk.getStats().getLocalInitializations());
+        } else {
+          assertEquals(1, disk.getStats().getRemoteInitializations());
+          assertEquals(0, disk.getStats().getLocalInitializations());
+        }
+      }
+    });
+  }
+
   private static class MyWriter extends CacheWriterAdapter implements Declarable {
     public MyWriter() {}
 
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
index c526fc2..d66bb84 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
@@ -64,6 +64,7 @@ import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionMessageObserver;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 import org.apache.geode.internal.cache.ColocationLogger;
+import org.apache.geode.internal.cache.DiskRegion;
 import org.apache.geode.internal.cache.InitialImageOperation.RequestImageMessage;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionHelper;
@@ -192,9 +193,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
 
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setPartitionAttributes(paf.create());
         cache.createRegion("region2", af.create());
         paf.setColocatedWith("region2");
@@ -212,13 +213,13 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
     createData(vm0, 0, NUM_BUCKETS, "c", "region3");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
     assertEquals(vm0Buckets, getBucketList(vm0, "region3"));
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1Buckets, getBucketList(vm1, "region2"));
     assertEquals(vm1Buckets, getBucketList(vm1, "region3"));
-    Set<Integer> vm2Buckets = getBucketList(vm2, PR_REGION_NAME);
+    Set<Integer> vm2Buckets = getBucketList(vm2, getPartitionedRegionName());
     assertEquals(vm2Buckets, getBucketList(vm2, "region2"));
     assertEquals(vm2Buckets, getBucketList(vm2, "region3"));
 
@@ -236,9 +237,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
 
     // The secondary buckets can be recovered asynchronously,
     // so wait for them to come back.
-    waitForBuckets(vm0, vm0Buckets, PR_REGION_NAME);
+    waitForBuckets(vm0, vm0Buckets, getPartitionedRegionName());
     waitForBuckets(vm0, vm0Buckets, "region2");
-    waitForBuckets(vm1, vm1Buckets, PR_REGION_NAME);
+    waitForBuckets(vm1, vm1Buckets, getPartitionedRegionName());
     waitForBuckets(vm1, vm1Buckets, "region2");
 
     checkData(vm0, 0, NUM_BUCKETS, "a");
@@ -294,8 +295,8 @@ public class PersistentColocatedPartitionedRegionDUnitTest
   private SerializableRunnable createPRsColocatedPairThread =
       new SerializableRunnable("create2PRs") {
         public void run() {
-          createPR(PR_REGION_NAME, true);
-          createPR("region2", PR_REGION_NAME, true);
+          createPR(getPartitionedRegionName(), true);
+          createPR("region2", getPartitionedRegionName(), true);
         }
       };
 
@@ -303,9 +304,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
       new SerializableRunnable("create multiple child PRs") {
         @Override
         public void run() throws Exception {
-          createPR(PR_REGION_NAME, true);
+          createPR(getPartitionedRegionName(), true);
           for (int i = 2; i < numChildPRs + 2; ++i) {
-            createPR("region" + i, PR_REGION_NAME, true);
+            createPR("region" + i, getPartitionedRegionName(), true);
           }
         }
       };
@@ -314,8 +315,8 @@ public class PersistentColocatedPartitionedRegionDUnitTest
       new SerializableRunnable("create PR colocation hierarchy") {
         @Override
         public void run() throws Exception {
-          createPR(PR_REGION_NAME, true);
-          createPR("region2", PR_REGION_NAME, true);
+          createPR(getPartitionedRegionName(), true);
+          createPR("region2", getPartitionedRegionName(), true);
           for (int i = 3; i < numChildPRGenerations + 2; ++i) {
             createPR("region" + i, "region" + (i - 1), true);
           }
@@ -330,7 +331,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           try {
             // Skip creation of first region - expect region2 creation to fail
             // createPR(PR_REGION_NAME, true);
-            createPR("region2", PR_REGION_NAME, true);
+            createPR("region2", getPartitionedRegionName(), true);
           } catch (Exception e) {
             ex = e;
             exClass = e.getClass().toString();
@@ -362,7 +363,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           try {
             // Skip creation of first region - expect region2 creation to fail
             // createPR(PR_REGION_NAME, true);
-            createPR("region2", PR_REGION_NAME, true);
+            createPR("region2", getPartitionedRegionName(), true);
           } catch (Exception e) {
             ex = e;
             exClass = e.getClass().toString();
@@ -394,7 +395,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
 
           AtomicBoolean isDone = new AtomicBoolean(false);
           try {
-            createPR(PR_REGION_NAME, true);
+            createPR(getPartitionedRegionName(), true);
             // Let this thread continue running long enough for the missing region to be logged a
             // couple times.
             // Child regions do not get created by this thread.
@@ -437,14 +438,14 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           List<LogEvent> logEvents = Collections.emptyList();
 
           try {
-            createPR(PR_REGION_NAME, true);
+            createPR(getPartitionedRegionName(), true);
             // Delay creation of second (i.e child) region to see missing colocated region log
             // message (logInterval/2 < delay < logInterval)
             await().atMost(MAX_WAIT, TimeUnit.MILLISECONDS).until(() -> {
               verify(mockAppender, times(1)).append(loggingEventCaptor.capture());
             });
             logEvents = loggingEventCaptor.getAllValues();
-            createPR("region2", PR_REGION_NAME, true);
+            createPR("region2", getPartitionedRegionName(), true);
             // Another delay before exiting the thread to make sure that missing region logging
             // doesn't continue after missing region is created (delay > logInterval)
             await().atMost(logInterval * 2, TimeUnit.MILLISECONDS).until(() -> {
@@ -485,13 +486,13 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           List<LogEvent> logEvents = Collections.emptyList();
           int numLogEvents = 0;
 
-          createPR(PR_REGION_NAME, true);
+          createPR(getPartitionedRegionName(), true);
           // Delay creation of child generation regions to see missing colocated region log message
           // parent region is generation 1, child region is generation 2, grandchild is 3, etc.
           for (int generation = 2; generation < (numChildPRGenerations + 2); ++generation) {
             String childPRName = "region" + generation;
             String colocatedWithRegionName =
-                generation == 2 ? PR_REGION_NAME : "region" + (generation - 1);
+                generation == 2 ? getPartitionedRegionName() : "region" + (generation - 1);
             loggingEventCaptor = ArgumentCaptor.forClass(LogEvent.class);
 
             // delay between starting generations of child regions until the expected missing
@@ -551,7 +552,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           List<LogEvent> logEvents = Collections.emptyList();
           int numLogEvents = 0;
 
-          createPR(PR_REGION_NAME, true);
+          createPR(getPartitionedRegionName(), true);
           // Delay creation of child generation regions to see missing colocated region log message
           for (int regionNum = 2; regionNum < (numChildPRs + 2); ++regionNum) {
             String childPRName = "region" + regionNum;
@@ -570,7 +571,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
             assertEquals("Expected warning messages to be logged.", regionNum - 1, numLogEvents);
 
             // Start the child region
-            createPR(childPRName, PR_REGION_NAME, true);
+            createPR(childPRName, getPartitionedRegionName(), true);
           }
           String logMsg = "";
           logEvents = loggingEventCaptor.getAllValues();
@@ -616,8 +617,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           List<LogEvent> logEvents = Collections.emptyList();
 
           try {
-            createPR(PR_REGION_NAME, true);
-            createPR("region2", PR_REGION_NAME, true); // This child region is never created
+            createPR(getPartitionedRegionName(), true);
+            createPR("region2", getPartitionedRegionName(), true); // This child region is never
+                                                                   // created
             // Let this thread continue running long enough for the missing region to be logged a
             // couple times.
             // Grandchild region does not get created by this thread. (1.5*logInterval < delay <
@@ -640,6 +642,24 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         }
       };
 
+  void checkRecoveredFromDisk(VM vm, final int bucketId, final boolean recoveredLocally) {
+    vm.invoke(new SerializableRunnable("check recovered from disk") {
+      @Override
+      public void run() {
+        Cache cache = getCache();
+        PartitionedRegion region = (PartitionedRegion) cache.getRegion(getPartitionedRegionName());
+        DiskRegion disk = region.getRegionAdvisor().getBucket(bucketId).getDiskRegion();
+        if (recoveredLocally) {
+          assertEquals(0, disk.getStats().getRemoteInitializations());
+          assertEquals(1, disk.getStats().getLocalInitializations());
+        } else {
+          assertEquals(1, disk.getStats().getRemoteInitializations());
+          assertEquals(0, disk.getStats().getLocalInitializations());
+        }
+      }
+    });
+  }
+
   private class ColocationLoggerIntervalSetter extends SerializableRunnable {
     private int logInterval;
 
@@ -742,10 +762,10 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "a");
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertFalse(vm0Buckets.isEmpty());
     assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1Buckets, getBucketList(vm1, "region2"));
 
     closeCache(vm0);
@@ -778,10 +798,10 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "a");
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertFalse(vm0Buckets.isEmpty());
     assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1Buckets, getBucketList(vm1, "region2"));
 
     closeCache(vm0);
@@ -836,10 +856,10 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "a");
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertFalse(vm0Buckets.isEmpty());
     assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1Buckets, getBucketList(vm1, "region2"));
 
     closeCache(vm0);
@@ -881,10 +901,10 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "a");
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertFalse(vm0Buckets.isEmpty());
     assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1Buckets, getBucketList(vm1, "region2"));
 
     closeCache(vm0);
@@ -931,9 +951,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
     createData(vm0, 0, NUM_BUCKETS, "c", "region2");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertFalse(vm0Buckets.isEmpty());
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertFalse(vm1Buckets.isEmpty());
     for (int i = 2; i < numChildPRs + 2; ++i) {
       String childName = "region" + i;
@@ -986,9 +1006,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
     createData(vm0, 0, NUM_BUCKETS, "c", "region2");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertFalse(vm0Buckets.isEmpty());
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertFalse(vm1Buckets.isEmpty());
     for (int i = 2; i < numChildPRs + 2; ++i) {
       String childName = "region" + i;
@@ -1041,9 +1061,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
     createData(vm0, 0, NUM_BUCKETS, "c", "region3");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertFalse(vm0Buckets.isEmpty());
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertFalse(vm1Buckets.isEmpty());
     for (int i = 2; i < numChildGenerations + 2; ++i) {
       String childName = "region" + i;
@@ -1096,9 +1116,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
     createData(vm0, 0, NUM_BUCKETS, "c", "region3");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertFalse(vm0Buckets.isEmpty());
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertFalse(vm1Buckets.isEmpty());
     for (int i = 2; i < numChildGenerations + 2; ++i) {
       String childName = "region" + i;
@@ -1332,7 +1352,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
       }
     };
     SerializableRunnable createChildPR = getCreateChildPRRunnable();
@@ -1346,18 +1366,18 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "a");
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1Buckets, getBucketList(vm1, "region2"));
-    Set<Integer> vm2Buckets = getBucketList(vm2, PR_REGION_NAME);
+    Set<Integer> vm2Buckets = getBucketList(vm2, getPartitionedRegionName());
     assertEquals(vm2Buckets, getBucketList(vm2, "region2"));
 
-    Set<Integer> vm0PrimaryBuckets = getPrimaryBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0PrimaryBuckets = getPrimaryBucketList(vm0, getPartitionedRegionName());
     assertEquals(vm0PrimaryBuckets, getPrimaryBucketList(vm0, "region2"));
-    Set<Integer> vm1PrimaryBuckets = getPrimaryBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1PrimaryBuckets = getPrimaryBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1PrimaryBuckets, getPrimaryBucketList(vm1, "region2"));
-    Set<Integer> vm2PrimaryBuckets = getPrimaryBucketList(vm2, PR_REGION_NAME);
+    Set<Integer> vm2PrimaryBuckets = getPrimaryBucketList(vm2, getPartitionedRegionName());
     assertEquals(vm2PrimaryBuckets, getPrimaryBucketList(vm2, "region2"));
 
     closeCache(vm0);
@@ -1377,19 +1397,19 @@ public class PersistentColocatedPartitionedRegionDUnitTest
 
     Wait.pause(4000);
 
-    assertEquals(vm0Buckets, getBucketList(vm0, PR_REGION_NAME));
+    assertEquals(vm0Buckets, getBucketList(vm0, getPartitionedRegionName()));
     assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
-    assertEquals(vm1Buckets, getBucketList(vm1, PR_REGION_NAME));
+    assertEquals(vm1Buckets, getBucketList(vm1, getPartitionedRegionName()));
     assertEquals(vm1Buckets, getBucketList(vm1, "region2"));
-    assertEquals(vm2Buckets, getBucketList(vm2, PR_REGION_NAME));
+    assertEquals(vm2Buckets, getBucketList(vm2, getPartitionedRegionName()));
     assertEquals(vm2Buckets, getBucketList(vm2, "region2"));
 
     // primary can differ
-    vm0PrimaryBuckets = getPrimaryBucketList(vm0, PR_REGION_NAME);
+    vm0PrimaryBuckets = getPrimaryBucketList(vm0, getPartitionedRegionName());
     assertEquals(vm0PrimaryBuckets, getPrimaryBucketList(vm0, "region2"));
-    vm1PrimaryBuckets = getPrimaryBucketList(vm1, PR_REGION_NAME);
+    vm1PrimaryBuckets = getPrimaryBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1PrimaryBuckets, getPrimaryBucketList(vm1, "region2"));
-    vm2PrimaryBuckets = getPrimaryBucketList(vm2, PR_REGION_NAME);
+    vm2PrimaryBuckets = getPrimaryBucketList(vm2, getPartitionedRegionName());
     assertEquals(vm2PrimaryBuckets, getPrimaryBucketList(vm2, "region2"));
 
 
@@ -1429,7 +1449,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         AttributesFactory af = new AttributesFactory();
         PartitionAttributesFactory paf = new PartitionAttributesFactory();
         paf.setRedundantCopies(1);
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setPartitionAttributes(paf.create());
         cache.createRegion("region2", af.create());
 
@@ -1463,7 +1483,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
       }
     };
     SerializableRunnable createChildPR = getCreateChildPRRunnable();
@@ -1478,18 +1498,18 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     createData(vm0, 0, NUM_BUCKETS, "a");
     createData(vm0, 0, NUM_BUCKETS, "b", "region2");
 
-    Set<Integer> vm0Buckets = getBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0Buckets = getBucketList(vm0, getPartitionedRegionName());
     assertEquals(vm0Buckets, getBucketList(vm0, "region2"));
-    Set<Integer> vm1Buckets = getBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1Buckets = getBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1Buckets, getBucketList(vm1, "region2"));
-    Set<Integer> vm2Buckets = getBucketList(vm2, PR_REGION_NAME);
+    Set<Integer> vm2Buckets = getBucketList(vm2, getPartitionedRegionName());
     assertEquals(vm2Buckets, getBucketList(vm2, "region2"));
 
-    Set<Integer> vm0PrimaryBuckets = getPrimaryBucketList(vm0, PR_REGION_NAME);
+    Set<Integer> vm0PrimaryBuckets = getPrimaryBucketList(vm0, getPartitionedRegionName());
     assertEquals(vm0PrimaryBuckets, getPrimaryBucketList(vm0, "region2"));
-    Set<Integer> vm1PrimaryBuckets = getPrimaryBucketList(vm1, PR_REGION_NAME);
+    Set<Integer> vm1PrimaryBuckets = getPrimaryBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1PrimaryBuckets, getPrimaryBucketList(vm1, "region2"));
-    Set<Integer> vm2PrimaryBuckets = getPrimaryBucketList(vm2, PR_REGION_NAME);
+    Set<Integer> vm2PrimaryBuckets = getPrimaryBucketList(vm2, getPartitionedRegionName());
     assertEquals(vm2PrimaryBuckets, getPrimaryBucketList(vm2, "region2"));
 
     closeCache(vm2);
@@ -1527,18 +1547,18 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     vm2.invoke(createParentPR);
     // Make sure vm2 hasn't created any buckets in the parent PR yet
     // We don't want any buckets until the child PR is created
-    assertEquals(Collections.emptySet(), getBucketList(vm2, PR_REGION_NAME));
+    assertEquals(Collections.emptySet(), getBucketList(vm2, getPartitionedRegionName()));
     vm2.invoke(createChildPR);
 
     // Now vm2 should have created all of the appropriate buckets.
-    assertEquals(vm2Buckets, getBucketList(vm2, PR_REGION_NAME));
+    assertEquals(vm2Buckets, getBucketList(vm2, getPartitionedRegionName()));
     assertEquals(vm2Buckets, getBucketList(vm2, "region2"));
 
-    vm0PrimaryBuckets = getPrimaryBucketList(vm0, PR_REGION_NAME);
+    vm0PrimaryBuckets = getPrimaryBucketList(vm0, getPartitionedRegionName());
     assertEquals(vm0PrimaryBuckets, getPrimaryBucketList(vm0, "region2"));
-    vm1PrimaryBuckets = getPrimaryBucketList(vm1, PR_REGION_NAME);
+    vm1PrimaryBuckets = getPrimaryBucketList(vm1, getPartitionedRegionName());
     assertEquals(vm1PrimaryBuckets, getPrimaryBucketList(vm1, "region2"));
-    vm2PrimaryBuckets = getPrimaryBucketList(vm2, PR_REGION_NAME);
+    vm2PrimaryBuckets = getPrimaryBucketList(vm2, getPartitionedRegionName());
     assertEquals(vm2PrimaryBuckets, getPrimaryBucketList(vm2, "region2"));
   }
 
@@ -1569,9 +1589,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
 
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setPartitionAttributes(paf.create());
         cache.createRegion("region2", af.create());
 
@@ -1621,14 +1641,14 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
 
         DiskStore ds2 = cache.findDiskStore("disk2");
         if (ds2 == null) {
           ds2 = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("disk2");
         }
 
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setPartitionAttributes(paf.create());
         af.setDiskStoreName("disk2");
         cache.createRegion("region2", af.create());
@@ -1676,7 +1696,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     closeCache(vm2);
 
     // Wait until redundancy is recovered.
-    waitForRedundancyRecovery(vm0, 1, PR_REGION_NAME);
+    waitForRedundancyRecovery(vm0, 1, getPartitionedRegionName());
     waitForRedundancyRecovery(vm0, 1, "region2");
 
     createData(vm0, 0, NUM_BUCKETS, "b");
@@ -1719,11 +1739,11 @@ public class PersistentColocatedPartitionedRegionDUnitTest
       checkData(vm0, 0, NUM_BUCKETS, "b");
       checkData(vm0, 0, NUM_BUCKETS, "b", "region2");
 
-      waitForRedundancyRecovery(vm0, 1, PR_REGION_NAME);
+      waitForRedundancyRecovery(vm0, 1, getPartitionedRegionName());
       waitForRedundancyRecovery(vm0, 1, "region2");
-      waitForRedundancyRecovery(vm1, 1, PR_REGION_NAME);
+      waitForRedundancyRecovery(vm1, 1, getPartitionedRegionName());
       waitForRedundancyRecovery(vm1, 1, "region2");
-      waitForRedundancyRecovery(vm2, 1, PR_REGION_NAME);
+      waitForRedundancyRecovery(vm2, 1, getPartitionedRegionName());
       waitForRedundancyRecovery(vm2, 1, "region2");
 
       // Make sure we don't have any extra buckets after the restart
@@ -1760,7 +1780,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
       }
     };
 
@@ -1783,7 +1803,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         PartitionAttributesFactory paf = new PartitionAttributesFactory();
         paf.setRedundantCopies(1);
         paf.setRecoveryDelay(0);
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
         af.setPartitionAttributes(paf.create());
@@ -1820,7 +1840,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
       }
     };
 
@@ -1848,7 +1868,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         PartitionAttributesFactory paf = new PartitionAttributesFactory();
         paf.setRedundantCopies(1);
         paf.setRecoveryDelay(0);
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk2");
         af.setPartitionAttributes(paf.create());
@@ -1907,7 +1927,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     closeCache(vm2);
 
     // Wait until redundancy is recovered.
-    waitForRedundancyRecovery(vm0, 1, PR_REGION_NAME);
+    waitForRedundancyRecovery(vm0, 1, getPartitionedRegionName());
     waitForRedundancyRecovery(vm0, 1, "region2");
 
     createData(vm0, 0, NUM_BUCKETS, "b");
@@ -1963,7 +1983,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     // Make sure we can actually use the buckets in the child region.
     createData(vm0, 0, NUM_BUCKETS, "c", "region2");
 
-    waitForRedundancyRecovery(vm0, 1, PR_REGION_NAME);
+    waitForRedundancyRecovery(vm0, 1, getPartitionedRegionName());
     waitForRedundancyRecovery(vm0, 1, "region2");
 
     // Make sure we don't have any extra buckets after the restart
@@ -2012,9 +2032,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
 
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setPartitionAttributes(paf.create());
         cache.createRegion("region2", af.create());
       }
@@ -2143,9 +2163,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         paf.setLocalMaxMemory(0);
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PARTITION);
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
 
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setPartitionAttributes(paf.create());
         cache.createRegion("region2", af.create());
       }
@@ -2166,9 +2186,9 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
 
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setPartitionAttributes(paf.create());
         cache.createRegion("region2", af.create());
       }
@@ -2186,7 +2206,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
     SerializableRunnable doABunchOfPuts = new SerializableRunnable("doABunchOfPuts") {
       public void run() {
         Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
+        Region region = cache.getRegion(getPartitionedRegionName());
         try {
           for (int i = 0;; i++) {
             try {
@@ -2278,7 +2298,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
       }
     };
 
@@ -2290,7 +2310,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         PartitionAttributesFactory paf = new PartitionAttributesFactory();
         paf.setRedundantCopies(0);
         paf.setRecoveryDelay(0);
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
         af.setPartitionAttributes(paf.create());
@@ -2331,11 +2351,11 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
 
         paf.setRedundantCopies(1);
         paf.setRecoveryDelay(-1);
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
         af.setPartitionAttributes(paf.create());
@@ -2449,7 +2469,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
       }
     };
 
@@ -2466,7 +2486,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
         PartitionAttributesFactory paf = new PartitionAttributesFactory();
         paf.setRedundantCopies(0);
         paf.setRecoveryDelay(0);
-        paf.setColocatedWith(PR_REGION_NAME);
+        paf.setColocatedWith(getPartitionedRegionName());
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk2");
         af.setPartitionAttributes(paf.create());
@@ -2549,7 +2569,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           af.setPartitionAttributes(paf.create());
           af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
           af.setDiskStoreName("disk");
-          cache.createRegion(PR_REGION_NAME, af.create());
+          cache.createRegion(getPartitionedRegionName(), af.create());
         } finally {
           System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "partitionedRegionRetryTimeout",
               String.valueOf(PartitionedRegionHelper.DEFAULT_TOTAL_WAIT_RETRY_ITERATION));
@@ -2567,7 +2587,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           PartitionAttributesFactory paf = new PartitionAttributesFactory();
           paf.setRedundantCopies(0);
           paf.setRecoveryDelay(0);
-          paf.setColocatedWith(PR_REGION_NAME);
+          paf.setColocatedWith(getPartitionedRegionName());
           af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
           af.setDiskStoreName("disk");
           af.setPartitionAttributes(paf.create());
@@ -2614,7 +2634,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           af.setPartitionAttributes(paf.create());
           af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
           af.setDiskStoreName("disk");
-          cache.createRegion(PR_REGION_NAME, af.create());
+          cache.createRegion(getPartitionedRegionName(), af.create());
         } finally {
           System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "partitionedRegionRetryTimeout",
               String.valueOf(PartitionedRegionHelper.DEFAULT_TOTAL_WAIT_RETRY_ITERATION));
@@ -2633,7 +2653,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           PartitionAttributesFactory paf = new PartitionAttributesFactory();
           paf.setRedundantCopies(0);
           paf.setRecoveryDelay(0);
-          paf.setColocatedWith(PR_REGION_NAME);
+          paf.setColocatedWith(getPartitionedRegionName());
           af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
           af.setDiskStoreName("disk");
           af.setPartitionAttributes(paf.create());
@@ -2679,7 +2699,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           af.setPartitionAttributes(paf.create());
           af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
           af.setDiskStoreName("disk");
-          cache.createRegion(PR_REGION_NAME, af.create());
+          cache.createRegion(getPartitionedRegionName(), af.create());
         } finally {
           System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "partitionedRegionRetryTimeout",
               String.valueOf(PartitionedRegionHelper.DEFAULT_TOTAL_WAIT_RETRY_ITERATION));
@@ -2697,7 +2717,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
           PartitionAttributesFactory paf = new PartitionAttributesFactory();
           paf.setRedundantCopies(0);
           paf.setRecoveryDelay(0);
-          paf.setColocatedWith(PR_REGION_NAME);
+          paf.setColocatedWith(getPartitionedRegionName());
           af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
           af.setDiskStoreName("disk");
           af.setPartitionAttributes(paf.create());
@@ -2856,7 +2876,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
       @Override
       public void run() {
         Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
+        Region region = cache.getRegion(getPartitionedRegionName());
 
         for (int i = 0; i < NUM_BUCKETS; i++) {
           assertEquals("For key " + i, "a", region.get(i));
@@ -2937,7 +2957,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest
       @Override
       public void run() {
         Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
+        Region region = cache.getRegion(getPartitionedRegionName());
 
         for (int i = 0; i < NUM_BUCKETS; i++) {
           assertEquals("For key " + i, "a", region.get(i));
@@ -2949,8 +2969,8 @@ public class PersistentColocatedPartitionedRegionDUnitTest
 
       public void run() {
         Cache cache = getCache();
-        LogWriterUtils.getLogWriter().info("creating data in " + PR_REGION_NAME);
-        Region region = cache.getRegion(PR_REGION_NAME);
+        LogWriterUtils.getLogWriter().info("creating data in " + getPartitionedRegionName());
+        Region region = cache.getRegion(getPartitionedRegionName());
 
         for (int i = 0; i < NUM_BUCKETS; i++) {
           region.put(i, "c");
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
index 014eea8..dad51c4 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
@@ -32,7 +32,6 @@ import java.util.Properties;
 import java.util.Set;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
 
 import org.awaitility.Awaitility;
 import org.junit.Ignore;
@@ -77,6 +76,7 @@ import org.apache.geode.distributed.internal.DistributionMessage;
 import org.apache.geode.distributed.internal.DistributionMessageObserver;
 import org.apache.geode.distributed.internal.ReplyException;
 import org.apache.geode.internal.AvailablePort;
+import org.apache.geode.internal.cache.DiskRegion;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
 import org.apache.geode.internal.cache.InitialImageOperation.RequestImageMessage;
 import org.apache.geode.internal.cache.PartitionedRegion;
@@ -169,7 +169,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
     } catch (RMIException exp) {
       assertTrue(exp.getCause() instanceof IllegalStateException);
       IllegalStateException ise = (IllegalStateException) exp.getCause();
-      Object[] prms = new Object[] {"/" + PR_REGION_NAME, 2, 5};
+      Object[] prms = new Object[] {"/" + getPartitionedRegionName(), 2, 5};
       assertTrue(ise.getMessage().contains(
           LocalizedStrings.PartitionedRegion_FOR_REGION_0_TotalBucketNum_1_SHOULD_NOT_BE_CHANGED_Previous_Configured_2
               .toString(prms)));
@@ -181,7 +181,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
     } catch (RMIException exp) {
       assertTrue(exp.getCause() instanceof IllegalStateException);
       IllegalStateException ise = (IllegalStateException) exp.getCause();
-      Object[] prms = new Object[] {"/" + PR_REGION_NAME, 10, 5};
+      Object[] prms = new Object[] {"/" + getPartitionedRegionName(), 10, 5};
       assertTrue(ise.getMessage().contains(
           LocalizedStrings.PartitionedRegion_FOR_REGION_0_TotalBucketNum_1_SHOULD_NOT_BE_CHANGED_Previous_Configured_2
               .toString(prms)));
@@ -213,7 +213,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
         af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
         af.setDiskStoreName("disk");
         RegionAttributes attr = af.create();
-        cache.createRegion(PR_REGION_NAME, attr);
+        cache.createRegion(getPartitionedRegionName(), attr);
       }
     };
 
@@ -292,7 +292,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
       vm0.invoke(new SerializableRunnable() {
         public void run() {
           Cache cache = getCache();
-          Region region = cache.getRegion(PR_REGION_NAME);
+          Region region = cache.getRegion(getPartitionedRegionName());
           try {
             for (int i = 0; i < numBuckets; i++) {
               region.put(i, new BadSerializer());
@@ -328,6 +328,24 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
     }
   }
 
+  void checkRecoveredFromDisk(VM vm, final int bucketId, final boolean recoveredLocally) {
+    vm.invoke(new SerializableRunnable("check recovered from disk") {
+      @Override
+      public void run() {
+        Cache cache = getCache();
+        PartitionedRegion region = (PartitionedRegion) cache.getRegion(getPartitionedRegionName());
+        DiskRegion disk = region.getRegionAdvisor().getBucket(bucketId).getDiskRegion();
+        if (recoveredLocally) {
+          assertEquals(0, disk.getStats().getRemoteInitializations());
+          assertEquals(1, disk.getStats().getLocalInitializations());
+        } else {
+          assertEquals(1, disk.getStats().getRemoteInitializations());
+          assertEquals(0, disk.getStats().getLocalInitializations());
+        }
+      }
+    });
+  }
+
   public static class BadSerializer implements DataSerializable {
 
     public BadSerializer() {
@@ -610,7 +628,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
     vm0.invoke(new SerializableRunnable("Test ways to read") {
       public void run() {
         Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
+        Region region = cache.getRegion(getPartitionedRegionName());
 
         try {
           FunctionService.onRegion(region).execute(new TestFunction());
@@ -652,7 +670,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
         }
 
         try {
-          cache.getQueryService().newQuery("select * from /" + PR_REGION_NAME).execute();
+          cache.getQueryService().newQuery("select * from /" + getPartitionedRegionName())
+              .execute();
           fail("Should not have been able to read from missing buckets!");
         } catch (PartitionOfflineException e) {
           // expected
@@ -1045,6 +1064,9 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
   /**
    * This test this case we replace buckets where are offline on A by creating them on C We then
    * shutdown C and restart A, which recovers those buckets
+   * <p>
+   *
+   * TRAC 41340: data inconsistency after disk recovery from persistent PR
    */
   @Test
   public void testBug41340() throws Throwable {
@@ -1160,6 +1182,9 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
   /**
    * Test that we don't record our old member ID as offline, preventing redundancy recovery in the
    * future.
+   * <p>
+   *
+   * TRAC 41341: Redundancy not restored after reinitializing after locally destroying persistent PR
    */
   @Test
   public void testBug41341() {
@@ -1405,7 +1430,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
         paf.setLocalMaxMemory(0);
         af.setPartitionAttributes(paf.create());
         af.setDataPolicy(DataPolicy.PARTITION);
-        cache.createRegion(PR_REGION_NAME, af.create());
+        cache.createRegion(getPartitionedRegionName(), af.create());
 
         CacheServer server = cache.addCacheServer();
         server.setPort(AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET));
@@ -1438,7 +1463,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
           af.setDataPolicy(DataPolicy.NORMAL);
           af.setScope(Scope.LOCAL);
           af.setPoolName("pool");
-          Region region = cache.createRegion(PR_REGION_NAME, af.create());
+          Region region = cache.createRegion(getPartitionedRegionName(), af.create());
           try {
             region.registerInterestRegex(".*");
           } catch (ServerOperationException e) {
@@ -1468,7 +1493,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
         EvictionAttributes.createLRUEntryAttributes(50, EvictionAction.OVERFLOW_TO_DISK));
     rf.setDiskDirs(getDiskDirs());
 
-    Region region = rf.create(PR_REGION_NAME);
+    Region region = rf.create(getPartitionedRegionName());
     region.get(0);
     cache.getDistributedSystem().disconnect();
     // cache.close();
@@ -1490,8 +1515,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
         DistributionMessageObserver.setInstance(new DistributionMessageObserver() {
 
           @Override
-          public void beforeSendMessage(DistributionManager dm, DistributionMessage msg) {
-            if (msg instanceof ManageBucketReplyMessage) {
+          public void beforeSendMessage(DistributionManager dm, DistributionMessage message) {
+            if (message instanceof ManageBucketReplyMessage) {
               Cache cache = getCache();
               disconnectFromDS();
 
@@ -1554,18 +1579,18 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
     createNestedPR(vm1);
     createNestedPR(vm2);
 
-    createData(vm0, 0, numBuckets, "a", "parent1/" + PR_REGION_NAME);
-    createData(vm0, 0, numBuckets, "b", "parent2/" + PR_REGION_NAME);
-    checkData(vm2, 0, numBuckets, "a", "parent1/" + PR_REGION_NAME);
-    checkData(vm2, 0, numBuckets, "b", "parent2/" + PR_REGION_NAME);
+    createData(vm0, 0, numBuckets, "a", "parent1/" + getPartitionedRegionName());
+    createData(vm0, 0, numBuckets, "b", "parent2/" + getPartitionedRegionName());
+    checkData(vm2, 0, numBuckets, "a", "parent1/" + getPartitionedRegionName());
+    checkData(vm2, 0, numBuckets, "b", "parent2/" + getPartitionedRegionName());
 
-    Set<Integer> vm1_0Buckets = getBucketList(vm0, "parent1/" + PR_REGION_NAME);
-    Set<Integer> vm1_1Buckets = getBucketList(vm1, "parent1/" + PR_REGION_NAME);
-    Set<Integer> vm1_2Buckets = getBucketList(vm2, "parent1/" + PR_REGION_NAME);
+    Set<Integer> vm1_0Buckets = getBucketList(vm0, "parent1/" + getPartitionedRegionName());
+    Set<Integer> vm1_1Buckets = getBucketList(vm1, "parent1/" + getPartitionedRegionName());
+    Set<Integer> vm1_2Buckets = getBucketList(vm2, "parent1/" + getPartitionedRegionName());
 
-    Set<Integer> vm2_0Buckets = getBucketList(vm0, "parent2/" + PR_REGION_NAME);
-    Set<Integer> vm2_1Buckets = getBucketList(vm1, "parent2/" + PR_REGION_NAME);
-    Set<Integer> vm2_2Buckets = getBucketList(vm2, "parent2/" + PR_REGION_NAME);
+    Set<Integer> vm2_0Buckets = getBucketList(vm0, "parent2/" + getPartitionedRegionName());
+    Set<Integer> vm2_1Buckets = getBucketList(vm1, "parent2/" + getPartitionedRegionName());
+    Set<Integer> vm2_2Buckets = getBucketList(vm2, "parent2/" + getPartitionedRegionName());
 
     closeCache(vm0);
     closeCache(vm1);
@@ -1583,20 +1608,20 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
     async1.getResult();
     async2.getResult();
 
-    assertEquals(vm1_0Buckets, getBucketList(vm0, "parent1/" + PR_REGION_NAME));
-    assertEquals(vm1_1Buckets, getBucketList(vm1, "parent1/" + PR_REGION_NAME));
-    assertEquals(vm1_2Buckets, getBucketList(vm2, "parent1/" + PR_REGION_NAME));
+    assertEquals(vm1_0Buckets, getBucketList(vm0, "parent1/" + getPartitionedRegionName()));
+    assertEquals(vm1_1Buckets, getBucketList(vm1, "parent1/" + getPartitionedRegionName()));
+    assertEquals(vm1_2Buckets, getBucketList(vm2, "parent1/" + getPartitionedRegionName()));
 
-    assertEquals(vm2_0Buckets, getBucketList(vm0, "parent2/" + PR_REGION_NAME));
-    assertEquals(vm2_1Buckets, getBucketList(vm1, "parent2/" + PR_REGION_NAME));
-    assertEquals(vm2_2Buckets, getBucketList(vm2, "parent2/" + PR_REGION_NAME));
+    assertEquals(vm2_0Buckets, getBucketList(vm0, "parent2/" + getPartitionedRegionName()));
+    assertEquals(vm2_1Buckets, getBucketList(vm1, "parent2/" + getPartitionedRegionName()));
+    assertEquals(vm2_2Buckets, getBucketList(vm2, "parent2/" + getPartitionedRegionName()));
 
-    checkData(vm0, 0, numBuckets, "a", "parent1/" + PR_REGION_NAME);
-    checkData(vm0, 0, numBuckets, "b", "parent2/" + PR_REGION_NAME);
-    createData(vm1, numBuckets, 113, "c", "parent1/" + PR_REGION_NAME);
-    createData(vm1, numBuckets, 113, "d", "parent2/" + PR_REGION_NAME);
-    checkData(vm2, numBuckets, 113, "c", "parent1/" + PR_REGION_NAME);
-    checkData(vm2, numBuckets, 113, "d", "parent2/" + PR_REGION_NAME);
+    checkData(vm0, 0, numBuckets, "a", "parent1/" + getPartitionedRegionName());
+    checkData(vm0, 0, numBuckets, "b", "parent2/" + getPartitionedRegionName());
+    createData(vm1, numBuckets, 113, "c", "parent1/" + getPartitionedRegionName());
+    createData(vm1, numBuckets, 113, "d", "parent2/" + getPartitionedRegionName());
+    checkData(vm2, numBuckets, 113, "c", "parent1/" + getPartitionedRegionName());
+    checkData(vm2, numBuckets, 113, "d", "parent2/" + getPartitionedRegionName());
   }
 
   @Test
@@ -1616,7 +1641,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
 
       public Object call() {
         Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
+        Region region = cache.getRegion(getPartitionedRegionName());
 
         int i = 0;
         while (true) {
@@ -1636,7 +1661,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
     SerializableCallable waitForIntValue = new SerializableCallable() {
       public Object call() {
         Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
+        Region region = cache.getRegion(getPartitionedRegionName());
         // The value is initialized as a String so wait
         // for it to be changed to an Integer.
         await().atMost(60, SECONDS).until(() -> {
@@ -1669,7 +1694,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
 
       public Object call() {
         Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
+        Region region = cache.getRegion(getPartitionedRegionName());
         int value = (Integer) region.get(0);
         return value;
       }
@@ -1687,8 +1712,10 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
    * member A that it hosts the bucket 3. Member A crashes 4. Member B destroys the bucket and
    * throws a partition offline exception, because it wasn't able to complete initialization. 5.
    * Member A recovers, and gets stuck waiting for member B.
+   * <p>
    *
-   * @throws Throwable
+   * TRAC 42226: recycled VM hangs during re-start while waiting for Partition to come online (after
+   * Controller VM sees unexpected PartitionOffLineException while doing ops)
    */
   @Category(FlakyTest.class) // GEODE-1208: time sensitive, multiple non-thread-safe test hooks,
                              // async actions
@@ -1834,7 +1861,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
 
           Cache cache = getCache();
           RegionAttributes attr = getPersistentPRAttributes(redundancy, -1, cache, 113, true);
-          cache.createRegion(PR_REGION_NAME, attr);
+          cache.createRegion(getPartitionedRegionName(), attr);
         }
       };
 
@@ -2129,15 +2156,15 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
 
     // create some buckets
     createData(vm0, 0, 2, "a");
-    createData(vm0, 0, 2, "a", PR_CHILD_REGION_NAME);
-    closePR(vm0, PR_CHILD_REGION_NAME);
+    createData(vm0, 0, 2, "a", getChildRegionName());
+    closePR(vm0, getChildRegionName());
     closePR(vm0);
 
     // createPR(vm1, 1);
     createCoLocatedPR(vm1, 1, false);
     // create an overlapping bucket
     createData(vm1, 2, 4, "a");
-    createData(vm1, 2, 4, "a", PR_CHILD_REGION_NAME);
+    createData(vm1, 2, 4, "a", getChildRegionName());
 
     IgnoredException[] expectVm0 =
         {IgnoredException.addIgnoredException("ConflictingPersistentDataException", vm0),
@@ -2350,19 +2377,18 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
   private void createChildPR(VM vm) {
     vm.invoke(() -> {
       PartitionAttributes PRatts =
-          new PartitionAttributesFactory().setColocatedWith(PR_REGION_NAME).create();
+          new PartitionAttributesFactory().setColocatedWith(getPartitionedRegionName()).create();
       PartitionedRegion child =
           (PartitionedRegion) PartitionedRegionTestHelper.createPartionedRegion("CHILD", PRatts);
     });
   }
 
-  private static final class RecoveryObserver
-      extends InternalResourceManager.ResourceObserverAdapter {
+  private final class RecoveryObserver extends InternalResourceManager.ResourceObserverAdapter {
     final CountDownLatch recoveryDone = new CountDownLatch(1);
 
     @Override
     public void rebalancingOrRecoveryFinished(Region region) {
-      if (region.getName().equals(PR_REGION_NAME)) {
+      if (region.getName().equals(getPartitionedRegionName())) {
         recoveryDone.countDown();
       }
     }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
index d401b7f..1b2732e 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
@@ -14,12 +14,16 @@
  */
 package org.apache.geode.internal.cache.partitioned;
 
-import static org.apache.geode.test.dunit.Assert.assertEquals;
+import static org.apache.commons.io.FileUtils.listFiles;
+import static org.apache.commons.io.filefilter.DirectoryFileFilter.DIRECTORY;
+import static org.apache.geode.admin.AdminDistributedSystemFactory.defineDistributedSystem;
+import static org.apache.geode.admin.AdminDistributedSystemFactory.getDistributedSystem;
+import static org.apache.geode.test.dunit.Invoke.invokeInEveryVM;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.IOException;
-import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.net.InetAddress;
 import java.util.Collection;
@@ -28,12 +32,11 @@ import java.util.TreeSet;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.filefilter.DirectoryFileFilter;
 import org.apache.commons.io.filefilter.RegexFileFilter;
+import org.apache.logging.log4j.Logger;
+import org.junit.Before;
 
 import org.apache.geode.admin.AdminDistributedSystem;
-import org.apache.geode.admin.AdminDistributedSystemFactory;
 import org.apache.geode.admin.AdminException;
 import org.apache.geode.admin.DistributedSystemConfig;
 import org.apache.geode.cache.AttributesFactory;
@@ -43,361 +46,224 @@ import org.apache.geode.cache.DiskStore;
 import org.apache.geode.cache.PartitionAttributesFactory;
 import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionAttributes;
-import org.apache.geode.cache.control.RebalanceFactory;
 import org.apache.geode.cache.partition.PartitionRegionHelper;
 import org.apache.geode.cache.partition.PartitionRegionInfo;
 import org.apache.geode.cache.persistence.ConflictingPersistentDataException;
 import org.apache.geode.cache.persistence.PersistentID;
 import org.apache.geode.distributed.internal.membership.InternalDistributedMember;
-import org.apache.geode.internal.cache.BackupUtil;
 import org.apache.geode.internal.cache.DiskRegion;
-import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.PartitionedRegionDataStore;
+import org.apache.geode.internal.cache.backup.BackupUtil;
 import org.apache.geode.internal.cache.control.InternalResourceManager;
 import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceObserver;
-import org.apache.geode.internal.cache.persistence.PersistenceAdvisor;
+import org.apache.geode.internal.cache.control.InternalResourceManager.ResourceObserverAdapter;
 import org.apache.geode.internal.cache.persistence.PersistenceAdvisorImpl;
+import org.apache.geode.internal.cache.persistence.PersistenceAdvisorImpl.PersistenceAdvisorObserver;
 import org.apache.geode.internal.cache.persistence.PersistentMemberID;
+import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.BackupStatus;
 import org.apache.geode.management.ManagementException;
-import org.apache.geode.test.dunit.Assert;
 import org.apache.geode.test.dunit.AsyncInvocation;
-import org.apache.geode.test.dunit.Invoke;
-import org.apache.geode.test.dunit.LogWriterUtils;
-import org.apache.geode.test.dunit.SerializableCallable;
 import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.Wait;
 import org.apache.geode.test.dunit.WaitCriterion;
 import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
 
+@SuppressWarnings("serial")
 public abstract class PersistentPartitionedRegionTestBase extends JUnit4CacheTestCase {
+  private static final Logger logger = LogService.getLogger();
 
-  public static String PR_REGION_NAME = "region";
-  public static String PR_CHILD_REGION_NAME = "childRegion";
   // This must be bigger than the dunit ack-wait-threshold for the revoke
   // tests. The command line is setting the ack-wait-threshold to be
   // 60 seconds.
   private static final int MAX_WAIT = 70 * 1000;
 
-  /*
-   * (non-Javadoc) Set the region name for this test so that multiple subclasses of this test base
-   * do not conflict with one another during parallel dunit runs
-   *
-   * @see dunit.DistributedTestCase#setUp()
-   */
-  @Override
-  public final void postSetUp() throws Exception {
-    disconnectAllFromDS();
-    Invoke.invokeInEveryVM(PersistentPartitionedRegionTestBase.class, "setRegionName",
-        new Object[] {getUniqueName()});
-    setRegionName(getUniqueName());
-    postSetUpPersistentPartitionedRegionTestBase();
-  }
+  private static final int NUM_BUCKETS = 113;
+  private static final String CHILD_REGION_NAME = "childRegion";
 
-  protected void postSetUpPersistentPartitionedRegionTestBase() throws Exception {}
+  private String partitionedRegionName;
 
-  public static void setRegionName(String testName) {
-    PR_REGION_NAME = testName + "Region";
-  }
+  @Before
+  public void setUpPersistentPartitionedRegionTestBase() throws Exception {
+    disconnectAllFromDS();
 
-  protected void checkRecoveredFromDisk(VM vm, final int bucketId, final boolean recoveredLocally) {
-    vm.invoke(new SerializableRunnable("check recovered from disk") {
-      public void run() {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(PR_REGION_NAME);
-        DiskRegion disk = region.getRegionAdvisor().getBucket(bucketId).getDiskRegion();
-        if (recoveredLocally) {
-          assertEquals(0, disk.getStats().getRemoteInitializations());
-          assertEquals(1, disk.getStats().getLocalInitializations());
-        } else {
-          assertEquals(1, disk.getStats().getRemoteInitializations());
-          assertEquals(0, disk.getStats().getLocalInitializations());
-        }
-      }
-    });
-  }
+    partitionedRegionName = getUniqueName() + "Region";
+    invokeInEveryVM(() -> partitionedRegionName = getUniqueName() + "Region");
 
-  protected void fakeCleanShutdown(VM vm, final int bucketId) {
-    vm.invoke(new SerializableRunnable("mark clean") {
-      public void run() {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(PR_REGION_NAME);
-        DiskRegion disk = region.getRegionAdvisor().getBucket(bucketId).getDiskRegion();
-        for (PersistentMemberID id : disk.getOnlineMembers()) {
-          disk.memberOfflineAndEqual(id);
-        }
-        for (PersistentMemberID id : disk.getOfflineMembers()) {
-          disk.memberOfflineAndEqual(id);
-        }
-        cache.close();
-      }
-    });
+    postSetUpPersistentPartitionedRegionTestBase();
   }
 
-  private PersistentMemberID getPersistentID(VM vm, final int bucketId) {
-    Object id = vm.invoke(new SerializableCallable("get bucket persistent id") {
-      public Object call() {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(PR_REGION_NAME);
-        PersistenceAdvisor advisor =
-            region.getRegionAdvisor().getBucket(bucketId).getPersistenceAdvisor();
-        return advisor.getPersistentID();
-      }
-    });
-
-    return (PersistentMemberID) id;
+  protected void postSetUpPersistentPartitionedRegionTestBase() throws Exception {
+    // override as needed
   }
 
-  private void forceRecovery(VM vm) {
-    vm.invoke(new SerializableRunnable("force recovery") {
-      public void run() {
-        Cache cache = getCache();
-        RebalanceFactory rf = cache.getResourceManager().createRebalanceFactory();
-        try {
-          rf.start().getResults();
-        } catch (Exception e) {
-          Assert.fail("interupted", e);
-        }
+  void fakeCleanShutdown(final VM vm, final int bucketId) {
+    vm.invoke("fakeCleanShutdown", () -> {
+      Cache cache = getCache();
+      PartitionedRegion region = (PartitionedRegion) cache.getRegion(getPartitionedRegionName());
+      DiskRegion disk = region.getRegionAdvisor().getBucket(bucketId).getDiskRegion();
+      for (PersistentMemberID id : disk.getOnlineMembers()) {
+        disk.memberOfflineAndEqual(id);
+      }
+      for (PersistentMemberID id : disk.getOfflineMembers()) {
+        disk.memberOfflineAndEqual(id);
       }
+      cache.close();
     });
   }
 
-  protected void checkData(VM vm0, final int startKey, final int endKey, final String value) {
-    checkData(vm0, startKey, endKey, value, PR_REGION_NAME);
+  protected void checkData(VM vm, final int startKey, final int endKey, final String value) {
+    checkData(vm, startKey, endKey, value, getPartitionedRegionName());
   }
 
-  protected void checkData(VM vm0, final int startKey, final int endKey, final String value,
+  protected void checkData(final VM vm, final int startKey, final int endKey, final String value,
       final String regionName) {
-    SerializableRunnable checkData = new SerializableRunnable("CheckData") {
-
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(regionName);
-
-        for (int i = startKey; i < endKey; i++) {
-          assertEquals("For key " + i, value, region.get(i));
-        }
+    vm.invoke("checkData", () -> {
+      Region region = getCache().getRegion(regionName);
+      for (int i = startKey; i < endKey; i++) {
+        assertThat(region.get(i)).isEqualTo(value);
       }
-    };
-
-    vm0.invoke(checkData);
+    });
   }
 
-  protected void removeData(VM vm, final int startKey, final int endKey) {
-    SerializableRunnable createData = new SerializableRunnable() {
-
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
-
-        for (int i = startKey; i < endKey; i++) {
-          region.destroy(i);
-        }
+  void removeData(final VM vm, final int startKey, final int endKey) {
+    vm.invoke("removeData", () -> {
+      Region region = getCache().getRegion(getPartitionedRegionName());
+      for (int i = startKey; i < endKey; i++) {
+        region.destroy(i);
       }
-    };
-    vm.invoke(createData);
+    });
   }
 
-  protected void createData(VM vm, final int startKey, final int endKey, final String value) {
-    LogWriterUtils.getLogWriter().info("createData invoked.  PR_REGION_NAME is " + PR_REGION_NAME);
-    createData(vm, startKey, endKey, value, PR_REGION_NAME);
+  protected void createData(final VM vm, final int startKey, final int endKey, final String value) {
+    createData(vm, startKey, endKey, value, getPartitionedRegionName());
   }
 
-  protected void createData(VM vm, final int startKey, final int endKey, final String value,
+  protected void createData(final VM vm, final int startKey, final int endKey, final String value,
       final String regionName) {
-    SerializableRunnable createData = new SerializableRunnable("createData") {
-
-      public void run() {
-        Cache cache = getCache();
-        cache.getLogger().info("creating data in " + regionName);
-        Region region = cache.getRegion(regionName);
-
-        for (int i = startKey; i < endKey; i++) {
-          region.put(i, value);
-        }
+    vm.invoke("createData", () -> {
+      Region region = getCache().getRegion(regionName);
+      for (int i = startKey; i < endKey; i++) {
+        region.put(i, value);
       }
-    };
-    vm.invoke(createData);
+    });
   }
 
-  protected void closeCache(VM vm0) {
-    SerializableRunnable close = new SerializableRunnable("Close Cache") {
-      public void run() {
-        Cache cache = getCache();
-        cache.close();
-      }
-    };
-
-    vm0.invoke(close);
+  protected void closeCache(final VM vm) {
+    vm.invoke("closeCache", () -> getCache().close());
   }
 
-  protected AsyncInvocation closeCacheAsync(VM vm0) {
-    SerializableRunnable close = new SerializableRunnable() {
-      public void run() {
-        Cache cache = getCache();
-        cache.close();
-      }
-    };
-
-    return vm0.invokeAsync(close);
+  AsyncInvocation closeCacheAsync(final VM vm) {
+    return vm.invokeAsync("closeCacheAsync", () -> getCache().close());
   }
 
-  protected void closePR(VM vm0) {
-    closePR(vm0, PR_REGION_NAME);
+  void closePR(final VM vm) {
+    closePR(vm, getPartitionedRegionName());
   }
 
-  protected void closePR(VM vm0, String regionName) {
-    SerializableRunnable close = new SerializableRunnable("Close PR") {
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(regionName);
-        region.close();
-      }
-    };
-
-    vm0.invoke(close);
+  void closePR(final VM vm, final String regionName) {
+    vm.invoke("closePR", () -> getCache().getRegion(regionName).close());
   }
 
-  protected void destroyPR(VM vm0) {
-    destroyPR(vm0, PR_REGION_NAME);
+  void destroyPR(final VM vm) {
+    destroyPR(vm, getPartitionedRegionName());
   }
 
-  protected void destroyPR(VM vm0, String regionName) {
-    SerializableRunnable destroy = new SerializableRunnable("Destroy PR") {
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(regionName);
-        region.localDestroyRegion();
-      }
-    };
-
-    vm0.invoke(destroy);
+  private void destroyPR(final VM vm, String regionName) {
+    vm.invoke("destroyPR", () -> getCache().getRegion(regionName).localDestroyRegion());
   }
 
-  protected void localDestroyPR(VM vm0) {
-    SerializableRunnable destroyPR = new SerializableRunnable("destroy pr") {
-
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
-        region.localDestroyRegion();
-      }
-    };
-    vm0.invoke(destroyPR);
+  void localDestroyPR(final VM vm) {
+    vm.invoke("localDestroyPR",
+        () -> getCache().getRegion(getPartitionedRegionName()).localDestroyRegion());
   }
 
-  protected void createPR(VM vm0, final int redundancy, final int recoveryDelay, int numBuckets) {
-    SerializableRunnable createPR = getCreatePRRunnable(redundancy, recoveryDelay, numBuckets);
-
-    vm0.invoke(createPR);
+  protected void createPR(final VM vm, final int redundancy, final int recoveryDelay,
+      final int numBuckets) {
+    vm.invoke(getCreatePRRunnable(redundancy, recoveryDelay, numBuckets));
   }
 
-  protected void createPR(VM vm0, final int redundancy, final int recoveryDelay, int numBuckets,
-      boolean synchronous) {
-    SerializableRunnable createPR =
-        getCreatePRRunnable(redundancy, recoveryDelay, numBuckets, synchronous);
-
-    vm0.invoke(createPR);
+  protected void createPR(final VM vm, final int redundancy, final int recoveryDelay,
+      final int numBuckets, final boolean synchronous) {
+    vm.invoke(getCreatePRRunnable(redundancy, recoveryDelay, numBuckets, synchronous));
   }
 
-  protected void createPR(VM vm0, final int redundancy, final int recoveryDelay) {
-    SerializableRunnable createPR = getCreatePRRunnable(redundancy, recoveryDelay);
-
-    vm0.invoke(createPR);
+  protected void createPR(final VM vm, final int redundancy, final int recoveryDelay) {
+    vm.invoke(getCreatePRRunnable(redundancy, recoveryDelay));
   }
 
-  protected void createPR(VM vm0, final int redundancy) {
-    SerializableRunnable createPR = getCreatePRRunnable(redundancy, -1);
-
-    vm0.invoke(createPR);
+  protected void createPR(final VM vm, final int redundancy) {
+    vm.invoke(getCreatePRRunnable(redundancy, -1));
   }
 
-  protected void createNestedPR(VM vm) {
-    SerializableRunnable createPR = getNestedPRRunnable();
-    vm.invoke(createPR);
+  void createNestedPR(final VM vm) {
+    vm.invoke(getNestedPRRunnable());
   }
 
-  protected AsyncInvocation createNestedPRAsync(VM vm) {
-    SerializableRunnable createPR = getNestedPRRunnable();
-    return vm.invokeAsync(createPR);
+  AsyncInvocation createNestedPRAsync(final VM vm) {
+    return vm.invokeAsync(getNestedPRRunnable());
   }
 
   private SerializableRunnable getNestedPRRunnable() {
-    SerializableRunnable createPR = new SerializableRunnable("create pr") {
-
+    return new SerializableRunnable("getNestedPRRunnable") {
+      @Override
       public void run() {
-        Cache cache = getCache();
 
         // Wait for both nested PRs to be created
         final CountDownLatch recoveryDone = new CountDownLatch(2);
 
-        ResourceObserver observer = new InternalResourceManager.ResourceObserverAdapter() {
+        ResourceObserver observer = new ResourceObserverAdapter() {
           @Override
-          public void recoveryFinished(Region region) {
+          public void recoveryFinished(final Region region) {
             recoveryDone.countDown();
           }
         };
         InternalResourceManager.setResourceObserver(observer);
 
-        DiskStore ds = cache.findDiskStore("disk");
-        if (ds == null) {
-          ds = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("disk");
-        }
-        Region parent1;
-        {
-          AttributesFactory af = new AttributesFactory();
-          af.setDataPolicy(DataPolicy.REPLICATE);
-          parent1 = cache.createRegion("parent1", af.create());
-        }
-        Region parent2;
-        {
-          AttributesFactory af = new AttributesFactory();
-          af.setDataPolicy(DataPolicy.REPLICATE);
-          parent2 = cache.createRegion("parent2", af.create());
-        }
-        {
-          AttributesFactory af = new AttributesFactory();
-          PartitionAttributesFactory paf = new PartitionAttributesFactory();
-          paf.setRedundantCopies(1);
-          af.setPartitionAttributes(paf.create());
-          af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
-          af.setDiskStoreName("disk");
-          parent1.createSubregion(PR_REGION_NAME, af.create());
-        }
-        {
-          AttributesFactory af = new AttributesFactory();
-          PartitionAttributesFactory paf = new PartitionAttributesFactory();
-          paf.setRedundantCopies(1);
-          af.setPartitionAttributes(paf.create());
-          af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
-          af.setDiskStoreName("disk");
-          parent2.createSubregion(PR_REGION_NAME, af.create());
+        Cache cache = getCache();
+        DiskStore diskStore = cache.findDiskStore("disk");
+        if (diskStore == null) {
+          diskStore = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("disk");
         }
 
+        AttributesFactory attributesFactory = new AttributesFactory();
+        attributesFactory.setDataPolicy(DataPolicy.REPLICATE);
+
+        Region parent1 = cache.createRegion("parent1", attributesFactory.create());
+        Region parent2 = cache.createRegion("parent2", attributesFactory.create());
+
+        attributesFactory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
+        attributesFactory.setDiskStoreName("disk");
+
+        PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory();
+        partitionAttributesFactory.setRedundantCopies(1);
+        attributesFactory.setPartitionAttributes(partitionAttributesFactory.create());
+
+        parent1.createSubregion(getPartitionedRegionName(), attributesFactory.create());
+        parent2.createSubregion(getPartitionedRegionName(), attributesFactory.create());
+
         try {
           recoveryDone.await(MAX_WAIT, TimeUnit.MILLISECONDS);
         } catch (InterruptedException e) {
-          Assert.fail("interrupted", e);
+          throw new RuntimeException(e);
         }
       }
     };
-    return createPR;
   }
 
-  protected void createCoLocatedPR(VM vm, int setRedundantCopies,
-      boolean setPersistenceAdvisorObserver) {
+  void createCoLocatedPR(final VM vm, final int setRedundantCopies,
+      final boolean setPersistenceAdvisorObserver) {
     vm.invoke(() -> {
       String dsName = "colacatedpr";
 
-      Cache cache = getCache();
-
       // Wait for both nested PRs to be created
       final CountDownLatch recoveryDone = new CountDownLatch(2);
-      ResourceObserver observer = new InternalResourceManager.ResourceObserverAdapter() {
+      ResourceObserver observer = new ResourceObserverAdapter() {
         @Override
-        public void recoveryFinished(Region region) {
+        public void recoveryFinished(final Region region) {
           recoveryDone.countDown();
         }
       };
@@ -407,47 +273,53 @@ public abstract class PersistentPartitionedRegionTestBase extends JUnit4CacheTes
       // And throw exception while region is getting initialized.
       final CountDownLatch childRegionCreated = new CountDownLatch(1);
       if (setPersistenceAdvisorObserver) {
-        PersistenceAdvisorImpl
-            .setPersistenceAdvisorObserver(new PersistenceAdvisorImpl.PersistenceAdvisorObserver() {
-              public void observe(String regionPath) {
-                if (regionPath.contains(PR_CHILD_REGION_NAME)) {
-                  try {
-                    childRegionCreated.await(MAX_WAIT, TimeUnit.MILLISECONDS);
-                  } catch (Exception e) {
-                    Assert.fail("Exception", e);
-                  }
-                  throw new ConflictingPersistentDataException(
-                      "Testing Cache Close with ConflictingPersistentDataException for region."
-                          + regionPath);
-                }
+        PersistenceAdvisorImpl.setPersistenceAdvisorObserver(new PersistenceAdvisorObserver() {
+          @Override
+          public void observe(String regionPath) {
+            if (regionPath.contains(getChildRegionName())) {
+              try {
+                childRegionCreated.await(MAX_WAIT, TimeUnit.MILLISECONDS);
+              } catch (InterruptedException e) {
+                throw new RuntimeException(e);
               }
-            });
+              throw new ConflictingPersistentDataException(
+                  "Testing Cache Close with ConflictingPersistentDataException for region "
+                      + regionPath);
+            }
+          }
+        });
       }
 
       // Create region.
       try {
-        DiskStore ds = cache.findDiskStore(dsName);
-        if (ds == null) {
-          ds = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create(dsName);
+        Cache cache = getCache();
+
+        DiskStore diskStore = cache.findDiskStore(dsName);
+        if (diskStore == null) {
+          diskStore = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create(dsName);
         }
 
         // Parent Region
-        PartitionAttributesFactory paf =
+        PartitionAttributesFactory partitionAttributesFactory =
             new PartitionAttributesFactory().setRedundantCopies(setRedundantCopies);
-        AttributesFactory af = new AttributesFactory();
-        af.setPartitionAttributes(paf.create());
-        af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
-        af.setDiskStoreName(dsName);
-        cache.createRegion(PR_REGION_NAME, af.create());
+
+        AttributesFactory attributesFactory = new AttributesFactory();
+        attributesFactory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
+        attributesFactory.setDiskStoreName(dsName);
+        attributesFactory.setPartitionAttributes(partitionAttributesFactory.create());
+
+        cache.createRegion(getPartitionedRegionName(), attributesFactory.create());
 
         // Colocated region
-        paf = (new PartitionAttributesFactory()).setRedundantCopies(setRedundantCopies)
-            .setColocatedWith(PR_REGION_NAME);
-        af = new AttributesFactory();
-        af.setPartitionAttributes(paf.create());
-        af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
-        af.setDiskStoreName(dsName);
-        cache.createRegion(PR_CHILD_REGION_NAME, af.create());
+        partitionAttributesFactory = (new PartitionAttributesFactory())
+            .setRedundantCopies(setRedundantCopies).setColocatedWith(getPartitionedRegionName());
+
+        attributesFactory = new AttributesFactory();
+        attributesFactory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
+        attributesFactory.setDiskStoreName(dsName);
+        attributesFactory.setPartitionAttributes(partitionAttributesFactory.create());
+
+        cache.createRegion(getChildRegionName(), attributesFactory.create());
 
         // Count down on region create.
         childRegionCreated.countDown();
@@ -455,7 +327,7 @@ public abstract class PersistentPartitionedRegionTestBase extends JUnit4CacheTes
         try {
           recoveryDone.await(MAX_WAIT, TimeUnit.MILLISECONDS);
         } catch (InterruptedException e) {
-          Assert.fail("interrupted", e);
+          throw new RuntimeException(e);
         }
 
       } finally {
@@ -465,7 +337,7 @@ public abstract class PersistentPartitionedRegionTestBase extends JUnit4CacheTes
   }
 
   private SerializableRunnable getCreatePRRunnable(final int redundancy, final int recoveryDelay) {
-    return getCreatePRRunnable(redundancy, recoveryDelay, 113);
+    return getCreatePRRunnable(redundancy, recoveryDelay, NUM_BUCKETS);
   }
 
   private SerializableRunnable getCreatePRRunnable(final int redundancy, final int recoveryDelay,
@@ -475,14 +347,12 @@ public abstract class PersistentPartitionedRegionTestBase extends JUnit4CacheTes
 
   private SerializableRunnable getCreatePRRunnable(final int redundancy, final int recoveryDelay,
       final int numBuckets, final boolean synchronous) {
-    SerializableRunnable createPR = new SerializableRunnable("create pr") {
-
+    return new SerializableRunnable("getCreatePRRunnable") {
+      @Override
       public void run() {
-        final CountDownLatch recoveryDone;
+        final CountDownLatch recoveryDone = new CountDownLatch(1);
         if (redundancy > 0) {
-          recoveryDone = new CountDownLatch(1);
-
-          ResourceObserver observer = new InternalResourceManager.ResourceObserverAdapter() {
+          ResourceObserver observer = new ResourceObserverAdapter() {
             @Override
             public void recoveryFinished(Region region) {
               recoveryDone.countDown();
@@ -490,391 +360,302 @@ public abstract class PersistentPartitionedRegionTestBase extends JUnit4CacheTes
           };
           InternalResourceManager.setResourceObserver(observer);
         } else {
-          recoveryDone = null;
+          recoveryDone.countDown();
         }
 
         Cache cache = getCache();
 
-        RegionAttributes attr =
+        RegionAttributes regionAttributes =
             getPersistentPRAttributes(redundancy, recoveryDelay, cache, numBuckets, synchronous);
-        cache.createRegion(PR_REGION_NAME, attr);
-        if (recoveryDone != null) {
-          try {
-            recoveryDone.await();
-          } catch (InterruptedException e) {
-            Assert.fail("Interrupted", e);
-          }
+        cache.createRegion(getPartitionedRegionName(), regionAttributes);
+
+        try {
+          recoveryDone.await();
+        } catch (InterruptedException e) {
+          throw new RuntimeException(e);
         }
       }
     };
-    return createPR;
   }
 
   protected RegionAttributes getPersistentPRAttributes(final int redundancy,
-      final int recoveryDelay, Cache cache, int numBuckets, boolean synchronous) {
-    DiskStore ds = cache.findDiskStore("disk");
-    if (ds == null) {
-      ds = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("disk");
+      final int recoveryDelay, final Cache cache, final int numBuckets, final boolean synchronous) {
+    DiskStore diskStore = cache.findDiskStore("disk");
+    if (diskStore == null) {
+      diskStore = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("disk");
     }
-    AttributesFactory af = new AttributesFactory();
-    PartitionAttributesFactory paf = new PartitionAttributesFactory();
-    paf.setRedundantCopies(redundancy);
-    paf.setRecoveryDelay(recoveryDelay);
-    paf.setTotalNumBuckets(numBuckets);
+
+    PartitionAttributesFactory partitionAttributesFactory = new PartitionAttributesFactory();
+    partitionAttributesFactory.setRedundantCopies(redundancy);
+    partitionAttributesFactory.setRecoveryDelay(recoveryDelay);
+    partitionAttributesFactory.setTotalNumBuckets(numBuckets);
     // Make sure all vms end up with the same local max memory
-    paf.setLocalMaxMemory(500);
-    af.setPartitionAttributes(paf.create());
-    af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
-    af.setDiskStoreName("disk");
-    af.setDiskSynchronous(synchronous);
-    RegionAttributes attr = af.create();
-    return attr;
+    partitionAttributesFactory.setLocalMaxMemory(500);
+
+    AttributesFactory attributesFactory = new AttributesFactory();
+    attributesFactory.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
+    attributesFactory.setDiskStoreName("disk");
+    attributesFactory.setDiskSynchronous(synchronous);
+    attributesFactory.setPartitionAttributes(partitionAttributesFactory.create());
+
+    return attributesFactory.create();
   }
 
-  protected AsyncInvocation createPRAsync(VM vm0, final int redundancy, int recoveryDelay,
+  AsyncInvocation createPRAsync(final VM vm, final int redundancy, int recoveryDelay,
       int numBuckets) {
-    SerializableRunnable createPR = getCreatePRRunnable(redundancy, recoveryDelay, numBuckets);
-    return vm0.invokeAsync(createPR);
+    return vm.invokeAsync(getCreatePRRunnable(redundancy, recoveryDelay, numBuckets));
   }
 
-  protected AsyncInvocation createPRAsync(VM vm0, final int redundancy) {
-    SerializableRunnable createPR = getCreatePRRunnable(redundancy, -1);
-    return vm0.invokeAsync(createPR);
+  AsyncInvocation createPRAsync(final VM vm, final int redundancy) {
+    return vm.invokeAsync(getCreatePRRunnable(redundancy, -1));
   }
 
-  protected Set<Integer> getBucketList(VM vm0) {
-    return getBucketList(vm0, PR_REGION_NAME);
+  protected Set<Integer> getBucketList(final VM vm) {
+    return getBucketList(vm, getPartitionedRegionName());
   }
 
-  protected Set<Integer> getBucketList(VM vm0, final String regionName) {
-    SerializableCallable getBuckets = new SerializableCallable("get buckets") {
-
-      public Object call() throws Exception {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
-        return new TreeSet<Integer>(region.getDataStore().getAllLocalBucketIds());
-      }
-    };
-
-    return (Set<Integer>) vm0.invoke(getBuckets);
+  protected Set<Integer> getBucketList(final VM vm, final String regionName) {
+    return vm.invoke("getBucketList", () -> {
+      PartitionedRegion region = (PartitionedRegion) getCache().getRegion(regionName);
+      return new TreeSet<>(region.getDataStore().getAllLocalBucketIds());
+    });
   }
 
-  protected void waitForBuckets(VM vm, final Set<Integer> expectedBuckets,
-      final String regionName) {
-    SerializableCallable getBuckets = new SerializableCallable("get buckets") {
-
-      public Object call() throws Exception {
-        Cache cache = getCache();
-        final PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
-        Wait.waitForCriterion(new WaitCriterion() {
-
-          public boolean done() {
-            return expectedBuckets.equals(getActualBuckets());
-          }
-
-          public String description() {
-            return "Buckets on vm " + getActualBuckets() + " never became equal to expected "
-                + expectedBuckets;
-          }
+  void waitForBuckets(final VM vm, final Set<Integer> expectedBuckets, final String regionName) {
+    vm.invoke("waitForBuckets", () -> {
+      Cache cache = getCache();
+      final PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
 
-          public TreeSet<Integer> getActualBuckets() {
-            return new TreeSet<Integer>(region.getDataStore().getAllLocalBucketIds());
-          }
-        }, 30 * 1000, 100, true);
+      Wait.waitForCriterion(new WaitCriterion() {
+        @Override
+        public boolean done() {
+          return expectedBuckets.equals(getActualBuckets());
+        }
 
-        return null;
-      }
-    };
+        @Override
+        public String description() {
+          return "Buckets on vm " + getActualBuckets() + " never became equal to expected "
+              + expectedBuckets;
+        }
 
-    vm.invoke(getBuckets);
+        Set<Integer> getActualBuckets() {
+          return new TreeSet<>(region.getDataStore().getAllLocalBucketIds());
+        }
+      }, 30 * 1000, 100, true);
+    });
   }
 
-  protected Set<Integer> getPrimaryBucketList(VM vm0) {
-    return getPrimaryBucketList(vm0, PR_REGION_NAME);
+  Set<Integer> getPrimaryBucketList(final VM vm) {
+    return getPrimaryBucketList(vm, getPartitionedRegionName());
   }
 
-  protected Set<Integer> getPrimaryBucketList(VM vm0, final String regionName) {
-    SerializableCallable getPrimaryBuckets = new SerializableCallable("get primary buckets") {
-
-      public Object call() throws Exception {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
-        return new TreeSet<Integer>(region.getDataStore().getAllLocalPrimaryBucketIds());
-      }
-    };
-
-    return (Set<Integer>) vm0.invoke(getPrimaryBuckets);
+  Set<Integer> getPrimaryBucketList(final VM vm, final String regionName) {
+    return vm.invoke("getPrimaryBucketList", () -> {
+      Cache cache = getCache();
+      PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
+      return new TreeSet<>(region.getDataStore().getAllLocalPrimaryBucketIds());
+    });
   }
 
+  void revokeKnownMissingMembers(final VM vm, final int numExpectedMissing) {
+    vm.invoke("revokeKnownMissingMembers", () -> {
+      DistributedSystemConfig config = defineDistributedSystem(getSystem(), "");
+      AdminDistributedSystem adminDS = getDistributedSystem(config);
+      adminDS.connect();
+      try {
+        adminDS.waitToBeConnected(MAX_WAIT);
 
-  protected void revokeKnownMissingMembers(VM vm2, final int numExpectedMissing) {
-    vm2.invoke(new SerializableRunnable("Revoke the member") {
-
-      public void run() {
-        final DistributedSystemConfig config;
-        final AdminDistributedSystem adminDS;
-        try {
-          config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
-          adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
-          adminDS.connect();
-          adminDS.waitToBeConnected(MAX_WAIT);
-          try {
-            final WaitCriterion wc = new WaitCriterion() {
-
-              public boolean done() {
-                try {
-                  final Set<PersistentID> missingIds = adminDS.getMissingPersistentMembers();
-                  if (missingIds.size() != numExpectedMissing) {
-                    return false;
-                  }
-                  for (PersistentID missingId : missingIds) {
-                    adminDS.revokePersistentMember(missingId.getUUID());
-                  }
-                  return true;
-                } catch (AdminException ae) {
-                  throw new RuntimeException(ae);
-                }
+        final WaitCriterion wc = new WaitCriterion() {
+          @Override
+          public boolean done() {
+            try {
+              Set<PersistentID> missingIds = adminDS.getMissingPersistentMembers();
+              if (missingIds.size() != numExpectedMissing) {
+                return false;
               }
-
-              public String description() {
-                try {
-                  return "expected " + numExpectedMissing
-                      + " missing members for revocation, current: "
-                      + adminDS.getMissingPersistentMembers();
-                } catch (AdminException ae) {
-                  throw new RuntimeException(ae);
-                }
+              for (PersistentID missingId : missingIds) {
+                adminDS.revokePersistentMember(missingId.getUUID());
               }
-            };
-            Wait.waitForCriterion(wc, MAX_WAIT, 500, true);
-          } finally {
-            adminDS.disconnect();
+              return true;
+            } catch (AdminException e) {
+              throw new RuntimeException(e);
+            }
           }
-        } catch (Exception e) {
-          throw new RuntimeException(e);
-        }
-      }
-    });
-  }
 
-  protected void revokeAllMembers(VM vm) {
-    vm.invoke(new SerializableRunnable("Revoke the member") {
-
-      public void run() {
-        GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        DistributedSystemConfig config;
-        AdminDistributedSystem adminDS = null;
-        try {
-          config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
-          adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
-          adminDS.connect();
-          adminDS.waitToBeConnected(MAX_WAIT);
-          adminDS.revokePersistentMember(InetAddress.getLocalHost(), null);
-        } catch (RuntimeException e) {
-          throw e;
-        } catch (Exception e) {
-          throw new RuntimeException(e);
-        } finally {
-          if (adminDS != null) {
-            adminDS.disconnect();
+          @Override
+          public String description() {
+            try {
+              return "expected " + numExpectedMissing + " missing members for revocation, current: "
+                  + adminDS.getMissingPersistentMembers();
+            } catch (AdminException e) {
+              throw new RuntimeException(e);
+            }
           }
-        }
+        };
+        Wait.waitForCriterion(wc, MAX_WAIT, 500, true);
+
+      } finally {
+        adminDS.disconnect();
       }
     });
   }
 
-  protected void revokeMember(VM vm, final File directory) {
-    vm.invoke(new SerializableRunnable("Revoke the member") {
+  void revokeAllMembers(final VM vm) {
+    vm.invoke("revokeAllMembers", () -> {
+      InternalCache cache = getCache(); // TODO:KIRK: delete this line
+      DistributedSystemConfig config = defineDistributedSystem(getSystem(), "");
+      AdminDistributedSystem adminDS = getDistributedSystem(config);
+      adminDS.connect();
 
-      public void run() {
-        GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
-        DistributedSystemConfig config;
-        AdminDistributedSystem adminDS = null;
-        try {
-          config = AdminDistributedSystemFactory.defineDistributedSystem(getSystem(), "");
-          adminDS = AdminDistributedSystemFactory.getDistributedSystem(config);
-          adminDS.connect();
-          adminDS.waitToBeConnected(MAX_WAIT);
-          adminDS.revokePersistentMember(InetAddress.getLocalHost(), directory.getCanonicalPath());
-        } catch (Exception e) {
-          throw new RuntimeException(e);
-        } finally {
-          if (adminDS != null) {
-            adminDS.disconnect();
-          }
-        }
+      try {
+        adminDS.waitToBeConnected(MAX_WAIT);
+        adminDS.revokePersistentMember(InetAddress.getLocalHost(), null);
+      } finally {
+        adminDS.disconnect();
       }
     });
   }
 
-  protected boolean moveBucket(final int bucketId, VM source, VM target) {
-
-    SerializableCallable getId = new SerializableCallable("Get Id") {
-
-      public Object call() throws Exception {
-        Cache cache = getCache();
-        return cache.getDistributedSystem().getDistributedMember();
-      }
-    };
-
-    final InternalDistributedMember sourceId = (InternalDistributedMember) source.invoke(getId);
-
-    SerializableCallable move = new SerializableCallable("move bucket") {
-
-      public Object call() {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(PR_REGION_NAME);
-        return region.getDataStore().moveBucket(bucketId, sourceId, false);
+  void revokeMember(final VM vm, final File directory) {
+    vm.invoke("revokeMember", () -> {
+      InternalCache cache = getCache(); // TODO:KIRK: delete this line
+      DistributedSystemConfig config = defineDistributedSystem(getSystem(), "");
+      AdminDistributedSystem adminDS = getDistributedSystem(config);
+      adminDS.connect();
+      try {
+        adminDS.waitToBeConnected(MAX_WAIT);
+        adminDS.revokePersistentMember(InetAddress.getLocalHost(), directory.getCanonicalPath());
+      } finally {
+        adminDS.disconnect();
       }
-    };
-
-    return (Boolean) target.invoke(move);
-
+    });
   }
 
-  protected Set<PersistentMemberID> getOfflineMembers(final int bucketId, VM vm) {
-
-    SerializableCallable getId = new SerializableCallable("Get Id") {
-
-      public Object call() throws Exception {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(PR_REGION_NAME);
-        return region.getRegionAdvisor().getProxyBucketArray()[bucketId].getPersistenceAdvisor()
-            .getMembershipView().getOfflineMembers();
-      }
-    };
-
-
-    return (Set<PersistentMemberID>) vm.invoke(getId);
-
+  protected boolean moveBucket(final int bucketId, final VM source, final VM target) {
+    InternalDistributedMember sourceId = getInternalDistributedMember(source);
 
+    return target.invoke("moveBucket", () -> {
+      PartitionedRegion region =
+          (PartitionedRegion) getCache().getRegion(getPartitionedRegionName());
+      return region.getDataStore().moveBucket(bucketId, sourceId, false);
+    });
   }
 
-  protected Set<PersistentMemberID> getOnlineMembers(final int bucketId, VM vm) {
-
-    SerializableCallable getId = new SerializableCallable("Get Id") {
-
-      public Object call() throws Exception {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(PR_REGION_NAME);
-        return region.getRegionAdvisor().getProxyBucketArray()[bucketId].getPersistenceAdvisor()
-            .getPersistedOnlineOrEqualMembers();
-      }
-    };
-
-
-    return (Set<PersistentMemberID>) vm.invoke(getId);
+  private InternalDistributedMember getInternalDistributedMember(final VM vm) {
+    return (InternalDistributedMember) vm.invoke("getDistributedMember",
+        () -> getCache().getDistributedSystem().getDistributedMember());
   }
 
-  protected void waitForBucketRecovery(final VM vm2, final Set<Integer> lostBuckets) {
-    waitForBucketRecovery(vm2, lostBuckets, PR_REGION_NAME);
+  Set<PersistentMemberID> getOfflineMembers(final int bucketId, final VM vm) {
+    return vm.invoke("getOfflineMembers", () -> {
+      PartitionedRegion region =
+          (PartitionedRegion) getCache().getRegion(getPartitionedRegionName());
+      return region.getRegionAdvisor().getProxyBucketArray()[bucketId].getPersistenceAdvisor()
+          .getMembershipView().getOfflineMembers();
+    });
   }
 
-  protected void waitForBucketRecovery(final VM vm2, final Set<Integer> lostBuckets,
-      final String regionName) {
-    vm2.invoke(new SerializableRunnable() {
-      public void run() {
-        Cache cache = getCache();
-        PartitionedRegion region = (PartitionedRegion) cache.getRegion(regionName);
-        final PartitionedRegionDataStore dataStore = region.getDataStore();
-        Wait.waitForCriterion(new WaitCriterion() {
-
-          public boolean done() {
-            Set<Integer> vm2Buckets = dataStore.getAllLocalBucketIds();
-            return lostBuckets.equals(vm2Buckets);
-          }
-
-          public String description() {
-            return "expected to recover " + lostBuckets + " buckets, now have "
-                + dataStore.getAllLocalBucketIds();
-          }
-        }, MAX_WAIT, 100, true);
-      }
+  Set<PersistentMemberID> getOnlineMembers(final int bucketId, final VM vm) {
+    return vm.invoke("getOnlineMembers", () -> {
+      PartitionedRegion region =
+          (PartitionedRegion) getCache().getRegion(getPartitionedRegionName());
+      return region.getRegionAdvisor().getProxyBucketArray()[bucketId].getPersistenceAdvisor()
+          .getPersistedOnlineOrEqualMembers();
     });
   }
 
-  protected void waitForRedundancyRecovery(VM vm, final int expectedRedundancy,
-      final String regionName) {
-    vm.invoke(new SerializableRunnable() {
+  void waitForBucketRecovery(final VM vm, final Set<Integer> lostBuckets) {
+    waitForBucketRecovery(vm, lostBuckets, getPartitionedRegionName());
+  }
 
-      public void run() {
-        Cache cache = getCache();
-        final Region region = cache.getRegion(regionName);
-        Wait.waitForCriterion(new WaitCriterion() {
+  private void waitForBucketRecovery(final VM vm, final Set<Integer> lostBuckets,
+      final String regionName) {
+    vm.invoke("waitForBucketRecovery", () -> {
+      PartitionedRegion region = (PartitionedRegion) getCache().getRegion(regionName);
+      PartitionedRegionDataStore dataStore = region.getDataStore();
 
-          public boolean done() {
-            PartitionRegionInfo info = PartitionRegionHelper.getPartitionRegionInfo(region);
-            return info.getActualRedundantCopies() == expectedRedundancy;
-          }
+      Wait.waitForCriterion(new WaitCriterion() {
+        @Override
+        public boolean done() {
+          Set<Integer> vm2Buckets = dataStore.getAllLocalBucketIds();
+          return lostBuckets.equals(vm2Buckets);
+        }
 
-          public String description() {
-            PartitionRegionInfo info = PartitionRegionHelper.getPartitionRegionInfo(region);
-            return "Did not reach expected redundancy " + expectedRedundancy + " redundancy info = "
-                + info.getActualRedundantCopies();
-          }
-        }, 30 * 1000, 100, true);
-      }
+        @Override
+        public String description() {
+          return "expected to recover " + lostBuckets + " buckets, now have "
+              + dataStore.getAllLocalBucketIds();
+        }
+      }, MAX_WAIT, 100, true);
     });
   }
 
-  protected void invalidateData(VM vm, final int startKey, final int endKey) {
-    SerializableRunnable createData = new SerializableRunnable() {
+  void waitForRedundancyRecovery(final VM vm, final int expectedRedundancy,
+      final String regionName) {
+    vm.invoke("waitForRedundancyRecovery", () -> {
+      Region region = getCache().getRegion(regionName);
 
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(PR_REGION_NAME);
+      Wait.waitForCriterion(new WaitCriterion() {
+        @Override
+        public boolean done() {
+          PartitionRegionInfo info = PartitionRegionHelper.getPartitionRegionInfo(region);
+          return info.getActualRedundantCopies() == expectedRedundancy;
+        }
 
-        for (int i = startKey; i < endKey; i++) {
-          region.destroy(i);
-          region.create(i, null);
-          region.invalidate(i);
+        @Override
+        public String description() {
+          PartitionRegionInfo info = PartitionRegionHelper.getPartitionRegionInfo(region);
+          return "Did not reach expected redundancy " + expectedRedundancy + " redundancy info = "
+              + info.getActualRedundantCopies();
         }
-      }
-    };
-    vm.invoke(createData);
+      }, 30 * 1000, 100, true);
+    });
   }
 
-  // used for above test
-  protected BackupStatus backup(VM vm) {
-    return (BackupStatus) vm.invoke(new SerializableCallable("Backup all members") {
-
-      public Object call() {
-        try {
-          return BackupUtil.backupAllMembers(getSystem().getDistributionManager(), getBackupDir(),
-              null);
-        } catch (ManagementException e) {
-          throw new RuntimeException(e);
-        }
+  protected BackupStatus backup(final VM vm) {
+    return vm.invoke("backup", () -> {
+      try {
+        return BackupUtil.backupAllMembers(getSystem().getDistributionManager(), getBackupDir(),
+            null);
+      } catch (ManagementException e) {
+        throw new RuntimeException(e);
       }
     });
   }
 
-  protected void restoreBackup(int expectedNumScripts) throws IOException, InterruptedException {
-    Collection<File> restoreScripts = FileUtils.listFiles(getBackupDir(),
-        new RegexFileFilter(".*restore.*"), DirectoryFileFilter.DIRECTORY);
-    assertEquals("Restore scripts " + restoreScripts, expectedNumScripts, restoreScripts.size());
+  protected void restoreBackup(final int expectedNumScripts)
+      throws IOException, InterruptedException {
+    Collection<File> restoreScripts =
+        listFiles(getBackupDir(), new RegexFileFilter(".*restore.*"), DIRECTORY);
+    assertThat(restoreScripts).hasSize(expectedNumScripts);
     for (File script : restoreScripts) {
       execute(script);
     }
-
   }
 
-  private void execute(File script) throws IOException, InterruptedException {
-    ProcessBuilder pb = new ProcessBuilder(script.getAbsolutePath());
-    pb.redirectErrorStream(true);
-    Process process = pb.start();
+  private void execute(final File script) throws IOException, InterruptedException {
+    ProcessBuilder processBuilder = new ProcessBuilder(script.getAbsolutePath());
+    processBuilder.redirectErrorStream(true);
+    Process process = processBuilder.start();
+
+    try (BufferedReader reader =
+        new BufferedReader(new InputStreamReader(process.getInputStream()))) {
+      String line;
+      while ((line = reader.readLine()) != null) {
+        logger.info("OUTPUT:" + line);
+        // TODO validate output
+      }
+    }
 
-    InputStream is = process.getInputStream();
-    byte[] buffer = new byte[1024];
-    BufferedReader br = new BufferedReader(new InputStreamReader(is));
-    String line;
-    while ((line = br.readLine()) != null) {
-      LogWriterUtils.getLogWriter().fine("OUTPUT:" + line);
-      // TODO validate output
-    } ;
+    assertThat(process.waitFor()).isEqualTo(0);
+  }
 
-    assertEquals(0, process.waitFor());
+  public String getPartitionedRegionName() {
+    return partitionedRegionName;
+  }
 
+  String getChildRegionName() {
+    return CHILD_REGION_NAME;
   }
 
   protected static File getBackupDir() {
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
index 5da461b..135bbca 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
@@ -22,7 +22,9 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheTransactionManager;
 import org.apache.geode.cache.Region;
+import org.apache.geode.internal.cache.DiskRegion;
 import org.apache.geode.internal.cache.DiskStoreImpl;
+import org.apache.geode.internal.cache.PartitionedRegion;
 import org.apache.geode.internal.cache.TXManagerImpl;
 import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.Host;
@@ -30,8 +32,6 @@ import org.apache.geode.test.dunit.Invoke;
 import org.apache.geode.test.dunit.LogWriterUtils;
 import org.apache.geode.test.dunit.SerializableRunnable;
 import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
 import org.apache.geode.test.junit.categories.DistributedTest;
 
 /**
@@ -120,7 +120,7 @@ public class PersistentPartitionedRegionWithTransactionDUnitTest
         Cache cache = getCache();
 
         CacheTransactionManager tx = cache.getCacheTransactionManager();
-        Region region = cache.getRegion(PR_REGION_NAME);
+        Region region = cache.getRegion(getPartitionedRegionName());
 
         for (int i = startKey; i < endKey; i++) {
           tx.begin();
@@ -169,7 +169,7 @@ public class PersistentPartitionedRegionWithTransactionDUnitTest
   }
 
   @Override
-  protected void checkData(VM vm0, final int startKey, final int endKey, final String value,
+  protected void checkData(VM vm, final int startKey, final int endKey, final String value,
       final String regionName) {
     SerializableRunnable checkData = new SerializableRunnable() {
 
@@ -187,6 +187,24 @@ public class PersistentPartitionedRegionWithTransactionDUnitTest
       }
     };
 
-    vm0.invoke(checkData);
+    vm.invoke(checkData);
+  }
+
+  void checkRecoveredFromDisk(VM vm, final int bucketId, final boolean recoveredLocally) {
+    vm.invoke(new SerializableRunnable("check recovered from disk") {
+      @Override
+      public void run() {
+        Cache cache = getCache();
+        PartitionedRegion region = (PartitionedRegion) cache.getRegion(getPartitionedRegionName());
+        DiskRegion disk = region.getRegionAdvisor().getBucket(bucketId).getDiskRegion();
+        if (recoveredLocally) {
+          assertEquals(0, disk.getStats().getRemoteInitializations());
+          assertEquals(1, disk.getStats().getLocalInitializations());
+        } else {
+          assertEquals(1, disk.getStats().getRemoteInitializations());
+          assertEquals(0, disk.getStats().getLocalInitializations());
+        }
+      }
+    });
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
index df17039..9dcf90b 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/persistence/PersistentRecoveryOrderDUnitTest.java
@@ -1213,7 +1213,7 @@ public class PersistentRecoveryOrderDUnitTest extends PersistentReplicatedTestBa
           }
 
           @Override
-          public void beforeSendMessage(DistributionManager dm, DistributionMessage msg) {}
+          public void beforeSendMessage(DistributionManager dm, DistributionMessage message) {}
         });
       }
     });
diff --git a/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
index c97b83c..3ddb041 100644
--- a/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/RegionManagementDUnitTest.java
@@ -68,7 +68,6 @@ import org.apache.geode.management.internal.MBeanJMXAdapter;
 import org.apache.geode.management.internal.SystemManagementService;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.categories.FlakyTest;
 
 /**
  * Distributed tests for {@link RegionMXBean}.
@@ -217,7 +216,6 @@ public class RegionManagementDUnitTest implements Serializable {
    * asynchronously.
    */
   @Test
-  @Category(FlakyTest.class) // GEODE-1930
   public void testRegionAggregate() throws Exception {
     createManagersAndThenMembers();
 
@@ -247,7 +245,6 @@ public class RegionManagementDUnitTest implements Serializable {
   }
 
   @Test
-  @Category(FlakyTest.class) // GEODE-3335
   public void testNavigationAPIS() throws Exception {
     createManagersAndThenMembers();
 
@@ -299,7 +296,6 @@ public class RegionManagementDUnitTest implements Serializable {
   }
 
   @Test
-  @Category(FlakyTest.class) // GEODE-1930
   public void testLruStats() throws Exception {
     createMembersAndThenManagers();
     for (VM memberVM : this.memberVMs) {
@@ -407,7 +403,8 @@ public class RegionManagementDUnitTest implements Serializable {
       ManagementService service = getManagementService();
       assertThat(service.getDistributedSystemMXBean()).isNotNull();
 
-      awaitMemberCount(4);
+      // With the DUnit framework there is a locator, a manager and 3 members
+      awaitMemberCount(5);
 
       DistributedSystemMXBean distributedSystemMXBean = service.getDistributedSystemMXBean();
       assertThat(distributedSystemMXBean.listDistributedRegionObjectNames()).hasSize(2);
@@ -520,7 +517,7 @@ public class RegionManagementDUnitTest implements Serializable {
     assertThat(fixedPartitionAttributesData).isNotNull();
     assertThat(fixedPartitionAttributesData).hasSize(3);
 
-    for (int i = 0; i < fixedPartitionAttributesData.length; i++) {
+    for (FixedPartitionAttributesData aFixedPartitionAttributesData : fixedPartitionAttributesData) {
       // TODO: add real assertions
       // LogWriterUtils.getLogWriter().info("<ExpectedString> Fixed PR Data is " +
       // fixedPartitionAttributesData[i] + "</ExpectedString> ");
@@ -971,7 +968,7 @@ public class RegionManagementDUnitTest implements Serializable {
         assertThat(fixedPrData).isNotNull();
         assertThat(fixedPrData).hasSize(3);
 
-        for (int i = 0; i < fixedPrData.length; i++) {
+        for (FixedPartitionAttributesData aFixedPrData : fixedPrData) {
           // TODO: add real assertions
           // LogWriterUtils.getLogWriter().info("<ExpectedString> Remote PR Data is " +
           // fixedPrData[i] + "</ExpectedString> ");
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/beans/DistributedSystemBridgeJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/beans/DistributedSystemBridgeJUnitTest.java
index 2c34ddd..c742c5f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/beans/DistributedSystemBridgeJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/beans/DistributedSystemBridgeJUnitTest.java
@@ -26,13 +26,13 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.mockito.InOrder;
 
-import org.apache.geode.admin.internal.BackupDataStoreHelper;
-import org.apache.geode.admin.internal.FinishBackupRequest;
-import org.apache.geode.admin.internal.PrepareBackupRequest;
 import org.apache.geode.distributed.internal.DM;
 import org.apache.geode.distributed.internal.locks.DLockService;
-import org.apache.geode.internal.cache.BackupManager;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.backup.BackupDataStoreHelper;
+import org.apache.geode.internal.cache.backup.BackupManager;
+import org.apache.geode.internal.cache.backup.FinishBackupRequest;
+import org.apache.geode.internal.cache.backup.PrepareBackupRequest;
 import org.apache.geode.internal.cache.persistence.PersistentMemberManager;
 import org.apache.geode.test.fake.Fakes;
 import org.apache.geode.test.junit.categories.UnitTest;
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java
index 6d2e9cc..f1050d8 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java
@@ -12,376 +12,179 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
+
 package org.apache.geode.management.internal.cli;
 
-import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
-import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
+import java.util.Arrays;
 import java.util.Properties;
 import java.util.Set;
+import java.util.stream.Collectors;
 
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionFactory;
-import org.apache.geode.cache.RegionShortcut;
-import org.apache.geode.cache.execute.FunctionAdapter;
-import org.apache.geode.cache.execute.FunctionContext;
-import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.ConfigurationProperties;
 import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.management.DistributedRegionMXBean;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.RegionMXBean;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.LogWriterUtils;
-import org.apache.geode.test.dunit.SerializableCallable;
-import org.apache.geode.test.dunit.SerializableRunnable;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.Wait;
-import org.apache.geode.test.dunit.WaitCriterion;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.management.internal.cli.exceptions.UserErrorException;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
-public class CliUtilDUnitTest extends JUnit4CacheTestCase {
-
-  public static final String COMMON_REGION = "region1";
-  public static final String COMMON_REGION_GROUP1 = "region_group1";
-  public static final String COMMON_REGION_GROUP2 = "region_group2";
-  public static final String REGION_MEMBER1_GROUP1 = "region_member1_group1";
-  public static final String REGION_MEMBER2_GROUP1 = "region_member2_group1";
-  public static final String REGION_MEMBER1_GROUP2 = "region_member1_group2";
-  public static final String REGION_MEMBER2_GROUP2 = "region_member2_group2";
-
-  public static final String MEMBER_1_GROUP1 = "member1_group1";
-  public static final String MEMBER_2_GROUP1 = "member2_group1";
-  public static final String MEMBER_1_GROUP2 = "member1_group2";
-  public static final String MEMBER_2_GROUP2 = "member2_group2";
-
-  public static final String GROUP1 = "group1";
-  public static final String GROUP2 = "group2";
-
-  private static final long serialVersionUID = 1L;
-
-  @Override
-  public final void preTearDownCacheTestCase() throws Exception {
-    destroySetup();
+public class CliUtilDUnitTest {
+
+  @ClassRule
+  public static LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @ClassRule
+  public static GfshCommandRule gfsh = new GfshCommandRule();
+
+  private static MemberVM locator;
+  private static Set<DistributedMember> members;
+
+  @BeforeClass
+  public static void setUpCluster() throws Exception {
+    locator = lsRule.startLocatorVM(0);
+    gfsh.connectAndVerify(locator);
+
+    Properties properties = new Properties();
+    properties.setProperty(ConfigurationProperties.NAME, "member1");
+    properties.setProperty(ConfigurationProperties.GROUPS, "group1");
+    lsRule.startServerVM(1, properties, locator.getPort());
+
+    properties.setProperty(ConfigurationProperties.NAME, "member2");
+    properties.setProperty(ConfigurationProperties.GROUPS, "group1");
+    lsRule.startServerVM(2, properties, locator.getPort());
+
+    properties.setProperty(ConfigurationProperties.NAME, "member3");
+    properties.setProperty(ConfigurationProperties.GROUPS, "group2");
+    lsRule.startServerVM(3, properties, locator.getPort());
+
+    properties.setProperty(ConfigurationProperties.NAME, "member4");
+    properties.setProperty(ConfigurationProperties.GROUPS, "group2");
+    lsRule.startServerVM(4, properties, locator.getPort());
+
+    // create regions
+    gfsh.executeAndAssertThat("create region --name=commonRegion --type=REPLICATE")
+        .statusIsSuccess();
+    gfsh.executeAndAssertThat("create region --name=group1Region --group=group1 --type=REPLICATE")
+        .statusIsSuccess();
+    gfsh.executeAndAssertThat("create region --name=group2Region --group=group2 --type=REPLICATE")
+        .statusIsSuccess();
+
+    locator.waitTillRegionsAreReadyOnServers("/commonRegion", 4);
+    locator.waitTillRegionsAreReadyOnServers("/group1Region", 2);
+    locator.waitTillRegionsAreReadyOnServers("/group2Region", 2);
   }
 
-  protected final void destroySetup() {
-    disconnectAllFromDS();
-  }
-
-  @SuppressWarnings("serial")
-  void setupMembersWithIdsAndGroups() {
-    final VM vm1 = Host.getHost(0).getVM(0);
-    final VM vm2 = Host.getHost(0).getVM(1);
-    final VM vm3 = Host.getHost(0).getVM(2);
-    final VM vm4 = Host.getHost(0).getVM(3);
-
-    vm1.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        createCacheWithMemberIdAndGroup(MEMBER_1_GROUP1, GROUP1);
-        createRegion(REGION_MEMBER1_GROUP1);
-        createRegion(COMMON_REGION_GROUP1);
-        createRegion(COMMON_REGION);
-      }
-    });
-
-    vm2.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        createCacheWithMemberIdAndGroup(MEMBER_2_GROUP1, GROUP1);
-        createRegion(REGION_MEMBER2_GROUP1);
-        createRegion(COMMON_REGION_GROUP1);
-        createRegion(COMMON_REGION);
-      }
-    });
-
-    vm3.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        createCacheWithMemberIdAndGroup(MEMBER_1_GROUP2, GROUP2);
-        createRegion(REGION_MEMBER1_GROUP2);
-        createRegion(COMMON_REGION_GROUP2);
-        createRegion(COMMON_REGION);
-      }
-    });
-
-    vm4.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        createCacheWithMemberIdAndGroup(MEMBER_2_GROUP2, GROUP2);
-        createRegion(REGION_MEMBER2_GROUP2);
-        createRegion(COMMON_REGION_GROUP2);
-        createRegion(COMMON_REGION);
-      }
-    });
-
-    vm1.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        startManager();
-      }
+  @Test
+  public void findMembers() throws Exception {
+    locator.invoke(() -> {
+      // can't pass in both group and names
+      assertThatThrownBy(() -> CliUtil.findMembers("group1".split(","), "member1".split(",")))
+          .isInstanceOf(UserErrorException.class);
+
+      // finds all servers
+      members = CliUtil.findMembers(null, null);
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member2", "member3",
+          "member4");
+
+      // find only one member
+      members = CliUtil.findMembers(null, "member1".split(","));
+      assertThat(getNames(members)).containsExactly("member1");
+
+      // find multiple members
+      members = CliUtil.findMembers(null, "member1,member3".split(","));
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member3");
+
+      // find multiple members
+      members = CliUtil.findMembers(null, "MembER1,member3".split(","));
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member3");
+
+      // find only one group
+      members = CliUtil.findMembers("group1".split(","), null);
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member2");
+
+      // find multiple groups
+      members = CliUtil.findMembers("group1,group2".split(","), null);
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member2", "member3",
+          "member4");
     });
   }
 
-  private void startManager() {
-    final ManagementService service = ManagementService.getManagementService(getCache());
-    service.startManager();
-    assertEquals(true, service.isManager());
-    assertNotNull(service.getManagerMXBean());
-    assertTrue(service.getManagerMXBean().isRunning());
-    final WaitCriterion waitForMaangerMBean = new WaitCriterion() {
-      @Override
-      public boolean done() {
-        boolean flag = checkBean(COMMON_REGION, 4) && checkBean(COMMON_REGION_GROUP1, 2)
-            && checkBean(COMMON_REGION_GROUP2, 2) && checkBean(REGION_MEMBER1_GROUP1, 1)
-            && checkBean(REGION_MEMBER2_GROUP1, 1) && checkBean(REGION_MEMBER1_GROUP2, 1)
-            && checkBean(REGION_MEMBER2_GROUP2, 1);
-        if (!flag) {
-          LogWriterUtils.getLogWriter().info("Still probing for mbeans");
-          return false;
-        } else {
-          LogWriterUtils.getLogWriter()
-              .info("All distributed region mbeans are federated to manager.");
-          return true;
-        }
-      }
-
-      private boolean checkBean(String string, int memberCount) {
-        DistributedRegionMXBean bean2 =
-            service.getDistributedRegionMXBean(Region.SEPARATOR + string);
-        LogWriterUtils.getLogWriter()
-            .info("DistributedRegionMXBean for region=" + string + " is " + bean2);
-        if (bean2 == null)
-          return false;
-        else {
-          int members = bean2.getMemberCount();
-          LogWriterUtils.getLogWriter().info("DistributedRegionMXBean for region=" + string
-              + " is aggregated for " + memberCount + " expected count=" + memberCount);
-          if (members < memberCount) {
-            return false;
-          } else {
-            return true;
-          }
-        }
-      }
-
-      @Override
-      public String description() {
-        return "Probing for ManagerMBean";
-      }
-    };
-
-    Wait.waitForCriterion(waitForMaangerMBean, 120000, 2000, true);
-    LogWriterUtils.getLogWriter().info("Manager federation is complete");
-  }
-
-  @SuppressWarnings("rawtypes")
-  private Region createRegion(String regionName) {
-    RegionFactory regionFactory = getCache().createRegionFactory(RegionShortcut.REPLICATE);
-    Region region = regionFactory.create(regionName);
-    final ManagementService service = ManagementService.getManagementService(getCache());
-    assertNotNull(service.getMemberMXBean());
-    RegionMXBean bean = service.getLocalRegionMBean(Region.SEPARATOR + regionName);
-    assertNotNull(bean);
-    LogWriterUtils.getLogWriter().info("Created region=" + regionName + " Bean=" + bean);
-    return region;
-  }
-
-  public void createCacheWithMemberIdAndGroup(String memberName, String groupName) {
-    Properties localProps = new Properties();
-    localProps.setProperty(NAME, memberName);
-    localProps.setProperty(GROUPS, groupName);
-    localProps.setProperty(JMX_MANAGER, "true");
-    localProps.setProperty(JMX_MANAGER_START, "false");
-    int jmxPort = AvailablePortHelper.getRandomAvailableTCPPort();
-    localProps.setProperty(JMX_MANAGER_PORT, "" + jmxPort);
-    LogWriterUtils.getLogWriter().info("Set jmx-port=" + jmxPort);
-    getSystem(localProps);
-    getCache();
-    final ManagementService service = ManagementService.getManagementService(getCache());
-    assertNotNull(service.getMemberMXBean());
+  public void getMember() throws Exception {
+    locator.invoke(() -> {
+      assertThat(CliUtil.getDistributedMemberByNameOrId("notValidName")).isNull();
+      assertThat(CliUtil.getDistributedMemberByNameOrId("member1").getName()).isEqualTo("member1");
+      assertThat(CliUtil.getDistributedMemberByNameOrId("MembER1").getName()).isEqualTo("member1");
+    });
   }
 
-  @SuppressWarnings("serial")
   @Test
-  public void testCliUtilMethods() {
-    setupMembersWithIdsAndGroups();
-
-    final VM vm1 = Host.getHost(0).getVM(0);
-
-    LogWriterUtils.getLogWriter().info("testFor - findMembersOrThrow");
-    vm1.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        verifyFindAllMatchingMembers();
-      }
-    });
-
-    final String id = (String) vm1.invoke(new SerializableCallable() {
-      @Override
-      public Object call() throws Exception {
-        InternalCache cache = getCache();
-        return cache.getDistributedSystem().getDistributedMember().getId();
-      }
-    });
-
-    LogWriterUtils.getLogWriter().info("testFor - getDistributedMemberByNameOrId");
-    vm1.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        getDistributedMemberByNameOrId(MEMBER_1_GROUP1, id);
-      }
-    });
-
-    LogWriterUtils.getLogWriter().info("testFor - executeFunction");
-    vm1.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        verifyExecuteFunction();
-      }
-    });
-
-    LogWriterUtils.getLogWriter().info("testFor - getRegionAssociatedMembers");
-    vm1.invoke(new SerializableRunnable() {
-      @Override
-      public void run() {
-        getRegionAssociatedMembers();
-      }
+  public void getAllMembers() throws Exception {
+    locator.invoke(() -> {
+      InternalCache cache = LocatorServerStartupRule.getCache();
+      members = CliUtil.getAllMembers(cache);
+      assertThat(getNames(members)).containsExactlyInAnyOrder("locator-0", "member1", "member2",
+          "member3", "member4");
+
+      members = CliUtil.getAllNormalMembers(cache);
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member2", "member3",
+          "member4");
     });
   }
 
-  public void verifyFindAllMatchingMembers() {
-    Set<DistributedMember> set = CliUtil.findMembers(GROUP1.split(","), null);
-    assertNotNull(set);
-    assertEquals(2, set.size());
-    assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
-    assertEquals(true, containsMember(set, MEMBER_2_GROUP1));
-
-    set = CliUtil.findMembers(new String[] {"group1", "group2"}, null);
-    assertNotNull(set);
-    assertEquals(4, set.size());
-    assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
-    assertEquals(true, containsMember(set, MEMBER_2_GROUP1));
-    assertEquals(true, containsMember(set, MEMBER_1_GROUP2));
-    assertEquals(true, containsMember(set, MEMBER_2_GROUP2));
-
-    set = CliUtil.findMembers(null, MEMBER_1_GROUP1.split(","));
-    assertNotNull(set);
-    assertEquals(1, set.size());
-    assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
-
-    set = CliUtil.findMembers(null, new String[] {"member1_group1", "member2_group2"});
-    assertNotNull(set);
-    assertEquals(2, set.size());
-    assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
-    assertEquals(true, containsMember(set, MEMBER_2_GROUP2));
-  }
-
-  private Object containsMember(Set<DistributedMember> set, String string) {
-    boolean returnValue = false;
-    for (DistributedMember member : set)
-      if (member.getName().equals(string))
-        return true;
-    return returnValue;
+  @Test
+  public void getRegionAssociatedMembers() throws Exception {
+    locator.invoke(() -> {
+      InternalCache cache = LocatorServerStartupRule.getCache();
+      members = CliUtil.getRegionAssociatedMembers("commonRegion", cache, true);
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member2", "member3",
+          "member4");
+
+      members = CliUtil.getRegionAssociatedMembers("group1Region", cache, true);
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member2");
+    });
   }
 
-  public void getDistributedMemberByNameOrId(String name, String id) {
-    DistributedMember member = CliUtil.getDistributedMemberByNameOrId(name);
-    assertNotNull(member);
-
-    member = CliUtil.getDistributedMemberByNameOrId(id);
-    assertNotNull(member);
+  @Test
+  public void getRegionsAssociatedMembers() throws Exception {
+    locator.invoke(() -> {
+      InternalCache cache = LocatorServerStartupRule.getCache();
+      // this finds the members that host both these two regions
+      Set<String> regions =
+          Arrays.stream("commonRegion,group1Region".split(",")).collect(Collectors.toSet());
+      members = CliUtil.getQueryRegionsAssociatedMembers(regions, cache, true);
+      assertThat(getNames(members)).containsExactlyInAnyOrder("member1", "member2");
+
+      regions = Arrays.stream("group1Region,group2Region".split(",")).collect(Collectors.toSet());
+      members = CliUtil.getQueryRegionsAssociatedMembers(regions, cache, true);
+      assertThat(getNames(members)).isEmpty();
+    });
   }
 
-  public void verifyExecuteFunction() {
-    DunitFunction function = new DunitFunction("myfunction");
-    Set<DistributedMember> set;
-    @SuppressWarnings("rawtypes")
-    Region region1 = getCache().getRegion(COMMON_REGION);
-    region1.clear();
-    set = CliUtil.findMembers(GROUP1.split(","), null);
-    assertEquals(2, set.size());
-    ResultCollector collector = CliUtil.executeFunction(function, "executeOnGroup", set);
-    collector.getResult();
-    assertEquals(2, region1.size());
-    assertTrue(region1.containsKey(MEMBER_1_GROUP1));
-    assertTrue(region1.containsKey(MEMBER_2_GROUP1));
-    assertEquals("executeOnGroup", region1.get(MEMBER_1_GROUP1));
-    assertEquals("executeOnGroup", region1.get(MEMBER_2_GROUP1));
+  @Test
+  public void getMemberByNameOrId() throws Exception {
+    locator.invoke(() -> {
+      DistributedMember member = CliUtil.getDistributedMemberByNameOrId("member1");
+      assertThat(member.getName()).isEqualTo("member1");
+      assertThat(member.getId()).contains("member1:");
+      assertThat(member.getGroups()).containsExactly("group1");
+
+      member = CliUtil.getDistributedMemberByNameOrId("member100");
+      assertThat(member).isNull();
+    });
   }
 
-  public void getRegionAssociatedMembers() {
-    String region_group1 = "/region_group1";
-    String region1 = "/region1";
-    String region_member2_group1 = "/region_member2_group1";
-
-    InternalCache cache = getCache();
-
-    Set<DistributedMember> set = CliUtil.getRegionAssociatedMembers(region1, cache, true);
-    assertNotNull(set);
-    assertEquals(4, set.size());
-    assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
-    assertEquals(true, containsMember(set, MEMBER_2_GROUP1));
-    assertEquals(true, containsMember(set, MEMBER_1_GROUP2));
-    assertEquals(true, containsMember(set, MEMBER_2_GROUP2));
-
-    /*
-     * TODO: This is failing because last param is not considered in method set =
-     * CliUtil.getRegionAssociatedMembers(region1, cache, false); assertNotNull(set);
-     * assertIndexDetailsEquals(1, set.size());
-     */
-
-    set = CliUtil.getRegionAssociatedMembers(region_group1, cache, true);
-    assertNotNull(set);
-    assertEquals(2, set.size());
-    assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
-    assertEquals(true, containsMember(set, MEMBER_2_GROUP1));
-
-    set = CliUtil.getRegionAssociatedMembers(region_member2_group1, cache, true);
-    assertNotNull(set);
-    assertEquals(1, set.size());
-    assertEquals(true, containsMember(set, MEMBER_2_GROUP1));
-  }
 
-  public static class DunitFunction extends FunctionAdapter {
-
-    private static final long serialVersionUID = 1L;
-    private String id;
-
-    public DunitFunction(String fid) {
-      this.id = fid;
-    }
-
-    @Override
-    public void execute(FunctionContext context) {
-      Object object = context.getArguments();
-      InternalCache cache = (InternalCache) CacheFactory.getAnyInstance();
-      @SuppressWarnings("rawtypes")
-      Region region = cache.getRegion(COMMON_REGION);
-      String id = cache.getDistributedSystem().getDistributedMember().getName();
-      region.put(id, object);
-      LogWriterUtils.getLogWriter().info("Completed executeFunction on member : " + id);
-      context.getResultSender().lastResult(true);
-    }
-
-    @Override
-    public String getId() {
-      return id;
-    }
+  private static Set<String> getNames(Set<DistributedMember> members) {
+    return members.stream().map(DistributedMember::getName).collect(Collectors.toSet());
   }
-
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
index 9649ab5..571d2b5 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
@@ -28,7 +28,7 @@ import org.apache.geode.internal.AvailablePortHelper;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class NetstatDUnitTest {
@@ -36,7 +36,7 @@ public class NetstatDUnitTest {
   public static LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @ClassRule
-  public static GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public static GfshCommandRule gfshConnector = new GfshCommandRule();
 
   private static int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(3);
 
@@ -75,40 +75,40 @@ public class NetstatDUnitTest {
 
   @Test
   public void testConnectToLocator() throws Exception {
-    gfshConnector.connect(ports[0], GfshShellConnectionRule.PortType.locator);
+    gfshConnector.connect(ports[0], GfshCommandRule.PortType.locator);
     gfshConnector.executeAndAssertThat(netStatCommand).statusIsSuccess();
   }
 
   @Test
   public void testConnectToJmxManagerOne() throws Exception {
-    gfshConnector.connect(ports[1], GfshShellConnectionRule.PortType.jmxManager);
+    gfshConnector.connect(ports[1], GfshCommandRule.PortType.jmxManager);
     gfshConnector.executeAndAssertThat(netStatCommand).statusIsSuccess();
   }
 
   @Test
   public void testConnectToJmxManagerTwo() throws Exception {
-    gfshConnector.connect(ports[2], GfshShellConnectionRule.PortType.jmxManager);
+    gfshConnector.connect(ports[2], GfshCommandRule.PortType.jmxManager);
     gfshConnector.executeAndAssertThat(netStatCommand).statusIsSuccess();
   }
 
   @Ignore("GEODE-2488")
   @Test
   public void testConnectToLocatorWithLargeCommandResponse() throws Exception {
-    gfshConnector.connect(ports[0], GfshShellConnectionRule.PortType.locator);
+    gfshConnector.connect(ports[0], GfshCommandRule.PortType.locator);
     gfshConnector.executeAndAssertThat(netStatLsofCommand).statusIsSuccess();
   }
 
   @Ignore("GEODE-2488")
   @Test
   public void testConnectToJmxManagerOneWithLargeCommandResponse() throws Exception {
-    gfshConnector.connect(ports[1], GfshShellConnectionRule.PortType.jmxManager);
+    gfshConnector.connect(ports[1], GfshCommandRule.PortType.jmxManager);
     gfshConnector.executeAndAssertThat(netStatLsofCommand).statusIsSuccess();
   }
 
   @Ignore("GEODE-2488")
   @Test
   public void testConnectToJmxManagerTwoWithLargeCommandResponse() throws Exception {
-    gfshConnector.connect(ports[2], GfshShellConnectionRule.PortType.jmxManager);
+    gfshConnector.connect(ports[2], GfshCommandRule.PortType.jmxManager);
     gfshConnector.executeAndAssertThat(netStatLsofCommand).statusIsSuccess();
   }
 
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommandIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommandIntegrationTest.java
index 44aa4e1..5ab4faf 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommandIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRegionCommandIntegrationTest.java
@@ -22,7 +22,7 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category(IntegrationTest.class)
@@ -32,11 +32,11 @@ public class AlterRegionCommandIntegrationTest {
       new ServerStarterRule().withJMXManager().withRegion(RegionShortcut.REPLICATE, "REPLICATED");
 
   @ClassRule
-  public static GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public static GfshCommandRule gfsh = new GfshCommandRule();
 
   @BeforeClass
   public static void before() throws Exception {
-    gfsh.connectAndVerify(server.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(server.getJmxPort(), GfshCommandRule.PortType.jmxManager);
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommandDUnitTest.java
index d417995..3fd908c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommandDUnitTest.java
@@ -16,8 +16,8 @@ package org.apache.geode.management.internal.cli.commands;
 
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.http;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.jmxManager;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.http;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.jmxManager;
 
 import java.util.Properties;
 
@@ -31,7 +31,7 @@ import org.junit.runners.Parameterized;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 
 @Category(DistributedTest.class)
@@ -48,7 +48,7 @@ public class ChangeLogLevelCommandDUnitTest {
   public static LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @ClassRule
-  public static GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public static GfshCommandRule gfsh = new GfshCommandRule();
 
 
   @Parameterized.Parameter
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConcurrentDeployDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConcurrentDeployDUnitTest.java
index f4e6635..3449c21 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConcurrentDeployDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConcurrentDeployDUnitTest.java
@@ -27,7 +27,7 @@ import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.JarFileRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
@@ -44,7 +44,7 @@ public class ConcurrentDeployDUnitTest {
   public JarFileRule jar1Rule = new JarFileRule("classOne", "jar1.jar", true);
 
   // This is a reference used to refer to connections in VM 2 and VM 3
-  private static GfshShellConnectionRule gfsh;
+  private static GfshCommandRule gfsh;
 
   private VM gfsh1, gfsh2, gfsh3;
 
@@ -79,8 +79,8 @@ public class ConcurrentDeployDUnitTest {
   }
 
   public static void connectToLocator(int locatorPort) throws Exception {
-    gfsh = new GfshShellConnectionRule();
-    gfsh.connectAndVerify(locatorPort, GfshShellConnectionRule.PortType.locator);
+    gfsh = new GfshCommandRule();
+    gfsh.connectAndVerify(locatorPort, GfshCommandRule.PortType.locator);
   }
 
   public static void loopThroughDeployAndUndeploys(File jar1) throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommandDUnitTest.java
new file mode 100644
index 0000000..4206597
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommandDUnitTest.java
@@ -0,0 +1,218 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.commands;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.distributed.ConfigurationProperties;
+import org.apache.geode.distributed.Locator;
+import org.apache.geode.distributed.internal.ClusterConfigurationService;
+import org.apache.geode.distributed.internal.InternalLocator;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
+
+@Category(DistributedTest.class)
+public class CreateDefinedIndexesCommandDUnitTest {
+  private MemberVM locator, server1, server2, server3;
+
+  @Rule
+  public GfshCommandRule gfsh = new GfshCommandRule();
+
+  @Rule
+  public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
+
+  @Rule
+  public TestName testName = new SerializableTestName();
+
+  @Before
+  public void before() throws Exception {
+    locator = locatorServerStartupRule.startLocatorVM(0);
+    server1 = locatorServerStartupRule.startServerVM(1, locator.getPort());
+    server2 = locatorServerStartupRule.startServerVM(2, locator.getPort());
+
+    Properties server3Properties = new Properties();
+    server3Properties.setProperty(ConfigurationProperties.LOCATORS,
+        "localhost[" + locator.getPort() + "]");
+    server3Properties.setProperty(ConfigurationProperties.GROUPS, "group1");
+    server3 = locatorServerStartupRule.startServerVM(3, server3Properties);
+
+    gfsh.connectAndVerify(locator);
+    gfsh.executeAndAssertThat("clear defined indexes").statusIsSuccess()
+        .containsOutput("Index definitions successfully cleared");
+  }
+
+  @Test
+  public void noDefinitions() {
+    gfsh.executeAndAssertThat("create defined indexes").statusIsSuccess()
+        .containsOutput("No indexes defined");
+  }
+
+  @Test
+  public void nonexistentRegion() {
+    String regionName = testName.getMethodName();
+
+    MemberVM.invokeInEveryMember(() -> {
+      Cache cache = LocatorServerStartupRule.getCache();
+      assertThat(cache.getRegion(regionName)).isNull();
+    }, server1, server2, server3);
+
+    gfsh.executeAndAssertThat("define index --name=index_" + regionName
+        + " --expression=value1 --region=" + regionName + "1").statusIsSuccess()
+        .containsOutput("Index successfully defined");
+
+    gfsh.executeAndAssertThat("create defined indexes").statusIsError()
+        .containsOutput("RegionNotFoundException");
+
+    MemberVM.invokeInEveryMember(() -> {
+      Cache cache = LocatorServerStartupRule.getCache();
+      QueryService queryService = cache.getQueryService();
+
+      assertThat(queryService.getIndexes().isEmpty()).isTrue();
+    }, server1, server2, server3);
+  }
+
+  @Test
+  public void multipleIndexesOnMultipleRegionsClusterWide() {
+    String region1Name = testName.getMethodName() + "1";
+    String region2Name = testName.getMethodName() + "2";
+    String index1Name = "index_" + region1Name;
+    String index2Name = "index_" + region2Name;
+
+    gfsh.executeAndAssertThat("create region --name=" + region1Name + " --type=REPLICATE")
+        .statusIsSuccess().containsOutput("Region \"/" + region1Name + "\" created on \"server-1\"")
+        .containsOutput("Region \"/" + region1Name + "\" created on \"server-2\"")
+        .containsOutput("Region \"/" + region1Name + "\" created on \"server-3\"");
+
+    gfsh.executeAndAssertThat("create region --name=" + region2Name + " --type=REPLICATE")
+        .statusIsSuccess().containsOutput("Region \"/" + region2Name + "\" created on \"server-1\"")
+        .containsOutput("Region \"/" + region2Name + "\" created on \"server-2\"")
+        .containsOutput("Region \"/" + region2Name + "\" created on \"server-3\"");
+
+    MemberVM.invokeInEveryMember(() -> {
+      Cache cache = LocatorServerStartupRule.getCache();
+      assertThat(cache.getRegion(region1Name)).isNotNull();
+      assertThat(cache.getRegion(region2Name)).isNotNull();
+    }, server1, server2, server3);
+
+    gfsh.executeAndAssertThat(
+        "define index --name=" + index1Name + " --expression=value1 --region=" + region1Name)
+        .statusIsSuccess().containsOutput("Index successfully defined");
+
+    gfsh.executeAndAssertThat(
+        "define index --name=" + index2Name + " --expression=value2 --region=" + region2Name)
+        .statusIsSuccess().containsOutput("Index successfully defined");
+
+    gfsh.executeAndAssertThat("create defined indexes").statusIsSuccess()
+        .containsOutput("Indexes successfully created");
+
+    MemberVM.invokeInEveryMember(() -> {
+      Cache cache = LocatorServerStartupRule.getCache();
+      QueryService queryService = cache.getQueryService();
+      Region region1 = cache.getRegion(region1Name);
+      Region region2 = cache.getRegion(region2Name);
+
+      assertThat(queryService.getIndexes(region1).size()).isEqualTo(1);
+      assertThat(queryService.getIndexes(region2).size()).isEqualTo(1);
+      assertThat(queryService.getIndex(region1, index1Name)).isNotNull();
+      assertThat(queryService.getIndex(region2, index2Name)).isNotNull();
+    }, server1, server2, server3);
+
+    locator.invoke(() -> {
+      // Make sure the indexes exist in the cluster config
+      ClusterConfigurationService sharedConfig =
+          ((InternalLocator) Locator.getLocator()).getSharedConfiguration();
+      assertThat(sharedConfig.getConfiguration("cluster").getCacheXmlContent()).contains(index1Name,
+          index2Name);
+      assertThat(sharedConfig.getConfiguration("group1")).isNull();
+    });
+  }
+
+  @Test
+  public void multipleIndexesOnMultipleRegionsInMemberGroup() {
+    String region1Name = testName.getMethodName() + "1";
+    String region2Name = testName.getMethodName() + "2";
+    String index1Name = "index_" + region1Name;
+    String index2Name = "index_" + region2Name;
+
+    gfsh.executeAndAssertThat(
+        "create region --name=" + region1Name + " --type=REPLICATE --group=group1")
+        .statusIsSuccess()
+        .containsOutput("Region \"/" + region1Name + "\" created on \"server-3\"");
+
+    gfsh.executeAndAssertThat(
+        "create region --name=" + region2Name + " --type=REPLICATE --group=group1")
+        .statusIsSuccess()
+        .containsOutput("Region \"/" + region2Name + "\" created on \"server-3\"");
+
+    MemberVM.invokeInEveryMember(() -> {
+      Cache cache = LocatorServerStartupRule.getCache();
+      assertThat(cache.getRegion(region1Name)).isNull();
+      assertThat(cache.getRegion(region2Name)).isNull();
+    }, server1, server2);
+
+    MemberVM.invokeInEveryMember(() -> {
+      Cache cache = LocatorServerStartupRule.getCache();
+      assertThat(cache.getRegion(region1Name)).isNotNull();
+      assertThat(cache.getRegion(region2Name)).isNotNull();
+    }, server3);
+
+    gfsh.executeAndAssertThat(
+        "define index --name=" + index1Name + " --expression=value1 --region=" + region1Name)
+        .statusIsSuccess().containsOutput("Index successfully defined");
+
+    gfsh.executeAndAssertThat(
+        "define index --name=" + index2Name + " --expression=value1 --region=" + region2Name)
+        .statusIsSuccess().containsOutput("Index successfully defined");
+
+    gfsh.executeAndAssertThat("create defined indexes --group=group1").statusIsSuccess()
+        .containsOutput("Indexes successfully created");
+
+    MemberVM.invokeInEveryMember(() -> {
+      Cache cache = LocatorServerStartupRule.getCache();
+      QueryService queryService = cache.getQueryService();
+      Region region1 = cache.getRegion(region1Name);
+      Region region2 = cache.getRegion(region2Name);
+
+      assertThat(queryService.getIndexes(region1).size()).isEqualTo(1);
+      assertThat(queryService.getIndexes(region2).size()).isEqualTo(1);
+      assertThat(queryService.getIndex(region1, index1Name)).isNotNull();
+      assertThat(queryService.getIndex(region2, index2Name)).isNotNull();
+    }, server3);
+
+    locator.invoke(() -> {
+      // Make sure the indexes exist in the cluster config
+      ClusterConfigurationService sharedConfig =
+          ((InternalLocator) Locator.getLocator()).getSharedConfiguration();
+      assertThat(sharedConfig.getConfiguration("group1").getCacheXmlContent()).contains(index2Name,
+          index1Name);
+      assertThat(sharedConfig.getConfiguration("cluster").getCacheXmlContent()).isNullOrEmpty();
+    });
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommandTest.java
new file mode 100644
index 0000000..3435d0c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateDefinedIndexesCommandTest.java
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.commands;
+
+import static org.apache.geode.management.cli.Result.Status.ERROR;
+import static org.apache.geode.management.cli.Result.Status.OK;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.Mockito;
+
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.cache.query.IndexType;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.ClusterConfigurationService;
+import org.apache.geode.management.internal.cli.domain.IndexInfo;
+import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.geode.test.junit.rules.GfshParserRule;
+
+@Category(UnitTest.class)
+public class CreateDefinedIndexesCommandTest {
+  @Rule
+  public GfshParserRule gfshParser = new GfshParserRule();
+
+  private CommandResult result;
+  private ResultCollector resultCollector;
+  private CreateDefinedIndexesCommand command;
+
+  @Before
+  public void setUp() throws Exception {
+    IndexDefinition.indexDefinitions.clear();
+    resultCollector = mock(ResultCollector.class);
+    command = spy(CreateDefinedIndexesCommand.class);
+    doReturn(resultCollector).when(command).executeFunction(any(), any(), any(Set.class));
+  }
+
+  @Test
+  public void noDefinitions() throws Exception {
+    result = gfshParser.executeCommandWithInstance(command, "create defined indexes");
+    assertThat(result.getStatus()).isEqualTo(OK);
+    assertThat(result.getContent().toString()).contains("No indexes defined");
+  }
+
+  @Test
+  public void noMembers() throws Exception {
+    IndexDefinition.indexDefinitions
+        .add(new IndexInfo("indexName", "indexedExpression", "TestRegion", IndexType.FUNCTIONAL));
+    doReturn(Collections.EMPTY_SET).when(command).findMembers(any(), any());
+    result = gfshParser.executeCommandWithInstance(command, "create defined indexes");
+    assertThat(result.getStatus()).isEqualTo(ERROR);
+    assertThat(result.getContent().toString()).contains("No Members Found");
+  }
+
+  @Test
+  public void creationFailure() throws Exception {
+    DistributedMember member = mock(DistributedMember.class);
+    when(member.getId()).thenReturn("memberId");
+    ClusterConfigurationService mockService = mock(ClusterConfigurationService.class);
+
+    doReturn(mockService).when(command).getSharedConfiguration();
+    doReturn(Collections.singleton(member)).when(command).findMembers(any(), any());
+    doReturn(Arrays.asList(new CliFunctionResult(member.getId(), new Exception("MockException"),
+        "Exception Message."))).when(resultCollector).getResult();
+
+    IndexDefinition.indexDefinitions
+        .add(new IndexInfo("index1", "value1", "TestRegion", IndexType.FUNCTIONAL));
+    result = gfshParser.executeCommandWithInstance(command, "create defined indexes");
+
+    assertThat(result.getStatus()).isEqualTo(ERROR);
+    verify(command, never()).persistClusterConfiguration(any(), any());
+  }
+
+  @Test
+  public void creationSuccess() throws Exception {
+    XmlEntity xmlEntity = mock(XmlEntity.class);
+    DistributedMember member = mock(DistributedMember.class);
+    when(member.getId()).thenReturn("memberId");
+    ClusterConfigurationService mockService = mock(ClusterConfigurationService.class);
+
+    doReturn(mockService).when(command).getSharedConfiguration();
+    doReturn(Collections.singleton(member)).when(command).findMembers(any(), any());
+    doReturn(Arrays.asList(new CliFunctionResult(member.getId(), xmlEntity))).when(resultCollector)
+        .getResult();
+
+    IndexDefinition.indexDefinitions
+        .add(new IndexInfo("index1", "value1", "TestRegion", IndexType.FUNCTIONAL));
+    result = gfshParser.executeCommandWithInstance(command, "create defined indexes");
+
+    assertThat(result.getStatus()).isEqualTo(OK);
+    assertThat(result.failedToPersist()).isFalse();
+    verify(command, Mockito.times(1)).persistClusterConfiguration(any(), any());
+    assertThat(result.getContent().toString()).contains("Indexes successfully created");
+  }
+
+  @Test
+  public void multipleIndexesOnMultipleRegions() throws Exception {
+    XmlEntity xmlEntityRegion1 = mock(XmlEntity.class);
+    XmlEntity xmlEntityRegion2 = mock(XmlEntity.class);
+    DistributedMember member1 = mock(DistributedMember.class);
+    DistributedMember member2 = mock(DistributedMember.class);
+    when(member1.getId()).thenReturn("memberId_1");
+    when(member2.getId()).thenReturn("memberId_2");
+
+    ClusterConfigurationService mockService = mock(ClusterConfigurationService.class);
+    CliFunctionResult member1Region1Result =
+        new CliFunctionResult(member1.getId(), xmlEntityRegion1);
+    CliFunctionResult member1Region2Result =
+        new CliFunctionResult(member1.getId(), xmlEntityRegion2);
+    CliFunctionResult member2Region1Result =
+        new CliFunctionResult(member2.getId(), xmlEntityRegion2);
+    CliFunctionResult member2Region2Result =
+        new CliFunctionResult(member2.getId(), xmlEntityRegion2);
+
+    doReturn(mockService).when(command).getSharedConfiguration();
+    doReturn(new HashSet<>(Arrays.asList(new DistributedMember[] {member1, member2}))).when(command)
+        .findMembers(any(), any());
+    doReturn(Arrays.asList(new CliFunctionResult[] {member1Region1Result, member1Region2Result,
+        member2Region1Result, member2Region2Result})).when(resultCollector).getResult();
+
+    IndexDefinition.indexDefinitions
+        .add(new IndexInfo("index1", "value1", "TestRegion1", IndexType.FUNCTIONAL));
+    IndexDefinition.indexDefinitions
+        .add(new IndexInfo("index2", "value2", "TestRegion2", IndexType.FUNCTIONAL));
+
+    result = gfshParser.executeCommandWithInstance(command, "create defined indexes");
+
+    assertThat(result.getStatus()).isEqualTo(OK);
+    assertThat(result.failedToPersist()).isFalse();
+
+    // The command will receive 4 results from 2 members, but we need to persist only 2 (#regions)
+    // of them.
+    verify(command, Mockito.times(2)).persistClusterConfiguration(any(), any());
+    assertThat(result.getContent().toString()).contains("Indexes successfully created");
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
index 7b8a5e8..b9f6513 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandDUnitTest.java
@@ -36,7 +36,7 @@ import org.apache.geode.test.compiler.JarBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
 
 @Category(DistributedTest.class)
@@ -49,7 +49,7 @@ public class CreateRegionCommandDUnitTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TestName testName = new SerializableTestName();
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandIntegrationTest.java
index ce580a5..28dffab 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/CreateRegionCommandIntegrationTest.java
@@ -36,7 +36,7 @@ import org.apache.geode.cache.RegionAttributes;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.cache.util.CacheListenerAdapter;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category(IntegrationTest.class)
@@ -55,11 +55,11 @@ public class CreateRegionCommandIntegrationTest {
       new ServerStarterRule().withJMXManager().withRegion(RegionShortcut.REPLICATE, "REPLICATED");
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
-    gfsh.connectAndVerify(server.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(server.getJmxPort(), GfshCommandRule.PortType.jmxManager);
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandFunctionRegistrationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandFunctionRegistrationDUnitTest.java
index c2a03bf..a043ff2 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandFunctionRegistrationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandFunctionRegistrationDUnitTest.java
@@ -37,7 +37,7 @@ import org.apache.geode.test.compiler.JarBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
 
 @Category(DistributedTest.class)
@@ -52,7 +52,7 @@ public class DeployCommandFunctionRegistrationDUnitTest implements Serializable
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public transient GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public transient GfshCommandRule gfshConnector = new GfshCommandRule();
 
   @Before
   public void setup() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
index ed8de9e..4b91ce5 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployCommandRedeployDUnitTest.java
@@ -43,7 +43,7 @@ import org.apache.geode.test.compiler.ClassBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
 
 @Category(DistributedTest.class)
@@ -73,7 +73,7 @@ public class DeployCommandRedeployDUnitTest implements Serializable {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public transient GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public transient GfshCommandRule gfshConnector = new GfshCommandRule();
 
   @Before
   public void setup() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployWithGroupsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployWithGroupsDUnitTest.java
index 34402a5..145bbe4 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployWithGroupsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DeployWithGroupsDUnitTest.java
@@ -32,7 +32,7 @@ import org.apache.geode.test.compiler.ClassBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
 
 /**
@@ -73,7 +73,7 @@ public class DeployWithGroupsDUnitTest implements Serializable {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public transient GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public transient GfshCommandRule gfshConnector = new GfshCommandRule();
 
   @Before
   public void setup() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandIntegrationTest.java
similarity index 69%
rename from geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandJUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandIntegrationTest.java
index 094ff4f..e76a26b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandIntegrationTest.java
@@ -14,43 +14,40 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.assertj.core.api.Assertions.assertThat;
-
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule.PortType;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category(IntegrationTest.class)
-public class DescribeConfigCommandJUnitTest {
+public class DescribeConfigCommandIntegrationTest {
   private static final String[] EXPECTED_BASE_CONFIGURATION_DATA = {"Configuration of member :",
       "JVM command line arguments", "GemFire properties defined using the API"};
 
   private static final String[] EXPECTED_EXPANDED_CONFIGURATION_DATA =
       {"Cache attributes", "GemFire properties using default values"};
 
-  @Rule
-  public ServerStarterRule server = new ServerStarterRule().withJMXManager().withName("server")
-      .withRegion(RegionShortcut.PARTITION, "region").withAutoStart();
+  @ClassRule
+  public static ServerStarterRule server = new ServerStarterRule().withJMXManager()
+      .withName("server").withRegion(RegionShortcut.PARTITION, "region").withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule(server::getJmxPort, PortType.jmxManager);
 
   @Test
   public void describeConfig() throws Exception {
-    gfsh.connectAndVerify(server.getJmxPort(), PortType.jmxManager);
     gfsh.executeAndAssertThat("describe config --member=" + server.getName()).statusIsSuccess()
         .containsOutput(EXPECTED_BASE_CONFIGURATION_DATA);
   }
 
   @Test
   public void describeConfigAndShowDefaults() throws Exception {
-    gfsh.connectAndVerify(server.getJmxPort(), PortType.jmxManager);
     gfsh.executeAndAssertThat("describe config --hide-defaults=false --member=" + server.getName())
         .statusIsSuccess().containsOutput(EXPECTED_BASE_CONFIGURATION_DATA)
         .containsOutput(EXPECTED_EXPANDED_CONFIGURATION_DATA);
@@ -58,6 +55,7 @@ public class DescribeConfigCommandJUnitTest {
 
   @Test
   public void describeConfigWhenNotConnected() throws Exception {
+    gfsh.disconnect();
     gfsh.executeAndAssertThat("describe config --member=" + server.getName()).statusIsError()
         .containsOutput("was found but is not currently available");
   }
@@ -65,19 +63,8 @@ public class DescribeConfigCommandJUnitTest {
   @Test
   public void describeConfigOnInvalidMember() throws Exception {
     String invalidMemberName = "invalid-member-name";
-    String expectedErrorString = String.format("Member \"%s\" not found", invalidMemberName);
-
-    gfsh.connectAndVerify(server.getJmxPort(), PortType.jmxManager);
+    String expectedErrorString = String.format("Member %s could not be found", invalidMemberName);
     gfsh.executeAndAssertThat("describe config --member=" + invalidMemberName).statusIsError()
         .containsOutput(expectedErrorString);
   }
-
-  @Test
-  public void describeConfigWithoutMemberName() throws Exception {
-    String expectedErrorString = "You should specify option ";
-
-    gfsh.connectAndVerify(server.getJmxPort(), PortType.jmxManager);
-    gfsh.executeAndAssertThat("describe config").statusIsError()
-        .containsOutput(expectedErrorString);
-  }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandOverHttpDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandTest.java
similarity index 64%
copy from geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandOverHttpDUnitTest.java
copy to geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandTest.java
index 0c15a52..d94707a 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandOverHttpDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandTest.java
@@ -15,16 +15,24 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.test.dunit.rules.MemberVM;
-import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.geode.test.junit.rules.GfshParserRule;
+
+
+@Category(UnitTest.class)
+public class DescribeConfigCommandTest {
+
+  @ClassRule
+  public static GfshParserRule parser = new GfshParserRule();
 
-@Category(DistributedTest.class)
-public class ListIndexCommandOverHttpDUnitTest extends ListIndexCommandDUnitTest {
-  @Override
-  public void connectGfsh(MemberVM vm) throws Exception {
-    gfsh.connectAndVerify(vm.getHttpPort(), GfshShellConnectionRule.PortType.http);
+  @Test
+  public void describeConfigWithoutMemberName() throws Exception {
+    assertThat(parser.parse("describe config")).isNull();
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeMembersCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeMembersCommandDUnitTest.java
index cfd2780..65b3b8c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeMembersCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeMembersCommandDUnitTest.java
@@ -15,7 +15,6 @@
 package org.apache.geode.management.internal.cli.commands;
 
 import static org.apache.geode.management.internal.cli.i18n.CliStrings.DESCRIBE_MEMBER;
-import static org.assertj.core.api.Assertions.assertThat;
 
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
@@ -26,7 +25,7 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class DescribeMembersCommandDUnitTest {
@@ -35,7 +34,7 @@ public class DescribeMembersCommandDUnitTest {
   private static MemberVM locator;
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @BeforeClass
   public static void setup() throws Exception {
@@ -46,8 +45,8 @@ public class DescribeMembersCommandDUnitTest {
   @Test
   public void describeInvalidMember() throws Exception {
     gfsh.connectAndVerify(locator);
-    gfsh.executeAndAssertThat(DESCRIBE_MEMBER + " --name=foo").statusIsSuccess()
-        .containsOutput("Member \"foo\" not found");
+    gfsh.executeAndAssertThat(DESCRIBE_MEMBER + " --name=foo").statusIsError()
+        .containsOutput("Member foo could not be found");
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommandTest.java
new file mode 100644
index 0000000..78726ee
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyGatewaySenderCommandTest.java
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.commands;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
+import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.geode.test.junit.rules.GfshParserRule;
+
+
+@Category(UnitTest.class)
+public class DestroyGatewaySenderCommandTest {
+
+  @ClassRule
+  public static GfshParserRule parser = new GfshParserRule();
+
+  private DestroyGatewaySenderCommand command;
+  private ResultCollector collector;
+  private InternalCache cache;
+  private List<CliFunctionResult> functionResults;
+  private CliFunctionResult result1, result2;
+  private CommandResult result;
+
+  @Before
+  public void before() throws Exception {
+    command = spy(DestroyGatewaySenderCommand.class);
+    cache = mock(InternalCache.class);
+    doReturn(cache).when(command).getCache();
+    collector = mock(ResultCollector.class);
+    doReturn(collector).when(command).executeFunction(any(), any(), any(Set.class));
+    functionResults = new ArrayList<>();
+    doReturn(functionResults).when(collector).getResult();
+  }
+
+  @Test
+  public void mandatoryOptions() throws Exception {
+    assertThat(parser.parse("destroy gateway-sender --member=A")).isNull();
+  }
+
+  @Test
+  public void allFunctionReturnsOK() throws Exception {
+    result1 = new CliFunctionResult("member", true, "result1");
+    result2 = new CliFunctionResult("member", true, "result2");
+    functionResults.add(result1);
+    functionResults.add(result2);
+
+    doReturn(mock(Set.class)).when(command).getMembers(any(), any());
+    parser.executeAndAssertThat(command, "destroy gateway-sender --id=1").statusIsSuccess()
+        .tableHasColumnWithValuesContaining("Status", "result1", "result2");
+
+  }
+
+  @Test
+  public void oneFunctionReturnsError() throws Exception {
+    result1 = new CliFunctionResult("member", true, "result1");
+    result2 = new CliFunctionResult("member", false, "result2");
+    functionResults.add(result1);
+    functionResults.add(result2);
+
+    doReturn(mock(Set.class)).when(command).getMembers(any(), any());
+    parser.executeAndAssertThat(command, "destroy gateway-sender --id=1").statusIsError()
+        .tableHasColumnWithValuesContaining("Status", "result1", "ERROR: result2");
+
+  }
+
+  @Test
+  public void oneFunctionThrowsGeneralException() throws Exception {
+    result1 = new CliFunctionResult("member", true, "result1");
+    result2 = new CliFunctionResult("member", new Exception("something happened"), null);
+    functionResults.add(result1);
+    functionResults.add(result2);
+
+    doReturn(mock(Set.class)).when(command).getMembers(any(), any());
+    parser.executeAndAssertThat(command, "destroy gateway-sender --id=1").statusIsError()
+        .tableHasColumnWithValuesContaining("Status", "result1", "ERROR: something happened");
+
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyIndexCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyIndexCommandsDUnitTest.java
index 0959804..9902ca7 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyIndexCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyIndexCommandsDUnitTest.java
@@ -30,7 +30,7 @@ import org.apache.geode.management.internal.cli.domain.Stock;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class DestroyIndexCommandsDUnitTest {
@@ -47,7 +47,7 @@ public class DestroyIndexCommandsDUnitTest {
   public LocatorServerStartupRule rule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandDUnitTest.java
index 421a005..51e2102 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandDUnitTest.java
@@ -16,15 +16,8 @@
 package org.apache.geode.management.internal.cli.commands;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.awaitility.Awaitility.waitAtMost;
 
 import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.concurrent.TimeUnit;
-
-import javax.management.MBeanServer;
-import javax.management.MalformedObjectNameException;
-import javax.management.ObjectName;
 
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -41,12 +34,10 @@ import org.apache.geode.cache.Scope;
 import org.apache.geode.distributed.Locator;
 import org.apache.geode.distributed.internal.ClusterConfigurationService;
 import org.apache.geode.distributed.internal.InternalLocator;
-import org.apache.geode.management.internal.MBeanJMXAdapter;
-import org.apache.geode.management.internal.ManagementConstants;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class DestroyRegionCommandDUnitTest {
@@ -54,7 +45,7 @@ public class DestroyRegionCommandDUnitTest {
   public static LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private static MemberVM locator, server1, server2, server3;
 
@@ -84,8 +75,8 @@ public class DestroyRegionCommandDUnitTest {
       factory.create("Order");
     }, server1, server2);
 
-    locator.invoke(() -> waitForRegionMBeanCreation("/Customer", 2));
-    locator.invoke(() -> waitForRegionMBeanCreation("/Order", 2));
+    locator.waitTillRegionsAreReadyOnServers("/Customer", 2);
+    locator.waitTillRegionsAreReadyOnServers("/Order", 2);
 
     // Test unable to destroy with co-location
     gfsh.executeAndAssertThat("destroy region --name=/Customer").statusIsError()
@@ -112,7 +103,7 @@ public class DestroyRegionCommandDUnitTest {
       factory.create("Customer");
     }, server1, server2, server3);
 
-    locator.invoke(() -> waitForRegionMBeanCreation("/Customer", 3));
+    locator.waitTillRegionsAreReadyOnServers("/Customer", 3);
 
     gfsh.executeAndAssertThat("destroy region --name=Customer").statusIsSuccess()
         .containsOutput("destroyed successfully");
@@ -142,9 +133,9 @@ public class DestroyRegionCommandDUnitTest {
       factory.create("Customer_3");
     });
 
-    locator.invoke(() -> waitForRegionMBeanCreation("/Customer", 3));
-    locator.invoke(() -> waitForRegionMBeanCreation("/Customer_2", 3));
-    locator.invoke(() -> waitForRegionMBeanCreation("/Customer_3", 3));
+    locator.waitTillRegionsAreReadyOnServers("/Customer", 3);
+    locator.waitTillRegionsAreReadyOnServers("/Customer_2", 3);
+    locator.waitTillRegionsAreReadyOnServers("/Customer_3", 3);
 
     gfsh.executeAndAssertThat("destroy region --name=Customer").statusIsSuccess()
         .containsOutput("destroyed successfully");
@@ -201,18 +192,4 @@ public class DestroyRegionCommandDUnitTest {
       assertThat(cache.getRegion("Customer")).isNull();
     }, server1, server2, server3);
   }
-
-  private static void waitForRegionMBeanCreation(String regionPath, int mbeanCount) {
-    waitAtMost(5, TimeUnit.SECONDS).until(() -> {
-      try {
-        MBeanServer mbeanServer = MBeanJMXAdapter.mbeanServer;
-        String queryExp =
-            MessageFormat.format(ManagementConstants.OBJECTNAME__REGION_MXBEAN, regionPath, "*");
-        ObjectName queryExpON = new ObjectName(queryExp);
-        return mbeanServer.queryNames(queryExpON, null).size() == mbeanCount;
-      } catch (MalformedObjectNameException mone) {
-        throw new RuntimeException(mone);
-      }
-    });
-  }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandTest.java
index b519c8d..f4352b2 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyRegionCommandTest.java
@@ -15,22 +15,31 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
+import java.util.ArrayList;
 import java.util.Collections;
+import java.util.List;
+import java.util.Set;
 
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
 import org.apache.geode.management.internal.cli.result.CommandResult;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 import org.apache.geode.test.junit.categories.UnitTest;
 import org.apache.geode.test.junit.rules.GfshParserRule;
 
@@ -42,35 +51,82 @@ public class DestroyRegionCommandTest {
 
   private DestroyRegionCommand command;
   private CommandResult result;
+  private CliFunctionResult result1, result2;
 
   @Before
   public void before() throws Exception {
     command = spy(DestroyRegionCommand.class);
     doReturn(mock(InternalCache.class)).when(command).getCache();
+
+    ResultCollector collector = mock(ResultCollector.class);
+    doReturn(collector).when(command).executeFunction(any(), any(), any(Set.class));
+
+    List<CliFunctionResult> functionResults = new ArrayList<>();
+    doReturn(functionResults).when(collector).getResult();
+    result1 = mock(CliFunctionResult.class);
+    result2 = mock(CliFunctionResult.class);
+    functionResults.add(result1);
+    functionResults.add(result2);
   }
 
   @Test
   public void invalidRegion() throws Exception {
-    result = parser.executeCommandWithInstance(command, "destroy region");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.getContent().toString()).contains("Invalid command");
+    parser.executeAndAssertThat(command, "destroy region").statusIsError()
+        .containsOutput("Invalid command");
 
-    result = parser.executeCommandWithInstance(command, "destroy region --name=");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.getContent().toString()).contains("Invalid command");
+    parser.executeAndAssertThat(command, "destroy region --name=").statusIsError()
+        .containsOutput("Invalid command");
 
-    result = parser.executeCommandWithInstance(command, "destroy region --name=/");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.getContent().toString()).contains("Invalid command");
+    parser.executeAndAssertThat(command, "destroy region --name=/").statusIsError()
+        .containsOutput("Invalid command");
   }
 
   @Test
   public void whenNoRegionIsFoundOnAnyMembers() throws Exception {
     doReturn(Collections.emptySet()).when(command).findMembersForRegion(any(), any());
-    result = parser.executeCommandWithInstance(command, "destroy region --name=test");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    parser.executeAndAssertThat(command, "destroy region --name=test").statusIsError()
+        .containsOutput("Could not find a Region with Region path");
+
+    parser.executeAndAssertThat(command, "destroy region --name=test --if-exists")
+        .statusIsSuccess();
+  }
+
+  @Test
+  public void multipleResultReturnedWithOneError() throws Exception {
+    // mock this to pass the member search call
+    doReturn(Collections.singleton(DistributedMember.class)).when(command)
+        .findMembersForRegion(any(), any());
+    when(result1.isSuccessful()).thenReturn(true);
+    when(result1.getMessage()).thenReturn("result1 message");
+    when(result1.getXmlEntity()).thenReturn(mock(XmlEntity.class));
+
+    when(result2.isSuccessful()).thenReturn(false);
+    when(result2.getMessage()).thenReturn("result2 message");
+
+    parser.executeAndAssertThat(command, "destroy region --name=test").statusIsError()
+        .containsOutput("result2 message");
+
+    // verify that xmlEntiry returned by the result1 is not saved to Cluster config
+    verify(command, never()).persistClusterConfiguration(any(), any());
+  }
+
+  @Test
+  public void multipleResultReturnedWithOneException() throws Exception {
+    // mock this to pass the member search call
+    doReturn(Collections.singleton(DistributedMember.class)).when(command)
+        .findMembersForRegion(any(), any());
+    when(result1.isSuccessful()).thenReturn(true);
+    when(result1.getMessage()).thenReturn("result1 message");
+    when(result1.getXmlEntity()).thenReturn(mock(XmlEntity.class));
+
+    when(result2.isSuccessful()).thenReturn(false);
+    when(result2.getThrowable()).thenReturn(new IllegalArgumentException("something happened"));
+
+    assertThatThrownBy(
+        () -> parser.executeCommandWithInstance(command, "destroy region --name=test"))
+            .isInstanceOf(IllegalArgumentException.class);
 
-    result = parser.executeCommandWithInstance(command, "destroy region --name=test --if-exists");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
+    // verify that xmlEntiry returned by the result1 is not saved to Cluster config
+    verify(command, never()).persistClusterConfiguration(any(), any());
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
index f8cd657..eb15d05 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsJUnitTest.java
@@ -43,11 +43,10 @@ import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.cache.execute.AbstractExecution;
 import org.apache.geode.internal.util.CollectionUtils;
 import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
 import org.apache.geode.management.internal.cli.functions.DescribeDiskStoreFunction;
 import org.apache.geode.management.internal.cli.functions.ListDiskStoresFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.util.DiskStoreNotFoundException;
-import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
 import org.apache.geode.test.junit.categories.UnitTest;
 
 /**
@@ -124,10 +123,6 @@ public class DiskStoreCommandsJUnitTest {
 
     mockContext.checking(new Expectations() {
       {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
         oneOf(mockFunctionExecutor).setArguments(with(equal(diskStoreName)));
         will(returnValue(mockFunctionExecutor));
         oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeDiskStoreFunction.class)));
@@ -147,39 +142,8 @@ public class DiskStoreCommandsJUnitTest {
     assertEquals(expectedDiskStoredDetails, actualDiskStoreDetails);
   }
 
-  @Test(expected = MemberNotFoundException.class)
-  public void testGetDiskStoreDescriptionThrowsMemberNotFoundException() {
-    final String diskStoreName = "mockDiskStore";
-    final String memberId = "mockMember";
-
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedMember mockMember =
-        mockContext.mock(DistributedMember.class, "DistributedMember");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue("testMember"));
-      }
-    });
-
-    final DescribeDiskStoreCommand describeCommand =
-        createDescribeDiskStoreCommand(mockCache, mockMember, null);
-
-    try {
-      describeCommand.getDiskStoreDescription(memberId, diskStoreName);
-    } catch (MemberNotFoundException expected) {
-      assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, memberId),
-          expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test(expected = DiskStoreNotFoundException.class)
-  public void testGetDiskStoreDescriptionThrowsDiskStoreNotFoundException() {
+  @Test(expected = EntityNotFoundException.class)
+  public void testGetDiskStoreDescriptionThrowsEntityNotFoundException() {
     final String diskStoreName = "mockDiskStore";
     final String memberId = "mockMember";
 
@@ -192,14 +156,10 @@ public class DiskStoreCommandsJUnitTest {
 
     mockContext.checking(new Expectations() {
       {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
         oneOf(mockFunctionExecutor).setArguments(with(equal(diskStoreName)));
         will(returnValue(mockFunctionExecutor));
         oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeDiskStoreFunction.class)));
-        will(throwException(new DiskStoreNotFoundException("expected")));
+        will(throwException(new EntityNotFoundException("expected")));
       }
     });
 
@@ -208,7 +168,7 @@ public class DiskStoreCommandsJUnitTest {
 
     try {
       describeCommand.getDiskStoreDescription(memberId, diskStoreName);
-    } catch (DiskStoreNotFoundException expected) {
+    } catch (EntityNotFoundException expected) {
       assertEquals("expected", expected.getMessage());
       throw expected;
     }
@@ -228,10 +188,6 @@ public class DiskStoreCommandsJUnitTest {
 
     mockContext.checking(new Expectations() {
       {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
         oneOf(mockFunctionExecutor).setArguments(with(equal(diskStoreName)));
         will(returnValue(mockFunctionExecutor));
         oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeDiskStoreFunction.class)));
@@ -267,10 +223,6 @@ public class DiskStoreCommandsJUnitTest {
 
     mockContext.checking(new Expectations() {
       {
-        oneOf(mockMember).getName();
-        will(returnValue(null));
-        oneOf(mockMember).getId();
-        will(returnValue(memberId));
         oneOf(mockFunctionExecutor).setArguments(with(equal(diskStoreName)));
         will(returnValue(mockFunctionExecutor));
         oneOf(mockFunctionExecutor).execute(with(aNonNull(DescribeDiskStoreFunction.class)));
@@ -434,12 +386,18 @@ public class DiskStoreCommandsJUnitTest {
     }
 
     @Override
-    public Set<DistributedMember> getMembers(final InternalCache cache) {
+    public Set<DistributedMember> getAllMembers(final InternalCache cache) {
       assertSame(getCache(), cache);
       return Collections.singleton(this.distributedMember);
     }
 
     @Override
+    public DistributedMember getMember(String nameOrId) {
+      assertSame(getCache(), cache);
+      return this.distributedMember;
+    }
+
+    @Override
     public Execution getMembersFunctionExecutor(final Set<DistributedMember> members) {
       Assert.assertNotNull(members);
       return this.functionExecutor;
@@ -447,7 +405,6 @@ public class DiskStoreCommandsJUnitTest {
   }
 
   private static class TestListDiskStoresCommand extends ListDiskStoresCommand {
-
     private final InternalCache cache;
     private final DistributedMember distributedMember;
     private final Execution functionExecutor;
@@ -466,12 +423,18 @@ public class DiskStoreCommandsJUnitTest {
     }
 
     @Override
-    public Set<DistributedMember> getMembers(final InternalCache cache) {
+    public Set<DistributedMember> getAllMembers(final InternalCache cache) {
       assertSame(getCache(), cache);
       return Collections.singleton(this.distributedMember);
     }
 
     @Override
+    public DistributedMember getMember(String nameOrId) {
+      assertSame(getCache(), cache);
+      return this.distributedMember;
+    }
+
+    @Override
     public Execution getMembersFunctionExecutor(final Set<DistributedMember> members) {
       Assert.assertNotNull(members);
       return this.functionExecutor;
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommandSecurityTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommandSecurityTest.java
index 5247dae..4ab8b2e 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommandSecurityTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommandSecurityTest.java
@@ -44,7 +44,7 @@ import org.apache.geode.security.SimpleTestSecurityManager;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ExecuteFunctionCommandSecurityTest implements Serializable {
@@ -53,7 +53,7 @@ public class ExecuteFunctionCommandSecurityTest implements Serializable {
   public static LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private static MemberVM locator, server1, server2;
 
@@ -87,8 +87,8 @@ public class ExecuteFunctionCommandSecurityTest implements Serializable {
 
   @Test
   public void dataReaderCanExecuteReadFunction() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "dataRead", "dataRead");
+    gfsh.secureConnectAndVerify(locator.getPort(), GfshCommandRule.PortType.locator, "dataRead",
+        "dataRead");
     gfsh.executeAndAssertThat("execute function --id=" + new ReadFunction().getId())
         .statusIsSuccess();
     assertThat(gfsh.getGfshOutput()).contains(ReadFunction.SUCCESS_OUTPUT);
@@ -96,8 +96,8 @@ public class ExecuteFunctionCommandSecurityTest implements Serializable {
 
   @Test
   public void dataReaderCanNotExecuteWriteFunction() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "dataRead", "dataRead");
+    gfsh.secureConnectAndVerify(locator.getPort(), GfshCommandRule.PortType.locator, "dataRead",
+        "dataRead");
     gfsh.executeAndAssertThat("execute function --id=" + new WriteFunction().getId())
         .containsOutput("dataRead not authorized for DATA:WRITE")
         .doesNotContainOutput(WriteFunction.SUCCESS_OUTPUT);
@@ -105,8 +105,8 @@ public class ExecuteFunctionCommandSecurityTest implements Serializable {
 
   @Test
   public void dataWriterCanExecuteWriteFunction() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "dataWrite", "dataWrite");
+    gfsh.secureConnectAndVerify(locator.getPort(), GfshCommandRule.PortType.locator, "dataWrite",
+        "dataWrite");
     gfsh.executeAndAssertThat("execute function --id=" + new WriteFunction().getId())
         .statusIsSuccess();
     assertThat(gfsh.getGfshOutput()).contains(WriteFunction.SUCCESS_OUTPUT);
@@ -114,8 +114,8 @@ public class ExecuteFunctionCommandSecurityTest implements Serializable {
 
   @Test
   public void dataWriterCanNotExecuteReadFunction() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "dataWrite", "dataWrite");
+    gfsh.secureConnectAndVerify(locator.getPort(), GfshCommandRule.PortType.locator, "dataWrite",
+        "dataWrite");
     gfsh.executeCommand("execute function --id=" + new ReadFunction().getId());
     assertThat(gfsh.getGfshOutput()).contains("dataWrite not authorized for DATA:READ");
     assertThat(gfsh.getGfshOutput()).doesNotContain(ReadFunction.SUCCESS_OUTPUT);
@@ -123,8 +123,8 @@ public class ExecuteFunctionCommandSecurityTest implements Serializable {
 
   @Test
   public void readOnlyUserOnReplicatedRegion() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "dataRead", "dataRead");
+    gfsh.secureConnectAndVerify(locator.getPort(), GfshCommandRule.PortType.locator, "dataRead",
+        "dataRead");
     gfsh.executeAndAssertThat(
         "execute function --id=" + new ReadFunction().getId() + " --region=" + REPLICATED_REGION)
         .statusIsSuccess().containsOutput(ReadFunction.SUCCESS_OUTPUT);
@@ -137,8 +137,8 @@ public class ExecuteFunctionCommandSecurityTest implements Serializable {
 
   @Test
   public void readOnlyUserOnPartitionedRegion() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "dataRead", "dataRead");
+    gfsh.secureConnectAndVerify(locator.getPort(), GfshCommandRule.PortType.locator, "dataRead",
+        "dataRead");
     gfsh.executeAndAssertThat(
         "execute function --id=" + new ReadFunction().getId() + " --region=" + PARTITIONED_REGION)
         .statusIsSuccess().containsOutput(ReadFunction.SUCCESS_OUTPUT);
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportDataCommandTest.java
similarity index 60%
copy from geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java
copy to geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportDataCommandTest.java
index 68527e2..601ba84 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportDataCommandTest.java
@@ -15,23 +15,26 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import java.io.File;
+import static org.assertj.core.api.Assertions.assertThat;
 
+import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.management.internal.cli.GfshParseResult;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.geode.test.junit.rules.GfshParserRule;
 
-@Category(IntegrationTest.class)
-public class ExportLogsOverHttpIntegrationTest extends ExportLogsIntegrationTest {
 
-  @Override
-  public void connect() throws Exception {
-    gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
-  }
+@Category(UnitTest.class)
+public class ExportDataCommandTest {
 
-  public File getWorkingDirectory() throws Exception {
-    return new File(System.getProperty("user.dir"));
-  }
+  @ClassRule
+  public static GfshParserRule parser = new GfshParserRule();
 
+  @Test
+  public void missingMember() throws Exception {
+    GfshParseResult result = parser.parse("export data --region=regionA --file=test");
+    assertThat(result).isNull();
+  }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportDataIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportDataIntegrationTest.java
index 8d36d19..fda9f6f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportDataIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportDataIntegrationTest.java
@@ -18,7 +18,6 @@ package org.apache.geode.management.internal.cli.commands;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
 
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -36,7 +35,7 @@ import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category(IntegrationTest.class)
@@ -51,7 +50,7 @@ public class ExportDataIntegrationTest {
       .withRegion(RegionShortcut.PARTITION, TEST_REGION_NAME).withEmbeddedLocator();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder tempDir = new TemporaryFolder();
@@ -62,8 +61,7 @@ public class ExportDataIntegrationTest {
 
   @Before
   public void setup() throws Exception {
-    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(),
-        GfshShellConnectionRule.PortType.locator);
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), GfshCommandRule.PortType.locator);
     region = server.getCache().getRegion(TEST_REGION_NAME);
     loadRegion("value");
     Path basePath = tempDir.getRoot().toPath();
@@ -95,8 +93,8 @@ public class ExportDataIntegrationTest {
         .addOption(CliStrings.MEMBER, invalidMemberName)
         .addOption(CliStrings.EXPORT_DATA__REGION, TEST_REGION_NAME)
         .addOption(CliStrings.EXPORT_DATA__FILE, snapshotFile.toString()).getCommandString();
-    gfsh.executeCommand(invalidMemberCommand);
-    assertThat(gfsh.getGfshOutput()).contains("Member " + invalidMemberName + " not found");
+    gfsh.executeAndAssertThat(invalidMemberCommand)
+        .containsOutput("Member " + invalidMemberName + " could not be found");
   }
 
   @Test
@@ -129,15 +127,6 @@ public class ExportDataIntegrationTest {
   }
 
   @Test
-  public void testMissingMember() throws Exception {
-    String missingMemberCommand = new CommandStringBuilder(CliStrings.EXPORT_DATA)
-        .addOption(CliStrings.EXPORT_DATA__REGION, TEST_REGION_NAME)
-        .addOption(CliStrings.EXPORT_DATA__FILE, snapshotFile.toString()).getCommandString();
-    gfsh.executeCommand(missingMemberCommand);
-    assertThat(gfsh.getGfshOutput()).contains("You should specify option");
-  }
-
-  @Test
   public void testMissingFileAndDirectory() throws Exception {
     String missingFileAndDirCommand = buildBaseExportCommand().getCommandString();
     gfsh.executeCommand(missingFileAndDirCommand);
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 9c5d030..03a05a7 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
@@ -14,7 +14,10 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.apache.geode.management.internal.cli.commands.ExportLogsCommand.*;
+import static org.apache.geode.management.internal.cli.commands.ExportLogsCommand.GIGABYTE;
+import static org.apache.geode.management.internal.cli.commands.ExportLogsCommand.KILOBYTE;
+import static org.apache.geode.management.internal.cli.commands.ExportLogsCommand.MEGABYTE;
+import static org.apache.geode.management.internal.cli.commands.ExportLogsCommand.TERABYTE;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Matchers.eq;
@@ -179,7 +182,7 @@ public class ExportLogsCommandTest {
     testResults2.addResult(member2, 60 * MEGABYTE);
 
     doReturn(mockCache).when(spyCmd).getCache();
-    doReturn(testMembers).when(spyCmd).getMembers(null, null);
+    doReturn(testMembers).when(spyCmd).getMembersIncludingLocators(null, null);
     doReturn(testResults1).when(spyCmd)
         .estimateLogSize(Matchers.any(SizeExportLogsFunction.Args.class), eq(member1));
     doReturn(testResults2).when(spyCmd)
@@ -220,7 +223,7 @@ public class ExportLogsCommandTest {
     testResults2.addResult(member2, 60 * MEGABYTE);
 
     doReturn(mockCache).when(spyCmd).getCache();
-    doReturn(testMembers).when(spyCmd).getMembers(null, null);
+    doReturn(testMembers).when(spyCmd).getMembersIncludingLocators(null, null);
     doReturn(testResults1).when(spyCmd)
         .estimateLogSize(Matchers.any(SizeExportLogsFunction.Args.class), eq(member1));
     doReturn(testResults2).when(spyCmd)
@@ -261,7 +264,7 @@ public class ExportLogsCommandTest {
     testResults1.addResult(member1, new ManagementException(sb.toString()));
 
     doReturn(mockCache).when(spyCmd).getCache();
-    doReturn(testMembers).when(spyCmd).getMembers(null, null);
+    doReturn(testMembers).when(spyCmd).getMembersIncludingLocators(null, null);
     doReturn(testResults1).when(spyCmd)
         .estimateLogSize(Matchers.any(SizeExportLogsFunction.Args.class), eq(member1));
 
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsDUnitTest.java
index 43adca6..c23393f 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsDUnitTest.java
@@ -57,7 +57,7 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.Member;
 
 @Category(DistributedTest.class)
@@ -69,7 +69,7 @@ public class ExportLogsDUnitTest {
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
 
   @Rule
-  public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public GfshCommandRule gfshConnector = new GfshCommandRule();
 
   private MemberVM locator;
   private MemberVM server1;
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 c798ee0..f992f9a 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
@@ -28,7 +28,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
 @Category(IntegrationTest.class)
@@ -38,7 +38,7 @@ public class ExportLogsIntegrationTest {
       new LocatorStarterRule().withWorkingDir().withLogFile().withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void connect() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOnServerManagerDUnit.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOnServerManagerDUnit.java
index f1e3bbd..c7696a5 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOnServerManagerDUnit.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOnServerManagerDUnit.java
@@ -30,7 +30,7 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 
 @Category(DistributedTest.class)
@@ -41,12 +41,12 @@ public class ExportLogsOnServerManagerDUnit {
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
 
   @Rule
-  public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public GfshCommandRule gfshConnector = new GfshCommandRule();
 
   @Test
   public void testExportWithOneServer() throws Exception {
     MemberVM server0 = lsRule.startServerAsJmxManager(0);
-    gfshConnector.connect(server0.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfshConnector.connect(server0.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     gfshConnector.executeAndAssertThat("export logs").statusIsSuccess();
 
     String message = gfshConnector.getGfshOutput();
@@ -64,8 +64,7 @@ public class ExportLogsOnServerManagerDUnit {
   public void testExportWithPeerLocator() throws Exception {
     MemberVM server0 = lsRule.startServerAsEmbededLocator(0);
     lsRule.startServerVM(1, server0.getEmbeddedLocatorPort());
-    gfshConnector.connect(server0.getEmbeddedLocatorPort(),
-        GfshShellConnectionRule.PortType.locator);
+    gfshConnector.connect(server0.getEmbeddedLocatorPort(), GfshCommandRule.PortType.locator);
     gfshConnector.executeAndAssertThat("export logs").statusIsSuccess();
 
     String message = gfshConnector.getGfshOutput();
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsStatsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsStatsDUnitTest.java
index d7e6095..009053b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsStatsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsStatsDUnitTest.java
@@ -48,7 +48,7 @@ import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ExportLogsStatsDUnitTest {
@@ -57,7 +57,7 @@ public class ExportLogsStatsDUnitTest {
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
 
   @ClassRule
-  public static GfshShellConnectionRule connector = new GfshShellConnectionRule();
+  public static GfshCommandRule connector = new GfshCommandRule();
 
   protected static int jmxPort, httpPort;
   protected static Set<String> expectedZipEntries = new HashSet<>();
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsWithMemberGroupDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsWithMemberGroupDUnitTest.java
index ad5ea93..b4ae334 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsWithMemberGroupDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsWithMemberGroupDUnitTest.java
@@ -41,7 +41,7 @@ import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ExportLogsWithMemberGroupDUnitTest {
@@ -50,7 +50,7 @@ public class ExportLogsWithMemberGroupDUnitTest {
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
 
   @ClassRule
-  public static GfshShellConnectionRule connector = new GfshShellConnectionRule();
+  public static GfshCommandRule connector = new GfshCommandRule();
 
   protected static int jmxPort, httpPort;
   protected static Set<String> expectedZipEntries = new HashSet<>();
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/FunctionCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/FunctionCommandsDUnitTest.java
index cc5227f..ab67cd3 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/FunctionCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/FunctionCommandsDUnitTest.java
@@ -40,7 +40,7 @@ import org.apache.geode.management.ManagementService;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class FunctionCommandsDUnitTest {
@@ -54,7 +54,7 @@ public class FunctionCommandsDUnitTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
@@ -116,7 +116,7 @@ public class FunctionCommandsDUnitTest {
   }
 
   public void connectGfsh(MemberVM vm) throws Exception {
-    gfsh.connectAndVerify(vm.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(vm.getJmxPort(), GfshCommandRule.PortType.jmxManager);
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GcCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GcCommandDUnitTest.java
index a3e2937..bf00b73 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GcCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GcCommandDUnitTest.java
@@ -17,8 +17,8 @@ package org.apache.geode.management.internal.cli.commands;
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.http;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.jmxManager;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.http;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.jmxManager;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.Properties;
@@ -35,7 +35,7 @@ import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 
 @Category(DistributedTest.class)
@@ -61,7 +61,7 @@ public class GcCommandDUnitTest {
   public static LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @ClassRule
-  public static GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public static GfshCommandRule gfsh = new GfshCommandRule();
 
   @BeforeClass
   public static void setup() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
index 3b242fc..4d2c0b9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GemfireDataCommandsDUnitTest.java
@@ -26,15 +26,10 @@ import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
 import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
 import static org.apache.geode.test.dunit.Wait.waitForCriterion;
 
-import java.io.File;
-import java.io.IOException;
 import java.io.Serializable;
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
-import java.util.Map;
 import java.util.Properties;
 import java.util.Random;
 import java.util.Set;
@@ -70,12 +65,8 @@ import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.HeadlessGfsh;
 import org.apache.geode.management.internal.cli.domain.DataCommandRequest;
-import org.apache.geode.management.internal.cli.dto.Car;
-import org.apache.geode.management.internal.cli.dto.Key1;
-import org.apache.geode.management.internal.cli.dto.ObjectWithCharAttr;
 import org.apache.geode.management.internal.cli.dto.Value1;
 import org.apache.geode.management.internal.cli.dto.Value2;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.json.GfJsonArray;
 import org.apache.geode.management.internal.cli.json.GfJsonException;
 import org.apache.geode.management.internal.cli.result.CommandResult;
@@ -83,7 +74,6 @@ import org.apache.geode.management.internal.cli.result.CompositeResultData;
 import org.apache.geode.management.internal.cli.result.CompositeResultData.SectionResultData;
 import org.apache.geode.management.internal.cli.result.ResultData;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.Host;
 import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.SerializableCallable;
@@ -584,7 +574,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
     validateResult(cmdResult, true);
   }
 
-  @Test // FlakyTest: GEODE-2006
+  @Test
   public void testSelectCommand() {
     setupForSelect();
     doTestGetRegionAssociatedMembersForSelect();
@@ -752,58 +742,6 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
     }
   }
 
-  @Test
-  public void testSimplePutCommand() {
-    final String keyPrefix = "testKey";
-    final String valuePrefix = "testValue";
-
-    setupForGetPutRemoveLocateEntry("tesSimplePut");
-
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-
-    for (int i = 0; i < COUNT; i++) {
-      String command = "put";
-      String key = keyPrefix + i;
-      String value = valuePrefix + i;
-      command = command + " " + "--key=" + key + " --value=" + value + " --region="
-          + DATA_REGION_NAME_PATH;
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      validateResult(cmdResult, true);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-    }
-
-    // Bug : 51587 : GFSH command failing when ; is present in either key or value in put operation
-    String command = "put";
-    String key = keyPrefix + "\\;" + COUNT;
-    String value = valuePrefix + "\\;" + COUNT;
-    command =
-        command + " " + "--key=" + key + " --value=" + value + " --region=" + DATA_REGION_NAME_PATH;
-    CommandResult cmdResult = executeCommand(command);
-    printCommandOutput(cmdResult);
-    validateResult(cmdResult, true);
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-    SerializableRunnable checkPutKeys = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_PATH);
-        assertNotNull(region);
-        for (int i = 0; i < COUNT; i++) {
-          String key = keyPrefix + i;
-          assertEquals(true, region.containsKey(key));
-        }
-        // Validation for Bug 51587
-        String key = keyPrefix + "\\;" + COUNT;
-        assertEquals(true, region.containsKey(key));
-      }
-    };
-
-    vm1.invoke(checkPutKeys);
-    vm2.invoke(checkPutKeys);
-  }
 
   private void validateResult(CommandResult cmdResult, boolean expected) {
     if (ResultData.TYPE_COMPOSITE.equals(cmdResult.getType())) {
@@ -909,598 +847,6 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
       fail("Expected CompositeResult Returned Result Type " + cmdResult.getType());
   }
 
-  @Test // FlakyTest: GEODE-1249
-  public void testSimplePutIfAbsentCommand() {
-    final String keyPrefix = "testKey";
-    final String valuePrefix = "testValue";
-
-    setupForGetPutRemoveLocateEntry("testSimplePutIfAbsent");
-
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-
-    // Seed the region with some keys
-    SerializableRunnable putKeys = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_PATH);
-        assertNotNull(region);
-        region.clear();
-        for (int i = 0; i < COUNT; i++) {
-          String key = keyPrefix + i;
-          String value = valuePrefix + i;
-          region.put(key, value);
-        }
-        assertEquals(COUNT, region.size());
-      }
-    };
-    vm1.invoke(putKeys);
-
-    // Now try to replace all existing keys with new values to test --skip-if-exists. Values should
-    // not be replaced if the key is present.
-    for (int i = 0; i < COUNT; i++) {
-      String command = "put";
-      String key = keyPrefix + i;
-      String value = valuePrefix + i + i;
-      command = command + " " + "--key=" + key + " --value=" + value + " --region="
-          + DATA_REGION_NAME_PATH + " --skip-if-exists=true";
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-    }
-
-    // Verify that none of the values were replaced
-    SerializableRunnable checkPutIfAbsentKeys = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_PATH);
-        assertNotNull(region);
-        for (int i = 0; i < COUNT; i++) {
-          String key = keyPrefix + i;
-          String expected = valuePrefix + i;
-          String actual = (String) region.get(key);
-          assertEquals("--skip-if-exists=true failed to preserve value", expected, actual);
-        }
-      }
-    };
-
-    vm1.invoke(checkPutIfAbsentKeys);
-    vm2.invoke(checkPutIfAbsentKeys);
-  }
-
-  @Test
-  public void testSimpleGetLocateEntryCommand() {
-    final String keyPrefix = "testKey";
-    final String valuePrefix = "testValue";
-
-    setupForGetPutRemoveLocateEntry("testSimpleGetLocateEntry");
-
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-
-    SerializableRunnable putKeys = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_PATH);
-        assertNotNull(region);
-        region.clear();
-        for (int i = 0; i < COUNT; i++) {
-          String key = keyPrefix + i;
-          String value = valuePrefix + i;
-          region.put(key, value);
-        }
-      }
-    };
-
-    vm1.invoke(putKeys);
-    for (int i = 0; i < COUNT; i++) {
-      String command = "get";
-      String key = keyPrefix + i;
-      String value = valuePrefix + i;
-      command = command + " " + "--key=" + key + " --region=" + DATA_REGION_NAME_PATH;
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-
-      command = "locate entry";
-      command = command + " " + "--key=" + key + " --region=" + DATA_REGION_NAME_PATH;
-      cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-
-    }
-
-  }
-
-  @Test
-  public void testRecursiveLocateEntryCommand() {
-    final String keyPrefix = "testKey";
-    final String valuePrefix = "testValue";
-
-    setupForGetPutRemoveLocateEntry("testRecursiveLocateEntry");
-
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-
-    SerializableRunnable putKeys = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_PATH);
-        Region region2 = cache.getRegion(DATA_REGION_NAME_CHILD_1_PATH);
-        Region region3 = cache.getRegion(DATA_REGION_NAME_CHILD_1_2_PATH);
-        assertNotNull(region);
-        region.clear();
-        for (int i = 0; i < COUNT; i++) {
-          String key = keyPrefix + i;
-          String value = valuePrefix + i;
-          region.put(key, value);
-          region2.put(key, value);
-          region3.put(key, value);
-        }
-      }
-    };
-
-    vm1.invoke(putKeys);
-    for (int i = 0; i < COUNT; i++) {
-      String key = keyPrefix + i;
-      String command = "locate entry";
-      command = command + " " + "--key=" + key + " --region=" + DATA_REGION_NAME_PATH
-          + " --recursive=true";
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-      validateLocationsResult(cmdResult, 6); // 3 Regions X 2 members = 6
-    }
-  }
-
-  @Test
-  public void testGetLocateEntryFromRegionOnDifferentVM() {
-    final String keyPrefix = "testKey";
-    final String valuePrefix = "testValue";
-
-    setupForGetPutRemoveLocateEntry("testGetLocateEntryFromRegionOnDifferentVM");
-
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-
-    SerializableRunnable putKeys1 = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_VM1_PATH);
-        Region parRegion = cache.getRegion(DATA_PAR_REGION_NAME_VM1_PATH);
-        assertNotNull(region);
-        region.clear();
-        for (int i = 0; i < COUNT; i++) {
-          if (i % 2 == 0) {
-            String key = keyPrefix + i;
-            String value = valuePrefix + i;
-            region.put(key, value);
-            parRegion.put(key, value);
-          }
-        }
-      }
-    };
-
-    SerializableRunnable putKeys2 = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_VM2_PATH);
-        Region parRegion = cache.getRegion(DATA_PAR_REGION_NAME_VM2_PATH);
-        assertNotNull(region);
-        region.clear();
-        for (int i = 0; i < COUNT; i++) {
-          if (i % 2 != 0) {
-            String key = keyPrefix + i;
-            String value = valuePrefix + i;
-            region.put(key, value);
-            parRegion.put(key, value);
-          }
-        }
-      }
-    };
-
-    vm1.invoke(putKeys1);
-    vm2.invoke(putKeys2);
-    for (int i = 0; i < COUNT; i++) {
-      String command = "get";
-      String key = keyPrefix + i;
-      String value = valuePrefix + i;
-      if (i % 2 == 0)
-        command = command + " " + "--key=" + key + " --region=" + DATA_REGION_NAME_VM1_PATH;
-      else if (i % 2 == 1)
-        command = command + " " + "--key=" + key + " --region=" + DATA_REGION_NAME_VM2_PATH;
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-
-      command = "locate entry";
-      if (i % 2 == 0)
-        command = command + " " + "--key=" + key + " --region=" + DATA_REGION_NAME_VM1_PATH;
-      else if (i % 2 == 1)
-        command = command + " " + "--key=" + key + " --region=" + DATA_REGION_NAME_VM2_PATH;
-      cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-
-
-      command = "locate entry";
-      if (i % 2 == 0)
-        command = command + " " + "--key=" + key + " --region=" + DATA_PAR_REGION_NAME_VM1_PATH;
-      else if (i % 2 == 1)
-        command = command + " " + "--key=" + key + " --region=" + DATA_PAR_REGION_NAME_VM2_PATH;
-      cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-      validateLocationsResult(cmdResult, 1); // 1 Regions X (2-1) 2 Copies but redundancy not
-                                             // satisfied = 1
-    }
-  }
-
-  @Test // FlakyTest: GEODE-1822
-  public void testGetLocateEntryLocationsForPR() {
-    final String keyPrefix = "testKey";
-    final String valuePrefix = "testValue";
-
-    setupForGetPutRemoveLocateEntry("testGetLocateEntryLocationsForPR");
-    final VM vm1 = Host.getHost(0).getVM(1);
-
-    SerializableRunnable putKeys1 = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_PAR_REGION_NAME_PATH);
-        assertNotNull(region);
-        for (int i = 0; i < COUNT; i++) {
-          String key = keyPrefix + i;
-          String value = valuePrefix + i;
-          region.put(key, value);
-        }
-      }
-    };
-
-    vm1.invoke(putKeys1);
-
-    for (int i = 0; i < COUNT; i++) {
-      String key = keyPrefix + i;
-      String command = "locate entry";
-      command = command + " " + "--key=" + key + " --region=" + DATA_PAR_REGION_NAME_PATH;
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-      validateLocationsResult(cmdResult, 2); // 2 Members
-    }
-  }
-
-  @Test
-  public void testPutFromRegionOnDifferentVM() {
-    final String keyPrefix = "testKey";
-    final String valuePrefix = "testValue";
-
-    setupForGetPutRemoveLocateEntry("testPutFromRegionOnDifferentVM");
-
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-
-    for (int i = 0; i < COUNT; i++) {
-      String command = "put";
-      String key = keyPrefix + i;
-      String value = valuePrefix + i;
-      if (i % 2 == 0)
-        command = command + " " + "--key=" + key + " --value=" + value + " --region="
-            + DATA_REGION_NAME_VM1_PATH;
-      else
-        command = command + " " + "--key=" + key + " --value=" + value + " --region="
-            + DATA_REGION_NAME_VM2_PATH;
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-    }
-
-    SerializableRunnable checkPutKeysInVM1 = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_VM1_PATH);
-        assertNotNull(region);
-        for (int i = 0; i < COUNT; i++) {
-          if (i % 2 == 0) {
-            String key = keyPrefix + i;
-            assertEquals(true, region.containsKey(key));
-          }
-        }
-      }
-    };
-
-    SerializableRunnable checkPutKeysInVM2 = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_VM2_PATH);
-        assertNotNull(region);
-        for (int i = 0; i < COUNT; i++) {
-          if (i % 2 != 0) {
-            String key = keyPrefix + i;
-            assertEquals(true, region.containsKey(key));
-          }
-        }
-      }
-    };
-
-    vm1.invoke(checkPutKeysInVM1);
-    vm2.invoke(checkPutKeysInVM2);
-  }
-
-  @Test // FlakyTest: GEODE-1182
-  public void testGetLocateEntryJsonKeys() {
-    final String keyPrefix = "testKey";
-
-    setupForGetPutRemoveLocateEntry("testGetLocateEntryJsonKeys");
-
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-
-    SerializableRunnable putKeys = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_PATH);
-        assertNotNull(region);
-        region.clear();
-        for (int i = 0; i < COUNT; i++) {
-          String keyString = keyPrefix + i;
-          Key1 key = new Key1();
-          key.setId(keyString);
-          key.setName("name" + keyString);
-          Value2 value2 = new Value2();
-          value2.setStateName("State" + keyString);
-          value2.setCapitalCity("capital" + keyString);
-          value2.setPopulation(i * 100);
-          value2.setAreaInSqKm(i * 100.4365);
-          region.put(key, value2);
-        }
-
-        // Added for Bug #51175
-        List<String> colors = new ArrayList<String>();
-        colors.add("White");
-        colors.add("Red");
-        colors.add("Blue");
-        Map<String, String> attrMap = new HashMap<String, String>();
-        attrMap.put("power", "90hp");
-        attrMap.put("turningRadius", "4mtr");
-        attrMap.put("engineCapacity", "1248cc");
-        attrMap.put("turboGeometry", "VGT");
-
-        Set<String> attrSet = new HashSet<String>();
-        attrSet.add("power");
-        attrSet.add("turningRadius");
-
-        for (int i = COUNT; i < COUNT + 5; i++) {
-          String keyString = keyPrefix + i;
-          Key1 key = new Key1();
-          key.setId(keyString);
-          key.setName("name" + keyString);
-          Car car = new Car();
-          car.setMake("Make" + keyString);
-          car.setModel("Model" + keyString);
-          car.setColors(colors);
-          car.setAttributes(attrMap);
-          car.setAttributeSet(attrSet);
-          region.put(key, car);
-        }
-      }
-    };
-
-    String expectedCols[] = {"id", "name", "stateName", "capitalCity", "population", "areaInSqKm"};
-    vm1.invoke(putKeys);
-    for (int i = 0; i < COUNT; i++) {
-      String command = "get";
-      String keyString = keyPrefix + i;
-      String population = "" + i * 100;
-      String area = "" + i * (100.4365);
-      String keyJson = keyTemplate.replaceAll("\\?", keyString);
-      String valueJson = valueTemplate.replaceAll("\\?1", population);
-      valueJson = valueJson.replaceAll("\\?2", area);
-      valueJson = valueJson.replaceAll("\\?", keyString);
-      getLogWriter().info("Getting key with json key : " + keyJson);
-      command = command + " " + "--key=" + keyJson + " --region=" + DATA_REGION_NAME_PATH
-          + " --key-class=" + Key1.class.getCanonicalName();
-      command = command + " --value-class=" + Value2.class.getCanonicalName();
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-      validateJSONGetResult(cmdResult, expectedCols);
-
-      command = "locate entry";
-      command = command + " " + "--key=" + keyJson + " --region=" + DATA_REGION_NAME_PATH
-          + " --key-class=" + Key1.class.getCanonicalName();
-      command = command + " --value-class=" + Value2.class.getCanonicalName();
-      cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-    }
-
-    // Added for Bug #51175
-    expectedCols =
-        new String[] {"id", "name", "attributes", "make", "model", "colors", "attributeSet"};
-    for (int i = COUNT; i < COUNT + 5; i++) {
-      String command = "get";
-      String keyString = keyPrefix + i;
-      String population = "" + i * 100;
-      String area = "" + i * (100.4365);
-      String keyJson = keyTemplate.replaceAll("\\?", keyString);
-      String valueJson = valueTemplate.replaceAll("\\?1", population);
-      valueJson = valueJson.replaceAll("\\?2", area);
-      valueJson = valueJson.replaceAll("\\?", keyString);
-      getLogWriter().info("Getting key with json key : " + keyJson);
-      command = command + " " + "--key=" + keyJson + " --region=" + DATA_REGION_NAME_PATH
-          + " --key-class=" + Key1.class.getCanonicalName();
-      command = command + " --value-class=" + Value2.class.getCanonicalName();
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-      // validateJSONGetResult(cmdResult, expectedCols);
-      validateJSONGetResultValues(cmdResult, expectedCols);
-
-      command = "locate entry";
-      command = command + " " + "--key=" + keyJson + " --region=" + DATA_REGION_NAME_PATH
-          + " --key-class=" + Key1.class.getCanonicalName();
-      command = command + " --value-class=" + Value2.class.getCanonicalName();
-      cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-    }
-  }
-
-  @Test // FlakyTest: GEODE-1430
-  public void testPutJsonKeys() {
-    final String keyPrefix = "testKey";
-
-    setupForGetPutRemoveLocateEntry("testPutJsonKeys");
-
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final VM vm2 = Host.getHost(0).getVM(2);
-
-    for (int i = 0; i < COUNT; i++) {
-      String command = "put";
-      String keyString = keyPrefix + i;
-      String population = "" + i * 100;
-      String area = "" + i * (100.4365);
-      String keyJson = keyTemplate.replaceAll("\\?", keyString);
-      String valueJson = valueTemplate.replaceAll("\\?1", population);
-      valueJson = valueJson.replaceAll("\\?2", area);
-      valueJson = valueJson.replaceAll("\\?", keyString);
-      getLogWriter().info("Putting key with json key : " + keyJson);
-      getLogWriter().info("Putting key with json valye : " + valueJson);
-      command = command + " " + "--key=" + keyJson + " --value=" + valueJson + " --region="
-          + DATA_REGION_NAME_PATH;
-      command = command + " --key-class=" + Key1.class.getCanonicalName() + " --value-class="
-          + Value2.class.getCanonicalName();
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-    }
-
-    // Bug #51175
-    for (int i = COUNT; i < COUNT + 5; i++) {
-      String command = "put";
-      String keyString = keyPrefix + i;
-      String id = "" + i * 100;
-      String make = "" + i * (100.4365);
-      String model = "" + i * (100.4365);
-      String list = "['red','white','blue']";
-      String set = "['red','white','blue']";
-      String map = "{'power':'90hp'}";
-      String keyJson = keyTemplate.replaceAll("\\?", keyString);
-
-      String valueJson = carTemplate.replaceAll("\\?make", make);
-      valueJson = valueJson.replaceAll("\\?model", model);
-      valueJson = valueJson.replaceAll("\\?list", list);
-      valueJson = valueJson.replaceAll("\\?set", set);
-      valueJson = valueJson.replaceAll("\\?map", map);
-
-      getLogWriter().info("Putting key with json key : " + keyJson);
-      getLogWriter().info("Putting key with json valye : " + valueJson);
-      command = command + " " + "--key=" + keyJson + " --value=" + valueJson + " --region="
-          + DATA_REGION_NAME_PATH;
-      command = command + " --key-class=" + Key1.class.getCanonicalName() + " --value-class="
-          + Car.class.getCanonicalName();
-      CommandResult cmdResult = executeCommand(command);
-      printCommandOutput(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      validateResult(cmdResult, true);
-    }
-
-    SerializableRunnable checkPutKeys = new SerializableRunnable() {
-      @Override
-      public void run() {
-        Cache cache = getCache();
-        Region region = cache.getRegion(DATA_REGION_NAME_PATH);
-        assertNotNull(region);
-        for (int i = 0; i < COUNT + 5; i++) {
-          String keyString = keyPrefix + i;
-          Key1 key = new Key1();
-          key.setId(keyString);
-          key.setName("name" + keyString);
-          assertEquals(true, region.containsKey(key));
-
-          // Bug #51175
-          if (i >= COUNT) {
-            Car car = (Car) region.get(key);
-            assertNotNull(car.getAttributes());
-            assertNotNull(car.getAttributeSet());
-            assertNotNull(car.getColors());
-          }
-
-        }
-      }
-    };
-
-    vm1.invoke(checkPutKeys);
-    vm2.invoke(checkPutKeys);
-
-    doBugCheck50449();
-  }
-
-  public void doBugCheck50449() {
-    String command = "put --key-class=" + ObjectWithCharAttr.class.getCanonicalName()
-        + " --value=456 --key=\"('name':'hesdfdsfy2','t':456, 'c':'d')\"" + " --region="
-        + DATA_REGION_NAME_PATH;
-    CommandResult cmdResult = executeCommand(command);
-    printCommandOutput(cmdResult);
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-    validateResult(cmdResult, true);
-
-    command = "put --key-class=" + ObjectWithCharAttr.class.getCanonicalName()
-        + " --value=123 --key=\"('name':'hesdfdsfy2','t':123, 'c':'d')\"" + " --region="
-        + DATA_REGION_NAME_PATH;
-    cmdResult = executeCommand(command);
-    printCommandOutput(cmdResult);
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-    validateResult(cmdResult, true);
-
-    command = "get --key-class=" + ObjectWithCharAttr.class.getCanonicalName()
-        + " --key=\"('name':'','t':123, 'c':'d')\"" + " --region=" + DATA_REGION_NAME_PATH;
-    cmdResult = executeCommand(command);
-    printCommandOutput(cmdResult);
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-    validateResult(cmdResult, true);
-
-    command = "get --key-class=" + ObjectWithCharAttr.class.getCanonicalName()
-        + " --key=\"('name':'','t':456, 'c':'d')\"" + " --region=" + DATA_REGION_NAME_PATH;
-    cmdResult = executeCommand(command);
-    printCommandOutput(cmdResult);
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-    validateResult(cmdResult, true);
-
-    // check wrong key
-    command = "get --key-class=" + ObjectWithCharAttr.class.getCanonicalName()
-        + " --key=\"('name':'','t':999, 'c':'d')\"" + " --region=" + DATA_REGION_NAME_PATH;
-    cmdResult = executeCommand(command);
-    printCommandOutput(cmdResult);
-    assertEquals(Result.Status.OK, cmdResult.getStatus());
-    validateResult(cmdResult, false);
-  }
-
   private Region<?, ?> createParReg(String regionName, Cache cache) {
     RegionFactory regionFactory = cache.createRegionFactory();
     regionFactory.setDataPolicy(DataPolicy.PARTITION);
@@ -1513,164 +859,6 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
     return regionFactory.create(regionName);
   }
 
-  @Test // FlakyTest: GEODE-1404
-  public void testImportExportData() throws InterruptedException, IOException {
-    final String regionName = "Region1";
-    final String exportFileName = "export.gfd";
-    final VM manager = Host.getHost(0).getVM(0);
-    final VM vm1 = Host.getHost(0).getVM(1);
-    final File exportFile = new File(exportFileName);
-    final String filePath = exportFile.getCanonicalPath();
-
-    try {
-      if (!exportFile.exists()) {
-        exportFile.createNewFile();
-      }
-      exportFile.deleteOnExit();
-
-      setUpJmxManagerOnVm0ThenConnect(null);
-
-      manager.invoke(new SerializableRunnable() {
-        public void run() {
-          createParReg(regionName, getCache());
-        }
-      });
-
-      vm1.invoke(new SerializableRunnable() {
-        @Override
-        public void run() throws Exception {
-          Region region = createParReg(regionName, getCache());
-          for (int i = 0; i < 100; i++) {
-            region.put(i, i);
-          }
-        }
-      });
-
-      CommandStringBuilder csb = new CommandStringBuilder(CliStrings.EXPORT_DATA);
-      csb.addOption(CliStrings.EXPORT_DATA__REGION, regionName);
-      csb.addOption(CliStrings.MEMBER, "Manager");
-      csb.addOption(CliStrings.EXPORT_DATA__FILE, filePath);
-      String commandString = csb.toString();
-
-      CommandResult cmdResult = executeCommand(commandString);
-      String resultAsString = commandResultToString(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      getLogWriter().info("Command Output");
-      getLogWriter().info(resultAsString);
-
-      vm1.invoke(new SerializableRunnable() {
-        public void run() {
-          Region region = getCache().getRegion(regionName);
-          for (int i = 0; i < 100; i++) {
-            region.destroy(i);
-          }
-        }
-      });
-
-      /*
-       * Add CacheListener
-       */
-
-      manager.invoke(addCacheListenerInvocations(regionName));
-      vm1.invoke(addCacheListenerInvocations(regionName));
-
-      /*
-       * Import the data
-       */
-
-      csb = new CommandStringBuilder(CliStrings.IMPORT_DATA);
-      csb.addOption(CliStrings.IMPORT_DATA__REGION, regionName);
-      csb.addOption(CliStrings.IMPORT_DATA__FILE, filePath);
-      csb.addOption(CliStrings.MEMBER, "Manager");
-
-      commandString = csb.toString();
-      cmdResult = executeCommand(commandString);
-      resultAsString = commandResultToString(cmdResult);
-
-      getLogWriter().info("Result of import data");
-      getLogWriter().info(resultAsString);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      /*
-       * Validate the region entries after import They must match the entries before export
-       */
-
-      manager.invoke(new SerializableRunnable() {
-        public void run() {
-          Region region = getCache().getRegion(regionName);
-          for (int i = 0; i < 100; i++) {
-            assertEquals(i, region.get(i));
-          }
-        }
-      });
-
-      /*
-       * Verify callbacks were not invoked
-       */
-
-      manager.invoke(verifyCacheListenerInvocations(regionName, false));
-      vm1.invoke(verifyCacheListenerInvocations(regionName, false));
-
-      /*
-       * Import the data with invokeCallbacks=true
-       */
-
-      vm1.invoke(new SerializableRunnable() {
-        public void run() {
-          Region region = getCache().getRegion(regionName);
-          for (int i = 0; i < 100; i++) {
-            region.destroy(i);
-          }
-        }
-      });
-
-      csb = new CommandStringBuilder(CliStrings.IMPORT_DATA);
-      csb.addOption(CliStrings.IMPORT_DATA__REGION, regionName);
-      csb.addOption(CliStrings.IMPORT_DATA__FILE, filePath);
-      csb.addOption(CliStrings.MEMBER, "Manager");
-      csb.addOption(CliStrings.IMPORT_DATA__INVOKE_CALLBACKS, "true");
-      commandString = csb.toString();
-      cmdResult = executeCommand(commandString);
-      commandResultToString(cmdResult);
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-
-      /*
-       * Verify callbacks were invoked
-       */
-
-      manager.invoke(verifyCacheListenerInvocations(regionName, true));
-      vm1.invoke(verifyCacheListenerInvocations(regionName, true));
-
-      // Test for bad input
-      csb = new CommandStringBuilder(CliStrings.EXPORT_DATA);
-      csb.addOption(CliStrings.EXPORT_DATA__REGION, "FDSERW");
-      csb.addOption(CliStrings.EXPORT_DATA__FILE, filePath);
-      csb.addOption(CliStrings.MEMBER, "Manager");
-      commandString = csb.getCommandString();
-
-      cmdResult = executeCommand(commandString);
-      resultAsString = commandResultToString(cmdResult);
-      getLogWriter().info("Result of import data with wrong region name");
-      getLogWriter().info(resultAsString);
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-
-      csb = new CommandStringBuilder(CliStrings.IMPORT_DATA);
-      csb.addOption(CliStrings.IMPORT_DATA__REGION, regionName);
-      csb.addOption(CliStrings.IMPORT_DATA__FILE, "#WEQW");
-      csb.addOption(CliStrings.MEMBER, "Manager");
-      commandString = csb.getCommandString();
-
-      cmdResult = executeCommand(commandString);
-      resultAsString = commandResultToString(cmdResult);
-      getLogWriter().info("Result of import data with wrong file");
-      getLogWriter().info(resultAsString);
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-
-    } finally {
-      exportFile.delete();
-    }
-  }
-
   private SerializableRunnable addCacheListenerInvocations(final String regionName) {
     return new SerializableRunnable() {
       public void run() {
@@ -2141,9 +1329,8 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
     String memSizeFromFunctionCall = (String) manager.invoke(new SerializableCallable() {
       public Object call() {
         InternalCache cache = GemFireCacheImpl.getInstance();
-        CliUtil.getMembersForeRegionViaFunction(cache, DATA_REGION_NAME_PATH, true);
-        return ""
-            + CliUtil.getMembersForeRegionViaFunction(cache, DATA_REGION_NAME_PATH, true).size();
+        CliUtil.getRegionAssociatedMembers(DATA_REGION_NAME_PATH, cache, true);
+        return "" + CliUtil.getRegionAssociatedMembers(DATA_REGION_NAME_PATH, cache, true).size();
       }
     });
 
@@ -2184,8 +1371,7 @@ public class GemfireDataCommandsDUnitTest extends CliCommandTestBase {
     String memSizeFromFunctionCall = (String) manager.invoke(new SerializableCallable() {
       public Object call() {
         InternalCache cache = GemFireCacheImpl.getInstance();
-        return ""
-            + CliUtil.getMembersForeRegionViaFunction(cache, REBALANCE_REGION_NAME, true).size();
+        return "" + CliUtil.getRegionAssociatedMembers(REBALANCE_REGION_NAME, cache, true).size();
       }
     });
 
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GetCommandIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GetCommandIntegrationTest.java
index 226edc3..d840613 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GetCommandIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GetCommandIntegrationTest.java
@@ -37,7 +37,7 @@ import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionFactory;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 
@@ -47,8 +47,8 @@ public class GetCommandIntegrationTest {
   private static ServerStarterRule server =
       new ServerStarterRule().withJMXManager().withAutoStart();
 
-  private static GfshShellConnectionRule gfsh =
-      new GfshShellConnectionRule(server::getJmxPort, GfshShellConnectionRule.PortType.jmxManager);
+  private static GfshCommandRule gfsh =
+      new GfshCommandRule(server::getJmxPort, GfshCommandRule.PortType.jmxManager);
 
   @ClassRule
   public static RuleChain chain = RuleChain.outerRule(server).around(gfsh);
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java
index 3436cde..2902daa 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandIntegrationTest.java
@@ -15,15 +15,13 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.assertj.core.api.Assertions.assertThat;
-
 import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
 @Category(IntegrationTest.class)
@@ -32,7 +30,7 @@ public class GfshCommandIntegrationTest {
   public static LocatorStarterRule locator = new LocatorStarterRule().withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Test
   public void invalidCommandWhenNotConnected() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
index 894a773..a2ee67e 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
@@ -14,624 +14,87 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_BIND_ADDRESS;
-import static org.apache.geode.distributed.ConfigurationProperties.HTTP_SERVICE_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
-import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
-import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.apache.geode.distributed.ConfigurationProperties.START_DEV_REST_API;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
 
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
 import java.util.Collections;
-import java.util.List;
-import java.util.Properties;
-import java.util.Set;
 
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.lib.concurrent.Synchroniser;
-import org.jmock.lib.legacy.ClassImposteriser;
-import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.distributed.internal.DistributionConfig;
-import org.apache.geode.internal.cache.InternalCache;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.CollectionUtils;
-import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.util.MemberNotFoundException;
+import org.apache.geode.distributed.internal.ClusterConfigurationService;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.test.junit.categories.UnitTest;
 
-/**
- * The GfshCommandJUnitTest class is a test suite of test cases testing the contract and
- * functionality of the GfshCommand class for implementing GemFire shell (Gfsh) commands.
- *
- * @see GfshCommand
- * @see org.jmock.Expectations
- * @see org.jmock.Mockery
- * @see org.jmock.lib.legacy.ClassImposteriser
- * @see org.junit.Assert
- * @see org.junit.Test
- * @since GemFire 7.0
- */
 @Category(UnitTest.class)
 public class GfshCommandJUnitTest {
 
-  private Mockery mockContext;
-
-  private static <T extends Function> T register(T function) {
-    if (FunctionService.isRegistered(function.getId())) {
-      function = (T) FunctionService.getFunction(function.getId());
-    } else {
-      FunctionService.registerFunction(function);
-    }
-
-    return function;
-  }
-
-  private static class DefaultGfshCommand implements GfshCommand {
-  }
-
-  private DefaultGfshCommand defaultGfshCommand;
+  private GfshCommand command;
+  private Gfsh gfsh;
+  private ClusterConfigurationService clusterConfigurationService;
 
   @Before
-  public void setup() {
-    mockContext = new Mockery();
-    mockContext.setImposteriser(ClassImposteriser.INSTANCE);
-    mockContext.setThreadingPolicy(new Synchroniser());
-
-    defaultGfshCommand = new DefaultGfshCommand();
-  }
-
-  @After
-  public void tearDown() {
-    mockContext.assertIsSatisfied();
-    mockContext = null;
-  }
-
-  private GfshCommand createAbstractCommandsSupport(final InternalCache cache) {
-    return new TestCommands(cache);
-  }
-
-  private DistributedMember createMockMember(final String memberId, final String memberName) {
-    final DistributedMember mockMember =
-        mockContext.mock(DistributedMember.class, "DistributedMember " + memberId);
-
-    mockContext.checking(new Expectations() {
-      {
-        allowing(mockMember).getName();
-        will(returnValue(memberName));
-        allowing(mockMember).getId();
-        will(returnValue(memberId));
-      }
-    });
-
-    return mockMember;
-  }
-
-  @Test
-  public void testConvertDefaultValue() {
-    assertNull(defaultGfshCommand.convertDefaultValue(null, StringUtils.EMPTY));
-    assertEquals(StringUtils.EMPTY,
-        defaultGfshCommand.convertDefaultValue(StringUtils.EMPTY, "test"));
-    assertEquals(StringUtils.SPACE,
-        defaultGfshCommand.convertDefaultValue(StringUtils.SPACE, "testing"));
-    assertEquals("tested",
-        defaultGfshCommand.convertDefaultValue(CliMetaData.ANNOTATION_DEFAULT_VALUE, "tested"));
-  }
-
-  @Test
-  public void testGetMemberWithMatchingMemberId() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final GfshCommand commands = createAbstractCommandsSupport(mockCache);
-
-    assertSame(mockMemberTwo, commands.getMember(mockCache, "2"));
-  }
-
-  @Test
-  public void testGetMemberWithMatchingMemberName() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final GfshCommand commands = createAbstractCommandsSupport(mockCache);
-
-    assertSame(mockMemberOne, commands.getMember(mockCache, "One"));
+  public void before() throws Exception {
+    command = spy(GfshCommand.class);
+    gfsh = mock(Gfsh.class);
+    clusterConfigurationService = mock(ClusterConfigurationService.class);
   }
 
   @Test
-  public void testGetMemberWithMatchingMemberNameCaseInsensitive() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
+  public void isConnectedAndReady() throws Exception {
+    when(command.getGfsh()).thenReturn(null);
+    assertThat(command.isConnectedAndReady()).isFalse();
 
-    final GfshCommand commands = createAbstractCommandsSupport(mockCache);
+    when(command.getGfsh()).thenReturn(gfsh);
+    when(gfsh.isConnectedAndReady()).thenReturn(false);
+    assertThat(command.isConnectedAndReady()).isFalse();
 
-    assertSame(mockMemberSelf, commands.getMember(mockCache, "self"));
-  }
-
-  @Test(expected = MemberNotFoundException.class)
-  public void testGetMemberThrowsMemberNotFoundException() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final GfshCommand commands = createAbstractCommandsSupport(mockCache);
-
-    try {
-      commands.getMember(mockCache, "zero");
-    } catch (MemberNotFoundException expected) {
-      assertEquals(CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, "zero"),
-          expected.getMessage());
-      throw expected;
-    }
+    when(command.getGfsh()).thenReturn(gfsh);
+    when(gfsh.isConnectedAndReady()).thenReturn(true);
+    assertThat(command.isConnectedAndReady()).isTrue();
   }
 
   @Test
-  public void testGetMembers() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
+  public void persistClusterConfiguration() throws Exception {
+    when(command.getSharedConfiguration()).thenReturn(null);
+    Result result = ResultBuilder.createInfoResult("info");
+    Runnable runnable = mock(Runnable.class);
 
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-    final DistributedMember mockMemberOne = createMockMember("1", "One");
-    final DistributedMember mockMemberTwo = createMockMember("2", "Two");
+    command.persistClusterConfiguration(result, runnable);
+    assertThat(result.failedToPersist()).isTrue();
 
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(CollectionUtils.asSet(mockMemberOne, mockMemberTwo)));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final GfshCommand commands = createAbstractCommandsSupport(mockCache);
-
-    final Set<DistributedMember> expectedMembers =
-        CollectionUtils.asSet(mockMemberOne, mockMemberTwo, mockMemberSelf);
-    final Set<DistributedMember> actualMembers = commands.getMembers(mockCache);
-
-    assertNotNull(actualMembers);
-    assertEquals(expectedMembers.size(), actualMembers.size());
-    assertTrue(actualMembers.containsAll(expectedMembers));
+    when(command.getSharedConfiguration()).thenReturn(clusterConfigurationService);
+    command.persistClusterConfiguration(result, runnable);
+    assertThat(result.failedToPersist()).isFalse();
   }
 
   @Test
-  public void testGetMembersContainsOnlySelf() {
-    final InternalCache mockCache = mockContext.mock(InternalCache.class, "InternalCache");
-
-    final DistributedSystem mockDistributedSystem =
-        mockContext.mock(DistributedSystem.class, "DistributedSystem");
-    final DistributedMember mockMemberSelf = createMockMember("S", "Self");
-
-    mockContext.checking(new Expectations() {
-      {
-        oneOf(mockCache).getMembers();
-        will(returnValue(Collections.emptySet()));
-        oneOf(mockCache).getDistributedSystem();
-        will(returnValue(mockDistributedSystem));
-        oneOf(mockDistributedSystem).getDistributedMember();
-        will(returnValue(mockMemberSelf));
-      }
-    });
-
-    final GfshCommand commands = createAbstractCommandsSupport(mockCache);
-
-    final Set<DistributedMember> expectedMembers = CollectionUtils.asSet(mockMemberSelf);
-    final Set<DistributedMember> actualMembers = commands.getMembers(mockCache);
-
-    assertNotNull(actualMembers);
-    assertEquals(expectedMembers.size(), actualMembers.size());
-    assertTrue(actualMembers.containsAll(expectedMembers));
+  public void getMember() throws Exception {
+    doReturn(null).when(command).findMember("test");
+    assertThatThrownBy(() -> command.getMember("test")).isInstanceOf(EntityNotFoundException.class);
   }
 
   @Test
-  public void testRegister() {
-    try {
-      final Function mockFunction = mockContext.mock(Function.class, "Function");
-
-      mockContext.checking(new Expectations() {
-        {
-          exactly(3).of(mockFunction).getId();
-          will(returnValue("testRegister"));
-          oneOf(mockFunction).isHA();
-          will(returnValue(true));
-          oneOf(mockFunction).hasResult();
-          will(returnValue(true));
-        }
-      });
-
-      final GfshCommand commands =
-          createAbstractCommandsSupport(mockContext.mock(InternalCache.class));
-
-      assertFalse(FunctionService.isRegistered("testRegister"));
-      assertSame(mockFunction, register(mockFunction));
-      assertTrue(FunctionService.isRegistered("testRegister"));
-    } finally {
-      FunctionService.unregisterFunction("testRegister");
-    }
+  public void getMembers() throws Exception {
+    String[] members = {"member"};
+    doReturn(Collections.emptySet()).when(command).findMembers(members, null);
+    assertThatThrownBy(() -> command.getMembers(members, null))
+        .isInstanceOf(EntityNotFoundException.class);
   }
 
   @Test
-  public void testRegisteredAlready() {
-    try {
-      final Function registeredFunction = mockContext.mock(Function.class, "Registered Function");
-      final Function unregisteredFunction =
-          mockContext.mock(Function.class, "Unregistered Function");
-
-      mockContext.checking(new Expectations() {
-        {
-          exactly(2).of(registeredFunction).getId();
-          will(returnValue("testRegisteredAlready"));
-          oneOf(registeredFunction).isHA();
-          will(returnValue(false));
-          exactly(2).of(unregisteredFunction).getId();
-          will(returnValue("testRegisteredAlready"));
-        }
-      });
-
-      final GfshCommand commands =
-          createAbstractCommandsSupport(mockContext.mock(InternalCache.class));
-
-      FunctionService.registerFunction(registeredFunction);
-
-      assertTrue(FunctionService.isRegistered("testRegisteredAlready"));
-      assertSame(registeredFunction, register(unregisteredFunction));
-      assertTrue(FunctionService.isRegistered("testRegisteredAlready"));
-    } finally {
-      FunctionService.unregisterFunction("testRegisteredAlready");
-    }
-  }
-
-  @Test
-  public void testToStringOnBoolean() {
-    assertEquals("false", defaultGfshCommand.toString(null, null, null));
-    assertEquals("true", defaultGfshCommand.toString(true, null, null));
-    assertEquals("true", defaultGfshCommand.toString(Boolean.TRUE, null, null));
-    assertEquals("false", defaultGfshCommand.toString(false, null, null));
-    assertEquals("false", defaultGfshCommand.toString(Boolean.FALSE, null, null));
-    assertEquals("false", defaultGfshCommand.toString(true, "false", "true"));
-    assertEquals("true", defaultGfshCommand.toString(false, "false", "true"));
-    assertEquals("Yes", defaultGfshCommand.toString(true, "Yes", "No"));
-    assertEquals("Yes", defaultGfshCommand.toString(false, "No", "Yes"));
-    assertEquals("TRUE", defaultGfshCommand.toString(Boolean.TRUE, "TRUE", "FALSE"));
-    assertEquals("FALSE", defaultGfshCommand.toString(Boolean.FALSE, "TRUE", "FALSE"));
-  }
-
-  @Test
-  public void testToStringOnThrowable() {
-    assertEquals("test", defaultGfshCommand.toString(new Throwable("test"), false));
-  }
-
-  @Test
-  public void testToStringOnThrowablePrintingStackTrace() {
-    final StringWriter writer = new StringWriter();
-    final Throwable t = new Throwable("test");
-
-    t.printStackTrace(new PrintWriter(writer));
-
-    assertEquals(writer.toString(), defaultGfshCommand.toString(t, true));
-  }
-
-  private static class TestCommands implements GfshCommand {
-
-    private final InternalCache cache;
-
-    protected TestCommands(final InternalCache cache) {
-      assert cache != null : "The InternalCache cannot be null!";
-      this.cache = cache;
-    }
-
-    @Override
-    public InternalCache getCache() {
-      return this.cache;
-    }
-  }
-
-  @Test
-  public void testAddGemFirePropertyFileToCommandLine() {
-    List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-
-    StartMemberUtils.addGemFirePropertyFile(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-
-    File file = new File("/path/to/gemfire.properties");
-    StartMemberUtils.addGemFirePropertyFile(commandLine, file);
-    assertFalse(commandLine.isEmpty());
-    assertTrue(commandLine.contains("-DgemfirePropertyFile=" + file.getAbsolutePath()));
-  }
-
-  @Test
-  public void testAddGemFireSystemPropertiesToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addGemFireSystemProperties(commandLine, new Properties());
-    assertTrue(commandLine.isEmpty());
-
-    final Properties gemfireProperties = new Properties();
-    gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
-    gemfireProperties.setProperty(LOG_LEVEL, "config");
-    gemfireProperties.setProperty(LOG_FILE, org.apache.commons.lang.StringUtils.EMPTY);
-    gemfireProperties.setProperty(MCAST_PORT, "0");
-    gemfireProperties.setProperty(NAME, "machine");
-    StartMemberUtils.addGemFireSystemProperties(commandLine, gemfireProperties);
-
-    assertFalse(commandLine.isEmpty());
-    assertEquals(4, commandLine.size());
-
-    for (final String propertyName : gemfireProperties.stringPropertyNames()) {
-      final String propertyValue = gemfireProperties.getProperty(propertyName);
-      if (org.apache.commons.lang.StringUtils.isBlank(propertyValue)) {
-        for (final String systemProperty : commandLine) {
-          assertFalse(systemProperty.startsWith(
-              "-D" + DistributionConfig.GEMFIRE_PREFIX + "".concat(propertyName).concat("=")));
-        }
-      } else {
-        assertTrue(commandLine.contains("-D" + DistributionConfig.GEMFIRE_PREFIX
-            + "".concat(propertyName).concat("=").concat(propertyValue)));
-      }
-    }
-  }
-
-  @Test
-  public void testAddGemFireSystemPropertiesToCommandLineWithRestAPI() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addGemFireSystemProperties(commandLine, new Properties());
-    assertTrue(commandLine.isEmpty());
-    final Properties gemfireProperties = new Properties();
-    gemfireProperties.setProperty(LOCATORS, "localhost[11235]");
-    gemfireProperties.setProperty(LOG_LEVEL, "config");
-    gemfireProperties.setProperty(LOG_FILE, StringUtils.EMPTY);
-    gemfireProperties.setProperty(MCAST_PORT, "0");
-    gemfireProperties.setProperty(NAME, "machine");
-    gemfireProperties.setProperty(START_DEV_REST_API, "true");
-    gemfireProperties.setProperty(HTTP_SERVICE_PORT, "8080");
-    gemfireProperties.setProperty(HTTP_SERVICE_BIND_ADDRESS, "localhost");
-
-    StartMemberUtils.addGemFireSystemProperties(commandLine, gemfireProperties);
-
-    assertFalse(commandLine.isEmpty());
-    assertEquals(7, commandLine.size());
-
-    for (final String propertyName : gemfireProperties.stringPropertyNames()) {
-      final String propertyValue = gemfireProperties.getProperty(propertyName);
-      if (StringUtils.isBlank(propertyValue)) {
-        for (final String systemProperty : commandLine) {
-          assertFalse(systemProperty.startsWith(
-              "-D" + DistributionConfig.GEMFIRE_PREFIX + "".concat(propertyName).concat("=")));
-        }
-      } else {
-        assertTrue(commandLine.contains("-D" + DistributionConfig.GEMFIRE_PREFIX
-            + "".concat(propertyName).concat("=").concat(propertyValue)));
-      }
-    }
-  }
-
-  @Test
-  public void testAddInitialHeapToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addInitialHeap(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addInitialHeap(commandLine, org.apache.commons.lang.StringUtils.EMPTY);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addInitialHeap(commandLine, " ");
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addInitialHeap(commandLine, "512M");
-    assertFalse(commandLine.isEmpty());
-    assertEquals("-Xms512M", commandLine.get(0));
-  }
-
-  @Test
-  public void testAddJvmArgumentsAndOptionsToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addJvmArgumentsAndOptions(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addJvmArgumentsAndOptions(commandLine, new String[] {});
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addJvmArgumentsAndOptions(commandLine,
-        new String[] {"-DmyProp=myVal", "-d64", "-server", "-Xprof"});
-    assertFalse(commandLine.isEmpty());
-    assertEquals(4, commandLine.size());
-    assertEquals("-DmyProp=myVal", commandLine.get(0));
-    assertEquals("-d64", commandLine.get(1));
-    assertEquals("-server", commandLine.get(2));
-    assertEquals("-Xprof", commandLine.get(3));
-  }
-
-  @Test
-  public void testAddMaxHeapToCommandLine() {
-    final List<String> commandLine = new ArrayList<>();
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addMaxHeap(commandLine, null);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addMaxHeap(commandLine, org.apache.commons.lang.StringUtils.EMPTY);
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addMaxHeap(commandLine, "  ");
-    assertTrue(commandLine.isEmpty());
-    StartMemberUtils.addMaxHeap(commandLine, "1024M");
-    assertFalse(commandLine.isEmpty());
-    assertEquals(3, commandLine.size());
-    assertEquals("-Xmx1024M", commandLine.get(0));
-    assertEquals("-XX:+UseConcMarkSweepGC", commandLine.get(1));
-    assertEquals(
-        "-XX:CMSInitiatingOccupancyFraction=" + StartMemberUtils.CMS_INITIAL_OCCUPANCY_FRACTION,
-        commandLine.get(2));
-  }
-
-  @Test(expected = AssertionError.class)
-  public void testReadPidWithNull() {
-    try {
-      StartMemberUtils.readPid(null);
-    } catch (AssertionError expected) {
-      assertEquals("The file from which to read the process ID (pid) cannot be null!",
-          expected.getMessage());
-      throw expected;
-    }
-  }
-
-  @Test
-  public void testReadPidWithNonExistingFile() {
-    assertEquals(StartMemberUtils.INVALID_PID,
-        StartMemberUtils.readPid(new File("/path/to/non_existing/pid.file")));
-  }
-
-  @Test
-  public void testGetSystemClasspath() {
-    assertEquals(System.getProperty("java.class.path"), StartMemberUtils.getSystemClasspath());
-  }
-
-  @Test
-  public void testToClasspath() {
-    final boolean EXCLUDE_SYSTEM_CLASSPATH = false;
-    final boolean INCLUDE_SYSTEM_CLASSPATH = true;
-    String[] jarFilePathnames =
-        {"/path/to/user/libs/A.jar", "/path/to/user/libs/B.jar", "/path/to/user/libs/C.jar"};
-    String[] userClasspaths = {"/path/to/classes:/path/to/libs/1.jar:/path/to/libs/2.jar",
-        "/path/to/ext/libs/1.jar:/path/to/ext/classes:/path/to/ext/lib/10.jar"};
-    String expectedClasspath = StartMemberUtils.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(toClasspath(userClasspaths)).concat(File.pathSeparator)
-        .concat(toClasspath(jarFilePathnames));
-    assertEquals(expectedClasspath,
-        StartMemberUtils.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, jarFilePathnames, userClasspaths));
-    expectedClasspath = StartMemberUtils.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(toClasspath(userClasspaths)).concat(File.pathSeparator)
-        .concat(System.getProperty("java.class.path")).concat(File.pathSeparator)
-        .concat(toClasspath(jarFilePathnames));
-    assertEquals(expectedClasspath,
-        StartMemberUtils.toClasspath(INCLUDE_SYSTEM_CLASSPATH, jarFilePathnames, userClasspaths));
-    expectedClasspath = StartMemberUtils.GEODE_JAR_PATHNAME.concat(File.pathSeparator)
-        .concat(System.getProperty("java.class.path"));
-    assertEquals(expectedClasspath,
-        StartMemberUtils.toClasspath(INCLUDE_SYSTEM_CLASSPATH, null, (String[]) null));
-    assertEquals(StartMemberUtils.GEODE_JAR_PATHNAME,
-        StartMemberUtils.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, null, (String[]) null));
-    assertEquals(StartMemberUtils.GEODE_JAR_PATHNAME,
-        StartMemberUtils.toClasspath(EXCLUDE_SYSTEM_CLASSPATH, new String[0], ""));
-  }
-
-  @Test
-  public void testToClassPathOrder() {
-    String userClasspathOne = "/path/to/user/lib/a.jar:/path/to/user/classes";
-    String userClasspathTwo =
-        "/path/to/user/lib/x.jar:/path/to/user/lib/y.jar:/path/to/user/lib/z.jar";
-
-    String expectedClasspath = StartMemberUtils.getGemFireJarPath().concat(File.pathSeparator)
-        .concat(userClasspathOne).concat(File.pathSeparator).concat(userClasspathTwo)
-        .concat(File.pathSeparator).concat(System.getProperty("java.class.path"))
-        .concat(File.pathSeparator).concat(StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME)
-        .concat(File.pathSeparator).concat(StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME);
-
-    String actualClasspath =
-        StartMemberUtils.toClasspath(true,
-            new String[] {StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME,
-                StartMemberUtils.CORE_DEPENDENCIES_JAR_PATHNAME},
-            userClasspathOne, userClasspathTwo);
-
-    assertEquals(expectedClasspath, actualClasspath);
-  }
-
-  private String toClasspath(final String... jarFilePathnames) {
-    String classpath = org.apache.commons.lang.StringUtils.EMPTY;
-    if (jarFilePathnames != null) {
-      for (final String jarFilePathname : jarFilePathnames) {
-        classpath +=
-            (classpath.isEmpty() ? org.apache.commons.lang.StringUtils.EMPTY : File.pathSeparator);
-        classpath += jarFilePathname;
-      }
-    }
-    return classpath;
+  public void getMembersIncludingLocators() throws Exception {
+    String[] members = {"member"};
+    doReturn(Collections.emptySet()).when(command).findMembersIncludingLocators(members, null);
+    assertThatThrownBy(() -> command.getMembersIncludingLocators(members, null))
+        .isInstanceOf(EntityNotFoundException.class);
   }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataCommandTest.java
similarity index 61%
copy from geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java
copy to geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataCommandTest.java
index 68527e2..f2f837e 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataCommandTest.java
@@ -15,23 +15,25 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import java.io.File;
+import static org.assertj.core.api.Assertions.assertThat;
 
+import org.junit.ClassRule;
+import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.geode.test.junit.rules.GfshParserRule;
 
-@Category(IntegrationTest.class)
-public class ExportLogsOverHttpIntegrationTest extends ExportLogsIntegrationTest {
 
-  @Override
-  public void connect() throws Exception {
-    gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
-  }
+@Category(UnitTest.class)
+public class ImportDataCommandTest {
 
-  public File getWorkingDirectory() throws Exception {
-    return new File(System.getProperty("user.dir"));
-  }
+  @ClassRule
+  public static GfshParserRule gfsh = new GfshParserRule();
 
+  @Test
+  public void manditaryOptions() throws Exception {
+    assertThat(gfsh.parse("import data --region=regionA --file=test")).isNull();
+    assertThat(gfsh.parse("import data --member=regionA --file=test")).isNull();
+  }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataIntegrationTest.java
index 5dfbc83..7f774dd 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ImportDataIntegrationTest.java
@@ -36,7 +36,7 @@ import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category(IntegrationTest.class)
@@ -51,7 +51,7 @@ public class ImportDataIntegrationTest {
       .withRegion(RegionShortcut.PARTITION, TEST_REGION_NAME).withEmbeddedLocator();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder tempDir = new TemporaryFolder();
@@ -62,8 +62,7 @@ public class ImportDataIntegrationTest {
 
   @Before
   public void setup() throws Exception {
-    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(),
-        GfshShellConnectionRule.PortType.locator);
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), GfshCommandRule.PortType.locator);
     region = server.getCache().getRegion(TEST_REGION_NAME);
     loadRegion("value");
     Path basePath = tempDir.getRoot().toPath();
@@ -128,7 +127,8 @@ public class ImportDataIntegrationTest {
         .addOption(CliStrings.IMPORT_DATA__REGION, TEST_REGION_NAME)
         .addOption(CliStrings.IMPORT_DATA__FILE, snapshotFile.toString()).getCommandString();
     gfsh.executeCommand(invalidMemberCommand);
-    assertThat(gfsh.getGfshOutput()).contains("Member " + invalidMemberName + " not found");
+    assertThat(gfsh.getGfshOutput())
+        .contains("Member " + invalidMemberName + " could not be found");
   }
 
   @Test
@@ -152,24 +152,6 @@ public class ImportDataIntegrationTest {
   }
 
   @Test
-  public void testMissingRegion() throws Exception {
-    String missingRegionCommand = new CommandStringBuilder(CliStrings.IMPORT_DATA)
-        .addOption(CliStrings.MEMBER, server.getName())
-        .addOption(CliStrings.IMPORT_DATA__FILE, snapshotFile.toString()).getCommandString();
-    gfsh.executeCommand(missingRegionCommand);
-    assertThat(gfsh.getGfshOutput()).contains("You should specify option");
-  }
-
-  @Test
-  public void testMissingMember() throws Exception {
-    String missingMemberCommand = new CommandStringBuilder(CliStrings.EXPORT_DATA)
-        .addOption(CliStrings.IMPORT_DATA__REGION, TEST_REGION_NAME)
-        .addOption(CliStrings.IMPORT_DATA__FILE, snapshotFile.toString()).getCommandString();
-    gfsh.executeCommand(missingMemberCommand);
-    assertThat(gfsh.getGfshOutput()).contains("You should specify option");
-  }
-
-  @Test
   public void testMissingFileAndDirectory() throws Exception {
     String missingFileAndDirCommand = buildBaseImportCommand().getCommandString();
     gfsh.executeCommand(missingFileAndDirCommand);
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandsIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandsIntegrationTest.java
index 0da3595..85a3792 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandsIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandsIntegrationTest.java
@@ -39,7 +39,7 @@ import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.Server;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
@@ -66,7 +66,7 @@ public class IndexCommandsIntegrationTest {
   }
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
@@ -86,7 +86,7 @@ public class IndexCommandsIntegrationTest {
   }
 
   public void connect(Server server) throws Exception {
-    gfsh.connectAndVerify(server.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(server.getJmxPort(), GfshCommandRule.PortType.jmxManager);
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandsShareConfigurationDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandsShareConfigurationDUnitTest.java
index 54d03ae..61eae9c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandsShareConfigurationDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandsShareConfigurationDUnitTest.java
@@ -51,13 +51,13 @@ import org.apache.geode.test.dunit.Assert;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class IndexCommandsShareConfigurationDUnitTest {
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public LocatorServerStartupRule startupRule = new LocatorServerStartupRule();
@@ -86,7 +86,7 @@ public class IndexCommandsShareConfigurationDUnitTest {
 
     locator = startupRule.startLocatorVM(0, locatorProps);
 
-    gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
 
     Properties props = new Properties();
     props.setProperty(GROUPS, groupName);
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
index bbd0b6c..0e9468c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAndDescribeDiskStoreCommandsDUnitTest.java
@@ -20,6 +20,7 @@ import static org.apache.geode.test.dunit.Assert.assertNotNull;
 import static org.apache.geode.test.dunit.Host.getHost;
 import static org.apache.geode.test.dunit.LogWriterUtils.getDUnitLogLevel;
 import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
+import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.Serializable;
 import java.util.Properties;
@@ -100,9 +101,8 @@ public class ListAndDescribeDiskStoreCommandsDUnitTest extends CliCommandTestBas
 
     assertNotNull(commandResult);
     assertEquals(Result.Status.ERROR, commandResult.getStatus());
-    assertEquals(
-        "A disk store with name (badDiskStoreName) was not found on member (producerServer).",
-        toString(commandResult));
+    assertThat(toString(commandResult)).contains(
+        "A disk store with name (badDiskStoreName) was not found on member (producerServer).");
   }
 
   private static String toString(final Result result) {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
index c56124c..f85816e 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAndDescribeRegionDUnitTest.java
@@ -56,7 +56,7 @@ import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.FlakyTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ListAndDescribeRegionDUnitTest implements Serializable {
@@ -73,7 +73,7 @@ public class ListAndDescribeRegionDUnitTest implements Serializable {
   public static LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @ClassRule
-  public static GfshShellConnectionRule gfshShellConnectionRule = new GfshShellConnectionRule();
+  public static GfshCommandRule gfshCommandRule = new GfshCommandRule();
 
   @BeforeClass
   public static void setupSystem() throws Exception {
@@ -127,13 +127,13 @@ public class ListAndDescribeRegionDUnitTest implements Serializable {
       createRegionsWithSubRegions();
     });
 
-    gfshShellConnectionRule.connectAndVerify(locator);
+    gfshCommandRule.connectAndVerify(locator);
   }
 
   @Test
   public void listAllRegions() throws Exception {
     String listRegions = new CommandStringBuilder(LIST_REGION).toString();
-    gfshShellConnectionRule.executeAndAssertThat(listRegions).statusIsSuccess().containsOutput(PR1,
+    gfshCommandRule.executeAndAssertThat(listRegions).statusIsSuccess().containsOutput(PR1,
         LOCALREGIONONMANAGER, REGION1, REGION2, REGION3);
   }
 
@@ -141,7 +141,7 @@ public class ListAndDescribeRegionDUnitTest implements Serializable {
   public void listRegionsOnManager() throws Exception {
     String listRegions =
         new CommandStringBuilder(LIST_REGION).addOption(MEMBER, "Manager").toString();
-    gfshShellConnectionRule.executeAndAssertThat(listRegions).statusIsSuccess().containsOutput(PR1,
+    gfshCommandRule.executeAndAssertThat(listRegions).statusIsSuccess().containsOutput(PR1,
         LOCALREGIONONMANAGER);
   }
 
@@ -149,39 +149,39 @@ public class ListAndDescribeRegionDUnitTest implements Serializable {
   public void listRegionsOnServer() throws Exception {
     CommandStringBuilder csb = new CommandStringBuilder(LIST_REGION);
     csb.addOption(MEMBER, "Server");
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess()
-        .containsOutput(PR1, REGION1, REGION2, REGION3, SUBREGION1A);
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess().containsOutput(PR1,
+        REGION1, REGION2, REGION3, SUBREGION1A);
   }
 
   @Test
   public void listRegionsInGroup1() throws Exception {
     CommandStringBuilder csb = new CommandStringBuilder(LIST_REGION);
     csb.addOption(GROUP, "G1");
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess()
-        .containsOutput(PR1, LOCALREGIONONMANAGER);
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess().containsOutput(PR1,
+        LOCALREGIONONMANAGER);
   }
 
   @Test
   public void listRegionsInGroup2() throws Exception {
     CommandStringBuilder csb = new CommandStringBuilder(LIST_REGION);
     csb.addOption(GROUP, "G2");
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess()
-        .containsOutput(PR1, REGION1, REGION2, REGION3, SUBREGION1A);
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess().containsOutput(PR1,
+        REGION1, REGION2, REGION3, SUBREGION1A);
   }
 
   @Test
   public void describeRegionsOnManager() throws Exception {
     CommandStringBuilder csb = new CommandStringBuilder(DESCRIBE_REGION);
     csb.addOption(DESCRIBE_REGION__NAME, PR1);
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess()
-        .containsOutput(PR1, "Server");
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess().containsOutput(PR1,
+        "Server");
   }
 
   @Test
   public void describeRegionsOnServer() throws Exception {
     CommandStringBuilder csb = new CommandStringBuilder(DESCRIBE_REGION);
     csb.addOption(DESCRIBE_REGION__NAME, LOCALREGIONONMANAGER);
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess()
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess()
         .containsOutput(LOCALREGIONONMANAGER, "Manager");
   }
 
@@ -204,7 +204,7 @@ public class ListAndDescribeRegionDUnitTest implements Serializable {
     CommandStringBuilder csb = new CommandStringBuilder(DESCRIBE_REGION);
     csb.addOption(DESCRIBE_REGION__NAME, regionName);
     String commandString = csb.toString();
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess().containsOutput(
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess().containsOutput(
         regionName, RegionAttributesNames.COMPRESSOR,
         RegionEntryContext.DEFAULT_COMPRESSION_PROVIDER);
 
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
index 8857625..5522cf0 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandDUnitTest.java
@@ -29,7 +29,7 @@ import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ListIndexCommandDUnitTest {
@@ -44,7 +44,7 @@ public class ListIndexCommandDUnitTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
@@ -65,7 +65,7 @@ public class ListIndexCommandDUnitTest {
   }
 
   public void connectGfsh(MemberVM vm) throws Exception {
-    gfsh.connectAndVerify(vm.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(vm.getJmxPort(), GfshCommandRule.PortType.jmxManager);
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandJUnitTest.java
index d874c41..60d9168 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandJUnitTest.java
@@ -209,7 +209,7 @@ public class ListIndexCommandJUnitTest {
     }
 
     @Override
-    public Set<DistributedMember> getMembers(final InternalCache cache) {
+    public Set<DistributedMember> getAllMembers(final InternalCache cache) {
       assertSame(getCache(), cache);
       return Collections.emptySet();
     }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListMembersCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListMembersCommandDUnitTest.java
index 9dbbc30..05b83c9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListMembersCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListMembersCommandDUnitTest.java
@@ -29,7 +29,7 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ListMembersCommandDUnitTest {
@@ -38,7 +38,7 @@ public class ListMembersCommandDUnitTest {
   private static MemberVM locator;
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @BeforeClass
   public static void setup() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LocateEntryDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LocateEntryDUnitTest.java
new file mode 100644
index 0000000..2528dbf
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/LocateEntryDUnitTest.java
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.commands;
+
+import org.junit.BeforeClass;
+import org.junit.ClassRule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.management.internal.cli.dto.Key;
+import org.apache.geode.management.internal.cli.dto.Value;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+
+
+@Category(DistributedTest.class)
+public class LocateEntryDUnitTest {
+  @ClassRule
+  public static LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @ClassRule
+  public static GfshCommandRule gfsh = new GfshCommandRule();
+
+  private static MemberVM locator, server1, server2;
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    locator = lsRule.startLocatorVM(0);
+    server1 = lsRule.startServerVM(1, locator.getPort());
+    server2 = lsRule.startServerVM(2, locator.getPort());
+
+    gfsh.connectAndVerify(locator);
+
+    // create a partitioned region and put an entry
+    gfsh.executeAndAssertThat("create region --name=regionA --type=PARTITION").statusIsSuccess();
+    gfsh.executeAndAssertThat("put --region=regionA --key=key --value=value").statusIsSuccess();
+
+    // create a replicate region and put an entry
+    gfsh.executeAndAssertThat("create region --name=regionB --type=REPLICATE").statusIsSuccess();
+    gfsh.executeAndAssertThat("put --region=regionB --key=key --value=value").statusIsSuccess();
+
+    // create a child replicate region
+    gfsh.executeAndAssertThat("create region --name=regionB/regionBB --type=REPLICATE")
+        .statusIsSuccess();
+    gfsh.executeAndAssertThat("put --region=regionB/regionBB --key=key --value=value")
+        .statusIsSuccess();
+
+    locator.waitTillRegionsAreReadyOnServers("/regionA", 2);
+    locator.waitTillRegionsAreReadyOnServers("/regionB", 2);
+    locator.waitTillRegionsAreReadyOnServers("/regionB/regionBB", 2);
+  }
+
+  @Test
+  public void locateEntryForPartitionedRegion() throws Exception {
+    gfsh.executeAndAssertThat("locate entry --region=regionA --key=key").statusIsSuccess()
+        .containsKeyValuePair("Locations Found", "1");
+  }
+
+  @Test
+  public void locateEntryForReplicateRegion() throws Exception {
+    gfsh.executeAndAssertThat("locate entry --region=regionB --key=key").statusIsSuccess()
+        .containsKeyValuePair("Locations Found", "2");
+  }
+
+  @Test
+  public void recursiveLocate() throws Exception {
+    gfsh.executeAndAssertThat("locate entry --region=regionB --key=key  --recursive=true")
+        .statusIsSuccess().containsKeyValuePair("Locations Found", "4");
+  }
+
+  @Test
+  public void jsonKeyValue() throws Exception {
+    gfsh.executeAndAssertThat(
+        "put --region=regionA --key=('key':'1') --value=('value':'1') " + "--key-class="
+            + Key.class.getCanonicalName() + " --value-class=" + Value.class.getCanonicalName())
+        .statusIsSuccess();
+    gfsh.executeAndAssertThat("locate entry --region=regionA --key=('key':'1') " + "--key-class="
+        + Key.class.getCanonicalName()).statusIsSuccess()
+        .containsKeyValuePair("Locations Found", "1");
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/PutCommandIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/PutCommandIntegrationTest.java
index e50adb7..e164d10 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/PutCommandIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/PutCommandIntegrationTest.java
@@ -15,14 +15,23 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
+import static org.assertj.core.api.Assertions.assertThat;
+
+import org.junit.After;
 import org.junit.ClassRule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.RuleChain;
 
 import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.management.internal.cli.dto.Car;
+import org.apache.geode.management.internal.cli.dto.Key;
+import org.apache.geode.management.internal.cli.dto.Key1;
+import org.apache.geode.management.internal.cli.dto.ObjectWithCharAttr;
+import org.apache.geode.management.internal.cli.dto.Value;
+import org.apache.geode.management.internal.cli.dto.Value2;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 
@@ -32,23 +41,88 @@ public class PutCommandIntegrationTest {
   private static ServerStarterRule server =
       new ServerStarterRule().withJMXManager().withRegion(RegionShortcut.REPLICATE, "testRegion");
 
-  private static GfshShellConnectionRule gfsh =
-      new GfshShellConnectionRule(server::getJmxPort, GfshShellConnectionRule.PortType.jmxManager);
+  private static GfshCommandRule gfsh =
+      new GfshCommandRule(server::getJmxPort, GfshCommandRule.PortType.jmxManager);
 
   @ClassRule
   public static RuleChain chain = RuleChain.outerRule(server).around(gfsh);
 
 
+  @After
+  public void after() throws Exception {
+    // clear the region after each test
+    server.getCache().getRegion("testRegion").clear();
+  }
+
   @Test
   public void putWithoutSlash() throws Exception {
     gfsh.executeAndAssertThat("put --region=testRegion --key=key1 --value=value1")
         .statusIsSuccess();
+    assertThat(server.getCache().getRegion("testRegion").get("key1")).isEqualTo("value1");
   }
 
 
   @Test
   public void putWithSlash() throws Exception {
     gfsh.executeAndAssertThat("put --region=/testRegion --key=key1 --value=value1")
+        .statusIsSuccess().containsKeyValuePair("Result", "true");
+    assertThat(server.getCache().getRegion("testRegion").get("key1")).isEqualTo("value1");
+  }
+
+  @Test
+  // Bug : 51587 : GFSH command failing when ; is present in either key or value in put operation
+  public void putWithSemicoln() throws Exception {
+    gfsh.executeAndAssertThat("put --region=/testRegion --key=key1;key1 --value=value1;value1")
+        .statusIsSuccess().containsKeyValuePair("Result", "true");
+    assertThat(server.getCache().getRegion("testRegion").get("key1;key1"))
+        .isEqualTo("value1;value1");
+  }
+
+  @Test
+  public void putIfAbsent() throws Exception {
+    gfsh.executeAndAssertThat("put --region=/testRegion --key=key1 --value=value1")
+        .statusIsSuccess().containsKeyValuePair("Result", "true");
+    gfsh.executeAndAssertThat("put --region=/testRegion --key=key1 --value=value2 --skip-if-exists")
         .statusIsSuccess();
+    assertThat(server.getCache().getRegion("testRegion").get("key1")).isEqualTo("value1");
+  }
+
+  @Test
+  public void putWithSimpleJson() throws Exception {
+    gfsh.executeAndAssertThat(
+        "put --region=testRegion --key=('key':'1') --value=('value':'1') " + "--key-class="
+            + Key.class.getCanonicalName() + " --value-class=" + Value.class.getCanonicalName())
+        .statusIsSuccess().containsKeyValuePair("Result", "true");
+  }
+
+  @Test
+  public void putWithComplicatedJson() throws Exception {
+    String keyJson = "('id':'1','name':'name1')";
+    String stateJson =
+        "('stateName':'State1','population':10,'capitalCity':'capital1','areaInSqKm':100)";
+    String carJson =
+        "\"('attributes':?map,'make':'make1','model':'modle1','colors':?list,'attributeSet':?set)\"";
+
+    // put the state json
+    String command =
+        "put --region=testRegion --key=" + keyJson + " --value=" + stateJson + " --key-class="
+            + Key1.class.getCanonicalName() + " --value-class=" + Value2.class.getCanonicalName();
+    gfsh.executeAndAssertThat(command).statusIsSuccess();
+
+    // put the car json
+    String list = "['red','white','blue']";
+    String set = "['red','white','blue']";
+    String map = "{'power':'90hp'}";
+    String valueJson = carJson.replaceAll("\\?list", list);
+    valueJson = valueJson.replaceAll("\\?set", set);
+    valueJson = valueJson.replaceAll("\\?map", map);
+    command = "put --region=testRegion --key=" + keyJson + " --value=" + valueJson + " --key-class="
+        + Key1.class.getCanonicalName() + " --value-class=" + Car.class.getCanonicalName();
+    gfsh.executeAndAssertThat(command).statusIsSuccess();
+
+    // put with json with single character field
+    command = "put --region=testRegion --key-class=" + ObjectWithCharAttr.class.getCanonicalName()
+        + " --value=456 --key=('name':'hesdfdsfy2','t':456,'c':'d')";
+    gfsh.executeAndAssertThat(command).statusIsSuccess();
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueryCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueryCommandTest.java
index bafd47f..afc1dbc 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueryCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/QueryCommandTest.java
@@ -21,7 +21,6 @@ import java.io.File;
 import java.nio.charset.StandardCharsets;
 import java.util.Arrays;
 import java.util.List;
-import java.util.regex.Pattern;
 
 import com.google.common.io.Files;
 import org.apache.commons.io.FileUtils;
@@ -40,7 +39,7 @@ import org.apache.geode.cache.Region;
 import org.apache.geode.cache.RegionShortcut;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category(IntegrationTest.class)
@@ -62,7 +61,7 @@ public class QueryCommandTest {
           .withRegion(RegionShortcut.REPLICATE, "complexRegion");
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -84,9 +83,9 @@ public class QueryCommandTest {
   @Before
   public void connect() throws Exception {
     if (useHttp) {
-      gfsh.connectAndVerify(server.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(server.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(server.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(server.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
   }
 
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/RemoveCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/RemoveCommandDUnitTest.java
index 5a0bb17..4051dc1 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/RemoveCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/RemoveCommandDUnitTest.java
@@ -39,7 +39,7 @@ import org.apache.geode.test.dunit.SerializableCallableIF;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class RemoveCommandDUnitTest implements Serializable {
@@ -51,7 +51,7 @@ public class RemoveCommandDUnitTest implements Serializable {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public transient GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public transient GfshCommandRule gfsh = new GfshCommandRule();
 
   private transient MemberVM locator;
   private transient MemberVM server1;
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/RemoveCommandJsonDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/RemoveCommandJsonDUnitTest.java
index 4137820..bc1c80a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/RemoveCommandJsonDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/RemoveCommandJsonDUnitTest.java
@@ -40,7 +40,7 @@ import org.apache.geode.test.dunit.SerializableCallableIF;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class RemoveCommandJsonDUnitTest implements Serializable {
@@ -50,7 +50,7 @@ public class RemoveCommandJsonDUnitTest implements Serializable {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public transient GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public transient GfshCommandRule gfsh = new GfshCommandRule();
 
   private transient MemberVM locator;
   private transient MemberVM server1;
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowDeadlockDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowDeadlockDUnitTest.java
index 885370b..6d27f7b 100755
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowDeadlockDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowDeadlockDUnitTest.java
@@ -40,7 +40,7 @@ import org.apache.geode.test.concurrent.FileBasedCountDownLatch;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 /**
  * Distributed tests for show deadlock command in {@link ShowDeadlockCommand}.
@@ -65,7 +65,7 @@ public class ShowDeadlockDUnitTest {
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void setup() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowLogCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowLogCommandDUnitTest.java
index 6f9dd88..19ecff1 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowLogCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowLogCommandDUnitTest.java
@@ -18,8 +18,8 @@ import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_LEVEL;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.http;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.jmxManager;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.http;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.jmxManager;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.Serializable;
@@ -44,7 +44,7 @@ import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 @RunWith(Parameterized.class)
@@ -65,7 +65,7 @@ public class ShowLogCommandDUnitTest implements Serializable {
   public static LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @ClassRule
-  public static GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public static GfshCommandRule gfsh = new GfshCommandRule();
 
   @Parameterized.Parameter
   public static boolean useHttp;
@@ -155,8 +155,7 @@ public class ShowLogCommandDUnitTest implements Serializable {
     assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
 
     String output = gfsh.getGfshOutput();
-    assertThat(output).contains("Member not found");
-
+    assertThat(output).contains("Member NotAValidMember could not be found");
   }
 
   private static boolean allMembersAreConnected() {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommandIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommandIntegrationTest.java
new file mode 100644
index 0000000..b18af6c
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommandIntegrationTest.java
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.commands;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.apache.logging.log4j.Logger;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule.PortType;
+import org.apache.geode.test.junit.rules.ServerStarterRule;
+
+@Category(IntegrationTest.class)
+public class ShowMetricsCommandIntegrationTest {
+  private static final Logger logger = LogService.getLogger();
+  private static final String REGION_NAME = "test-region";
+  private static final String MEMBER_NAME = "testServer";
+
+  @ClassRule
+  public static ServerStarterRule server =
+      new ServerStarterRule().withRegion(RegionShortcut.REPLICATE, REGION_NAME)
+          .withName(MEMBER_NAME).withJMXManager().withEmbeddedLocator().withAutoStart();
+
+  @Rule
+  public GfshCommandRule gfsh = new GfshCommandRule();
+
+  @Test
+  public void everyCategoryHasAUseCase() throws Exception {
+    Set<ShowMetricsCommand.Category> categoriesUsed = new HashSet<>();
+    categoriesUsed.addAll(ShowMetricsCommand.REGION_METRIC_CATEGORIES);
+    categoriesUsed.addAll(ShowMetricsCommand.MEMBER_METRIC_CATEGORIES);
+    categoriesUsed.addAll(ShowMetricsCommand.MEMBER_WITH_PORT_METRIC_CATEGORIES);
+    categoriesUsed.addAll(ShowMetricsCommand.SYSTEM_METRIC_CATEGORIES);
+    categoriesUsed.addAll(ShowMetricsCommand.SYSTEM_REGION_METRIC_CATEGORIES);
+
+    Set<ShowMetricsCommand.Category> categoriesSpecified =
+        Arrays.stream(ShowMetricsCommand.Category.values()).collect(Collectors.toSet());
+
+    assertThat(categoriesSpecified)
+        .containsExactlyInAnyOrder(categoriesUsed.toArray(new ShowMetricsCommand.Category[0]));
+  }
+
+  @Test
+  public void commandFailsWhenNotConnected() throws Exception {
+    gfsh.executeAndAssertThat("show metrics")
+        .containsOutput("was found but is not currently available");
+  }
+
+  @Test
+  public void getRegionMetricsShowsExactlyDefaultCategories() throws Exception {
+    // Use --region and --member to get RegionMetricsFromMember
+    String cmd = "show metrics --region=/" + REGION_NAME + " --member=" + MEMBER_NAME;
+    List<String> expectedCategories =
+        ShowMetricsInterceptor.getValidCategoriesAsStrings(true, true, false);
+    // Blank lines are permitted for grouping.
+    expectedCategories.add("");
+    logger.info("Expecting categories: " + String.join(", ", expectedCategories));
+
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), PortType.locator);
+    gfsh.executeAndAssertThat(cmd).tableHasColumnOnlyWithValues("Category",
+        expectedCategories.toArray(new String[0]));
+  }
+
+  @Test
+  public void getSystemRegionMetricsShowsExactlyDefaultCategories() throws Exception {
+    // Use --region alone to get SystemRegionMetrics
+    String cmd = "show metrics --region=/" + REGION_NAME;
+    List<String> expectedCategories =
+        ShowMetricsInterceptor.getValidCategoriesAsStrings(true, false, false);
+    // Blank lines are permitted for grouping.
+    expectedCategories.add("");
+    logger.info("Expecting categories: " + String.join(", ", expectedCategories));
+
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), PortType.locator);
+    gfsh.executeAndAssertThat(cmd).tableHasColumnOnlyWithValues("Category",
+        expectedCategories.toArray(new String[0]));
+  }
+
+  @Test
+  public void getMemberMetricsShowsExactlyDefaultCategories() throws Exception {
+    // Use --member to get member metrics
+    String cmd = "show metrics --member=" + MEMBER_NAME;
+    List<String> expectedCategories =
+        ShowMetricsInterceptor.getValidCategoriesAsStrings(false, true, false);
+    // Blank lines are permitted for grouping.
+    expectedCategories.add("");
+    logger.info("Expecting categories: " + String.join(", ", expectedCategories));
+
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), PortType.locator);
+    gfsh.executeAndAssertThat(cmd).tableHasColumnOnlyWithValues("Category",
+        expectedCategories.toArray(new String[0]));
+  }
+
+  @Test
+  public void getMemberWithPortMetricsShowsExactlyDefaultCategories() throws Exception {
+    // Use --member and --port to get member metrics with port info
+    String cmd = "show metrics --member=" + MEMBER_NAME + " --port=" + server.getPort();
+    List<String> expectedCategories =
+        ShowMetricsInterceptor.getValidCategoriesAsStrings(false, true, true);
+    // Blank lines are permitted for grouping.
+    expectedCategories.add("");
+    logger.info("Expecting categories: " + String.join(", ", expectedCategories));
+
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), PortType.locator);
+    gfsh.executeAndAssertThat(cmd).tableHasColumnOnlyWithValues("Category",
+        expectedCategories.toArray(new String[0]));
+  }
+
+  @Test
+  public void getSystemMetricsShowsExactlyDefaultCategories() throws Exception {
+    // No specified options yield system-wide metrics
+    String cmd = "show metrics";
+    List<String> expectedCategories =
+        ShowMetricsInterceptor.getValidCategoriesAsStrings(false, false, false);
+    // Blank lines are permitted for grouping.
+    expectedCategories.add("");
+    logger.info("Expecting categories: " + String.join(", ", expectedCategories));
+
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), PortType.locator);
+    gfsh.executeAndAssertThat(cmd).tableHasColumnOnlyWithValues("Category",
+        expectedCategories.toArray(new String[0]));
+  }
+
+  @Test
+  public void invalidCategoryGetsReported() throws Exception {
+    String cmd =
+        "show metrics --categories=\"cluster,cache,some_invalid_category,another_invalid_category\"";
+
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), PortType.locator);
+    gfsh.executeAndAssertThat(cmd).containsOutput("Invalid Categories")
+        .containsOutput("some_invalid_category").containsOutput("another_invalid_category")
+        .doesNotContainOutput("cache").doesNotContainOutput("cluster");
+  }
+
+  @Test
+  public void categoryOptionAbridgesOutput() throws Exception {
+    String cmd = "show metrics --categories=\"cluster,cache\"";
+    List<String> expectedCategories = Arrays.asList("cluster", "cache", "");
+    logger.info("Expecting categories: " + String.join(", ", expectedCategories));
+
+    gfsh.connectAndVerify(server.getEmbeddedLocatorPort(), PortType.locator);
+    gfsh.executeAndAssertThat(cmd).tableHasColumnOnlyWithValues("Category",
+        expectedCategories.toArray(new String[0]));
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsDUnitTest.java
index 1a34a3e..ea2a489 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsDUnitTest.java
@@ -41,7 +41,7 @@ import org.apache.geode.management.RegionMXBean;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ShowMetricsDUnitTest {
@@ -52,7 +52,7 @@ public class ShowMetricsDUnitTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder tempFolder = new TemporaryFolder();
@@ -131,7 +131,7 @@ public class ShowMetricsDUnitTest {
   public void testShowMetricsMember() throws Exception {
     gfsh.executeAndAssertThat(
         "show metrics --member=" + server.getName() + " --port=" + server.getPort())
-        .statusIsSuccess().containsOutput("Member Metrics").containsOutput("cache-server");
+        .statusIsSuccess().containsOutput("Member Metrics").containsOutput("cacheserver");
   }
 
   @Test
@@ -141,7 +141,7 @@ public class ShowMetricsDUnitTest {
 
     gfsh.executeAndAssertThat("show metrics --member=" + server.getName() + " --port="
         + server.getPort() + " --file=" + output.getAbsolutePath()).statusIsSuccess()
-        .containsOutput("Member Metrics").containsOutput("cache-server")
+        .containsOutput("Member Metrics").containsOutput("cacheserver")
         .containsOutput("Member metrics exported to " + output.getAbsolutePath());
 
     assertThat(output).exists();
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommandJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsJUnitTest.java
similarity index 92%
rename from geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommandJUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsJUnitTest.java
index e3c91b8..e6f15e4 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsCommandJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMetricsJUnitTest.java
@@ -1,7 +1,7 @@
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
  * agreements. See the NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
  * "License"); you may not use this file except in compliance with the License. You may obtain a
  * copy of the License at
  *
@@ -12,7 +12,6 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-
 package org.apache.geode.management.internal.cli.commands;
 
 import static org.assertj.core.api.Assertions.assertThat;
@@ -28,7 +27,7 @@ import org.apache.geode.test.junit.categories.UnitTest;
 import org.apache.geode.test.junit.rules.GfshParserRule;
 
 @Category(UnitTest.class)
-public class ShowMetricsCommandJUnitTest {
+public class ShowMetricsJUnitTest {
 
   @Rule
   public GfshParserRule parser = new GfshParserRule();
@@ -57,6 +56,7 @@ public class ShowMetricsCommandJUnitTest {
     ShowMetricsCommand command = spy(ShowMetricsCommand.class);
     CommandResult result = parser.executeCommandWithInstance(command, "show metrics --port=abc");
     assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.getContent().toString()).contains("Invalid port");
+    // When relying on Spring's converters, any command that does not parse is "Invalid"
+    assertThat(result.getContent().toString()).contains("Invalid command");
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMissingDiskStoresDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMissingDiskStoresDUnitTest.java
index f0f4a69..9245100 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMissingDiskStoresDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShowMissingDiskStoresDUnitTest.java
@@ -37,7 +37,7 @@ import org.apache.geode.test.dunit.AsyncInvocation;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ShowMissingDiskStoresDUnitTest {
@@ -55,7 +55,7 @@ public class ShowMissingDiskStoresDUnitTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public GfshCommandRule gfshConnector = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
@@ -126,7 +126,7 @@ public class ShowMissingDiskStoresDUnitTest {
     return restart;
   }
 
-  private void checkAsyncResults(AsyncInvocation ai, GfshShellConnectionRule gfsh, int secsToWait)
+  private void checkAsyncResults(AsyncInvocation ai, GfshCommandRule gfsh, int secsToWait)
       throws Exception {
     try {
       Awaitility.await().atLeast(secsToWait, TimeUnit.SECONDS).until(() -> ai.isDone());
@@ -142,7 +142,7 @@ public class ShowMissingDiskStoresDUnitTest {
     System.out.println(result);
   }
 
-  private void putUsingGfsh(GfshShellConnectionRule gfsh, String regionName, int key, String val)
+  private void putUsingGfsh(GfshCommandRule gfsh, String regionName, int key, String val)
       throws Exception {
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.PUT)
         .addOption(CliStrings.PUT__KEY, Integer.toString(key)).addOption(CliStrings.PUT__VALUE, val)
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShutdownCommandDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShutdownCommandDUnitTest.java
index 84e2803..e108867 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShutdownCommandDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ShutdownCommandDUnitTest.java
@@ -17,8 +17,8 @@ package org.apache.geode.management.internal.cli.commands;
 import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
 import static org.apache.geode.distributed.ConfigurationProperties.LOG_FILE;
 import static org.apache.geode.distributed.ConfigurationProperties.NAME;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.http;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.jmxManager;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.http;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.jmxManager;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.Properties;
@@ -40,7 +40,7 @@ import org.apache.geode.test.dunit.SerializableCallableIF;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 
 @Category(DistributedTest.class)
@@ -70,7 +70,7 @@ public class ShutdownCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
 
   @Before
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/VersionCommandJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/VersionCommandJUnitTest.java
index 6a23b1c..6884123 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/VersionCommandJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/VersionCommandJUnitTest.java
@@ -35,7 +35,7 @@ import org.junit.runner.RunWith;
 
 import org.apache.geode.internal.GemFireVersion;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
 @Category(IntegrationTest.class)
@@ -49,7 +49,7 @@ public class VersionCommandJUnitTest {
   public static LocatorStarterRule locator = new LocatorStarterRule().withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Test
   @Parameters({"version", "version --full=false"})
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java
index 83f58e7..ddfa7c0 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/lifecycle/GfshStatusCommandsIntegrationTest.java
@@ -27,7 +27,7 @@ import org.junit.rules.TestName;
 
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
 @Category(IntegrationTest.class)
@@ -39,7 +39,7 @@ public class GfshStatusCommandsIntegrationTest {
       new LocatorStarterRule().withJMXManager().withName(LOCATOR_NAME).withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/dto/Key.java
similarity index 67%
copy from geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
copy to geode-core/src/test/java/org/apache/geode/management/internal/cli/dto/Key.java
index 361cf63..ce2d102 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/dto/Key.java
@@ -12,21 +12,30 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.management.internal.cli.functions;
+
+package org.apache.geode.management.internal.cli.dto;
 
 import java.io.Serializable;
 
-public class GatewaySenderDestroyFunctionArgs implements Serializable {
+public class Key implements Serializable {
+  private int key;
 
-  private static final long serialVersionUID = 3848480256348119530L;
-  private String id;
+  public int getKey() {
+    return key;
+  }
 
+  public void setKey(int id) {
+    this.key = id;
+  }
 
-  public GatewaySenderDestroyFunctionArgs(String id) {
-    this.id = id;
+  public boolean equals(Object other) {
+    if (!(other instanceof Key)) {
+      return false;
+    }
+    return ((Key) other).key == this.key;
   }
 
-  public String getId() {
-    return id;
+  public int hashCode() {
+    return key;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/dto/Value.java
similarity index 71%
copy from geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
copy to geode-core/src/test/java/org/apache/geode/management/internal/cli/dto/Value.java
index 361cf63..9bf3bf7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/dto/Value.java
@@ -12,21 +12,19 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
-package org.apache.geode.management.internal.cli.functions;
 
-import java.io.Serializable;
-
-public class GatewaySenderDestroyFunctionArgs implements Serializable {
+package org.apache.geode.management.internal.cli.dto;
 
-  private static final long serialVersionUID = 3848480256348119530L;
-  private String id;
+import java.io.Serializable;
 
+public class Value implements Serializable {
+  private String value;
 
-  public GatewaySenderDestroyFunctionArgs(String id) {
-    this.id = id;
+  public String getValue() {
+    return value;
   }
 
-  public String getId() {
-    return id;
+  public void setValue(String value) {
+    this.value = value;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/CliFunctionResultTest.java
similarity index 51%
copy from geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
copy to geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/CliFunctionResultTest.java
index 361cf63..2f0946b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/CliFunctionResultTest.java
@@ -12,21 +12,31 @@
  * or implied. See the License for the specific language governing permissions and limitations under
  * the License.
  */
+
 package org.apache.geode.management.internal.cli.functions;
 
-import java.io.Serializable;
+import static org.assertj.core.api.Assertions.assertThat;
 
-public class GatewaySenderDestroyFunctionArgs implements Serializable {
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
 
-  private static final long serialVersionUID = 3848480256348119530L;
-  private String id;
+import org.apache.geode.test.junit.categories.UnitTest;
 
 
-  public GatewaySenderDestroyFunctionArgs(String id) {
-    this.id = id;
-  }
+@Category(UnitTest.class)
+public class CliFunctionResultTest {
+
+  private CliFunctionResult result;
+
+  @Test
+  public void getErrorMessage() throws Exception {
+    result = new CliFunctionResult("memberName", false, "message");
+    assertThat(result.getErrorMessage()).isEqualTo("message");
+
+    result = new CliFunctionResult("memberName", new Exception("exception message"), "message");
+    assertThat(result.getErrorMessage()).isEqualTo("message");
 
-  public String getId() {
-    return id;
+    result = new CliFunctionResult("memberName", new Exception("exception message"), null);
+    assertThat(result.getErrorMessage()).isEqualTo("exception message");
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunctionTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunctionTest.java
new file mode 100644
index 0000000..330e465
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/CreateDefinedIndexesFunctionTest.java
@@ -0,0 +1,226 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.functions;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.*;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.ResultSender;
+import org.apache.geode.cache.query.Index;
+import org.apache.geode.cache.query.IndexCreationException;
+import org.apache.geode.cache.query.IndexType;
+import org.apache.geode.cache.query.MultiIndexCreationException;
+import org.apache.geode.cache.query.QueryService;
+import org.apache.geode.cache.query.internal.InternalQueryService;
+import org.apache.geode.cache.query.internal.index.CompactMapRangeIndex;
+import org.apache.geode.cache.query.internal.index.HashIndex;
+import org.apache.geode.cache.query.internal.index.PrimaryKeyIndex;
+import org.apache.geode.internal.cache.execute.FunctionContextImpl;
+import org.apache.geode.management.internal.cli.domain.IndexInfo;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.test.fake.Fakes;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class CreateDefinedIndexesFunctionTest {
+  private Cache cache;
+  private Region region1;
+  private Region region2;
+  private FunctionContext context;
+  private QueryService queryService;
+  private TestResultSender resultSender;
+  private Set<IndexInfo> indexDefinitions;
+  private CreateDefinedIndexesFunction function;
+
+  @Before
+  public void setUp() throws Exception {
+    cache = Fakes.cache();
+    resultSender = new TestResultSender();
+    queryService = spy(InternalQueryService.class);
+    region1 = Fakes.region("Region1", cache);
+    region2 = Fakes.region("Region2", cache);
+    function = spy(CreateDefinedIndexesFunction.class);
+    doReturn(queryService).when(cache).getQueryService();
+
+    indexDefinitions = new HashSet<>();
+    indexDefinitions.add(new IndexInfo("index1", "value1", "/Region1", IndexType.HASH));
+    indexDefinitions.add(new IndexInfo("index2", "value2", "/Region2", IndexType.FUNCTIONAL));
+    indexDefinitions.add(new IndexInfo("index3", "value3", "/Region1", IndexType.PRIMARY_KEY));
+  }
+
+  @Test
+  public void noIndexDefinitionsAsFunctionArgument() throws Exception {
+    context = new FunctionContextImpl(cache, CreateDefinedIndexesFunction.class.getName(),
+        Collections.emptySet(), resultSender);
+
+    function.execute(context);
+    List<?> results = resultSender.getResults();
+
+    assertThat(results).isNotNull();
+    assertThat(results.size()).isEqualTo(1);
+    Object firstResult = results.get(0);
+    assertThat(firstResult).isInstanceOf(CliFunctionResult.class);
+    assertThat(((CliFunctionResult) firstResult).isSuccessful()).isTrue();
+    assertThat(((CliFunctionResult) firstResult).getMessage()).isNotEmpty();
+    assertThat(((CliFunctionResult) firstResult).getMessage()).contains("No indexes defined");
+  }
+
+  @Test
+  public void noIndexPreviouslyDefinedInQueryService() throws Exception {
+    when(queryService.createDefinedIndexes()).thenReturn(Collections.emptyList());
+    context = new FunctionContextImpl(cache, CreateDefinedIndexesFunction.class.getName(),
+        indexDefinitions, resultSender);
+
+    function.execute(context);
+    List<?> results = resultSender.getResults();
+
+    assertThat(results).isNotNull();
+    assertThat(results.size()).isEqualTo(1);
+    Object firstResult = results.get(0);
+    assertThat(firstResult).isInstanceOf(CliFunctionResult.class);
+    assertThat(((CliFunctionResult) firstResult).isSuccessful()).isTrue();
+    assertThat(((CliFunctionResult) firstResult).getMessage()).isNotEmpty();
+    assertThat(((CliFunctionResult) firstResult).getMessage()).contains("No indexes defined");
+  }
+
+  @Test
+  public void multiIndexCreationExceptionThrowByQueryService() throws Exception {
+    HashMap<String, Exception> exceptions = new HashMap<>();
+    exceptions.put("index1", new IndexCreationException("Mock Failure."));
+    exceptions.put("index3", new IndexCreationException("Another Mock Failure."));
+    when(queryService.createDefinedIndexes())
+        .thenThrow(new MultiIndexCreationException(exceptions));
+    context = new FunctionContextImpl(cache, CreateDefinedIndexesFunction.class.getName(),
+        indexDefinitions, resultSender);
+
+    function.execute(context);
+    List<?> results = resultSender.getResults();
+
+    assertThat(results).isNotNull();
+    assertThat(results.size()).isEqualTo(1);
+    Object firstResult = results.get(0);
+    assertThat(firstResult).isNotNull();
+    assertThat(firstResult).isInstanceOf(CliFunctionResult.class);
+    assertThat(((CliFunctionResult) firstResult).isSuccessful()).isFalse();
+    assertThat(((CliFunctionResult) firstResult).getSerializables().length).isEqualTo(1);
+    assertThat(((CliFunctionResult) firstResult).getSerializables()[0]).isNotNull();
+    assertThat(((CliFunctionResult) firstResult).getSerializables()[0].toString()).contains(
+        "Index creation failed for indexes", "index1", "Mock Failure", "index3",
+        "Another Mock Failure");
+  }
+
+  @Test
+  public void unexpectedExceptionThrowByQueryService() throws Exception {
+    when(queryService.createDefinedIndexes()).thenThrow(new RuntimeException("Mock Exception"));
+    context = new FunctionContextImpl(cache, CreateDefinedIndexesFunction.class.getName(),
+        indexDefinitions, resultSender);
+
+    function.execute(context);
+    List<?> results = resultSender.getResults();
+
+    assertThat(results).isNotNull();
+    assertThat(results.size()).isEqualTo(1);
+    Object firstResult = results.get(0);
+    assertThat(firstResult).isNotNull();
+    assertThat(firstResult).isInstanceOf(CliFunctionResult.class);
+    assertThat(((CliFunctionResult) firstResult).isSuccessful()).isFalse();
+    assertThat(((CliFunctionResult) firstResult).getSerializables().length).isEqualTo(1);
+    assertThat(((CliFunctionResult) firstResult).getSerializables()[0]).isNotNull();
+    assertThat(((CliFunctionResult) firstResult).getSerializables()[0].toString())
+        .contains("RuntimeException", "Mock Exception");
+  }
+
+  @Test
+  public void creationSuccess() throws Exception {
+    Index index1 = mock(HashIndex.class);
+    when(index1.getName()).thenReturn("index1");
+    when(index1.getRegion()).thenReturn(region1);
+
+    Index index2 = mock(CompactMapRangeIndex.class);
+    when(index2.getName()).thenReturn("index2");
+    when(index2.getRegion()).thenReturn(region2);
+
+    Index index3 = mock(PrimaryKeyIndex.class);
+    when(index3.getName()).thenReturn("index3");
+    when(index3.getRegion()).thenReturn(region1);
+
+    doReturn(mock(XmlEntity.class)).when(function).createXmlEntity(any());
+    when(queryService.createDefinedIndexes()).thenReturn(Arrays.asList(index1, index2, index3));
+    context = new FunctionContextImpl(cache, CreateDefinedIndexesFunction.class.getName(),
+        indexDefinitions, resultSender);
+
+    function.execute(context);
+    List<?> results = resultSender.getResults();
+
+    assertThat(results).isNotNull();
+    assertThat(results.size()).isEqualTo(2);
+
+    Object firstIndex = results.get(0);
+    assertThat(firstIndex).isNotNull();
+    assertThat(firstIndex).isInstanceOf(CliFunctionResult.class);
+    assertThat(((CliFunctionResult) firstIndex).isSuccessful());
+
+    Object secondIndex = results.get(0);
+    assertThat(secondIndex).isNotNull();
+    assertThat(secondIndex).isInstanceOf(CliFunctionResult.class);
+    assertThat(((CliFunctionResult) secondIndex).isSuccessful()).isTrue();
+    assertThat(((CliFunctionResult) secondIndex).getXmlEntity()).isNotNull();
+  }
+
+  private static class TestResultSender implements ResultSender {
+
+    private final List<Object> results = new LinkedList<>();
+
+    private Exception t;
+
+    protected List<Object> getResults() throws Exception {
+      if (t != null) {
+        throw t;
+      }
+      return Collections.unmodifiableList(results);
+    }
+
+    @Override
+    public void lastResult(final Object lastResult) {
+      results.add(lastResult);
+    }
+
+    @Override
+    public void sendResult(final Object oneResult) {
+      results.add(oneResult);
+    }
+
+    @Override
+    public void sendException(final Throwable t) {
+      this.t = (Exception) t;
+    }
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
index 2339838..cd65dbb 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DescribeDiskStoreFunctionJUnitTest.java
@@ -14,8 +14,12 @@
  */
 package org.apache.geode.management.internal.cli.functions;
 
-import static org.assertj.core.api.Assertions.*;
-import static org.junit.Assert.*;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.util.Arrays;
@@ -55,7 +59,7 @@ import org.apache.geode.internal.lang.ObjectUtils;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.internal.util.CollectionUtils;
 import org.apache.geode.management.internal.cli.domain.DiskStoreDetails;
-import org.apache.geode.management.internal.cli.util.DiskStoreNotFoundException;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
 import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.junit.categories.UnitTest;
 
@@ -610,7 +614,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
   }
 
   @Test
-  public void testExecuteThrowingDiskStoreNotFoundException() throws Exception {
+  public void testExecuteThrowingEntityNotFoundException() throws Exception {
     final String diskStoreName = "testDiskStore";
     final String memberId = "mockMemberId";
     final String memberName = "mockMemberName";
@@ -649,7 +653,7 @@ public class DescribeDiskStoreFunctionJUnitTest {
     String expected = String.format("A disk store with name (%1$s) was not found on member (%2$s).",
         diskStoreName, memberName);
     assertThatThrownBy(() -> testResultSender.getResults())
-        .isInstanceOf(DiskStoreNotFoundException.class).hasMessage(expected);
+        .isInstanceOf(EntityNotFoundException.class).hasMessage(expected);
   }
 
   @Test
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionTest.java
new file mode 100644
index 0000000..28f3311
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionTest.java
@@ -0,0 +1,87 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.functions;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.ArgumentCaptor;
+
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.ResultSender;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+
+@Category(UnitTest.class)
+public class GatewaySenderDestroyFunctionTest {
+
+  private GatewaySenderDestroyFunction function;
+  private FunctionContext context;
+  private InternalCache cache;
+  private ResultSender resultSender;
+  private ArgumentCaptor<CliFunctionResult> resultCaptor;
+  private GatewaySenderDestroyFunctionArgs args;
+
+  @Before
+  public void before() {
+    function = spy(GatewaySenderDestroyFunction.class);
+    context = mock(FunctionContext.class);
+    cache = mock(InternalCache.class);
+    args = mock(GatewaySenderDestroyFunctionArgs.class);
+    resultSender = mock(ResultSender.class);
+    when(context.getCache()).thenReturn(cache);
+    when(context.getResultSender()).thenReturn(resultSender);
+    when(context.getArguments()).thenReturn(args);
+    when(args.getId()).thenReturn("id");
+    resultCaptor = ArgumentCaptor.forClass(CliFunctionResult.class);
+    when(cache.getDistributedSystem()).thenReturn(mock(DistributedSystem.class));
+  }
+
+  @Test
+  public void gateWaySenderNotFound_ifExists_false() throws Exception {
+    when(cache.getGatewaySender(any())).thenReturn(null);
+    when(args.isIfExists()).thenReturn(false);
+    function.execute(context);
+
+    verify(resultSender).lastResult(resultCaptor.capture());
+    CliFunctionResult result = resultCaptor.getValue();
+    assertThat(result.isSuccessful()).isFalse();
+    assertThat(result.getThrowable()).isNull();
+    assertThat(result.getMessage()).isEqualTo("Gateway sender id not found.");
+  }
+
+  @Test
+  public void gateWaySenderNotFound_ifExists_true() throws Exception {
+    when(cache.getGatewaySender(any())).thenReturn(null);
+    when(args.isIfExists()).thenReturn(true);
+    function.execute(context);
+
+    verify(resultSender).lastResult(resultCaptor.capture());
+    CliFunctionResult result = resultCaptor.getValue();
+    assertThat(result.isSuccessful()).isTrue();
+    assertThat(result.getThrowable()).isNull();
+    assertThat(result.getMessage()).isEqualTo("Skipping: Gateway sender id not found.");
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunctionTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunctionTest.java
new file mode 100644
index 0000000..6088509
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/RegionDestroyFunctionTest.java
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package org.apache.geode.management.internal.cli.functions;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.mockito.ArgumentCaptor;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.ResultSender;
+import org.apache.geode.internal.cache.InternalCache;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+
+@Category(UnitTest.class)
+public class RegionDestroyFunctionTest {
+
+  private RegionDestroyFunction function;
+  private FunctionContext context;
+  private InternalCache cache;
+  private ResultSender resultSender;
+  private ArgumentCaptor<CliFunctionResult> resultCaptor;
+
+  @Before
+  public void before() {
+    function = spy(RegionDestroyFunction.class);
+    context = mock(FunctionContext.class);
+    cache = mock(InternalCache.class);
+    resultSender = mock(ResultSender.class);
+    when(context.getCache()).thenReturn(cache);
+    when(context.getResultSender()).thenReturn(resultSender);
+    when(context.getArguments()).thenReturn("testRegion");
+    resultCaptor = ArgumentCaptor.forClass(CliFunctionResult.class);
+  }
+
+  @Test
+  public void functionContextIsWrong() throws Exception {
+    function.execute(context);
+    verify(resultSender).lastResult(resultCaptor.capture());
+    CliFunctionResult result = resultCaptor.getValue();
+
+    assertThat(result.isSuccessful()).isFalse();
+    assertThat(result.getMessage()).contains("Function Id mismatch or arguments is not available");
+  }
+
+  @Test
+  public void regionAlreadyDestroyed() throws Exception {
+    when(context.getFunctionId()).thenReturn(RegionDestroyFunction.class.getName());
+    when(cache.getRegion(any())).thenReturn(null);
+    function.execute(context);
+
+    verify(resultSender).lastResult(resultCaptor.capture());
+    CliFunctionResult result = resultCaptor.getValue();
+
+    assertThat(result.isSuccessful()).isTrue();
+    assertThat(result.getMessage()).contains("SUCCESS");
+  }
+
+  @Test
+  public void illegalStateExceptionWillNotThrowExceptionToCommand() throws Exception {
+    when(context.getFunctionId()).thenReturn(RegionDestroyFunction.class.getName());
+    Region region = mock(Region.class);
+    when(cache.getRegion(any())).thenReturn(region);
+    doThrow(new IllegalStateException("message")).when(region).destroyRegion();
+
+    function.execute(context);
+    verify(resultSender).lastResult(resultCaptor.capture());
+    CliFunctionResult result = resultCaptor.getValue();
+    assertThat(result.isSuccessful()).isFalse();
+    // will not populate the exception in the result, but only preserve the message
+    assertThat(result.getThrowable()).isNull();
+    assertThat(result.getMessage()).isEqualTo("message");
+  }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/remote/CommandExecutorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/remote/CommandExecutorTest.java
index 3020bc2..4f51f25 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/remote/CommandExecutorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/remote/CommandExecutorTest.java
@@ -17,7 +17,11 @@ package org.apache.geode.management.internal.cli.remote;
 
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.doThrow;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -25,6 +29,8 @@ import org.junit.experimental.categories.Category;
 import org.springframework.shell.event.ParseResult;
 
 import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
+import org.apache.geode.management.internal.cli.exceptions.UserErrorException;
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.security.NotAuthorizedException;
 import org.apache.geode.test.junit.categories.UnitTest;
@@ -39,7 +45,7 @@ public class CommandExecutorTest {
   public void before() {
     parseResult = mock(ParseResult.class);
     result = mock(Result.class);
-    executor = new CommandExecutor();
+    executor = spy(CommandExecutor.class);
   }
 
 
@@ -52,46 +58,77 @@ public class CommandExecutorTest {
 
   @Test
   public void returnsResultAsExpected() throws Exception {
-    executor = new CommandExecutor() {
-      protected Object invokeCommand(ParseResult parseResult) {
-        return result;
-      }
-    };
+    doReturn(result).when(executor).invokeCommand(any());
     Object thisResult = executor.execute(parseResult);
     assertThat(thisResult).isSameAs(result);
   }
 
   @Test
   public void testNullResult() throws Exception {
-    executor = new CommandExecutor() {
-      protected Object invokeCommand(ParseResult parseResult) {
-        return null;
-      }
-    };
+    doReturn(null).when(executor).invokeCommand(any());
     Object thisResult = executor.execute(parseResult);
     assertThat(thisResult.toString()).contains("Command returned null");
   }
 
   @Test
   public void anyRuntimeExceptionGetsCaught() throws Exception {
-    executor = new CommandExecutor() {
-      protected Object invokeCommand(ParseResult parseResult) {
-        throw new RuntimeException("my message here");
-      }
-    };
+    ;
+    doThrow(new RuntimeException("my message here")).when(executor).invokeCommand(any());
     Object thisResult = executor.execute(parseResult);
+    assertThat(((CommandResult) thisResult).getStatus()).isEqualTo(Result.Status.ERROR);
     assertThat(thisResult.toString()).contains("my message here");
   }
 
   @Test
   public void notAuthorizedExceptionGetsThrown() throws Exception {
-    executor = new CommandExecutor() {
-      protected Object invokeCommand(ParseResult parseResult) {
-        throw new NotAuthorizedException("Not Authorized");
-      }
-    };
+    doThrow(new NotAuthorizedException("Not Authorized")).when(executor).invokeCommand(any());
     assertThatThrownBy(() -> executor.execute(parseResult))
         .isInstanceOf(NotAuthorizedException.class);
+  }
+
+  @Test
+  public void anyIllegalArgumentExceptionGetsCaught() throws Exception {
+    ;
+    doThrow(new IllegalArgumentException("my message here")).when(executor).invokeCommand(any());
+    Object thisResult = executor.execute(parseResult);
+    assertThat(((CommandResult) thisResult).getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(thisResult.toString()).contains("my message here");
+  }
 
+  @Test
+  public void anyIllegalStateExceptionGetsCaught() throws Exception {
+    ;
+    doThrow(new IllegalStateException("my message here")).when(executor).invokeCommand(any());
+    Object thisResult = executor.execute(parseResult);
+    assertThat(((CommandResult) thisResult).getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(thisResult.toString()).contains("my message here");
+  }
+
+  @Test
+  public void anyUserErrorExceptionGetsCaught() throws Exception {
+    ;
+    doThrow(new UserErrorException("my message here")).when(executor).invokeCommand(any());
+    Object thisResult = executor.execute(parseResult);
+    assertThat(((CommandResult) thisResult).getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(thisResult.toString()).contains("my message here");
+  }
+
+  @Test
+  public void anyEntityNotFoundException_statusOK() throws Exception {
+    ;
+    doThrow(new EntityNotFoundException("my message here", true)).when(executor)
+        .invokeCommand(any());
+    Object thisResult = executor.execute(parseResult);
+    assertThat(((CommandResult) thisResult).getStatus()).isEqualTo(Result.Status.OK);
+    assertThat(thisResult.toString()).contains("Skipping: my message here");
+  }
+
+  @Test
+  public void anyEntityNotFoundException_statusERROR() throws Exception {
+    ;
+    doThrow(new EntityNotFoundException("my message here")).when(executor).invokeCommand(any());
+    Object thisResult = executor.execute(parseResult);
+    assertThat(((CommandResult) thisResult).getStatus()).isEqualTo(Result.Status.ERROR);
+    assertThat(thisResult.toString()).contains("my message here");
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java
index 80bfe62..95fcb15 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshMultilineCommandTest.java
@@ -25,7 +25,7 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 
@@ -37,11 +37,11 @@ public class GfshMultilineCommandTest {
 
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Test
   public void testMultiLineCommand() throws Exception {
-    gfsh.connectAndVerify(server.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(server.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     // Execute a command
     CommandStringBuilder csb = new CommandStringBuilder(LIST_MEMBER);
     csb.addOption(GROUP, "nogroup");
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
index 6d8da39..0d12a18 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
@@ -26,7 +26,7 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ClusterConfigDeployJarDUnitTest extends ClusterConfigTestBase {
@@ -36,7 +36,7 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigTestBase {
   private String group2Jar;
 
   @Rule
-  public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public GfshCommandRule gfshConnector = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDistributionDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDistributionDUnitTest.java
index 99d40e1..1c0890b 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDistributionDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDistributionDUnitTest.java
@@ -40,7 +40,7 @@ import org.apache.geode.test.compiler.ClassBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
 
 @Category(DistributedTest.class)
@@ -60,7 +60,7 @@ public class ClusterConfigDistributionDUnitTest {
   @Rule
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
   @Rule
-  public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public GfshCommandRule gfshConnector = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
index b70c71b..fe170e9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigImportDUnitTest.java
@@ -40,7 +40,7 @@ import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ClusterConfigImportDUnitTest extends ClusterConfigTestBase {
@@ -50,7 +50,7 @@ public class ClusterConfigImportDUnitTest extends ClusterConfigTestBase {
   private MemberVM locatorVM;
 
   @Rule
-  public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public GfshCommandRule gfshConnector = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java
index 2c76362..030e4ef 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigWithSecurityDUnitTest.java
@@ -40,7 +40,7 @@ import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.serializable.SerializableTemporaryFolder;
 
 @Category({DistributedTest.class, SecurityTest.class})
@@ -57,7 +57,7 @@ public class ClusterConfigWithSecurityDUnitTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule connector = new GfshShellConnectionRule();
+  public GfshCommandRule connector = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ImportClusterConfigDistributedTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ImportClusterConfigDistributedTest.java
index c214246..46d1f7a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ImportClusterConfigDistributedTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ImportClusterConfigDistributedTest.java
@@ -33,7 +33,7 @@ import org.apache.geode.cache.Region;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ImportClusterConfigDistributedTest {
@@ -50,7 +50,7 @@ public class ImportClusterConfigDistributedTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void exportClusterConfig() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ImportOldClusterConfigDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ImportOldClusterConfigDUnitTest.java
index 8ef523d..396a40a9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ImportOldClusterConfigDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ImportOldClusterConfigDUnitTest.java
@@ -33,7 +33,7 @@ import org.apache.geode.management.internal.configuration.utils.ZipUtils;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ImportOldClusterConfigDUnitTest {
@@ -41,7 +41,7 @@ public class ImportOldClusterConfigDUnitTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder tempFolder = new TemporaryFolder();
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java
index f09a2e4..ba32771 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsPostProcessorTest.java
@@ -16,7 +16,6 @@ package org.apache.geode.management.internal.security;
 
 import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_POST_PROCESSOR;
-import static org.assertj.core.api.Assertions.assertThat;
 
 import org.junit.BeforeClass;
 import org.junit.ClassRule;
@@ -30,7 +29,7 @@ import org.apache.geode.security.TestPostProcessor;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.apache.geode.test.junit.rules.ConnectionConfiguration;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category({IntegrationTest.class, SecurityTest.class})
@@ -42,8 +41,8 @@ public class GfshCommandsPostProcessorTest {
       .withProperty(SECURITY_MANAGER, SimpleTestSecurityManager.class.getName()).withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfshConnection = new GfshShellConnectionRule(
-      serverStarter::getJmxPort, GfshShellConnectionRule.PortType.jmxManager);
+  public GfshCommandRule gfshConnection =
+      new GfshCommandRule(serverStarter::getJmxPort, GfshCommandRule.PortType.jmxManager);
 
   @BeforeClass
   public static void beforeClass() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java
index 9e3478cb..a2980b7 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/GfshCommandsSecurityTest.java
@@ -35,7 +35,7 @@ import org.apache.geode.security.SimpleTestSecurityManager;
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
 import org.apache.geode.test.junit.rules.ConnectionConfiguration;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category({IntegrationTest.class, SecurityTest.class})
@@ -46,8 +46,8 @@ public class GfshCommandsSecurityTest {
           .withRegion(RegionShortcut.REPLICATE_PERSISTENT, "persistentRegion");
 
   @Rule
-  public GfshShellConnectionRule gfshConnection = new GfshShellConnectionRule(
-      serverStarter::getJmxPort, GfshShellConnectionRule.PortType.jmxManager);
+  public GfshCommandRule gfshConnection =
+      new GfshCommandRule(serverStarter::getJmxPort, GfshCommandRule.PortType.jmxManager);
 
   @BeforeClass
   public static void beforeClass() throws Exception {
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/security/MultiUserDUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/security/MultiUserDUnitTest.java
index c33da97..749d58a 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/security/MultiUserDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/security/MultiUserDUnitTest.java
@@ -43,8 +43,8 @@ import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.FlakyTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule.PortType;
 import org.apache.geode.test.junit.rules.Member;
 
 @Category({DistributedTest.class, SecurityTest.class})
@@ -73,7 +73,7 @@ public class MultiUserDUnitTest {
     // test is done.
     VM vm1 = lsRule.getVM(1);
     AsyncInvocation vm1Invoke = vm1.invokeAsync("run as data-reader", () -> {
-      GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+      GfshCommandRule gfsh = new GfshCommandRule();
       gfsh.secureConnectAndVerify(jmxPort, PortType.jmxManager, "dataRead", "dataRead");
 
       Awaitility.waitAtMost(5, TimeUnit.MILLISECONDS);
@@ -84,7 +84,7 @@ public class MultiUserDUnitTest {
     // set up vm_2 as a gfsh vm, and then connect as "stranger" and try to execute the commands and
     // assert errors comes back are NotAuthorized
     AsyncInvocation vm2Invoke = vm2.invokeAsync("run as guest", () -> {
-      GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+      GfshCommandRule gfsh = new GfshCommandRule();
       gfsh.secureConnectAndVerify(jmxPort, PortType.jmxManager, "guest", "guest");
 
       List<TestCommand> allCommands = TestCommand.getOnlineCommands();
@@ -119,7 +119,7 @@ public class MultiUserDUnitTest {
     // set up vm_3 as another gfsh vm, and then connect as "super-user" and try to execute the
     // commands and assert we don't get a NotAuthorized Exception
     AsyncInvocation vm3Invoke = vm3.invokeAsync("run as superUser", () -> {
-      GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+      GfshCommandRule gfsh = new GfshCommandRule();
       gfsh.secureConnectAndVerify(jmxPort, PortType.jmxManager, "data,cluster", "data,cluster");
 
       List<TestCommand> allCommands = TestCommand.getOnlineCommands();
diff --git a/geode-core/src/test/java/org/apache/geode/pdx/ClientsWithVersioningRetryDUnitTest.java b/geode-core/src/test/java/org/apache/geode/pdx/ClientsWithVersioningRetryDUnitTest.java
index b67cc48..37c7960 100644
--- a/geode-core/src/test/java/org/apache/geode/pdx/ClientsWithVersioningRetryDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/pdx/ClientsWithVersioningRetryDUnitTest.java
@@ -215,8 +215,8 @@ public class ClientsWithVersioningRetryDUnitTest extends JUnit4CacheTestCase {
         DistributionMessageObserver.setInstance(new DistributionMessageObserver() {
 
           @Override
-          public void beforeSendMessage(DistributionManager dm, DistributionMessage msg) {
-            if (msg instanceof DistributedPutAllOperation.PutAllMessage) {
+          public void beforeSendMessage(DistributionManager dm, DistributionMessage message) {
+            if (message instanceof DistributedPutAllOperation.PutAllMessage) {
               DistributionMessageObserver.setInstance(null);
               disconnectFromDS(vm1);
             }
diff --git a/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java b/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
index b747d73..7cea40c 100644
--- a/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/PDXGfshPostProcessorOnRemoteServerTest.java
@@ -39,7 +39,7 @@ import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category({DistributedTest.class, SecurityTest.class})
 public class PDXGfshPostProcessorOnRemoteServerTest {
@@ -50,7 +50,7 @@ public class PDXGfshPostProcessorOnRemoteServerTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Test
   public void testGfshCommand() throws Exception {
@@ -96,7 +96,7 @@ public class PDXGfshPostProcessorOnRemoteServerTest {
           });
     });
 
-    gfsh.connectAndVerify(locatorVM.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager,
+    gfsh.connectAndVerify(locatorVM.getJmxPort(), GfshCommandRule.PortType.jmxManager,
         CliStrings.CONNECT__USERNAME, "dataUser", CliStrings.CONNECT__PASSWORD, "1234567");
 
     // get command
diff --git a/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java b/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
index 1e051d7..15ae43d 100644
--- a/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/security/PDXPostProcessorDUnitTest.java
@@ -49,7 +49,7 @@ import org.apache.geode.test.dunit.VM;
 import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 import org.apache.geode.test.junit.runners.CategoryWithParameterizedRunnerFactory;
 
@@ -211,9 +211,9 @@ public class PDXPostProcessorDUnitTest extends JUnit4DistributedTestCase {
     });
 
     this.client1.invoke(() -> {
-      GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
-      gfsh.secureConnectAndVerify(this.server.getJmxPort(),
-          GfshShellConnectionRule.PortType.jmxManager, "dataUser", "1234567");
+      GfshCommandRule gfsh = new GfshCommandRule();
+      gfsh.secureConnectAndVerify(this.server.getJmxPort(), GfshCommandRule.PortType.jmxManager,
+          "dataUser", "1234567");
 
       // get command
       gfsh.executeAndAssertThat("get --key=key1 --region=AuthRegion").statusIsSuccess();
diff --git a/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java b/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java
index cd75a04..cc4d3d1 100644
--- a/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java
+++ b/geode-core/src/test/java/org/apache/geode/test/fake/Fakes.java
@@ -98,6 +98,7 @@ public class Fakes {
     when(distributionManager.getSystem()).thenReturn(system);
     when(distributionManager.getCancelCriterion()).thenReturn(systemCancelCriterion);
     when(distributionManager.getCache()).thenReturn(cache);
+    when(distributionManager.getExistingCache()).thenReturn(cache);
 
     return cache;
   }
@@ -120,6 +121,8 @@ public class Fakes {
     when(attributes.getDataPolicy()).thenReturn(policy);
     when(region.getCache()).thenReturn(cache);
     when(region.getRegionService()).thenReturn(cache);
+    when(region.getName()).thenReturn(name);
+
     return region;
   }
 
diff --git a/geode-core/src/test/java/org/apache/geode/test/junit/assertions/GfshShellConnectionRuleAssert.java b/geode-core/src/test/java/org/apache/geode/test/junit/assertions/CommandResultAssert.java
similarity index 68%
rename from geode-core/src/test/java/org/apache/geode/test/junit/assertions/GfshShellConnectionRuleAssert.java
rename to geode-core/src/test/java/org/apache/geode/test/junit/assertions/CommandResultAssert.java
index 79d54d9..97c72dc 100644
--- a/geode-core/src/test/java/org/apache/geode/test/junit/assertions/GfshShellConnectionRuleAssert.java
+++ b/geode-core/src/test/java/org/apache/geode/test/junit/assertions/CommandResultAssert.java
@@ -17,8 +17,6 @@ package org.apache.geode.test.junit.assertions;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.Arrays;
-import java.util.List;
-import java.util.Optional;
 
 import org.assertj.core.api.AbstractAssert;
 import org.assertj.core.api.Assertions;
@@ -27,14 +25,18 @@ import org.json.JSONArray;
 import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.json.GfJsonObject;
 import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
 
 
-public class GfshShellConnectionRuleAssert
-    extends AbstractAssert<GfshShellConnectionRuleAssert, GfshShellConnectionRuleExecution> {
-  public GfshShellConnectionRuleAssert(GfshShellConnectionRule gfsh, CommandResult commandResult) {
-    super(new GfshShellConnectionRuleExecution(gfsh, commandResult),
-        GfshShellConnectionRuleAssert.class);
+public class CommandResultAssert
+    extends AbstractAssert<CommandResultAssert, CommandResultExecution> {
+
+  public CommandResultAssert(CommandResult commandResult) {
+    super(new CommandResultExecution(commandResult.toJson(), commandResult),
+        CommandResultAssert.class);
+  }
+
+  public CommandResultAssert(String output, CommandResult commandResult) {
+    super(new CommandResultExecution(output, commandResult), CommandResultAssert.class);
   }
 
   /**
@@ -57,8 +59,8 @@ public class GfshShellConnectionRuleAssert
    * <code> containsKeyValuePair("Key Class", "java.lang.String"); </code>
    * </pre>
    */
-  public GfshShellConnectionRuleAssert containsKeyValuePair(String key, String value) {
-    assertThat(actual.getGfshOutput()).containsPattern(key + "\\s+: " + value);
+  public CommandResultAssert containsKeyValuePair(String key, String value) {
+    assertThat(actual.getOutput()).containsPattern(key + "\\s+: " + value);
 
     return this;
   }
@@ -66,9 +68,9 @@ public class GfshShellConnectionRuleAssert
   /**
    * Verifies the gfsh output contains the given output
    */
-  public GfshShellConnectionRuleAssert containsOutput(String... expectedOutputs) {
+  public CommandResultAssert containsOutput(String... expectedOutputs) {
     for (String expectedOutput : expectedOutputs) {
-      assertThat(actual.getGfshOutput()).contains(expectedOutput);
+      assertThat(actual.getOutput()).contains(expectedOutput);
     }
 
     return this;
@@ -77,9 +79,9 @@ public class GfshShellConnectionRuleAssert
   /**
    * Verifies the gfsh output does not contain the given output
    */
-  public GfshShellConnectionRuleAssert doesNotContainOutput(String... expectedOutputs) {
+  public CommandResultAssert doesNotContainOutput(String... expectedOutputs) {
     for (String expectedOutput : expectedOutputs) {
-      assertThat(actual.getGfshOutput()).doesNotContain(expectedOutput);
+      assertThat(actual.getOutput()).doesNotContain(expectedOutput);
     }
 
     return this;
@@ -88,9 +90,9 @@ public class GfshShellConnectionRuleAssert
   /**
    * Verifies that gfsh executed with status OK
    */
-  public GfshShellConnectionRuleAssert statusIsSuccess() {
+  public CommandResultAssert statusIsSuccess() {
     CommandResult result = actual.getCommandResult();
-    Assertions.assertThat(result.getStatus()).describedAs(actual.getGfsh().getGfshOutput())
+    Assertions.assertThat(result.getStatus()).describedAs(actual.getOutput())
         .isEqualTo(Result.Status.OK);
 
     return this;
@@ -99,9 +101,9 @@ public class GfshShellConnectionRuleAssert
   /**
    * Verifies that gfsh executed with status ERROR
    */
-  public GfshShellConnectionRuleAssert statusIsError() {
+  public CommandResultAssert statusIsError() {
     CommandResult result = actual.getCommandResult();
-    Assertions.assertThat(result.getStatus()).describedAs(actual.getGfsh().getGfshOutput())
+    Assertions.assertThat(result.getStatus()).describedAs(actual.getOutput())
         .isEqualTo(Result.Status.ERROR);
 
     return this;
@@ -127,10 +129,10 @@ public class GfshShellConnectionRuleAssert
    * </code>
    * </pre>
    */
-  public GfshShellConnectionRuleAssert tableHasColumnWithExactValuesInExactOrder(String header,
+  public CommandResultAssert tableHasColumnWithExactValuesInExactOrder(String header,
       Object... expectedValues) {
     GfJsonObject resultContentJSON = actual.getCommandResult().getContent();
-    Object content = resultContentJSON.get(header);
+    Object content = getColumnContent(header, resultContentJSON);
 
     if (content == null) {
       failWithMessage(
@@ -163,10 +165,10 @@ public class GfshShellConnectionRuleAssert
    * <code> tableHasColumnWithExactValuesInAnyOrder("Region Path", "/region2", "/region1"); </code>
    * </pre>
    */
-  public GfshShellConnectionRuleAssert tableHasColumnWithExactValuesInAnyOrder(String header,
+  public CommandResultAssert tableHasColumnWithExactValuesInAnyOrder(String header,
       Object... expectedValues) {
     GfJsonObject resultContentJSON = actual.getCommandResult().getContent();
-    Object content = resultContentJSON.get(header);
+    Object content = getColumnContent(header, resultContentJSON);
 
     if (content == null) {
       failWithMessage("Command result did not contain a table with column header <" + header + ">: "
@@ -183,10 +185,10 @@ public class GfshShellConnectionRuleAssert
    * Verifies that each of the actual values in the column with the given header contains at least
    * one of the expectedValues.
    */
-  public GfshShellConnectionRuleAssert tableHasColumnWithValuesContaining(String header,
+  public CommandResultAssert tableHasColumnWithValuesContaining(String header,
       String... expectedValues) {
     GfJsonObject resultContentJSON = actual.getCommandResult().getContent();
-    Object content = resultContentJSON.get(header);
+    Object content = getColumnContent(header, resultContentJSON);
 
     if (content == null) {
       failWithMessage("Command result did not contain a table with column header <" + header + ">: "
@@ -208,13 +210,45 @@ public class GfshShellConnectionRuleAssert
     return this;
   }
 
-  public GfshShellConnectionRuleAssert hasResult() {
+
+  /**
+   * Verifies that each of the actual values in the column with the given header contains at least
+   * one of the expectedValues.
+   */
+  public CommandResultAssert tableHasColumnOnlyWithValues(String header, String... expectedValues) {
+    GfJsonObject resultContentJSON = actual.getCommandResult().getContent();
+    Object content = getColumnContent(header, resultContentJSON);
+
+    if (content == null) {
+      failWithMessage("Command result did not contain a table with column header <" + header + ">: "
+          + resultContentJSON.toString());
+    }
+
+    Object[] actualValues = toArray((JSONArray) content);
+    assertThat(actualValues).containsOnly(expectedValues);
+    return this;
+  }
+
+  private Object getColumnContent(String header, GfJsonObject resultContentJSON) {
+    if (resultContentJSON.get(header) != null) {
+      return resultContentJSON.get(header);
+    }
+    try {
+      // Sometimes, the output is buried in a most questionable way.
+      return resultContentJSON.getJSONObject("__sections__-0").getJSONObject("__tables__-0")
+          .getJSONObject("content").get(header);
+    } catch (NullPointerException ignored) {
+    }
+    return null;
+  }
+
+  public CommandResultAssert hasResult() {
     containsKeyValuePair("Result", "true");
 
     return this;
   }
 
-  public GfshShellConnectionRuleAssert hasNoResult() {
+  public CommandResultAssert hasNoResult() {
     containsKeyValuePair("Result", "false");
 
     return this;
diff --git a/geode-core/src/test/java/org/apache/geode/test/junit/assertions/GfshShellConnectionRuleExecution.java b/geode-core/src/test/java/org/apache/geode/test/junit/assertions/CommandResultExecution.java
similarity index 71%
rename from geode-core/src/test/java/org/apache/geode/test/junit/assertions/GfshShellConnectionRuleExecution.java
rename to geode-core/src/test/java/org/apache/geode/test/junit/assertions/CommandResultExecution.java
index b4c3003..ec79c18 100644
--- a/geode-core/src/test/java/org/apache/geode/test/junit/assertions/GfshShellConnectionRuleExecution.java
+++ b/geode-core/src/test/java/org/apache/geode/test/junit/assertions/CommandResultExecution.java
@@ -15,28 +15,21 @@
 package org.apache.geode.test.junit.assertions;
 
 import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
 
-public class GfshShellConnectionRuleExecution {
-  private GfshShellConnectionRule gfsh;
+public class CommandResultExecution {
   private CommandResult commandResult;
+  private String output;
 
-  public GfshShellConnectionRuleExecution(GfshShellConnectionRule gfsh,
-      CommandResult commandResult) {
-
-    this.gfsh = gfsh;
+  public CommandResultExecution(String output, CommandResult commandResult) {
+    this.output = output;
     this.commandResult = commandResult;
   }
 
-  public GfshShellConnectionRule getGfsh() {
-    return gfsh;
-  }
-
   public CommandResult getCommandResult() {
     return commandResult;
   }
 
-  public String getGfshOutput() {
-    return gfsh.getGfshOutput();
+  public String getOutput() {
+    return output;
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshShellConnectionRule.java b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
similarity index 93%
rename from geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshShellConnectionRule.java
rename to geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
index 6f8de9b..3583684 100644
--- a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
@@ -34,7 +34,7 @@ import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.IgnoredException;
-import org.apache.geode.test.junit.assertions.GfshShellConnectionRuleAssert;
+import org.apache.geode.test.junit.assertions.CommandResultAssert;
 
 /**
  * Class which eases the connection to the locator/jmxManager in Gfsh shell and execute gfsh
@@ -52,7 +52,7 @@ import org.apache.geode.test.junit.assertions.GfshShellConnectionRuleAssert;
  * you can use this as Rule:
  *
  * <pre>
- * {@literal @}Rule GfshShellConnectionRule rule = new GfshShellConnectionRule();
+ * {@literal @}Rule GfshCommandRule rule = new GfshCommandRule();
  * </pre>
  *
  * then after you connect to a locator, you don't have to call disconnect() or close() at all, since
@@ -62,13 +62,13 @@ import org.apache.geode.test.junit.assertions.GfshShellConnectionRuleAssert;
  * Or as a ClassRule:
  *
  * <pre>
- * {@literal @}ClassRule GfshShellConnectionRule rule = new GfshShellConnectionRule();
+ * {@literal @}ClassRule GfshCommandRule rule = new GfshCommandRule();
  * </pre>
  *
  * When using as a ClassRule, if you call connect in a test, you will need to call disconnect after
  * the test as well. See NetstatDUnitTest for example.
  */
-public class GfshShellConnectionRule extends DescribedExternalResource {
+public class GfshCommandRule extends DescribedExternalResource {
 
   private Supplier<Integer> portSupplier;
   private PortType portType = PortType.jmxManager;
@@ -78,7 +78,7 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
   private TemporaryFolder temporaryFolder = new TemporaryFolder();
   private File workingDir;
 
-  public GfshShellConnectionRule() {
+  public GfshCommandRule() {
     try {
       temporaryFolder.create();
     } catch (IOException e) {
@@ -86,7 +86,7 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
     }
   }
 
-  public GfshShellConnectionRule(Supplier<Integer> portSupplier, PortType portType) {
+  public GfshCommandRule(Supplier<Integer> portSupplier, PortType portType) {
     this();
     this.portType = portType;
     this.portSupplier = portSupplier;
@@ -238,9 +238,9 @@ public class GfshShellConnectionRule extends DescribedExternalResource {
     return result;
   }
 
-  public GfshShellConnectionRuleAssert executeAndAssertThat(String command) {
+  public CommandResultAssert executeAndAssertThat(String command) {
     CommandResult commandResult = executeCommand(command);
-    return new GfshShellConnectionRuleAssert(this, commandResult);
+    return new CommandResultAssert(gfsh.outputString, commandResult);
   }
 
 
diff --git a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshParserRule.java b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshParserRule.java
index 9e1b220..20592be 100644
--- a/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshParserRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/junit/rules/GfshParserRule.java
@@ -34,6 +34,7 @@ import org.apache.geode.management.internal.cli.GfshParseResult;
 import org.apache.geode.management.internal.cli.GfshParser;
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.test.junit.assertions.CommandResultAssert;
 
 public class GfshParserRule extends ExternalResource {
 
@@ -81,6 +82,11 @@ public class GfshParserRule extends ExternalResource {
         parseResult.getArguments());
   }
 
+  public <T> CommandResultAssert executeAndAssertThat(T instance, String command) {
+    CommandResult result = executeCommandWithInstance(instance, command);
+    return new CommandResultAssert(result);
+  }
+
   public CommandCandidate complete(String command) {
     List<Completion> candidates = new ArrayList<>();
     int cursor = parser.completeAdvanced(command, command.length(), candidates);
diff --git a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
index cbeb2a1..d218f77 100644
--- a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
+++ b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/excludedClasses.txt
@@ -1,20 +1,63 @@
+org.apache.geode.internal.security.SecurableCommunicationChannel
+org/apache/geode/admin/internal/BackupStatusImpl
+org/apache/geode/cache/operations/CloseCQOperationContext
+org/apache/geode/cache/operations/DestroyOperationContext
+org/apache/geode/cache/operations/ExecuteCQOperationContext
+org/apache/geode/cache/operations/ExecuteFunctionOperationContext
+org/apache/geode/cache/operations/GetDurableCQsOperationContext
+org/apache/geode/cache/operations/GetOperationContext
+org/apache/geode/cache/operations/InterestOperationContext
+org/apache/geode/cache/operations/InvalidateOperationContext
+org/apache/geode/cache/operations/KeyOperationContext
+org/apache/geode/cache/operations/KeySetOperationContext
+org/apache/geode/cache/operations/KeyValueOperationContext
+org/apache/geode/cache/operations/OperationContext
+org/apache/geode/cache/operations/PutAllOperationContext
+org/apache/geode/cache/operations/PutOperationContext
+org/apache/geode/cache/operations/QueryOperationContext
+org/apache/geode/cache/operations/RegionClearOperationContext
+org/apache/geode/cache/operations/RegionCreateOperationContext
+org/apache/geode/cache/operations/RegionDestroyOperationContext
+org/apache/geode/cache/operations/RegionOperationContext
+org/apache/geode/cache/operations/RegisterInterestOperationContext
+org/apache/geode/cache/operations/RemoveAllOperationContext
+org/apache/geode/cache/operations/StopCQOperationContext
+org/apache/geode/cache/operations/UnregisterInterestOperationContext
+org/apache/geode/cache/operations/internal/GetOperationContextImpl
+org/apache/geode/cache/operations/internal/UpdateOnlyMap
 org/apache/geode/cache/query/CqAttributesFactory
 org/apache/geode/cache/query/internal/index/CompactRangeIndex
 org/apache/geode/cache/query/internal/index/CompactRangeIndex$1
 org/apache/geode/cache/query/internal/index/CompactRangeIndex$IMQEvaluator$1
-org/apache/geode/internal/cache/tier/CommunicationMode
 org/apache/geode/distributed/LocatorLauncher
 org/apache/geode/distributed/LocatorLauncher$Command
 org/apache/geode/distributed/ServerLauncher
 org/apache/geode/distributed/ServerLauncher$Command
+org/apache/geode/distributed/internal/DistributionConfigImpl
 org/apache/geode/distributed/internal/DistributionManager
+org/apache/geode/distributed/internal/tcpserver/LocatorCancelException
+org/apache/geode/internal/AvailablePort$Keeper
 org/apache/geode/internal/ExitCode
 org/apache/geode/internal/JarDeployer
-org/apache/geode/internal/cache/BackupLock
+org/apache/geode/internal/cache/backup/BackupLock
+org/apache/geode/internal/cache/DiskStoreAttributesCreation
+org/apache/geode/internal/cache/DiskStoreMonitor$DiskState
+org/apache/geode/internal/cache/EventStateHelper
+org/apache/geode/internal/cache/InitialImageOperation$GIITestHook
+org/apache/geode/internal/cache/Oplog$OPLOG_TYPE
+org/apache/geode/internal/cache/UserSpecifiedDiskStoreAttributes
+org/apache/geode/internal/cache/client/protocol/exception/ServiceLoadingFailureException
+org/apache/geode/internal/cache/client/protocol/exception/ServiceVersionNotFoundException
+org/apache/geode/internal/cache/operations/ContainsKeyOperationContext
+org/apache/geode/internal/cache/tier/CommunicationMode
+org/apache/geode/internal/cache/tier/InternalClientMembership$EventType
+org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl$ClientCqConcurrentMap
+org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl$CqNameToOpHashMap
+org/apache/geode/internal/datasource/FacetsJCAConnectionManagerImpl
 org/apache/geode/internal/exception/InvalidExecutionContextException
 org/apache/geode/internal/logging/GemFireLevel
-org/apache/geode/internal/logging/LoggingThreadGroup
 org/apache/geode/internal/logging/LogWriterImpl
+org/apache/geode/internal/logging/LoggingThreadGroup
 org/apache/geode/internal/logging/log4j/ConfigurableLogger
 org/apache/geode/internal/logging/log4j/CustomGemFireLogger
 org/apache/geode/internal/logging/log4j/ExtendedGemFireLogger
@@ -25,17 +68,76 @@ org/apache/geode/internal/logging/log4j/LogWriterAppenders$Identifier
 org/apache/geode/internal/logging/log4j/LogWriterLogger
 org/apache/geode/internal/logging/log4j/message/GemFireParameterizedMessage
 org/apache/geode/internal/logging/log4j/message/GemFireParameterizedMessageFactory
+org/apache/geode/internal/memcached/Command
+org/apache/geode/internal/memcached/Command$1
+org/apache/geode/internal/memcached/Command$10
+org/apache/geode/internal/memcached/Command$11
+org/apache/geode/internal/memcached/Command$12
+org/apache/geode/internal/memcached/Command$13
+org/apache/geode/internal/memcached/Command$14
+org/apache/geode/internal/memcached/Command$15
+org/apache/geode/internal/memcached/Command$16
+org/apache/geode/internal/memcached/Command$17
+org/apache/geode/internal/memcached/Command$18
+org/apache/geode/internal/memcached/Command$19
+org/apache/geode/internal/memcached/Command$2
+org/apache/geode/internal/memcached/Command$20
+org/apache/geode/internal/memcached/Command$21
+org/apache/geode/internal/memcached/Command$22
+org/apache/geode/internal/memcached/Command$23
+org/apache/geode/internal/memcached/Command$24
+org/apache/geode/internal/memcached/Command$25
+org/apache/geode/internal/memcached/Command$26
+org/apache/geode/internal/memcached/Command$27
+org/apache/geode/internal/memcached/Command$28
+org/apache/geode/internal/memcached/Command$29
+org/apache/geode/internal/memcached/Command$3
+org/apache/geode/internal/memcached/Command$30
+org/apache/geode/internal/memcached/Command$31
+org/apache/geode/internal/memcached/Command$32
+org/apache/geode/internal/memcached/Command$33
+org/apache/geode/internal/memcached/Command$34
+org/apache/geode/internal/memcached/Command$4
+org/apache/geode/internal/memcached/Command$5
+org/apache/geode/internal/memcached/Command$6
+org/apache/geode/internal/memcached/Command$7
+org/apache/geode/internal/memcached/Command$8
+org/apache/geode/internal/memcached/Command$9
 org/apache/geode/internal/offheap/RefCountChangeInfo
 org/apache/geode/internal/process/BlockingProcessStreamReader
+org/apache/geode/internal/process/ClusterConfigurationNotAvailableException
 org/apache/geode/internal/process/NonBlockingProcessStreamReader
 org/apache/geode/internal/process/ProcessStreamReader
 org/apache/geode/internal/process/ProcessStreamReader$ReadingMode
 org/apache/geode/internal/process/ProcessTerminatedAbnormallyException
 org/apache/geode/internal/process/ProcessType
 org/apache/geode/internal/process/ProcessUtils
+org/apache/geode/internal/process/SharedConfigurationNotAvailableException
 org/apache/geode/internal/process/UnableToControlProcessException
+org/apache/geode/internal/ra/GFConnectionFactoryImpl
+org/apache/geode/internal/ra/GFConnectionImpl
+org/apache/geode/internal/ra/spi/JCAManagedConnectionFactory
 org/apache/geode/internal/redis/RegionCreationException
-org/apache/geode/redis/internal/RedisCommandType,false
+org/apache/geode/internal/security/GeodeSecurityUtil
+org/apache/geode/internal/security/IntegratedSecurityService
+org/apache/geode/internal/security/IntegratedSecurityService$SerializationProxy
+org/apache/geode/internal/security/SecurityService
+org/apache/geode/internal/security/shiro/GeodeAuthenticationToken
+org/apache/geode/internal/shared/NativeErrorException
+org/apache/geode/internal/shared/OSType
+org/apache/geode/internal/shared/OSType$1
+org/apache/geode/internal/shared/OSType$2
+org/apache/geode/internal/shared/OSType$3
+org/apache/geode/internal/shared/OSType$4
+org/apache/geode/internal/shared/OSType$5
+org/apache/geode/internal/shared/TCPSocketOptions
+org/apache/geode/internal/statistics/platform/LinuxProcFsStatistics$CPU
+org/apache/geode/internal/util/concurrent/StoppableReadWriteLock
+org/apache/geode/management/internal/BackupStatusImpl
+org/apache/geode/management/internal/cli/commands/ShowMetricsCommand$Category
+org/apache/geode/management/internal/cli/exceptions/UserErrorException
+org/apache/geode/pdx/JSONFormatter$states
+org/apache/geode/redis/internal/RedisCommandType
 org/apache/geode/redis/internal/RedisCommandType$1
 org/apache/geode/redis/internal/RedisCommandType$10
 org/apache/geode/redis/internal/RedisCommandType$100
@@ -149,6 +251,7 @@ org/apache/geode/redis/internal/RedisCommandType$96
 org/apache/geode/redis/internal/RedisCommandType$97
 org/apache/geode/redis/internal/RedisCommandType$98
 org/apache/geode/redis/internal/RedisCommandType$99
+org/apache/geode/redis/internal/RedisCommandType,false
 org/apache/geode/redis/internal/RedisDataType
 org/apache/geode/redis/internal/RedisDataType$1
 org/apache/geode/redis/internal/RedisDataType$2
@@ -212,116 +315,15 @@ org/apache/geode/redis/internal/executor/SortedSetQuery$6
 org/apache/geode/redis/internal/executor/SortedSetQuery$7
 org/apache/geode/redis/internal/executor/SortedSetQuery$8
 org/apache/geode/redis/internal/executor/SortedSetQuery$9
-org/apache/geode/internal/shared/NativeErrorException
-org/apache/geode/internal/shared/OSType
-org/apache/geode/internal/shared/OSType$1
-org/apache/geode/internal/shared/OSType$2
-org/apache/geode/internal/shared/OSType$3
-org/apache/geode/internal/shared/OSType$4
-org/apache/geode/internal/shared/OSType$5
-org/apache/geode/internal/shared/TCPSocketOptions
-org/apache/geode/internal/process/SharedConfigurationNotAvailableException
-org/apache/geode/internal/cache/tier/InternalClientMembership$EventType
-org/apache/geode/internal/util/concurrent/StoppableReadWriteLock
-org/apache/geode/rest/internal/web/exception.GemfireRestException
+org/apache/geode/redis/internal/executor/list/ListExecutor$ListDirection
 org/apache/geode/rest/internal/web/controllers/support/JSONTypes
 org/apache/geode/rest/internal/web/controllers/support/QueryResultTypes
 org/apache/geode/rest/internal/web/controllers/support/UpdateOp
+org/apache/geode/rest/internal/web/exception.GemfireRestException
 org/apache/geode/rest/internal/web/exception/MalformedJsonException
 org/apache/geode/rest/internal/web/exception/RegionNotFoundException
 org/apache/geode/rest/internal/web/exception/ResourceNotFoundException
-org/apache/geode/distributed/internal/DistributionConfigImpl
-org/apache/geode/internal/cache/EventStateHelper
-org/apache/geode/internal/cache/DiskStoreMonitor$DiskState
-org/apache/geode/internal/cache/UserSpecifiedDiskStoreAttributes
-org/apache/geode/internal/cache/DiskStoreAttributesCreation
-org/apache/geode/internal/cache/Oplog$OPLOG_TYPE
-org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl$ClientCqConcurrentMap
-org/apache/geode/internal/cache/tier/sockets/ClientUpdateMessageImpl$CqNameToOpHashMap
-org/apache/geode/internal/datasource/FacetsJCAConnectionManagerImpl
-org/apache/geode/internal/process/ClusterConfigurationNotAvailableException
-org/apache/geode/internal/security/GeodeSecurityUtil
-org/apache/geode/internal/security/IntegratedSecurityService
-org/apache/geode/internal/security/IntegratedSecurityService$SerializationProxy
-org/apache/geode/internal/security/SecurityService
-org/apache/geode/internal/statistics/platform/LinuxProcFsStatistics$CPU
-org/apache/geode/internal/ra/GFConnectionFactoryImpl
-org/apache/geode/internal/ra/GFConnectionImpl
-org/apache/geode/internal/ra/spi/JCAManagedConnectionFactory
-org/apache/geode/cache/operations/internal/UpdateOnlyMap
-org/apache/geode/cache/operations/CloseCQOperationContext
-org/apache/geode/cache/operations/DestroyOperationContext
-org/apache/geode/cache/operations/ExecuteCQOperationContext
-org/apache/geode/cache/operations/ExecuteFunctionOperationContext
-org/apache/geode/cache/operations/GetDurableCQsOperationContext
-org/apache/geode/cache/operations/GetOperationContext
-org/apache/geode/cache/operations/InterestOperationContext
-org/apache/geode/cache/operations/InvalidateOperationContext
-org/apache/geode/cache/operations/KeyOperationContext
-org/apache/geode/cache/operations/KeySetOperationContext
-org/apache/geode/cache/operations/KeyValueOperationContext
-org/apache/geode/cache/operations/OperationContext
-org/apache/geode/cache/operations/PutAllOperationContext
-org/apache/geode/cache/operations/PutOperationContext
-org/apache/geode/cache/operations/QueryOperationContext
-org/apache/geode/cache/operations/RegionClearOperationContext
-org/apache/geode/cache/operations/RegionCreateOperationContext
-org/apache/geode/cache/operations/RegionDestroyOperationContext
-org/apache/geode/cache/operations/RegionOperationContext
-org/apache/geode/cache/operations/RegisterInterestOperationContext
-org/apache/geode/cache/operations/RemoveAllOperationContext
-org/apache/geode/cache/operations/StopCQOperationContext
-org/apache/geode/cache/operations/UnregisterInterestOperationContext
-org/apache/geode/cache/operations/internal/GetOperationContextImpl
-org/apache/geode/internal/cache/client/protocol/exception/ServiceLoadingFailureException
-org/apache/geode/internal/cache/client/protocol/exception/ServiceVersionNotFoundException
-org/apache/geode/internal/cache/operations/ContainsKeyOperationContext
 org/apache/geode/security/ResourcePermission
 org/apache/geode/security/ResourcePermission$Operation
 org/apache/geode/security/ResourcePermission$Resource
 org/apache/geode/security/ResourcePermission$Target
-org/apache/geode/distributed/internal/tcpserver/LocatorCancelException
-org.apache.geode.internal.security.SecurableCommunicationChannel
-org/apache/geode/internal/security/shiro/GeodeAuthenticationToken
-org/apache/geode/internal/cache/InitialImageOperation$GIITestHook
-org/apache/geode/internal/AvailablePort$Keeper
-org/apache/geode/admin/internal/BackupStatusImpl
-org/apache/geode/management/internal/BackupStatusImpl
-org/apache/geode/pdx/JSONFormatter$states
-org/apache/geode/internal/memcached/Command
-org/apache/geode/internal/memcached/Command$1
-org/apache/geode/internal/memcached/Command$10
-org/apache/geode/internal/memcached/Command$11
-org/apache/geode/internal/memcached/Command$12
-org/apache/geode/internal/memcached/Command$13
-org/apache/geode/internal/memcached/Command$14
-org/apache/geode/internal/memcached/Command$15
-org/apache/geode/internal/memcached/Command$16
-org/apache/geode/internal/memcached/Command$17
-org/apache/geode/internal/memcached/Command$18
-org/apache/geode/internal/memcached/Command$19
-org/apache/geode/internal/memcached/Command$2
-org/apache/geode/internal/memcached/Command$20
-org/apache/geode/internal/memcached/Command$21
-org/apache/geode/internal/memcached/Command$22
-org/apache/geode/internal/memcached/Command$23
-org/apache/geode/internal/memcached/Command$24
-org/apache/geode/internal/memcached/Command$25
-org/apache/geode/internal/memcached/Command$26
-org/apache/geode/internal/memcached/Command$27
-org/apache/geode/internal/memcached/Command$28
-org/apache/geode/internal/memcached/Command$29
-org/apache/geode/internal/memcached/Command$3
-org/apache/geode/internal/memcached/Command$30
-org/apache/geode/internal/memcached/Command$31
-org/apache/geode/internal/memcached/Command$32
-org/apache/geode/internal/memcached/Command$33
-org/apache/geode/internal/memcached/Command$34
-org/apache/geode/internal/memcached/Command$4
-org/apache/geode/internal/memcached/Command$5
-org/apache/geode/internal/memcached/Command$6
-org/apache/geode/internal/memcached/Command$7
-org/apache/geode/internal/memcached/Command$8
-org/apache/geode/internal/memcached/Command$9
-org/apache/geode/redis/internal/RedisCommandType
-org/apache/geode/redis/internal/executor/list/ListExecutor$ListDirection
diff --git a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
index d5e8b78..d3b1207 100644
--- a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
+++ b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedDataSerializables.txt
@@ -2,15 +2,11 @@ org/apache/geode/admin/RegionSubRegionSnapshot,2
 fromData,62,2a2bb80023b500082a2bb900240100b5000b2a2bb80025b500052ab40005b9002601004d2cb9002701009900132cb900280100c000292ab6001ba7ffeab1
 toData,30,2ab400082bb800202b2ab4000bb9002102002ab40005c000032bb80022b1
 
-org/apache/geode/admin/internal/FinishBackupRequest,2
+org/apache/geode/internal/cache/backup/FinishBackupRequest,2
 fromData,33,2a2bb700292a2bb8002ab500022a2bb8002ab500032a2bb8002bb6002cb50004b1
 toData,33,2a2bb7002d2ab400022bb8002e2ab400032bb8002e2ab40004b8002f2bb80030b1
 
-org/apache/geode/admin/internal/FinishBackupResponse,2
-fromData,14,2a2bb700042a2bb80005b50003b1
-toData,14,2a2bb700062ab400032bb80007b1
-
-org/apache/geode/admin/internal/PrepareBackupResponse,2
+org/apache/geode/internal/cache/backup/BackupResponse,2
 fromData,14,2a2bb700042a2bb80005b50003b1
 toData,14,2a2bb700062ab400032bb80007b1
 
diff --git a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
index 37a4224..aa4669e 100755
--- a/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
+++ b/geode-core/src/test/resources/org/apache/geode/codeAnalysis/sanctionedSerializables.txt
@@ -490,8 +490,7 @@ org/apache/geode/management/internal/cli/domain/RegionDescriptionPerMember,true,
 org/apache/geode/management/internal/cli/domain/RegionInformation,true,1,dataPolicy:org/apache/geode/cache/DataPolicy,isRoot:boolean,name:java/lang/String,parentRegion:java/lang/String,path:java/lang/String,scope:org/apache/geode/cache/Scope,subRegionInformationSet:java/util/Set
 org/apache/geode/management/internal/cli/domain/StackTracesPerMember,true,1,memberNameOrId:java/lang/String,stackTraces:byte[]
 org/apache/geode/management/internal/cli/domain/SubscriptionQueueSizeResult,true,1,subscriptionQueueSize:long
-org/apache/geode/management/internal/cli/exceptions/CliException,true,-7603040667204839200
-org/apache/geode/management/internal/cli/exceptions/CreateSubregionException,true,4387344870743824916
+org/apache/geode/management/internal/cli/exceptions/EntityNotFoundException,false,statusOK:boolean
 org/apache/geode/management/internal/cli/exceptions/IndexNotFoundException,true,1,indexName:java/lang/String,message:java/lang/String
 org/apache/geode/management/internal/cli/functions/AlterRuntimeConfigFunction,true,1
 org/apache/geode/management/internal/cli/functions/AsyncEventQueueFunctionArgs,true,-6524494645663740872,asyncEventQueueId:java/lang/String,batchSize:int,batchTimeInterval:int,diskStoreName:java/lang/String,diskSynchronous:boolean,dispatcherThreads:int,enableBatchConflation:boolean,forwardExpirationDestroy:boolean,gatewayEventFilters:java/lang/String[],gatewaySubstitutionFilter:java/lang/String,isParallel:boolean,listenerClassName:java/lang/String,listenerProperties:java/util/Properties, [...]
@@ -520,7 +519,7 @@ org/apache/geode/management/internal/cli/functions/GatewayReceiverCreateFunction
 org/apache/geode/management/internal/cli/functions/GatewayReceiverFunctionArgs,true,-5158224572470173267,bindAddress:java/lang/String,endPort:java/lang/Integer,gatewayTransportFilters:java/lang/String[],hostnameForSenders:java/lang/String,manualStart:java/lang/Boolean,maximumTimeBetweenPings:java/lang/Integer,socketBufferSize:java/lang/Integer,startPort:java/lang/Integer
 org/apache/geode/management/internal/cli/functions/GatewaySenderCreateFunction,true,8746830191680509335
 org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction,true,1
-org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs,true,3848480256348119530,id:java/lang/String
+org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunctionArgs,true,3848480256348119530,id:java/lang/String,ifExists:boolean
 org/apache/geode/management/internal/cli/functions/GatewaySenderFunctionArgs,true,-5158224572470173267,alertThreshold:java/lang/Integer,batchSize:java/lang/Integer,batchTimeInterval:java/lang/Integer,diskStoreName:java/lang/String,diskSynchronous:java/lang/Boolean,dispatcherThreads:java/lang/Integer,enableBatchConflation:java/lang/Boolean,enablePersistence:java/lang/Boolean,gatewayEventFilters:java/lang/String[],gatewayTransportFilters:java/lang/String[],id:java/lang/String,manualStart:j [...]
 org/apache/geode/management/internal/cli/functions/GetMemberConfigInformationFunction,true,1
 org/apache/geode/management/internal/cli/functions/GetMemberInformationFunction,true,1
@@ -563,14 +562,12 @@ org/apache/geode/management/internal/cli/result/TableBuilderHelper$TooManyColumn
 org/apache/geode/management/internal/cli/shell/JMXConnectionException,true,3872374016604940917,exceptionType:int
 org/apache/geode/management/internal/cli/shell/JMXInvocationException,true,-4265451314790394366
 org/apache/geode/management/internal/cli/shell/jline/ANSIHandler$ANSIStyle,false
-org/apache/geode/management/internal/cli/util/DiskStoreNotFoundException,true,-5184836041554948093
 org/apache/geode/management/internal/cli/util/EvictionAttributesInfo,true,1,evictionAction:java/lang/String,evictionAlgorithm:java/lang/String,evictionMaxValue:int
 org/apache/geode/management/internal/cli/util/ExportLogsCacheWriter,false,currentFile:java/nio/file/Path,currentOutputStream:java/io/BufferedOutputStream,isEmpty:boolean
 org/apache/geode/management/internal/cli/util/FixedPartitionAttributesInfo,false,isPrimary:boolean,numBuckets:int,partitionName:java/lang/String
 org/apache/geode/management/internal/cli/util/JConsoleNotFoundException,true,-1485615321440327206
 org/apache/geode/management/internal/cli/util/LogFilter$LineFilterResult,false
 org/apache/geode/management/internal/cli/util/MemberInformation,true,1,cacheXmlFilePath:java/lang/String,cpuUsage:java/lang/String,groups:java/lang/String,heapUsage:java/lang/String,host:java/lang/String,id:java/lang/String,initHeapSize:java/lang/String,locatorBindAddress:java/lang/String,locatorPort:int,locators:java/lang/String,logFilePath:java/lang/String,maxHeapSize:java/lang/String,name:java/lang/String,processId:java/lang/String,serverBindAddress:java/lang/String,statArchiveFilePat [...]
-org/apache/geode/management/internal/cli/util/MemberNotFoundException,true,5686788909239181174
 org/apache/geode/management/internal/cli/util/VisualVmNotFoundException,true,-8491645604829510102
 org/apache/geode/management/internal/configuration/domain/SharedConfigurationStatus,false
 org/apache/geode/management/internal/configuration/functions/GetRegionNamesFunction,false
diff --git a/geode-core/src/test/resources/org/apache/geode/internal/cache/BackupJUnitTest.cache.xml b/geode-core/src/test/resources/org/apache/geode/internal/cache/backup/BackupIntegrationTest.cache.xml
similarity index 100%
rename from geode-core/src/test/resources/org/apache/geode/internal/cache/BackupJUnitTest.cache.xml
rename to geode-core/src/test/resources/org/apache/geode/internal/cache/backup/BackupIntegrationTest.cache.xml
diff --git a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties
index eb0a719..8199dbf 100644
--- a/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties
+++ b/geode-core/src/test/resources/org/apache/geode/management/internal/cli/commands/golden-help-offline.properties
@@ -2257,10 +2257,12 @@ PARAMETERS\n\
 \ \ \ \ categories\n\
 \ \ \ \ \ \ \ \ Categories available based upon the parameters specified are:\n\
 \ \ \ \ \ \ \ \ - no parameters specified: cluster, cache, diskstore, query\n\
-\ \ \ \ \ \ \ \ - region specified: cluster, region, partition, diskstore, callback, eviction\n\
-\ \ \ \ \ \ \ \ - member specified: member, jvm, region, serialization, communication, function,\n\
-\ \ \ \ \ \ \ \ transaction, diskstore, lock, eviction, distribution, offheap\n\
-\ \ \ \ \ \ \ \ - member and region specified: region, partition, diskstore, callback, eviction\n\
+\ \ \ \ \ \ \ \ - region specified: callback, cluster, diskstore, eviction, partition, region\n\
+\ \ \ \ \ \ \ \ - member specified: communication, diskstore, distribution, eviction, function, jvm, lock, member,\n\
+\ \ \ \ \ \ \ \ offheap, region, serialization, transaction\n\
+\ \ \ \ \ \ \ \ - member and port specified: cacheserver, communication, diskstore, distribution, eviction, function,\n\
+\ \ \ \ \ \ \ \ jvm, lock, member, notification, offheap, query, region, serialization, transaction\n\
+\ \ \ \ \ \ \ \ - member and region specified: callback, diskstore, eviction, partition, region\n\
 \ \ \ \ \ \ \ \ Required: false\n\
 
 show-missing-disk-stores.help=\
diff --git a/geode-docs/getting_started/system_requirements/host_machine.html.md.erb b/geode-docs/getting_started/system_requirements/host_machine.html.md.erb
index 787e896..1e26fef 100644
--- a/geode-docs/getting_started/system_requirements/host_machine.html.md.erb
+++ b/geode-docs/getting_started/system_requirements/host_machine.html.md.erb
@@ -30,10 +30,11 @@ Each machine that will run <%=vars.product_name_long%> must meet the following r
     -   Aggregate product-level and application-level time statistics. 
     -   Accurate monitoring of the Geode system with scripts and other tools that read the system statistics and log files.
 -   The host name and host files are properly configured for the machine. The host name and host file configuration can affect `gfsh` and Pulse functionality.
--   Many default Linux installations use SYN cookies to protect the 
-system against malicious attacks that flood TCP SYN packets.
-The use of SYN cookies dramatically reduces network bandwidth,
-and can be triggered by a running distributed system.
+-   Disable TCP SYN cookies. Most default Linux installations use SYN cookies to protect the 
+system against malicious attacks that flood TCP SYN packets, but this feature 
+is not compatible with stable and busy <%=vars.product_name%> clusters. 
+Security implementations should instead seek to prevent attacks by placing <%=vars.product_name%> 
+server clusters behind advanced firewall protection.
 
     To disable SYN cookies permanently:
     1. Edit the `/etc/sysctl.conf` file to include the following line:
@@ -47,3 +48,5 @@ and can be triggered by a running distributed system.
         ``` pre
         sysctl -p
         ```
+
+    See [Disabling TCP SYN Cookies](../../managing/monitor_tune/disabling_tcp_syn_cookies.html) for details.
\ No newline at end of file
diff --git a/geode-docs/managing/monitor_tune/chapter_overview.html.md.erb b/geode-docs/managing/monitor_tune/chapter_overview.html.md.erb
index 8f7e921..af2c485 100644
--- a/geode-docs/managing/monitor_tune/chapter_overview.html.md.erb
+++ b/geode-docs/managing/monitor_tune/chapter_overview.html.md.erb
@@ -21,6 +21,10 @@ limitations under the License.
 
 A collection of tools and controls allow you to monitor and adjust <%=vars.product_name_long%> performance.
 
+-   **[Disabling TCP SYN Cookies](disabling_tcp_syn_cookies.html)**
+
+    This is a must-do for Linux systems.
+
 -   **[Improving Performance on vSphere](performance_on_vsphere.html)**
 
     This topic provides guidelines for tuning vSphere virtualized environments that host <%=vars.product_name_long%> deployments.
diff --git a/geode-docs/managing/monitor_tune/disabling_tcp_syn_cookies.html.md.erb b/geode-docs/managing/monitor_tune/disabling_tcp_syn_cookies.html.md.erb
new file mode 100644
index 0000000..58b3e01
--- /dev/null
+++ b/geode-docs/managing/monitor_tune/disabling_tcp_syn_cookies.html.md.erb
@@ -0,0 +1,42 @@
+---
+title:  Disable TCP SYN Cookies
+---
+
+<!--
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+Most default Linux installations use SYN cookies to protect the 
+system against malicious attacks (such as DDOS) that flood TCP SYN packets.
+
+This feature is not compatible with stable and busy <%=vars.product_name%> clusters. SYN Cookies protection gets
+incorrectly activated by normal <%=vars.product_name%> traffic, severely limiting bandwidth and new connection
+rates, and destroying SLAs. Security implementations should instead seek to prevent DDOS types of
+attacks by placing <%=vars.product_name%> server clusters behind advanced firewall protection.
+
+To disable SYN cookies permanently:
+
+1. Edit the `/etc/sysctl.conf` file to include the following line:
+
+    ``` pre
+    net.ipv4.tcp_syncookies = 0
+    ```
+    Setting this value to zero disables SYN cookies.
+2. Reload `sysctl.conf`:
+
+    ``` pre
+    sysctl -p
+    ```
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
index ffe891c..926b2d0 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -29,10 +29,8 @@ import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
-import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.execute.Execution;
 import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionInvocationTargetException;
 import org.apache.geode.cache.execute.ResultCollector;
 import org.apache.geode.cache.lucene.internal.cli.functions.LuceneCreateIndexFunction;
 import org.apache.geode.cache.lucene.internal.cli.functions.LuceneDescribeIndexFunction;
@@ -48,6 +46,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.commands.GfshCommand;
+import org.apache.geode.management.internal.cli.exceptions.UserErrorException;
 import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.result.CommandResult;
@@ -56,7 +55,6 @@ import org.apache.geode.management.internal.cli.result.ResultBuilder;
 import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
-import org.apache.geode.security.GemFireSecurityException;
 import org.apache.geode.security.ResourcePermission.Operation;
 import org.apache.geode.security.ResourcePermission.Resource;
 
@@ -88,26 +86,12 @@ public class LuceneIndexCommands implements GfshCommand {
       help = LuceneCliStrings.LUCENE_LIST_INDEX__STATS__HELP) final boolean stats) {
 
     getSecurityService().authorize(Resource.CLUSTER, Operation.READ, LucenePermission.TARGET);
-
-    try {
-      return toTabularResult(getIndexListing(), stats);
-    } catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings.format(
-          CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, LuceneCliStrings.LUCENE_LIST_INDEX));
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      getCache().getLogger().info(t);
-      return ResultBuilder.createGemFireErrorResult(String
-          .format(LuceneCliStrings.LUCENE_LIST_INDEX__ERROR_MESSAGE, toString(t, isDebugging())));
-    }
+    return toTabularResult(getIndexListing(), stats);
   }
 
   @SuppressWarnings("unchecked")
   protected List<LuceneIndexDetails> getIndexListing() {
-    final Execution functionExecutor = getMembersFunctionExecutor(getMembers(getCache()));
+    final Execution functionExecutor = getMembersFunctionExecutor(getAllMembers(getCache()));
 
     if (functionExecutor instanceof AbstractExecution) {
       ((AbstractExecution) functionExecutor).setIgnoreDepartedMembers(true);
@@ -230,27 +214,12 @@ public class LuceneIndexCommands implements GfshCommand {
 
       @CliOption(key = LuceneCliStrings.LUCENE__REGION_PATH, mandatory = true,
           optionContext = ConverterHint.REGION_PATH,
-          help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__REGION_HELP) final String regionPath) {
+          help = LuceneCliStrings.LUCENE_DESCRIBE_INDEX__REGION_HELP) final String regionPath)
+      throws Exception {
 
     getSecurityService().authorize(Resource.CLUSTER, Operation.READ, LucenePermission.TARGET);
-
-    try {
-      LuceneIndexInfo indexInfo = new LuceneIndexInfo(indexName, regionPath);
-      return toTabularResult(getIndexDetails(indexInfo), true);
-    } catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings.format(
-          CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, LuceneCliStrings.LUCENE_DESCRIBE_INDEX));
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (IllegalArgumentException e) {
-      return ResultBuilder.createInfoResult(e.getMessage());
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      getCache().getLogger().info(t);
-      return ResultBuilder.createGemFireErrorResult(String.format(
-          LuceneCliStrings.LUCENE_DESCRIBE_INDEX__ERROR_MESSAGE, toString(t, isDebugging())));
-    }
+    LuceneIndexInfo indexInfo = new LuceneIndexInfo(indexName, regionPath);
+    return toTabularResult(getIndexDetails(indexInfo), true);
   }
 
   @SuppressWarnings("unchecked")
@@ -288,32 +257,15 @@ public class LuceneIndexCommands implements GfshCommand {
 
       @CliOption(key = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY,
           unspecifiedDefaultValue = "false",
-          help = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY__HELP) boolean keysOnly) {
-
+          help = LuceneCliStrings.LUCENE_SEARCH_INDEX__KEYSONLY__HELP) boolean keysOnly)
+      throws Exception {
     getSecurityService().authorize(Resource.DATA, Operation.READ, regionPath);
+    LuceneQueryInfo queryInfo =
+        new LuceneQueryInfo(indexName, regionPath, queryString, defaultField, limit, keysOnly);
+    int pageSize = Integer.MAX_VALUE;
+    searchResults = getSearchResults(queryInfo);
+    return displayResults(pageSize, keysOnly);
 
-    try {
-      LuceneQueryInfo queryInfo =
-          new LuceneQueryInfo(indexName, regionPath, queryString, defaultField, limit, keysOnly);
-      int pageSize = Integer.MAX_VALUE;
-      searchResults = getSearchResults(queryInfo);
-      return displayResults(pageSize, keysOnly);
-    } catch (FunctionInvocationTargetException ignore) {
-      return ResultBuilder.createGemFireErrorResult(CliStrings.format(
-          CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, LuceneCliStrings.LUCENE_SEARCH_INDEX));
-    } catch (VirtualMachineError e) {
-      SystemFailure.initiateFailure(e);
-      throw e;
-    } catch (IllegalArgumentException e) {
-      return ResultBuilder.createInfoResult(e.getMessage());
-    } catch (GemFireSecurityException e) {
-      throw e;
-    } catch (Throwable t) {
-      SystemFailure.checkFailure();
-      getCache().getLogger().info(t);
-      return ResultBuilder.createGemFireErrorResult(String
-          .format(LuceneCliStrings.LUCENE_SEARCH_INDEX__ERROR_MESSAGE, toString(t, isDebugging())));
-    }
   }
 
   @CliCommand(value = LuceneCliStrings.LUCENE_DESTROY_INDEX,
@@ -365,8 +317,8 @@ public class LuceneIndexCommands implements GfshCommand {
     // the index has been created, but not the region
     XmlEntity xmlEntity = null;
     InternalCache cache = getCache();
-    Set<DistributedMember> regionMembers = getRegionMembers(cache, regionPath);
-    Set<DistributedMember> normalMembers = getNormalMembers(cache);
+    Set<DistributedMember> regionMembers = findMembersForRegion(cache, regionPath);
+    Set<DistributedMember> normalMembers = getAllNormalMembers(cache);
     LuceneDestroyIndexInfo indexInfo = new LuceneDestroyIndexInfo(indexName, regionPath);
     ResultCollector<?, ?> rc;
     if (regionMembers.isEmpty()) {
@@ -403,14 +355,6 @@ public class LuceneIndexCommands implements GfshCommand {
     return xmlEntity;
   }
 
-  protected Set<DistributedMember> getRegionMembers(InternalCache cache, String regionPath) {
-    return CliUtil.getMembersForeRegionViaFunction(cache, regionPath, true);
-  }
-
-  protected Set<DistributedMember> getNormalMembers(InternalCache cache) {
-    return CliUtil.getAllNormalMembers(cache);
-  }
-
   private Result getDestroyIndexResult(List<CliFunctionResult> cliFunctionResults, String indexName,
       String regionPath) {
     final TabularResultData tabularResult = ResultBuilder.createTabularResultData();
@@ -534,7 +478,7 @@ public class LuceneIndexCommands implements GfshCommand {
           data.accumulate("score", searchResults.get(i).getScore());
         }
       } else {
-        throw new Exception(searchResults.get(i).getExceptionMessage());
+        throw new UserErrorException(searchResults.get(i).getExceptionMessage());
       }
     }
     return ResultBuilder.buildResult(data);
@@ -553,21 +497,16 @@ public class LuceneIndexCommands implements GfshCommand {
 
   protected ResultCollector<?, ?> executeFunctionOnRegion(Function function,
       LuceneFunctionSerializable functionArguments, boolean returnAllMembers) {
-    Set<DistributedMember> targetMembers = CliUtil.getMembersForeRegionViaFunction(getCache(),
-        functionArguments.getRegionPath(), returnAllMembers);
+    Set<DistributedMember> targetMembers = CliUtil.getRegionAssociatedMembers(
+        functionArguments.getRegionPath(), getCache(), returnAllMembers);
     if (targetMembers.isEmpty()) {
-      throw new IllegalArgumentException(CliStrings.format(
+      throw new UserErrorException(CliStrings.format(
           LuceneCliStrings.LUCENE_DESTROY_INDEX__MSG__COULDNOT_FIND_MEMBERS_FOR_REGION_0,
           new Object[] {functionArguments.getRegionPath()}));
     }
     return executeFunction(function, functionArguments, targetMembers);
   }
 
-  protected ResultCollector<?, ?> executeFunction(Function function,
-      LuceneFunctionSerializable functionArguments, Set<DistributedMember> targetMembers) {
-    return CliUtil.executeFunction(function, functionArguments, targetMembers);
-  }
-
   @CliAvailabilityIndicator({LuceneCliStrings.LUCENE_SEARCH_INDEX,
       LuceneCliStrings.LUCENE_CREATE_INDEX, LuceneCliStrings.LUCENE_DESCRIBE_INDEX,
       LuceneCliStrings.LUCENE_LIST_INDEX, LuceneCliStrings.LUCENE_DESTROY_INDEX})
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneCommandsSecurityDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneCommandsSecurityDUnitTest.java
index 8de5ea1..0606b10 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneCommandsSecurityDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneCommandsSecurityDUnitTest.java
@@ -44,7 +44,7 @@ import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category({DistributedTest.class, SecurityTest.class})
 @RunWith(JUnitParamsRunner.class)
@@ -54,7 +54,7 @@ public class LuceneCommandsSecurityDUnitTest {
   public LocatorServerStartupRule locatorServer = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfshShell = new GfshShellConnectionRule();
+  public GfshCommandRule gfshShell = new GfshCommandRule();
 
   private MemberVM locator;
 
@@ -84,8 +84,8 @@ public class LuceneCommandsSecurityDUnitTest {
   @Parameters(method = "getCreateIndexUserNameAndExpectedResponses")
   public void verifyCreateIndexPermissions(UserNameAndExpectedResponse user) throws Exception {
     // Connect gfsh
-    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
-        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(), GfshCommandRule.PortType.locator,
+        user.getUserName(), user.getUserName());
 
     // Attempt to create lucene index
     CommandResult result = this.gfshShell.executeCommand(getCreateIndexCommand());
@@ -108,8 +108,8 @@ public class LuceneCommandsSecurityDUnitTest {
     createIndexAndRegion();
 
     // Connect gfsh
-    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
-        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(), GfshCommandRule.PortType.locator,
+        user.getUserName(), user.getUserName());
 
     // Attempt to search lucene index
     CommandResult result = this.gfshShell.executeCommand(getSearchIndexCommand());
@@ -132,8 +132,8 @@ public class LuceneCommandsSecurityDUnitTest {
     createIndexAndRegion();
 
     // Connect gfsh
-    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
-        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(), GfshCommandRule.PortType.locator,
+        user.getUserName(), user.getUserName());
 
     // Attempt to search lucene index
     CommandResult result = this.gfshShell.executeCommand(getListIndexesCommand());
@@ -156,8 +156,8 @@ public class LuceneCommandsSecurityDUnitTest {
     createIndexAndRegion();
 
     // Connect gfsh
-    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
-        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(), GfshCommandRule.PortType.locator,
+        user.getUserName(), user.getUserName());
 
     // Attempt to search lucene index
     CommandResult result = this.gfshShell.executeCommand(getDescribeIndexCommand());
@@ -181,8 +181,8 @@ public class LuceneCommandsSecurityDUnitTest {
     createIndexAndRegion();
 
     // Connect gfsh
-    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
-        GfshShellConnectionRule.PortType.locator, user.getUserName(), user.getUserName());
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(), GfshCommandRule.PortType.locator,
+        user.getUserName(), user.getUserName());
 
     // Attempt to search lucene index
     CommandResult result = this.gfshShell.executeCommand(getDestroyIndexCommand());
@@ -193,8 +193,8 @@ public class LuceneCommandsSecurityDUnitTest {
 
   private void createIndexAndRegion() throws Exception {
     // Connect gfsh to locator with permissions necessary to create an index and region
-    this.gfshShell.secureConnectAndVerify(this.locator.getPort(),
-        GfshShellConnectionRule.PortType.locator, "cluster,data", "cluster,data");
+    this.gfshShell.secureConnectAndVerify(this.locator.getPort(), GfshCommandRule.PortType.locator,
+        "cluster,data", "cluster,data");
 
     // Create lucene index
     this.gfshShell.executeAndAssertThat(getCreateIndexCommand()).statusIsSuccess();
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java
index 2aa3804..64c9ec0 100755
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsDUnitTest.java
@@ -59,9 +59,9 @@ import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
-import org.apache.geode.test.junit.assertions.GfshShellConnectionRuleAssert;
+import org.apache.geode.test.junit.assertions.CommandResultAssert;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
 
 @Category(DistributedTest.class)
@@ -70,7 +70,7 @@ import org.apache.geode.test.junit.rules.serializable.SerializableTestName;
 public class LuceneIndexCommandsDUnitTest implements Serializable {
 
   @Rule
-  public transient GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public transient GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public LocatorServerStartupRule startupRule = new LocatorServerStartupRule();
@@ -88,7 +88,7 @@ public class LuceneIndexCommandsDUnitTest implements Serializable {
   }
 
   public void connect(MemberVM serverVM) throws Exception {
-    gfsh.connectAndVerify(serverVM.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(serverVM.getJmxPort(), GfshCommandRule.PortType.jmxManager);
   }
 
   @Test
@@ -416,7 +416,7 @@ public class LuceneIndexCommandsDUnitTest implements Serializable {
     CommandStringBuilder csb = new CommandStringBuilder(LuceneCliStrings.LUCENE_DESCRIBE_INDEX);
     csb.addOption(LuceneCliStrings.LUCENE__INDEX_NAME, "notAnIndex");
     csb.addOption(LuceneCliStrings.LUCENE__REGION_PATH, REGION_NAME);
-    gfsh.executeAndAssertThat(csb.toString()).statusIsSuccess().containsOutput(REGION_NAME);
+    gfsh.executeAndAssertThat(csb.toString()).statusIsError().containsOutput(REGION_NAME);
   }
 
   @Test
@@ -461,8 +461,7 @@ public class LuceneIndexCommandsDUnitTest implements Serializable {
     csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__QUERY_STRING, "field1:jon~");
     csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD, "field1");
 
-    GfshShellConnectionRuleAssert assertion =
-        gfsh.executeAndAssertThat(csb.toString()).statusIsSuccess();
+    CommandResultAssert assertion = gfsh.executeAndAssertThat(csb.toString()).statusIsSuccess();
 
     try {
       assertion.tableHasColumnWithExactValuesInExactOrder("key", "A", "B", "C", "D");
@@ -554,7 +553,7 @@ public class LuceneIndexCommandsDUnitTest implements Serializable {
     csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__QUERY_STRING, "EFG");
     csb.addOption(LuceneCliStrings.LUCENE_SEARCH_INDEX__DEFAULT_FIELD, "field2");
 
-    gfsh.executeAndAssertThat(csb.toString()).statusIsSuccess()
+    gfsh.executeAndAssertThat(csb.toString()).statusIsError()
         .containsOutput(getRegionNotFoundErrorMessage("/region"));
   }
 
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
index d73bfc5..48fdde1 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommandsJUnitTest.java
@@ -447,8 +447,8 @@ public class LuceneIndexCommandsJUnitTest {
         isA(LuceneDestroyIndexFunction.class), any(LuceneDestroyIndexInfo.class), any(Set.class));
     doReturn(cliFunctionResults).when(mockResultCollector).getResult();
 
-    doReturn(Collections.emptySet()).when(commands).getNormalMembers(any());
-    doReturn(Collections.emptySet()).when(commands).getRegionMembers(any(), any());
+    doReturn(Collections.emptySet()).when(commands).getAllNormalMembers(any());
+    doReturn(Collections.emptySet()).when(commands).findMembersForRegion(any(), any());
 
     CommandResult result = (CommandResult) commands.destroyIndex(indexName, regionPath);
     verifyDestroyIndexCommandResult(result, cliFunctionResults, expectedStatus);
@@ -484,8 +484,8 @@ public class LuceneIndexCommandsJUnitTest {
         isA(LuceneDestroyIndexFunction.class), any(LuceneDestroyIndexInfo.class), any(Set.class));
     doReturn(cliFunctionResults).when(mockResultCollector).getResult();
 
-    doReturn(members).when(commands).getNormalMembers(any());
-    doReturn(members).when(commands).getRegionMembers(any(), any());
+    doReturn(members).when(commands).getAllNormalMembers(any());
+    doReturn(members).when(commands).findMembersForRegion(any(), any());
 
     CommandResult result = (CommandResult) commands.destroyIndex(indexName, regionPath);
     verifyDestroyIndexCommandResult(result, cliFunctionResults, expectedStatus);
@@ -516,8 +516,8 @@ public class LuceneIndexCommandsJUnitTest {
         isA(LuceneDestroyIndexFunction.class), any(LuceneDestroyIndexInfo.class), any(Set.class));
     doReturn(cliFunctionResults).when(mockResultCollector).getResult();
 
-    doReturn(Collections.emptySet()).when(commands).getNormalMembers(any());
-    doReturn(Collections.emptySet()).when(commands).getRegionMembers(any(), any());
+    doReturn(Collections.emptySet()).when(commands).getAllNormalMembers(any());
+    doReturn(Collections.emptySet()).when(commands).findMembersForRegion(any(), any());
 
     CommandResult result = (CommandResult) commands.destroyIndex(indexName, regionPath);
     verifyDestroyIndexCommandResult(result, cliFunctionResults, expectedStatus);
@@ -553,8 +553,8 @@ public class LuceneIndexCommandsJUnitTest {
         isA(LuceneDestroyIndexFunction.class), any(LuceneDestroyIndexInfo.class), any(Set.class));
     doReturn(cliFunctionResults).when(mockResultCollector).getResult();
 
-    doReturn(Collections.emptySet()).when(commands).getNormalMembers(any());
-    doReturn(Collections.emptySet()).when(commands).getRegionMembers(any(), any());
+    doReturn(Collections.emptySet()).when(commands).getAllNormalMembers(any());
+    doReturn(Collections.emptySet()).when(commands).findMembersForRegion(any(), any());
 
     CommandResult result = (CommandResult) commands.destroyIndex(indexName, regionPath);
     verifyDestroyIndexCommandResult(result, cliFunctionResults, expectedStatus);
@@ -664,7 +664,7 @@ public class LuceneIndexCommandsJUnitTest {
     }
 
     @Override
-    public Set<DistributedMember> getMembers(final InternalCache cache) {
+    public Set<DistributedMember> getAllMembers(final InternalCache cache) {
       assertSame(getCache(), cache);
       return Collections.emptySet();
     }
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
index 0c0f8ff..e7189e4 100755
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/configuration/LuceneClusterConfigurationDUnitTest.java
@@ -48,7 +48,7 @@ import org.apache.geode.test.dunit.SerializableRunnableIF;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 
 @Category(DistributedTest.class)
@@ -58,7 +58,7 @@ public class LuceneClusterConfigurationDUnitTest {
   public LocatorServerStartupRule ls = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfshConnector = new GfshShellConnectionRule();
+  public GfshCommandRule gfshConnector = new GfshCommandRule();
 
   private MemberVM locator = null;
 
diff --git a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java
index 5fec88e..a1fa3ce 100644
--- a/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java
+++ b/geode-pulse/src/main/java/org/apache/geode/tools/pulse/internal/security/LogoutHandler.java
@@ -41,13 +41,12 @@ public class LogoutHandler extends SimpleUrlLogoutSuccessHandler implements Logo
 
   public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response,
       Authentication authentication) throws IOException, ServletException {
-    logger.debug("Invoked #LogoutHandler ...");
-    GemFireAuthentication gemauthentication = (GemFireAuthentication) authentication;
-    if (gemauthentication != null) {
-      Repository.get().logoutUser(gemauthentication.getName());
-      logger.info("#LogoutHandler : Closing GemFireAuthentication JMX Connection...");
+
+    if (authentication != null) {
+      Repository.get().logoutUser(authentication.getName());
+      logger.info("#LogoutHandler: GemFireAuthentication JMX Connection Closed.");
     }
+
     super.onLogoutSuccess(request, response, authentication);
   }
-
 }
diff --git a/geode-pulse/src/test/java/org/apache/geode/tools/pulse/internal/security/LogoutHandlerUnitTest.java b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/internal/security/LogoutHandlerUnitTest.java
new file mode 100644
index 0000000..b1b4a80
--- /dev/null
+++ b/geode-pulse/src/test/java/org/apache/geode/tools/pulse/internal/security/LogoutHandlerUnitTest.java
@@ -0,0 +1,103 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more contributor license
+ * agreements. See the NOTICE file distributed with this work for additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
+ * or implied. See the License for the specific language governing permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.tools.pulse.internal.security;
+
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.powermock.api.mockito.PowerMockito.spy;
+import static org.powermock.api.mockito.PowerMockito.when;
+
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+import org.mockito.Mockito;
+import org.powermock.core.classloader.annotations.PowerMockIgnore;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.powermock.modules.junit4.PowerMockRunnerDelegate;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.security.core.Authentication;
+
+import org.apache.geode.test.junit.categories.UnitTest;
+import org.apache.geode.tools.pulse.internal.data.Cluster;
+import org.apache.geode.tools.pulse.internal.data.Repository;
+
+@Category(UnitTest.class)
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(Repository.class)
+@PowerMockRunnerDelegate(Parameterized.class)
+@PowerMockIgnore({"javax.management.*", "javax.security.*", "*.UnitTest"})
+public class LogoutHandlerUnitTest {
+  private Repository repository;
+  private LogoutHandler handler;
+  private static String mockUser = "admin";
+
+  @Parameterized.Parameter
+  public static Authentication authentication;
+
+  @Parameterized.Parameters(name = "{0}")
+  public static Collection<Authentication> authentications() throws Exception {
+    Authentication defaultAuthentication = mock(Authentication.class, "Default Authentication");
+    when(defaultAuthentication.getName()).thenReturn(mockUser);
+
+    GemFireAuthentication gemfireAuthentication =
+        mock(GemFireAuthentication.class, "GemFire Authentication");
+    when(gemfireAuthentication.getName()).thenReturn(mockUser);
+
+    return Arrays.asList(new Authentication[] {defaultAuthentication, gemfireAuthentication});
+  }
+
+  @Before
+  public void setup() throws Exception {
+    Cluster cluster = Mockito.spy(Cluster.class);
+    repository = Mockito.spy(Repository.class);
+    spy(Repository.class);
+    when(Repository.class, "get").thenReturn(repository);
+    doReturn(cluster).when(repository).getCluster();
+    handler = new LogoutHandler("/defaultTargetUrl");
+  }
+
+  @Test
+  public void testNullAuthentication() throws Exception {
+    MockHttpServletRequest request = new MockHttpServletRequest();
+    MockHttpServletResponse response = new MockHttpServletResponse();
+
+    handler.onLogoutSuccess(request, response, null);
+
+    assertThat(response.getStatus()).isEqualTo(302);
+    assertThat(response.getHeader("Location")).isEqualTo("/defaultTargetUrl");
+  }
+
+  @Test
+  public void testNotNullAuthentication() throws Exception {
+    MockHttpServletRequest request = new MockHttpServletRequest();
+    MockHttpServletResponse response = new MockHttpServletResponse();
+
+    handler.onLogoutSuccess(request, response, authentication);
+
+    assertThat(response.getStatus()).isEqualTo(302);
+    assertThat(response.getHeader("Location")).isEqualTo("/defaultTargetUrl");
+    verify(repository, Mockito.times(1)).logoutUser(mockUser);
+  }
+}
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateAndDestroyGatewaySenderCommandsDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateAndDestroyGatewaySenderCommandsDUnitTest.java
index 0594dd3..613b620 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateAndDestroyGatewaySenderCommandsDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateAndDestroyGatewaySenderCommandsDUnitTest.java
@@ -46,7 +46,7 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class CreateAndDestroyGatewaySenderCommandsDUnitTest {
@@ -55,7 +55,7 @@ public class CreateAndDestroyGatewaySenderCommandsDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
index 287f9ea..d8d7fde 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewayReceiverCommandDUnitTest.java
@@ -49,7 +49,7 @@ import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 /**
  * DUnit tests for 'create gateway-receiver' command.
@@ -63,7 +63,7 @@ public class CreateGatewayReceiverCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewaySenderCommandDUnitTest.java
index 21a89e5..61b7891 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewaySenderCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/CreateGatewaySenderCommandDUnitTest.java
@@ -40,7 +40,7 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class CreateGatewaySenderCommandDUnitTest {
@@ -49,7 +49,7 @@ public class CreateGatewaySenderCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/DestroyGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/DestroyGatewaySenderCommandDUnitTest.java
index 5166bc7..3980d92 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/DestroyGatewaySenderCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/DestroyGatewaySenderCommandDUnitTest.java
@@ -16,13 +16,7 @@
 package org.apache.geode.internal.cache.wan.wancommand;
 
 import static org.apache.geode.distributed.ConfigurationProperties.DISTRIBUTED_SYSTEM_ID;
-import static org.apache.geode.distributed.ConfigurationProperties.REMOTE_LOCATORS;
-import static org.apache.geode.test.dunit.LogWriterUtils.getLogWriter;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
 
-import java.util.List;
 import java.util.Properties;
 
 import org.junit.Before;
@@ -30,15 +24,10 @@ import org.junit.Rule;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CommandResult;
-import org.apache.geode.management.internal.cli.result.TabularResultData;
-import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class DestroyGatewaySenderCommandDUnitTest {
@@ -47,63 +36,25 @@ public class DestroyGatewaySenderCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
-  private MemberVM locatorSite1;
-  private MemberVM locatorSite2;
-  private MemberVM server1;
-  private MemberVM server2;
-  private MemberVM server3;
+  private MemberVM locator;
 
   @Before
   public void before() throws Exception {
     Properties props = new Properties();
     props.setProperty(DISTRIBUTED_SYSTEM_ID, "" + 1);
-    locatorSite1 = locatorServerStartupRule.startLocatorVM(1, props);
-
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "" + 2);
-    props.setProperty(REMOTE_LOCATORS, "localhost[" + locatorSite1.getPort() + "]");
-    locatorSite2 = locatorServerStartupRule.startLocatorVM(2, props);
-
-    // Connect Gfsh to locator.
-    gfsh.connectAndVerify(locatorSite1);
+    locator = locatorServerStartupRule.startLocatorVM(0, props);
+    gfsh.connectAndVerify(locator);
   }
 
   @Test
   public void testDestroyGatewaySender_NotCreatedSender() throws Exception {
-    Integer locator1Port = locatorSite1.getPort();
-
-    // setup servers in Site #1
-    server1 = locatorServerStartupRule.startServerVM(3, locator1Port);
-    server2 = locatorServerStartupRule.startServerVM(4, locator1Port);
-    server3 = locatorServerStartupRule.startServerVM(5, locator1Port);
-
-    // Test Destroy Command
-    String command =
-        CliStrings.DESTROY_GATEWAYSENDER + " --" + CliStrings.DESTROY_GATEWAYSENDER__ID + "=ln";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = cmdResult.toString();
-      getLogWriter().info(
-          "testDestroyGatewaySender_NotCreatedSender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.OK, cmdResult.getStatus());
-      TabularResultData resultData = (TabularResultData) cmdResult.getResultData();
-      List<String> status = resultData.retrieveAllValues("Status");
-      assertEquals(3, status.size());
-      for (String stat : status) {
-        assertTrue("GatewaySender destroy should fail", stat.contains("ERROR:"));
-      }
-    } else {
-      fail("testCreateDestroyParallelGatewaySender failed as did not get CommandResult");
-    }
-  }
+    locatorServerStartupRule.startServerVM(1, locator.getPort());
+    locatorServerStartupRule.startServerVM(2, locator.getPort());
 
-  private CommandResult executeCommandWithIgnoredExceptions(String command) {
-    final IgnoredException ignored = IgnoredException.addIgnoredException("Could not connect");
-    try {
-      return gfsh.executeCommand(command);
-    } finally {
-      ignored.remove();
-    }
+    // destroy a sender that does not exist
+    gfsh.executeAndAssertThat("destroy gateway-sender --id=ln").statusIsError()
+        .tableHasColumnWithValuesContaining("Status", "ERROR", "ERROR");
   }
 }
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/PauseGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/PauseGatewaySenderCommandDUnitTest.java
index dd6dfd2..fa1bf34 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/PauseGatewaySenderCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/PauseGatewaySenderCommandDUnitTest.java
@@ -44,7 +44,7 @@ import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class PauseGatewaySenderCommandDUnitTest {
@@ -53,7 +53,7 @@ public class PauseGatewaySenderCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
@@ -79,29 +79,13 @@ public class PauseGatewaySenderCommandDUnitTest {
 
   @Test
   public void testPauseGatewaySender_ErrorConditions() throws Exception {
-
-    Integer locator1Port = locatorSite1.getPort();
-
-    // setup servers in Site #1
-    server1 = locatorServerStartupRule.startServerVM(3, locator1Port);
-    server2 = locatorServerStartupRule.startServerVM(4, locator1Port);
-    server3 = locatorServerStartupRule.startServerVM(5, locator1Port);
-    server3.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
-
-    final DistributedMember vm1Member = (DistributedMember) server1.invoke(getMemberIdCallable());
+    server1 = locatorServerStartupRule.startServerVM(3, locatorSite1.getPort());
+    final DistributedMember vm1Member = server1.invoke(getMemberIdCallable());
     String command = CliStrings.PAUSE_GATEWAYSENDER + " --" + CliStrings.PAUSE_GATEWAYSENDER__ID
         + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId() + " --" + CliStrings.GROUP
         + "=SenderGroup1";
-    CommandResult cmdResult = gfsh.executeCommand(command);
-
-    if (cmdResult != null) {
-      String strCmdResult = cmdResult.toString();
-      getLogWriter().info("testPauseGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testPauseGatewaySender failed as did not get CommandResult");
-    }
+    gfsh.executeAndAssertThat(command).statusIsError()
+        .containsOutput(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
   }
 
   /**
@@ -120,7 +104,7 @@ public class PauseGatewaySenderCommandDUnitTest {
     server1.invoke(() -> startSender("ln"));
     server1.invoke(() -> verifySenderState("ln", true, false));
 
-    final DistributedMember vm1Member = (DistributedMember) server1.invoke(getMemberIdCallable());
+    final DistributedMember vm1Member = server1.invoke(getMemberIdCallable());
     pause(10000);
     String command = CliStrings.PAUSE_GATEWAYSENDER + " --" + CliStrings.PAUSE_GATEWAYSENDER__ID
         + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId();
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/ResumeGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/ResumeGatewaySenderCommandDUnitTest.java
index 576c846..df19f73 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/ResumeGatewaySenderCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/ResumeGatewaySenderCommandDUnitTest.java
@@ -46,7 +46,7 @@ import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ResumeGatewaySenderCommandDUnitTest {
@@ -55,7 +55,7 @@ public class ResumeGatewaySenderCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
@@ -89,21 +89,12 @@ public class ResumeGatewaySenderCommandDUnitTest {
 
     server1.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
 
-    final DistributedMember vm1Member = (DistributedMember) server1.invoke(getMemberIdCallable());
+    final DistributedMember vm1Member = server1.invoke(getMemberIdCallable());
     String command = CliStrings.RESUME_GATEWAYSENDER + " --" + CliStrings.RESUME_GATEWAYSENDER__ID
         + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId() + " --" + CliStrings.GROUP
         + "=SenderGroup1";
-    CommandResult cmdResult = gfsh.executeCommand(command);
-
-    if (cmdResult != null) {
-      String strCmdResult = cmdResult.toString();
-      getLogWriter()
-          .info("testResumeGatewaySender_ErrorConditions stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testPauseGatewaySender failed as did not get CommandResult");
-    }
+    gfsh.executeAndAssertThat(command).statusIsError()
+        .containsOutput(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
   }
 
   @Test
@@ -262,21 +253,6 @@ public class ResumeGatewaySenderCommandDUnitTest {
 
     Integer locator1Port = locatorSite1.getPort();
 
-    // setup servers in Site #1
-    /*
-     * String group = "SenderGroup1"; Properties props = new Properties(); props.setProperty(GROUPS,
-     * group); server1 = locatorServerStartupRule.startServerVM(3, props, locator1Port); server2 =
-     * locatorServerStartupRule.startServerVM(4, props, locator1Port);
-     *
-     * props.setProperty(GROUPS, "SenderGroup1, SenderGroup2"); server3 =
-     * locatorServerStartupRule.startServerVM(5, props, locator1Port);
-     *
-     * props.setProperty(GROUPS, "SenderGroup2"); server4 =
-     * locatorServerStartupRule.startServerVM(6, props, locator1Port);
-     *
-     * props.setProperty(GROUPS, "SenderGroup3"); server5 =
-     * locatorServerStartupRule.startServerVM(7, props, locator1Port);
-     */
     server1 = startServerWithGroups(3, "SenderGroup1", locator1Port);
     server2 = startServerWithGroups(4, "SenderGroup1", locator1Port);
     server3 = startServerWithGroups(5, "SenderGroup1, SenderGroup2", locator1Port);
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewayReceiverCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewayReceiverCommandDUnitTest.java
index 109a04a..f7e2aa3 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewayReceiverCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewayReceiverCommandDUnitTest.java
@@ -43,7 +43,7 @@ import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class StartGatewayReceiverCommandDUnitTest {
@@ -52,7 +52,7 @@ public class StartGatewayReceiverCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
@@ -91,17 +91,8 @@ public class StartGatewayReceiverCommandDUnitTest {
     final DistributedMember vm1Member = (DistributedMember) server1.invoke(getMemberIdCallable());
     String command = CliStrings.START_GATEWAYRECEIVER + " --" + CliStrings.MEMBER + "="
         + vm1Member.getId() + " --" + CliStrings.GROUP + "=RG1";
-    CommandResult cmdResult = gfsh.executeCommand(command);
-
-    if (cmdResult != null) {
-      String strCmdResult = cmdResult.toString();
-      getLogWriter()
-          .info("testStartGatewayReceiver_ErrorConditions stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testStartGatewayReceiver_ErrorConditions failed as did not get CommandResult");
-    }
+    gfsh.executeAndAssertThat(command).statusIsError()
+        .containsOutput(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
   }
 
   @Test
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewaySenderCommandDUnitTest.java
index f43f38f..a1fa23a 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewaySenderCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StartGatewaySenderCommandDUnitTest.java
@@ -44,7 +44,7 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class StartGatewaySenderCommandDUnitTest {
@@ -53,7 +53,7 @@ public class StartGatewaySenderCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
@@ -95,16 +95,8 @@ public class StartGatewaySenderCommandDUnitTest {
     String command = CliStrings.START_GATEWAYSENDER + " --" + CliStrings.START_GATEWAYSENDER__ID
         + "=ln --" + CliStrings.MEMBER + "=" + vm1Member.getId() + " --" + CliStrings.GROUP
         + "=SenserGroup1";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-
-    if (cmdResult != null) {
-      String strCmdResult = cmdResult.toString();
-      getLogWriter().info("testStartGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testStartGatewaySender failed as did not get CommandResult");
-    }
+    gfsh.executeAndAssertThat(command).statusIsError()
+        .containsOutput(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
   }
 
   @Test
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewayReceiverCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewayReceiverCommandDUnitTest.java
index c863fe2..760405a 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewayReceiverCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewayReceiverCommandDUnitTest.java
@@ -44,7 +44,7 @@ import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class StatusGatewayReceiverCommandDUnitTest {
@@ -53,7 +53,7 @@ public class StatusGatewayReceiverCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewaySenderCommandDUnitTest.java
index d7270400..da9aab7 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewaySenderCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StatusGatewaySenderCommandDUnitTest.java
@@ -44,7 +44,7 @@ import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class StatusGatewaySenderCommandDUnitTest {
@@ -53,7 +53,7 @@ public class StatusGatewaySenderCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java
index edf2aa9..ed6b016 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewayReceiverCommandDUnitTest.java
@@ -44,7 +44,7 @@ import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class StopGatewayReceiverCommandDUnitTest {
@@ -53,7 +53,7 @@ public class StopGatewayReceiverCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
@@ -91,19 +91,11 @@ public class StopGatewayReceiverCommandDUnitTest {
 
     server1.invoke(() -> createReceiver(locator1Port));
 
-    final DistributedMember server1DM = (DistributedMember) server1.invoke(getMemberIdCallable());
+    final DistributedMember server1DM = server1.invoke(getMemberIdCallable());
     String command = CliStrings.STOP_GATEWAYRECEIVER + " --" + CliStrings.MEMBER + "="
         + server1DM.getId() + " --" + CliStrings.GROUP + "=RG1";
-    CommandResult cmdResult = gfsh.executeCommand(command);
-    if (cmdResult != null) {
-      String strCmdResult = cmdResult.toString();
-      getLogWriter()
-          .info("testStopGatewayReceiver_ErrorConditions stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testStopGatewayReceiver_ErrorConditions failed as did not get CommandResult");
-    }
+    gfsh.executeAndAssertThat(command).statusIsError()
+        .containsOutput(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
   }
 
   @Test
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java
index f8ad5f8..1b2174a 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/StopGatewaySenderCommandDUnitTest.java
@@ -45,7 +45,7 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class StopGatewaySenderCommandDUnitTest {
@@ -54,7 +54,7 @@ public class StopGatewaySenderCommandDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
@@ -88,19 +88,12 @@ public class StopGatewaySenderCommandDUnitTest {
 
     server1.invoke(() -> createSender("ln", 2, false, 100, 400, false, false, null, true));
 
-    final DistributedMember server1DM = (DistributedMember) server1.invoke(getMemberIdCallable());
+    final DistributedMember server1DM = server1.invoke(getMemberIdCallable());
     String command = CliStrings.STOP_GATEWAYSENDER + " --" + CliStrings.STOP_GATEWAYSENDER__ID
         + "=ln --" + CliStrings.MEMBER + "=" + server1DM.getId() + " --" + CliStrings.GROUP
         + "=SenderGroup1";
-    CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
-    if (cmdResult != null) {
-      String strCmdResult = cmdResult.toString();
-      getLogWriter().info("testStopGatewaySender stringResult : " + strCmdResult + ">>>>");
-      assertEquals(Result.Status.ERROR, cmdResult.getStatus());
-      assertTrue(strCmdResult.contains(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
-    } else {
-      fail("testStopGatewaySender failed as did not get CommandResult");
-    }
+    gfsh.executeAndAssertThat(command).statusIsError()
+        .containsOutput(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
   }
 
   @Test
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandListDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
index 39c6393..3ab3cf8 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandListDUnitTest.java
@@ -41,7 +41,7 @@ import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class WanCommandListDUnitTest {
@@ -52,7 +52,7 @@ public class WanCommandListDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private MemberVM locatorSite1;
   private MemberVM locatorSite2;
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
index 6c4c0c4..894668d 100644
--- a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigurationIndexWithFromClauseDUnitTest.java
@@ -31,7 +31,7 @@ import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 @RunWith(JUnitParamsRunner.class)
@@ -51,7 +51,7 @@ public class ClusterConfigurationIndexWithFromClauseDUnitTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfshShellConnectionRule = new GfshShellConnectionRule();
+  public GfshCommandRule gfshCommandRule = new GfshCommandRule();
 
   private MemberVM locator = null;
 
@@ -65,12 +65,12 @@ public class ClusterConfigurationIndexWithFromClauseDUnitTest {
   public void indexCreatedWithEntrySetInFromClauseMustPersist(RegionShortcut regionShortcut)
       throws Exception {
     MemberVM vm1 = lsRule.startServerVM(1, locator.getPort());
-    gfshShellConnectionRule.connectAndVerify(locator);
+    gfshCommandRule.connectAndVerify(locator);
     createRegionUsingGfsh(REGION_NAME, regionShortcut, null);
     createIndexUsingGfsh("\"" + REGION_NAME + ".entrySet() z\"", "z.key", INDEX_NAME);
     String serverName = vm1.getName();
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_MEMBER);
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
     lsRule.stopVM(1);
     lsRule.startServerVM(1, locator.getPort());
     verifyIndexRecreated(INDEX_NAME);
@@ -78,8 +78,8 @@ public class ClusterConfigurationIndexWithFromClauseDUnitTest {
 
   private void verifyIndexRecreated(String indexName) throws Exception {
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.LIST_INDEX);
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
-    String resultAsString = gfshShellConnectionRule.getGfshOutput();
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
+    String resultAsString = gfshCommandRule.getGfshOutput();
     assertTrue(resultAsString.contains(indexName));
   }
 
@@ -89,7 +89,7 @@ public class ClusterConfigurationIndexWithFromClauseDUnitTest {
     csb.addOption(CliStrings.CREATE_INDEX__EXPRESSION, expression);
     csb.addOption(CliStrings.CREATE_INDEX__REGION, regionName);
     csb.addOption(CliStrings.CREATE_INDEX__NAME, indexName);
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
   }
 
   private void createRegionUsingGfsh(String regionName, RegionShortcut regionShortCut, String group)
@@ -98,6 +98,6 @@ public class ClusterConfigurationIndexWithFromClauseDUnitTest {
     csb.addOption(CliStrings.CREATE_REGION__REGION, regionName);
     csb.addOption(CliStrings.CREATE_REGION__REGIONSHORTCUT, regionShortCut.name());
     csb.addOptionWithValueCheck(CliStrings.GROUP, group);
-    gfshShellConnectionRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
+    gfshCommandRule.executeAndAssertThat(csb.toString()).statusIsSuccess();
   }
 }
diff --git a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/WANClusterConfigurationDUnitTest.java b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/WANClusterConfigurationDUnitTest.java
index e42573d..63cc212 100644
--- a/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/WANClusterConfigurationDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/management/internal/configuration/WANClusterConfigurationDUnitTest.java
@@ -34,7 +34,7 @@ import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category({DistributedTest.class})
 @SuppressWarnings("serial")
@@ -44,7 +44,7 @@ public class WANClusterConfigurationDUnitTest {
   public LocatorServerStartupRule locatorServerStartupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private static final String REPLICATE_REGION = "ReplicateRegion1";
 
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeCommandDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeCommandDUnitTest.java
index c748b94..081ed72 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeCommandDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeCommandDUnitTest.java
@@ -41,7 +41,7 @@ import org.apache.geode.test.dunit.IgnoredException;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 @RunWith(JUnitParamsRunner.class)
@@ -51,7 +51,7 @@ public class AlterRuntimeCommandDUnitTest {
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -83,9 +83,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server0 = startupRule.startServerAsJmxManager(0, props);
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(server0.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(server0.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(server0.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(server0.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -137,9 +137,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -173,9 +173,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csbSetFileSizeLimit =
@@ -221,9 +221,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -264,9 +264,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_LIMIT = 10;
@@ -314,9 +314,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -352,9 +352,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -382,9 +382,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -423,9 +423,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final String TEST_NAME = "statisticsArchive";
@@ -460,9 +460,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final String TEST_NAME = "statisticsArchive";
@@ -505,9 +505,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final String TEST_NAME = "statisticsArchive";
@@ -549,9 +549,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -585,9 +585,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_RATE = 2000;
@@ -631,9 +631,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_RATE = 2500;
@@ -678,9 +678,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -713,9 +713,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_LIMIT = 10;
@@ -752,9 +752,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_LIMIT = 10;
@@ -799,9 +799,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_LIMIT = 25;
@@ -847,9 +847,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -895,9 +895,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_LIMIT = 10;
@@ -934,9 +934,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_LIMIT = 10;
@@ -981,9 +981,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     final int TEST_LIMIT = 25;
@@ -1029,9 +1029,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -1064,9 +1064,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -1105,9 +1105,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server2 = startupRule.startServerVM(2, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     server2.invoke(() -> {
@@ -1151,9 +1151,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM server1 = startupRule.startServerVM(1, props, locator.getPort());
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     CommandStringBuilder csb = new CommandStringBuilder(CliStrings.ALTER_RUNTIME_CONFIG);
@@ -1182,9 +1182,9 @@ public class AlterRuntimeCommandDUnitTest {
     MemberVM locator = startupRule.startLocatorVM(0);
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     Properties props = new Properties();
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ClusterConfigurationDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ClusterConfigurationDUnitTest.java
index f5ddf62..eda609a 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ClusterConfigurationDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ClusterConfigurationDUnitTest.java
@@ -36,7 +36,7 @@ import org.apache.geode.test.compiler.ClassBuilder;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 @RunWith(Parameterized.class)
@@ -45,7 +45,7 @@ public class ClusterConfigurationDUnitTest {
   public LocatorServerStartupRule startupRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -63,7 +63,7 @@ public class ClusterConfigurationDUnitTest {
   public void testStartServerAndExecuteCommands() throws Exception {
     MemberVM locator = startupRule.startLocatorVM(0);
     if (connectOverHttp) {
-      gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
       gfsh.connectAndVerify(locator);
     }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpTest.java
index 80c60e6..6932124 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpTest.java
@@ -30,7 +30,7 @@ import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.compiler.ClassBuilder;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.ServerStarterRule;
 
 @Category(IntegrationTest.class)
@@ -41,14 +41,14 @@ public class CommandOverHttpTest {
       new ServerStarterRule().withWorkingDir().withLogFile().withJMXManager().withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfshRule = new GfshShellConnectionRule();
+  public GfshCommandRule gfshRule = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
 
   @Before
   public void before() throws Exception {
-    gfshRule.connectAndVerify(server.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    gfshRule.connectAndVerify(server.getHttpPort(), GfshCommandRule.PortType.http);
   }
 
   @Test
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandIntegrationTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandIntegrationTest.java
index 1c7cdcb..23015ce 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandIntegrationTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandIntegrationTest.java
@@ -21,7 +21,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
 @Category(IntegrationTest.class)
@@ -31,7 +31,7 @@ public class ConnectCommandIntegrationTest {
   public static LocatorStarterRule locator = new LocatorStarterRule().withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Test
   public void connectToLocator() throws Exception {
@@ -40,11 +40,11 @@ public class ConnectCommandIntegrationTest {
 
   @Test
   public void connectOverJmx() throws Exception {
-    gfsh.connectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
   }
 
   @Test
   public void connectOverHttp() throws Exception {
-    gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
   }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java
index 0c1744b..74c2b89 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSSLTest.java
@@ -70,7 +70,7 @@ import org.apache.geode.test.dunit.rules.CleanupDUnitVMsRule;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ConnectCommandWithSSLTest {
@@ -169,22 +169,22 @@ public class ConnectCommandWithSSLTest {
   }
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Test
   public void connectWithNoSSL() throws Exception {
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator);
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator);
     assertThat(gfsh.isConnected()).isFalse();
     // should fail at connecting to locator stage
     assertThat(gfsh.getGfshOutput()).doesNotContain("Connecting to Manager at");
     assertThat(gfsh.getGfshOutput())
         .contains("trying to connect a non-SSL-enabled client to an SSL-enabled locator");
 
-    gfsh.connect(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+    gfsh.connect(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     assertThat(gfsh.isConnected()).isFalse();
     assertThat(gfsh.getGfshOutput()).contains("non-JRMP server at remote endpoint");
 
-    gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    gfsh.connect(locator.getHttpPort(), GfshCommandRule.PortType.http);
     assertThat(gfsh.isConnected()).isFalse();
     assertThat(gfsh.getGfshOutput()).contains("Unexpected end of file from server");
   }
@@ -193,18 +193,18 @@ public class ConnectCommandWithSSLTest {
   public void connectWithSSL() throws Exception {
     sslProperties.store(out, null);
 
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "security-properties-file", sslConfigFile.getAbsolutePath());
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator, "security-properties-file",
+        sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isTrue();
     gfsh.disconnect();
 
-    gfsh.connect(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager,
+    gfsh.connect(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager,
         "security-properties-file", sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isTrue();
     gfsh.disconnect();
 
-    gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
-        "security-properties-file", sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
+    gfsh.connect(locator.getHttpPort(), GfshCommandRule.PortType.http, "security-properties-file",
+        sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
     assertThat(gfsh.isConnected()).isTrue();
   }
 
@@ -212,22 +212,22 @@ public class ConnectCommandWithSSLTest {
   public void connectWithJmxSSL() throws Exception {
     jmxSslProperties.store(out, null);
     // can't connect locator
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "security-properties-file", sslConfigFile.getAbsolutePath());
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator, "security-properties-file",
+        sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isFalse();
     assertThat(gfsh.getGfshOutput()).doesNotContain("Connecting to Manager at");
     assertThat(gfsh.getGfshOutput())
         .contains("trying to connect a non-SSL-enabled client to an SSL-enabled locator");
 
     // can connect to jmx
-    gfsh.connect(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager,
+    gfsh.connect(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager,
         "security-properties-file", sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isTrue();
     gfsh.disconnect();
 
     // cannot connect to http
-    gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
-        "security-properties-file", sslConfigFile.getAbsolutePath());
+    gfsh.connect(locator.getHttpPort(), GfshCommandRule.PortType.http, "security-properties-file",
+        sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isFalse();
   }
 
@@ -241,20 +241,20 @@ public class ConnectCommandWithSSLTest {
   public void connectWithClusterSSL() throws Exception {
     clusterSslProperties.store(out, null);
     // can connect to locator and jmx
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "security-properties-file", sslConfigFile.getAbsolutePath());
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator, "security-properties-file",
+        sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isTrue();
     gfsh.disconnect();
 
     // can connect to jmx
-    gfsh.connect(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager,
+    gfsh.connect(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager,
         "security-properties-file", sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isTrue();
     gfsh.disconnect();
 
     // can connect to http
-    gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
-        "security-properties-file", sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
+    gfsh.connect(locator.getHttpPort(), GfshCommandRule.PortType.http, "security-properties-file",
+        sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
     assertThat(gfsh.isConnected()).isTrue();
   }
 
@@ -262,18 +262,18 @@ public class ConnectCommandWithSSLTest {
   public void connectWithHttpSSL() throws Exception {
     httpSslProperties.store(out, null);
     // can connect to locator and jmx
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "security-properties-file", sslConfigFile.getAbsolutePath());
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator, "security-properties-file",
+        sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isFalse();
 
     // cannot connect to jmx
-    gfsh.connect(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager,
+    gfsh.connect(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager,
         "security-properties-file", sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isFalse();
 
     // can connect to http
-    gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
-        "security-properties-file", sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
+    gfsh.connect(locator.getHttpPort(), GfshCommandRule.PortType.http, "security-properties-file",
+        sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
     assertThat(gfsh.isConnected()).isTrue();
   }
 
@@ -281,18 +281,18 @@ public class ConnectCommandWithSSLTest {
   public void connectWithHttpSSLAndSkipSSLValidation() throws Exception {
     httpSslPropertiesSkipValidation.store(out, null);
     // cannot connect to locator and jmx
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "security-properties-file", sslConfigFile.getAbsolutePath());
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator, "security-properties-file",
+        sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isFalse();
 
     // cannot connect to jmx
-    gfsh.connect(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager,
+    gfsh.connect(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager,
         "security-properties-file", sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isFalse();
 
     // can connect to http
-    gfsh.connect(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
-        "security-properties-file", sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
+    gfsh.connect(locator.getHttpPort(), GfshCommandRule.PortType.http, "security-properties-file",
+        sslConfigFile.getAbsolutePath(), "skip-ssl-validation", "true");
     assertThat(gfsh.isConnected()).isTrue();
   }
 
@@ -304,8 +304,8 @@ public class ConnectCommandWithSSLTest {
     combined.store(out, null);
 
     // can connect to both locator and jmx
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "security-properties-file", sslConfigFile.getAbsolutePath());
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator, "security-properties-file",
+        sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isTrue();
   }
 
@@ -315,13 +315,13 @@ public class ConnectCommandWithSSLTest {
     sslProperties.store(out, null);
 
     // can connect to both locator and jmx
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "security-properties-file", sslConfigFile.getAbsolutePath());
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator, "security-properties-file",
+        sslConfigFile.getAbsolutePath());
     assertThat(gfsh.isConnected()).isTrue();
     gfsh.disconnect();
 
     // reconnect again with no SSL should fail
-    gfsh.connect(locator.getPort(), GfshShellConnectionRule.PortType.locator);
+    gfsh.connect(locator.getPort(), GfshCommandRule.PortType.locator);
     assertThat(gfsh.isConnected()).isFalse();
     // it should fail at connecting to locator, not connecting to manager
     assertThat(gfsh.getGfshOutput()).doesNotContain("Connecting to Manager at");
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSecurityTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSecurityTest.java
index b0128a4..628ef1d 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSecurityTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandWithSecurityTest.java
@@ -22,7 +22,7 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.security.SimpleTestSecurityManager;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
 @Category(IntegrationTest.class)
@@ -33,26 +33,26 @@ public class ConnectCommandWithSecurityTest {
       new LocatorStarterRule().withSecurityManager(SimpleTestSecurityManager.class).withAutoStart();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Test
   public void connectToLocator() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getPort(), GfshShellConnectionRule.PortType.locator,
-        "clusterRead", "clusterRead");
+    gfsh.secureConnectAndVerify(locator.getPort(), GfshCommandRule.PortType.locator, "clusterRead",
+        "clusterRead");
     gfsh.executeAndAssertThat("list members").statusIsSuccess();
   }
 
   @Test
   public void connectOverJmx() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager,
+    gfsh.secureConnectAndVerify(locator.getJmxPort(), GfshCommandRule.PortType.jmxManager,
         "clusterRead", "clusterRead");
     gfsh.executeAndAssertThat("list members").statusIsSuccess();
   }
 
   @Test
   public void connectOverHttp() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
-        "clusterRead", "clusterRead");
+    gfsh.secureConnectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http, "clusterRead",
+        "clusterRead");
     gfsh.executeAndAssertThat("list members").statusIsSuccess();
   }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandDUnitTest.java
index 370670b..a3d24ce 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/DescribeConfigCommandDUnitTest.java
@@ -36,7 +36,7 @@ import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 @RunWith(JUnitParamsRunner.class)
@@ -46,7 +46,7 @@ public class DescribeConfigCommandDUnitTest {
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -61,9 +61,9 @@ public class DescribeConfigCommandDUnitTest {
     MemberVM server0 = startupRule.startServerAsJmxManager(0, localProps);
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(server0.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(server0.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(server0.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(server0.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     server0.invoke(() -> {
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommandWithSecurityDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommandWithSecurityDUnitTest.java
index 3b90842..87f3b34 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommandWithSecurityDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExecuteFunctionCommandWithSecurityDUnitTest.java
@@ -17,8 +17,8 @@ package org.apache.geode.management.internal.cli.commands;
 
 import static org.apache.geode.distributed.ConfigurationProperties.SECURITY_MANAGER;
 import static org.apache.geode.management.internal.security.TestFunctions.ReadFunction;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.http;
-import static org.apache.geode.test.junit.rules.GfshShellConnectionRule.PortType.jmxManager;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.http;
+import static org.apache.geode.test.junit.rules.GfshCommandRule.PortType.jmxManager;
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.util.Properties;
@@ -36,7 +36,7 @@ import org.apache.geode.security.SimpleTestSecurityManager;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ExecuteFunctionCommandWithSecurityDUnitTest {
@@ -44,7 +44,7 @@ public class ExecuteFunctionCommandWithSecurityDUnitTest {
   public static LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   private static MemberVM locator;
 
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommandDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommandDUnitTest.java
index a8504de..1ab1fba 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommandDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportConfigCommandDUnitTest.java
@@ -35,7 +35,7 @@ import org.junit.runner.RunWith;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 @RunWith(JUnitParamsRunner.class)
@@ -45,7 +45,7 @@ public class ExportConfigCommandDUnitTest {
       new LocatorServerStartupRule().withTempWorkingDir().withLogFile();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Rule
   public TemporaryFolder temporaryFolder = new TemporaryFolder();
@@ -59,9 +59,9 @@ public class ExportConfigCommandDUnitTest {
     MemberVM server0 = startupRule.startServerAsEmbededLocator(0, props);
 
     if (connectOverHttp) {
-      gfsh.connectAndVerify(server0.getHttpPort(), GfshShellConnectionRule.PortType.http);
+      gfsh.connectAndVerify(server0.getHttpPort(), GfshCommandRule.PortType.http);
     } else {
-      gfsh.connectAndVerify(server0.getJmxPort(), GfshShellConnectionRule.PortType.jmxManager);
+      gfsh.connectAndVerify(server0.getJmxPort(), GfshCommandRule.PortType.jmxManager);
     }
 
     // start server1 and server2 in group2
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java
index 68527e2..63ad379 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsOverHttpIntegrationTest.java
@@ -20,14 +20,14 @@ import java.io.File;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(IntegrationTest.class)
 public class ExportLogsOverHttpIntegrationTest extends ExportLogsIntegrationTest {
 
   @Override
   public void connect() throws Exception {
-    gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
   }
 
   public File getWorkingDirectory() throws Exception {
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsStatsOverHttpDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsStatsOverHttpDUnitTest.java
index 0775259..99793c4 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsStatsOverHttpDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ExportLogsStatsOverHttpDUnitTest.java
@@ -30,7 +30,7 @@ import org.junit.experimental.categories.Category;
 import org.junit.rules.TemporaryFolder;
 
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ExportLogsStatsOverHttpDUnitTest extends ExportLogsStatsDUnitTest {
@@ -41,7 +41,7 @@ public class ExportLogsStatsOverHttpDUnitTest extends ExportLogsStatsDUnitTest {
   @Override
   public void connectIfNeeded() throws Exception {
     if (!connector.isConnected())
-      connector.connect(httpPort, GfshShellConnectionRule.PortType.http);
+      connector.connect(httpPort, GfshCommandRule.PortType.http);
   }
 
   @Test
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/FunctionCommandsOverHttpDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/FunctionCommandsOverHttpDUnitTest.java
index d1aacbb..55285d5 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/FunctionCommandsOverHttpDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/FunctionCommandsOverHttpDUnitTest.java
@@ -19,12 +19,12 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class FunctionCommandsOverHttpDUnitTest extends FunctionCommandsDUnitTest {
   @Override
   public void connectGfsh(MemberVM vm) throws Exception {
-    gfsh.connectAndVerify(vm.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    gfsh.connectAndVerify(vm.getHttpPort(), GfshCommandRule.PortType.http);
   }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandOverHttpTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandOverHttpTest.java
index 64b2707..abe9480 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandOverHttpTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/IndexCommandOverHttpTest.java
@@ -18,13 +18,13 @@ package org.apache.geode.management.internal.cli.commands;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.Server;
 
 @Category(IntegrationTest.class)
 public class IndexCommandOverHttpTest extends IndexCommandsIntegrationTest {
   @Override
   public void connect(Server server) throws Exception {
-    gfsh.connectAndVerify(server.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    gfsh.connectAndVerify(server.getHttpPort(), GfshCommandRule.PortType.http);
   }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandOverHttpDUnitTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandOverHttpDUnitTest.java
index 0c15a52..64fae9a 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandOverHttpDUnitTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/cli/commands/ListIndexCommandOverHttpDUnitTest.java
@@ -19,12 +19,12 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(DistributedTest.class)
 public class ListIndexCommandOverHttpDUnitTest extends ListIndexCommandDUnitTest {
   @Override
   public void connectGfsh(MemberVM vm) throws Exception {
-    gfsh.connectAndVerify(vm.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    gfsh.connectAndVerify(vm.getHttpPort(), GfshCommandRule.PortType.http);
   }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
index 74e9277..2b60a8f 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/security/GfshCommandsOverHttpSecurityTest.java
@@ -19,12 +19,11 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.test.junit.categories.IntegrationTest;
 import org.apache.geode.test.junit.categories.SecurityTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category({IntegrationTest.class, SecurityTest.class})
 public class GfshCommandsOverHttpSecurityTest extends GfshCommandsSecurityTest {
   public GfshCommandsOverHttpSecurityTest() {
-    gfshConnection = new GfshShellConnectionRule(serverStarter::getHttpPort,
-        GfshShellConnectionRule.PortType.http);
+    gfshConnection = new GfshCommandRule(serverStarter::getHttpPort, GfshCommandRule.PortType.http);
   }
 }
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java
index 97f2a96..fa63d07 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/security/LogNoPasswordTest.java
@@ -33,7 +33,7 @@ import org.apache.geode.security.SecurityManager;
 import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 
 @Category(IntegrationTest.class)
 public class LogNoPasswordTest {
@@ -43,7 +43,7 @@ public class LogNoPasswordTest {
   public LocatorServerStartupRule lsRule = new LocatorServerStartupRule().withLogFile();
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Test
   public void testPasswordInLogs() throws Exception {
@@ -51,7 +51,7 @@ public class LogNoPasswordTest {
     properties.setProperty(LOG_LEVEL, "debug");
     properties.setProperty(SECURITY_MANAGER, MySecurityManager.class.getName());
     MemberVM locator = lsRule.startLocatorVM(0, properties);
-    gfsh.secureConnectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http, "any",
+    gfsh.secureConnectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http, "any",
         PASSWORD);
     gfsh.executeAndAssertThat("list members").statusIsSuccess();
 
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/HttpOperationInvokerMBeanOperationTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/HttpOperationInvokerMBeanOperationTest.java
index ab11ddd..71f92f3 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/HttpOperationInvokerMBeanOperationTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/HttpOperationInvokerMBeanOperationTest.java
@@ -34,7 +34,7 @@ import org.junit.experimental.categories.Category;
 import org.apache.geode.management.DistributedSystemMXBean;
 import org.apache.geode.management.internal.ManagementConstants;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
 @Category(IntegrationTest.class)
@@ -46,11 +46,11 @@ public class HttpOperationInvokerMBeanOperationTest {
   private HttpOperationInvoker invoker;
 
   @Rule
-  public GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public GfshCommandRule gfsh = new GfshCommandRule();
 
   @Before
   public void before() throws Exception {
-    gfsh.connectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http);
+    gfsh.connectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http);
     invoker = (HttpOperationInvoker) gfsh.getGfsh().getOperationInvoker();
   }
 
diff --git a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/HttpOperationInvokerSecurityTest.java b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/HttpOperationInvokerSecurityTest.java
index 1a352ed..fef7bbe 100644
--- a/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/HttpOperationInvokerSecurityTest.java
+++ b/geode-web/src/test/java/org/apache/geode/management/internal/web/shell/HttpOperationInvokerSecurityTest.java
@@ -37,7 +37,7 @@ import org.apache.geode.management.internal.cli.CommandRequest;
 import org.apache.geode.security.NotAuthorizedException;
 import org.apache.geode.security.SimpleTestSecurityManager;
 import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.rules.GfshShellConnectionRule;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
 import org.apache.geode.test.junit.rules.LocatorStarterRule;
 
 @Category(IntegrationTest.class)
@@ -48,15 +48,15 @@ public class HttpOperationInvokerSecurityTest {
       new LocatorStarterRule().withSecurityManager(SimpleTestSecurityManager.class).withAutoStart();
 
   @ClassRule
-  public static GfshShellConnectionRule gfsh = new GfshShellConnectionRule();
+  public static GfshCommandRule gfsh = new GfshCommandRule();
 
   private static HttpOperationInvoker invoker;
   private static CommandRequest request;
 
   @Test
   public void performBeanOperationsHasAuthorizationCheck() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
-        "test", "test");
+    gfsh.secureConnectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http, "test",
+        "test");
     invoker = (HttpOperationInvoker) gfsh.getGfsh().getOperationInvoker();
 
     Integer distributedSystemId =
@@ -84,8 +84,8 @@ public class HttpOperationInvokerSecurityTest {
 
   @Test
   public void processCommandHasAuthorizationCheck() throws Exception {
-    gfsh.secureConnectAndVerify(locator.getHttpPort(), GfshShellConnectionRule.PortType.http,
-        "test", "test");
+    gfsh.secureConnectAndVerify(locator.getHttpPort(), GfshCommandRule.PortType.http, "test",
+        "test");
 
     invoker = (HttpOperationInvoker) gfsh.getGfsh().getOperationInvoker();
 

-- 
To stop receiving notification emails like this one, please contact
"commits@geode.apache.org" <co...@geode.apache.org>.