use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method verifyRegionQueueNotEmpty.
public static void verifyRegionQueueNotEmpty(String senderId) {
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();
int queueSize = 0;
for (RegionQueue q : queues) {
queueSize += q.size();
}
assertTrue(queues.size() > 0);
assertTrue(queueSize > 0);
} else if (sender.isParallel()) {
RegionQueue regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
assertTrue(regionQueue.size() > 0);
}
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method addSecondCacheQueueListener.
private void addSecondCacheQueueListener(String senderId, boolean isParallel) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
listener2 = new QueueListener();
if (!isParallel) {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
for (RegionQueue q : queues) {
q.addCacheListener(listener2);
}
} else {
RegionQueue parallelQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
parallelQueue.addCacheListener(listener2);
}
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method addCacheListenerOnQueueBucketRegion.
private void addCacheListenerOnQueueBucketRegion(String senderId, int numBuckets) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
RegionQueue parallelQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
PartitionedRegion region = (PartitionedRegion) parallelQueue.getRegion();
for (int i = 0; i < numBuckets; i++) {
BucketRegion br = region.getBucketRegion(i);
if (br != null) {
AttributesMutator mutator = br.getAttributesMutator();
CacheListener listener = new QueueListener();
mutator.addCacheListener(listener);
}
}
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method checkQueue_BR.
public static HashMap checkQueue_BR(String senderId, int numBuckets) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
RegionQueue parallelQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
PartitionedRegion region = (PartitionedRegion) parallelQueue.getRegion();
HashMap listenerAttrs = new HashMap();
for (int i = 0; i < numBuckets; i++) {
BucketRegion br = region.getBucketRegion(i);
if (br != null) {
QueueListener listener = (QueueListener) br.getCacheListener();
if (listener != null) {
listenerAttrs.put("Create" + i, listener.createList);
listenerAttrs.put("Update" + i, listener.updateList);
listenerAttrs.put("Destroy" + i, listener.destroyList);
}
}
}
return listenerAttrs;
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method startSender.
public static void startSender(String senderId) {
final IgnoredException exln = IgnoredException.addIgnoredException("Could not connect");
IgnoredException exp = IgnoredException.addIgnoredException(ForceReattemptException.class.getName());
IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class.getName());
try {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
sender.start();
} finally {
exp.remove();
exp1.remove();
exln.remove();
}
}
Aggregations