use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml70DUnitTest method testAsyncEventQueueWithGatewayEventFilter.
/**
* Added to test the scenario of defect #50600.
*/
@Test
public void testAsyncEventQueueWithGatewayEventFilter() throws Exception {
getSystem();
CacheCreation cache = new CacheCreation();
String id = "WBCLChannel";
AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
factory.setBatchSize(100);
factory.setBatchTimeInterval(500);
factory.setBatchConflationEnabled(true);
factory.setMaximumQueueMemory(200);
factory.setDiskSynchronous(true);
factory.setParallel(false);
factory.setDispatcherThreads(33);
AsyncEventListener eventListener = new MyAsyncEventListener();
AsyncEventQueue asyncEventQueue = factory.create(id, eventListener);
RegionAttributesCreation attrs = new RegionAttributesCreation();
attrs.addAsyncEventQueueId(asyncEventQueue.getId());
cache.createRegion("UserRegion", attrs);
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<AsyncEventQueue> asyncEventQueuesOnCache = c.getAsyncEventQueues();
assertTrue("Size of asyncEventQueues should be greater than 0", asyncEventQueuesOnCache.size() > 0);
for (AsyncEventQueue asyncEventQueueOnCache : asyncEventQueuesOnCache) {
CacheXml70DUnitTest.validateAsyncEventQueue(asyncEventQueue, asyncEventQueueOnCache);
}
}
use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml70DUnitTest method testConcurrentAsyncEventQueue.
@Test
public void testConcurrentAsyncEventQueue() throws Exception {
getSystem();
CacheCreation cache = new CacheCreation();
String id = "WBCLChannel";
AsyncEventQueueFactory factory = cache.createAsyncEventQueueFactory();
factory.setBatchSize(100);
factory.setBatchTimeInterval(500);
factory.setBatchConflationEnabled(true);
factory.setMaximumQueueMemory(200);
factory.setDiskSynchronous(true);
factory.setDispatcherThreads(5);
factory.setOrderPolicy(OrderPolicy.THREAD);
AsyncEventListener eventListener = new MyAsyncEventListener();
AsyncEventQueue asyncEventQueue = factory.create(id, eventListener);
RegionAttributesCreation attrs = new RegionAttributesCreation();
attrs.addAsyncEventQueueId(asyncEventQueue.getId());
cache.createRegion("UserRegion", attrs);
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<AsyncEventQueue> asyncEventQueuesOnCache = c.getAsyncEventQueues();
assertTrue("Size of asyncEventQueues should be greater than 0", asyncEventQueuesOnCache.size() > 0);
for (AsyncEventQueue asyncEventQueueOnCache : asyncEventQueuesOnCache) {
validateConcurrentAsyncEventQueue(asyncEventQueue, asyncEventQueueOnCache);
}
}
use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml70DUnitTest method testConcurrencyChecksEnabled.
/** make sure we can create regions with concurrencyChecksEnabled=true */
@Test
public void testConcurrencyChecksEnabled() throws Exception {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
attrs.setScope(Scope.DISTRIBUTED_ACK);
attrs.setDataPolicy(DataPolicy.REPLICATE);
attrs.setConcurrencyChecksEnabled(true);
cache.createRegion("replicated", attrs);
attrs = new RegionAttributesCreation(cache);
attrs.setDataPolicy(DataPolicy.PARTITION);
attrs.setConcurrencyChecksEnabled(true);
cache.createRegion("partitioned", attrs);
attrs = new RegionAttributesCreation(cache);
attrs.setScope(Scope.DISTRIBUTED_ACK);
attrs.setDataPolicy(DataPolicy.EMPTY);
attrs.setConcurrencyChecksEnabled(true);
cache.createRegion("empty", attrs);
attrs = new RegionAttributesCreation(cache);
attrs.setScope(Scope.DISTRIBUTED_ACK);
attrs.setConcurrencyChecksEnabled(true);
cache.createRegion("normal", attrs);
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Region region = c.getRegion("replicated");
assertNotNull(region);
assertTrue("expected concurrency checks to be enabled", region.getAttributes().getConcurrencyChecksEnabled());
region.localDestroyRegion();
region = c.getRegion("partitioned");
assertNotNull(region);
assertTrue("expected concurrency checks to be enabled", region.getAttributes().getConcurrencyChecksEnabled());
region.localDestroyRegion();
region = c.getRegion("empty");
assertNotNull(region);
assertTrue("expected concurrency checks to be enabled", region.getAttributes().getConcurrencyChecksEnabled());
region.localDestroyRegion();
region = c.getRegion("normal");
assertNotNull(region);
assertTrue("expected concurrency checks to be enabled", region.getAttributes().getConcurrencyChecksEnabled());
region.localDestroyRegion();
}
use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml80DUnitTest method testCompressor.
@SuppressWarnings("rawtypes")
@Test
public void testCompressor() throws Exception {
final String regionName = "testCompressor";
final CacheCreation cache = new CacheCreation();
final RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
attrs.setCompressor(SnappyCompressor.getDefaultInstance());
/* Region regionBefore = */
cache.createRegion(regionName, attrs);
testXml(cache);
final Cache c = getCache();
assertNotNull(c);
final Region regionAfter = c.getRegion(regionName);
assertNotNull(regionAfter);
assertTrue(SnappyCompressor.getDefaultInstance().equals(regionAfter.getAttributes().getCompressor()));
regionAfter.localDestroyRegion();
}
use of org.apache.geode.internal.cache.xmlcache.CacheCreation in project geode by apache.
the class CacheXml80DUnitTest method testCacheServerDisableTcpNoDelay.
@Test
public void testCacheServerDisableTcpNoDelay() throws Exception {
CacheCreation cache = new CacheCreation();
CacheServer cs = cache.addCacheServer();
cs.setPort(0);
cs.setTcpNoDelay(false);
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
attrs.setDataPolicy(DataPolicy.NORMAL);
cache.createVMRegion("rootNORMAL", attrs);
testXml(cache);
}
Aggregations