Search in sources :

Example 16 with GatewayReceiverFactory

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;
}
Also used : GatewayReceiverFactory(org.apache.geode.cache.wan.GatewayReceiverFactory) GatewayReceiver(org.apache.geode.cache.wan.GatewayReceiver) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) IOException(java.io.IOException) Properties(java.util.Properties)

Example 17 with GatewayReceiverFactory

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;
}
Also used : GatewayReceiverFactory(org.apache.geode.cache.wan.GatewayReceiverFactory) WANTestBase(org.apache.geode.internal.cache.wan.WANTestBase) ArrayList(java.util.ArrayList) GatewayReceiver(org.apache.geode.cache.wan.GatewayReceiver) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter) IOException(java.io.IOException) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties)

Example 18 with GatewayReceiverFactory

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);
    }
}
Also used : GatewayReceiverFactory(org.apache.geode.cache.wan.GatewayReceiverFactory) WANTestBase(org.apache.geode.internal.cache.wan.WANTestBase) GatewayReceiver(org.apache.geode.cache.wan.GatewayReceiver) InternalDistributedSystem(org.apache.geode.distributed.internal.InternalDistributedSystem) IOException(java.io.IOException) ConfigurationProperties(org.apache.geode.distributed.ConfigurationProperties) Properties(java.util.Properties)

Aggregations

GatewayReceiverFactory (org.apache.geode.cache.wan.GatewayReceiverFactory)18 GatewayReceiver (org.apache.geode.cache.wan.GatewayReceiver)14 IOException (java.io.IOException)10 Properties (java.util.Properties)8 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)8 GatewayTransportFilter (org.apache.geode.cache.wan.GatewayTransportFilter)5 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)4 Test (org.junit.Test)3 GatewaySenderFactory (org.apache.geode.cache.wan.GatewaySenderFactory)2 CacheXml70DUnitTest (org.apache.geode.cache30.CacheXml70DUnitTest)2 MyGatewayTransportFilter1 (org.apache.geode.cache30.MyGatewayTransportFilter1)2 MyGatewayTransportFilter2 (org.apache.geode.cache30.MyGatewayTransportFilter2)2 WANTestBase (org.apache.geode.internal.cache.wan.WANTestBase)2 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)2 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)2 File (java.io.File)1 ArrayList (java.util.ArrayList)1 AttributesFactory (org.apache.geode.cache.AttributesFactory)1 CacheXmlException (org.apache.geode.cache.CacheXmlException)1 Declarable (org.apache.geode.cache.Declarable)1