mivanac commented on code in PR #7323: URL: https://github.com/apache/geode/pull/7323#discussion_r858373193
########## geode-core/src/test/java/org/apache/geode/internal/cache/wan/parallel/ParallelQueueSetPossibleDuplicateMessageJUnitTest.java: ########## @@ -0,0 +1,198 @@ +/* + * 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.parallel; + +import static org.apache.geode.cache.Region.SEPARATOR; +import static org.apache.geode.internal.cache.wan.parallel.ParallelQueueSetPossibleDuplicateMessage.UNSUCCESSFULLY_DISPATCHED; +import static org.apache.geode.internal.statistics.StatisticsClockFactory.disabledClock; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.BlockingQueue; +import java.util.concurrent.LinkedBlockingQueue; + +import org.junit.Before; +import org.junit.Test; + +import org.apache.geode.distributed.internal.ClusterDistributionManager; +import org.apache.geode.internal.cache.BucketRegionQueue; +import org.apache.geode.internal.cache.BucketRegionQueueHelper; +import org.apache.geode.internal.cache.GemFireCacheImpl; +import org.apache.geode.internal.cache.PartitionedRegion; +import org.apache.geode.internal.cache.PartitionedRegionHelper; +import org.apache.geode.internal.cache.wan.AbstractGatewaySender; +import org.apache.geode.internal.cache.wan.GatewaySenderEventImpl; +import org.apache.geode.internal.cache.wan.GatewaySenderStats; +import org.apache.geode.internal.statistics.DummyStatisticsFactory; +import org.apache.geode.test.fake.Fakes; + +public class ParallelQueueSetPossibleDuplicateMessageJUnitTest { + + private static final String GATEWAY_SENDER_ID = "ny"; + private static final int BUCKET_ID = 85; + private static final long KEY = 198; + + private GemFireCacheImpl cache; Review Comment: Since ParallelGatewaySenderHelper is used in UT, mock cache needs to be GemFireCacheImpl, as it is in other tests. ########## geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/parallel/ParallelWANPersistenceEnabledGatewaySenderCheckPossibleDuplicateDUnitTest.java: ########## @@ -0,0 +1,182 @@ +/* + * 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.parallel; + +import static org.assertj.core.api.Assertions.assertThat; + +import org.apache.logging.log4j.Logger; +import org.junit.Test; +import org.junit.experimental.categories.Category; + +import org.apache.geode.internal.cache.wan.WANTestBase; +import org.apache.geode.logging.internal.log4j.api.LogService; +import org.apache.geode.test.dunit.IgnoredException; +import org.apache.geode.test.junit.categories.WanTest; + +@Category({WanTest.class}) +public class ParallelWANPersistenceEnabledGatewaySenderCheckPossibleDuplicateDUnitTest + extends WANTestBase { + + private static final long serialVersionUID = 2L; + private static final Logger logger = LogService.getLogger(); + + public ParallelWANPersistenceEnabledGatewaySenderCheckPossibleDuplicateDUnitTest() { + super(); + } + + @Override + protected final void postSetUpWANTestBase() throws Exception { + // The restart tests log this string + IgnoredException.addIgnoredException("failed accepting client connection"); + } + + /** + * When gateway senders starts to unqueue, and check that received events are + * not marked as possible duplicate. + */ + @Test + public void testPersistentPartitionedRegionWithGatewaySenderCheckReceiverNoPossibleDuplicate() + throws InterruptedException { + Integer lnPort = vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1)); + Integer nyPort = vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort)); + Review Comment: updated -- 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]
