SGF-360 - Failures in SubRegionNamespaceTests when built with Java 8.

This commit is contained in:
John Blum
2014-12-11 16:42:55 -08:00
parent cf99650add
commit 20a8257574
3 changed files with 12 additions and 13 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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!";