use of org.apache.geode.cache.server.ClientSubscriptionConfig in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testGetCacheServerDiskStoreName.
@Test
public void testGetCacheServerDiskStoreName() {
final String expectedDiskStoreName = "testDiskStore";
final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
final ClientSubscriptionConfig mockClientSubscriptionConfig = mockContext.mock(ClientSubscriptionConfig.class, "ClientSubscriptionConfig");
mockContext.checking(new Expectations() {
{
exactly(2).of(mockCacheServer).getClientSubscriptionConfig();
will(returnValue(mockClientSubscriptionConfig));
oneOf(mockClientSubscriptionConfig).getDiskStoreName();
will(returnValue(expectedDiskStoreName));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertEquals(expectedDiskStoreName, function.getDiskStoreName(mockCacheServer));
}
use of org.apache.geode.cache.server.ClientSubscriptionConfig in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testIsCacheServerUsingDiskStoreWhenDiskStoresMismatch.
@Test
public void testIsCacheServerUsingDiskStoreWhenDiskStoresMismatch() {
final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
final ClientSubscriptionConfig mockClientSubscriptionConfig = mockContext.mock(ClientSubscriptionConfig.class, "ClientSubscriptionConfig");
final DiskStore mockDiskStore = mockContext.mock(DiskStore.class, "DiskStore");
mockContext.checking(new Expectations() {
{
exactly(2).of(mockCacheServer).getClientSubscriptionConfig();
will(returnValue(mockClientSubscriptionConfig));
oneOf(mockClientSubscriptionConfig).getDiskStoreName();
will(returnValue(" "));
oneOf(mockDiskStore).getName();
will(returnValue("otherDiskStore"));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertFalse(function.isUsingDiskStore(mockCacheServer, mockDiskStore));
}
use of org.apache.geode.cache.server.ClientSubscriptionConfig in project geode by apache.
the class DescribeDiskStoreFunctionJUnitTest method testGetCacheServerDiskStoreNameWhenUnspecified.
@Test
public void testGetCacheServerDiskStoreNameWhenUnspecified() {
final CacheServer mockCacheServer = mockContext.mock(CacheServer.class, "CacheServer");
final ClientSubscriptionConfig mockClientSubscriptionConfig = mockContext.mock(ClientSubscriptionConfig.class, "ClientSubscriptionConfig");
mockContext.checking(new Expectations() {
{
exactly(2).of(mockCacheServer).getClientSubscriptionConfig();
will(returnValue(mockClientSubscriptionConfig));
oneOf(mockClientSubscriptionConfig).getDiskStoreName();
will(returnValue(null));
}
});
final DescribeDiskStoreFunction function = createDescribeDiskStoreFunction(null);
assertEquals(DiskStoreDetails.DEFAULT_DISK_STORE_NAME, function.getDiskStoreName(mockCacheServer));
}
Aggregations