use of org.apache.geode.cache.asyncqueue.AsyncEventListener in project geode by apache.
the class WANTestBase method getAsyncEventListenerMapSize.
public static int getAsyncEventListenerMapSize(String asyncEventQueueId) {
AsyncEventListener theListener = null;
Set<AsyncEventQueue> asyncEventQueues = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncQueue : asyncEventQueues) {
if (asyncEventQueueId.equals(asyncQueue.getId())) {
theListener = asyncQueue.getAsyncEventListener();
}
}
final Map eventsMap = ((MyAsyncEventListener) theListener).getEventsMap();
assertNotNull(eventsMap);
LogWriterUtils.getLogWriter().info("The events map size is " + eventsMap.size());
return eventsMap.size();
}
use of org.apache.geode.cache.asyncqueue.AsyncEventListener in project geode by apache.
the class MyGatewayEventSubstitutionFilter method validateAsyncEventListener.
public static void validateAsyncEventListener(String asyncQueueId, final int expectedSize) {
AsyncEventListener theListener = null;
Set<AsyncEventQueue> asyncEventQueues = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncQueue : asyncEventQueues) {
if (asyncQueueId.equals(asyncQueue.getId())) {
theListener = asyncQueue.getAsyncEventListener();
}
}
final Map eventsMap = ((MyAsyncEventListener) theListener).getEventsMap();
assertNotNull(eventsMap);
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
if (eventsMap.size() == expectedSize) {
return true;
}
return false;
}
public String description() {
return "Expected map entries: " + expectedSize + " but actual entries: " + eventsMap.size();
}
};
// TODO:Yogs
Wait.waitForCriterion(wc, 60000, 500, true);
}
use of org.apache.geode.cache.asyncqueue.AsyncEventListener in project geode by apache.
the class MyGatewayEventSubstitutionFilter method validateAsyncEventForOperationDetail.
public static void validateAsyncEventForOperationDetail(String asyncQueueId, final int expectedSize, boolean isLoad, boolean isPutAll) {
AsyncEventListener theListener = null;
Set<AsyncEventQueue> asyncEventQueues = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncQueue : asyncEventQueues) {
if (asyncQueueId.equals(asyncQueue.getId())) {
theListener = asyncQueue.getAsyncEventListener();
}
}
final Map eventsMap = ((MyAsyncEventListener_CacheLoader) theListener).getEventsMap();
assertNotNull(eventsMap);
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
if (eventsMap.size() == expectedSize) {
return true;
}
return false;
}
public String description() {
return "Expected map entries: " + expectedSize + " but actual entries: " + eventsMap.size();
}
};
// TODO:Yogs
Wait.waitForCriterion(wc, 60000, 500, true);
Collection values = eventsMap.values();
Iterator itr = values.iterator();
while (itr.hasNext()) {
AsyncEvent asyncEvent = (AsyncEvent) itr.next();
if (isLoad)
assertTrue(asyncEvent.getOperation().isLoad());
if (isPutAll)
assertTrue(asyncEvent.getOperation().isPutAll());
}
}
use of org.apache.geode.cache.asyncqueue.AsyncEventListener in project geode by apache.
the class MyGatewayEventSubstitutionFilter method createConcurrentAsyncEventQueue.
public static void createConcurrentAsyncEventQueue(String asyncChannelId, boolean isParallel, Integer maxMemory, Integer batchSize, boolean isConflation, boolean isPersistent, String diskStoreName, boolean isDiskSynchronous, int dispatcherThreads, OrderPolicy policy) {
createDiskStore(asyncChannelId, diskStoreName);
AsyncEventListener asyncEventListener = new MyAsyncEventListener();
AsyncEventQueueFactory factory = getInitialAsyncEventQueueFactory(isParallel, maxMemory, batchSize, isPersistent, diskStoreName);
factory.setDiskSynchronous(isDiskSynchronous);
factory.setBatchConflationEnabled(isConflation);
factory.setOrderPolicy(policy);
AsyncEventQueue asyncChannel = factory.create(asyncChannelId, asyncEventListener);
}
use of org.apache.geode.cache.asyncqueue.AsyncEventListener in project geode by apache.
the class MyGatewayEventSubstitutionFilter method getAsyncEventListener.
public static AsyncEventListener getAsyncEventListener(String asyncEventQueueId) {
AsyncEventListener theListener = null;
Set<AsyncEventQueue> asyncEventQueues = cache.getAsyncEventQueues();
for (AsyncEventQueue asyncQueue : asyncEventQueues) {
if (asyncEventQueueId.equals(asyncQueue.getId())) {
return asyncQueue.getAsyncEventListener();
}
}
return null;
}
Aggregations