Search in sources :

Example 16 with ClientSubscriptionConfig

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));
}
Also used : Expectations(org.jmock.Expectations) ClientSubscriptionConfig(org.apache.geode.cache.server.ClientSubscriptionConfig) CacheServer(org.apache.geode.cache.server.CacheServer) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 17 with ClientSubscriptionConfig

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));
}
Also used : DiskStore(org.apache.geode.cache.DiskStore) Expectations(org.jmock.Expectations) ClientSubscriptionConfig(org.apache.geode.cache.server.ClientSubscriptionConfig) CacheServer(org.apache.geode.cache.server.CacheServer) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Example 18 with ClientSubscriptionConfig

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));
}
Also used : Expectations(org.jmock.Expectations) ClientSubscriptionConfig(org.apache.geode.cache.server.ClientSubscriptionConfig) CacheServer(org.apache.geode.cache.server.CacheServer) UnitTest(org.apache.geode.test.junit.categories.UnitTest) Test(org.junit.Test)

Aggregations

ClientSubscriptionConfig (org.apache.geode.cache.server.ClientSubscriptionConfig)18 CacheServer (org.apache.geode.cache.server.CacheServer)12 Test (org.junit.Test)9 Expectations (org.jmock.Expectations)7 DiskStore (org.apache.geode.cache.DiskStore)6 UnitTest (org.apache.geode.test.junit.categories.UnitTest)6 Cache (org.apache.geode.cache.Cache)4 ClientCache (org.apache.geode.cache.client.ClientCache)3 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)3 ClientCacheCreation (org.apache.geode.internal.cache.xmlcache.ClientCacheCreation)3 RegionAttributesCreation (org.apache.geode.internal.cache.xmlcache.RegionAttributesCreation)3 File (java.io.File)2 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 List (java.util.List)2 SerializableRunnable (org.apache.geode.test.dunit.SerializableRunnable)2 UnknownHostException (java.net.UnknownHostException)1 LinkedList (java.util.LinkedList)1 CacheFactory (org.apache.geode.cache.CacheFactory)1 DiskStoreFactory (org.apache.geode.cache.DiskStoreFactory)1