use of org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation in project geode by apache.
the class CacheXml66DUnitTest method testEntriesInRootRegion.
/**
* Tests creating a cache with entries defined in the root region
*/
@Test
public void testEntriesInRootRegion() throws Exception {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation) cache.createRegion("root", new RegionAttributesCreation(cache));
root.put("KEY1", "VALUE1");
root.put("KEY2", "VALUE2");
root.put("KEY3", "VALUE3");
testXml(cache);
}
use of org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation in project geode by apache.
the class LuceneIndexXmlParserJUnitTest method setUp.
@Before
public void setUp() {
this.parser = new LuceneXmlParser();
CacheCreation cache = Mockito.mock(CacheCreation.class);
RegionCreation regionCreation = Mockito.mock(RegionCreation.class);
RegionAttributesCreation rac = Mockito.mock(RegionAttributesCreation.class);
Mockito.when(regionCreation.getFullPath()).thenReturn("/region");
Mockito.when(regionCreation.getAttributes()).thenReturn(rac);
Mockito.when(regionCreation.getExtensionPoint()).thenReturn(new SimpleExtensionPoint(this.rc, this.rc));
this.rc = regionCreation;
this.stack = new Stack<Object>();
stack.push(cache);
stack.push(rc);
this.parser.setStack(stack);
}
use of org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation in project geode by apache.
the class CacheXml70GatewayDUnitTest method testSerialGatewaySender.
@Test
public void testSerialGatewaySender() throws Exception {
getSystem();
CacheCreation cache = new CacheCreation();
GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
gatewaySenderFactory.setParallel(false);
gatewaySenderFactory.setManualStart(true);
gatewaySenderFactory.setSocketBufferSize(124);
gatewaySenderFactory.setSocketReadTimeout(1000);
gatewaySenderFactory.setBatchConflationEnabled(false);
gatewaySenderFactory.setBatchSize(100);
gatewaySenderFactory.setBatchTimeInterval(10);
gatewaySenderFactory.setPersistenceEnabled(true);
gatewaySenderFactory.setDiskStoreName("LNSender");
gatewaySenderFactory.setDiskSynchronous(true);
gatewaySenderFactory.setMaximumQueueMemory(200);
gatewaySenderFactory.setAlertThreshold(30);
GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
GatewaySender serialGatewaySender = gatewaySenderFactory.create("LN", 2);
RegionAttributesCreation attrs = new RegionAttributesCreation();
attrs.addGatewaySenderId(serialGatewaySender.getId());
cache.createRegion("UserRegion", attrs);
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
for (GatewaySender sender : sendersOnCache) {
assertEquals(false, sender.isParallel());
validateGatewaySender(serialGatewaySender, sender);
}
}
use of org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation in project geode by apache.
the class CacheXml66DUnitTest method testMaxOplogSize.
@Test
public void testMaxOplogSize() throws Exception {
CacheCreation cache = new CacheCreation();
// Set properties for Asynch writes
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
RegionCreation root = (RegionCreation) cache.createRegion("root", attrs);
{
attrs = new RegionAttributesCreation(cache);
DiskWriteAttributesFactory dwaf = new DiskWriteAttributesFactory();
dwaf.setSynchronous(true);
dwaf.setMaxOplogSize(1);
attrs.setDiskWriteAttributes(dwaf.create());
root.createSubregion("sync", attrs);
}
{
attrs = new RegionAttributesCreation(cache);
DiskWriteAttributesFactory dwaf = new DiskWriteAttributesFactory();
dwaf.setTimeInterval(123L);
dwaf.setBytesThreshold(456L);
dwaf.setMaxOplogSize(1);
attrs.setDiskWriteAttributes(dwaf.create());
root.createSubregion("async", attrs);
}
testXml(cache);
}
use of org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation in project geode by apache.
the class CacheXml66DUnitTest method testExpirationAttriubutes.
/**
* Tests creating a cache with a various {@link ExpirationAttributes}.
*/
@Test
public void testExpirationAttriubutes() throws Exception {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
attrs.setStatisticsEnabled(true);
{
ExpirationAttributes expire = new ExpirationAttributes(42, ExpirationAction.INVALIDATE);
attrs.setRegionTimeToLive(expire);
}
{
ExpirationAttributes expire = new ExpirationAttributes(43, ExpirationAction.DESTROY);
attrs.setRegionIdleTimeout(expire);
}
{
ExpirationAttributes expire = new ExpirationAttributes(44, ExpirationAction.LOCAL_INVALIDATE);
attrs.setEntryTimeToLive(expire);
}
{
ExpirationAttributes expire = new ExpirationAttributes(45, ExpirationAction.LOCAL_DESTROY);
attrs.setEntryIdleTimeout(expire);
}
cache.createRegion("root", attrs);
testXml(cache);
}
Aggregations