use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testIsAsyncEventQueueUsingDiskStore.
@Test
public void testIsAsyncEventQueueUsingDiskStore() {
final String diskStoreName = "testDiskStore";
final AsyncEventQueue mockQueue = mockContext.mock(AsyncEventQueue.class, "AsyncEventQueue");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
oneOf(mockQueue).getDiskStoreName();
will(returnValue(diskStoreName));
oneOf(mockQueue).isPersistent();
will(returnValue(true));
oneOf(mockDiskStore).getName();
will(returnValue(diskStoreName));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertTrue(function.isUsingDiskStore(mockQueue, mockDiskStore));
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testIsAsyncEventQueueUsingDiskStoreWhenQueueIsNotPersistent.
@Test
public void testIsAsyncEventQueueUsingDiskStoreWhenQueueIsNotPersistent() {
final String diskStoreName = "testDiskStore";
final AsyncEventQueue mockQueue = mockContext.mock(AsyncEventQueue.class, "AsyncEventQueue");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
oneOf(mockQueue).isPersistent();
will(returnValue(false));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertFalse(function.isUsingDiskStore(mockQueue, mockDiskStore));
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testGetAsyncEventQueueDiskStoreName.
@Test
public void testGetAsyncEventQueueDiskStoreName() {
final String expectedDiskStoreName = "testDiskStore";
final AsyncEventQueue mockQueue = mockContext.mock(AsyncEventQueue.class, "AsyncEventQueue");
mockContext.checking(new Expectations() {
{
oneOf(mockQueue).getDiskStoreName();
will(returnValue(expectedDiskStoreName));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertEquals(expectedDiskStoreName, function.getDiskStoreName(mockQueue));
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testSetAsyncEventQueueDetails.
@Test
public void testSetAsyncEventQueueDetails() {
final String diskStoreName = "testDiskStore";
final InternalCache mockCache = mockContext.mock(InternalCache.class, "Cache");
final AsyncEventQueue mockQueue1 = mockContext.mock(AsyncEventQueue.class, "AsyncEvenQueue1");
final AsyncEventQueue mockQueue2 = mockContext.mock(AsyncEventQueue.class, "AsyncEvenQueue2");
final AsyncEventQueue mockQueue3 = mockContext.mock(AsyncEventQueue.class, "AsyncEvenQueue3");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getAsyncEventQueues();
will(returnValue(CollectionUtils.asSet(mockQueue1, mockQueue2, mockQueue3)));
oneOf(mockQueue1).isPersistent();
will(returnValue(true));
oneOf(mockQueue1).getDiskStoreName();
will(returnValue(diskStoreName));
oneOf(mockQueue1).getId();
will(returnValue("q1"));
oneOf(mockQueue2).isPersistent();
will(returnValue(true));
oneOf(mockQueue2).getDiskStoreName();
will(returnValue(null));
oneOf(mockQueue3).isPersistent();
will(returnValue(false));
atLeast(1).of(mockDiskStore).getName();
will(returnValue(diskStoreName));
}
});
final Set<DiskStoreDetails.AsyncEventQueueDetails> expectedAsyncEventQueueDetails = CollectionUtils.asSet(createAsyncEventQueueDetails("q1"));
final DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStoreName, "memberOne");
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
function.setAsyncEventQueueDetails(mockCache, mockDiskStore, diskStoreDetails);
assertAsyncEventQueueDetails(expectedAsyncEventQueueDetails, diskStoreDetails);
}
use of org.apache.geode.cache.asyncqueue.AsyncEventQueue in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testIsAsyncEventQueueUsingDiskStoreWhenDiskStoresMismatch.
@Test
public void testIsAsyncEventQueueUsingDiskStoreWhenDiskStoresMismatch() {
final AsyncEventQueue mockQueue = mockContext.mock(AsyncEventQueue.class, "AsyncEventQueue");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
oneOf(mockQueue).getDiskStoreName();
will(returnValue("mockDiskStore"));
oneOf(mockQueue).isPersistent();
will(returnValue(true));
oneOf(mockDiskStore).getName();
will(returnValue(DiskStoreDetails.DEFAULT_DISK_STORE_NAME));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertFalse(function.isUsingDiskStore(mockQueue, mockDiskStore));
}
Aggregations