use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method validateQueueContents.
public static void validateQueueContents(final String senderId, final int regionSize) {
IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class.getName());
IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
if (!sender.isParallel()) {
final Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
Awaitility.await().atMost(120, TimeUnit.SECONDS).until(() -> {
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
assertEquals("Expected queue entries: " + regionSize + " but actual entries: " + size, regionSize, size);
});
} else if (sender.isParallel()) {
final RegionQueue regionQueue;
regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
Awaitility.await().atMost(120, TimeUnit.SECONDS).until(() -> assertEquals("Expected queue entries: " + regionSize + " but actual entries: " + regionQueue.size(), regionSize, regionQueue.size()));
}
} finally {
exp1.remove();
exp2.remove();
}
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method checkQueueStats.
public static void checkQueueStats(String senderId, final int queueSize, final int eventsReceived, final int eventsQueued, final int eventsDistributed) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
final GatewaySenderStats statistics = ((AbstractGatewaySender) sender).getStatistics();
assertEquals(queueSize, statistics.getEventQueueSize());
assertEquals(eventsReceived, statistics.getEventsReceived());
assertEquals(eventsQueued, statistics.getEventsQueued());
assert (statistics.getEventsDistributed() >= eventsDistributed);
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class ConcurrentSerialGatewaySenderOperationsDUnitTest 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 ConcurrentSerialGatewaySenderOperationsDUnitTest 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 ConcurrentSerialGatewaySenderOperationsDUnitTest method verifySenderPausedState.
public static void verifySenderPausedState(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
AbstractGatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = (AbstractGatewaySender) s;
break;
}
}
assertTrue(sender.isPaused());
}
Aggregations