+ add integration test for region with dedicated attributes

This commit is contained in:
costin
2010-07-30 14:49:05 +03:00
parent bc0fb93bad
commit 2ec50b0f7a
2 changed files with 26 additions and 3 deletions

View File

@@ -25,7 +25,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.data.gemfire.ClientRegionFactoryBean;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.annotation.DirtiesContext.ClassMode;
import org.springframework.test.context.ContextConfiguration;
@@ -35,7 +34,9 @@ import com.gemstone.gemfire.cache.CacheListener;
import com.gemstone.gemfire.cache.CacheLoader;
import com.gemstone.gemfire.cache.CacheLoaderException;
import com.gemstone.gemfire.cache.LoaderHelper;
import com.gemstone.gemfire.cache.PartitionAttributes;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
@@ -99,4 +100,16 @@ public class RegionIntegrationTest {
//BeanDefinition bd = ((BeanDefinitionRegistry) ctx.getAutowireCapableBeanFactory()).getBeanDefinition("basic-client");
// System.out.println(bd.getPropertyValues().getPropertyValue("interests").getValue());
}
@Test
public void testRegionAttributes() throws Exception {
Region region = ctx.getBean("attr-region", Region.class);
assertEquals("attr-region", region.getName());
RegionAttributes attr = region.getAttributes();
assertEquals(true, attr.getEarlyAck());
PartitionAttributes pa = attr.getPartitionAttributes();
assertEquals(512, pa.getLocalMaxMemory());
assertEquals(1, pa.getRedundantCopies());
}
}

View File

@@ -17,7 +17,7 @@
<bean id="basic" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache" p:name="basic"/>
<!-- find existing region -->
<bean id="root" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache" p:name="root"/>
<bean id="root" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache"/>
<bean id="listeners" class="org.springframework.data.gemfire.RegionFactoryBean" p:cache-ref="cache" p:name="listeners">
<property name="cacheListeners">
@@ -40,5 +40,15 @@
</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">
<bean class="org.springframework.data.gemfire.RegionAttributesFactory" p:early-ack="true">
<property name="partitionAttributes">
<bean class="org.springframework.data.gemfire.PartitionAttributesFactory" p:redundant-copies="1" p:local-max-memory="512"/>
</property>
</bean>
</property>
</bean>
</beans>
</beans>