use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testIsAsyncEventQueueUsingDiskStoreWhenUsingDefaultDiskStore.
@Test
public void testIsAsyncEventQueueUsingDiskStoreWhenUsingDefaultDiskStore() {
final AsyncEventQueue mockQueue = mockContext.mock(AsyncEventQueue.class, "AsyncEventQueue");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
oneOf(mockQueue).getDiskStoreName();
will(returnValue(" "));
oneOf(mockQueue).isPersistent();
will(returnValue(true));
oneOf(mockDiskStore).getName();
will(returnValue(DiskStoreDetails.DEFAULT_DISK_STORE_NAME));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertTrue(function.isUsingDiskStore(mockQueue, mockDiskStore));
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class PDXAsyncEventQueueDUnitTest method createSerialAsyncEventQueue.
protected void createSerialAsyncEventQueue(VM vm, final boolean persistent) {
SerializableCallable createSystem = new SerializableCallable() {
public Object call() throws Exception {
Cache cache = getCache();
AsyncEventQueue sender = cache.createAsyncEventQueueFactory().setBatchSize(2).setBatchTimeInterval(1000).setBatchConflationEnabled(false).setPersistent(persistent).create("queue", new AsyncEventListener() {
@Override
public void close() {
// TODO Auto-generated method stub
}
@Override
public boolean processEvents(List<AsyncEvent> events) {
// do nothing
return true;
}
});
return null;
}
};
vm.invoke(createSystem);
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class LuceneIndexCreationPersistenceIntegrationTest method shouldStoreIndexAndQueueInTheSameDiskStoreAsTheRegion.
@Test
public void shouldStoreIndexAndQueueInTheSameDiskStoreAsTheRegion() {
createIndex(cache, "text");
cache.createDiskStoreFactory().setDiskDirs(new File[] { diskDirRule.get() }).create("DiskStore");
cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).setDiskStoreName("DiskStore").create(REGION_NAME);
final String diskStoreName = cache.getRegion(REGION_NAME).getAttributes().getDiskStoreName();
verifyInternalRegions(region -> {
assertEquals(diskStoreName, region.getAttributes().getDiskStoreName());
});
AsyncEventQueue queue = getIndexQueue(cache);
assertEquals(diskStoreName, queue.getDiskStoreName());
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class LuceneIndexCreationPersistenceIntegrationTest method aeqShouldAlwaysBeDiskSynchronousWhenUserRegionIsEither.
@Test
@Parameters({ "true", "false" })
public void aeqShouldAlwaysBeDiskSynchronousWhenUserRegionIsEither(boolean synchronous) {
createIndex(cache, "text");
cache.createRegionFactory(RegionShortcut.PARTITION_PERSISTENT).setDiskSynchronous(synchronous).create(REGION_NAME);
verifyInternalRegions(region -> {
assertTrue(region.getDataPolicy().withPersistence());
assertTrue(region.isDiskSynchronous());
});
AsyncEventQueue queue = getIndexQueue(cache);
assertTrue(queue.isDiskSynchronous());
assertEquals(true, queue.isPersistent());
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue 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);
});
}
}
Aggregations