You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by je...@apache.org on 2018/03/27 12:59:07 UTC

[geode] branch develop updated: GEODE-4943: Move isConnectedAndReady method to public class (#1681)

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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 6bccecf  GEODE-4943: Move isConnectedAndReady method to public class (#1681)
6bccecf is described below

commit 6bccecfb5bcaaf4491e27f14f5f7405db26ce81e
Author: Jens Deppe <jd...@pivotal.io>
AuthorDate: Tue Mar 27 05:59:00 2018 -0700

    GEODE-4943: Move isConnectedAndReady method to public class (#1681)
    
    - Remove unnecessary findMembersWithAsyncEventQueue method which was
      inadvertently included originally.
---
 .../java/org/apache/geode/management/cli/GfshCommand.java  | 10 ++++++----
 .../internal/cli/commands/InternalGfshCommand.java         |  4 ----
 .../internal/cli/commands/GfshCommandJUnitTest.java        | 14 --------------
 3 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/geode-core/src/main/java/org/apache/geode/management/cli/GfshCommand.java b/geode-core/src/main/java/org/apache/geode/management/cli/GfshCommand.java
index fe28622..fad6922 100644
--- a/geode-core/src/main/java/org/apache/geode/management/cli/GfshCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/cli/GfshCommand.java
@@ -35,12 +35,18 @@ import org.apache.geode.management.internal.cli.CliUtil;
 import org.apache.geode.management.internal.cli.exceptions.EntityNotFoundException;
 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.shell.Gfsh;
 import org.apache.geode.security.ResourcePermission;
 
 @Experimental
 public abstract class GfshCommand implements CommandMarker {
   private InternalCache cache;
 
+  public boolean isConnectedAndReady() {
+    Gfsh gfsh = Gfsh.getCurrentInstance();
+    return gfsh != null && gfsh.isConnectedAndReady();
+  }
+
   public void authorize(ResourcePermission.Resource resource,
       ResourcePermission.Operation operation, ResourcePermission.Target target) {
     cache.getSecurityService().authorize(resource, operation, target);
@@ -170,8 +176,4 @@ public abstract class GfshCommand implements CommandMarker {
     ResultCollector rc = executeFunction(function, args, targetMembers);
     return CliFunctionResult.cleanResults((List<?>) rc.getResult());
   }
-
-  public Set<DistributedMember> findMembersWithAsyncEventQueue(String queueId) {
-    return CliUtil.getMembersWithAsyncEventQueue((InternalCache) getCache(), queueId);
-  }
 }
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/InternalGfshCommand.java b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/InternalGfshCommand.java
index e05b551..e32c730 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/InternalGfshCommand.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/InternalGfshCommand.java
@@ -37,10 +37,6 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 public abstract class InternalGfshCommand extends GfshCommand implements CommandMarker {
   public static final String EXPERIMENTAL = "(Experimental) ";
 
-  public boolean isConnectedAndReady() {
-    return getGfsh() != null && getGfsh().isConnectedAndReady();
-  }
-
   public void persistClusterConfiguration(Result result, Runnable runnable) {
     if (result == null) {
       throw new IllegalArgumentException("Result should not be null");
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
index 55288e9..177c4be 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/GfshCommandJUnitTest.java
@@ -49,20 +49,6 @@ public class GfshCommandJUnitTest {
   }
 
   @Test
-  public void isConnectedAndReady() throws Exception {
-    when(command.getGfsh()).thenReturn(null);
-    assertThat(command.isConnectedAndReady()).isFalse();
-
-    when(command.getGfsh()).thenReturn(gfsh);
-    when(gfsh.isConnectedAndReady()).thenReturn(false);
-    assertThat(command.isConnectedAndReady()).isFalse();
-
-    when(command.getGfsh()).thenReturn(gfsh);
-    when(gfsh.isConnectedAndReady()).thenReturn(true);
-    assertThat(command.isConnectedAndReady()).isTrue();
-  }
-
-  @Test
   public void persistClusterConfiguration() throws Exception {
     when(command.getConfigurationService()).thenReturn(null);
     Result result = ResultBuilder.createInfoResult("info");

-- 
To stop receiving notification emails like this one, please contact
jensdeppe@apache.org.