Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albertogpz committed Dec 15, 2021
1 parent 9fc42b6 commit 1ac52a6
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ public interface GatewaySender {
.getInteger(GeodeGlossary.GEMFIRE_PREFIX + "gateway-connection-retry-interval", 1000)
.intValue();

String DEFAULT_TYPE = "SerialGatewaySender";

/**
* The order policy. This enum is applicable only when concurrency-level is > 1.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public class GatewaySenderAttributesImpl implements MutableGatewaySenderAttribut

private boolean groupTransactionEvents = GatewaySender.DEFAULT_MUST_GROUP_TRANSACTION_EVENTS;

private String type = GatewaySender.DEFAULT_TYPE;
private String type;

private boolean isForInternalUse = GatewaySender.DEFAULT_IS_FOR_INTERNAL_USE;

Expand Down Expand Up @@ -179,7 +179,7 @@ public void setGroupTransactionEvents(boolean groupTransEvents) {

public void setType(String type) {
this.type = type;
isParallel = type.equals("Parallel") ? true : false;
isParallel = type.contains("Parallel") ? true : false;
}

public void setForInternalUse(boolean forInternalUse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ private GatewaySender createGatewaySender(Cache cache,

String type = gatewaySenderCreateArgs.getType();
if (type != null) {
gateway.setType(gatewaySenderCreateArgs.getType());
gateway.setParallel(gatewaySenderCreateArgs.getType().contains("Parallel"));
gateway.setType(type);
gateway.setParallel(type.contains("Parallel"));
} else {
Boolean isParallel = gatewaySenderCreateArgs.isParallel();
if (isParallel != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
@RunWith(GeodeParamsRunner.class)
public class TxGroupingPartitionedRegionDUnitTest extends TxGroupingBaseDUnitTest {
@Test
@Parameters({"TxGroupParallelGatewaySender", "TxGroupSerialGatewaySender"})
@Parameters({"TxGroupingParallelGatewaySender", "TxGroupingSerialGatewaySender"})
public void testPartitionedRegionPropagationWithGroupTransactionEventsAndMixOfEventsInAndNotInTransactions(
String type)
throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.cache.wan.GatewaySenderFactory;
import org.apache.geode.cache.wan.internal.txgrouping.serial.TxGroupingSerialGatewaySenderImpl;
import org.apache.geode.internal.cache.wan.GatewaySenderException;

public class WanTxGroupingConfigurationJUnitTest {
Expand Down Expand Up @@ -63,9 +64,8 @@ public void test_ValidateSerialGatewaySenderGroupTransactionEventsAttributeSetTo
public void test_create_SerialGatewaySender_ThrowsException_when_GroupTransactionEvents_isTrue_and_DispatcherThreads_is_greaterThanOne() {
cache = new CacheFactory().set(MCAST_PORT, "0").create();
GatewaySenderFactory fact = cache.createGatewaySenderFactory();
fact.setParallel(false);
fact.setDispatcherThreads(2);
fact.setGroupTransactionEvents(true);
fact.setType(TxGroupingSerialGatewaySenderImpl.TYPE);
assertThatThrownBy(() -> fact.create("NYSender", 2))
.isInstanceOf(GatewaySenderException.class)
.hasMessageContaining(
Expand All @@ -77,7 +77,7 @@ public void test_create_GatewaySender_ThrowsException_when_GroupTransactionEvent
cache = new CacheFactory().set(MCAST_PORT, "0").create();
GatewaySenderFactory fact = cache.createGatewaySenderFactory();
fact.setBatchConflationEnabled(true);
fact.setGroupTransactionEvents(true);
fact.setType(TxGroupingSerialGatewaySenderImpl.TYPE);
assertThatThrownBy(() -> fact.create("NYSender", 2))
.isInstanceOf(GatewaySenderException.class)
.hasMessageContaining(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.geode.cache.wan.GatewaySender;
import org.apache.geode.cache.wan.GatewaySenderFactory;
import org.apache.geode.cache.wan.GatewayTransportFilter;
import org.apache.geode.cache.wan.internal.parallel.ParallelGatewaySenderImpl;
import org.apache.geode.cache30.MyGatewayEventFilter1;
import org.apache.geode.cache30.MyGatewayTransportFilter1;
import org.apache.geode.cache30.MyGatewayTransportFilter2;
Expand Down Expand Up @@ -69,7 +70,7 @@ public void test_GatewaySender_without_Locator() {
cache = new CacheFactory().set(MCAST_PORT, "0").create();

GatewaySenderFactory fact = cache.createGatewaySenderFactory();
fact.setParallel(true);
fact.setType(ParallelGatewaySenderImpl.TYPE);
GatewaySender sender1 = fact.create("NYSender", 2);
sender1.start();
fail("Expected IllegalStateException but not thrown");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
import org.apache.geode.cache.wan.GatewaySender.OrderPolicy;
import org.apache.geode.cache.wan.GatewaySenderFactory;
import org.apache.geode.cache.wan.GatewayTransportFilter;
import org.apache.geode.cache.wan.internal.parallel.ParallelGatewaySenderImpl;
import org.apache.geode.cache.wan.internal.serial.SerialGatewaySenderImpl;
import org.apache.geode.distributed.internal.InternalDistributedSystem;
import org.apache.geode.internal.cache.GemFireCacheImpl;
import org.apache.geode.internal.cache.InternalCache;
Expand Down Expand Up @@ -220,6 +222,13 @@ public GatewaySenderFactory setEnforceThreadsConnectSameReceiver(
public @NotNull GatewaySender create(final @NotNull String id, final int remoteDSId) {
attrs.setId(id);
attrs.setRemoteDs(remoteDSId);
if (attrs.getType() == null) {
if (attrs.isParallel()) {
attrs.setType(ParallelGatewaySenderImpl.TYPE);
} else {
attrs.setType(SerialGatewaySenderImpl.TYPE);
}
}

validate(cache, attrs);

Expand Down

0 comments on commit 1ac52a6

Please sign in to comment.