use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class Bug36269DUnitTest method createServerCache.
public static Integer createServerCache() throws Exception {
new Bug36269DUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setMirrorType(MirrorType.KEYS_VALUES);
cache.createRegion(REGION_NAME, factory.create());
CacheServer server = 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.server.CacheServer in project geode by apache.
the class Bug36805DUnitTest method createServerCache.
public static Integer createServerCache() throws Exception {
new Bug36805DUnitTest().createCache(new Properties());
// no region is created on server
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
CacheServer server1 = cache.addCacheServer();
server1.setPort(port);
server1.setNotifyBySubscription(true);
server1.start();
return new Integer(server1.getPort());
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class Bug36995DUnitTest method stopServer.
public static void stopServer() {
try {
Iterator iter = cache.getCacheServers().iterator();
if (iter.hasNext()) {
CacheServer server = (CacheServer) iter.next();
server.stop();
}
} catch (Exception e) {
fail("failed while stopServer()", e);
}
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class CacheServerTestUtil method restartCacheServers.
public static void restartCacheServers() {
Iterator iter = getCache().getCacheServers().iterator();
if (iter.hasNext()) {
CacheServer server = (CacheServer) iter.next();
try {
server.start();
} catch (Exception e) {
Assert.fail("Unexpected exception", e);
}
assertTrue(server.isRunning());
}
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class CacheServerTransactionsDUnitTest method createServerCache.
public static Integer createServerCache(Integer maxThreads) throws Exception {
new CacheServerTransactionsDUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
factory.setCacheListener(new CacheListenerAdapter() {
public void afterDestroy(EntryEvent event) {
synchronized (CacheServerTransactionsDUnitTest.class) {
destroyed = true;
CacheServerTransactionsDUnitTest.class.notify();
}
}
public void afterInvalidate(EntryEvent event) {
synchronized (CacheServerTransactionsDUnitTest.class) {
invalidated = true;
CacheServerTransactionsDUnitTest.class.notifyAll();
}
}
});
Region r1 = cache.createRegion(REGION_NAME, factory.create());
assertNotNull(r1);
CacheServer server1 = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
server1.setPort(port);
server1.setMaxThreads(maxThreads.intValue());
server1.setNotifyBySubscription(true);
server1.start();
createEntries();
return new Integer(server1.getPort());
}
Aggregations