use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class ClientConflationDUnitTest method createClientCache.
/**
* create client 2 with 2 regions each with a unique writer and unique listeners
*
* @throws Exception
*/
public static void createClientCache(String host, Integer port, String conflation) throws Exception {
ClientConflationDUnitTest test = new ClientConflationDUnitTest();
cacheClient = test.createCache(createProperties1(conflation));
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
createPool2(host, factory, port);
factory.setCacheListener(new CacheListenerAdapter() {
public void afterCreate(EntryEvent event) {
synchronized (ClientConflationDUnitTest.class) {
counterCreate1++;
}
}
public void afterUpdate(EntryEvent event) {
// getLogWriter().info("afterUpdate event = " + event, new Exception());
synchronized (this) {
counterUpdate1++;
}
}
});
RegionAttributes attrs = factory.create();
cacheClient.createRegion(REGION_NAME1, attrs);
createPool2(host, factory, port);
factory.setCacheListener(new CacheListenerAdapter() {
public void afterCreate(EntryEvent event) {
synchronized (ClientConflationDUnitTest.class) {
counterCreate2++;
}
}
public void afterUpdate(EntryEvent event) {
synchronized (this) {
counterUpdate2++;
}
}
});
attrs = factory.create();
cacheClient.createRegion(REGION_NAME2, attrs);
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class ClientInterestNotifyDUnitTest method createClientCacheFeeder.
public static void createClientCacheFeeder(String host, Integer port) throws Exception {
ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest();
Cache cacheFeeder = test.createCache(createProperties1());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setConcurrencyChecksEnabled(false);
createPool2(host, factory, port);
RegionAttributes attrs = factory.create();
cacheFeeder.createRegion(REGION_NAME1, attrs);
cacheFeeder.createRegion(REGION_NAME2, attrs);
cacheFeeder.createRegion(REGION_NAME3, attrs);
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class ClientInterestNotifyDUnitTest method createServerCache.
/**
* create a server cache and start the server
*
* @throws Exception
*/
public static Integer createServerCache() throws Exception {
ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest();
Properties props = new Properties();
props.setProperty(DELTA_PROPAGATION, "false");
cacheServer = test.createCache(props);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
factory.setConcurrencyChecksEnabled(false);
RegionAttributes attrs = factory.create();
cacheServer.createRegion(REGION_NAME1, attrs);
cacheServer.createRegion(REGION_NAME2, attrs);
cacheServer.createRegion(REGION_NAME3, attrs);
CacheServer server = cacheServer.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
server.setPort(port);
server.setNotifyBySubscription(true);
server.setSocketBufferSize(32768);
server.start();
return new Integer(server.getPort());
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class ClientInterestNotifyDUnitTest method createClientCache.
/**
* create client with 3 regions each with a unique listener
*
* @throws Exception
*/
public static void createClientCache(String host, Integer port, /* String nbs, */
String name) throws Exception {
ClientInterestNotifyDUnitTest test = new ClientInterestNotifyDUnitTest();
Cache cacheClient = test.createCache(createProperties1());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setConcurrencyChecksEnabled(false);
createPool2(host, factory, port);
factory.setCacheListener(test.new EventListener(name + REGION_NAME1));
RegionAttributes attrs = factory.create();
cacheClient.createRegion(REGION_NAME1, attrs);
factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setConcurrencyChecksEnabled(false);
createPool2(host, factory, port);
factory.setCacheListener(test.new EventListener(name + REGION_NAME2));
attrs = factory.create();
cacheClient.createRegion(REGION_NAME2, attrs);
factory = new AttributesFactory();
factory.setScope(Scope.LOCAL);
factory.setConcurrencyChecksEnabled(false);
createPool2(host, factory, port);
factory.setCacheListener(test.new EventListener(name + REGION_NAME3));
attrs = factory.create();
cacheClient.createRegion(REGION_NAME3, attrs);
}
use of org.apache.geode.cache.RegionAttributes in project geode by apache.
the class InterestListEndpointDUnitTest method createServerCache.
public static Integer createServerCache(Integer maxThreads) throws Exception {
new InterestListEndpointDUnitTest().createCache(new Properties());
RegionAttributes attrs = impl.createServerCacheAttributes();
cache.createRegion(REGION_NAME, attrs);
CacheServer server1 = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
server1.setPort(port);
server1.setMaxThreads(maxThreads.intValue());
server1.setNotifyBySubscription(true);
server1.start();
return new Integer(server1.getPort());
}
Aggregations