use of org.apache.geode.cache.wan.GatewayReceiverFactory in project geode by apache.
the class WANTestBase method createReceiverWithSSL.
public static int createReceiverWithSSL(int locPort) {
WANTestBase test = new WANTestBase();
Properties gemFireProps = test.getDistributedSystemProperties();
gemFireProps.put(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
gemFireProps.put(GATEWAY_SSL_ENABLED, "true");
gemFireProps.put(GATEWAY_SSL_PROTOCOLS, "any");
gemFireProps.put(GATEWAY_SSL_CIPHERS, "any");
gemFireProps.put(GATEWAY_SSL_REQUIRE_AUTHENTICATION, "true");
gemFireProps.put(GATEWAY_SSL_KEYSTORE_TYPE, "jks");
gemFireProps.put(GATEWAY_SSL_KEYSTORE, TestUtil.getResourcePath(WANTestBase.class, "/org/apache/geode/cache/client/internal/cacheserver.keystore"));
gemFireProps.put(GATEWAY_SSL_KEYSTORE_PASSWORD, "password");
gemFireProps.put(GATEWAY_SSL_TRUSTSTORE, TestUtil.getResourcePath(WANTestBase.class, "/org/apache/geode/cache/client/internal/cacheserver.truststore"));
gemFireProps.put(GATEWAY_SSL_TRUSTSTORE_PASSWORD, "password");
gemFireProps.setProperty(MCAST_PORT, "0");
gemFireProps.setProperty(LOCATORS, "localhost[" + locPort + "]");
LogWriterUtils.getLogWriter().info("Starting cache ds with following properties \n" + gemFireProps);
InternalDistributedSystem ds = test.getSystem(gemFireProps);
cache = CacheFactory.create(ds);
GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
fact.setStartPort(port);
fact.setEndPort(port);
fact.setManualStart(true);
GatewayReceiver receiver = fact.create();
try {
receiver.start();
} catch (IOException e) {
e.printStackTrace();
fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port);
}
return port;
}
use of org.apache.geode.cache.wan.GatewayReceiverFactory in project geode by apache.
the class SenderWithTransportFilterDUnitTest method createReceiverWithTransportFilters.
public static int createReceiverWithTransportFilters(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);
GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
fact.setStartPort(port);
fact.setEndPort(port);
ArrayList<GatewayTransportFilter> transportFilters = new ArrayList<GatewayTransportFilter>();
transportFilters.add(new CheckSumTransportFilter("CheckSumTransportFilter"));
if (!transportFilters.isEmpty()) {
for (GatewayTransportFilter filter : transportFilters) {
fact.addGatewayTransportFilter(filter);
}
}
GatewayReceiver receiver = fact.create();
try {
receiver.start();
} catch (IOException e) {
fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port, e);
}
return port;
}
use of org.apache.geode.cache.wan.GatewayReceiverFactory in project geode by apache.
the class WANLocatorServerDUnitTest method createReceiver.
public static void createReceiver(Integer port1, Integer port2, Integer port3) {
WANTestBase test = new WANTestBase(getTestMethodName());
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + port1 + "],localhost[" + port2 + "],localhost[" + port3 + "]");
InternalDistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
GatewayReceiverFactory fact = cache.createGatewayReceiverFactory();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
fact.setStartPort(port);
fact.setEndPort(port);
fact.setManualStart(true);
GatewayReceiver receiver = fact.create();
try {
receiver.start();
} catch (IOException e) {
fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port, e);
}
}
Aggregations