merge 1.2.2

This commit is contained in:
David Turanski
2012-12-10 08:21:12 -05:00
parent 0a2fcb7324
commit c9de0477f9
7 changed files with 221 additions and 26 deletions

View File

@@ -18,6 +18,7 @@ package org.springframework.data.gemfire.config;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
@@ -39,6 +40,7 @@ import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CustomExpiry;
import com.gemstone.gemfire.cache.DiskStore;
import com.gemstone.gemfire.cache.DiskStoreFactory;
import com.gemstone.gemfire.cache.EvictionAction;
@@ -47,6 +49,7 @@ import com.gemstone.gemfire.cache.EvictionAttributes;
import com.gemstone.gemfire.cache.ExpirationAction;
import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.Region.Entry;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.util.ObjectSizer;
@@ -99,6 +102,7 @@ public class DiskStoreAndEvictionRegionParsingTest {
testReplicaDataOptions();
testPartitionDataOptions();
testEntryTtl();
testCustomExpiry();
}
private void testDiskStore() {
@@ -170,4 +174,39 @@ public class DiskStoreAndEvictionRegionParsingTest {
assertEquals(400, regionTTI.getTimeout());
assertEquals(ExpirationAction.INVALIDATE, regionTTI.getAction());
}
@SuppressWarnings("rawtypes")
private void testCustomExpiry() throws Exception {
assertTrue(context.containsBean("replicated-data-custom-expiry"));
RegionFactoryBean fb = context.getBean("&replicated-data-custom-expiry", RegionFactoryBean.class);
RegionAttributes attrs = TestUtils.readField("attributes", fb);
assertNotNull(attrs.getCustomEntryIdleTimeout());
assertNotNull(attrs.getCustomEntryTimeToLive());
assertTrue(attrs.getCustomEntryIdleTimeout() instanceof TestCustomExpiry);
assertTrue(attrs.getCustomEntryTimeToLive() instanceof TestCustomExpiry);
}
public static class TestCustomExpiry<K,V> implements CustomExpiry<K,V> {
/* (non-Javadoc)
* @see com.gemstone.gemfire.cache.CacheCallback#close()
*/
@Override
public void close() {
// TODO Auto-generated method stub
}
/* (non-Javadoc)
* @see com.gemstone.gemfire.cache.CustomExpiry#getExpiry(com.gemstone.gemfire.cache.Region.Entry)
*/
@Override
public ExpirationAttributes getExpiry(Entry<K, V> entry) {
return null;
}
}
}

View File

@@ -28,9 +28,9 @@
<gfe:disk-dir location="${location}" max-size="${maxSize}"/>
</gfe:disk-store>
<!-- <gfe:partitioned-region id="partitioned-data-with-timeout" disk-store-ref="diskStore1" persistent="true"> -->
<!-- <gfe:entry-ttl timeout="${ttl}" action="DESTROY"/> -->
<!-- </gfe:partitioned-region> -->
<gfe:partitioned-region id="partitioned-data-with-timeout" disk-store-ref="diskStore1" persistent="true">
<gfe:entry-ttl timeout="${ttl}" action="DESTROY"/>
</gfe:partitioned-region>
<gfe:replicated-region id="replicated-data" close="true" destroy="false" disk-store-ref="diskStore1">
<gfe:region-ttl timeout="${ttl}" action="DESTROY"/>
@@ -41,6 +41,13 @@
<gfe:eviction type="ENTRY_COUNT" threshold="50" action="OVERFLOW_TO_DISK"/>
</gfe:replicated-region>
<gfe:replicated-region id="replicated-data-custom-expiry" close="true" destroy="false">
<gfe:custom-entry-ttl ref="customExpiry"/>
<gfe:custom-entry-tti>
<bean class="org.springframework.data.gemfire.config.DiskStoreAndEvictionRegionParsingTest.TestCustomExpiry"/>
</gfe:custom-entry-tti>
</gfe:replicated-region>
<gfe:partitioned-region id="partition-data" persistent="true" disk-store-ref="ds2">
<gfe:eviction type="MEMORY_SIZE" threshold="10" action="LOCAL_DESTROY">
@@ -50,8 +57,10 @@
</gfe:eviction>
</gfe:partitioned-region>
<gfe:disk-store id="ds2" queue-size="50" auto-compact="true" max-oplog-size="10" time-interval="9999">
<gfe:disk-store id="ds2" queue-size="50" auto-compact="true" max-oplog-size="10" time-interval="9999">
<gfe:disk-dir location="./" max-size="1"/>
</gfe:disk-store>
<bean id="customExpiry" class="org.springframework.data.gemfire.config.DiskStoreAndEvictionRegionParsingTest.TestCustomExpiry"/>
</beans>