SGF-133: Enabled pool autowiring
This commit is contained in:
@@ -1,15 +1,29 @@
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.cache.client.ClientCache;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration("client-cache.xml")
|
||||
public class ClientCacheTest {
|
||||
@Resource(name="challengeQuestionsRegion")
|
||||
Region<?,?> region;
|
||||
|
||||
@Autowired
|
||||
ClientCache cache;
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
|
||||
assertEquals("gemfirePool",region.getAttributes().getPoolName());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,11 +4,13 @@ import static org.junit.Assert.assertSame;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.mockito.Mockito;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.cache.client.ClientCache;
|
||||
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
|
||||
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
|
||||
import com.gemstone.gemfire.cache.client.Pool;
|
||||
|
||||
public class ClientRegionFactoryBeanTest {
|
||||
|
||||
@@ -17,6 +19,14 @@ public class ClientRegionFactoryBeanTest {
|
||||
throws Exception {
|
||||
ClientRegionFactoryBean<Object, Object> fb = new ClientRegionFactoryBean<Object, Object>();
|
||||
fb.setShortcut(ClientRegionShortcut.CACHING_PROXY);
|
||||
|
||||
Pool pool = Mockito.mock(Pool.class);
|
||||
|
||||
BeanFactory beanFactory = Mockito.mock(BeanFactory.class);
|
||||
|
||||
Mockito.when(beanFactory.getBean(Pool.class)).thenReturn(pool);
|
||||
|
||||
fb.setBeanFactory(beanFactory);
|
||||
|
||||
String regionName = "regionName";
|
||||
ClientCache cache = Mockito.mock(ClientCache.class);
|
||||
@@ -36,5 +46,4 @@ public class ClientRegionFactoryBeanTest {
|
||||
|
||||
assertSame(region, result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@
|
||||
"-//GemStone Systems, Inc.//GemFire Declarative Caching 6.5//EN"
|
||||
"http://www.gemstone.com/dtd/cache6_5.dtd">
|
||||
|
||||
<client-cache>
|
||||
<region name="myRegion" refid="PROXY"/>
|
||||
<client-cache>
|
||||
<pool name="DEFAULT">
|
||||
<locator port="1234" host="localhost"/>
|
||||
</pool>
|
||||
<region name="myRegion" refid="PROXY"/>
|
||||
<!-- you can override or add to the PROXY attributes by adding
|
||||
a region-attributes sub element here -->
|
||||
</client-cache>
|
||||
|
||||
@@ -7,4 +7,7 @@
|
||||
|
||||
<gfe:client-cache/>
|
||||
<gfe:client-region data-policy="NORMAL" name="ChallengeQuestions" id="challengeQuestionsRegion"/>
|
||||
<gfe:pool>
|
||||
<gfe:locator host="localhost" port="1234"/>
|
||||
</gfe:pool>
|
||||
</beans>
|
||||
|
||||
@@ -27,7 +27,11 @@
|
||||
<gfe:client-cache id="client-cache"/>
|
||||
|
||||
<gfe:client-cache id="client-cache-with-xml" cache-xml-location="classpath:gemfire-client-cache.xml"/>
|
||||
|
||||
|
||||
<gfe:pool>
|
||||
<gfe:server host="localhost" port="1234"/>
|
||||
</gfe:pool>
|
||||
|
||||
<gfe:cache id="heap-tuned-cache" critical-heap-percentage="70.0" eviction-heap-percentage="60.0"/>
|
||||
</beans>
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<gfe:client-cache />
|
||||
|
||||
<gfe:client-region id="simple" pool-name="gemfire-pool"/>
|
||||
<gfe:client-region id="simple"/>
|
||||
|
||||
<gfe:client-region id="empty" pool-name="gemfire-pool" name="publisher" data-policy="empty" close="true" destroy="false"/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user