Search in sources :

Example 1 with Filter70

use of org.apache.geode.internal.cache.wan.Filter70 in project geode by apache.

the class WanValidationsDUnitTest method testGatewayEventFilters.

@Test
public void testGatewayEventFilters() {
    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
    createCacheInVMs(lnPort, vm1, vm2);
    ArrayList<GatewayEventFilter> eventFilters = new ArrayList<GatewayEventFilter>();
    eventFilters.add(new MyGatewayEventFilter());
    vm1.invoke(() -> WANTestBase.createSenderForValidations("ln", 2, false, 100, false, false, eventFilters, null, true, false));
    try {
        eventFilters.clear();
        eventFilters.add(new Filter70());
        vm2.invoke(() -> WANTestBase.createSenderForValidations("ln", 2, false, 100, false, false, eventFilters, null, true, false));
        fail("Expected IllegalStateException : GatewayEventFilters Should match");
    } catch (Exception e) {
        if (!(e.getCause() instanceof IllegalStateException) || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with GatewayEventFilters"))) {
            Assert.fail("Expected IllegalStateException", e);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) GatewaySenderConfigurationException(org.apache.geode.internal.cache.wan.GatewaySenderConfigurationException) GatewaySenderException(org.apache.geode.internal.cache.wan.GatewaySenderException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) GatewayEventFilter(org.apache.geode.cache.wan.GatewayEventFilter) Filter70(org.apache.geode.internal.cache.wan.Filter70) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Example 2 with Filter70

use of org.apache.geode.internal.cache.wan.Filter70 in project geode by apache.

the class WanValidationsDUnitTest method testGatewayEventFilters2.

@Test
public void testGatewayEventFilters2() {
    Integer lnPort = (Integer) vm0.invoke(() -> WANTestBase.createFirstLocatorWithDSId(1));
    createCacheInVMs(lnPort, vm1, vm2);
    ArrayList<GatewayEventFilter> eventFilters = new ArrayList<GatewayEventFilter>();
    eventFilters.add(new MyGatewayEventFilter());
    vm1.invoke(() -> WANTestBase.createSenderForValidations("ln", 2, false, 100, false, false, eventFilters, null, true, false));
    try {
        eventFilters.clear();
        eventFilters.add(new MyGatewayEventFilter());
        eventFilters.add(new Filter70());
        vm2.invoke(() -> WANTestBase.createSenderForValidations("ln", 2, false, 100, false, false, eventFilters, null, true, false));
        fail("Expected IllegalStateException : GatewayEventFilters Should match");
    } catch (Exception e) {
        if (!(e.getCause() instanceof IllegalStateException) || !(e.getCause().getMessage().contains("because another cache has the same Gateway Sender defined with GatewayEventFilters"))) {
            Assert.fail("Expected IllegalStateException", e);
        }
    }
}
Also used : ArrayList(java.util.ArrayList) GatewaySenderConfigurationException(org.apache.geode.internal.cache.wan.GatewaySenderConfigurationException) GatewaySenderException(org.apache.geode.internal.cache.wan.GatewaySenderException) IgnoredException(org.apache.geode.test.dunit.IgnoredException) GatewayEventFilter(org.apache.geode.cache.wan.GatewayEventFilter) Filter70(org.apache.geode.internal.cache.wan.Filter70) Test(org.junit.Test) DistributedTest(org.apache.geode.test.junit.categories.DistributedTest) FlakyTest(org.apache.geode.test.junit.categories.FlakyTest)

Aggregations

ArrayList (java.util.ArrayList)2 GatewayEventFilter (org.apache.geode.cache.wan.GatewayEventFilter)2 Filter70 (org.apache.geode.internal.cache.wan.Filter70)2 GatewaySenderConfigurationException (org.apache.geode.internal.cache.wan.GatewaySenderConfigurationException)2 GatewaySenderException (org.apache.geode.internal.cache.wan.GatewaySenderException)2 IgnoredException (org.apache.geode.test.dunit.IgnoredException)2 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)2 FlakyTest (org.apache.geode.test.junit.categories.FlakyTest)2 Test (org.junit.Test)2