SGF-68
+ fix region initialization
This commit is contained in:
@@ -63,12 +63,13 @@ public class RegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V> imple
|
||||
private RegionAttributes<K, V> attributes;
|
||||
private Scope scope;
|
||||
private DataPolicy dataPolicy;
|
||||
private Region<K, V> region;
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
|
||||
region = getRegion();
|
||||
postProcess(region);
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
private GemFireCache cache;
|
||||
private String name;
|
||||
|
||||
Region<K, V> region;
|
||||
private Region<K, V> region;
|
||||
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
Assert.notNull(cache, "Cache property must be set");
|
||||
@@ -111,4 +111,8 @@ public class RegionLookupFactoryBean<K, V> implements FactoryBean<Region<K, V>>,
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
protected Region<K, V> getRegion() {
|
||||
return region;
|
||||
}
|
||||
}
|
||||
@@ -61,13 +61,13 @@ public class ClientRegionFactoryBean<K, V> extends RegionLookupFactoryBean<K, V>
|
||||
private DataPolicy dataPolicy;
|
||||
|
||||
private RegionAttributes<K, V> attributes;
|
||||
|
||||
private Region<K, V> region;
|
||||
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
super.afterPropertiesSet();
|
||||
region = getRegion();
|
||||
postProcess(region);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,9 @@ import java.util.Arrays;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.client.ClientRegionFactoryBean;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@@ -91,12 +92,12 @@ public class RegionIntegrationTest {
|
||||
}
|
||||
|
||||
//@Test
|
||||
//TODO: Disabled since for some reason in Spring, I get the bean rather then the client
|
||||
// TODO: disabled since the interest registration requires a proper pool to be created, which requires another JVM to run with the server/locator
|
||||
public void testRegionInterest() throws Exception {
|
||||
ClientRegionFactoryBean regionFB = (ClientRegionFactoryBean) ctx.getBean("&basic-client");
|
||||
System.out.println("**** interests are " + Arrays.toString(regionFB.getInterests()));
|
||||
//BeanDefinition bd = ((BeanDefinitionRegistry) ctx.getAutowireCapableBeanFactory()).getBeanDefinition("basic-client");
|
||||
// System.out.println(bd.getPropertyValues().getPropertyValue("interests").getValue());
|
||||
BeanDefinition bd = ((BeanDefinitionRegistry) ctx.getAutowireCapableBeanFactory()).getBeanDefinition("basic-client");
|
||||
System.out.println(bd.getPropertyValues().getPropertyValue("interests").getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
</bean>
|
||||
|
||||
<!-- client configurations -->
|
||||
<bean id="basic-client" class="org.springframework.data.gemfire.client.ClientRegionFactoryBean" p:cache-ref="cache" p:name="client-region" lazy-init="true">
|
||||
<bean id="basic-client" class="org.springframework.data.gemfire.client.ClientRegionFactoryBean" p:cache-ref="cache"
|
||||
p:name="client-region" lazy-init="true" p:pool-name="pool">
|
||||
<property name="interests">
|
||||
<array>
|
||||
<bean class="org.springframework.data.gemfire.client.Interest" p:key="Vlaicu" p:policy="NONE"/>
|
||||
@@ -40,6 +41,12 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="pool" class="org.springframework.data.gemfire.client.PoolFactoryBean" p:subscription-enabled="true">
|
||||
<property name="servers">
|
||||
<bean class="org.springframework.data.gemfire.client.PoolConnection" p:host="localhost" p:port="40404"/>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<!-- region with various attributes -->
|
||||
<bean id="attr-region" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache" lazy-init="true">
|
||||
<property name="attributes">
|
||||
|
||||
Reference in New Issue
Block a user