+ add flag to disable bean-factory-locator
This commit is contained in:
Costin Leau
2011-07-06 11:50:55 +03:00
parent fff04a8777
commit e261ecf6bd
7 changed files with 59 additions and 13 deletions

View File

@@ -61,4 +61,5 @@ public class CacheIntegrationTest extends RecreatingContextTest{
public void testCacheWithXml() throws Exception {
Cache cache = ctx.getBean("cache-with-xml", Cache.class);
}
}
}

View File

@@ -17,12 +17,14 @@
package org.springframework.data.gemfire.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import org.springframework.core.io.Resource;
import org.springframework.data.gemfire.CacheFactoryBean;
import org.springframework.data.gemfire.GemfireBeanFactoryLocator;
import org.springframework.data.gemfire.RecreatingContextTest;
import org.springframework.data.gemfire.TestUtils;
@@ -61,4 +63,17 @@ public class CacheNamespaceTest extends RecreatingContextTest {
assertEquals(ctx.getBean("props"), TestUtils.readField("properties", cfb));
}
@Test(expected = IllegalArgumentException.class)
public void testNoBeanFactory() throws Exception {
assertTrue(ctx.containsBean("no-bl"));
CacheFactoryBean cfb = (CacheFactoryBean) ctx.getBean("&no-bl");
GemfireBeanFactoryLocator locator = new GemfireBeanFactoryLocator();
try {
assertNotNull(locator.useBeanFactory("cache-with-name"));
locator.useBeanFactory("no-bl");
} finally {
locator.destroy();
}
}
}