Example usage for org.springframework.data.gemfire.test StubCache StubCache

List of usage examples for org.springframework.data.gemfire.test StubCache StubCache

Introduction

In this page you can find the example usage for org.springframework.data.gemfire.test StubCache StubCache.

Prototype

public StubCache() 

Source Link

Usage

From source file:org.springframework.data.gemfire.test.GemfireTestBeanPostProcessor.java

@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (bean instanceof CacheFactoryBean) {
        String beanTypeName = bean.getClass().getName();

        bean = (bean instanceof ClientCacheFactoryBean
                ? new MockClientCacheFactoryBean((ClientCacheFactoryBean) bean)
                : new MockCacheFactoryBean((CacheFactoryBean) bean));

        logger.info(String.format("Replacing the '%1$s' bean definition having type '%2$s' with mock (%3$s)...",
                beanName, beanTypeName, bean.getClass().getName()));
    } else if (bean instanceof CacheServerFactoryBean) {
        ((CacheServerFactoryBean) bean).setCache(new StubCache());
    }//  ww  w . ja va2s  .com

    return bean;
}