[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-21 Thread Dave Barnes (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300421#comment-16300421
 ] 

Dave Barnes commented on GEODE-2665:


Documented.

> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-21 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300416#comment-16300416
 ] 

ASF subversion and git services commented on GEODE-2665:


Commit 09026a689fd4e755c7f6a2c5608189aa5e720b38 in geode's branch 
refs/heads/develop from [~dbarnes97]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=09026a6 ]

GEODE-2665: Document Gfsh command to delete async event queues (#1200)

and added documentation for the --if-exists option for some other destroy 
commands.

> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300415#comment-16300415
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

davebarnes97 closed pull request #1200: GEODE-2665: Document Gfsh command to 
delete async event queues
URL: https://github.com/apache/geode/pull/1200
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/geode-docs/tools_modules/gfsh/command-pages/destroy.html.md.erb 
b/geode-docs/tools_modules/gfsh/command-pages/destroy.html.md.erb
index 5d32b73806..9ea08a2172 100644
--- a/geode-docs/tools_modules/gfsh/command-pages/destroy.html.md.erb
+++ b/geode-docs/tools_modules/gfsh/command-pages/destroy.html.md.erb
@@ -22,9 +22,13 @@ limitations under the License.
 
 Delete or unregister functions, remove indexes, disk stores and regions.
 
+-   **[destroy async-event-queue](#topic_destroy-async-event-queue)**
+
+Destroy an asynchronous event queue.
+
 -   **[destroy disk-store](#topic_yfr_l2z_ck)**
 
-Deletes a disk store and all files on disk used by the disk store. Data 
for closed regions that previously used this disk store is lost.
+Delete a disk store and all files on disk used by the disk store.
 
 -   **[destroy function](#topic_E48C2DF809054C12A162026D8A2139BB)**
 
@@ -46,16 +50,43 @@ Delete or unregister functions, remove indexes, disk stores 
and regions.
 
 Destroy or remove a region.
 
+## destroy 
async-event-queue
+
+Destroy an asynchronous event queue.
+
+**Availability:** Online. You must be connected in `gfsh` to a JMX Manager 
member to use this command.
+
+**Syntax:**
+
+``` pre
+destroy async-event-queue --id=value [--groups=value(,value)*] 
[--if-exists=value]
+```
+
+**Parameters, destroy async-event-queue:**
+
+| Name  | Description  
 |
+|---|---|
+| \\-\\-id  | *Required.* ID of the 
async event queue to be deleted.  |
+| ‑‑groups | Group(s) of 
members on which the async event queue will be destroyed. If no group is 
specified, the queue is destroyed on all members. |
+| ‑‑if‑exists | If the specified async event queue does not 
exist, gfsh responds with a message to that effect. If this parameter is true, 
the response is prefixed with the label "Skipping: ". Useful for scripted 
tests. Default (if the parameter is not specified): false. Default (if the 
parameter is specified without value): true. |
+
+
+**Example Commands:**
+
+``` pre
+destroy async-event-queue --id=myAsyncEventQueue
+```
+
 ## destroy disk-store
 
-Deletes a disk store and all files on disk used by the disk store. Data for 
closed regions that previously used this disk store are lost.
+Delete a disk store and all files on disk used by the disk store. Data for 
closed regions that previously used this disk store are lost.
 
 **Availability:** Online. You must be connected in `gfsh` to a JMX Manager 
member to use this command.
 
 **Syntax:**
 
 ``` pre
-destroy disk-store --name=value [--groups=value(,value)*]
+destroy disk-store --name=value [--groups=value(,value)*] [--if-exists=value]
 ```
 
 **Parameters, destroy disk-store:**
@@ -64,6 +95,7 @@ destroy disk-store --name=value [--groups=value(,value)*]
 
|---|--|
 | \\-\\-name  | *Required.* Name of the 
disk store to be deleted.   
 |
 | ‑‑groups | Group(s) of 
members on which the disk store will be destroyed. If no group is specified, 
the disk store is destroyed on all members. |
+| ‑‑if‑exists | If the specified disk store does not exist, 
gfsh responds with a message to that effect. If this parameter is true, the 
response is prefixed with the label "Skipping: ". Useful for scripted tests. 
Default (if the parameter is not specified): false. Default (if the parameter 
is specified without value): true. |
 
 
 **Example Commands:**
@@ -139,7 +171,7 @@ gfsh>alter region --name=regionA --gateway-sender-id=""
 
 ``` pre
 destroy gateway-sender --id=value [--groups=value(,value)*]
-  [--members=value(,value)*]
+  [--members=value(,value)*] [--if-exists=value]
 ```
 
 **Parameters, destroy gateway-sender:**
@@ -149,6 +181,7 @@ destroy gateway-sender --id=value [--groups=value(,value)*]
 | \\-\\-id | *Requ

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300398#comment-16300398
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

davebarnes97 opened a new pull request #1200: GEODE-2665: Document Gfsh command 
to delete async event queues
URL: https://github.com/apache/geode/pull/1200
 
 
   Documented the gfsh command `destroy async-event-queue`.
   While I was at it, added documentation for the `--if-exists` option for some 
other destroy commands.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-21 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300307#comment-16300307
 ] 

ASF subversion and git services commented on GEODE-2665:


Commit d4183f67920e8d92f37a2ed09b0c6f3196c83058 in geode's branch 
refs/heads/develop from [~khowe]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=d4183f6 ]

GEODE-2665: Add Gfsh command to delete async event queues (#1116)

* GEODE-2665: Add Gfsh command to delete async event queues

New classes added for the Command, Function and FunctionArgs
New test classes added for DUnit and Unit tests

Command supports --if-exists option for idempotency

Refactor tests for changes in handling function results errors


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-21 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300305#comment-16300305
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner closed pull request #1116: GEODE-2665: Add Gfsh command to delete 
async event queues
URL: https://github.com/apache/geode/pull/1116
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

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
new file mode 100644
index 00..c46dc9ac91
--- /dev/null
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
@@ -0,0 +1,79 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS;
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS_HELP;
+
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+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.configuration.domain.XmlEntity;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class DestroyAsyncEventQueueCommand implements GfshCommand {
+  public static final String DESTROY_ASYNC_EVENT_QUEUE = "destroy 
async-event-queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__HELP = "destroy an 
Async Event Queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID = "id";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID__HELP =
+  "ID of the queue to be destroyed.";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP =
+  "Group(s) of members on which to destroy the async event queue.";
+
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND =
+  "Async event queue \"%s\" not found";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED =
+  "Async event queue \"%s\" destroyed";
+
+  @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = 
DESTROY_ASYNC_EVENT_QUEUE__HELP)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+  operation = ResourcePermission.Operation.MANAGE)
+  public Result 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},
+  optionContext = ConverterHint.MEMBERGROUP,
+  help = DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP) String[] onGroups,
+  @CliOption(key = IFEXISTS, help = IFEXISTS_HELP, specifiedDefaultValue = 
"true",
+  unspecifiedDefaultValue = "false") boolean ifExists)
+  throws Throwable {
+DestroyAsyncEventQueueFunctionArgs asyncEventQueueDestoryFunctionArgs =
+new DestroyAsyncEventQueueFunctionArgs(aeqId, ifExists);
+
+Set members = getMembers(onGroups, null);
+List functionResults = executeAndGetFunctionResult(
+new DestroyAsyncEventQueueFunction(), 
asyncEve

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-21 Thread ASF subversion and git services (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16300306#comment-16300306
 ] 

ASF subversion and git services commented on GEODE-2665:


Commit d4183f67920e8d92f37a2ed09b0c6f3196c83058 in geode's branch 
refs/heads/develop from [~khowe]
[ https://gitbox.apache.org/repos/asf?p=geode.git;h=d4183f6 ]

GEODE-2665: Add Gfsh command to delete async event queues (#1116)

* GEODE-2665: Add Gfsh command to delete async event queues

New classes added for the Command, Function and FunctionArgs
New test classes added for DUnit and Unit tests

Command supports --if-exists option for idempotency

Refactor tests for changes in handling function results errors


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-19 Thread Kenneth Howe (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16297528#comment-16297528
 ] 

Kenneth Howe commented on GEODE-2665:
-

This JIRA is not blocked on GEODE-2666. The command implementation uses the 
existing AsyncEventQueueImpl.destroy() method.

> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295222#comment-16295222
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r157534615
 
 

 ##
 File path: 
geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DestroyAsyncEventQueueFunctionTest.java
 ##
 @@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.functions;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
+import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.ResultSender;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.execute.FunctionContextImpl;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.test.fake.Fakes;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class DestroyAsyncEventQueueFunctionTest {
+
+  private static final String TEST_AEQ_ID = "Test-AEQ";
+  private AsyncEventQueue mockAEQ;
+  private FunctionContext mockContext;
+  private DestroyAsyncEventQueueFunctionArgs mockArgs;
+  private GemFireCacheImpl cache;
+
+  @Before
+  public void setUp() throws Exception {
+mockAEQ = mock(AsyncEventQueueImpl.class);
+mockContext = mock(FunctionContext.class);
+mockArgs = mock(DestroyAsyncEventQueueFunctionArgs.class);
+cache = Fakes.cache();
+
+when(mockArgs.getId()).thenReturn(TEST_AEQ_ID);
+when(mockAEQ.getId()).thenReturn(TEST_AEQ_ID);
+  }
+
+  @Test
+  public void execute_validAeqId_OK() throws Throwable {
+XmlEntity xmlEntity = mock(XmlEntity.class);
+DestroyAsyncEventQueueFunction spyFunction = 
spy(DestroyAsyncEventQueueFunction.class);
+doReturn(xmlEntity).when(spyFunction).getAEQXmlEntity(anyString(), 
anyString());
+when(cache.getAsyncEventQueue(TEST_AEQ_ID)).thenReturn(mockAEQ);
+
+TestResultSender resultSender = new TestResultSender();
+FunctionContext context = new FunctionContextImpl(cache, "functionId", 
mockArgs, resultSender);
+spyFunction.execute(context);
+
+List results = resultSender.getResults();
+assertThat(results.size()).isEqualTo(1);
+CliFunctionResult result = (CliFunctionResult) results.get(0);
+assertThat(result.isSuccessful()).isTrue();
+assertThat(result.getXmlEntity()).isNotNull();
+assertThat(result.getThrowable()).isNull();
+  }
+
+  @Test
+  public void execute_nonexistentAeqId_returnsError() throws Throwable {
+when(cache.getAsyncEventQueue(TEST_AEQ_ID)).thenReturn(null);
+
+TestResultSender resultSender = new TestResultSender();
+
+FunctionContext context = new FunctionContextImpl(cache, "functionId", 
mockArgs, resultSender);
+new DestroyAsyncEventQueueFunction().execute(context);
+List results = resultSender.getResults();
+assertThat(results.size()).isEqualTo(1);
+CliFunctionResult result = (CliFunctionResult) results.get(0);
+assertThat(result.isSuccessful()).isFalse();
+assertThat(result.getMessage()).containsPattern(TEST_AEQ_ID + ".*not 
found");
+  }
+
+  @Test
+  public void execute_nonexistentAeqIdIfExists_returnsSuccess() throws 
Throwable {
+when(cache.getAsyncEventQueue(TEST_AEQ_ID)).thenReturn(null);
+when(mockArgs.isIfExists()).thenReturn(true);
+
+TestResultSender resultSender = new TestRes

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295223#comment-16295223
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r157534671
 
 

 ##
 File path: 
geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommandDUnitTest.java
 ##
 @@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.internal.cache.wan.MyAsyncEventListener;
+import org.apache.geode.management.internal.cli.json.GfJsonException;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+
+@Category(DistributedTest.class)
+public class DestroyAsyncEventQueueCommandDUnitTest {
+
+  private static MemberVM locator, server1, server2, server3;
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @Rule
+  public GfshCommandRule gfsh = new GfshCommandRule();
+
+  @Before
+  public void setUp() throws Exception {
+locator = lsRule.startLocatorVM(0);
+server1 = lsRule.startServerVM(1, "group1", locator.getPort());
+server2 = lsRule.startServerVM(2, locator.getPort());
+gfsh.connectAndVerify(locator);
+  }
+
+  @Test
+  public void destroyAeq_returnsSuccess() {
+gfsh.executeAndAssertThat(
+"create async-event-queue --id=queue1 --listener=" + 
MyAsyncEventListener.class.getName())
+.statusIsSuccess();
+
 
 Review comment:
   Good catch! Adding this check to the existing tests showed that the Function 
implementation was not returning the correct XmlEntity, so that was corrected 
as well. 


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295209#comment-16295209
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r157533029
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyAsyncEventQueueFunction.java
 ##
 @@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.functions;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.internal.InternalEntity;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import 
org.apache.geode.management.internal.cli.commands.DestroyAsyncEventQueueCommand;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+
+/**
+ * Function used by the 'create async-event-queue' gfsh command to create an 
asynchronous event
+ * queue on a member.
+ *
+ * @since GemFire 8.0
+ */
+public class DestroyAsyncEventQueueFunction implements Function, 
InternalEntity {
+
+  private static final long serialVersionUID = -7754359270344102817L;
+
+  @Override
+  public void execute(FunctionContext context) {
+String memberId = "";
+
+DestroyAsyncEventQueueFunctionArgs aeqArgs =
+(DestroyAsyncEventQueueFunctionArgs) context.getArguments();
+String aeqId = aeqArgs.getId();
+memberId = context.getMemberName();
+
+try {
+  AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) 
context.getCache().getAsyncEventQueue(aeqId);
+  if (aeq == null) {
+if (aeqArgs.isIfExists()) {
+  context.getResultSender()
+  .lastResult(new CliFunctionResult(memberId, true,
+  String.format(
+  "Skipping: "
+  + 
DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND,
+  aeqId)));
+} else {
+  context.getResultSender().lastResult(new CliFunctionResult(memberId, 
false, String.format(
+  
DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND, 
aeqId)));
+}
+  } else {
+aeq.stop();
+aeq.destroy();
+XmlEntity xmlEntity = getAEQXmlEntity("name", aeqId);
+context.getResultSender()
+.lastResult(new CliFunctionResult(memberId, xmlEntity, 
String.format(
+
DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED, 
aeqId)));
+  }
+} catch (Exception e) {
+  e.printStackTrace();
 
 Review comment:
   Deleted. This was added while debugging and was not intended to remain in 
production code.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295205#comment-16295205
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r157532555
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyAsyncEventQueueFunction.java
 ##
 @@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.functions;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.internal.InternalEntity;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import 
org.apache.geode.management.internal.cli.commands.DestroyAsyncEventQueueCommand;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+
+/**
+ * Function used by the 'create async-event-queue' gfsh command to create an 
asynchronous event
+ * queue on a member.
+ *
+ * @since GemFire 8.0
+ */
 
 Review comment:
   Corrected.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295201#comment-16295201
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r157532234
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
 ##
 @@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS;
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS_HELP;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.logging.LogService;
+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.result.TabularResultData;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class DestroyAsyncEventQueueCommand implements GfshCommand {
+  public static final String DESTROY_ASYNC_EVENT_QUEUE = "destroy 
async-event-queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__HELP = "destroy an 
Async Event Queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID = "id";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID__HELP =
+  "ID of the queue to be destroyed.";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP =
+  "Group(s) of members on which to destroy the async event queue.";
+
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND =
+  "Async event queue \"%s\" not found";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED =
+  "Async event queue \"%s\" destroyed";
+
+  @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = 
DESTROY_ASYNC_EVENT_QUEUE__HELP)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+  operation = ResourcePermission.Operation.MANAGE)
+  public Result 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},
+  optionContext = ConverterHint.MEMBERGROUP,
+  help = DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP) String[] onGroups,
+  @CliOption(key = IFEXISTS, help = IFEXISTS_HELP, specifiedDefaultValue = 
"true",
+  unspecifiedDefaultValue = "false") boolean ifExists)
+  throws Throwable {
+DestroyAsyncEventQueueFunctionArgs asyncEventQueueDestoryFunctionArgs =
+new DestroyAsyncEventQueueFunctionArgs(aeqId, ifExists);
+
+Set members = getMembers(onGroups, null);
 
 Review comment:
   Good catch.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> 

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-18 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16295200#comment-16295200
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r157532093
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
 ##
 @@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS;
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS_HELP;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.logging.LogService;
+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.result.TabularResultData;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class DestroyAsyncEventQueueCommand implements GfshCommand {
+  public static final String DESTROY_ASYNC_EVENT_QUEUE = "destroy 
async-event-queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__HELP = "destroy an 
Async Event Queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID = "id";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID__HELP =
+  "ID of the queue to be destroyed.";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP =
+  "Group(s) of members on which to destroy the async event queue.";
+
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND =
+  "Async event queue \"%s\" not found";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED =
+  "Async event queue \"%s\" destroyed";
+
+  @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = 
DESTROY_ASYNC_EVENT_QUEUE__HELP)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+  operation = ResourcePermission.Operation.MANAGE)
+  public Result 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},
+  optionContext = ConverterHint.MEMBERGROUP,
+  help = DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP) String[] onGroups,
+  @CliOption(key = IFEXISTS, help = IFEXISTS_HELP, specifiedDefaultValue = 
"true",
+  unspecifiedDefaultValue = "false") boolean ifExists)
+  throws Throwable {
+DestroyAsyncEventQueueFunctionArgs asyncEventQueueDestoryFunctionArgs =
+new DestroyAsyncEventQueueFunctionArgs(aeqId, ifExists);
+
+Set members = getMembers(onGroups, null);
+if (members.size() == 0) {
+  String message = 
String.format(DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND, aeqId);
 
 Review comment:
   Good point. However in light of Jinmei's comment, I'm removing this 
conditional.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the 

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289921#comment-16289921
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

jinmeiliao commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r156786471
 
 

 ##
 File path: 
geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommandDUnitTest.java
 ##
 @@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.internal.cache.wan.MyAsyncEventListener;
+import org.apache.geode.management.internal.cli.json.GfJsonException;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+
+@Category(DistributedTest.class)
+public class DestroyAsyncEventQueueCommandDUnitTest {
+
+  private static MemberVM locator, server1, server2, server3;
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @Rule
+  public GfshCommandRule gfsh = new GfshCommandRule();
+
+  @Before
+  public void setUp() throws Exception {
+locator = lsRule.startLocatorVM(0);
+server1 = lsRule.startServerVM(1, "group1", locator.getPort());
+server2 = lsRule.startServerVM(2, locator.getPort());
+gfsh.connectAndVerify(locator);
+  }
+
+  @Test
+  public void destroyAeq_returnsSuccess() {
+gfsh.executeAndAssertThat(
+"create async-event-queue --id=queue1 --listener=" + 
MyAsyncEventListener.class.getName())
+.statusIsSuccess();
+
+locator.waitTillAsyncEventQueuesAreReadyOnServers("queue1", 2);
+gfsh.executeAndAssertThat("list async-event-queues").statusIsSuccess();
+
+gfsh.executeAndAssertThat("destroy async-event-queue --id=queue1 
").statusIsSuccess();
+gfsh.executeAndAssertThat("list async-event-queues").statusIsSuccess()
 
 Review comment:
   in here, verify that the cluster config is deleted from the xml.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289920#comment-16289920
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

jinmeiliao commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r156786372
 
 

 ##
 File path: 
geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommandDUnitTest.java
 ##
 @@ -0,0 +1,151 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import java.io.IOException;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.internal.cache.wan.MyAsyncEventListener;
+import org.apache.geode.management.internal.cli.json.GfJsonException;
+import org.apache.geode.test.dunit.rules.LocatorServerStartupRule;
+import org.apache.geode.test.dunit.rules.MemberVM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.apache.geode.test.junit.rules.GfshCommandRule;
+
+@Category(DistributedTest.class)
+public class DestroyAsyncEventQueueCommandDUnitTest {
+
+  private static MemberVM locator, server1, server2, server3;
+
+  @Rule
+  public LocatorServerStartupRule lsRule = new LocatorServerStartupRule();
+
+  @Rule
+  public GfshCommandRule gfsh = new GfshCommandRule();
+
+  @Before
+  public void setUp() throws Exception {
+locator = lsRule.startLocatorVM(0);
+server1 = lsRule.startServerVM(1, "group1", locator.getPort());
+server2 = lsRule.startServerVM(2, locator.getPort());
+gfsh.connectAndVerify(locator);
+  }
+
+  @Test
+  public void destroyAeq_returnsSuccess() {
+gfsh.executeAndAssertThat(
+"create async-event-queue --id=queue1 --listener=" + 
MyAsyncEventListener.class.getName())
+.statusIsSuccess();
+
 
 Review comment:
   It would be a good idea for this test to verify cluster config change as 
well using something like:
   
   locator.invoke(()->{
   // get the cluster config service and then get the config for "cluster", and 
then get the xml string and verify the config is in there.
   })


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289462#comment-16289462
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

jinmeiliao commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r156707604
 
 

 ##
 File path: 
geode-core/src/test/java/org/apache/geode/management/internal/cli/functions/DestroyAsyncEventQueueFunctionTest.java
 ##
 @@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.functions;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.when;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.asyncqueue.AsyncEventQueue;
+import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.cache.execute.ResultSender;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.execute.FunctionContextImpl;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.test.fake.Fakes;
+import org.apache.geode.test.junit.categories.UnitTest;
+
+@Category(UnitTest.class)
+public class DestroyAsyncEventQueueFunctionTest {
+
+  private static final String TEST_AEQ_ID = "Test-AEQ";
+  private AsyncEventQueue mockAEQ;
+  private FunctionContext mockContext;
+  private DestroyAsyncEventQueueFunctionArgs mockArgs;
+  private GemFireCacheImpl cache;
+
+  @Before
+  public void setUp() throws Exception {
+mockAEQ = mock(AsyncEventQueueImpl.class);
+mockContext = mock(FunctionContext.class);
+mockArgs = mock(DestroyAsyncEventQueueFunctionArgs.class);
+cache = Fakes.cache();
+
+when(mockArgs.getId()).thenReturn(TEST_AEQ_ID);
+when(mockAEQ.getId()).thenReturn(TEST_AEQ_ID);
+  }
+
+  @Test
+  public void execute_validAeqId_OK() throws Throwable {
+XmlEntity xmlEntity = mock(XmlEntity.class);
+DestroyAsyncEventQueueFunction spyFunction = 
spy(DestroyAsyncEventQueueFunction.class);
+doReturn(xmlEntity).when(spyFunction).getAEQXmlEntity(anyString(), 
anyString());
+when(cache.getAsyncEventQueue(TEST_AEQ_ID)).thenReturn(mockAEQ);
+
+TestResultSender resultSender = new TestResultSender();
+FunctionContext context = new FunctionContextImpl(cache, "functionId", 
mockArgs, resultSender);
+spyFunction.execute(context);
+
+List results = resultSender.getResults();
+assertThat(results.size()).isEqualTo(1);
+CliFunctionResult result = (CliFunctionResult) results.get(0);
+assertThat(result.isSuccessful()).isTrue();
+assertThat(result.getXmlEntity()).isNotNull();
+assertThat(result.getThrowable()).isNull();
+  }
+
+  @Test
+  public void execute_nonexistentAeqId_returnsError() throws Throwable {
+when(cache.getAsyncEventQueue(TEST_AEQ_ID)).thenReturn(null);
+
+TestResultSender resultSender = new TestResultSender();
+
+FunctionContext context = new FunctionContextImpl(cache, "functionId", 
mockArgs, resultSender);
+new DestroyAsyncEventQueueFunction().execute(context);
+List results = resultSender.getResults();
+assertThat(results.size()).isEqualTo(1);
+CliFunctionResult result = (CliFunctionResult) results.get(0);
+assertThat(result.isSuccessful()).isFalse();
+assertThat(result.getMessage()).containsPattern(TEST_AEQ_ID + ".*not 
found");
+  }
+
+  @Test
+  public void execute_nonexistentAeqIdIfExists_returnsSuccess() throws 
Throwable {
+when(cache.getAsyncEventQueue(TEST_AEQ_ID)).thenReturn(null);
+when(mockArgs.isIfExists()).thenReturn(true);
+
+TestResultSender resultSender = new TestRe

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289464#comment-16289464
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

jinmeiliao commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r156704844
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
 ##
 @@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS;
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS_HELP;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.logging.LogService;
+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.result.TabularResultData;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class DestroyAsyncEventQueueCommand implements GfshCommand {
+  public static final String DESTROY_ASYNC_EVENT_QUEUE = "destroy 
async-event-queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__HELP = "destroy an 
Async Event Queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID = "id";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID__HELP =
+  "ID of the queue to be destroyed.";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP =
+  "Group(s) of members on which to destroy the async event queue.";
+
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND =
+  "Async event queue \"%s\" not found";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED =
+  "Async event queue \"%s\" destroyed";
+
+  @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = 
DESTROY_ASYNC_EVENT_QUEUE__HELP)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+  operation = ResourcePermission.Operation.MANAGE)
+  public Result 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},
+  optionContext = ConverterHint.MEMBERGROUP,
+  help = DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP) String[] onGroups,
+  @CliOption(key = IFEXISTS, help = IFEXISTS_HELP, specifiedDefaultValue = 
"true",
+  unspecifiedDefaultValue = "false") boolean ifExists)
+  throws Throwable {
+DestroyAsyncEventQueueFunctionArgs asyncEventQueueDestoryFunctionArgs =
+new DestroyAsyncEventQueueFunctionArgs(aeqId, ifExists);
+
+Set members = getMembers(onGroups, null);
 
 Review comment:
   If you use getMembers() call, it will check for 0 instances found and throw 
an Exception which is handled by the executor to turn into a 
GemfireUserErrorResult, so you don't need to do the check at all.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289463#comment-16289463
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

jinmeiliao commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r156705878
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyAsyncEventQueueFunction.java
 ##
 @@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.functions;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.internal.InternalEntity;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import 
org.apache.geode.management.internal.cli.commands.DestroyAsyncEventQueueCommand;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+
+/**
+ * Function used by the 'create async-event-queue' gfsh command to create an 
asynchronous event
+ * queue on a member.
+ *
+ * @since GemFire 8.0
+ */
+public class DestroyAsyncEventQueueFunction implements Function, 
InternalEntity {
+
+  private static final long serialVersionUID = -7754359270344102817L;
+
+  @Override
+  public void execute(FunctionContext context) {
+String memberId = "";
+
+DestroyAsyncEventQueueFunctionArgs aeqArgs =
+(DestroyAsyncEventQueueFunctionArgs) context.getArguments();
+String aeqId = aeqArgs.getId();
+memberId = context.getMemberName();
+
+try {
+  AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) 
context.getCache().getAsyncEventQueue(aeqId);
+  if (aeq == null) {
+if (aeqArgs.isIfExists()) {
+  context.getResultSender()
+  .lastResult(new CliFunctionResult(memberId, true,
+  String.format(
+  "Skipping: "
+  + 
DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND,
+  aeqId)));
+} else {
+  context.getResultSender().lastResult(new CliFunctionResult(memberId, 
false, String.format(
+  
DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND, 
aeqId)));
+}
+  } else {
+aeq.stop();
+aeq.destroy();
+XmlEntity xmlEntity = getAEQXmlEntity("name", aeqId);
+context.getResultSender()
+.lastResult(new CliFunctionResult(memberId, xmlEntity, 
String.format(
+
DestroyAsyncEventQueueCommand.DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED, 
aeqId)));
+  }
+} catch (Exception e) {
+  e.printStackTrace();
 
 Review comment:
   use logService.getLogger() to log the error instead of raw print.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289430#comment-16289430
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

jdeppe-pivotal commented on a change in pull request #1116: GEODE-2665: Add 
Gfsh command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r156700169
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/functions/DestroyAsyncEventQueueFunction.java
 ##
 @@ -0,0 +1,85 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.functions;
+
+import org.apache.logging.log4j.Logger;
+
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl;
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.FunctionAdapter;
+import org.apache.geode.cache.execute.FunctionContext;
+import org.apache.geode.internal.InternalEntity;
+import org.apache.geode.internal.cache.xmlcache.CacheXml;
+import 
org.apache.geode.management.internal.cli.commands.DestroyAsyncEventQueueCommand;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+
+/**
+ * Function used by the 'create async-event-queue' gfsh command to create an 
asynchronous event
+ * queue on a member.
+ *
+ * @since GemFire 8.0
+ */
 
 Review comment:
   This comment is inaccurate.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-13 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16289429#comment-16289429
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

jdeppe-pivotal commented on a change in pull request #1116: GEODE-2665: Add 
Gfsh command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r156699939
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
 ##
 @@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS;
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS_HELP;
+
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.logging.LogService;
+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.result.TabularResultData;
+import org.apache.geode.management.internal.configuration.domain.XmlEntity;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class DestroyAsyncEventQueueCommand implements GfshCommand {
+  public static final String DESTROY_ASYNC_EVENT_QUEUE = "destroy 
async-event-queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__HELP = "destroy an 
Async Event Queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID = "id";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID__HELP =
+  "ID of the queue to be destroyed.";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP =
+  "Group(s) of members on which to destroy the async event queue.";
+
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND =
+  "Async event queue \"%s\" not found";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED =
+  "Async event queue \"%s\" destroyed";
+
+  @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = 
DESTROY_ASYNC_EVENT_QUEUE__HELP)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+  operation = ResourcePermission.Operation.MANAGE)
+  public Result 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},
+  optionContext = ConverterHint.MEMBERGROUP,
+  help = DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP) String[] onGroups,
+  @CliOption(key = IFEXISTS, help = IFEXISTS_HELP, specifiedDefaultValue = 
"true",
+  unspecifiedDefaultValue = "false") boolean ifExists)
+  throws Throwable {
+DestroyAsyncEventQueueFunctionArgs asyncEventQueueDestoryFunctionArgs =
+new DestroyAsyncEventQueueFunctionArgs(aeqId, ifExists);
+
+Set members = getMembers(onGroups, null);
+if (members.size() == 0) {
+  String message = 
String.format(DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND, aeqId);
 
 Review comment:
   I think this is the wrong message here. Something more specific about 
members not found perhaps?


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
UR

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16281100#comment-16281100
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner commented on issue #1116: GEODE-2665: Add Gfsh command to delete 
async event queues
URL: https://github.com/apache/geode/pull/1116#issuecomment-349806774
 
 
   Before merging I'll have to refactor the Command and Test classes following 
PR#1127 merge.


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)


[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-06 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16281098#comment-16281098
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r155389831
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
 ##
 @@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS;
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS_HELP;
+
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.management.cli.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.result.TabularResultData;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class DestroyAsyncEventQueueCommand implements GfshCommand {
+  public static final String DESTROY_ASYNC_EVENT_QUEUE = "destroy 
async-event-queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__HELP = "destroy an 
Async Event Queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID = "id";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID__HELP =
+  "ID of the queue to be destroyed.";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP =
+  "Group(s) of members on which to destroy the async event queue.";
+
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND =
+  "Async event queue \"%s\" not found";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED =
+  "Async event queue \"%s\" destroyed";
+
+  @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = 
DESTROY_ASYNC_EVENT_QUEUE__HELP)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+  operation = ResourcePermission.Operation.MANAGE)
+  public Result 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},
+  optionContext = ConverterHint.MEMBERGROUP,
+  help = DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP) String[] onGroups,
+  @CliOption(key = IFEXISTS, help = IFEXISTS_HELP, specifiedDefaultValue = 
"true",
+  unspecifiedDefaultValue = "false") boolean ifExists) {
+DestroyAsyncEventQueueFunctionArgs asyncEventQueueDestoryFunctionArgs =
+new DestroyAsyncEventQueueFunctionArgs(aeqId, ifExists);
+
+Set members = getMembers(onGroups, null);
+
+List functionResults =
+execute(new DestroyAsyncEventQueueFunction(), 
asyncEventQueueDestoryFunctionArgs, members);
+
+TabularResultData tabularResultData = 
ResultBuilder.createTabularResultData();
+boolean errorOccurred = false;
+for (CliFunctionResult functionResult : functionResults) {
+  LogService.getLogger().info("FunctionResult = '" + functionResult + "'");
+  tabularResultData.accumulate("Member", 
functionResult.getMemberIdOrName());

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-04 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16277037#comment-16277037
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

jinmeiliao commented on a change in pull request #1116: GEODE-2665: Add Gfsh 
command to delete async event queues
URL: https://github.com/apache/geode/pull/1116#discussion_r154698337
 
 

 ##
 File path: 
geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DestroyAsyncEventQueueCommand.java
 ##
 @@ -0,0 +1,99 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.management.internal.cli.commands;
+
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS;
+import static 
org.apache.geode.management.internal.cli.i18n.CliStrings.IFEXISTS_HELP;
+
+import java.util.List;
+import java.util.Set;
+
+import org.springframework.shell.core.annotation.CliCommand;
+import org.springframework.shell.core.annotation.CliOption;
+
+import org.apache.geode.cache.execute.Function;
+import org.apache.geode.cache.execute.ResultCollector;
+import org.apache.geode.distributed.DistributedMember;
+import org.apache.geode.internal.logging.LogService;
+import org.apache.geode.management.cli.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.result.TabularResultData;
+import org.apache.geode.management.internal.security.ResourceOperation;
+import org.apache.geode.security.ResourcePermission;
+
+public class DestroyAsyncEventQueueCommand implements GfshCommand {
+  public static final String DESTROY_ASYNC_EVENT_QUEUE = "destroy 
async-event-queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__HELP = "destroy an 
Async Event Queue";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID = "id";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__ID__HELP =
+  "ID of the queue to be destroyed.";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP =
+  "Group(s) of members on which to destroy the async event queue.";
+
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_NOT_FOUND =
+  "Async event queue \"%s\" not found";
+  public static final String DESTROY_ASYNC_EVENT_QUEUE__AEQ_0_DESTROYED =
+  "Async event queue \"%s\" destroyed";
+
+  @CliCommand(value = DESTROY_ASYNC_EVENT_QUEUE, help = 
DESTROY_ASYNC_EVENT_QUEUE__HELP)
+  @ResourceOperation(resource = ResourcePermission.Resource.CLUSTER,
+  operation = ResourcePermission.Operation.MANAGE)
+  public Result 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},
+  optionContext = ConverterHint.MEMBERGROUP,
+  help = DESTROY_ASYNC_EVENT_QUEUE__GROUP__HELP) String[] onGroups,
+  @CliOption(key = IFEXISTS, help = IFEXISTS_HELP, specifiedDefaultValue = 
"true",
+  unspecifiedDefaultValue = "false") boolean ifExists) {
+DestroyAsyncEventQueueFunctionArgs asyncEventQueueDestoryFunctionArgs =
+new DestroyAsyncEventQueueFunctionArgs(aeqId, ifExists);
+
+Set members = getMembers(onGroups, null);
+
+List functionResults =
+execute(new DestroyAsyncEventQueueFunction(), 
asyncEventQueueDestoryFunctionArgs, members);
+
+TabularResultData tabularResultData = 
ResultBuilder.createTabularResultData();
+boolean errorOccurred = false;
+for (CliFunctionResult functionResult : functionResults) {
+  LogService.getLogger().info("FunctionResult = '" + functionResult + "'");
+  tabularResultData.accumulate("Member", 
functionResult.getMemberIdOrName())

[jira] [Commented] (GEODE-2665) Add gfsh command to destroy async-event-queue

2017-12-01 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/GEODE-2665?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16275220#comment-16275220
 ] 

ASF GitHub Bot commented on GEODE-2665:
---

pdxrunner opened a new pull request #1116: GEODE-2665: Add Gfsh command to 
delete async event queues
URL: https://github.com/apache/geode/pull/1116
 
 
   New classes added for the Command, Function and FunctionArgs
   New test classes added for DUnit and Unit tests
   
   Command supports --if-exists option for idempotency
   
   Thank you for submitting a contribution to Apache Geode.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [X] Is there a JIRA ticket associated with this PR? Is it referenced in 
the commit message?
   
   - [X] Has your PR been rebased against the latest commit within the target 
branch (typically `develop`)?
   
   - [X] Is your initial contribution a single, squashed commit?
   
   - [X] Does `gradlew build` run cleanly?
   
   - [X] Have you written or updated unit tests to verify your changes?
   
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   
   ### Note:
   Please ensure that once the PR is submitted, you check travis-ci for build 
issues and
   submit an update to your PR as soon as possible. If you need help, please 
send an
   email to d...@geode.apache.org.
   


This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Add gfsh command to destroy async-event-queue
> -
>
> Key: GEODE-2665
> URL: https://issues.apache.org/jira/browse/GEODE-2665
> Project: Geode
>  Issue Type: Sub-task
>  Components: docs, gfsh
>Reporter: Swapnil Bawaskar
>Assignee: Kenneth Howe
> Fix For: 1.4.0
>
>
> Currently, there is only an {{create async-event-queue}} command in gfsh, we 
> need the corresponding {{destroy async-event-queue}}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)