use of org.apache.geode.distributed.internal.InternalDistributedSystem in project geode by apache.
the class WANTestBase method createCache.
protected static void createCache(boolean management, Integer locPort) {
WANTestBase test = new WANTestBase();
Properties props = test.getDistributedSystemProperties();
if (management) {
props.setProperty(JMX_MANAGER, "true");
props.setProperty(JMX_MANAGER_START, "false");
props.setProperty(JMX_MANAGER_PORT, "0");
props.setProperty(JMX_MANAGER_HTTP_PORT, "0");
}
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + locPort + "]");
InternalDistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
}
use of org.apache.geode.distributed.internal.InternalDistributedSystem in project geode by apache.
the class WANTestBase method createClientWithLocator.
public static void createClientWithLocator(final int port0, final String host) {
WANTestBase test = new WANTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
InternalDistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
CacheServerTestUtil.disableShufflingOfEndpoints();
Pool p;
try {
p = PoolManager.createFactory().addLocator(host, port0).setPingInterval(250).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1).setReadTimeout(2000).setSocketBufferSize(1000).setMinConnections(6).setMaxConnections(10).setRetryAttempts(3).create("pool");
} finally {
CacheServerTestUtil.enableShufflingOfEndpoints();
}
}
use of org.apache.geode.distributed.internal.InternalDistributedSystem in project geode by apache.
the class WANCommandTestBase method createReceiverWithGroup.
public int createReceiverWithGroup(int locPort, String groups) {
Properties props = getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + locPort + "]");
props.setProperty(GROUPS, groups);
InternalDistributedSystem ds = getSystem(props);
cache = CacheFactory.create(ds);
GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
fact.setStartPort(AvailablePort.AVAILABLE_PORTS_LOWER_BOUND);
fact.setEndPort(AvailablePort.AVAILABLE_PORTS_UPPER_BOUND);
fact.setManualStart(true);
GatewayReceiver receiver = fact.create();
return receiver.getPort();
}
use of org.apache.geode.distributed.internal.InternalDistributedSystem in project geode by apache.
the class WANCommandTestBase method createFirstLocatorWithDSId.
public Integer createFirstLocatorWithDSId(int dsId) {
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(DISTRIBUTED_SYSTEM_ID, "" + dsId);
props.setProperty(LOCATORS, "localhost[" + port + "]");
props.setProperty(START_LOCATOR, "localhost[" + port + "],server=true,peer=true,hostname-for-clients=localhost");
InternalDistributedSystem ds = getSystem(props);
cache = CacheFactory.create(ds);
return port;
}
use of org.apache.geode.distributed.internal.InternalDistributedSystem in project geode by apache.
the class WANTestBase method createServer.
public static int createServer(int locPort) {
WANTestBase test = new WANTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + locPort + "]");
InternalDistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
CacheServer server = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
server.setPort(port);
server.setHostnameForClients("localhost");
try {
server.start();
} catch (IOException e) {
org.apache.geode.test.dunit.Assert.fail("Failed to start server ", e);
}
return port;
}
Aggregations