geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [geode] branch develop updated: GEODE-5971: refactor more to use ResultModel (#3268)
Date Wed, 06 Mar 2019 21:48:22 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/develop by this push:
     new 4e976c4  GEODE-5971: refactor more to use ResultModel (#3268)
4e976c4 is described below

commit 4e976c466148c8dbe682ddb8ffa6a1db36789bb6
Author: jinmeiliao <jiliao@pivotal.io>
AuthorDate: Wed Mar 6 13:47:59 2019 -0800

    GEODE-5971: refactor more to use ResultModel (#3268)
    
    Co-authored-by: Owen Nichols <onichols@pivotal.io>
---
 .../management/internal/cli/NetstatDUnitTest.java  |   9 +-
 .../DestroyAsyncEventQueueCommandDUnitTest.java    |  15 +-
 .../cli/commands/AlterOfflineDiskStoreCommand.java |   2 +-
 .../cli/commands/AlterRuntimeConfigCommand.java    |  28 ++-
 .../cli/commands/ChangeLogLevelCommand.java        |  23 ++-
 .../internal/cli/commands/ConnectCommand.java      |  39 ++--
 .../internal/cli/commands/DeployCommand.java       |  38 ++--
 .../cli/commands/DescribeClientCommand.java        |  15 +-
 .../commands/DestroyAsyncEventQueueCommand.java    |  19 +-
 .../cli/commands/DestroyFunctionCommand.java       |  41 ++--
 .../internal/cli/commands/DisconnectCommand.java   |  52 +++--
 .../internal/cli/commands/EchoCommand.java         |  26 ++-
 .../internal/cli/commands/GCCommand.java           |  70 +++----
 .../internal/cli/commands/ListClientCommand.java   |  19 +-
 .../internal/cli/commands/ListGatewayCommand.java  |  63 +++----
 .../internal/cli/commands/ListRegionCommand.java   |  75 ++++----
 .../internal/cli/commands/NetstatCommand.java      |  74 +++++---
 .../internal/cli/result/model/FileResultModel.java |   3 +
 .../internal/cli/result/model/ResultModel.java     |   4 -
 .../internal/cli/commands/ConnectCommandTest.java  |  15 +-
 .../cli/commands/ListGatewayCommandTest.java       |  38 ++--
 .../cli/result/model/TabularResultModelTest.java   |   4 +
 .../internal/cli/shell/GfshAbstractUnitTest.java   |   9 +-
 .../commands/DescribeClientCommandDUnitTest.java   | 112 ++++++-----
 .../cli/commands/ListClientCommandDUnitTest.java   |  46 ++---
 .../geode/test/junit/rules/GfshCommandRule.java    |   8 +
 .../assertions/AbstractResultModelAssert.java      |   4 +
 .../test/junit/assertions/CommandResultAssert.java |   5 +
 .../junit/assertions/TabularResultModelAssert.java |  19 ++
 .../wancommand/ListGatewaysCommandDUnitTest.java   | 209 +++++----------------
 .../WANClusterConfigurationDUnitTest.java          |  17 +-
 .../internal/cli/commands/CommandOverHttpTest.java |  17 +-
 32 files changed, 492 insertions(+), 626 deletions(-)

diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
index aeaccc8..ca30b58 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/NetstatDUnitTest.java
@@ -126,8 +126,7 @@ public class NetstatDUnitTest {
   public void testOutputToFile() throws Exception {
     File outputFile = new File(temp.newFolder(), "command.log.txt");
 
-    CommandResult result = gfsh.executeCommand("netstat --file=" + outputFile.getAbsolutePath());
-    assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
+    gfsh.executeAndAssertThat("netstat --file=" + outputFile.getAbsolutePath()).statusIsSuccess();
 
     List<String> lines = new ArrayList<>();
     Scanner scanner = new Scanner(outputFile);
@@ -147,9 +146,9 @@ public class NetstatDUnitTest {
   public void testOutputToFileForOneGroup() throws Exception {
     File outputFile = new File(temp.newFolder(), "command.log.txt");
 
-    CommandResult result = gfsh.executeCommand(
-        String.format("netstat --file=%s --group=%s", outputFile.getAbsolutePath(), GROUP_1));
-    assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
+    gfsh.executeAndAssertThat(
+        String.format("netstat --file=%s --group=%s", outputFile.getAbsolutePath(), GROUP_1))
+        .statusIsSuccess();
 
     List<String> lines = new ArrayList<>();
     Scanner scanner = new Scanner(outputFile);
diff --git a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommandDUnitTest.java b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommandDUnitTest.java
index 9aa6dae..a7f297b 100644
--- a/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommandDUnitTest.java
+++ b/geode-core/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommandDUnitTest.java
@@ -171,14 +171,11 @@ public class DestroyAsyncEventQueueCommandDUnitTest {
     gfsh.executeAndAssertThat("list async-event-queues").statusIsSuccess();
 
     gfsh.executeAndAssertThat("destroy async-event-queue --id=queue1").statusIsSuccess()
-        .tableHasRowWithValues("Member", "Status", "server-1",
-            String.format(DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED,
-                "queue1"))
-        .tableHasRowWithValues("Member", "Status", "server-2",
-            String.format(
-                "ERROR: "
-                    + DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND,
-                "queue1"));
+        .hasTableSection()
+        .hasRowSize(2)
+        .hasRowContaining("server-1", "OK", "Async event queue \"queue1\" destroyed")
+        .hasRowContaining("server-2", "ERROR", "Async event queue \"queue1\" not found");
+
     gfsh.executeAndAssertThat("list async-event-queues").statusIsSuccess()
         .containsOutput("No Async Event Queues Found");
   }
@@ -200,7 +197,7 @@ public class DestroyAsyncEventQueueCommandDUnitTest {
         .statusIsSuccess().containsOutput(String.format(
             DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED, "queue1"));
     gfsh.executeAndAssertThat("list async-event-queues").statusIsSuccess()
-        .tableHasRowWithValues("Member", "ID", "server-3", "queue3");
+        .hasTableSection().hasRowContaining("server-3", "queue3");
 
     // verify that cluster config aeq entry for destroyed queue is deleted
     locator.invoke(() -> {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterOfflineDiskStoreCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterOfflineDiskStoreCommand.java
index 7b5d204..4204669 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterOfflineDiskStoreCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterOfflineDiskStoreCommand.java
@@ -106,7 +106,7 @@ public class AlterOfflineDiskStoreCommand extends SingleGfshCommand {
 
           return ResultModel.createInfo(resultMessage);
         } else {
-          return ResultModel.createCommandProcessingError(
+          return ResultModel.createError(
               "Cannot use the --remove=true parameter with any other parameters");
         }
       } else {
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeConfigCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeConfigCommand.java
index f58b603..a6117c8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeConfigCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/AlterRuntimeConfigCommand.java
@@ -43,7 +43,10 @@ import org.apache.geode.management.internal.cli.GfshParseResult;
 import org.apache.geode.management.internal.cli.functions.AlterRuntimeConfigFunction;
 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.remote.CommandExecutor;
 import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.model.InfoResultModel;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
@@ -59,7 +62,7 @@ public class AlterRuntimeConfigCommand extends InternalGfshCommand {
       interceptor = "org.apache.geode.management.internal.cli.commands.AlterRuntimeConfigCommand$AlterRuntimeInterceptor")
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.MANAGE)
-  public Result alterRuntimeConfig(
+  public ResultModel alterRuntimeConfig(
       @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
           optionContext = ConverterHint.ALL_MEMBER_IDNAME,
           help = CliStrings.ALTER_RUNTIME_CONFIG__MEMBER__HELP) String[] memberNameOrId,
@@ -100,7 +103,7 @@ public class AlterRuntimeConfigCommand extends InternalGfshCommand {
     Set<DistributedMember> targetMembers = findMembers(group, memberNameOrId);
 
     if (targetMembers.isEmpty()) {
-      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+      return ResultModel.createError(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
     }
 
     if (archiveDiskSpaceLimit != null) {
@@ -174,8 +177,7 @@ public class AlterRuntimeConfigCommand extends InternalGfshCommand {
     }
 
     if (runTimeDistributionConfigAttributes.isEmpty() && rumTimeCacheAttributes.isEmpty()) {
-      return ResultBuilder
-          .createUserErrorResult(CliStrings.ALTER_RUNTIME_CONFIG__RELEVANT__OPTION__MESSAGE);
+      return ResultModel.createError(CliStrings.ALTER_RUNTIME_CONFIG__RELEVANT__OPTION__MESSAGE);
     }
 
     Map<String, String> allRunTimeAttributes = new HashMap<>();
@@ -197,6 +199,8 @@ public class AlterRuntimeConfigCommand extends InternalGfshCommand {
       }
     }
     final String lineSeparator = System.getProperty("line.separator");
+
+
     if (!successfulMembers.isEmpty()) {
       StringBuilder successMessageBuilder = new StringBuilder();
 
@@ -211,14 +215,18 @@ public class AlterRuntimeConfigCommand extends InternalGfshCommand {
       Properties properties = new Properties();
       properties.putAll(runTimeDistributionConfigAttributes);
 
-      Result result = ResultBuilder.createInfoResult(successMessageBuilder.toString());
-
+      ResultModel result = new ResultModel();
+      InfoResultModel successInfo = result.addInfo("success");
+      successInfo.addLine(successMessageBuilder.toString());
       // Set the Cache attributes to be modified
       final XmlEntity xmlEntity = XmlEntity.builder().withType(CacheXml.CACHE)
           .withAttributes(rumTimeCacheAttributes).build();
-      persistClusterConfiguration(result,
-          () -> ((InternalConfigurationPersistenceService) getConfigurationPersistenceService())
-              .modifyXmlAndProperties(properties, xmlEntity, group));
+      InternalConfigurationPersistenceService cps = getConfigurationPersistenceService();
+      if (cps == null) {
+        successInfo.addLine(CommandExecutor.SERVICE_NOT_RUNNING_CHANGE_NOT_PERSISTED);
+      } else {
+        cps.modifyXmlAndProperties(properties, xmlEntity, group);
+      }
       return result;
     } else {
       StringBuilder errorMessageBuilder = new StringBuilder();
@@ -229,7 +237,7 @@ public class AlterRuntimeConfigCommand extends InternalGfshCommand {
         errorMessageBuilder.append(errorMessage);
         errorMessageBuilder.append(lineSeparator);
       }
-      return ResultBuilder.createUserErrorResult(errorMessageBuilder.toString());
+      return ResultModel.createError(errorMessageBuilder.toString());
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommand.java
index f14c172..1e0a9bc 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ChangeLogLevelCommand.java
@@ -42,6 +42,8 @@ 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.result.model.ResultModel;
+import org.apache.geode.management.internal.cli.result.model.TabularResultModel;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -53,7 +55,7 @@ public class ChangeLogLevelCommand extends InternalGfshCommand {
       interceptor = "org.apache.geode.management.internal.cli.commands.ChangeLogLevelCommand$ChangeLogLevelCommandInterceptor")
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.WRITE)
-  public Result changeLogLevel(
+  public ResultModel changeLogLevel(
       @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
           help = CliStrings.CHANGE_LOGLEVEL__MEMBER__HELP) String[] memberIds,
       @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS}, unspecifiedDefaultValue = "",
@@ -63,8 +65,7 @@ public class ChangeLogLevelCommand extends InternalGfshCommand {
           help = CliStrings.CHANGE_LOGLEVEL__LOGLEVEL__HELP) String logLevel) {
 
     if ((memberIds == null || memberIds.length == 0) && (grps == null || grps.length == 0)) {
-      return ResultBuilder
-          .createUserErrorResult(CliStrings.CHANGE_LOGLEVEL__MSG__SPECIFY_GRP_OR_MEMBER);
+      return ResultModel.createError(CliStrings.CHANGE_LOGLEVEL__MSG__SPECIFY_GRP_OR_MEMBER);
     }
 
     Cache cache = getCache();
@@ -91,7 +92,7 @@ public class ChangeLogLevelCommand extends InternalGfshCommand {
     }
 
     if (dsMembers.size() == 0) {
-      return ResultBuilder.createGemFireErrorResult(
+      return ResultModel.createError(
           "No members were found matching the given member IDs or groups.");
     }
 
@@ -107,10 +108,15 @@ public class ChangeLogLevelCommand extends InternalGfshCommand {
 
     Execution execution = FunctionService.onMembers(dsMembers).setArguments(functionArgs);
     if (execution == null) {
-      return ResultBuilder.createUserErrorResult(CliStrings.CHANGE_LOGLEVEL__MSG__CANNOT_EXECUTE);
+      return ResultModel.createError(CliStrings.CHANGE_LOGLEVEL__MSG__CANNOT_EXECUTE);
     }
     List<?> resultList =
         (List<?>) this.executeFunction(logFunction, functionArgs, dsMembers).getResult();
+
+    ResultModel result = new ResultModel();
+    TabularResultModel tableInfo = result.addTable("result");
+    tableInfo.setColumnHeader(CliStrings.CHANGE_LOGLEVEL__COLUMN_MEMBER,
+        CliStrings.CHANGE_LOGLEVEL__COLUMN_STATUS);
     for (Object object : resultList) {
       try {
         if (object instanceof Throwable) {
@@ -124,11 +130,9 @@ public class ChangeLogLevelCommand extends InternalGfshCommand {
           Map.Entry<String, String> entry = resultMap.entrySet().iterator().next();
 
           if (entry.getValue().contains("ChangeLogLevelFunction exception")) {
-            resultTable.accumulate(CliStrings.CHANGE_LOGLEVEL__COLUMN_MEMBER, entry.getKey());
-            resultTable.accumulate(CliStrings.CHANGE_LOGLEVEL__COLUMN_STATUS, "false");
+            tableInfo.addRow(entry.getKey(), "false");
           } else {
-            resultTable.accumulate(CliStrings.CHANGE_LOGLEVEL__COLUMN_MEMBER, entry.getKey());
-            resultTable.accumulate(CliStrings.CHANGE_LOGLEVEL__COLUMN_STATUS, "true");
+            tableInfo.addRow(entry.getKey(), "true");
           }
 
         }
@@ -137,7 +141,6 @@ public class ChangeLogLevelCommand extends InternalGfshCommand {
       }
     }
 
-    Result result = ResultBuilder.buildResult(compositeResultData);
     logger.info("change log-level command result=" + result);
     return result;
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConnectCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConnectCommand.java
index 0747f44..25d49d9 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConnectCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConnectCommand.java
@@ -52,7 +52,6 @@ import org.apache.geode.internal.net.SSLConfigurationFactory;
 import org.apache.geode.internal.security.SecurableCommunicationChannel;
 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.JmxManagerLocatorRequest;
 import org.apache.geode.management.internal.JmxManagerLocatorResponse;
 import org.apache.geode.management.internal.SSLUtil;
@@ -61,8 +60,8 @@ import org.apache.geode.management.internal.cli.LogWrapper;
 import org.apache.geode.management.internal.cli.converters.ConnectionEndpointConverter;
 import org.apache.geode.management.internal.cli.domain.ConnectToLocatorResult;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.InfoResultData;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.model.InfoResultModel;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.management.internal.cli.shell.JmxOperationInvoker;
 import org.apache.geode.management.internal.cli.shell.OperationInvoker;
@@ -88,7 +87,7 @@ public class ConnectCommand extends OfflineGfshCommand {
   @CliCommand(value = {CliStrings.CONNECT}, help = CliStrings.CONNECT__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GFSH, CliStrings.TOPIC_GEODE_JMX,
       CliStrings.TOPIC_GEODE_MANAGER})
-  public Result connect(
+  public ResultModel connect(
       @CliOption(key = {CliStrings.CONNECT__LOCATOR},
           unspecifiedDefaultValue = ConnectionEndpointConverter.DEFAULT_LOCATOR_ENDPOINTS,
           optionContext = ConnectionEndpoint.LOCATOR_OPTION_CONTEXT,
@@ -125,13 +124,13 @@ public class ConnectCommand extends OfflineGfshCommand {
           unspecifiedDefaultValue = "false",
           help = "When connecting via HTTP, connects using 1-way SSL validation rather than 2-way SSL validation.") boolean skipSslValidation) {
 
-    Result result;
+    ResultModel result = new ResultModel();
     Gfsh gfsh = getGfsh();
 
     // bail out if gfsh is already connected.
     if (gfsh != null && gfsh.isConnectedAndReady()) {
-      return ResultBuilder
-          .createInfoResult("Already connected to: " + getGfsh().getOperationInvoker().toString());
+      return ResultModel
+          .createInfo("Already connected to: " + getGfsh().getOperationInvoker().toString());
     }
 
     if (StringUtils.startsWith(url, "https")) {
@@ -187,10 +186,10 @@ public class ConnectCommand extends OfflineGfshCommand {
     // will reach here only when remoteVersion is not available or does not match
     invoker.stop();
     if (remoteVersion == null) {
-      return ResultBuilder.createUserErrorResult(
+      return ResultModel.createError(
           String.format("Cannot use a %s gfsh client to connect to this cluster.", gfshVersion));
     } else {
-      return ResultBuilder.createUserErrorResult(String.format(
+      return ResultModel.createError(String.format(
           "Cannot use a %s gfsh client to connect to a %s cluster.", gfshVersion, remoteVersion));
     }
   }
@@ -278,7 +277,7 @@ public class ConnectCommand extends OfflineGfshCommand {
   }
 
 
-  Result httpConnect(Properties gfProperties, String url, boolean skipSslVerification) {
+  ResultModel httpConnect(Properties gfProperties, String url, boolean skipSslVerification) {
     Gfsh gfsh = getGfsh();
     try {
       SSLConfig sslConfig = SSLConfigurationFactory.getSSLConfigForComponent(gfProperties,
@@ -297,7 +296,7 @@ public class ConnectCommand extends OfflineGfshCommand {
 
       LogWrapper.getInstance().info(
           CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS, operationInvoker.toString()));
-      return ResultBuilder.createInfoResult(
+      return ResultModel.createInfo(
           CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS, operationInvoker.toString()));
 
     } catch (SecurityException | AuthenticationFailedException e) {
@@ -319,7 +318,8 @@ public class ConnectCommand extends OfflineGfshCommand {
     }
   }
 
-  Result jmxConnect(Properties gfProperties, boolean useSsl, ConnectionEndpoint memberRmiHostPort,
+  ResultModel jmxConnect(Properties gfProperties, boolean useSsl,
+      ConnectionEndpoint memberRmiHostPort,
       ConnectionEndpoint locatorTcpHostPort, boolean retry) {
     ConnectionEndpoint jmxHostPortToConnect = null;
     Gfsh gfsh = getGfsh();
@@ -364,16 +364,17 @@ public class ConnectCommand extends OfflineGfshCommand {
             new Object[] {jmxHostPortToConnect.toString(false)}));
       }
 
-      InfoResultData infoResultData = ResultBuilder.createInfoResultData();
+      ResultModel result = new ResultModel();
+      InfoResultModel infoResultModel = result.addInfo();
       JmxOperationInvoker operationInvoker = new JmxOperationInvoker(jmxHostPortToConnect.getHost(),
           jmxHostPortToConnect.getPort(), gfProperties);
 
       gfsh.setOperationInvoker(operationInvoker);
-      infoResultData.addLine(CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS,
+      infoResultModel.addLine(CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS,
           jmxHostPortToConnect.toString(false)));
       LogWrapper.getInstance().info(CliStrings.format(CliStrings.CONNECT__MSG__SUCCESS,
           jmxHostPortToConnect.toString(false)));
-      return ResultBuilder.buildResult(infoResultData);
+      return result;
     } catch (SecurityException | AuthenticationFailedException e) {
       // if it's security exception, and we already sent in username and password, still returns the
       // connection error
@@ -508,16 +509,16 @@ public class ConnectCommand extends OfflineGfshCommand {
     HttpsURLConnection.setDefaultSSLSocketFactory(ssl.getSocketFactory());
   }
 
-  private Result handleException(Exception e) {
+  private ResultModel handleException(Exception e) {
     return handleException(e, e.getMessage());
   }
 
-  private Result handleException(Exception e, String errorMessage) {
+  private ResultModel handleException(Exception e, String errorMessage) {
     LogWrapper.getInstance().severe(errorMessage, e);
-    return ResultBuilder.createConnectionErrorResult(errorMessage);
+    return ResultModel.createError(errorMessage);
   }
 
-  private Result handleException(Exception e, ConnectionEndpoint hostPortToConnect) {
+  private ResultModel handleException(Exception e, ConnectionEndpoint hostPortToConnect) {
     if (hostPortToConnect == null) {
       return handleException(e);
     }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommand.java
index 090f73a..712bd87 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommand.java
@@ -50,9 +50,11 @@ import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
 import org.apache.geode.management.internal.cli.functions.DeployFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.remote.CommandExecutionContext;
+import org.apache.geode.management.internal.cli.remote.CommandExecutor;
 import org.apache.geode.management.internal.cli.result.FileResult;
 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.result.model.ResultModel;
+import org.apache.geode.management.internal.cli.result.model.TabularResultModel;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -73,7 +75,7 @@ public class DeployCommand extends InternalGfshCommand {
       isFileUploaded = true, relatedTopic = {CliStrings.TOPIC_GEODE_CONFIG})
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.DEPLOY)
-  public Result deploy(
+  public ResultModel deploy(
       @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS}, help = CliStrings.DEPLOY__GROUP__HELP,
           optionContext = ConverterHint.MEMBERGROUP) String[] groups,
       @CliOption(key = {CliStrings.JAR, CliStrings.JARS},
@@ -81,7 +83,8 @@ public class DeployCommand extends InternalGfshCommand {
       @CliOption(key = {CliStrings.DEPLOY__DIR}, help = CliStrings.DEPLOY__DIR__HELP) String dir)
       throws IOException {
 
-    TabularResultData tabularData = ResultBuilder.createTabularResultData();
+    ResultModel result = new ResultModel();
+    TabularResultModel deployResult = result.addTable("deployResult");
 
     List<String> jarFullPaths = CommandExecutionContext.getFilePathFromShell();
 
@@ -120,34 +123,27 @@ public class DeployCommand extends InternalGfshCommand {
 
     List<CliFunctionResult> cleanedResults = CliFunctionResult.cleanResults(results);
 
-    for (CliFunctionResult result : cleanedResults) {
-      if (result.getThrowable() != null) {
-        tabularData.accumulate("Member", result.getMemberIdOrName());
-        tabularData.accumulate("Deployed JAR", "");
-        tabularData.accumulate("Deployed JAR Location",
-            "ERROR: " + result.getThrowable().getClass().getName() + ": "
-                + result.getThrowable().getMessage());
-        tabularData.setStatus(Result.Status.ERROR);
+    deployResult.setColumnHeader("Member", "Deployed JAR", "Deployed JAR Location");
+    for (CliFunctionResult cliResult : cleanedResults) {
+      if (cliResult.getThrowable() != null) {
+        deployResult.addRow(cliResult.getMemberIdOrName(), "",
+            "ERROR: " + cliResult.getThrowable().getClass().getName() + ": "
+                + cliResult.getThrowable().getMessage());
+        result.setStatus(Result.Status.ERROR);
       } else {
-        String[] strings = (String[]) result.getSerializables();
+        String[] strings = (String[]) cliResult.getSerializables();
         for (int i = 0; i < strings.length; i += 2) {
-          tabularData.accumulate("Member", result.getMemberIdOrName());
-          tabularData.accumulate("Deployed JAR", strings[i]);
-          tabularData.accumulate("Deployed JAR Location", strings[i + 1]);
+          deployResult.addRow(cliResult.getMemberIdOrName(), strings[i], strings[i + 1]);
         }
       }
     }
 
-    Result result = ResultBuilder.buildResult(tabularData);
-    InternalConfigurationPersistenceService sc =
-        (InternalConfigurationPersistenceService) getConfigurationPersistenceService();
+    InternalConfigurationPersistenceService sc = getConfigurationPersistenceService();
     if (sc == null) {
-      result.setCommandPersisted(false);
+      result.addInfo().addLine(CommandExecutor.SERVICE_NOT_RUNNING_CHANGE_NOT_PERSISTED);
     } else {
       sc.addJarsToThisLocator(jarFullPaths, groups);
-      result.setCommandPersisted(true);
     }
-
     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 d9e9ec9..c74c69d 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
@@ -68,7 +68,7 @@ public class DescribeClientCommand extends GfshCommand {
     ManagementService service = getManagementService();
     ObjectName[] cacheServers = service.getDistributedSystemMXBean().listCacheServerObjectNames();
     if (cacheServers.length == 0) {
-      return ResultModel.createCommandProcessingError(
+      return ResultModel.createError(
           CliStrings.format(CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_SERVER_LIST));
     }
 
@@ -83,11 +83,11 @@ public class DescribeClientCommand extends GfshCommand {
           try {
             clientHealthStatus = serverMbean.showClientStats(clientId);
             if (clientHealthStatus == null) {
-              return ResultModel.createCommandProcessingError(CliStrings.format(
+              return ResultModel.createError(CliStrings.format(
                   CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_STATS_FOR_CLIENT_0, clientId));
             }
           } catch (Exception eee) {
-            return ResultModel.createCommandProcessingError(CliStrings.format(
+            return ResultModel.createError(CliStrings.format(
                 CliStrings.DESCRIBE_CLIENT_COULD_NOT_RETRIEVE_STATS_FOR_CLIENT_0_REASON_1, clientId,
                 eee.getMessage()));
           }
@@ -96,7 +96,7 @@ public class DescribeClientCommand extends GfshCommand {
     }
 
     if (clientHealthStatus == null) {
-      return ResultModel.createCommandProcessingError(
+      return ResultModel.createError(
           CliStrings.format(CliStrings.DESCRIBE_CLIENT__CLIENT__ID__NOT__FOUND__0, clientId));
     }
 
@@ -146,7 +146,7 @@ public class DescribeClientCommand extends GfshCommand {
 
       buildTableResult(result, clientHealthStatus, isDurable, primaryServers, secondaryServers);
     } else {
-      result = ResultModel.createCommandProcessingError(CliStrings.DESCRIBE_CLIENT_NO_MEMBERS);
+      result = ResultModel.createError(CliStrings.DESCRIBE_CLIENT_NO_MEMBERS);
     }
 
     LogWrapper.getInstance(getCache()).info("describe client result " + result);
@@ -166,7 +166,7 @@ public class DescribeClientCommand extends GfshCommand {
       secondServers.append(secondServer);
     }
 
-    DataResultModel dataSection = result.addData("InfoSection");
+    DataResultModel dataSection = result.addData("infoSection");
     if (clientHealthStatus != null) {
       dataSection.addData(CliStrings.DESCRIBE_CLIENT_COLUMN_PRIMARY_SERVERS, primServers);
       dataSection.addData(CliStrings.DESCRIBE_CLIENT_COLUMN_SECONDARY_SERVERS, secondServers);
@@ -193,8 +193,7 @@ public class DescribeClientCommand extends GfshCommand {
 
       if (poolStats.size() > 0) {
         for (Map.Entry<String, String> entry : poolStats.entrySet()) {
-          TabularResultModel poolStatsResultTable =
-              result.addTable("Pool Stats For Pool Name = " + entry.getKey());
+          TabularResultModel poolStatsResultTable = result.addTable(entry.getKey());
           poolStatsResultTable.setHeader("Pool Stats For Pool Name = " + entry.getKey());
           String poolStatsStr = entry.getValue();
           String str[] = poolStatsStr.split(";");
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
index dc2e258..ce0d9d7 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
@@ -26,12 +26,12 @@ import org.springframework.shell.core.annotation.CliOption;
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.InternalConfigurationPersistenceService;
 import org.apache.geode.management.cli.ConverterHint;
-import org.apache.geode.management.cli.Result;
 import org.apache.geode.management.internal.cli.functions.CliFunctionResult;
 import org.apache.geode.management.internal.cli.functions.DestroyAsyncEventQueueFunction;
 import org.apache.geode.management.internal.cli.functions.DestroyAsyncEventQueueFunctionArgs;
 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.remote.CommandExecutor;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
 import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
@@ -53,7 +53,7 @@ public class DestroyAsyncEventQueueCommand extends InternalGfshCommand {
   @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = DESTROY_ASYNC_EVENT_QUEUE__HELP)
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.MANAGE)
-  public Result destroyAsyncEventQueue(
+  public ResultModel destroyAsyncEventQueue(
       @CliOption(key = DESTROY_ASYNC_EVENT_QUEUE__ID, mandatory = true,
           help = DESTROY_ASYNC_EVENT_QUEUE__ID__HELP) String aeqId,
       @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
@@ -69,13 +69,16 @@ public class DestroyAsyncEventQueueCommand extends InternalGfshCommand {
     List<CliFunctionResult> functionResults = executeAndGetFunctionResult(
         new DestroyAsyncEventQueueFunction(), asyncEventQueueDestoryFunctionArgs, members);
 
-    Result commandResult = ResultBuilder.buildResult(functionResults);
+    ResultModel result = ResultModel.createMemberStatusResult(functionResults);
     XmlEntity xmlEntity = findXmlEntity(functionResults);
+    InternalConfigurationPersistenceService cps = getConfigurationPersistenceService();
     if (xmlEntity != null) {
-      persistClusterConfiguration(commandResult,
-          () -> ((InternalConfigurationPersistenceService) getConfigurationPersistenceService())
-              .deleteXmlEntity(xmlEntity, onGroups));
+      if (cps == null) {
+        result.addInfo().addLine(CommandExecutor.SERVICE_NOT_RUNNING_CHANGE_NOT_PERSISTED);
+      } else {
+        cps.deleteXmlEntity(xmlEntity, onGroups);
+      }
     }
-    return commandResult;
+    return result;
   }
 }
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 2cdad4b..eb7af7e 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
@@ -36,8 +36,8 @@ import org.apache.geode.management.internal.cli.AbstractCliAroundInterceptor;
 import org.apache.geode.management.internal.cli.GfshParseResult;
 import org.apache.geode.management.internal.cli.functions.UnregisterFunction;
 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;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -48,7 +48,7 @@ public class DestroyFunctionCommand extends InternalGfshCommand {
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.MANAGE, target = ResourcePermission.Target.DEPLOY)
   // TODO: Add optioncontext for functionId
-  public Result destroyFunction(
+  public ResultModel destroyFunction(
       @CliOption(key = CliStrings.DESTROY_FUNCTION__ID, mandatory = true,
           help = CliStrings.DESTROY_FUNCTION__HELP) String functionId,
       @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
@@ -60,43 +60,35 @@ public class DestroyFunctionCommand extends InternalGfshCommand {
       Cache cache = getCache();
       Set<DistributedMember> dsMembers = new HashSet<>();
       if (groups != null && memberId != null) {
-        return ResultBuilder
-            .createUserErrorResult(CliStrings.DESTROY_FUNCTION__MSG__PROVIDE_OPTION);
+        return ResultModel.createError(CliStrings.DESTROY_FUNCTION__MSG__PROVIDE_OPTION);
       } else if (groups != null && groups.length > 0) {
         // execute on group members
         for (String grp : groups) {
           dsMembers.addAll(cache.getDistributedSystem().getGroupMembers(grp));
         }
-        @SuppressWarnings("unchecked")
-        Result results = executeFunction(cache, dsMembers, functionId);
-        return results;
+        return executeFunction(cache, dsMembers, functionId);
       } else if (memberId != null) {
         // execute on member
         dsMembers.add(getMember(memberId));
-        @SuppressWarnings("unchecked")
-        Result results = executeFunction(cache, dsMembers, functionId);
-        return results;
+        return executeFunction(cache, dsMembers, functionId);
       } else {
         // no option provided.
-        @SuppressWarnings("unchecked")
-        Result results = executeFunction(cache, cache.getMembers(), functionId);
-        return results;
+        return executeFunction(cache, cache.getMembers(), functionId);
       }
     } catch (Exception e) {
-      ErrorResultData errorResultData = ResultBuilder.createErrorResultData()
-          .setErrorCode(ResultBuilder.ERRORCODE_DEFAULT).addLine(e.getMessage());
-      return ResultBuilder.buildResult(errorResultData);
+      return ResultModel.createError(e.getMessage());
     }
   }
 
-  private Result executeFunction(Cache cache, Set<DistributedMember> DsMembers, String functionId) {
+  private ResultModel executeFunction(Cache cache, Set<DistributedMember> DsMembers,
+      String functionId) {
     // unregister on a set of of members
     Function unregisterFunction = new UnregisterFunction();
     FunctionService.registerFunction(unregisterFunction);
     List resultList;
 
     if (DsMembers.isEmpty()) {
-      return ResultBuilder.createInfoResult("No members for execution");
+      return ResultModel.createInfo("No members for execution");
     }
     Object[] obj = new Object[1];
     obj[0] = functionId;
@@ -105,17 +97,12 @@ public class DestroyFunctionCommand extends InternalGfshCommand {
 
     if (execution == null) {
       cache.getLogger().error("executeUnregister execution is null");
-      ErrorResultData errorResultData =
-          ResultBuilder.createErrorResultData().setErrorCode(ResultBuilder.ERRORCODE_DEFAULT)
-              .addLine(CliStrings.DESTROY_FUNCTION__MSG__CANNOT_EXECUTE);
-      return (ResultBuilder.buildResult(errorResultData));
+      return ResultModel.createError(CliStrings.DESTROY_FUNCTION__MSG__CANNOT_EXECUTE);
     }
     try {
       resultList = (ArrayList) execution.execute(unregisterFunction).getResult();
     } catch (FunctionException ex) {
-      ErrorResultData errorResultData = ResultBuilder.createErrorResultData()
-          .setErrorCode(ResultBuilder.ERRORCODE_DEFAULT).addLine(ex.getMessage());
-      return (ResultBuilder.buildResult(errorResultData));
+      return ResultModel.createError(ex.getMessage());
     }
     String resultStr = ((String) resultList.get(0));
     if (resultStr.equals("Succeeded in unregistering")) {
@@ -124,10 +111,10 @@ public class DestroyFunctionCommand extends InternalGfshCommand {
         members.append(member.getId());
         members.append(",");
       }
-      return ResultBuilder.createInfoResult("Destroyed " + functionId + " Successfully on "
+      return ResultModel.createInfo("Destroyed " + functionId + " Successfully on "
           + members.toString().substring(0, members.toString().length() - 1));
     } else {
-      return ResultBuilder.createInfoResult("Failed in unregistering");
+      return ResultModel.createInfo("Failed in unregistering");
     }
   }
 
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DisconnectCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DisconnectCommand.java
index eb33973..4727734 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DisconnectCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DisconnectCommand.java
@@ -18,11 +18,10 @@ package org.apache.geode.management.internal.cli.commands;
 import org.springframework.shell.core.annotation.CliCommand;
 
 import org.apache.geode.management.cli.CliMetaData;
-import org.apache.geode.management.cli.Result;
 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.InfoResultData;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.model.InfoResultModel;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.management.internal.cli.shell.OperationInvoker;
 
@@ -30,35 +29,32 @@ public class DisconnectCommand extends OfflineGfshCommand {
   @CliCommand(value = {CliStrings.DISCONNECT}, help = CliStrings.DISCONNECT__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GFSH, CliStrings.TOPIC_GEODE_JMX,
       CliStrings.TOPIC_GEODE_MANAGER})
-  public Result disconnect() {
-    Result result;
+  public ResultModel disconnect() {
+
 
     if (getGfsh() != null && !getGfsh().isConnectedAndReady()) {
-      result = ResultBuilder.createInfoResult("Not connected.");
-    } else {
-      InfoResultData infoResultData = ResultBuilder.createInfoResultData();
-      try {
-        Gfsh gfshInstance = getGfsh();
-        if (gfshInstance.isConnectedAndReady()) {
-          OperationInvoker operationInvoker = gfshInstance.getOperationInvoker();
-          Gfsh.println("Disconnecting from: " + operationInvoker);
-          operationInvoker.stop();
-          infoResultData.addLine(CliStrings.format(CliStrings.DISCONNECT__MSG__DISCONNECTED,
-              operationInvoker.toString()));
-          LogWrapper.getInstance().info(CliStrings
-              .format(CliStrings.DISCONNECT__MSG__DISCONNECTED, operationInvoker.toString()));
-          if (!gfshInstance.isHeadlessMode()) {
-            gfshInstance.setPromptPath(gfshInstance.getEnvAppContextPath());
-          }
-        } else {
-          infoResultData.addLine(CliStrings.DISCONNECT__MSG__NOTCONNECTED);
-        }
-        result = ResultBuilder.buildResult(infoResultData);
-      } catch (Exception e) {
-        result = ResultBuilder.createConnectionErrorResult(
-            CliStrings.format(CliStrings.DISCONNECT__MSG__ERROR, e.getMessage()));
+      return ResultModel.createInfo("Not connected.");
+    }
+
+    ResultModel result = new ResultModel();
+    InfoResultModel infoResultData = result.addInfo();
+
+    Gfsh gfshInstance = getGfsh();
+    if (gfshInstance.isConnectedAndReady()) {
+      OperationInvoker operationInvoker = gfshInstance.getOperationInvoker();
+      Gfsh.println("Disconnecting from: " + operationInvoker);
+      operationInvoker.stop();
+      infoResultData.addLine(CliStrings.format(CliStrings.DISCONNECT__MSG__DISCONNECTED,
+          operationInvoker.toString()));
+      LogWrapper.getInstance().info(CliStrings
+          .format(CliStrings.DISCONNECT__MSG__DISCONNECTED, operationInvoker.toString()));
+      if (!gfshInstance.isHeadlessMode()) {
+        gfshInstance.setPromptPath(gfshInstance.getEnvAppContextPath());
       }
+    } else {
+      infoResultData.addLine(CliStrings.DISCONNECT__MSG__NOTCONNECTED);
     }
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/EchoCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/EchoCommand.java
index 79c9fa9..d409b9b 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/EchoCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/EchoCommand.java
@@ -22,39 +22,35 @@ import org.springframework.shell.core.annotation.CliCommand;
 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.i18n.CliStrings;
-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.result.model.ResultModel;
+import org.apache.geode.management.internal.cli.result.model.TabularResultModel;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 
 public class EchoCommand extends OfflineGfshCommand {
   @CliCommand(value = {CliStrings.ECHO}, help = CliStrings.ECHO__HELP)
   @CliMetaData(shellOnly = true, relatedTopic = {CliStrings.TOPIC_GFSH})
-  public Result echo(@CliOption(key = {CliStrings.ECHO__STR, ""}, specifiedDefaultValue = "",
+  public ResultModel echo(@CliOption(key = {CliStrings.ECHO__STR, ""}, specifiedDefaultValue = "",
       mandatory = true, help = CliStrings.ECHO__STR__HELP) String stringToEcho) {
-    Result result;
 
     if (stringToEcho.equals("$*")) {
       Gfsh gfshInstance = getGfsh();
       Map<String, String> envMap = gfshInstance.getEnv();
       Set<Map.Entry<String, String>> setEnvMap = envMap.entrySet();
-      TabularResultData resultData = buildResultForEcho(setEnvMap);
-
-      result = ResultBuilder.buildResult(resultData);
+      return buildResultForEcho(setEnvMap);
     } else {
-      result = ResultBuilder.createInfoResult(stringToEcho);
+      return ResultModel.createInfo(stringToEcho);
     }
-    return result;
   }
 
-  private TabularResultData buildResultForEcho(Set<Map.Entry<String, String>> propertyMap) {
-    TabularResultData resultData = ResultBuilder.createTabularResultData();
+  private ResultModel buildResultForEcho(Set<Map.Entry<String, String>> propertyMap) {
+    ResultModel result = new ResultModel();
+    TabularResultModel echoResult = result.addTable("echoResult");
 
+    echoResult.setColumnHeader("Property", "Value");
     for (Map.Entry<String, String> setEntry : propertyMap) {
-      resultData.accumulate("Property", setEntry.getKey());
-      resultData.accumulate("Value", String.valueOf(setEntry.getValue()));
+      echoResult.addRow(setEntry.getKey(), String.valueOf(setEntry.getValue()));
     }
-    return resultData;
+    return result;
   }
 }
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 9ba4607..fc269d4 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
@@ -28,14 +28,13 @@ import org.apache.geode.cache.execute.Function;
 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.GarbageCollectionFunction;
 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.result.model.InfoResultModel;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
+import org.apache.geode.management.internal.cli.result.model.TabularResultModel;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -44,80 +43,61 @@ public class GCCommand extends InternalGfshCommand {
   @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DEBUG_UTIL})
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.MANAGE)
-  public Result gc(
+  public ResultModel gc(
       @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
           help = CliStrings.GC__GROUP__HELP) String[] groups,
       @CliOption(key = CliStrings.MEMBER, optionContext = ConverterHint.ALL_MEMBER_IDNAME,
           help = CliStrings.GC__MEMBER__HELP) String memberId) {
     Cache cache = getCache();
-    Result result;
-    CompositeResultData gcResultTable = ResultBuilder.createCompositeResultData();
-    TabularResultData resultTable = gcResultTable.addSection().addTable("Table1");
+    ResultModel result = new ResultModel();
+    TabularResultModel summary = result.addTable("summary");
+    InfoResultModel errors = result.addInfo("errors");
     String headerText = "GC Summary";
-    resultTable.setHeader(headerText);
+    summary.setHeader(headerText);
     Set<DistributedMember> dsMembers = new HashSet<>();
     if (memberId != null && memberId.length() > 0) {
       DistributedMember member = getMember(memberId);
       dsMembers.add(member);
-      result = executeAndBuildResult(resultTable, dsMembers);
     } else if (groups != null && groups.length > 0) {
       for (String group : groups) {
         dsMembers.addAll(cache.getDistributedSystem().getGroupMembers(group));
       }
-      result = executeAndBuildResult(resultTable, dsMembers);
-
     } else {
       // gc on entire cluster
       // exclude locators
       dsMembers = getAllNormalMembers();
-      result = executeAndBuildResult(resultTable, dsMembers);
-
     }
-    return result;
-  }
-
-  private Result executeAndBuildResult(TabularResultData resultTable,
-      Set<DistributedMember> dsMembers) {
 
-    List<?> resultList;
     Function garbageCollectionFunction = new GarbageCollectionFunction();
-    resultList =
+    List<?> resultList =
         (List<?>) CliUtil.executeFunction(garbageCollectionFunction, null, dsMembers).getResult();
 
     for (Object object : resultList) {
-      if (object instanceof Exception) {
-        LogWrapper.getInstance(getCache())
-            .fine("Exception in GC " + ((Throwable) object).getMessage(), ((Throwable) object));
+      if (object == null) {
+        errors.addLine("ResultMap was null");
         continue;
       } else if (object instanceof Throwable) {
+        errors.addLine("Exception in GC " + ((Throwable) object).getMessage());
         LogWrapper.getInstance(getCache())
             .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 {
-          Map<String, String> resultMap = (Map<String, String>) object;
-          toTabularResultData(resultTable, resultMap.get("MemberId"),
-              resultMap.get("HeapSizeBeforeGC"), resultMap.get("HeapSizeAfterGC"),
-              resultMap.get("TimeSpentInGC"));
-        }
+      } else if (object instanceof String) {
+        // unexpected exception string - cache may be closed or something
+        errors.addLine((String) object);
       } else {
-        LogWrapper.getInstance(getCache()).fine("ResultMap was null ");
+        Map<String, String> resultMap = (Map<String, String>) object;
+        summary
+            .accumulate(CliStrings.GC__MSG__MEMBER_NAME, resultMap.get("MemberId"));
+        summary.accumulate(CliStrings.GC__MSG__HEAP_SIZE_BEFORE_GC,
+            resultMap.get("HeapSizeBeforeGC"));
+        summary
+            .accumulate(CliStrings.GC__MSG__HEAP_SIZE_AFTER_GC, resultMap.get("HeapSizeAfterGC"));
+        summary
+            .accumulate(CliStrings.GC__MSG__TOTAL_TIME_IN_GC, resultMap.get("TimeSpentInGC"));
       }
     }
 
-    return ResultBuilder.buildResult(resultTable);
+    return result;
   }
 
-  private void toTabularResultData(TabularResultData table, String memberId, String heapSizeBefore,
-      String heapSizeAfter, String timeTaken) {
-    table.accumulate(CliStrings.GC__MSG__MEMBER_NAME, memberId);
-    table.accumulate(CliStrings.GC__MSG__HEAP_SIZE_BEFORE_GC, heapSizeBefore);
-    table.accumulate(CliStrings.GC__MSG__HEAP_SIZE_AFTER_GC, heapSizeAfter);
-    table.accumulate(CliStrings.GC__MSG__TOTAL_TIME_IN_GC, timeTaken);
-  }
 }
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 811c5529..728887a 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
@@ -27,12 +27,12 @@ import org.springframework.shell.core.annotation.CliCommand;
 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.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;
-import org.apache.geode.management.internal.cli.result.TabularResultData;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
+import org.apache.geode.management.internal.cli.result.model.TabularResultModel;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -41,20 +41,20 @@ public class ListClientCommand extends InternalGfshCommand {
   @CliMetaData(relatedTopic = {CliStrings.TOPIC_CLIENT})
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
-  public Result listClient() throws Exception {
-    Result result;
+  public ResultModel listClient() throws Exception {
+    ResultModel result = new ResultModel();
     CompositeResultData compositeResultData = ResultBuilder.createCompositeResultData();
     CompositeResultData.SectionResultData section = compositeResultData.addSection("section1");
 
-    TabularResultData resultTable = section.addTable("TableForClientList");
-    String headerText = "ClientList";
-    resultTable = resultTable.setHeader(headerText);
+    TabularResultModel resultTable = result.addTable("clientList");
+    String headerText = "Client List";
+    resultTable.setHeader(headerText);
 
     ManagementService service = getManagementService();
     ObjectName[] cacheServers = service.getDistributedSystemMXBean().listCacheServerObjectNames();
 
     if (cacheServers.length == 0) {
-      return ResultBuilder.createGemFireErrorResult(
+      return ResultModel.createError(
           CliStrings.format(CliStrings.LIST_CLIENT_COULD_NOT_RETRIEVE_SERVER_LIST));
     }
 
@@ -84,7 +84,7 @@ public class ListClientCommand extends InternalGfshCommand {
     }
 
     if (clientServerMap.size() == 0) {
-      return ResultBuilder.createGemFireErrorResult(
+      return ResultModel.createError(
           CliStrings.format(CliStrings.LIST_COULD_NOT_RETRIEVE_CLIENT_LIST));
     }
 
@@ -106,7 +106,6 @@ public class ListClientCommand extends InternalGfshCommand {
       resultTable.accumulate(CliStrings.LIST_CLIENT_COLUMN_Clients, client);
       resultTable.accumulate(CliStrings.LIST_CLIENT_COLUMN_SERVERS, serverListForClient.toString());
     }
-    result = ResultBuilder.buildResult(compositeResultData);
 
     LogWrapper.getInstance(getCache()).info("list client result " + result);
 
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 6d9e44f..be23163 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
@@ -33,13 +33,11 @@ import org.apache.geode.management.GatewayReceiverMXBean;
 import org.apache.geode.management.GatewaySenderMXBean;
 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.MBeanJMXAdapter;
 import org.apache.geode.management.internal.SystemManagementService;
 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.result.model.ResultModel;
+import org.apache.geode.management.internal.cli.result.model.TabularResultModel;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -48,7 +46,7 @@ public class ListGatewayCommand extends InternalGfshCommand {
   @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_WAN)
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
-  public Result listGateway(
+  public ResultModel listGateway(
       @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
           optionContext = ConverterHint.MEMBERIDNAME,
           help = CliStrings.LIST_GATEWAY__MEMBER__HELP) String[] onMember,
@@ -57,13 +55,13 @@ public class ListGatewayCommand extends InternalGfshCommand {
           help = CliStrings.LIST_GATEWAY__GROUP__HELP) String[] onGroup)
       throws Exception {
 
-    Result result;
-    SystemManagementService service = (SystemManagementService) getManagementService();
+    ResultModel result = new ResultModel();
+    SystemManagementService service = getManagementService();
 
     Set<DistributedMember> dsMembers = findMembers(onGroup, onMember);
 
     if (dsMembers.isEmpty()) {
-      return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+      return ResultModel.createError(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
     }
 
     Map<String, Map<String, GatewaySenderMXBean>> gatewaySenderBeans = new TreeMap<>();
@@ -105,54 +103,51 @@ public class ListGatewayCommand extends InternalGfshCommand {
       }
     }
     if (gatewaySenderBeans.isEmpty() && gatewayReceiverBeans.isEmpty()) {
-      return ResultBuilder.createUserErrorResult(CliStrings.GATEWAYS_ARE_NOT_AVAILABLE_IN_CLUSTER);
+      return ResultModel.createError(CliStrings.GATEWAYS_ARE_NOT_AVAILABLE_IN_CLUSTER);
     }
-    CompositeResultData crd = ResultBuilder.createCompositeResultData();
-    crd.setHeader(CliStrings.HEADER_GATEWAYS);
-    accumulateListGatewayResult(crd, gatewaySenderBeans, gatewayReceiverBeans);
-    result = ResultBuilder.buildResult(crd);
+
+    accumulateListGatewayResult(result, gatewaySenderBeans, gatewayReceiverBeans);
 
     return result;
   }
 
-  protected void accumulateListGatewayResult(CompositeResultData crd,
+  protected void accumulateListGatewayResult(ResultModel result,
       Map<String, Map<String, GatewaySenderMXBean>> gatewaySenderBeans,
       Map<String, GatewayReceiverMXBean> gatewayReceiverBeans) {
     if (!gatewaySenderBeans.isEmpty()) {
-      TabularResultData gatewaySenderData = crd.addSection(CliStrings.SECTION_GATEWAY_SENDER)
-          .addTable(CliStrings.TABLE_GATEWAY_SENDER).setHeader(CliStrings.HEADER_GATEWAY_SENDER);
+      TabularResultModel gatewaySenders = result.addTable("gatewaySenders");
+      gatewaySenders.setHeader(CliStrings.SECTION_GATEWAY_SENDER);
       for (Map.Entry<String, Map<String, GatewaySenderMXBean>> entry : gatewaySenderBeans
           .entrySet()) {
         for (Map.Entry<String, GatewaySenderMXBean> memberToBean : entry.getValue().entrySet()) {
-          gatewaySenderData.accumulate(CliStrings.RESULT_GATEWAY_SENDER_ID, entry.getKey());
-          gatewaySenderData.accumulate(CliStrings.RESULT_HOST_MEMBER, memberToBean.getKey());
-          gatewaySenderData.accumulate(CliStrings.RESULT_REMOTE_CLUSTER,
-              memberToBean.getValue().getRemoteDSId());
-          gatewaySenderData.accumulate(CliStrings.RESULT_TYPE, memberToBean.getValue().isParallel()
+          gatewaySenders.accumulate(CliStrings.RESULT_GATEWAY_SENDER_ID, entry.getKey());
+          gatewaySenders.accumulate(CliStrings.RESULT_HOST_MEMBER, memberToBean.getKey());
+          gatewaySenders.accumulate(CliStrings.RESULT_REMOTE_CLUSTER,
+              memberToBean.getValue().getRemoteDSId() + "");
+          gatewaySenders.accumulate(CliStrings.RESULT_TYPE, memberToBean.getValue().isParallel()
               ? CliStrings.SENDER_PARALLEL : CliStrings.SENDER_SERIAL);
-          gatewaySenderData.accumulate(CliStrings.RESULT_STATUS, memberToBean.getValue().isRunning()
+          gatewaySenders.accumulate(CliStrings.RESULT_STATUS, memberToBean.getValue().isRunning()
               ? CliStrings.GATEWAY_RUNNING : CliStrings.GATEWAY_NOT_RUNNING);
-          gatewaySenderData.accumulate(CliStrings.RESULT_QUEUED_EVENTS,
-              memberToBean.getValue().getEventQueueSize());
-          gatewaySenderData.accumulate(CliStrings.RESULT_RECEIVER,
+          gatewaySenders.accumulate(CliStrings.RESULT_QUEUED_EVENTS,
+              memberToBean.getValue().getEventQueueSize() + "");
+          gatewaySenders.accumulate(CliStrings.RESULT_RECEIVER,
               memberToBean.getValue().getGatewayReceiver());
         }
       }
     }
 
     if (!gatewayReceiverBeans.isEmpty()) {
-      TabularResultData gatewayReceiverData = crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-          .addTable(CliStrings.TABLE_GATEWAY_RECEIVER)
-          .setHeader(CliStrings.HEADER_GATEWAY_RECEIVER);
+      TabularResultModel gatewaySenders = result.addTable("gatewayReceivers");
+      gatewaySenders.setHeader(CliStrings.SECTION_GATEWAY_RECEIVER);
       for (Map.Entry<String, GatewayReceiverMXBean> entry : gatewayReceiverBeans.entrySet()) {
-        gatewayReceiverData.accumulate(CliStrings.RESULT_HOST_MEMBER, entry.getKey());
-        gatewayReceiverData.accumulate(CliStrings.RESULT_PORT, entry.getValue().getPort());
-        gatewayReceiverData.accumulate(CliStrings.RESULT_SENDERS_COUNT,
-            entry.getValue().getClientConnectionCount());
+        gatewaySenders.accumulate(CliStrings.RESULT_HOST_MEMBER, entry.getKey());
+        gatewaySenders.accumulate(CliStrings.RESULT_PORT, entry.getValue().getPort() + "");
+        gatewaySenders.accumulate(CliStrings.RESULT_SENDERS_COUNT,
+            entry.getValue().getClientConnectionCount() + "");
         if (entry.getValue() == null || entry.getValue().getConnectedGatewaySenders() == null) {
-          gatewayReceiverData.accumulate(CliStrings.RESULT_SENDER_CONNECTED, "");
+          gatewaySenders.accumulate(CliStrings.RESULT_SENDER_CONNECTED, "");
         } else {
-          gatewayReceiverData.accumulate(CliStrings.RESULT_SENDER_CONNECTED,
+          gatewaySenders.accumulate(CliStrings.RESULT_SENDER_CONNECTED,
               Arrays.stream(entry.getValue().getConnectedGatewaySenders()).collect(joining(", ")));
         }
       }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListRegionCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListRegionCommand.java
index 45c68dc..33cc431 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListRegionCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ListRegionCommand.java
@@ -27,18 +27,16 @@ import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
 import org.apache.geode.annotations.Immutable;
-import org.apache.geode.cache.execute.FunctionInvocationTargetException;
 import org.apache.geode.cache.execute.ResultCollector;
 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.RegionInformation;
 import org.apache.geode.management.internal.cli.functions.GetRegionsFunction;
 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;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
+import org.apache.geode.management.internal.cli.result.model.TabularResultModel;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -50,61 +48,52 @@ public class ListRegionCommand extends InternalGfshCommand {
   @CliMetaData(relatedTopic = CliStrings.TOPIC_GEODE_REGION)
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
-  public Result listRegion(
+  public ResultModel listRegion(
       @CliOption(key = {CliStrings.GROUP, CliStrings.GROUPS},
           optionContext = ConverterHint.MEMBERGROUP,
           help = CliStrings.LIST_REGION__GROUP__HELP) String[] group,
       @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
           optionContext = ConverterHint.MEMBERIDNAME,
           help = CliStrings.LIST_REGION__MEMBER__HELP) String[] memberNameOrId) {
-    Result result = null;
-    try {
-      Set<RegionInformation> regionInfoSet = new LinkedHashSet<>();
-      ResultCollector<?, ?> rc;
-      Set<DistributedMember> targetMembers = findMembers(group, memberNameOrId);
-
-      if (targetMembers.isEmpty()) {
-        return ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
-      }
+    ResultModel result = new ResultModel();
+
+    Set<RegionInformation> regionInfoSet = new LinkedHashSet<>();
+    ResultCollector<?, ?> rc;
+    Set<DistributedMember> targetMembers = findMembers(group, memberNameOrId);
 
-      TabularResultData resultData = ResultBuilder.createTabularResultData();
-      rc = CliUtil.executeFunction(getRegionsFunction, null, targetMembers);
-      ArrayList<?> resultList = (ArrayList<?>) rc.getResult();
+    if (targetMembers.isEmpty()) {
+      return ResultModel.createError(CliStrings.NO_MEMBERS_FOUND_MESSAGE);
+    }
 
-      if (resultList != null) {
-        // Gather all RegionInformation into a flat set.
-        regionInfoSet.addAll(resultList.stream().filter(Objects::nonNull)
-            .filter(Object[].class::isInstance).map(Object[].class::cast).flatMap(Arrays::stream)
-            .filter(RegionInformation.class::isInstance).map(RegionInformation.class::cast)
-            .collect(Collectors.toSet()));
+    TabularResultModel resultData = result.addTable("regionInfo");
+    rc = CliUtil.executeFunction(getRegionsFunction, null, targetMembers);
+    ArrayList<?> resultList = (ArrayList<?>) rc.getResult();
 
-        Set<String> regionNames = new TreeSet<>();
+    if (resultList != null) {
+      // Gather all RegionInformation into a flat set.
+      regionInfoSet.addAll(resultList.stream().filter(Objects::nonNull)
+          .filter(Object[].class::isInstance).map(Object[].class::cast).flatMap(Arrays::stream)
+          .filter(RegionInformation.class::isInstance).map(RegionInformation.class::cast)
+          .collect(Collectors.toSet()));
 
-        for (RegionInformation regionInfo : regionInfoSet) {
-          regionNames.add(regionInfo.getName());
-          Set<String> subRegionNames = regionInfo.getSubRegionNames();
+      Set<String> regionNames = new TreeSet<>();
 
-          regionNames.addAll(subRegionNames);
-        }
+      for (RegionInformation regionInfo : regionInfoSet) {
+        regionNames.add(regionInfo.getName());
+        Set<String> subRegionNames = regionInfo.getSubRegionNames();
 
-        for (String regionName : regionNames) {
-          resultData.accumulate("List of regions", regionName);
-        }
+        regionNames.addAll(subRegionNames);
+      }
 
-        if (!regionNames.isEmpty()) {
-          result = ResultBuilder.buildResult(resultData);
+      if (regionNames.isEmpty()) {
+        return ResultModel.createInfo(CliStrings.LIST_REGION__MSG__NOT_FOUND);
+      }
 
-        } else {
-          result = ResultBuilder.createInfoResult(CliStrings.LIST_REGION__MSG__NOT_FOUND);
-        }
+      for (String regionName : regionNames) {
+        resultData.accumulate("List of regions", regionName);
       }
-    } catch (FunctionInvocationTargetException e) {
-      result = ResultBuilder.createGemFireErrorResult(CliStrings
-          .format(CliStrings.COULD_NOT_EXECUTE_COMMAND_TRY_AGAIN, CliStrings.LIST_REGION));
-    } catch (Exception e) {
-      result = ResultBuilder
-          .createGemFireErrorResult(CliStrings.LIST_REGION__MSG__ERROR + " : " + e.getMessage());
     }
+
     return result;
   }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/NetstatCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/NetstatCommand.java
index 98e0fa0..f58fbf8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/NetstatCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/NetstatCommand.java
@@ -15,9 +15,11 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -27,6 +29,8 @@ import java.util.Map;
 import java.util.Set;
 import java.util.zip.DataFormatException;
 
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
@@ -35,15 +39,14 @@ import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.distributed.internal.InternalDistributedSystem;
 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.AbstractCliAroundInterceptor;
 import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.GfshParseResult;
 import org.apache.geode.management.internal.cli.GfshParser;
-import org.apache.geode.management.internal.cli.LogWrapper;
 import org.apache.geode.management.internal.cli.functions.NetstatFunction;
 import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.geode.management.internal.cli.remote.CommandExecutionContext;
-import org.apache.geode.management.internal.cli.result.InfoResultData;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission;
 
@@ -51,11 +54,13 @@ public class NetstatCommand extends InternalGfshCommand {
   private static final String NETSTAT_FILE_REQUIRED_EXTENSION = ".txt";
 
   @CliCommand(value = CliStrings.NETSTAT, help = CliStrings.NETSTAT__HELP)
-  @CliMetaData(relatedTopic = {CliStrings.TOPIC_GEODE_DEBUG_UTIL})
+  @CliMetaData(
+      interceptor = "org.apache.geode.management.internal.cli.commands.NetstatCommand$Interceptor",
+      relatedTopic = {CliStrings.TOPIC_GEODE_DEBUG_UTIL})
   @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
       operation = ResourcePermission.Operation.READ)
   // TODO : Verify the auto-completion for multiple values.
-  public Result netstat(
+  public ResultModel netstat(
       @CliOption(key = {CliStrings.MEMBER, CliStrings.MEMBERS},
           optionContext = ConverterHint.ALL_MEMBER_IDNAME,
           help = CliStrings.NETSTAT__MEMBER__HELP) String[] members,
@@ -66,7 +71,7 @@ public class NetstatCommand extends InternalGfshCommand {
       @CliOption(key = CliStrings.NETSTAT__WITHLSOF, specifiedDefaultValue = "true",
           unspecifiedDefaultValue = "false",
           help = CliStrings.NETSTAT__WITHLSOF__HELP) boolean withlsof) {
-    Result result;
+    ResultModel result = new ResultModel();
 
     Map<String, DistributedMember> hostMemberMap = new HashMap<>();
     Map<String, List<String>> hostMemberListMap = new HashMap<>();
@@ -156,34 +161,18 @@ public class NetstatCommand extends InternalGfshCommand {
           }
         }
       }
-
-      InfoResultData resultData = ResultBuilder.createInfoResultData();
       if (saveAs != null && !saveAs.isEmpty()) {
         String saveToFile = saveAs;
         if (!saveAs.endsWith(NETSTAT_FILE_REQUIRED_EXTENSION)) {
           saveToFile = saveAs + NETSTAT_FILE_REQUIRED_EXTENSION;
         }
-        resultData.addAsFile(saveToFile, resultInfo.toString(),
-            CliStrings.NETSTAT__MSG__SAVED_OUTPUT_IN_0, false); // Note: substitution for {0} will
-        // happen on client side.
+
+        result.addFile(FilenameUtils.getName(saveToFile), resultInfo.toString()); // Note:
+                                                                                  // substitution
+                                                                                  // for {0} will
       } else {
-        resultData.addLine(resultInfo.toString());
+        result.addInfo().addLine(resultInfo.toString());
       }
-      result = ResultBuilder.buildResult(resultData);
-    } catch (IllegalArgumentException e) {
-      LogWrapper.getInstance(getCache())
-          .info(CliStrings.format(
-              CliStrings.NETSTAT__MSG__ERROR_OCCURRED_WHILE_EXECUTING_NETSTAT_ON_0,
-              new Object[] {Arrays.toString(members)}));
-      result = ResultBuilder.createUserErrorResult(e.getMessage());
-    } catch (RuntimeException e) {
-      LogWrapper.getInstance(getCache())
-          .info(CliStrings.format(
-              CliStrings.NETSTAT__MSG__ERROR_OCCURRED_WHILE_EXECUTING_NETSTAT_ON_0,
-              new Object[] {Arrays.toString(members)}), e);
-      result = ResultBuilder.createGemFireErrorResult(
-          CliStrings.format(CliStrings.NETSTAT__MSG__ERROR_OCCURRED_WHILE_EXECUTING_NETSTAT_ON_0,
-              new Object[] {Arrays.toString(members)}));
     } finally {
       hostMemberMap.clear();
       hostMemberListMap.clear();
@@ -232,4 +221,31 @@ public class NetstatCommand extends InternalGfshCommand {
     }
     list.add(memberIdOrName);
   }
+
+  public static class Interceptor extends AbstractCliAroundInterceptor {
+    @Override
+    public ResultModel preExecution(GfshParseResult parseResult) {
+      String saveAs = parseResult.getParamValueAsString(CliStrings.NETSTAT__FILE);
+
+      if (saveAs != null && StringUtils.isEmpty(FilenameUtils.getName(saveAs))) {
+        return ResultModel.createError("Invalid file name: " + saveAs);
+      }
+
+      return ResultModel.createInfo("");
+    }
+
+    @Override
+    public ResultModel postExecution(GfshParseResult parseResult, ResultModel result, Path tempFile)
+        throws IOException {
+      // save the content to the file specified by the user
+      String saveAs = parseResult.getParamValueAsString(CliStrings.NETSTAT__FILE);
+      if (saveAs == null) {
+        return result;
+      }
+
+      File file = new File(saveAs).getAbsoluteFile();
+      result.saveFileTo(file.getParentFile());
+      return result;
+    }
+  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/model/FileResultModel.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/model/FileResultModel.java
index 8f8d28f..3b1c3d8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/model/FileResultModel.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/model/FileResultModel.java
@@ -37,6 +37,9 @@ public class FileResultModel {
 
   public FileResultModel() {}
 
+  /**
+   * @param fileName only the name of the file, should not include directory information
+   */
   public FileResultModel(String fileName, String content) {
     this.filename = fileName;
     this.data = content.getBytes();
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/model/ResultModel.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/model/ResultModel.java
index d416c32..9f12d80 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/model/ResultModel.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/result/model/ResultModel.java
@@ -322,10 +322,6 @@ public class ResultModel {
     return response;
   }
 
-  public static ResultModel createCommandProcessingError(String message) {
-    return createError("Error processing command: " + message);
-  }
-
   /**
    * Helper method to create an {@code InfoResultModel} named "info". This method will also set
    * the status to ERROR.
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandTest.java
index 97aadc0..adb71b9 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ConnectCommandTest.java
@@ -42,6 +42,7 @@ import org.mockito.ArgumentCaptor;
 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.model.ResultModel;
 import org.apache.geode.management.internal.cli.shell.Gfsh;
 import org.apache.geode.management.internal.cli.shell.OperationInvoker;
 import org.apache.geode.test.junit.rules.GfshParserRule;
@@ -54,6 +55,7 @@ public class ConnectCommandTest {
   private ConnectCommand connectCommand;
   private Gfsh gfsh;
   private CommandResult result;
+  private ResultModel resultModel;
   private OperationInvoker operationInvoker;
   private Properties properties;
   private ArgumentCaptor<File> fileCaptor;
@@ -69,9 +71,10 @@ public class ConnectCommandTest {
     when(connectCommand.getGfsh()).thenReturn(gfsh);
     doReturn(properties).when(connectCommand).loadProperties(any());
     result = mock(CommandResult.class);
-    when(connectCommand.httpConnect(any(), any(), anyBoolean())).thenReturn(result);
+    resultModel = mock(ResultModel.class);
+    when(connectCommand.httpConnect(any(), any(), anyBoolean())).thenReturn(resultModel);
     when(connectCommand.jmxConnect(any(), anyBoolean(), any(), any(), anyBoolean()))
-        .thenReturn(result);
+        .thenReturn(resultModel);
     fileCaptor = ArgumentCaptor.forClass(File.class);
   }
 
@@ -323,7 +326,7 @@ public class ConnectCommandTest {
     when(gfsh.getVersion()).thenReturn("1.5.1");
     when(operationInvoker.getRemoteVersion()).thenReturn("1.5.2");
     when(operationInvoker.isConnected()).thenReturn(true);
-    when(result.getStatus()).thenReturn(Result.Status.OK);
+    when(resultModel.getStatus()).thenReturn(Result.Status.OK);
 
     gfshParserRule.executeAndAssertThat(connectCommand, "connect --locator=localhost:4040")
         .statusIsSuccess();
@@ -334,7 +337,7 @@ public class ConnectCommandTest {
     when(gfsh.getVersion()).thenReturn("1.5.1");
     when(operationInvoker.getRemoteVersion()).thenReturn("1.5");
     when(operationInvoker.isConnected()).thenReturn(true);
-    when(result.getStatus()).thenReturn(Result.Status.OK);
+    when(resultModel.getStatus()).thenReturn(Result.Status.OK);
 
     gfshParserRule.executeAndAssertThat(connectCommand, "connect --locator=localhost:4040")
         .statusIsSuccess();
@@ -345,7 +348,7 @@ public class ConnectCommandTest {
     when(gfsh.getVersion()).thenReturn("1.5.1");
     when(operationInvoker.getRemoteVersion()).thenReturn("1.5.0");
     when(operationInvoker.isConnected()).thenReturn(true);
-    when(result.getStatus()).thenReturn(Result.Status.OK);
+    when(resultModel.getStatus()).thenReturn(Result.Status.OK);
 
     gfshParserRule.executeAndAssertThat(connectCommand, "connect --locator=localhost:4040")
         .statusIsSuccess();
@@ -368,7 +371,7 @@ public class ConnectCommandTest {
     when(operationInvoker.getRemoteVersion()).thenReturn("1.5");
     when(operationInvoker.isConnected()).thenReturn(true);
 
-    when(result.getStatus()).thenReturn(Result.Status.OK);
+    when(resultModel.getStatus()).thenReturn(Result.Status.OK);
     gfshParserRule.executeAndAssertThat(connectCommand, "connect --locator=localhost:4040")
         .statusIsSuccess();
   }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommandTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommandTest.java
index dce163b..09006c3 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommandTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListGatewayCommandTest.java
@@ -15,7 +15,6 @@ package org.apache.geode.management.internal.cli.commands;
  * the License.
  */
 import static java.util.stream.Collectors.toSet;
-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;
@@ -26,7 +25,6 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.stream.Stream;
 
-import org.json.JSONObject;
 import org.junit.Before;
 import org.junit.ClassRule;
 import org.junit.Test;
@@ -35,8 +33,9 @@ import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.management.GatewayReceiverMXBean;
 import org.apache.geode.management.internal.SystemManagementService;
 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.ModelCommandResult;
+import org.apache.geode.management.internal.cli.result.model.ResultModel;
+import org.apache.geode.test.junit.assertions.CommandResultAssert;
 import org.apache.geode.test.junit.rules.GfshParserRule;
 
 public class ListGatewayCommandTest {
@@ -67,7 +66,7 @@ public class ListGatewayCommandTest {
 
   @Test
   public void listGatewaysDisplaysGatewaySendersAndReceivers() {
-    CompositeResultData crd = ResultBuilder.createCompositeResultData();
+    ResultModel crd = new ResultModel();
     crd.setHeader(CliStrings.HEADER_GATEWAYS);
 
     doReturn(new String[] {"10.118.19.31(server-ny-2:33256)<v2>:1029",
@@ -75,38 +74,35 @@ public class ListGatewayCommandTest {
             .getConnectedGatewaySenders();
 
     command.accumulateListGatewayResult(crd, Collections.EMPTY_MAP, receiverBeans);
-    JSONObject tableContent = (JSONObject) crd.retrieveSectionByIndex(0).getSectionGfJsonObject()
-        .get("__tables__-GatewayReceiver Table");
-
-    assertThat(tableContent.get("content").toString()).contains(
-        "[\"10.118.19.31(server-ny-2:33256)<v2>:1029, 10.118.19.31(server-ny-1:33206)<v1>:1028\"]");
+    new CommandResultAssert(new ModelCommandResult(crd))
+        .hasTableSection("gatewayReceivers")
+        .hasColumn("Senders Connected")
+        .containsExactly(
+            "10.118.19.31(server-ny-2:33256)<v2>:1029, 10.118.19.31(server-ny-1:33206)<v1>:1028");
   }
 
   @Test
   public void listGatewaysDisplaysGatewayReceiversWhenEmpty() {
-    CompositeResultData crd = ResultBuilder.createCompositeResultData();
-    crd.setHeader(CliStrings.HEADER_GATEWAYS);
+    ResultModel crd = new ResultModel();
 
     doReturn(new String[0]).when(receiverMXBean).getConnectedGatewaySenders();
 
     command.accumulateListGatewayResult(crd, Collections.EMPTY_MAP, receiverBeans);
-    JSONObject tableContent = (JSONObject) crd.retrieveSectionByIndex(0).getSectionGfJsonObject()
-        .get("__tables__-GatewayReceiver Table");
-
-    assertThat(tableContent.get("content").toString()).contains("[\"\"]");
+    new CommandResultAssert(new ModelCommandResult(crd))
+        .hasTableSection("gatewayReceivers")
+        .hasColumn("Senders Connected").containsExactly("");
   }
 
   @Test
   public void listGatewaysDisplaysGatewayReceiversWhenNull() {
-    CompositeResultData crd = ResultBuilder.createCompositeResultData();
-    crd.setHeader(CliStrings.HEADER_GATEWAYS);
+    ResultModel crd = new ResultModel();
 
     doReturn(null).when(receiverMXBean).getConnectedGatewaySenders();
 
     command.accumulateListGatewayResult(crd, Collections.EMPTY_MAP, receiverBeans);
-    JSONObject tableContent = (JSONObject) crd.retrieveSectionByIndex(0).getSectionGfJsonObject()
-        .get("__tables__-GatewayReceiver Table");
 
-    assertThat(tableContent.get("content").toString()).contains("[\"\"]");
+    new CommandResultAssert(new ModelCommandResult(crd))
+        .hasTableSection("gatewayReceivers")
+        .hasColumn("Senders Connected").containsExactly("");
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/result/model/TabularResultModelTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/result/model/TabularResultModelTest.java
index 4ff70ad..2255ca4 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/result/model/TabularResultModelTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/result/model/TabularResultModelTest.java
@@ -23,6 +23,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import org.junit.Before;
 import org.junit.Test;
 
+import org.apache.geode.test.junit.assertions.TabularResultModelAssert;
 
 
 public class TabularResultModelTest {
@@ -111,5 +112,8 @@ public class TabularResultModelTest {
     assertThat(table1.getValuesInRow(0)).containsExactly("v1", "k1", "t1");
     assertThat(table1.getValuesInRow(1)).containsExactly("v2", "k2", "t2");
     assertThat(table1.getValuesInRow(2)).containsExactly("v3", "k3", "t3");
+
+    new TabularResultModelAssert(table1).hasRowContaining("v1", "k1", "t1")
+        .hasRowContaining("v3", "k3", "t3");
   }
 }
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshAbstractUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshAbstractUnitTest.java
index e062264..a9cb7bf 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshAbstractUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/shell/GfshAbstractUnitTest.java
@@ -29,7 +29,8 @@ import org.junit.Before;
 import org.junit.Test;
 import org.springframework.shell.core.CommandResult;
 
-import org.apache.geode.management.internal.cli.result.LegacyCommandResult;
+import org.apache.geode.management.internal.cli.result.ModelCommandResult;
+
 
 
 public class GfshAbstractUnitTest {
@@ -99,14 +100,14 @@ public class GfshAbstractUnitTest {
     commandResult = gfsh.executeCommand("echo --string=ApacheGeode!");
     assertThat(commandResult.isSuccess()).isTrue();
     verify(gfsh, times(0)).expandProperties("echo --string=ApacheGeode!");
-    assertThat(((LegacyCommandResult) commandResult.getResult()).getMessageFromContent())
+    assertThat(((ModelCommandResult) commandResult.getResult()).getMessageFromContent())
         .isEqualTo("ApacheGeode!");
 
     // '$' character present, should expand properties and delegate to default implementation.
     commandResult = gfsh.executeCommand("echo --string=SYS_USER:${SYS_USER}");
     assertThat(commandResult.isSuccess()).isTrue();
     verify(gfsh, times(1)).expandProperties("echo --string=SYS_USER:${SYS_USER}");
-    assertThat(((LegacyCommandResult) commandResult.getResult()).getMessageFromContent())
+    assertThat(((ModelCommandResult) commandResult.getResult()).getMessageFromContent())
         .isEqualTo("SYS_USER:" + System.getProperty("user.name"));
 
     // '$' character present but not variable referenced, should try to expand, find nothing (no
@@ -114,7 +115,7 @@ public class GfshAbstractUnitTest {
     commandResult = gfsh.executeCommand("echo --string=MyNameIs:$USER_NAME");
     assertThat(commandResult.isSuccess()).isTrue();
     verify(gfsh, times(1)).expandProperties("echo --string=MyNameIs:$USER_NAME");
-    assertThat(((LegacyCommandResult) commandResult.getResult()).getMessageFromContent())
+    assertThat(((ModelCommandResult) commandResult.getResult()).getMessageFromContent())
         .isEqualTo("MyNameIs:$USER_NAME");
   }
 }
diff --git a/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DescribeClientCommandDUnitTest.java b/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DescribeClientCommandDUnitTest.java
index 9ead39d..c3d361b 100644
--- a/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DescribeClientCommandDUnitTest.java
+++ b/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/DescribeClientCommandDUnitTest.java
@@ -18,7 +18,6 @@ package org.apache.geode.management.internal.cli.commands;
 import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
@@ -39,13 +38,13 @@ import org.apache.geode.cache.client.ClientRegionShortcut;
 import org.apache.geode.cache.query.CqAttributesFactory;
 import org.apache.geode.cache.query.QueryService;
 import org.apache.geode.internal.cache.GemFireCacheImpl;
-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.model.TabularResultModel;
 import org.apache.geode.test.dunit.SerializableConsumerIF;
 import org.apache.geode.test.dunit.rules.ClientVM;
 import org.apache.geode.test.dunit.rules.ClusterStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.assertions.CommandResultAssert;
 import org.apache.geode.test.junit.categories.GfshTest;
 import org.apache.geode.test.junit.rules.GfshCommandRule;
 
@@ -97,7 +96,7 @@ public class DescribeClientCommandDUnitTest {
     client2Vm4 = createClient(4, subscriptionEnabled);
     setupCqsOnVM(client2Vm4, STOCKS_REGION, "cq1", "cq2", "cq3");
 
-    waitForClientReady(3);
+    waitForClientReady(2);
 
     validateResults(subscriptionEnabled);
   }
@@ -111,75 +110,74 @@ public class DescribeClientCommandDUnitTest {
     client2Vm4 = createClient(4, subscriptionEnabled);
     setupCqsOnVM(client2Vm4, STOCKS_REGION, "cq1", "cq2", "cq3");
 
-    waitForClientReady(1);
+    waitForClientReady(2);
 
     validateResults(subscriptionEnabled);
   }
 
   private void validateResults(boolean subscriptionEnabled) {
-    CommandResult result = gfsh.executeCommand("list members");
-    Map<String, List<String>> members = result.getMapFromTableContent("members");
-    int server1Idx = members.get("Name").indexOf("server-1");
-    String server1 = members.get("Id").get(server1Idx);
-
-    result = gfsh.executeCommand("list clients");
-    String clientId = result.getColumnFromTableContent(CliStrings.LIST_CLIENT_COLUMN_Clients,
-        "section1", "TableForClientList").get(0);
-
-    result = gfsh.executeCommand("describe client --clientID=" + clientId);
-    assertThat(result.getStatus()).isEqualTo(Result.Status.OK);
-
-    Map<String, List<String>> table =
-        result.getMapFromTableContent("Pool Stats For Pool Name = DEFAULT");
-    Map<String, String> data = result.getMapFromSection("InfoSection");
-
-    assertThat(table.get(CliStrings.DESCRIBE_CLIENT_MIN_CONN).get(0)).isEqualTo("1");
-    assertThat(table.get(CliStrings.DESCRIBE_CLIENT_MAX_CONN).get(0)).isEqualTo("-1");
-    assertThat(table.get(CliStrings.DESCRIBE_CLIENT_REDUNDANCY).get(0)).isEqualTo("1");
+    TabularResultModel listMemberTable = gfsh.executeAndAssertThat("list members")
+        .statusIsSuccess()
+        .hasTableSection()
+        .hasRowSize(3).getActual();
+    String server1Id = listMemberTable.getValue("Id", 1);
+
+    TabularResultModel listClientsTable = gfsh.executeAndAssertThat("list clients")
+        .statusIsSuccess()
+        .hasTableSection()
+        .hasRowSize(2)
+        .getActual();
+    String clientId = listClientsTable.getValue("Client Name / ID", 0);
+
+    CommandResultAssert describeAssert =
+        gfsh.executeAndAssertThat("describe client --clientID=" + clientId)
+            .statusIsSuccess();
+    TabularResultModel describeClientTable = describeAssert.hasTableSection("DEFAULT").getActual();
+    Map<String, String> dataResult =
+        describeAssert.hasDataSection("infoSection").getActual().getContent();
+
+    assertThat(describeClientTable.getHeader()).isEqualTo("Pool Stats For Pool Name = DEFAULT");
+    assertThat(describeClientTable.getRowSize()).isEqualTo(1);
+    assertThat(describeClientTable.getValue(CliStrings.DESCRIBE_CLIENT_MIN_CONN, 0)).isEqualTo("1");
+    assertThat(describeClientTable.getValue(CliStrings.DESCRIBE_CLIENT_MAX_CONN, 0))
+        .isEqualTo("-1");
+    assertThat(describeClientTable.getValue(CliStrings.DESCRIBE_CLIENT_REDUNDANCY, 0))
+        .isEqualTo("1");
 
     if (subscriptionEnabled) {
-      assertThat(table.get(CliStrings.DESCRIBE_CLIENT_CQs).get(0)).isEqualTo("3");
-      assertThat(Integer.parseInt(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_QUEUE_SIZE)))
-          .isGreaterThanOrEqualTo(1);
-      assertThat(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_PRIMARY_SERVERS)).isEqualTo(server1);
+      assertThat(describeClientTable.getValue(CliStrings.DESCRIBE_CLIENT_CQs, 0)).isEqualTo("3");
+      assertThat(Integer.parseInt(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_QUEUE_SIZE)))
+          .isGreaterThan(0);
+      assertThat(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_PRIMARY_SERVERS))
+          .isEqualTo(server1Id);
     } else {
-      assertThat(table.get(CliStrings.DESCRIBE_CLIENT_CQs).get(0)).isEqualTo("1");
-      assertThat(Integer.parseInt(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_QUEUE_SIZE)))
-          .isEqualTo(0);
-      assertThat(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_PRIMARY_SERVERS)).isEqualTo("N.A.");
+      assertThat(describeClientTable.getValue(CliStrings.DESCRIBE_CLIENT_CQs, 0)).isEqualTo("1");
+      assertThat(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_QUEUE_SIZE)).isEqualTo("0");
+      assertThat(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_PRIMARY_SERVERS))
+          .isEqualTo("N.A.");
     }
 
-    assertThat(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_PUTS)).isEqualTo("2");
-    assertThat(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_LISTENER_CALLS)).isEqualTo("0");
-    assertThat(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_DURABLE)).isEqualTo("No");
-    assertThat(Integer.parseInt(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_THREADS)))
+    assertThat(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_PUTS)).isEqualTo("2");
+    assertThat(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_LISTENER_CALLS)).isEqualTo("0");
+    assertThat(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_DURABLE)).isEqualTo("No");
+
+    assertThat(Integer.parseInt(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_THREADS)))
+        .isGreaterThan(0);
+    assertThat(Integer.parseInt(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_CPU)))
         .isGreaterThan(0);
-    assertThat(Integer.parseInt(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_CPU))).isGreaterThan(0);
-    assertThat(Integer.parseInt(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_UP_TIME)))
+    assertThat(Integer.parseInt(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_UP_TIME)))
         .isGreaterThanOrEqualTo(0);
-    assertThat(Long.parseLong(data.get(CliStrings.DESCRIBE_CLIENT_COLUMN_PROCESS_CPU_TIME)))
+    assertThat(Long.parseLong(dataResult.get(CliStrings.DESCRIBE_CLIENT_COLUMN_PROCESS_CPU_TIME)))
         .isGreaterThan(0);
   }
 
-  void waitForClientReady(int cqsToWaitFor) {
+  void waitForClientReady(int clientsCount) {
     // Wait until all CQs are ready
-    await().until(() -> {
-      CommandResult r = gfsh.executeCommand("list clients");
-      if (r.getStatus() != Result.Status.OK) {
-        return false;
-      }
-
-      String clientId = r.getColumnFromTableContent(CliStrings.LIST_CLIENT_COLUMN_Clients,
-          "section1", "TableForClientList").get(0);
-      r = gfsh.executeCommand("describe client --clientID=" + clientId);
-      Map<String, List<String>> table =
-          r.getMapFromTableContent("Pool Stats For Pool Name = DEFAULT");
-
-      if (table.size() == 0 || table.get(CliStrings.DESCRIBE_CLIENT_CQs).size() == 0) {
-        return false;
-      }
-
-      return table.get(CliStrings.DESCRIBE_CLIENT_CQs).get(0).equals(cqsToWaitFor + "");
+    await().untilAsserted(() -> {
+      gfsh.executeAndAssertThat("list clients")
+          .statusIsSuccess()
+          .hasTableSection()
+          .hasRowSize(clientsCount);
     });
   }
 
diff --git a/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ListClientCommandDUnitTest.java b/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ListClientCommandDUnitTest.java
index 3ff9cef..b9b6b5f 100644
--- a/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ListClientCommandDUnitTest.java
+++ b/geode-cq/src/distributedTest/java/org/apache/geode/management/internal/cli/commands/ListClientCommandDUnitTest.java
@@ -18,6 +18,7 @@ import static org.assertj.core.api.Assertions.assertThat;
 import static org.junit.Assert.assertNotNull;
 
 import java.util.List;
+import java.util.Map;
 import java.util.Properties;
 
 import org.apache.commons.lang3.exception.ExceptionUtils;
@@ -33,7 +34,6 @@ import org.apache.geode.cache.client.ClientRegionFactory;
 import org.apache.geode.cache.client.ClientRegionShortcut;
 import org.apache.geode.cache.client.PoolManager;
 import org.apache.geode.cache.client.internal.PoolImpl;
-import org.apache.geode.management.internal.cli.result.CommandResult;
 import org.apache.geode.test.dunit.rules.ClientVM;
 import org.apache.geode.test.dunit.rules.ClusterStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
@@ -100,25 +100,21 @@ public class ListClientCommandDUnitTest {
 
     locator.waitTillClientsAreReadyOnServers("server-1", server1port, 2);
 
-    CommandResult result =
-        gfsh.executeAndAssertThat("list clients").statusIsSuccess().getCommandResult();
+    Map<String, List<String>> clientMap =
+        gfsh.executeAndAssertThat("list clients").statusIsSuccess()
+            .hasTableSection("clientList")
+            .hasRowSize(2).getActual().getContent();
 
-    List<String> clientList =
-        result.getColumnFromTableContent("Client Name / ID", "section1", "TableForClientList");
-    assertThat(clientList).hasSize(2);
     try {
-      assertThat(clientList.get(0)).contains("client-1");
-      assertThat(clientList.get(1)).contains("client-2");
+      assertThat(clientMap.get("Client Name / ID").get(0)).contains("client-1");
+      assertThat(clientMap.get("Client Name / ID").get(1)).contains("client-2");
     } catch (AssertionError e) {
-      assertThat(clientList.get(0)).contains("client-2");
-      assertThat(clientList.get(1)).contains("client-1");
+      assertThat(clientMap.get("Client Name / ID").get(0)).contains("client-2");
+      assertThat(clientMap.get("Client Name / ID").get(1)).contains("client-1");
     }
-
-    assertThat(
-        result.getColumnFromTableContent("Server Name / ID", "section1", "TableForClientList"))
-            .hasSize(2)
-            .containsExactlyInAnyOrder("member=server-1,port=" + server1port,
-                "member=server-1,port=" + server1port);
+    assertThat(clientMap.get("Server Name / ID"))
+        .containsExactlyInAnyOrder("member=server-1,port=" + server1port,
+            "member=server-1,port=" + server1port);
 
     // shutdown the clients
     cluster.stop(client1ID);
@@ -164,18 +160,14 @@ public class ListClientCommandDUnitTest {
     locator.waitTillClientsAreReadyOnServers("server-1", server1port, 1);
     locator.waitTillClientsAreReadyOnServers("server-2", server2port, 1);
 
-    CommandResult result =
-        gfsh.executeAndAssertThat("list clients").statusIsSuccess().getCommandResult();
-
-    List<String> clientList =
-        result.getColumnFromTableContent("Client Name / ID", "section1", "TableForClientList");
-    assertThat(clientList).hasSize(1);
-    assertThat(clientList.get(0)).contains("client-1");
+    Map<String, List<String>> content = gfsh.executeAndAssertThat("list clients").statusIsSuccess()
+        .hasTableSection("clientList").getActual().getContent();
+    assertThat(content.get("Client Name / ID")).hasSize(1);
+    assertThat(content.get("Client Name / ID").get(0)).containsSequence("client-1");
 
-    List<String> serverList =
-        result.getColumnFromTableContent("Server Name / ID", "section1", "TableForClientList");
-    assertThat(serverList).hasSize(1);
-    assertThat(serverList.get(0)).contains("server-1").contains("server-2");
+    assertThat(content.get("Server Name / ID")).hasSize(1);
+    assertThat(content.get("Server Name / ID").get(0)).containsSequence("server-2")
+        .containsSequence("server-1");
 
     // shutdown the clients
     cluster.stop(client1ID);
diff --git a/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/GfshCommandRule.java b/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
index 887b7ad..eb25ebf 100644
--- a/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
+++ b/geode-dunit/src/main/java/org/apache/geode/test/junit/rules/GfshCommandRule.java
@@ -240,6 +240,14 @@ public class GfshCommandRule extends DescribedExternalResource {
     return gfsh.getGfsh();
   }
 
+  /**
+   *
+   * @return Command result object
+   *
+   * @deprecated use executeAndAssertThat(command). if you really need to get the result object
+   *             to do assertion, you can use hasTable().getActual() or hasData().getActual
+   *             after that method call.
+   */
   public CommandResult executeCommand(String command) {
     gfsh.executeCommand(command);
     CommandResult result;
diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/AbstractResultModelAssert.java b/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/AbstractResultModelAssert.java
index 9ffca34..cbc528e 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/AbstractResultModelAssert.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/AbstractResultModelAssert.java
@@ -37,4 +37,8 @@ public abstract class AbstractResultModelAssert<S extends AbstractResultModelAss
   public AbstractCharSequenceAssert<?, String> hasFooter() {
     return assertThat(actual.getFooter());
   }
+
+  public T getActual() {
+    return this.actual;
+  }
 }
diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/CommandResultAssert.java b/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/CommandResultAssert.java
index b2ac7e1..c056017 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/CommandResultAssert.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/CommandResultAssert.java
@@ -338,6 +338,11 @@ public class CommandResultAssert
     return this;
   }
 
+  public CommandResultAssert hasNoSection(String... sectionName) {
+    assertThat(getResultModel().getSectionNames()).doesNotContain(sectionName);
+    return this;
+  }
+
   // convenience method to get the first info section. if more than one info section
   // use the sectionName to get it
   public InfoResultModelAssert hasInfoSection() {
diff --git a/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/TabularResultModelAssert.java b/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/TabularResultModelAssert.java
index 1c59249..dcc70af 100644
--- a/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/TabularResultModelAssert.java
+++ b/geode-junit/src/main/java/org/apache/geode/test/junit/assertions/TabularResultModelAssert.java
@@ -16,7 +16,9 @@
 package org.apache.geode.test.junit.assertions;
 
 import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.fail;
 
+import org.apache.commons.lang3.StringUtils;
 import org.assertj.core.api.ListAssert;
 
 import org.apache.geode.management.internal.cli.result.model.TabularResultModel;
@@ -33,12 +35,29 @@ public class TabularResultModelAssert
     return this;
   }
 
+  public TabularResultModelAssert hasRowContaining(String... rowValues) {
+
+    for (int i = 0; i < actual.getRowSize(); i++) {
+      try {
+        hasRow(i).contains(rowValues);
+        return this;
+      } catch (AssertionError ignore) {
+      } ;
+    }
+    fail("Did not find [" + StringUtils.join(rowValues, ", ") + "] in any rows");
+    return null;
+  }
+
 
   public TabularResultModelAssert hasColumnSize(int expectedSize) {
     assertThat(actual.getColumnSize()).isEqualTo(expectedSize);
     return this;
   }
 
+  public ListAssert<String> hasColumns() {
+    return assertThat(actual.getHeaders());
+  }
+
   /**
    * return a ListAssert for a column of values
    */
diff --git a/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/ListGatewaysCommandDUnitTest.java b/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/ListGatewaysCommandDUnitTest.java
index b42ea7b..233c945 100644
--- a/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/ListGatewaysCommandDUnitTest.java
+++ b/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/ListGatewaysCommandDUnitTest.java
@@ -27,7 +27,6 @@ import static org.apache.geode.management.MXBeanAwaitility.awaitGatewayReceiverM
 import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.Serializable;
-import java.util.List;
 import java.util.Properties;
 
 import org.junit.Before;
@@ -36,14 +35,11 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 
 import org.apache.geode.management.GatewayReceiverMXBean;
-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.CompositeResultData;
-import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.test.awaitility.GeodeAwaitility;
 import org.apache.geode.test.dunit.rules.ClusterStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.assertions.CommandResultAssert;
 import org.apache.geode.test.junit.categories.WanTest;
 import org.apache.geode.test.junit.rules.GfshCommandRule;
 
@@ -93,9 +89,7 @@ public class ListGatewaysCommandDUnitTest implements Serializable {
     locatorSite1.invoke(() -> validateMemberMXBeanProxy(getMember(server3.getVM())));
 
     String command = CliStrings.LIST_GATEWAY;
-    CommandResult cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.ERROR);
+    gfsh.executeAndAssertThat(command).statusIsError();
   }
 
   @Test
@@ -142,21 +136,12 @@ public class ListGatewaysCommandDUnitTest implements Serializable {
     locatorSite2.invoke(() -> validateGatewayReceiverMXBeanProxy(getMember(server5.getVM()), true));
 
     String command = CliStrings.LIST_GATEWAY;
-    CommandResult cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
-
-    TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-    List<String> result_senderIds =
-        tableResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-    assertThat(result_senderIds).contains("ln_Serial");
-    assertThat(result_senderIds).contains("ln_Parallel");
-    assertThat(result_senderIds).hasSize(5);
-
-    assertThat(((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)).isNull();
+    gfsh.executeAndAssertThat(command).statusIsSuccess()
+        .hasNoSection("gatewayReceivers")
+        .hasTableSection("gatewaySenders")
+        .hasRowSize(5).hasColumn("GatewaySender Id")
+        .containsExactlyInAnyOrder("ln_Parallel", "ln_Parallel", "ln_Serial", "ln_Serial",
+            "ln_Serial");
   }
 
   @Test
@@ -190,22 +175,12 @@ public class ListGatewaysCommandDUnitTest implements Serializable {
         "ln_Parallel", true, false));
 
     String command = CliStrings.LIST_GATEWAY;
-    CommandResult cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
-
-    TabularResultData tableResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-
-    List<String> ports = tableResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-    assertThat(ports).hasSize(2);
-
-    List<String> hosts = tableResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-    assertThat(hosts).hasSize(2);
-
-    assertThat(((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)).isNull();
+    gfsh.executeAndAssertThat(command).statusIsSuccess()
+        .hasNoSection("gatewaySenders")
+        .hasTableSection("gatewayReceivers")
+        .hasRowSize(2)
+        .hasColumns()
+        .containsExactlyInAnyOrder("Member", "Port", "Sender Count", "Senders Connected");
   }
 
   @Test
@@ -255,28 +230,12 @@ public class ListGatewaysCommandDUnitTest implements Serializable {
         "ln_Parallel", true, false));
 
     String command = CliStrings.LIST_GATEWAY;
-    CommandResult cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
-
-    TabularResultData tableSenderResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-    List<String> senders =
-        tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-    assertThat(senders).hasSize(4);
-
-    List<String> hosts = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-    assertThat(hosts).hasSize(4);
-
-    TabularResultData tableReceiverResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-    List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-    assertThat(ports).hasSize(1);
-
-    hosts = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-    assertThat(hosts).hasSize(1);
+    CommandResultAssert commandAssert = gfsh.executeAndAssertThat(command).statusIsSuccess();
+    commandAssert
+        .hasTableSection("gatewaySenders").hasRowSize(4)
+        .hasColumns().contains("GatewaySender Id", "Member");
+    commandAssert.hasTableSection("gatewayReceivers")
+        .hasRowSize(1).hasColumns().contains("Port", "Member");
   }
 
   @Test
@@ -327,87 +286,33 @@ public class ListGatewaysCommandDUnitTest implements Serializable {
         "ln_Parallel", true, false));
 
     String command = CliStrings.LIST_GATEWAY + " --" + CliStrings.GROUP + "=Serial_Sender";
-    CommandResult cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
-
-    TabularResultData tableSenderResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-    List<String> senders =
-        tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-    assertThat(senders).hasSize(4);
-    List<String> hosts = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER);
-    assertThat(hosts).hasSize(4);
+    gfsh.executeAndAssertThat(command).statusIsSuccess()
+        .hasTableSection("gatewaySenders").hasRowSize(4);
 
     command = CliStrings.LIST_GATEWAY + " --" + CliStrings.GROUP + "=Parallel_Sender";
-    cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-
-    tableSenderResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-    senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-    assertThat(senders).hasSize(5);
-
-    TabularResultData tableReceiverResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-    List<String> ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-    assertThat(ports).hasSize(1);
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
+    CommandResultAssert commandAssert = gfsh.executeAndAssertThat(command).statusIsSuccess();
+    commandAssert.hasTableSection("gatewaySenders")
+        .hasRowSize(5);
+    commandAssert.hasTableSection("gatewayReceivers").hasRowSize(1);
 
     command = CliStrings.LIST_GATEWAY + " --" + CliStrings.GROUP + "=Receiver_Group";
-    cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
-
-    tableSenderResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-    senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-    assertThat(senders).hasSize(1);
-
-    tableReceiverResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-    ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-    assertThat(ports).hasSize(1);
+    commandAssert = gfsh.executeAndAssertThat(command).statusIsSuccess();
+    commandAssert.hasTableSection("gatewaySenders")
+        .hasRowSize(1);
+    commandAssert.hasTableSection("gatewayReceivers").hasRowSize(1);
 
     command = CliStrings.LIST_GATEWAY + " --" + CliStrings.GROUP + "=Serial_Sender,Parallel_Sender";
-    cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
-
-    tableSenderResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-    senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-    assertThat(senders).hasSize(5);
-
-    tableReceiverResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-    ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-    assertThat(ports).hasSize(1);
+    commandAssert = gfsh.executeAndAssertThat(command).statusIsSuccess();
+    commandAssert.hasTableSection("gatewaySenders")
+        .hasRowSize(5);
+    commandAssert.hasTableSection("gatewayReceivers").hasRowSize(1);
 
     command = CliStrings.LIST_GATEWAY + " --" + CliStrings.GROUP
         + "=Serial_Sender,Parallel_Sender,Receiver_Group";
-    cmdResult = gfsh.executeCommand(command);
-    assertThat(cmdResult).isNotNull();
-    assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
-
-    tableSenderResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-    senders = tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-    assertThat(senders).hasSize(5);
-
-    tableReceiverResultData = ((CompositeResultData) cmdResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-    ports = tableReceiverResultData.retrieveAllValues(CliStrings.RESULT_PORT);
-    assertThat(ports).hasSize(1);
+    commandAssert = gfsh.executeAndAssertThat(command).statusIsSuccess();
+    commandAssert.hasTableSection("gatewaySenders")
+        .hasRowSize(5);
+    commandAssert.hasTableSection("gatewayReceivers").hasRowSize(1);
   }
 
   private MemberVM startServerWithGroups(int index, String groups, int locPort) {
@@ -446,21 +351,11 @@ public class ListGatewaysCommandDUnitTest implements Serializable {
 
     // Verify Results
     gfsh.connect(locatorSite1);
-    CommandResult listGatewaysCommandResult = gfsh.executeCommand(CliStrings.LIST_GATEWAY);
-    assertThat(listGatewaysCommandResult).isNotNull();
-    assertThat(listGatewaysCommandResult.getStatus()).isSameAs(Result.Status.OK);
-    TabularResultData gatewayReceiversResultData =
-        ((CompositeResultData) listGatewaysCommandResult.getResultData())
-            .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-            .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-    assertThat(gatewayReceiversResultData.retrieveAllValues(CliStrings.RESULT_PORT)).hasSize(1);
-    assertThat(gatewayReceiversResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER))
-        .hasSize(1);
-    List<String> sendersCount =
-        gatewayReceiversResultData.retrieveAllValues(CliStrings.RESULT_SENDERS_COUNT);
-    assertThat(sendersCount).hasSize(1).doesNotContain("0");
-    assertThat(((CompositeResultData) listGatewaysCommandResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)).isNull();
+    gfsh.executeAndAssertThat(CliStrings.LIST_GATEWAY).statusIsSuccess()
+        .hasNoSection("gatewaySenders")
+        .hasTableSection("gatewayReceivers")
+        .hasRowSize(1)
+        .hasColumn("Sender Count").doesNotContain("0");
 
     // Stop receivers in Site #1 and Verify Sender Count
     server1.invoke(WANCommandUtils::stopReceivers);
@@ -468,18 +363,10 @@ public class ListGatewaysCommandDUnitTest implements Serializable {
     locatorSite1
         .invoke(() -> validateGatewayReceiverMXBeanProxy(getMember(server1.getVM()), false));
     gfsh.connect(locatorSite1);
-    listGatewaysCommandResult = gfsh.executeCommand(CliStrings.LIST_GATEWAY);
-    assertThat(listGatewaysCommandResult).isNotNull();
-    assertThat(listGatewaysCommandResult.getStatus()).isSameAs(Result.Status.OK);
-    gatewayReceiversResultData = ((CompositeResultData) listGatewaysCommandResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_RECEIVER)
-        .retrieveTable(CliStrings.TABLE_GATEWAY_RECEIVER);
-    assertThat(gatewayReceiversResultData.retrieveAllValues(CliStrings.RESULT_PORT)).hasSize(1);
-    assertThat(gatewayReceiversResultData.retrieveAllValues(CliStrings.RESULT_HOST_MEMBER))
-        .hasSize(1);
-    sendersCount = gatewayReceiversResultData.retrieveAllValues(CliStrings.RESULT_SENDERS_COUNT);
-    assertThat(sendersCount).hasSize(1).containsExactly("0");
-    assertThat(((CompositeResultData) listGatewaysCommandResult.getResultData())
-        .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)).isNull();
+    gfsh.executeAndAssertThat(CliStrings.LIST_GATEWAY).statusIsSuccess()
+        .hasNoSection("gatewaySenders")
+        .hasTableSection("gatewayReceivers")
+        .hasRowSize(1)
+        .hasColumn("Sender Count").containsExactly("0");
   }
 }
diff --git a/geode-wan/src/distributedTest/java/org/apache/geode/management/internal/configuration/WANClusterConfigurationDUnitTest.java b/geode-wan/src/distributedTest/java/org/apache/geode/management/internal/configuration/WANClusterConfigurationDUnitTest.java
index 1e6824f..5d08355 100644
--- a/geode-wan/src/distributedTest/java/org/apache/geode/management/internal/configuration/WANClusterConfigurationDUnitTest.java
+++ b/geode-wan/src/distributedTest/java/org/apache/geode/management/internal/configuration/WANClusterConfigurationDUnitTest.java
@@ -21,7 +21,6 @@ import static org.apache.geode.test.dunit.Assert.assertTrue;
 import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException;
 import static org.assertj.core.api.Assertions.assertThat;
 
-import java.util.List;
 import java.util.Set;
 
 import org.junit.Before;
@@ -31,11 +30,7 @@ import org.junit.experimental.categories.Category;
 
 import org.apache.geode.cache.wan.GatewayReceiver;
 import org.apache.geode.cache.wan.GatewaySender;
-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.CompositeResultData;
-import org.apache.geode.management.internal.cli.result.TabularResultData;
 import org.apache.geode.management.internal.cli.util.CommandStringBuilder;
 import org.apache.geode.test.dunit.rules.ClusterStartupRule;
 import org.apache.geode.test.dunit.rules.MemberVM;
@@ -220,16 +215,8 @@ public class WANClusterConfigurationDUnitTest {
 
   private void waitTillAllGatewaySendersAreReady() {
     await().untilAsserted(() -> {
-      CommandStringBuilder csb2 = new CommandStringBuilder(CliStrings.LIST_GATEWAY);
-      CommandResult cmdResult = gfsh.executeCommand(csb2.toString());
-      assertThat(cmdResult).isNotNull();
-      assertThat(cmdResult.getStatus()).isSameAs(Result.Status.OK);
-      TabularResultData tableSenderResultData = ((CompositeResultData) cmdResult.getResultData())
-          .retrieveSection(CliStrings.SECTION_GATEWAY_SENDER)
-          .retrieveTable(CliStrings.TABLE_GATEWAY_SENDER);
-      List<String> senders =
-          tableSenderResultData.retrieveAllValues(CliStrings.RESULT_GATEWAY_SENDER_ID);
-      assertThat(senders).hasSize(4);
+      gfsh.executeAndAssertThat(CliStrings.LIST_GATEWAY).statusIsSuccess()
+          .hasTableSection("gatewaySenders").hasRowSize(4);
     });
   }
 
diff --git a/geode-web/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpTest.java b/geode-web/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpTest.java
index 426576e..9162d04 100644
--- a/geode-web/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpTest.java
+++ b/geode-web/src/integrationTest/java/org/apache/geode/management/internal/cli/commands/CommandOverHttpTest.java
@@ -15,7 +15,6 @@
 
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.assertj.core.api.Assertions.assertThat;
 
 import java.io.File;
 import java.nio.file.Paths;
@@ -27,8 +26,6 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.rules.TemporaryFolder;
 
-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.GfshTest;
 import org.apache.geode.test.junit.rules.GfshCommandRule;
@@ -56,16 +53,18 @@ public class CommandOverHttpTest {
 
   @Test
   public void testListClient() throws Exception {
-    CommandResult result = gfshRule.executeCommand("list clients");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.toString()).contains("No clients were retrieved for cache-servers");
+    gfshRule.executeAndAssertThat("list clients")
+        .statusIsError()
+        .hasInfoSection().hasOutput()
+        .isEqualTo("No clients were retrieved for cache-servers.");
   }
 
   @Test
   public void testDescribeClient() throws Exception {
-    CommandResult result = gfshRule.executeCommand("describe client --clientID=xyz");
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
-    assertThat(result.getErrorMessage()).contains("Specified Client ID xyz not present");
+    gfshRule.executeAndAssertThat("describe client --clientID=xyz")
+        .statusIsError()
+        .hasInfoSection().hasOutput()
+        .contains("Specified Client ID xyz not present");
   }
 
   @Test


Mime
View raw message