use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class MyGatewayEventSubstitutionFilter method waitForSenderToBecomePrimary.
public static void waitForSenderToBecomePrimary(String senderId) {
Set<GatewaySender> senders = ((GemFireCacheImpl) cache).getAllGatewaySenders();
final GatewaySender sender = getGatewaySenderById(senders, senderId);
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
if (sender != null && ((AbstractGatewaySender) sender).isPrimary()) {
return true;
}
return false;
}
public String description() {
return "Expected sender primary state to be true but is false";
}
};
Wait.waitForCriterion(wc, 10000, 1000, true);
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class CacheXml70GatewayDUnitTest method testParallelGatewaySender.
@Test
public void testParallelGatewaySender() throws Exception {
getSystem();
CacheCreation cache = new CacheCreation();
GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
gatewaySenderFactory.setParallel(true);
gatewaySenderFactory.setDispatcherThreads(13);
gatewaySenderFactory.setManualStart(true);
gatewaySenderFactory.setSocketBufferSize(1234);
gatewaySenderFactory.setSocketReadTimeout(1050);
gatewaySenderFactory.setBatchConflationEnabled(false);
gatewaySenderFactory.setBatchSize(88);
gatewaySenderFactory.setBatchTimeInterval(9);
gatewaySenderFactory.setPersistenceEnabled(true);
gatewaySenderFactory.setDiskStoreName("LNSender");
gatewaySenderFactory.setDiskSynchronous(true);
gatewaySenderFactory.setMaximumQueueMemory(211);
gatewaySenderFactory.setAlertThreshold(35);
GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
GatewaySender parallelGatewaySender = gatewaySenderFactory.create("LN", 2);
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
for (GatewaySender sender : sendersOnCache) {
assertEquals(true, sender.isParallel());
validateGatewaySender(parallelGatewaySender, sender);
}
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class CacheXml70GatewayDUnitTest method testSerialGatewaySender.
@Test
public void testSerialGatewaySender() throws Exception {
getSystem();
CacheCreation cache = new CacheCreation();
GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
gatewaySenderFactory.setParallel(false);
gatewaySenderFactory.setManualStart(true);
gatewaySenderFactory.setSocketBufferSize(124);
gatewaySenderFactory.setSocketReadTimeout(1000);
gatewaySenderFactory.setBatchConflationEnabled(false);
gatewaySenderFactory.setBatchSize(100);
gatewaySenderFactory.setBatchTimeInterval(10);
gatewaySenderFactory.setPersistenceEnabled(true);
gatewaySenderFactory.setDiskStoreName("LNSender");
gatewaySenderFactory.setDiskSynchronous(true);
gatewaySenderFactory.setMaximumQueueMemory(200);
gatewaySenderFactory.setAlertThreshold(30);
GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
GatewaySender serialGatewaySender = gatewaySenderFactory.create("LN", 2);
RegionAttributesCreation attrs = new RegionAttributesCreation();
attrs.addGatewaySenderId(serialGatewaySender.getId());
cache.createRegion("UserRegion", attrs);
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
for (GatewaySender sender : sendersOnCache) {
assertEquals(false, sender.isParallel());
validateGatewaySender(serialGatewaySender, sender);
}
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class UpdateVersionDUnitTest method startSender.
public static void startSender(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
sender.start();
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class UpdateVersionDUnitTest method waitForSenderRunningState.
public static void waitForSenderRunningState(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
final GatewaySender sender = getGatewaySenderById(senders, senderId);
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
if (sender != null && sender.isRunning()) {
return true;
}
return false;
}
public String description() {
return "Expected sender isRunning state to be true but is false";
}
};
Wait.waitForCriterion(wc, 300000, 500, true);
}
Aggregations