use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class LocatorLoadBalancingDUnitTest method changeLoad.
private void changeLoad(final ServerLoad newLoad) {
Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
CacheServer server = cache.getCacheServers().get(0);
MyLoadProbe probe = (MyLoadProbe) server.getLoadProbe();
probe.setLoad(newLoad);
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class LocatorTestBase method startBridgeServer.
protected int startBridgeServer(final String[] groups, final String locators, final String[] regions, final ServerLoadProbe probe, final boolean useGroupsProperty) throws IOException {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, locators);
if (useGroupsProperty && groups != null) {
props.setProperty(GROUPS, StringUtils.join(groups, ","));
}
DistributedSystem ds = getSystem(props);
Cache cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEnableBridgeConflation(true);
factory.setDataPolicy(DataPolicy.REPLICATE);
RegionAttributes attrs = factory.create();
for (int i = 0; i < regions.length; i++) {
cache.createRegion(regions[i], attrs);
}
CacheServer server = cache.addCacheServer();
server.setPort(0);
if (!useGroupsProperty) {
server.setGroups(groups);
}
server.setLoadProbe(probe);
server.start();
remoteObjects.put(CACHE_KEY, cache);
return new Integer(server.getPort());
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class LocatorTestBase method addCacheServer.
protected int addCacheServer(final String[] groups) throws IOException {
Cache cache = (Cache) remoteObjects.get(CACHE_KEY);
CacheServer server = cache.addCacheServer();
server.setPort(0);
server.setGroups(groups);
server.start();
return new Integer(server.getPort());
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class CacheXml66DUnitTest method testCacheServerHostnameForClients.
@Test
public void testCacheServerHostnameForClients() throws Exception {
CacheCreation cache = new CacheCreation();
CacheServer bs = cache.addCacheServer();
bs.setPort(AvailablePortHelper.getRandomAvailableTCPPort());
final String BA = ALIAS1;
bs.setBindAddress(BA);
bs.setHostnameForClients("clientHostName");
testXml(cache);
Cache c = getCache();
assertNotNull(c);
CacheServer server = (CacheServer) cache.getCacheServers().iterator().next();
assertNotNull(server);
assertEquals(BA, server.getBindAddress());
assertEquals("clientHostName", server.getHostnameForClients());
}
use of org.apache.geode.cache.server.CacheServer in project geode by apache.
the class CacheXml66DUnitTest method testLoadPollInterval.
@Test
public void testLoadPollInterval() throws Exception {
CacheCreation cache = new CacheCreation();
CacheServer server = cache.addCacheServer();
server.setPort(AvailablePortHelper.getRandomAvailableTCPPort());
server.setLoadPollInterval(12345);
testXml(cache);
Cache c = getCache();
server = c.getCacheServers().get(0);
assertEquals(12345, server.getLoadPollInterval());
}
Aggregations