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();
}
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));
}
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));
}
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));
}
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));
}
Aggregations