use of org.apache.geode.cache.wan.GatewayReceiverFactory in project geode by apache.
the class CacheXml80GatewayDUnitTest method testGatewayReceiverWithManualStartTRUE.
@Test
public void testGatewayReceiverWithManualStartTRUE() throws Exception {
// getSystem();
CacheCreation cache = new CacheCreation();
GatewayReceiverFactory gatewayReceiverFactory = cache.createGatewayReceiverFactory();
gatewayReceiverFactory.setBindAddress("");
gatewayReceiverFactory.setStartPort(20000);
gatewayReceiverFactory.setEndPort(29999);
gatewayReceiverFactory.setMaximumTimeBetweenPings(2000);
gatewayReceiverFactory.setSocketBufferSize(1500);
gatewayReceiverFactory.setManualStart(true);
GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter1);
GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
gatewayReceiverFactory.addGatewayTransportFilter(myStreamFilter2);
GatewayReceiver receiver1 = gatewayReceiverFactory.create();
receiver1.start();
testXml(cache);
Cache c = getCache();
assertNotNull(c);
Set<GatewayReceiver> receivers = c.getGatewayReceivers();
for (GatewayReceiver receiver : receivers) {
validateGatewayReceiver(receiver1, receiver);
}
}
use of org.apache.geode.cache.wan.GatewayReceiverFactory in project geode by apache.
the class UpdateVersionDUnitTest method createReceiver.
public static int createReceiver(int locPort) {
UpdateVersionDUnitTest test = new UpdateVersionDUnitTest();
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);
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 WANTestBase method createReceiverWithBindAddress.
public static void createReceiverWithBindAddress(int locPort) {
WANTestBase test = new WANTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOG_LEVEL, LogWriterUtils.getDUnitLogLevel());
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);
fact.setManualStart(true);
fact.setBindAddress("200.112.204.10");
GatewayReceiver receiver = fact.create();
try {
receiver.start();
fail("Expected GatewayReceiver Exception");
} catch (GatewayReceiverException gRE) {
LogWriterUtils.getLogWriter().fine("Got the GatewayReceiverException", gRE);
assertTrue(gRE.getMessage().contains("Failed to create server socket on"));
} catch (IOException e) {
e.printStackTrace();
fail("Test " + test.getName() + " failed to start GatewayReceiver on port " + port);
}
}
use of org.apache.geode.cache.wan.GatewayReceiverFactory in project geode by apache.
the class WANTestBase method createReceiver.
public static int createReceiver() {
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();
Assert.fail("Test " + getTestMethodName() + " 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 MyGatewayEventSubstitutionFilter method createReceiver.
public static int createReceiver(int locPort) {
AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
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);
fact.setManualStart(true);
GatewayReceiver receiver = fact.create();
try {
receiver.start();
} catch (IOException e) {
e.printStackTrace();
fail("Test " + test.getName() + " failed to start GatewayRecevier on port " + port);
}
return port;
}
Aggregations