From 214dc766936864eef89b79b1f3b0182808443d65 Mon Sep 17 00:00:00 2001 From: Alberto Gomez Date: Fri, 5 Nov 2021 08:16:10 +0100 Subject: [PATCH] MODULE: Add gfsh create tx-grouping gw-sender cases. --- ...reateTxGroupingGatewaySenderDUnitTest.java | 109 ++++++++++++++++++ ...eDestroyGatewaySenderCommandDUnitTest.java | 5 +- 2 files changed, 111 insertions(+), 3 deletions(-) create mode 100644 geode-wan-txgrouping/src/distributedTest/java/org/apache/geode/internal/cache/wan/txgrouping/cli/commands/CreateTxGroupingGatewaySenderDUnitTest.java diff --git a/geode-wan-txgrouping/src/distributedTest/java/org/apache/geode/internal/cache/wan/txgrouping/cli/commands/CreateTxGroupingGatewaySenderDUnitTest.java b/geode-wan-txgrouping/src/distributedTest/java/org/apache/geode/internal/cache/wan/txgrouping/cli/commands/CreateTxGroupingGatewaySenderDUnitTest.java new file mode 100644 index 000000000000..e0f4abd86d2b --- /dev/null +++ b/geode-wan-txgrouping/src/distributedTest/java/org/apache/geode/internal/cache/wan/txgrouping/cli/commands/CreateTxGroupingGatewaySenderDUnitTest.java @@ -0,0 +1,109 @@ +/* + * 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.internal.cache.wan.txgrouping.cli.commands; + +import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException; + +import java.util.Properties; + +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; + +import org.apache.geode.test.dunit.rules.ClusterStartupRule; +import org.apache.geode.test.dunit.rules.MemberVM; +import org.apache.geode.test.junit.assertions.CommandResultAssert; +import org.apache.geode.test.junit.rules.GfshCommandRule; + +public class CreateTxGroupingGatewaySenderDUnitTest { + + @Rule + public ClusterStartupRule cluster = new ClusterStartupRule(); + + @Rule + public GfshCommandRule gfsh = new GfshCommandRule(); + + MemberVM locator; + + @Before + public void before() throws Exception { + locator = cluster.startLocatorVM(0); + cluster.startServerVM(1, new Properties(), locator.getPort()); + gfsh.connectAndVerify(locator); + } + + @Test + public void createTxGroupingParallelGatewaySender() { + addIgnoredException("could not get remote locator"); + + String createCommandString = + "create gateway-sender --id=sender1 --remote-distributed-system-id=1 --parallel --group-transaction-events=true"; + + // Check command status and output + CommandResultAssert createCommand = + gfsh.executeAndAssertThat(createCommandString).statusIsSuccess(); + createCommand + .hasTableSection() + .hasColumn("Member") + .containsExactly("server-1"); + + + String listCommandString = "list gateways --senders-only"; + CommandResultAssert listCommand = + gfsh.executeAndAssertThat(listCommandString).statusIsSuccess(); + + listCommand + .hasTableSection() + .hasColumn("GatewaySender Id") + .containsExactly("sender1"); + + listCommand + .hasTableSection() + .hasColumn("Type") + .containsExactly("Parallel"); + } + + @Test + public void createTxGroupingSerialGatewaySender() { + addIgnoredException("could not get remote locator"); + + String createCommandString = + "create gateway-sender --id=sender1 --remote-distributed-system-id=1 --dispatcher-threads=1 --group-transaction-events=true"; + + // Check command status and output + CommandResultAssert createCommand = + gfsh.executeAndAssertThat(createCommandString).statusIsSuccess(); + createCommand + .hasTableSection() + .hasColumn("Member") + .containsExactly("server-1"); + + + String listCommandString = "list gateways --senders-only"; + CommandResultAssert listCommand = + gfsh.executeAndAssertThat(listCommandString).statusIsSuccess(); + + listCommand + .hasTableSection() + .hasColumn("GatewaySender Id") + .containsExactly("sender1"); + + listCommand + .hasTableSection() + .hasColumn("Type") + .containsExactly("Serial"); + } +} diff --git a/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateDestroyGatewaySenderCommandDUnitTest.java b/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateDestroyGatewaySenderCommandDUnitTest.java index 854329ec507e..9a2a32a81c36 100644 --- a/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateDestroyGatewaySenderCommandDUnitTest.java +++ b/geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/wancommand/CreateDestroyGatewaySenderCommandDUnitTest.java @@ -191,8 +191,7 @@ public void testCreateDestroyGatewaySenderWithSingleDispatcherThread() { + "=ln" + " --" + CliStrings.CREATE_GATEWAYSENDER__REMOTEDISTRIBUTEDSYSTEMID + "=2" + " --" + CliStrings.CREATE_GATEWAYSENDER__MANUALSTART + "=true" + " --" + CliStrings.CREATE_GATEWAYSENDER__SOCKETBUFFERSIZE + "=1000" + " --" - + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=1" + " --" - + CliStrings.CREATE_GATEWAYSENDER__GROUPTRANSACTIONEVENTS + "=true"; + + CliStrings.CREATE_GATEWAYSENDER__DISPATCHERTHREADS + "=1" + " --"; gfsh.executeAndAssertThat(command).statusIsSuccess() .doesNotContainOutput("Did not complete waiting") @@ -204,7 +203,7 @@ public void testCreateDestroyGatewaySenderWithSingleDispatcherThread() { VMProvider.invokeInEveryMember(() -> { verifySenderState("ln", false, false); verifySenderAttributes("ln", 2, false, true, 1000, 0, false, 100, 1000, false, - true, 100, 0, 1, null, null, null, true); + true, 100, 0, 1, null, null, null, false); }, server1, server2, server3); // destroy gateway sender and verify AEQs cleaned up