Search in sources :

Example 26 with GatewaySender

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

the class WANTestBase method validateQueueContents.

public static void validateQueueContents(final String senderId, final int regionSize) {
    IgnoredException exp1 = IgnoredException.addIgnoredException(InterruptedException.class.getName());
    IgnoredException exp2 = IgnoredException.addIgnoredException(GatewaySenderException.class.getName());
    try {
        Set<GatewaySender> senders = cache.getGatewaySenders();
        GatewaySender sender = null;
        for (GatewaySender s : senders) {
            if (s.getId().equals(senderId)) {
                sender = s;
                break;
            }
        }
        if (!sender.isParallel()) {
            final Set<RegionQueue> queues = ((AbstractGatewaySender) sender).getQueues();
            Awaitility.await().atMost(120, TimeUnit.SECONDS).until(() -> {
                int size = 0;
                for (RegionQueue q : queues) {
                    size += q.size();
                }
                assertEquals("Expected queue entries: " + regionSize + " but actual entries: " + size, regionSize, size);
            });
        } else if (sender.isParallel()) {
            final RegionQueue regionQueue;
            regionQueue = ((AbstractGatewaySender) sender).getQueues().toArray(new RegionQueue[1])[0];
            Awaitility.await().atMost(120, TimeUnit.SECONDS).until(() -> assertEquals("Expected queue entries: " + regionSize + " but actual entries: " + regionQueue.size(), regionSize, regionQueue.size()));
        }
    } finally {
        exp1.remove();
        exp2.remove();
    }
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) IgnoredException(org.apache.geode.test.dunit.IgnoredException) RegionQueue(org.apache.geode.internal.cache.RegionQueue)

Example 27 with GatewaySender

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

the class WANTestBase method checkQueueStats.

public static void checkQueueStats(String senderId, final int queueSize, final int eventsReceived, final int eventsQueued, final int eventsDistributed) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    GatewaySender sender = null;
    for (GatewaySender s : senders) {
        if (s.getId().equals(senderId)) {
            sender = s;
            break;
        }
    }
    final GatewaySenderStats statistics = ((AbstractGatewaySender) sender).getStatistics();
    assertEquals(queueSize, statistics.getEventQueueSize());
    assertEquals(eventsReceived, statistics.getEventsReceived());
    assertEquals(eventsQueued, statistics.getEventsQueued());
    assert (statistics.getEventsDistributed() >= eventsDistributed);
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender)

Example 28 with GatewaySender

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

the class ConcurrentSerialGatewaySenderOperationsDUnitTest 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 29 with GatewaySender

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

the class ConcurrentSerialGatewaySenderOperationsDUnitTest 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)

Example 30 with GatewaySender

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

the class ConcurrentSerialGatewaySenderOperationsDUnitTest method verifySenderPausedState.

public static void verifySenderPausedState(String senderId) {
    Set<GatewaySender> senders = cache.getGatewaySenders();
    AbstractGatewaySender sender = null;
    for (GatewaySender s : senders) {
        if (s.getId().equals(senderId)) {
            sender = (AbstractGatewaySender) s;
            break;
        }
    }
    assertTrue(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