|
| 1 | +/* |
| 2 | + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license |
| 3 | + * agreements. See the NOTICE file distributed with this work for additional information regarding |
| 4 | + * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the |
| 5 | + * "License"); you may not use this file except in compliance with the License. You may obtain a |
| 6 | + * copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software distributed under the License |
| 11 | + * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
| 12 | + * or implied. See the License for the specific language governing permissions and limitations under |
| 13 | + * the License. |
| 14 | + */ |
| 15 | + |
| 16 | +package org.apache.geode.internal.cache.wan.txgrouping.cli.commands; |
| 17 | + |
| 18 | +import static org.apache.geode.test.dunit.IgnoredException.addIgnoredException; |
| 19 | + |
| 20 | +import java.util.Properties; |
| 21 | + |
| 22 | +import org.junit.Before; |
| 23 | +import org.junit.Rule; |
| 24 | +import org.junit.Test; |
| 25 | + |
| 26 | +import org.apache.geode.test.dunit.rules.ClusterStartupRule; |
| 27 | +import org.apache.geode.test.dunit.rules.MemberVM; |
| 28 | +import org.apache.geode.test.junit.assertions.CommandResultAssert; |
| 29 | +import org.apache.geode.test.junit.rules.GfshCommandRule; |
| 30 | + |
| 31 | +public class CreateTxGroupingGatewaySenderDUnitTest { |
| 32 | + |
| 33 | + @Rule |
| 34 | + public ClusterStartupRule cluster = new ClusterStartupRule(); |
| 35 | + |
| 36 | + @Rule |
| 37 | + public GfshCommandRule gfsh = new GfshCommandRule(); |
| 38 | + |
| 39 | + MemberVM locator; |
| 40 | + |
| 41 | + @Before |
| 42 | + public void before() throws Exception { |
| 43 | + locator = cluster.startLocatorVM(0); |
| 44 | + cluster.startServerVM(1, new Properties(), locator.getPort()); |
| 45 | + gfsh.connectAndVerify(locator); |
| 46 | + } |
| 47 | + |
| 48 | + @Test |
| 49 | + public void createTxGroupingParallelGatewaySender() { |
| 50 | + addIgnoredException("could not get remote locator"); |
| 51 | + |
| 52 | + String createCommandString = |
| 53 | + "create gateway-sender --id=sender1 --remote-distributed-system-id=1 --parallel --group-transaction-events=true"; |
| 54 | + |
| 55 | + // Check command status and output |
| 56 | + CommandResultAssert createCommand = |
| 57 | + gfsh.executeAndAssertThat(createCommandString).statusIsSuccess(); |
| 58 | + createCommand |
| 59 | + .hasTableSection() |
| 60 | + .hasColumn("Member") |
| 61 | + .containsExactly("server-1"); |
| 62 | + |
| 63 | + |
| 64 | + String listCommandString = "list gateways --senders-only"; |
| 65 | + CommandResultAssert listCommand = |
| 66 | + gfsh.executeAndAssertThat(listCommandString).statusIsSuccess(); |
| 67 | + |
| 68 | + listCommand |
| 69 | + .hasTableSection() |
| 70 | + .hasColumn("GatewaySender Id") |
| 71 | + .containsExactly("sender1"); |
| 72 | + |
| 73 | + listCommand |
| 74 | + .hasTableSection() |
| 75 | + .hasColumn("Type") |
| 76 | + .containsExactly("Parallel"); |
| 77 | + } |
| 78 | + |
| 79 | + @Test |
| 80 | + public void createTxGroupingSerialGatewaySender() { |
| 81 | + addIgnoredException("could not get remote locator"); |
| 82 | + |
| 83 | + String createCommandString = |
| 84 | + "create gateway-sender --id=sender1 --remote-distributed-system-id=1 --dispatcher-threads=1 --group-transaction-events=true"; |
| 85 | + |
| 86 | + // Check command status and output |
| 87 | + CommandResultAssert createCommand = |
| 88 | + gfsh.executeAndAssertThat(createCommandString).statusIsSuccess(); |
| 89 | + createCommand |
| 90 | + .hasTableSection() |
| 91 | + .hasColumn("Member") |
| 92 | + .containsExactly("server-1"); |
| 93 | + |
| 94 | + |
| 95 | + String listCommandString = "list gateways --senders-only"; |
| 96 | + CommandResultAssert listCommand = |
| 97 | + gfsh.executeAndAssertThat(listCommandString).statusIsSuccess(); |
| 98 | + |
| 99 | + listCommand |
| 100 | + .hasTableSection() |
| 101 | + .hasColumn("GatewaySender Id") |
| 102 | + .containsExactly("sender1"); |
| 103 | + |
| 104 | + listCommand |
| 105 | + .hasTableSection() |
| 106 | + .hasColumn("Type") |
| 107 | + .containsExactly("Serial"); |
| 108 | + } |
| 109 | +} |
0 commit comments