use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class StatsBugDUnitTest method createClientCacheForInvalidates.
/**
* Initializes the cache client
*
* @param port1 - port for the primary cache-server
* @param port2 for the secondary cache-server
* @throws Exception-thrown if any problem occurs in initializing the client
*/
public static void createClientCacheForInvalidates(String host, Integer port1, Integer port2) throws Exception {
StatsBugDUnitTest test = new StatsBugDUnitTest();
cache = test.createCache(createProperties1());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
pool = (PoolImpl) ClientServerTestCase.configureConnectionPool(factory, host, new int[] { port1.intValue(), port2.intValue() }, true, -1, 3, null);
RegionAttributes attrs = factory.create();
Region region = cache.createRegion(REGION_NAME, attrs);
region.registerInterest("ALL_KEYS", false, false);
LogWriterUtils.getLogWriter().info("Client cache created");
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class OperationsPropagationDUnitTest method createServerCache.
/**
* Create the server
*/
public static Integer createServerCache() throws Exception {
new OperationsPropagationDUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs = factory.create();
region = cache.createRegion(REGION_NAME, attrs);
CacheServerImpl server = (CacheServerImpl) cache.addCacheServer();
assertNotNull(server);
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
server.setPort(port);
server.setNotifyBySubscription(true);
server.start();
return new Integer(server.getPort());
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class PutAllDUnitTest method createClientCache2.
/**
* function to create client cache with HAEventIdPropagationListenerForClient2 as the listener
**/
public static void createClientCache2(String host, Integer port1) throws Exception {
int PORT1 = port1.intValue();
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
new PutAllDUnitTest().createCache(props);
props.setProperty("retryAttempts", "2");
props.setProperty("endpoints", "ep1=" + host + ":" + PORT1);
props.setProperty("redundancyLevel", "-1");
props.setProperty("establishCallbackConnection", "true");
props.setProperty("LBPolicy", "Sticky");
props.setProperty("readTimeout", "2000");
props.setProperty("socketBufferSize", "1000");
props.setProperty("retryInterval", "250");
props.setProperty("connectionsPerServer", "2");
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
PoolImpl p = (PoolImpl) ClientServerTestCase.configureConnectionPool(factory, host, PORT1, -1, true, -1, 2, null);
CacheListener clientListener = new HAEventIdPropagationListenerForClient2();
factory.setCacheListener(clientListener);
RegionAttributes attrs = factory.create();
cache.createRegion(REGION_NAME, attrs);
Region region = cache.getRegion(Region.SEPARATOR + REGION_NAME);
assertNotNull(region);
region.registerInterest("ALL_KEYS", InterestResultPolicy.NONE);
pool = p;
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class PersistentPartitionedRegionOldConfigDUnitTest method getPersistentPRAttributes.
@Override
protected RegionAttributes getPersistentPRAttributes(final int redundancy, final int recoveryDelay, Cache cache, int numBuckets, boolean synchronous) {
AttributesFactory af = new AttributesFactory();
PartitionAttributesFactory paf = new PartitionAttributesFactory();
paf.setRedundantCopies(redundancy);
paf.setRecoveryDelay(recoveryDelay);
paf.setTotalNumBuckets(numBuckets);
af.setPartitionAttributes(paf.create());
af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
af.setDiskDirs(getDiskDirs());
RegionAttributes attr = af.create();
return attr;
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class PersistentPartitionedRegionTestBase method getPersistentPRAttributes.
protected RegionAttributes getPersistentPRAttributes(final int redundancy, final int recoveryDelay, Cache cache, int numBuckets, boolean synchronous) {
DiskStore ds = cache.findDiskStore("disk");
if (ds == null) {
ds = cache.createDiskStoreFactory().setDiskDirs(getDiskDirs()).create("disk");
}
AttributesFactory af = new AttributesFactory();
PartitionAttributesFactory paf = new PartitionAttributesFactory();
paf.setRedundantCopies(redundancy);
paf.setRecoveryDelay(recoveryDelay);
paf.setTotalNumBuckets(numBuckets);
// Make sure all vms end up with the same local max memory
paf.setLocalMaxMemory(500);
af.setPartitionAttributes(paf.create());
af.setDataPolicy(DataPolicy.PERSISTENT_PARTITION);
af.setDiskStoreName("disk");
af.setDiskSynchronous(synchronous);
RegionAttributes attr = af.create();
return attr;
}
Aggregations