Search in sources :

Example 96 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class SerialGatewaySenderEventListenerDUnitTest method validateNoPoolCreation.

public static void validateNoPoolCreation(final String siteId) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    for (GatewaySender sender : senders) {
        if (sender.getId().equals(siteId)) {
            AbstractGatewaySender sImpl = (AbstractGatewaySender) sender;
            assertNull(sImpl.getProxy());
        }
    }
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Example 97 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class SerialGatewaySenderEventListenerDUnitTest method validateReceivedEventsMapSizeListener1.

public static void validateReceivedEventsMapSizeListener1(final String senderId, final Map map) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    GatewaySender sender = null;
    for (GatewaySender s : senders) {
        if (s.getId().equals(senderId)) {
            sender = s;
            break;
        }
    }
    final List<AsyncEventListener> listeners = ((AbstractGatewaySender) sender).getAsyncEventListeners();
    if (listeners.size() == 1) {
        final AsyncEventListener l = listeners.get(0);
        WaitCriterion wc = new WaitCriterion() {

            Map listenerMap;

            public boolean done() {
                listenerMap = ((MyGatewaySenderEventListener) l).getEventsMap();
                boolean sizeCorrect = map.size() == listenerMap.size();
                boolean keySetCorrect = listenerMap.keySet().containsAll(map.keySet());
                boolean valuesCorrect = listenerMap.values().containsAll(map.values());
                return sizeCorrect && keySetCorrect && valuesCorrect;
            }

            public String description() {
                return "Waiting for all sites to get updated, the sizes are " + listenerMap.size() + " and " + map.size();
            }
        };
        Wait.waitForCriterion(wc, 60000, 500, true);
    }
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) WaitCriterion(org.apache.geode.test.dunit.WaitCriterion) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) HashMap(java.util.HashMap) Map(java.util.Map) AsyncEventListener(org.apache.geode.cache.asyncqueue.AsyncEventListener)

Example 98 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class SerialGatewaySenderOperationsDUnitTest method verifySenderResumedState.

public static void verifySenderResumedState(String senderId) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    AbstractGatewaySender sender = null;
    for (GatewaySender s : senders) {
        if (s.getId().equals(senderId)) {
            sender = (AbstractGatewaySender) s;
            break;
        }
    }
    assertFalse(sender.isPaused());
    assertTrue(sender.isRunning());
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Example 99 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class SerialGatewaySenderOperationsDUnitTest method verifyGatewaySenderOperations.

public static void verifyGatewaySenderOperations(String senderId) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    GatewaySender sender = null;
    for (GatewaySender s : senders) {
        if (s.getId().equals(senderId)) {
            sender = s;
            break;
        }
    }
    assertFalse(sender.isPaused());
    assertFalse(((AbstractGatewaySender) sender).isRunning());
    sender.pause();
    sender.resume();
    sender.stop();
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Example 100 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class SerialGatewaySenderOperationsDUnitTest method verifySenderStoppedState.

public static void verifySenderStoppedState(String senderId) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    AbstractGatewaySender sender = null;
    for (GatewaySender s : senders) {
        if (s.getId().equals(senderId)) {
            sender = (AbstractGatewaySender) s;
            break;
        }
    }
    assertFalse(sender.isRunning());
    assertFalse(sender.isPaused());
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Aggregations

GatewaySender (org.apache.geode.cache.wan.GatewaySender)116 RegionQueue (org.apache.geode.internal.cache.RegionQueue)28 AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)28 Test (org.junit.Test)17 IgnoredException (org.apache.geode.test.dunit.IgnoredException)16 Region (org.apache.geode.cache.Region)10 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)10 AsyncEventQueue (org.apache.geode.cache.asyncqueue.AsyncEventQueue)9 GatewaySenderFactory (org.apache.geode.cache.wan.GatewaySenderFactory)9 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)9 DiskStore (org.apache.geode.cache.DiskStore)8 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)8 ConcurrentParallelGatewaySenderQueue (org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue)8 Expectations (org.jmock.Expectations)8 GatewayTransportFilter (org.apache.geode.cache.wan.GatewayTransportFilter)7 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)7 UnitTest (org.apache.geode.test.junit.categories.UnitTest)7 AttributesFactory (org.apache.geode.cache.AttributesFactory)6 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5