@Test
  @Parameters({"true, true", "true, false", "false, false"})
  public void testSuccessfulExecutionWhileRunningOpsOnRegion(
      boolean isPartitionedRegion,
      boolean isParallelGatewaySender) throws Exception {
    List<VM> serversInA = Arrays.asList(vm5, vm6, vm7);
    List<VM> serversInB = Collections.singletonList(vm3);
    VM serverInC = vm4;
    VM client = vm8;
    String senderIdInA = "B";
    String senderIdInB = "C";

    int senderLocatorPort = create3WanSitesAndClient(isPartitionedRegion, vm0,
        vm1, vm2, serversInA, serversInB, serverInC, client,
        senderIdInA, senderIdInB, true);

    int wanCopyRegionBatchSize = 20;
    int entries = 10000;
    Set<Long> keySet = LongStream.range(0L, entries).boxed().collect(Collectors.toSet());
    String regionName = getRegionName(isPartitionedRegion);
    // Put entries
    client.invoke(() -> doPutsFrom(regionName, 0, entries));

    // Check that entries are put in the region
    for (VM member : serversInA) {
      member.invoke(() -> validateRegionSize(regionName, entries));
    }

    // Create senders and receivers
    createSender(isParallelGatewaySender, serversInA, senderIdInA, 2);
    createSender(isParallelGatewaySender, serversInB, senderIdInB, 3);
    createReceivers(serversInB, serverInC);

    // Let maxRate be a 5th of the number of entries in order to have the
    // command running for about 5 seconds so that there is time
    // for the random operations to be done at the same time
    // as the command is running.
    // The rate is divided by the number of servers in case the sender is parallel
    int maxRate = (entries / 5) / (isParallelGatewaySender ? serversInA.size() : 1);

    // Execute wan-copy region command
    Callable<CommandResultAssert> wanCopyCommandCallable = () -> {
      String command = new CommandStringBuilder(WAN_COPY_REGION)
          .addOption(WAN_COPY_REGION__REGION, regionName)
          .addOption(WAN_COPY_REGION__SENDERID, senderIdInA)
          .addOption(WAN_COPY_REGION__BATCHSIZE, String.valueOf(wanCopyRegionBatchSize))
          .addOption(WAN_COPY_REGION__MAXRATE, String.valueOf(maxRate))
          .getCommandString();
      try {
        gfsh.connectAndVerify(senderLocatorPort, GfshCommandRule.PortType.locator);
      } catch (Exception e) {
        errorCollector.addError(e);
      }
      return gfsh.executeAndAssertThat(command);
    };

    Future<CommandResultAssert> wanCopyCommandFuture =
        executorServiceRule.submit(wanCopyCommandCallable);

    // Wait for the wan-copy command to start
    waitForWanCopyRegionCommandToStart(isParallelGatewaySender, isPartitionedRegion, serversInA);

    // While the command is running, send some random operations over the same keys
    AsyncInvocation<Void> asyncOps1 =
        client.invokeAsync(() -> sendRandomOpsFromClient(regionName, keySet, 3));
    AsyncInvocation<Void> asyncOps2 =
        client.invokeAsync(() -> sendRandomOpsFromClient(regionName, keySet, 3));
    AsyncInvocation<Void> asyncOps3 =
        client.invokeAsync(() -> sendRandomOpsFromClient(regionName, keySet, 3));

    // Check command status and output
    CommandResultAssert command = wanCopyCommandFuture.get();
    verifyStatusIsOk(command, serversInA.size());

    // Wait for random operations to finish
    asyncOps1.await();
    asyncOps2.await();
    asyncOps3.await();

    // Wait for entries to be replicated (replication queues empty)
    for (VM server : serversInA) {
      server.invoke(() -> getSenderStats(senderIdInA, 0));
    }

    // Check that the region's data is the same in sites "A" and "B"
    checkEqualRegionData(regionName, serversInA.get(0), serversInB.get(0), true);
  }
Scenario with 2 WAN sites: "A" and "B".
Initially, no replication is configured between sites.
Several entries are put in WAN site "A".

The following gateway senders are created and started:
- In "A" site: to replicate region entries to "B" site. Sender called "B".
(Replication is as follows: A -> B)

The "wan-copy region" command is run from "A" site passing sender "B".
Simultaneously, random operations for entries with the same
keys as the one previously put are run.

When the command finishes and the puts finish it
must be verified that the entries in the region in site "A"
are the same as the ones in region in site "B".
geode-wan/src/distributedTest/java/org/apache/geode/cache/wan/internal/cli/commands/WanCopyRegionCommandDistributedTest.java