SGF-360 - Failures in SubRegionNamespaceTests when built with Java 8.
This commit is contained in:
@@ -46,9 +46,9 @@ import com.gemstone.gemfire.cache.Region;
|
||||
* @see org.springframework.test.context.ContextConfiguration
|
||||
* @see org.springframework.test.context.junit4.SpringJUnit4ClassRunner
|
||||
*/
|
||||
@ContextConfiguration(locations = "subregion-ns.xml", initializers = GemfireTestApplicationContextInitializer.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SuppressWarnings({ "deprecation", "rawtypes" })
|
||||
@ContextConfiguration(locations = "subregion-ns.xml", initializers = GemfireTestApplicationContextInitializer.class)
|
||||
@SuppressWarnings({ "deprecation", "rawtypes", "unused" })
|
||||
public class SubRegionNamespaceTest {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -22,23 +22,27 @@ import org.springframework.data.gemfire.server.CacheServerFactoryBean;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
* @author John Blum
|
||||
*/
|
||||
public class GemfireTestBeanPostProcessor implements BeanPostProcessor {
|
||||
|
||||
private static Log logger = LogFactory.getLog(GemfireTestBeanPostProcessor.class);
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
@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...",
|
||||
beanName, bean.getClass().getName()));
|
||||
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());
|
||||
@@ -47,7 +51,8 @@ public class GemfireTestBeanPostProcessor implements BeanPostProcessor {
|
||||
return bean;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
|
||||
@@ -94,13 +94,7 @@ public class MockRegionFactory<K,V> {
|
||||
@Override public Region answer(InvocationOnMock invocation) throws Throwable {
|
||||
Region parent = (Region) invocation.getArguments()[0];
|
||||
String name = (String) invocation.getArguments()[1];
|
||||
String parentRegionName = null;
|
||||
|
||||
for (String key: cache.allRegions().keySet()) {
|
||||
if (cache.allRegions().get(key).equals(parent)) {
|
||||
parentRegionName = key;
|
||||
}
|
||||
}
|
||||
String parentRegionName = parent.getFullPath();
|
||||
|
||||
assert parentRegionName != null : "The parent Region name was null!";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user