use of org.apache.geode.cache.DiskStore in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testSetPdxSerializationDetails.
@Test
public void testSetPdxSerializationDetails() {
final String diskStoreName = "testDiskStore";
final InternalCache mockCache = mockContext.mock(InternalCache.class, "Cache");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
oneOf(mockCache).getPdxPersistent();
will(returnValue(true));
oneOf(mockCache).getPdxDiskStore();
will(returnValue(diskStoreName));
oneOf(mockDiskStore).getName();
will(returnValue(diskStoreName));
}
});
final DiskStoreDetails diskStoreDetails = new DiskStoreDetails(diskStoreName, "memberOne");
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(mockCache);
function.setPdxSerializationDetails(mockCache, mockDiskStore, diskStoreDetails);
assertTrue(diskStoreDetails.isPdxSerializationMetaDataStored());
}
use of org.apache.geode.cache.DiskStore in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testIsGatewaySenderUsingDiskStoreWhenDiskStoresMismatch.
@Test
public void testIsGatewaySenderUsingDiskStoreWhenDiskStoresMismatch() {
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("mockDiskStore"));
oneOf(mockDiskStore).getName();
will(returnValue("testDiskStore"));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertFalse(function.isUsingDiskStore(mockGatewaySender, mockDiskStore));
}
use of org.apache.geode.cache.DiskStore 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.DiskStore 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));
}
use of org.apache.geode.cache.DiskStore in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testIsRegionUsingDiskStoreWhenDiskStoresMismatch.
@Test
public void testIsRegionUsingDiskStoreWhenDiskStoresMismatch() {
final Region mockRegion = mockContext.mock(Region.class, "Region");
final RegionAttributes mockRegionAttributes = mockContext.mock(RegionAttributes.class, "RegionAttributes");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
atLeast(1).of(mockRegion).getAttributes();
will(returnValue(mockRegionAttributes));
oneOf(mockRegionAttributes).getDataPolicy();
will(returnValue(DataPolicy.PERSISTENT_PARTITION));
oneOf(mockRegionAttributes).getDiskStoreName();
will(returnValue("mockDiskStore"));
oneOf(mockDiskStore).getName();
will(returnValue("testDiskStore"));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertFalse(function.isUsingDiskStore(mockRegion, mockDiskStore));
}
Aggregations