use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class CacheCreationJUnitTest method userCanCreateMultipleCacheServersDeclaratively.
@Test
public void userCanCreateMultipleCacheServersDeclaratively() {
CacheCreation cacheCreation = new CacheCreation();
CacheServerCreation br1 = new CacheServerCreation(cacheCreation, false);
br1.setPort(40406);
CacheServerCreation br2 = new CacheServerCreation(cacheCreation, false);
br1.setPort(40407);
cacheCreation.getCacheServers().add(br1);
cacheCreation.getCacheServers().add(br2);
CacheServerImpl mockServer = mock(CacheServerImpl.class);
when(this.cache.addCacheServer()).thenReturn(mockServer);
Integer configuredServerPort = null;
String configuredServerBindAddress = null;
Boolean disableDefaultCacheServer = false;
cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache, configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
verify(this.cache, times(2)).addCacheServer();
verify(mockServer).configureFrom(br1);
verify(mockServer).configureFrom(br2);
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class CacheCreationJUnitTest method defaultCacheServerIsCreatedWithConfiguredPortWhenNoDeclarativeServerIsConfigured.
@Test
public void defaultCacheServerIsCreatedWithConfiguredPortWhenNoDeclarativeServerIsConfigured() {
CacheCreation cacheCreation = new CacheCreation();
CacheServerImpl mockServer = mock(CacheServerImpl.class);
when(this.cache.addCacheServer()).thenReturn(mockServer);
List<CacheServer> cacheServers = new ArrayList<>();
when(this.cache.getCacheServers()).thenReturn(cacheServers);
Boolean disableDefaultCacheServer = false;
Integer configuredServerPort = 9999;
String configuredServerBindAddress = null;
cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache, configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
verify(this.cache, times(1)).addCacheServer();
verify(mockServer).setPort(9999);
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class CacheCreationJUnitTest method declarativeCacheServerIsCreatedWithConfiguredServerPort.
@Test
public void declarativeCacheServerIsCreatedWithConfiguredServerPort() {
CacheCreation cacheCreation = new CacheCreation();
CacheServerCreation br1 = new CacheServerCreation(cacheCreation, false);
br1.setPort(8888);
cacheCreation.getCacheServers().add(br1);
CacheServerImpl mockServer = mock(CacheServerImpl.class);
when(this.cache.addCacheServer()).thenReturn(mockServer);
Integer configuredServerPort = 9999;
String configuredServerBindAddress = null;
Boolean disableDefaultCacheServer = false;
cacheCreation.startCacheServers(cacheCreation.getCacheServers(), this.cache, configuredServerPort, configuredServerBindAddress, disableDefaultCacheServer);
verify(this.cache, times(1)).addCacheServer();
verify(mockServer).setPort(configuredServerPort);
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class DurableClientTestCase method getBridgeServer.
protected static CacheServerImpl getBridgeServer() {
CacheServerImpl bridgeServer = (CacheServerImpl) CacheServerTestUtil.getCache().getCacheServers().iterator().next();
assertNotNull(bridgeServer);
return bridgeServer;
}
use of org.apache.geode.internal.cache.CacheServerImpl in project geode by apache.
the class AcceptorImplDUnitTest method getAcceptorImplFromCache.
/**
*
* @param cache
* @return the cache's Acceptor, if there is exactly one CacheServer. Otherwise null.
*/
public AcceptorImpl getAcceptorImplFromCache(GemFireCache cache) {
GemFireCacheImpl gemFireCache = (GemFireCacheImpl) cache;
List<CacheServer> cacheServers = gemFireCache.getCacheServers();
if (cacheServers.size() != 1) {
return null;
}
CacheServerImpl cacheServerImpl = (CacheServerImpl) cacheServers.get(0);
return cacheServerImpl.getAcceptor();
}
Aggregations