use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class SerialGatewaySenderEventListenerDUnitTest method validateReceivedEventsMapSizeListener1.
public static void validateReceivedEventsMapSizeListener1(final String senderId, final Map map) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
final List<AsyncEventListener> listeners = ((AbstractGatewaySender) sender).getAsyncEventListeners();
if (listeners.size() == 1) {
final AsyncEventListener l = listeners.get(0);
WaitCriterion wc = new WaitCriterion() {
Map listenerMap;
public boolean done() {
listenerMap = ((MyGatewaySenderEventListener) l).getEventsMap();
boolean sizeCorrect = map.size() == listenerMap.size();
boolean keySetCorrect = listenerMap.keySet().containsAll(map.keySet());
boolean valuesCorrect = listenerMap.values().containsAll(map.values());
return sizeCorrect && keySetCorrect && valuesCorrect;
}
public String description() {
return "Waiting for all sites to get updated, the sizes are " + listenerMap.size() + " and " + map.size();
}
};
Wait.waitForCriterion(wc, 60000, 500, true);
}
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class SerialGatewaySenderOperationsDUnitTest method verifySenderResumedState.
public static void verifySenderResumedState(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
AbstractGatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = (AbstractGatewaySender) s;
break;
}
}
assertFalse(sender.isPaused());
assertTrue(sender.isRunning());
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class SerialGatewaySenderOperationsDUnitTest method verifyGatewaySenderOperations.
public static void verifyGatewaySenderOperations(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
assertFalse(sender.isPaused());
assertFalse(((AbstractGatewaySender) sender).isRunning());
sender.pause();
sender.resume();
sender.stop();
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class SerialGatewaySenderOperationsDUnitTest method verifySenderStoppedState.
public static void verifySenderStoppedState(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
AbstractGatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = (AbstractGatewaySender) s;
break;
}
}
assertFalse(sender.isRunning());
assertFalse(sender.isPaused());
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class ParallelWANPersistenceEnabledGatewaySenderDUnitTest method testPartitionedRegionWithGatewaySenderPersistenceEnabled.
@Test
public void testPartitionedRegionWithGatewaySenderPersistenceEnabled() throws IOException {
try {
Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
Integer nyPort = (Integer) vm1.invoke(() -> WANTestBase.createFirstRemoteLocator(2, lnPort));
createCache(lnPort);
GatewaySenderFactory fact = cache.createGatewaySenderFactory();
fact.setPersistenceEnabled(true);
fact.setParallel(true);
final IgnoredException ex = IgnoredException.addIgnoredException("Could not connect");
try {
GatewaySender sender1 = fact.create("NYSender", 2);
AttributesFactory rFact = new AttributesFactory();
rFact.addGatewaySenderId(sender1.getId());
PartitionAttributesFactory pFact = new PartitionAttributesFactory();
pFact.setTotalNumBuckets(100);
pFact.setRedundantCopies(1);
rFact.setPartitionAttributes(pFact.create());
Region r = cache.createRegionFactory(rFact.create()).create("MyRegion");
sender1.start();
} finally {
ex.remove();
}
} catch (Exception e) {
fail("Unexpected Exception :" + e);
}
}
Aggregations