use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.
the class MyGatewayEventSubstitutionFilter method checkAsyncEventQueueSize.
public static void checkAsyncEventQueueSize(String asyncQueueId, int numQueueEntries) {
AsyncEventQueue theAsyncEventQueue = null;
Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncChannel : asyncEventChannels) {
if (asyncQueueId.equals(asyncChannel.getId())) {
theAsyncEventQueue = asyncChannel;
}
}
GatewaySender sender = ((AsyncEventQueueImpl) theAsyncEventQueue).getSender();
if (sender.isParallel()) {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
assertEquals(numQueueEntries, queues.toArray(new RegionQueue[queues.size()])[0].getRegion().size());
} else {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
assertEquals(numQueueEntries, size);
}
}
use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.
the class MyGatewayEventSubstitutionFilter method validateAsyncEventQueueAttributes.
/**
* Validate whether all the attributes set on AsyncEventQueueFactory are set on the sender
* underneath the AsyncEventQueue.
*/
public static void validateAsyncEventQueueAttributes(String asyncChannelId, int maxQueueMemory, int batchSize, int batchTimeInterval, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous, boolean batchConflationEnabled) {
AsyncEventQueue theChannel = null;
Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncChannel : asyncEventChannels) {
if (asyncChannelId.equals(asyncChannel.getId())) {
theChannel = asyncChannel;
}
}
GatewaySender theSender = ((AsyncEventQueueImpl) theChannel).getSender();
assertEquals("maxQueueMemory", maxQueueMemory, theSender.getMaximumQueueMemory());
assertEquals("batchSize", batchSize, theSender.getBatchSize());
assertEquals("batchTimeInterval", batchTimeInterval, theSender.getBatchTimeInterval());
assertEquals("isPersistent", isPersistent, theSender.isPersistenceEnabled());
assertEquals("diskStoreName", diskStoreName, theSender.getDiskStoreName());
assertEquals("isDiskSynchronous", isDiskSynchronous, theSender.isDiskSynchronous());
assertEquals("batchConflation", batchConflationEnabled, theSender.isBatchConflationEnabled());
}
use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.
the class MyGatewayEventSubstitutionFilter method checkAsyncEventQueueConflatedStats.
public static void checkAsyncEventQueueConflatedStats(String asyncEventQueueId, final int eventsConflated) {
Set<AsyncEventQueue> queues = cache.getAsyncEventQueues();
AsyncEventQueue queue = null;
for (AsyncEventQueue q : queues) {
if (q.getId().equals(asyncEventQueueId)) {
queue = q;
break;
}
}
final AsyncEventQueueStats statistics = ((AsyncEventQueueImpl) queue).getStatistics();
assertEquals(eventsConflated, statistics.getEventsNotQueuedConflated());
}
use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.
the class MyGatewayEventSubstitutionFilter method checkAsyncEventQueueStats.
public static void checkAsyncEventQueueStats(String queueId, final int queueSize, final int eventsReceived, final int eventsQueued, final int eventsDistributed) {
Set<AsyncEventQueue> asyncQueues = cache.getAsyncEventQueues();
AsyncEventQueue queue = null;
for (AsyncEventQueue q : asyncQueues) {
if (q.getId().equals(queueId)) {
queue = q;
break;
}
}
final AsyncEventQueueStats statistics = ((AsyncEventQueueImpl) queue).getStatistics();
assertEquals(queueSize, statistics.getEventQueueSize());
assertEquals(eventsReceived, statistics.getEventsReceived());
assertEquals(eventsQueued, statistics.getEventsQueued());
assert (statistics.getEventsDistributed() >= eventsDistributed);
}
use of org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl in project geode by apache.
the class MyGatewayEventSubstitutionFilter method checkAsyncEventQueueBatchStats.
public static void checkAsyncEventQueueBatchStats(String asyncQueueId, final int batches) {
Set<AsyncEventQueue> queues = cache.getAsyncEventQueues();
AsyncEventQueue queue = null;
for (AsyncEventQueue q : queues) {
if (q.getId().equals(asyncQueueId)) {
queue = q;
break;
}
}
final AsyncEventQueueStats statistics = ((AsyncEventQueueImpl) queue).getStatistics();
assert (statistics.getBatchesDistributed() >= batches);
assertEquals(0, statistics.getBatchesRedistributed());
}
Aggregations