use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method validateAfterAck.
public static Integer validateAfterAck(final String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
final MyGatewayEventFilter_AfterAck filter = (MyGatewayEventFilter_AfterAck) sender.getGatewayEventFilters().get(0);
return filter.getAckList().size();
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method checkStats_Failover.
public static void checkStats_Failover(String senderId, final int eventsReceived) {
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(eventsReceived, statistics.getEventsReceived());
assertEquals(eventsReceived, (statistics.getEventsQueued() + statistics.getUnprocessedTokensAddedByPrimary() + statistics.getUnprocessedEventsRemovedByPrimary()));
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class WANTestBase method getSenderToReceiverConnectionInfo.
public static Map getSenderToReceiverConnectionInfo(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
Map connectionInfo = null;
if (!sender.isParallel() && ((AbstractGatewaySender) sender).isPrimary()) {
connectionInfo = new HashMap();
GatewaySenderEventDispatcher dispatcher = ((AbstractGatewaySender) sender).getEventProcessor().getDispatcher();
if (dispatcher instanceof GatewaySenderEventRemoteDispatcher) {
ServerLocation serverLocation = ((GatewaySenderEventRemoteDispatcher) dispatcher).getConnection(false).getServer();
connectionInfo.put("serverHost", serverLocation.getHostName());
connectionInfo.put("serverPort", serverLocation.getPort());
}
}
return connectionInfo;
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class MyGatewayEventSubstitutionFilter 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();
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
if (size == 0) {
return true;
}
return false;
}
public String description() {
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
return "Expected queue size to be : " + 0 + " but actual entries: " + size;
}
};
Wait.waitForCriterion(wc, 60000, 500, true);
} else {
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
if (size == 0) {
return true;
}
return false;
}
public String description() {
Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
int size = 0;
for (RegionQueue q : queues) {
size += q.size();
}
return "Expected queue size to be : " + 0 + " but actual entries: " + size;
}
};
Wait.waitForCriterion(wc, 60000, 500, true);
}
}
use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.
the class MyGatewayEventSubstitutionFilter method unsetRemoveFromQueueOnException.
public static void unsetRemoveFromQueueOnException(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
GatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = s;
break;
}
}
assertNotNull(sender);
((AbstractGatewaySender) sender).setRemoveFromQueueOnException(false);
}
Aggregations