Search in sources :

Example 11 with MyGatewayTransportFilter1

use of org.apache.geode.cache30.MyGatewayTransportFilter1 in project geode by apache.

the class CacheXml70GatewayDUnitTest method testParallelGatewaySender.

@Test
public void testParallelGatewaySender() throws Exception {
    getSystem();
    CacheCreation cache = new CacheCreation();
    GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
    gatewaySenderFactory.setParallel(true);
    gatewaySenderFactory.setDispatcherThreads(13);
    gatewaySenderFactory.setManualStart(true);
    gatewaySenderFactory.setSocketBufferSize(1234);
    gatewaySenderFactory.setSocketReadTimeout(1050);
    gatewaySenderFactory.setBatchConflationEnabled(false);
    gatewaySenderFactory.setBatchSize(88);
    gatewaySenderFactory.setBatchTimeInterval(9);
    gatewaySenderFactory.setPersistenceEnabled(true);
    gatewaySenderFactory.setDiskStoreName("LNSender");
    gatewaySenderFactory.setDiskSynchronous(true);
    gatewaySenderFactory.setMaximumQueueMemory(211);
    gatewaySenderFactory.setAlertThreshold(35);
    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
    gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
    GatewaySender parallelGatewaySender = gatewaySenderFactory.create("LN", 2);
    testXml(cache);
    Cache c = getCache();
    assertNotNull(c);
    Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
    for (GatewaySender sender : sendersOnCache) {
        assertEquals(true, sender.isParallel());
        validateGatewaySender(parallelGatewaySender, sender);
    }
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) MyGatewayEventFilter1(org.apache.geode.cache30.MyGatewayEventFilter1) GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory) GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) MyGatewayTransportFilter1(org.apache.geode.cache30.MyGatewayTransportFilter1) MyGatewayTransportFilter2(org.apache.geode.cache30.MyGatewayTransportFilter2) GatewayEventFilter(org.apache.geode.cache.wan.GatewayEventFilter) CacheXml70DUnitTest(org.apache.geode.cache30.CacheXml70DUnitTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 12 with MyGatewayTransportFilter1

use of org.apache.geode.cache30.MyGatewayTransportFilter1 in project geode by apache.

the class CacheXml70GatewayDUnitTest method testSerialGatewaySender.

@Test
public void testSerialGatewaySender() throws Exception {
    getSystem();
    CacheCreation cache = new CacheCreation();
    GatewaySenderFactory gatewaySenderFactory = cache.createGatewaySenderFactory();
    gatewaySenderFactory.setParallel(false);
    gatewaySenderFactory.setManualStart(true);
    gatewaySenderFactory.setSocketBufferSize(124);
    gatewaySenderFactory.setSocketReadTimeout(1000);
    gatewaySenderFactory.setBatchConflationEnabled(false);
    gatewaySenderFactory.setBatchSize(100);
    gatewaySenderFactory.setBatchTimeInterval(10);
    gatewaySenderFactory.setPersistenceEnabled(true);
    gatewaySenderFactory.setDiskStoreName("LNSender");
    gatewaySenderFactory.setDiskSynchronous(true);
    gatewaySenderFactory.setMaximumQueueMemory(200);
    gatewaySenderFactory.setAlertThreshold(30);
    GatewayEventFilter myEventFilter1 = new MyGatewayEventFilter1();
    gatewaySenderFactory.addGatewayEventFilter(myEventFilter1);
    GatewayTransportFilter myStreamFilter1 = new MyGatewayTransportFilter1();
    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter1);
    GatewayTransportFilter myStreamFilter2 = new MyGatewayTransportFilter2();
    gatewaySenderFactory.addGatewayTransportFilter(myStreamFilter2);
    GatewaySender serialGatewaySender = gatewaySenderFactory.create("LN", 2);
    RegionAttributesCreation attrs = new RegionAttributesCreation();
    attrs.addGatewaySenderId(serialGatewaySender.getId());
    cache.createRegion("UserRegion", attrs);
    testXml(cache);
    Cache c = getCache();
    assertNotNull(c);
    Set<GatewaySender> sendersOnCache = c.getGatewaySenders();
    for (GatewaySender sender : sendersOnCache) {
        assertEquals(false, sender.isParallel());
        validateGatewaySender(serialGatewaySender, sender);
    }
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) MyGatewayEventFilter1(org.apache.geode.cache30.MyGatewayEventFilter1) GatewaySenderFactory(org.apache.geode.cache.wan.GatewaySenderFactory) RegionAttributesCreation(org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation) GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) MyGatewayTransportFilter1(org.apache.geode.cache30.MyGatewayTransportFilter1) MyGatewayTransportFilter2(org.apache.geode.cache30.MyGatewayTransportFilter2) GatewayEventFilter(org.apache.geode.cache.wan.GatewayEventFilter) CacheXml70DUnitTest(org.apache.geode.cache30.CacheXml70DUnitTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Example 13 with MyGatewayTransportFilter1

use of org.apache.geode.cache30.MyGatewayTransportFilter1 in project geode by apache.

the class CacheXml70GatewayDUnitTest method testGatewayReceiver.

@Test
public void testGatewayReceiver() 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);
    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);
    }
}
Also used : GatewayReceiverFactory(org.apache.geode.cache.wan.GatewayReceiverFactory) GatewayReceiver(org.apache.geode.cache.wan.GatewayReceiver) GatewayTransportFilter(org.apache.geode.cache.wan.GatewayTransportFilter) CacheCreation(org.apache.geode.internal.cache.xmlcache.CacheCreation) MyGatewayTransportFilter1(org.apache.geode.cache30.MyGatewayTransportFilter1) MyGatewayTransportFilter2(org.apache.geode.cache30.MyGatewayTransportFilter2) CacheXml70DUnitTest(org.apache.geode.cache30.CacheXml70DUnitTest) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest)

Aggregations

MyGatewayTransportFilter1 (org.apache.geode.cache30.MyGatewayTransportFilter1)13 MyGatewayTransportFilter2 (org.apache.geode.cache30.MyGatewayTransportFilter2)13 Test (org.junit.Test)13 GatewayTransportFilter (org.apache.geode.cache.wan.GatewayTransportFilter)10 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)10 MyGatewayEventFilter1 (org.apache.geode.cache30.MyGatewayEventFilter1)8 GatewayEventFilter (org.apache.geode.cache.wan.GatewayEventFilter)6 GatewaySender (org.apache.geode.cache.wan.GatewaySender)6 GatewaySenderFactory (org.apache.geode.cache.wan.GatewaySenderFactory)6 IgnoredException (org.apache.geode.test.dunit.IgnoredException)6 Properties (java.util.Properties)4 AttributesFactory (org.apache.geode.cache.AttributesFactory)4 Region (org.apache.geode.cache.Region)4 CacheXml70DUnitTest (org.apache.geode.cache30.CacheXml70DUnitTest)4 ConfigurationProperties (org.apache.geode.distributed.ConfigurationProperties)4 InternalDistributedSystem (org.apache.geode.distributed.internal.InternalDistributedSystem)4 RegionQueue (org.apache.geode.internal.cache.RegionQueue)4 AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)4 WANTestBase (org.apache.geode.internal.cache.wan.WANTestBase)4 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)4