SGF-10 SGF-15 + quick validation of parsing (w/o subscriptions/interests or pools)

This commit is contained in:
costin
2010-08-31 15:00:45 +03:00
parent 4848282483
commit 69ce99b3bc
3 changed files with 16 additions and 7 deletions

View File

@@ -25,7 +25,17 @@ public abstract class TestUtils {
@SuppressWarnings("unchecked")
public static <T> T readField(String name, Object target) throws Exception {
Field field = target.getClass().getDeclaredField(name);
Field field = null;
Class<?> clazz = target.getClass();
do {
try {
field = clazz.getDeclaredField(name);
} catch (Exception ex) {
}
clazz = clazz.getSuperclass();
} while (field == null && !clazz.equals(Object.class));
field.setAccessible(true);
return (T) field.get(target);
}

View File

@@ -36,7 +36,6 @@ import org.springframework.util.ObjectUtils;
import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.InterestResultPolicy;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
/**
@@ -56,15 +55,13 @@ public class ClientRegionNamespaceTest {
@Test
public void testPublishingClient() throws Exception {
assertTrue(context.containsBean("pub"));
ClientRegionFactoryBean fb = context.getBean("&pub", ClientRegionFactoryBean.class);
assertTrue(context.containsBean("empty"));
ClientRegionFactoryBean fb = context.getBean("&empty", ClientRegionFactoryBean.class);
assertEquals(DataPolicy.EMPTY, TestUtils.readField("dataPolicy", fb));
assertEquals(Scope.LOCAL, TestUtils.readField("scope", fb));
RegionAttributes attrs = TestUtils.readField("attributes", fb);
assertFalse(attrs.getPublisher());
}
@Test
public void testComplexClient() throws Exception {
assertTrue(context.containsBean("complex"));
ClientRegionFactoryBean fb = context.getBean("&complex", ClientRegionFactoryBean.class);

View File

@@ -19,10 +19,12 @@
<ref bean="c-listener"/>
<bean class="org.springframework.data.gemfire.SimpleCacheListener"/>
</gfe:cache-listener>
<!--
<gfe:key-interest durable="true" result-policy="KEYS">
<bean id="key" class="java.lang.Object"/>
</gfe:key-interest>
<gfe:regex-interest pattern=".*"/>
-->
</gfe:client-region>
<bean id="c-listener" class="org.springframework.data.gemfire.SimpleCacheListener"/>