Search in sources :

Example 91 with GatewaySender

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

the class PeerTypeRegistration method hasGatewaySender.

public boolean hasGatewaySender() {
    Set<GatewaySender> sendersAndAsyncQueues = cache.getGatewaySenders();
    Iterator<GatewaySender> itr = sendersAndAsyncQueues.iterator();
    while (itr.hasNext()) {
        GatewaySender sender = itr.next();
        if (AsyncEventQueueImpl.isAsyncEventQueue(sender.getId())) {
            itr.remove();
        }
    }
    return !sendersAndAsyncQueues.isEmpty();
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender)

Example 92 with GatewaySender

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

the class DescribeDiskStoreFunctionJUnitTest method testIsGatewaySenderPersistent.

@Test
public void testIsGatewaySenderPersistent() {
    final GatewaySender mockGatewaySender = mockContext.mock(GatewaySender.class, "GatewaySender");
    mockContext.checking(new Expectations() {

        {
            oneOf(mockGatewaySender).isPersistenceEnabled();
            will(returnValue(true));
        }
    });
    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
    assertTrue(function.isPersistent(mockGatewaySender));
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) Expectations(org.jmock.Expectations) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 93 with GatewaySender

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

the class DescribeDiskStoreFunctionJUnitTest method testIsGatewaySenderUsingDiskStore.

@Test
public void testIsGatewaySenderUsingDiskStore() {
    final String diskStoreName = "testDiskStore";
    final GatewaySender mockGatewaySender = mockContext.mock(GatewaySender.class, "GatewaySender");
    final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
    mockContext.checking(new Expectations() {

        {
            oneOf(mockGatewaySender).getDiskStoreName();
            will(returnValue(diskStoreName));
            oneOf(mockDiskStore).getName();
            will(returnValue(diskStoreName));
        }
    });
    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
    assertTrue(function.isUsingDiskStore(mockGatewaySender, mockDiskStore));
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) DiskStore(org.apache.geode.cache.DiskStore) Expectations(org.jmock.Expectations) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 94 with GatewaySender

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

the class DescribeDiskStoreFunctionJUnitTest method setupGatewaysForTestExecute.

private Set<DiskStoreDetails.GatewayDetails> setupGatewaysForTestExecute(final InternalCache mockCache, final String diskStoreName) {
    final GatewaySender mockGatewaySender = mockContext.mock(GatewaySender.class, "GatewaySender");
    mockContext.checking(new Expectations() {

        {
            oneOf(mockCache).getGatewaySenders();
            will(returnValue(CollectionUtils.asSet(mockGatewaySender)));
            oneOf(mockGatewaySender).getDiskStoreName();
            will(returnValue(diskStoreName));
            oneOf(mockGatewaySender).getId();
            will(returnValue("0123456789"));
            oneOf(mockGatewaySender).isPersistenceEnabled();
            will(returnValue(true));
        }
    });
    return CollectionUtils.asSet(createGatewayDetails("0123456789", true));
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) Expectations(org.jmock.Expectations)

Example 95 with GatewaySender

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

the class DescribeDiskStoreFunctionJUnitTest method testGetGatewaySenderDiskStoreNameWhenUnspecified.

@Test
public void testGetGatewaySenderDiskStoreNameWhenUnspecified() {
    final GatewaySender mockGatewaySender = mockContext.mock(GatewaySender.class, "GatewaySender");
    mockContext.checking(new Expectations() {

        {
            oneOf(mockGatewaySender).getDiskStoreName();
            will(returnValue(" "));
        }
    });
    final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
    assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME, function.getDiskStoreName(mockGatewaySender));
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) Expectations(org.jmock.Expectations) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

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