geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aba...@apache.org
Subject [6/9] incubator-geode git commit: GEODE-1984: Fixing the logic of destroying a gateway sender, one need to stop the gatewaySender before calling destroy.
Date Fri, 25 Nov 2016 15:17:53 GMT
GEODE-1984: Fixing the logic of destroying a gateway sender, one need to stop
            the gatewaySender before calling destroy.


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

Branch: refs/heads/feature/GEODE-1984
Commit: eb994e1320af01c3e37697b9d942fd25c181c01c
Parents: c8228f1
Author: adongre <adongre@apache.org>
Authored: Sun Nov 20 17:38:11 2016 +0530
Committer: adongre <adongre@apache.org>
Committed: Sun Nov 20 17:38:11 2016 +0530

----------------------------------------------------------------------
 .../functions/GatewaySenderDestroyFunction.java |  6 +++++
 .../internal/cli/i18n/CliStrings.java           |  3 +++
 ...WanCommandDestroyGatewaySenderDUnitTest.java | 28 ++++++++++----------
 3 files changed, 23 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eb994e13/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
index a64df06..a7ca8c5 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/GatewaySenderDestroyFunction.java
@@ -24,6 +24,7 @@ import org.apache.geode.internal.InternalEntity;
 import org.apache.geode.internal.cache.wan.GatewaySenderException;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.cli.CliUtil;
+import org.apache.geode.management.internal.cli.i18n.CliStrings;
 import org.apache.logging.log4j.Logger;
 
 public class GatewaySenderDestroyFunction extends FunctionAdapter implements InternalEntity
{
@@ -46,11 +47,16 @@ public class GatewaySenderDestroyFunction extends FunctionAdapter implements
Int
       GatewaySender gatewaySender =
           cache.getGatewaySender(gatewaySenderDestroyFunctionArgs.getId());
       if (gatewaySender != null) {
+        gatewaySender.stop();
         gatewaySender.destroy();
       } else {
         throw new GatewaySenderException(
             "GateWaySender with Id " + gatewaySenderDestroyFunctionArgs.getId() + "not found");
       }
+      resultSender.lastResult(new CliFunctionResult(memberNameOrId, true,
+          CliStrings.format(CliStrings.DESTROY_GATEWAYSENDER__MSG__GATEWAYSENDER_0_DESTROYED_ON_1,
+              new Object[] {gatewaySenderDestroyFunctionArgs.getId(), memberNameOrId})));
+
     } catch (GatewaySenderException gse) {
       resultSender.lastResult(handleException(memberNameOrId, gse.getMessage(), gse));
     } catch (Exception e) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eb994e13/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
index 8321a7f..447eff4 100644
--- a/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
+++ b/geode-core/src/main/java/org/apache/geode/management/internal/cli/i18n/CliStrings.java
@@ -2241,6 +2241,9 @@ public class CliStrings {
       "Name/Id of the member on which to destroy the Gateway Sender.";
   public static final String DESTROY_GATEWAYSENDER__ID = "id";
   public static final String DESTROY_GATEWAYSENDER__ID__HELP = "Id of the GatewaySender.";
+  public static final String DESTROY_GATEWAYSENDER__MSG__GATEWAYSENDER_0_DESTROYED_ON_1 =
+      "GatewaySender \"{0}\" destroyed on \"{1}\"";
+
 
 
   /* start gfmon command */

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/eb994e13/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandDestroyGatewaySenderDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandDestroyGatewaySenderDUnitTest.java
b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandDestroyGatewaySenderDUnitTest.java
index 7e3f3dd..f71eccb 100644
--- a/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandDestroyGatewaySenderDUnitTest.java
+++ b/geode-wan/src/test/java/org/apache/geode/internal/cache/wan/wancommand/WanCommandDestroyGatewaySenderDUnitTest.java
@@ -50,10 +50,24 @@ public class WanCommandDestroyGatewaySenderDUnitTest extends WANCommandTestBase
 
   @Test
   public void testDestroyGatewaySenderWithDefault() {
+    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId(1));
+    Properties props = getDistributedSystemProperties();
+    props.setProperty(MCAST_PORT, "0");
+    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
+    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
+    setUpJmxManagerOnVm0ThenConnect(props);
+
+    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
+
+    vm3.invoke(() -> createCache(punePort));
+    vm4.invoke(() -> createCache(punePort));
+    vm5.invoke(() -> createCache(punePort));
+
     createGatewaySenderWithDefault();
 
     String command =
         CliStrings.DESTROY_GATEWAYSENDER + " --" + CliStrings.DESTROY_GATEWAYSENDER__ID +
"=ln";
+
     CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);
     if (cmdResult != null) {
       String strCmdResult = commandResultToString(cmdResult);
@@ -65,20 +79,6 @@ public class WanCommandDestroyGatewaySenderDUnitTest extends WANCommandTestBase
   }
 
   private void createGatewaySenderWithDefault() {
-    Integer punePort = (Integer) vm1.invoke(() -> createFirstLocatorWithDSId(1));
-
-    Properties props = getDistributedSystemProperties();
-    props.setProperty(MCAST_PORT, "0");
-    props.setProperty(DISTRIBUTED_SYSTEM_ID, "1");
-    props.setProperty(LOCATORS, "localhost[" + punePort + "]");
-    setUpJmxManagerOnVm0ThenConnect(props);
-
-    Integer nyPort = (Integer) vm2.invoke(() -> createFirstRemoteLocator(2, punePort));
-
-    vm3.invoke(() -> createCache(punePort));
-    vm4.invoke(() -> createCache(punePort));
-    vm5.invoke(() -> createCache(punePort));
-
     String command = CliStrings.CREATE_GATEWAYSENDER + " --" + CliStrings.CREATE_GATEWAYSENDER__ID
         + "=ln" + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2";
     CommandResult cmdResult = executeCommandWithIgnoredExceptions(command);


Mime
View raw message