use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method waitForAsyncQueueToGetEmpty.
public static void waitForAsyncQueueToGetEmpty(String asyncQueueId) {
AsyncEventQueue theAsyncEventQueue = null;
Set<AsyncEventQueue> asyncEventChannels = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncChannel : asyncEventChannels) {
if (asyncQueueId.equals(asyncChannel.getId())) {
theAsyncEventQueue = asyncChannel;
}
}
final GatewaySender sender = ((AsyncEventQueueImpl) theAsyncEventQueue).getSender();
if (sender.isParallel()) {
final Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
assertEquals("Expected queue size to be : " + 0 + " but actual entries: " + size, 0, size);
});
} else {
Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
assertEquals("Expected queue size to be : " + 0 + " but actual entries: " + size, 0, size);
});
}
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method validateParallelSenderQueueBucketSize.
public static void validateParallelSenderQueueBucketSize(final String senderId, final int bucketSize) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
RegionQueue regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
Set<BucketRegion> buckets = ((PartitionedRegion) regionQueue.getRegion()).getDataStore().getAllLocalPrimaryBucketRegions();
for (BucketRegion bucket : buckets) {
assertEquals("Expected bucket entries for bucket " + bucket.getId() + " is different than actual.", bucketSize, bucket.keySet().size());
}
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method waitForConcurrentSerialSenderQueueToDrain.
public static void waitForConcurrentSerialSenderQueueToDrain(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = senders.stream().filter(s -> s.getId().equals(senderId)).findFirst().get();
Awaitility.await().atMost(1, TimeUnit.MINUTES).until(() -> {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueuesForConcurrentSerialGatewaySender();
for (RegionQueue q : queues) {
assertEquals(0, q.size());
}
});
}
use of org.apache.geode.internal.cache.RegionQueue in project geode by apache.
the class WANTestBase method testQueueSize.
public static void testQueueSize(String senderId, int numQueueEntries) {
GatewaySender sender = null;
for (GatewaySender s : cache.getGatewaySenders()) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
if (sender.isParallel()) {
int totalSize = 0;
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
for (RegionQueue q : queues) {
ConcurrentParallelGatewaySenderQueue prQ = (ConcurrentParallelGatewaySenderQueue) q;
totalSize += prQ.size();
}
assertEquals(numQueueEntries, totalSize);
} else {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
assertEquals(numQueueEntries, size);
}
}
Aggregations