nabarunnag commented on a change in pull request #6663:
URL: https://github.com/apache/geode/pull/6663#discussion_r678713224
##########
File path:
geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANStatsDUnitTest.java
##########
@@ -390,6 +391,139 @@ public void
testPRParallelPropagationWithoutGroupTransactionEventsSendsBatchesWi
assertEquals(0, v4List.get(5) + v5List.get(5) + v6List.get(5) +
v7List.get(5));
}
+ @Test
+ public void
testPRParallelPropagationWithGroupTransactionEventsWithoutBatchRedistributionSendsBatchesWithCompleteTransactions_SeveralClients()
{
+
testPRParallelPropagationWithGroupTransactionEventsSendsBatchesWithCompleteTransactions_SeveralClients(
+ false);
+ }
+
+ @Test
+ public void
testPRParallelPropagationWithGroupTransactionEventsWithBatchRedistributionSeveralClientsWithSendsBatchesWithCompleteTransactions_SeveralClients()
{
+
testPRParallelPropagationWithGroupTransactionEventsSendsBatchesWithCompleteTransactions_SeveralClients(
+ true);
+ }
+
+ public void
testPRParallelPropagationWithGroupTransactionEventsSendsBatchesWithCompleteTransactions_SeveralClients(
+ boolean isBatchesRedistributed) {
+ Integer lnPort = vm0.invoke(() ->
WANTestBase.createFirstLocatorWithDSId(1));
+ Integer nyPort = vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2,
lnPort));
+
+ createCacheInVMs(nyPort, vm2);
+
+ if (!isBatchesRedistributed) {
+ createReceiverInVMs(vm2);
+ }
+
+ createSenders(lnPort, true);
+
+ createReceiverCustomerOrderShipmentPR(vm2);
+
+ createSenderCustomerOrderShipmentPRs(vm4);
+ createSenderCustomerOrderShipmentPRs(vm5);
+ createSenderCustomerOrderShipmentPRs(vm6);
+ createSenderCustomerOrderShipmentPRs(vm7);
+
+ startSenderInVMs("ln", vm4, vm5, vm6, vm7);
+
+ int clients = 4;
+ int transactions = 300;
+ // batchSize is 10. Each transaction will contain 1 order + 3 shipments =
4 events.
+ // As a result, all batches will contain extra events to complete the
+ // transactions it will deliver.
+ int shipmentsPerTransaction = 3;
+
+ final List<Map<Object, Object>> customerData = new ArrayList<>(clients);
+ for (int intCustId = 0; intCustId < clients; intCustId++) {
+ final Map<Object, Object> custKeyValue = new HashMap<>();
+ CustId custId = new CustId(intCustId);
+ custKeyValue.put(custId, new Customer());
+ customerData.add(new HashMap());
+ vm4.invoke(() -> WANTestBase.putGivenKeyValue(customerRegionName,
custKeyValue));
+
+ for (int i = 0; i < transactions; i++) {
+ OrderId orderId = new OrderId(i, custId);
+ customerData.get(intCustId).put(orderId, new Order());
+ for (int j = 0; j < shipmentsPerTransaction; j++) {
+ customerData.get(intCustId).put(new ShipmentId(i + j, orderId), new
Shipment());
+ }
+ }
+ }
+
+ List<AsyncInvocation> asyncInvocations = new ArrayList<>(clients);
+
+ int eventsPerTransaction = shipmentsPerTransaction + 1;
+ for (int i = 0; i < clients; i++) {
+ final int intCustId = i;
+ AsyncInvocation asyncInvocation =
+ vm4.invokeAsync(() ->
WANTestBase.doOrderAndShipmentPutsInsideTransactions(
+ customerData.get(intCustId),
+ eventsPerTransaction));
+ asyncInvocations.add(asyncInvocation);
+ }
+
+ try {
+ for (AsyncInvocation asyncInvocation : asyncInvocations) {
+ asyncInvocation.await();
+ }
+ } catch (InterruptedException e) {
+ e.printStackTrace();
Review comment:
I think it will be better to fail the test here than printing the
stacktrace
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]