[ https://issues.apache.org/jira/browse/GEODE-3539?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16269530#comment-16269530 ]
ASF GitHub Bot commented on GEODE-3539: --------------------------------------- pdxrunner commented on a change in pull request #1093: GEODE-3539: add test coverage for "create async-event-queue" and "lis… URL: https://github.com/apache/geode/pull/1093#discussion_r153635536 ########## File path: geode-core/src/test/java/org/apache/geode/management/internal/cli/commands/ListAsyncEventQueuesCommandDUnitTest.java ########## @@ -0,0 +1,81 @@ +/* + * 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.test.junit.rules.GfshCommandRule.PortType.jmxManager; + +import org.junit.BeforeClass; +import org.junit.ClassRule; +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.test.dunit.rules.LocatorServerStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.categories.UnitTest; +import org.apache.geode.test.junit.rules.GfshCommandRule; + + +@Category(UnitTest.class) +public class ListAsyncEventQueuesCommandDUnitTest { + + @ClassRule + public static LocatorServerStartupRule lsRule = new LocatorServerStartupRule(); + + @Rule + public GfshCommandRule gfsh = new GfshCommandRule(locator::getJmxPort, jmxManager); + + private static MemberVM locator; + + @BeforeClass + public static void beforeClass() throws Exception { + locator = lsRule.startLocatorVM(0); + lsRule.startServerVM(1, "group1", locator.getPort()); + lsRule.startServerVM(2, "group2", locator.getPort()); + } + + @Test + public void list() throws Exception { + gfsh.executeAndAssertThat("list async-event-queue").statusIsSuccess() + .containsOutput("No Async Event Queues Found"); + + gfsh.executeAndAssertThat("create async-event-queue --id=queue1 --group=group1 --listener=" + + MyAsyncEventListener.class.getName()).statusIsSuccess(); + + gfsh.executeAndAssertThat("create async-event-queue --id=queue2 --group=group2 --listener=" + + MyAsyncEventListener.class.getName()).statusIsSuccess(); + + locator.waitTillAsyncEventQueuesAreReadyOnServers("queue1", 1); + locator.waitTillAsyncEventQueuesAreReadyOnServers("queue2", 1); + + gfsh.executeAndAssertThat("list async-event-queue").statusIsSuccess() + .tableHasRowCount("Member", 2).tableHasRowWithValues("Member", "ID", "server-1", "queue1") + .tableHasRowWithValues("Member", "ID", "server-2", "queue2"); + + // create another async event queue on the entire cluster, verify that the command will list all + gfsh.executeAndAssertThat( + "create async-event-queue --id=queue --listener=" + MyAsyncEventListener.class.getName()) + .statusIsSuccess(); + + gfsh.executeAndAssertThat("list async-event-queue").statusIsSuccess() + .tableHasRowCount("Member", 4).tableHasRowWithValues("Member", "ID", "server-1", "queue1") + .tableHasRowWithValues("Member", "ID", "server-2", "queue2") + .tableHasRowWithValues("Member", "ID", "server-1", "queue") + .tableHasRowWithValues("Member", "ID", "server-2", "queue"); Review comment: No, what I would envision is tableHasRowWithValues(Member, server-2, ID, queue2). I would keep the arguments separate but order arguments as pairs ..., header, value, ... . I agree that processing this wouldn't be quite as straightforward as String[] headers = Arrays.copyOfRange(headersThenValues, 0, numberOfColumn); String[] expectedValues = Arrays.copyOfRange(headersThenValues, numberOfColumn, headersThenValues.length); ---------------------------------------------------------------- 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 more test coverage for p2p commands > --------------------------------------- > > Key: GEODE-3539 > URL: https://issues.apache.org/jira/browse/GEODE-3539 > Project: Geode > Issue Type: Improvement > Components: gfsh > Reporter: Jinmei Liao > > Add more command tests that would eventually get rid of the legacy tests. -- This message was sent by Atlassian JIRA (v6.4.14#64029)