geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kl...@apache.org
Subject [39/50] [abbrv] geode git commit: GEODE-2199: be able to deploy jars without running servers
Date Fri, 20 Jan 2017 22:53:35 GMT
GEODE-2199: be able to deploy jars without running servers

* renamed the CliUtils.findAllMatchingServers to findMembersOrThrow to better describe the
behavior

(cherry picked from commit 80dd57b)


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

Branch: refs/heads/feature/GEODE-1930-2
Commit: e06bf2dba95d67061aed8e376d4da6916959d6e4
Parents: 6f418be
Author: Jinmei Liao <jiliao@pivotal.io>
Authored: Wed Jan 18 13:54:22 2017 -0800
Committer: Jinmei Liao <jiliao@pivotal.io>
Committed: Thu Jan 19 10:36:17 2017 -0800

----------------------------------------------------------------------
 .../geode/management/internal/cli/CliUtil.java  | 133 ++++++++++---------
 .../internal/cli/commands/ConfigCommands.java   |  32 +++--
 .../CreateAlterDestroyRegionCommands.java       |   2 +-
 .../internal/cli/commands/DeployCommands.java   |  65 ++++-----
 .../cli/commands/DiskStoreCommands.java         |   4 +-
 .../cli/commands/DurableClientCommands.java     |   8 +-
 .../internal/cli/commands/FunctionCommands.java |   2 +-
 .../internal/cli/commands/IndexCommands.java    |   6 +-
 .../cli/commands/MiscellaneousCommands.java     |   2 +-
 .../internal/cli/commands/QueueCommands.java    |   4 +-
 .../internal/cli/commands/RegionCommands.java   |   2 +-
 .../internal/cli/commands/WanCommands.java      |  24 ++--
 .../internal/cli/CliUtilDUnitTest.java          |  33 +++--
 .../internal/configuration/ClusterConfig.java   |   2 +-
 .../ClusterConfigDeployJarDUnitTest.java        |  11 +-
 .../dunit/rules/GfshShellConnectionRule.java    |   4 +-
 .../internal/cli/LuceneIndexCommands.java       |   2 +-
 17 files changed, 169 insertions(+), 167 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
index 5b9a6bd..8525b58 100755
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/CliUtil.java
@@ -14,6 +14,30 @@
  */
 package org.apache.geode.management.internal.cli;
 
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheClosedException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.execute.Execution;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionService;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.ClassPathLoader;
+import org.apache.geode.internal.cache.execute.AbstractExecution;
+import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
+import org.apache.geode.internal.lang.StringUtils;
+import org.apache.geode.internal.util.IOUtils;
+import org.apache.geode.management.DistributedSystemMXBean;
+import org.apache.geode.management.ManagementService;
+import org.apache.geode.management.cli.Result;
+import org.apache.geode.management.internal.cli.functions.MembersForRegionFunction;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
+import org.apache.geode.management.internal.cli.result.CommandResultException;
+import org.apache.geode.management.internal.cli.result.ResultBuilder;
+import org.apache.geode.management.internal.cli.shell.Gfsh;
+
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileFilter;
@@ -36,37 +60,12 @@ import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Scanner;
-import java.util.Set;
 import java.util.Map.Entry;
+import java.util.Set;
 import java.util.zip.DataFormatException;
 import java.util.zip.Deflater;
 import java.util.zip.Inflater;
 
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.CacheClosedException;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.execute.Execution;
-import org.apache.geode.cache.execute.Function;
-import org.apache.geode.cache.execute.FunctionService;
-import org.apache.geode.cache.execute.ResultCollector;
-import org.apache.geode.distributed.DistributedMember;
-import org.apache.geode.distributed.internal.InternalDistributedSystem;
-import org.apache.geode.internal.ClassPathLoader;
-import org.apache.geode.internal.cache.execute.AbstractExecution;
-import org.apache.geode.internal.cache.tier.sockets.CacheClientProxy;
-import org.apache.geode.internal.lang.StringUtils;
-import org.apache.geode.internal.util.IOUtils;
-import org.apache.geode.management.DistributedSystemMXBean;
-import org.apache.geode.management.ManagementService;
-import org.apache.geode.management.cli.Result;
-import org.apache.geode.management.internal.cli.functions.MembersForRegionFunction;
-import org.apache.geode.management.internal.cli.i18n.CliStrings;
-import org.apache.geode.management.internal.cli.result.CommandResultException;
-import org.apache.geode.management.internal.cli.result.ResultBuilder;
-import org.apache.geode.management.internal.cli.shell.Gfsh;
-
 /**
  * This class contains utility methods used by classes used to build the Command Line Interface
  * (CLI).
@@ -281,61 +280,65 @@ public class CliUtil {
 
 
 
-  public static Set<DistributedMember> findAllMatchingMembers(final String groups,
-      final String members) throws CommandResultException {
+  public static Set<DistributedMember> findMembersOrThrow(final String groups, final
String members)
+      throws CommandResultException {
 
-    String[] groupsArray = (groups == null ? null : groups.split(","));
-    String[] membersArray = (members == null ? null : members.split(","));
+    String[] groupsArray = (groups == null ? new String[] {} : groups.split(","));
+    String[] membersArray = (members == null ? new String[] {} : members.split(","));
 
-    return findAllMatchingMembers(groupsArray, membersArray);
+    return findMembersOrThrow(groupsArray, membersArray);
   }
 
-  public static Set<DistributedMember> findAllMatchingMembers(final String[] groups,
+  public static Set<DistributedMember> findMembersOrThrow(final String[] groups,
       final String[] members) throws CommandResultException {
-    Set<DistributedMember> matchingMembers = new HashSet<DistributedMember>();
-    Cache cache = CacheFactory.getAnyInstance();
 
-    if ((members != null && members.length > 0) && (groups != null &&
groups.length > 0)) {
+    Set<DistributedMember> matchingMembers = findMembers(groups, members);
+    if (matchingMembers.isEmpty()) {
       throw new CommandResultException(
-          ResultBuilder.createUserErrorResult(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE));
+          ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE));
+    }
+
+    return matchingMembers;
+  }
+
+  public static Set<DistributedMember> findMembers(String[] groups, String[] members)
{
+    if (groups == null) {
+      groups = new String[] {};
+    }
+
+    if (members == null) {
+      members = new String[] {};
+    }
+
+    Cache cache = CacheFactory.getAnyInstance();
+
+    if ((members.length > 0) && (groups.length > 0)) {
+      throw new IllegalArgumentException(CliStrings.PROVIDE_EITHER_MEMBER_OR_GROUP_MESSAGE);
     }
 
-    if (members != null && members.length > 0) {
-      for (String memberNameOrId : members) {
-        DistributedMember member = getDistributedMemberByNameOrId(memberNameOrId);
-        if (member != null) {
+    Set<DistributedMember> allNormalMembers = getAllNormalMembers(cache);
+    if (members.length == 0 && groups.length == 0) {
+      return allNormalMembers;
+    }
+
+    Set<DistributedMember> matchingMembers = new HashSet<DistributedMember>();
+    // it will either go into this loop or the following loop, not both.
+    for (String memberNameOrId : members) {
+      for (DistributedMember member : allNormalMembers) {
+        if (memberNameOrId.equalsIgnoreCase(member.getId())
+            || memberNameOrId.equals(member.getName())) {
           matchingMembers.add(member);
-        } else {
-          throw new CommandResultException(ResultBuilder.createUserErrorResult(
-              CliStrings.format(CliStrings.MEMBER_NOT_FOUND_ERROR_MESSAGE, memberNameOrId)));
         }
       }
-    } else if (groups != null && groups.length > 0) {
-      Set<DistributedMember> allNormalMembers = getAllNormalMembers(cache);
-      for (String group : groups) {
-        Set<DistributedMember> groupMembers = new HashSet<DistributedMember>();
-        for (DistributedMember member : allNormalMembers) {
-          if (member.getGroups().contains(group)) {
-            groupMembers.add(member);
-          }
-        }
-
-        if (!groupMembers.isEmpty()) {
-          matchingMembers.addAll(groupMembers);
+    }
 
-        } else {
-          throw new CommandResultException(ResultBuilder.createUserErrorResult(
-              CliStrings.format(CliStrings.NO_MEMBERS_IN_GROUP_ERROR_MESSAGE, group)));
+    for (String group : groups) {
+      for (DistributedMember member : allNormalMembers) {
+        if (member.getGroups().contains(group)) {
+          matchingMembers.add(member);
         }
       }
-    } else {
-      matchingMembers.addAll(getAllNormalMembers(cache));
-      if (matchingMembers.isEmpty()) {
-        throw new CommandResultException(
-            ResultBuilder.createUserErrorResult(CliStrings.NO_MEMBERS_FOUND_MESSAGE));
-      }
     }
-
     return matchingMembers;
   }
 

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
index 5154b75..12a0a64 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/ConfigCommands.java
@@ -14,19 +14,7 @@
  */
 package org.apache.geode.management.internal.cli.commands;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-import java.util.TreeSet;
+import static org.apache.geode.distributed.ConfigurationProperties.STATISTIC_SAMPLING_ENABLED;
 
 import org.apache.geode.SystemFailure;
 import org.apache.geode.cache.CacheClosedException;
@@ -57,12 +45,22 @@ import org.apache.geode.management.internal.configuration.domain.XmlEntity;
 import org.apache.geode.management.internal.security.ResourceOperation;
 import org.apache.geode.security.ResourcePermission.Operation;
 import org.apache.geode.security.ResourcePermission.Resource;
-
-import org.springframework.shell.core.CommandMarker;
 import org.springframework.shell.core.annotation.CliAvailabilityIndicator;
 import org.springframework.shell.core.annotation.CliCommand;
 import org.springframework.shell.core.annotation.CliOption;
 
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.TreeSet;
+
 /****
  * @since GemFire 7.0
  *
@@ -212,7 +210,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
 
     Set<DistributedMember> targetMembers;
     try {
-      targetMembers = CliUtil.findAllMatchingMembers(group, member);
+      targetMembers = CliUtil.findMembersOrThrow(group, member);
     } catch (CommandResultException crex) {
       return crex.getResult();
     }
@@ -307,7 +305,7 @@ public class ConfigCommands extends AbstractCommandsSupport {
 
     try {
 
-      targetMembers = CliUtil.findAllMatchingMembers(group, memberNameOrId);
+      targetMembers = CliUtil.findMembersOrThrow(group, memberNameOrId);
 
       if (archiveDiskSpaceLimit != null) {
         runTimeDistributionConfigAttributes.put(

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
index e8173f1..6dd5615 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/CreateAlterDestroyRegionCommands.java
@@ -582,7 +582,7 @@ public class CreateAlterDestroyRegionCommands extends AbstractCommandsSupport
{
 
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(groups, null);
+        targetMembers = CliUtil.findMembersOrThrow(groups, null);
       } catch (CommandResultException crex) {
         return crex.getResult();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommands.java
index a6b4575..bd67728 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommands.java
@@ -96,53 +96,40 @@ public final class DeployCommands extends AbstractCommandsSupport {
       String[] jarNames = CliUtil.bytesToNames(shellBytesData);
       byte[][] jarBytes = CliUtil.bytesToData(shellBytesData);
 
-      boolean accumulatedData = false;
-
       Set<DistributedMember> targetMembers;
-      try {
-        targetMembers = CliUtil.findAllMatchingMembers(groups, null);
-      } catch (CommandResultException e) {
-        return e.getResult();
-      }
 
-      // this deploys the jars to all the matching servers
-      ResultCollector<?, ?> resultCollector = CliUtil.executeFunction(this.deployFunction,
-          new Object[] {jarNames, jarBytes}, targetMembers);
+      targetMembers = CliUtil.findMembers(groups, null);
 
-      List<CliFunctionResult> results =
-          CliFunctionResult.cleanResults((List<?>) resultCollector.getResult());
+      if (targetMembers.size() > 0) {
+        // this deploys the jars to all the matching servers
+        ResultCollector<?, ?> resultCollector = CliUtil.executeFunction(this.deployFunction,
+            new Object[] {jarNames, jarBytes}, targetMembers);
 
-      for (CliFunctionResult result : results) {
-        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());
-          accumulatedData = true;
-          tabularData.setStatus(Status.ERROR);
-        } else {
-          String[] strings = (String[]) result.getSerializables();
-          for (int i = 0; i < strings.length; i += 2) {
+        List<CliFunctionResult> results =
+            CliFunctionResult.cleanResults((List<?>) resultCollector.getResult());
+
+        for (CliFunctionResult result : results) {
+          if (result.getThrowable() != null) {
             tabularData.accumulate("Member", result.getMemberIdOrName());
-            tabularData.accumulate("Deployed JAR", strings[i]);
-            tabularData.accumulate("Deployed JAR Location", strings[i + 1]);
-            accumulatedData = true;
+            tabularData.accumulate("Deployed JAR", "");
+            tabularData.accumulate("Deployed JAR Location",
+                "ERROR: " + result.getThrowable().getClass().getName() + ": "
+                    + result.getThrowable().getMessage());
+            tabularData.setStatus(Status.ERROR);
+          } else {
+            String[] strings = (String[]) result.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]);
+            }
           }
         }
       }
 
-      if (!accumulatedData) {
-        // This really should never happen since if a JAR file is already deployed a result
is
-        // returned indicating that.
-        return ResultBuilder.createInfoResult("Unable to deploy JAR file(s)");
-      }
-
       Result result = ResultBuilder.buildResult(tabularData);
-      if (tabularData.getStatus().equals(Status.OK)) {
-        persistClusterConfiguration(result,
-            () -> getSharedConfiguration().addJarsToThisLocator(jarNames, jarBytes, groups));
-      }
+      persistClusterConfiguration(result,
+          () -> getSharedConfiguration().addJarsToThisLocator(jarNames, jarBytes, groups));
       return result;
     } catch (NotAuthorizedException e) {
       // for NotAuthorizedException, will catch this later in the code
@@ -181,7 +168,7 @@ public final class DeployCommands extends AbstractCommandsSupport {
 
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(groups, null);
+        targetMembers = CliUtil.findMembersOrThrow(groups, null);
       } catch (CommandResultException crex) {
         return crex.getResult();
       }
@@ -249,7 +236,7 @@ public final class DeployCommands extends AbstractCommandsSupport {
 
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(group, null);
+        targetMembers = CliUtil.findMembersOrThrow(group, null);
       } catch (CommandResultException crex) {
         return crex.getResult();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
index ab8d02a..9116ba3 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommands.java
@@ -364,7 +364,7 @@ public class DiskStoreCommands extends AbstractCommandsSupport {
 
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(groups, null);
+        targetMembers = CliUtil.findMembersOrThrow(groups, null);
       } catch (CommandResultException crex) {
         return crex.getResult();
       }
@@ -1445,7 +1445,7 @@ public class DiskStoreCommands extends AbstractCommandsSupport {
 
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(groups, null);
+        targetMembers = CliUtil.findMembersOrThrow(groups, null);
       } catch (CommandResultException crex) {
         return crex.getResult();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DurableClientCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DurableClientCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DurableClientCommands.java
index 053f3eb..bcbfcf0 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DurableClientCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DurableClientCommands.java
@@ -84,7 +84,7 @@ public class DurableClientCommands extends AbstractCommandsSupport {
       boolean noResults = true;
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(group, memberNameOrId);
+        targetMembers = CliUtil.findMembersOrThrow(group, memberNameOrId);
       } catch (CommandResultException e) {
         return e.getResult();
       }
@@ -162,7 +162,7 @@ public class DurableClientCommands extends AbstractCommandsSupport {
     try {
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(group, memberNameOrId);
+        targetMembers = CliUtil.findMembersOrThrow(group, memberNameOrId);
       } catch (CommandResultException e) {
         return e.getResult();
       }
@@ -209,7 +209,7 @@ public class DurableClientCommands extends AbstractCommandsSupport {
     try {
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(group, memberNameOrId);
+        targetMembers = CliUtil.findMembersOrThrow(group, memberNameOrId);
       } catch (CommandResultException e) {
         return e.getResult();
       }
@@ -249,7 +249,7 @@ public class DurableClientCommands extends AbstractCommandsSupport {
     try {
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(group, memberNameOrId);
+        targetMembers = CliUtil.findMembersOrThrow(group, memberNameOrId);
       } catch (CommandResultException e) {
         return e.getResult();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
index 9a9ece9..91810e8 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/FunctionCommands.java
@@ -577,7 +577,7 @@ public class FunctionCommands implements CommandMarker {
 
     Set<DistributedMember> targetMembers;
     try {
-      targetMembers = CliUtil.findAllMatchingMembers(groups, members);
+      targetMembers = CliUtil.findMembersOrThrow(groups, members);
     } catch (CommandResultException crex) {
       return crex.getResult();
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
index 6e03c11..080d520 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/IndexCommands.java
@@ -236,7 +236,7 @@ public class IndexCommands extends AbstractCommandsSupport {
       IndexInfo indexInfo = new IndexInfo(indexName, indexedExpression, regionPath, idxType);
 
       final Set<DistributedMember> targetMembers =
-          CliUtil.findAllMatchingMembers(group, memberNameOrID);
+          CliUtil.findMembersOrThrow(group, memberNameOrID);
       final ResultCollector<?, ?> rc =
           CliUtil.executeFunction(createIndexFunction, indexInfo, targetMembers);
 
@@ -365,7 +365,7 @@ public class IndexCommands extends AbstractCommandsSupport {
     Set<DistributedMember> targetMembers = null;
 
     try {
-      targetMembers = CliUtil.findAllMatchingMembers(group, memberNameOrID);
+      targetMembers = CliUtil.findMembersOrThrow(group, memberNameOrID);
     } catch (CommandResultException e) {
       return e.getResult();
     }
@@ -556,7 +556,7 @@ public class IndexCommands extends AbstractCommandsSupport {
       final Cache cache = CacheFactory.getAnyInstance();
 
       final Set<DistributedMember> targetMembers =
-          CliUtil.findAllMatchingMembers(group, memberNameOrID);
+          CliUtil.findMembersOrThrow(group, memberNameOrID);
       final ResultCollector<?, ?> rc =
           CliUtil.executeFunction(createDefinedIndexesFunction, indexDefinitions, targetMembers);
 

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
index 88a9919..bbf0542 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/MiscellaneousCommands.java
@@ -1055,7 +1055,7 @@ public class MiscellaneousCommands implements CommandMarker {
           && (memberNameOrId == null || memberNameOrId.isEmpty())) {
         targetMembers = CliUtil.getAllMembers(cache);
       } else {
-        targetMembers = CliUtil.findAllMatchingMembers(group, memberNameOrId);
+        targetMembers = CliUtil.findMembersOrThrow(group, memberNameOrId);
       }
 
       ResultCollector<?, ?> rc =

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/QueueCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/QueueCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/QueueCommands.java
index 8548478..8c56833 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/QueueCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/QueueCommands.java
@@ -128,7 +128,7 @@ public class QueueCommands extends AbstractCommandsSupport {
 
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(groups, null);
+        targetMembers = CliUtil.findMembersOrThrow(groups, null);
       } catch (CommandResultException crex) {
         return crex.getResult();
       }
@@ -193,7 +193,7 @@ public class QueueCommands extends AbstractCommandsSupport {
 
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers((String) null, (String) null);
+        targetMembers = CliUtil.findMembersOrThrow((String) null, (String) null);
       } catch (CommandResultException crex) {
         return crex.getResult();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/RegionCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/RegionCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/RegionCommands.java
index 78a28d6..0bf80a5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/RegionCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/RegionCommands.java
@@ -89,7 +89,7 @@ public class RegionCommands implements CommandMarker {
 
       Set<DistributedMember> targetMembers;
       try {
-        targetMembers = CliUtil.findAllMatchingMembers(group, memberNameOrId);
+        targetMembers = CliUtil.findMembersOrThrow(group, memberNameOrId);
       } catch (CommandResultException crex) {
         return crex.getResult();
       }

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
index 38b47e9..239db48 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/WanCommands.java
@@ -147,7 +147,7 @@ public class WanCommands extends AbstractCommandsSupport {
           gatewayEventFilters, gatewayTransportFilter);
 
       Set<DistributedMember> membersToCreateGatewaySenderOn =
-          CliUtil.findAllMatchingMembers(onGroups, onMember == null ? null : onMember.split(","));
+          CliUtil.findMembersOrThrow(onGroups, onMember == null ? null : onMember.split(","));
 
       ResultCollector<?, ?> resultCollector =
           CliUtil.executeFunction(GatewaySenderCreateFunction.INSTANCE, gatewaySenderFunctionArgs,
@@ -209,7 +209,7 @@ public class WanCommands extends AbstractCommandsSupport {
           (SystemManagementService) ManagementService.getExistingManagementService(cache);
 
       TabularResultData resultData = ResultBuilder.createTabularResultData();
-      Set<DistributedMember> dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      Set<DistributedMember> dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
 
       ExecutorService execService = Executors.newCachedThreadPool(new ThreadFactory() {
         AtomicInteger threadNum = new AtomicInteger();
@@ -346,7 +346,7 @@ public class WanCommands extends AbstractCommandsSupport {
       TabularResultData resultData = ResultBuilder.createTabularResultData();
       Set<DistributedMember> dsMembers = null;
 
-      dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
       for (DistributedMember member : dsMembers) {
         if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId()))
{
           bean = service.getLocalGatewaySenderMXBean(senderId);
@@ -477,7 +477,7 @@ public class WanCommands extends AbstractCommandsSupport {
       // return ResultBuilder
       // .createUserErrorResult(CliStrings.GATEWAY_MSG_MEMBERS_NOT_FOUND);
       // }
-      dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
       for (DistributedMember member : dsMembers) {
         if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId()))
{
           bean = service.getLocalGatewaySenderMXBean(senderId);
@@ -549,7 +549,7 @@ public class WanCommands extends AbstractCommandsSupport {
 
 
       TabularResultData resultData = ResultBuilder.createTabularResultData();
-      Set<DistributedMember> dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      Set<DistributedMember> dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
 
       for (DistributedMember member : dsMembers) {
         if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId()))
{
@@ -632,7 +632,7 @@ public class WanCommands extends AbstractCommandsSupport {
               socketBufferSize, maximumTimeBetweenPings, gatewayTransportFilters);
 
       Set<DistributedMember> membersToCreateGatewayReceiverOn =
-          CliUtil.findAllMatchingMembers(onGroups, onMember == null ? null : onMember.split(","));
+          CliUtil.findMembersOrThrow(onGroups, onMember == null ? null : onMember.split(","));
 
       ResultCollector<?, ?> resultCollector =
           CliUtil.executeFunction(GatewayReceiverCreateFunction.INSTANCE,
@@ -753,7 +753,7 @@ public class WanCommands extends AbstractCommandsSupport {
       GatewayReceiverMXBean receieverBean = null;
 
       TabularResultData resultData = ResultBuilder.createTabularResultData();
-      Set<DistributedMember> dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      Set<DistributedMember> dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
 
       for (DistributedMember member : dsMembers) {
         ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
@@ -820,7 +820,7 @@ public class WanCommands extends AbstractCommandsSupport {
 
 
       TabularResultData resultData = ResultBuilder.createTabularResultData();
-      Set<DistributedMember> dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      Set<DistributedMember> dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
 
       for (DistributedMember member : dsMembers) {
         ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
@@ -887,7 +887,7 @@ public class WanCommands extends AbstractCommandsSupport {
       // return ResultBuilder
       // .createUserErrorResult(CliStrings.GATEWAY_MSG_MEMBERS_NOT_FOUND);
       // }
-      dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
 
       Map<String, Map<String, GatewaySenderMXBean>> gatewaySenderBeans =
           new TreeMap<String, Map<String, GatewaySenderMXBean>>();
@@ -986,7 +986,7 @@ public class WanCommands extends AbstractCommandsSupport {
               .addTable(CliStrings.TABLE_GATEWAY_SENDER);
 
       Set<DistributedMember> dsMembers = null;
-      dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
       for (DistributedMember member : dsMembers) {
         if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId()))
{
           bean = service.getLocalGatewaySenderMXBean(senderId);
@@ -1041,7 +1041,7 @@ public class WanCommands extends AbstractCommandsSupport {
           crd.addSection(CliStrings.SECTION_GATEWAY_RECEIVER_NOT_AVAILABLE)
               .addTable(CliStrings.TABLE_GATEWAY_RECEIVER);
 
-      Set<DistributedMember> dsMembers = CliUtil.findAllMatchingMembers(onGroup, onMember);
+      Set<DistributedMember> dsMembers = CliUtil.findMembersOrThrow(onGroup, onMember);
 
       for (DistributedMember member : dsMembers) {
         ObjectName gatewayReceiverObjectName = MBeanJMXAdapter.getGatewayReceiverMBeanName(member);
@@ -1089,7 +1089,7 @@ public class WanCommands extends AbstractCommandsSupport {
           new GatewaySenderDestroyFunctionArgs(id);
 
       Set<DistributedMember> membersToDestroyGatewaySenderOn =
-          CliUtil.findAllMatchingMembers(onGroups, onMember == null ? null : onMember.split(","));
+          CliUtil.findMembersOrThrow(onGroups, onMember == null ? null : onMember.split(","));
 
       ResultCollector<?, ?> resultCollector =
           CliUtil.executeFunction(GatewaySenderDestroyFunction.INSTANCE,

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java
index d7d59b7..86dd967 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/cli/CliUtilDUnitTest.java
@@ -14,14 +14,14 @@
  */
 package org.apache.geode.management.internal.cli;
 
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
-
-import java.util.Properties;
-import java.util.Set;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static org.apache.geode.distributed.ConfigurationProperties.GROUPS;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_PORT;
+import static org.apache.geode.distributed.ConfigurationProperties.JMX_MANAGER_START;
+import static org.apache.geode.distributed.ConfigurationProperties.NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
@@ -49,6 +49,11 @@ import org.apache.geode.test.dunit.Wait;
 import org.apache.geode.test.dunit.WaitCriterion;
 import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
 import org.apache.geode.test.junit.categories.DistributedTest;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import java.util.Properties;
+import java.util.Set;
 
 @Category(DistributedTest.class)
 public class CliUtilDUnitTest extends JUnit4CacheTestCase {
@@ -246,7 +251,7 @@ public class CliUtilDUnitTest extends JUnit4CacheTestCase {
 
     final VM vm1 = Host.getHost(0).getVM(0);
 
-    LogWriterUtils.getLogWriter().info("testFor - findAllMatchingMembers");
+    LogWriterUtils.getLogWriter().info("testFor - findMembersOrThrow");
     vm1.invoke(new SerializableRunnable() {
       @Override
       public void run() {
@@ -291,14 +296,14 @@ public class CliUtilDUnitTest extends JUnit4CacheTestCase {
 
   public void verifyFindAllMatchingMembers() {
     try {
-      Set<DistributedMember> set = CliUtil.findAllMatchingMembers(GROUP1, null);
+      Set<DistributedMember> set = CliUtil.findMembersOrThrow(GROUP1, null);
       assertNotNull(set);
       assertEquals(2, set.size());
       assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
       assertEquals(true, containsMember(set, MEMBER_2_GROUP1));
 
 
-      set = CliUtil.findAllMatchingMembers("group1,group2", null);
+      set = CliUtil.findMembersOrThrow("group1,group2", null);
       assertNotNull(set);
       assertEquals(4, set.size());
       assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
@@ -307,13 +312,13 @@ public class CliUtilDUnitTest extends JUnit4CacheTestCase {
       assertEquals(true, containsMember(set, MEMBER_2_GROUP2));
 
 
-      set = CliUtil.findAllMatchingMembers(null, MEMBER_1_GROUP1);
+      set = CliUtil.findMembersOrThrow(null, MEMBER_1_GROUP1);
       assertNotNull(set);
       assertEquals(1, set.size());
       assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
 
 
-      set = CliUtil.findAllMatchingMembers(null, "member1_group1,member2_group2");
+      set = CliUtil.findMembersOrThrow(null, "member1_group1,member2_group2");
       assertNotNull(set);
       assertEquals(2, set.size());
       assertEquals(true, containsMember(set, MEMBER_1_GROUP1));
@@ -351,7 +356,7 @@ public class CliUtilDUnitTest extends JUnit4CacheTestCase {
       @SuppressWarnings("rawtypes")
       Region region1 = CacheFactory.getAnyInstance().getRegion(COMMON_REGION);
       region1.clear();
-      set = CliUtil.findAllMatchingMembers(GROUP1, null);
+      set = CliUtil.findMembersOrThrow(GROUP1, null);
       assertEquals(2, set.size());
       ResultCollector collector = CliUtil.executeFunction(function, "executeOnGroup", set);
       collector.getResult();

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
index 94eec0a..4ac9886 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfig.java
@@ -156,7 +156,7 @@ public class ClusterConfig implements Serializable {
       for (String jar : this.getJarNames()) {
         JarClassLoader jarClassLoader = findJarClassLoader(jar);
         assertThat(jarClassLoader).isNotNull();
-        assertThat(jarClassLoader.loadClass(nameOfClassContainedInJar(jar))).isNotNull();
+        assertThat(Class.forName(nameOfClassContainedInJar(jar), true, jarClassLoader)).isNotNull();
       }
     });
   }

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
index 51a77d2..06e969c 100644
--- a/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/management/internal/configuration/ClusterConfigDeployJarDUnitTest.java
@@ -61,8 +61,15 @@ public class ClusterConfigDeployJarDUnitTest extends ClusterConfigBaseTest
{
     gfshConnector.connect();
     assertThat(gfshConnector.isConnected()).isTrue();
 
-    CommandResult result = gfshConnector.executeCommand("deploy --jar=" + clusterJarPath);
-    assertThat(result.getStatus()).isEqualTo(Result.Status.ERROR);
+    gfshConnector.executeAndVerifyCommand("deploy --jar=" + clusterJarPath);
+    ConfigGroup cluster = new ConfigGroup("cluster").jars("cluster.jar");
+    ClusterConfig expectedClusterConfig = new ClusterConfig(cluster);
+
+    expectedClusterConfig.verify(locator);
+
+    // start a server and verify that the server gets the jar
+    Server server1 = lsRule.startServerVM(1, locator.getPort());
+    expectedClusterConfig.verify(server1);
   }
 
   @Test

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
index 13442fd..c74d6c7 100644
--- a/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
+++ b/geode-core/src/test/java/org/apache/geode/test/dunit/rules/GfshShellConnectionRule.java
@@ -130,7 +130,9 @@ public class GfshShellConnectionRule extends DescribedExternalResource
{
 
   public CommandResult executeCommand(String command) throws Exception {
     gfsh.executeCommand(command);
-    return (CommandResult) gfsh.getResult();
+    CommandResult result = (CommandResult) gfsh.getResult();
+    System.out.println("command result: " + result.getContent().toString());
+    return result;
   }
 
   public CommandResult executeAndVerifyCommand(String command) throws Exception {

http://git-wip-us.apache.org/repos/asf/geode/blob/e06bf2db/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
index e7fb0b9..b84246c 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/LuceneIndexCommands.java
@@ -436,7 +436,7 @@ public class LuceneIndexCommands extends AbstractCommandsSupport {
         throw new IllegalArgumentException("Region not found.");
       }
     } else {
-      targetMembers = CliUtil.findAllMatchingMembers(groups, null);
+      targetMembers = CliUtil.findMembersOrThrow(groups, null);
     }
     return CliUtil.executeFunction(function, indexInfo, targetMembers);
   }


Mime
View raw message