+ fix failing test

This commit is contained in:
Costin Leau
2010-12-06 19:06:27 +02:00
parent 597f6b7774
commit 8be789516e
3 changed files with 9 additions and 5 deletions

View File

@@ -69,7 +69,7 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
* @throws Exception
*/
protected Region<K, V> lookupFallback(Cache cache, String regionName) throws Exception {
throw new BeanInitializationException("Cannot find region named " + regionName + " in cache " + cache);
throw new BeanInitializationException("Cannot find region [" + regionName + "] in cache " + cache);
}
public Region<K, V> getObject() throws Exception {

View File

@@ -32,8 +32,10 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.ObjectUtils;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
@@ -78,9 +80,11 @@ public class ReplicatedRegionNamespaceTest {
@Test
public void testRegionLookup() throws Exception {
Cache cache = context.getBean(Cache.class);
Region existing = cache.createRegionFactory().create("existing");
assertTrue(context.containsBean("lookup"));
RegionLookupFactoryBean lfb = context.getBean("&lookup", RegionLookupFactoryBean.class);
assertEquals("simple", TestUtils.readField("name", lfb));
assertEquals(context.getBean("simple"), context.getBean("lookup"));
assertEquals("existing", TestUtils.readField("name", lfb));
assertEquals(context.getBean("existing"), context.getBean("lookup"));
}
}

View File

@@ -6,7 +6,7 @@
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/gemfire http://www.springframework.org/schema/gemfire/spring-gemfire.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd" default-lazy-init="true">
<gfe:cache />
@@ -27,5 +27,5 @@
<bean id="c-loader" class="org.springframework.data.gemfire.SimpleCacheLoader"/>
<bean id="c-writer" class="org.springframework.data.gemfire.SimpleCacheWriter"/>
<gfe:lookup-region id="lookup" name="simple"/>
<gfe:lookup-region id="lookup" name="existing"/>
</beans>