From 2ecbd7b53da2687cd948e6acc6b06651b3520f91 Mon Sep 17 00:00:00 2001 From: John Blum Date: Mon, 13 Jul 2015 17:37:55 -0700 Subject: [PATCH] SGF-417 - Update apache-geode SDG branch based on the latest Apache Geode developments (snapshot 20150713182515). --- gradle.properties | 2 +- .../data/gemfire/DataPolicyConverter.java | 7 ++- .../support/RegionShortcutWrapper.java | 4 ++ .../data/gemfire/DataPolicyConverterTest.java | 24 ++++---- .../support/RegionShortcutWrapperTest.java | 56 ++++++++++++++----- .../data/gemfire/test/StubCache.java | 35 ++++++++---- ....java => StubCacheTransactionManager.java} | 40 +++++++------ 7 files changed, 110 insertions(+), 58 deletions(-) rename src/test/java/org/springframework/data/gemfire/test/{StubCacheTransactionMananger.java => StubCacheTransactionManager.java} (88%) diff --git a/gradle.properties b/gradle.properties index 7e9ba906..e13c2a5f 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ log4jVersion=1.2.17 mockitoVersion=1.10.19 slf4jVersion=1.7.12 spring.range="[4.0.0, 5.0.0)" -springVersion=4.1.6.RELEASE +springVersion=4.1.7.RELEASE springDataBuildVersion=1.7.0.BUILD-SNAPSHOT springDataCommonsVersion=1.11.0.BUILD-SNAPSHOT version=1.7.0.APACHE-GEODE-EA-SNAPSHOT diff --git a/src/main/java/org/springframework/data/gemfire/DataPolicyConverter.java b/src/main/java/org/springframework/data/gemfire/DataPolicyConverter.java index 3e56159c..125e9348 100644 --- a/src/main/java/org/springframework/data/gemfire/DataPolicyConverter.java +++ b/src/main/java/org/springframework/data/gemfire/DataPolicyConverter.java @@ -31,7 +31,8 @@ import com.gemstone.gemfire.cache.DataPolicy; public class DataPolicyConverter implements Converter { static enum Policy { - DEFAULT, EMPTY, NORMAL, PRELOADED, PARTITION, PERSISTENT_PARTITION, REPLICATE, PERSISTENT_REPLICATE; + DEFAULT, EMPTY, NORMAL, PRELOADED, PARTITION, PERSISTENT_PARTITION, HDFS_PARTITION, HDFS_PERSISTENT_PARTITION, + REPLICATE, PERSISTENT_REPLICATE; private static String toUpperCase(String value) { return (value == null ? null : value.toUpperCase()); @@ -58,6 +59,10 @@ public class DataPolicyConverter implements Converter { return DataPolicy.PARTITION; case PERSISTENT_PARTITION: return DataPolicy.PERSISTENT_PARTITION; + case HDFS_PARTITION: + return DataPolicy.HDFS_PARTITION; + case HDFS_PERSISTENT_PARTITION: + return DataPolicy.HDFS_PERSISTENT_PARTITION; case REPLICATE: return DataPolicy.REPLICATE; case PERSISTENT_REPLICATE: diff --git a/src/main/java/org/springframework/data/gemfire/support/RegionShortcutWrapper.java b/src/main/java/org/springframework/data/gemfire/support/RegionShortcutWrapper.java index 66a99294..83e29d24 100644 --- a/src/main/java/org/springframework/data/gemfire/support/RegionShortcutWrapper.java +++ b/src/main/java/org/springframework/data/gemfire/support/RegionShortcutWrapper.java @@ -36,6 +36,7 @@ public enum RegionShortcutWrapper { LOCAL_PERSISTENT(RegionShortcut.LOCAL_PERSISTENT), LOCAL_PERSISTENT_OVERFLOW(RegionShortcut.LOCAL_PERSISTENT_OVERFLOW), PARTITION(RegionShortcut.PARTITION), + PARTITION_HDFS(RegionShortcut.PARTITION_HDFS), PARTITION_HEAP_LRU(RegionShortcut.PARTITION_HEAP_LRU), PARTITION_OVERFLOW(RegionShortcut.PARTITION_OVERFLOW), PARTITION_PERSISTENT(RegionShortcut.PARTITION_PERSISTENT), @@ -44,9 +45,12 @@ public enum RegionShortcutWrapper { PARTITION_PROXY_REDUNDANT(RegionShortcut.PARTITION_PROXY_REDUNDANT), PARTITION_REDUNDANT(RegionShortcut.PARTITION_REDUNDANT), PARTITION_REDUNDANT_HEAP_LRU(RegionShortcut.PARTITION_REDUNDANT_HEAP_LRU), + PARTITION_REDUNDANT_HDFS(RegionShortcut.PARTITION_REDUNDANT_HDFS), PARTITION_REDUNDANT_OVERFLOW(RegionShortcut.PARTITION_REDUNDANT_OVERFLOW), PARTITION_REDUNDANT_PERSISTENT(RegionShortcut.PARTITION_REDUNDANT_PERSISTENT), PARTITION_REDUNDANT_PERSISTENT_OVERFLOW(RegionShortcut.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW), + PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE(RegionShortcut.PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE), + PARTITION_WRITEONLY_HDFS_STORE(RegionShortcut.PARTITION_WRITEONLY_HDFS_STORE), REPLICATE(RegionShortcut.REPLICATE), REPLICATE_HEAP_LRU(RegionShortcut.REPLICATE_HEAP_LRU), REPLICATE_OVERFLOW(RegionShortcut.REPLICATE_OVERFLOW), diff --git a/src/test/java/org/springframework/data/gemfire/DataPolicyConverterTest.java b/src/test/java/org/springframework/data/gemfire/DataPolicyConverterTest.java index 21ca8f88..2ed3df02 100644 --- a/src/test/java/org/springframework/data/gemfire/DataPolicyConverterTest.java +++ b/src/test/java/org/springframework/data/gemfire/DataPolicyConverterTest.java @@ -16,7 +16,6 @@ package org.springframework.data.gemfire; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import org.junit.Test; @@ -32,38 +31,41 @@ public class DataPolicyConverterTest { private final DataPolicyConverter converter = new DataPolicyConverter(); protected int getDataPolicyEnumerationSize() { + int count = 0; + for (byte ordinal = 0; ordinal < Byte.MAX_VALUE; ordinal++) { try { - assertNotNull(DataPolicy.fromOrdinal(ordinal)); + if (DataPolicy.fromOrdinal(ordinal) != null) { + count++; + } } - catch (Exception ignore) { - return ordinal; + catch (ArrayIndexOutOfBoundsException ignore) { + break; } - catch (Error ignore) { - return ordinal; + catch (Throwable ignore) { } } - throw new IndexOutOfBoundsException("The size of the Data Policy enumeration could not be determined" - + " because the ordinal based on Byte.MAX_VALUE was exhausted!"); + return count; } @Test - public void testPolicyToDataPolicy() { - // exclude DEFAULT + public void policyToDataPolicyConversion() { assertEquals(getDataPolicyEnumerationSize(), DataPolicyConverter.Policy.values().length - 1); assertEquals(DataPolicy.EMPTY, DataPolicyConverter.Policy.EMPTY.toDataPolicy()); assertEquals(DataPolicy.NORMAL, DataPolicyConverter.Policy.NORMAL.toDataPolicy()); assertEquals(DataPolicy.PRELOADED, DataPolicyConverter.Policy.PRELOADED.toDataPolicy()); assertEquals(DataPolicy.PARTITION, DataPolicyConverter.Policy.PARTITION.toDataPolicy()); assertEquals(DataPolicy.PERSISTENT_PARTITION, DataPolicyConverter.Policy.PERSISTENT_PARTITION.toDataPolicy()); + assertEquals(DataPolicy.HDFS_PARTITION, DataPolicyConverter.Policy.HDFS_PARTITION.toDataPolicy()); + assertEquals(DataPolicy.HDFS_PERSISTENT_PARTITION, DataPolicyConverter.Policy.HDFS_PERSISTENT_PARTITION.toDataPolicy()); assertEquals(DataPolicy.REPLICATE, DataPolicyConverter.Policy.REPLICATE.toDataPolicy()); assertEquals(DataPolicy.PERSISTENT_REPLICATE, DataPolicyConverter.Policy.PERSISTENT_REPLICATE.toDataPolicy()); assertEquals(DataPolicy.DEFAULT, DataPolicyConverter.Policy.DEFAULT.toDataPolicy()); } @Test - public void testConvert() { + public void convertDataPolicyStrings() { assertEquals(DataPolicy.EMPTY, converter.convert("empty")); assertEquals(DataPolicy.PARTITION, converter.convert("Partition")); assertEquals(DataPolicy.PERSISTENT_REPLICATE, converter.convert("PERSISTENT_REPLICATE")); diff --git a/src/test/java/org/springframework/data/gemfire/support/RegionShortcutWrapperTest.java b/src/test/java/org/springframework/data/gemfire/support/RegionShortcutWrapperTest.java index 425112ae..bfd0dedd 100644 --- a/src/test/java/org/springframework/data/gemfire/support/RegionShortcutWrapperTest.java +++ b/src/test/java/org/springframework/data/gemfire/support/RegionShortcutWrapperTest.java @@ -38,20 +38,22 @@ import com.gemstone.gemfire.cache.RegionShortcut; public class RegionShortcutWrapperTest { @Test - public void testOneForOneMapping() { + public void oneForOneMapping() { for (RegionShortcut shortcut : RegionShortcut.values()) { - assertNotNull(RegionShortcutWrapper.valueOf(shortcut.name())); - assertFalse(RegionShortcutWrapper.UNSPECIFIED.equals(RegionShortcutWrapper.valueOf(shortcut))); + RegionShortcutWrapper wrapper = RegionShortcutWrapper.valueOf(shortcut.name()); + + assertNotNull(wrapper); + assertFalse(RegionShortcutWrapper.UNSPECIFIED.equals(wrapper)); } } @Test - public void testRegionShortcutUnspecified() { + public void unspecifiedRegionShortcut() { assertEquals(RegionShortcutWrapper.UNSPECIFIED, RegionShortcutWrapper.valueOf((RegionShortcut) null)); } @Test - public void testIsHeapLru() { + public void isHeapLru() { assertFalse(RegionShortcutWrapper.LOCAL.isHeapLru()); assertTrue(RegionShortcutWrapper.LOCAL_HEAP_LRU.isHeapLru()); assertFalse(RegionShortcutWrapper.LOCAL_OVERFLOW.isHeapLru()); @@ -79,13 +81,14 @@ public class RegionShortcutWrapperTest { } @Test - public void testIsLocal() { + public void isLocal() { assertTrue(RegionShortcutWrapper.LOCAL.isLocal()); assertTrue(RegionShortcutWrapper.LOCAL_HEAP_LRU.isLocal()); assertTrue(RegionShortcutWrapper.LOCAL_OVERFLOW.isLocal()); assertTrue(RegionShortcutWrapper.LOCAL_PERSISTENT.isLocal()); assertTrue(RegionShortcutWrapper.LOCAL_PERSISTENT_OVERFLOW.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION.isLocal()); + assertFalse(RegionShortcutWrapper.PARTITION_HDFS.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_HEAP_LRU.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_OVERFLOW.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_PERSISTENT.isLocal()); @@ -93,10 +96,13 @@ public class RegionShortcutWrapperTest { assertFalse(RegionShortcutWrapper.PARTITION_PROXY.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_PROXY_REDUNDANT.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT.isLocal()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HDFS.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HEAP_LRU.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_OVERFLOW.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT.isLocal()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW.isLocal()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE.isLocal()); + assertFalse(RegionShortcutWrapper.PARTITION_WRITEONLY_HDFS_STORE.isLocal()); assertFalse(RegionShortcutWrapper.REPLICATE.isLocal()); assertFalse(RegionShortcutWrapper.REPLICATE_HEAP_LRU.isLocal()); assertFalse(RegionShortcutWrapper.REPLICATE_OVERFLOW.isLocal()); @@ -107,13 +113,14 @@ public class RegionShortcutWrapperTest { } @Test - public void testIsOverflow() { + public void isOverflow() { assertFalse(RegionShortcutWrapper.LOCAL.isOverflow()); assertFalse(RegionShortcutWrapper.LOCAL_HEAP_LRU.isOverflow()); assertTrue(RegionShortcutWrapper.LOCAL_OVERFLOW.isOverflow()); assertFalse(RegionShortcutWrapper.LOCAL_PERSISTENT.isOverflow()); assertTrue(RegionShortcutWrapper.LOCAL_PERSISTENT_OVERFLOW.isOverflow()); assertFalse(RegionShortcutWrapper.PARTITION.isOverflow()); + assertFalse(RegionShortcutWrapper.PARTITION_HDFS.isOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_HEAP_LRU.isOverflow()); assertTrue(RegionShortcutWrapper.PARTITION_OVERFLOW.isOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_PERSISTENT.isOverflow()); @@ -121,10 +128,13 @@ public class RegionShortcutWrapperTest { assertFalse(RegionShortcutWrapper.PARTITION_PROXY.isOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_PROXY_REDUNDANT.isOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT.isOverflow()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HDFS.isOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HEAP_LRU.isOverflow()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_OVERFLOW.isOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT.isOverflow()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW.isOverflow()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE.isOverflow()); + assertFalse(RegionShortcutWrapper.PARTITION_WRITEONLY_HDFS_STORE.isOverflow()); assertFalse(RegionShortcutWrapper.REPLICATE.isOverflow()); assertFalse(RegionShortcutWrapper.REPLICATE_HEAP_LRU.isOverflow()); assertTrue(RegionShortcutWrapper.REPLICATE_OVERFLOW.isOverflow()); @@ -135,13 +145,14 @@ public class RegionShortcutWrapperTest { } @Test - public void testIsPartition() { + public void isPartition() { assertFalse(RegionShortcutWrapper.LOCAL.isPartition()); assertFalse(RegionShortcutWrapper.LOCAL_HEAP_LRU.isPartition()); assertFalse(RegionShortcutWrapper.LOCAL_OVERFLOW.isPartition()); assertFalse(RegionShortcutWrapper.LOCAL_PERSISTENT.isPartition()); assertFalse(RegionShortcutWrapper.LOCAL_PERSISTENT_OVERFLOW.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION.isPartition()); + assertTrue(RegionShortcutWrapper.PARTITION_HDFS.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_HEAP_LRU.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_OVERFLOW.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_PERSISTENT.isPartition()); @@ -149,10 +160,13 @@ public class RegionShortcutWrapperTest { assertTrue(RegionShortcutWrapper.PARTITION_PROXY.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_PROXY_REDUNDANT.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT.isPartition()); + assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_HDFS.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_HEAP_LRU.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_OVERFLOW.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT.isPartition()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW.isPartition()); + assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE.isPartition()); + assertTrue(RegionShortcutWrapper.PARTITION_WRITEONLY_HDFS_STORE.isPartition()); assertFalse(RegionShortcutWrapper.REPLICATE.isPartition()); assertFalse(RegionShortcutWrapper.REPLICATE_HEAP_LRU.isPartition()); assertFalse(RegionShortcutWrapper.REPLICATE_OVERFLOW.isPartition()); @@ -163,13 +177,14 @@ public class RegionShortcutWrapperTest { } @Test - public void testIsPersistent() { + public void isPersistent() { assertFalse(RegionShortcutWrapper.LOCAL.isPersistent()); assertFalse(RegionShortcutWrapper.LOCAL_HEAP_LRU.isPersistent()); assertFalse(RegionShortcutWrapper.LOCAL_OVERFLOW.isPersistent()); assertTrue(RegionShortcutWrapper.LOCAL_PERSISTENT.isPersistent()); assertTrue(RegionShortcutWrapper.LOCAL_PERSISTENT_OVERFLOW.isPersistent()); assertFalse(RegionShortcutWrapper.PARTITION.isPersistent()); + assertFalse(RegionShortcutWrapper.PARTITION_HDFS.isPersistent()); assertFalse(RegionShortcutWrapper.PARTITION_HEAP_LRU.isPersistent()); assertFalse(RegionShortcutWrapper.PARTITION_OVERFLOW.isPersistent()); assertTrue(RegionShortcutWrapper.PARTITION_PERSISTENT.isPersistent()); @@ -177,10 +192,13 @@ public class RegionShortcutWrapperTest { assertFalse(RegionShortcutWrapper.PARTITION_PROXY.isPersistent()); assertFalse(RegionShortcutWrapper.PARTITION_PROXY_REDUNDANT.isPersistent()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT.isPersistent()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HDFS.isPersistent()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HEAP_LRU.isPersistent()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_OVERFLOW.isPersistent()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT.isPersistent()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW.isPersistent()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE.isPersistent()); + assertFalse(RegionShortcutWrapper.PARTITION_WRITEONLY_HDFS_STORE.isPersistent()); assertFalse(RegionShortcutWrapper.REPLICATE.isPersistent()); assertFalse(RegionShortcutWrapper.REPLICATE_HEAP_LRU.isPersistent()); assertFalse(RegionShortcutWrapper.REPLICATE_OVERFLOW.isPersistent()); @@ -191,13 +209,14 @@ public class RegionShortcutWrapperTest { } @Test - public void testIsPersistentOverflow() { + public void isPersistentOverflow() { assertFalse(RegionShortcutWrapper.LOCAL.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.LOCAL_HEAP_LRU.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.LOCAL_OVERFLOW.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.LOCAL_PERSISTENT.isPersistentOverflow()); assertTrue(RegionShortcutWrapper.LOCAL_PERSISTENT_OVERFLOW.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION.isPersistentOverflow()); + assertFalse(RegionShortcutWrapper.PARTITION_HDFS.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_HEAP_LRU.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_OVERFLOW.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_PERSISTENT.isPersistentOverflow()); @@ -205,10 +224,13 @@ public class RegionShortcutWrapperTest { assertFalse(RegionShortcutWrapper.PARTITION_PROXY.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_PROXY_REDUNDANT.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT.isPersistentOverflow()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HDFS.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HEAP_LRU.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_OVERFLOW.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT.isPersistentOverflow()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW.isPersistentOverflow()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE.isPersistentOverflow()); + assertFalse(RegionShortcutWrapper.PARTITION_WRITEONLY_HDFS_STORE.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.REPLICATE.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.REPLICATE_HEAP_LRU.isPersistentOverflow()); assertFalse(RegionShortcutWrapper.REPLICATE_OVERFLOW.isPersistentOverflow()); @@ -218,13 +240,14 @@ public class RegionShortcutWrapperTest { assertFalse(RegionShortcutWrapper.UNSPECIFIED.isPersistentOverflow()); } @Test - public void testIsProxy() { + public void isProxy() { assertFalse(RegionShortcutWrapper.LOCAL.isProxy()); assertFalse(RegionShortcutWrapper.LOCAL_HEAP_LRU.isProxy()); assertFalse(RegionShortcutWrapper.LOCAL_OVERFLOW.isProxy()); assertFalse(RegionShortcutWrapper.LOCAL_PERSISTENT.isProxy()); assertFalse(RegionShortcutWrapper.LOCAL_PERSISTENT_OVERFLOW.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION.isProxy()); + assertFalse(RegionShortcutWrapper.PARTITION_HDFS.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION_HEAP_LRU.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION_OVERFLOW.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION_PERSISTENT.isProxy()); @@ -232,10 +255,13 @@ public class RegionShortcutWrapperTest { assertTrue(RegionShortcutWrapper.PARTITION_PROXY.isProxy()); assertTrue(RegionShortcutWrapper.PARTITION_PROXY_REDUNDANT.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT.isProxy()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HDFS.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_HEAP_LRU.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_OVERFLOW.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT.isProxy()); assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW.isProxy()); + assertFalse(RegionShortcutWrapper.PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE.isProxy()); + assertFalse(RegionShortcutWrapper.PARTITION_WRITEONLY_HDFS_STORE.isProxy()); assertFalse(RegionShortcutWrapper.REPLICATE.isProxy()); assertFalse(RegionShortcutWrapper.REPLICATE_HEAP_LRU.isProxy()); assertFalse(RegionShortcutWrapper.REPLICATE_OVERFLOW.isProxy()); @@ -245,13 +271,14 @@ public class RegionShortcutWrapperTest { assertFalse(RegionShortcutWrapper.UNSPECIFIED.isProxy()); } @Test - public void testIsRedundant() { + public void isRedundant() { assertFalse(RegionShortcutWrapper.LOCAL.isRedundant()); assertFalse(RegionShortcutWrapper.LOCAL_HEAP_LRU.isRedundant()); assertFalse(RegionShortcutWrapper.LOCAL_OVERFLOW.isRedundant()); assertFalse(RegionShortcutWrapper.LOCAL_PERSISTENT.isRedundant()); assertFalse(RegionShortcutWrapper.LOCAL_PERSISTENT_OVERFLOW.isRedundant()); assertFalse(RegionShortcutWrapper.PARTITION.isRedundant()); + assertFalse(RegionShortcutWrapper.PARTITION_HDFS.isRedundant()); assertFalse(RegionShortcutWrapper.PARTITION_HEAP_LRU.isRedundant()); assertFalse(RegionShortcutWrapper.PARTITION_OVERFLOW.isRedundant()); assertFalse(RegionShortcutWrapper.PARTITION_PERSISTENT.isRedundant()); @@ -259,10 +286,13 @@ public class RegionShortcutWrapperTest { assertFalse(RegionShortcutWrapper.PARTITION_PROXY.isRedundant()); assertTrue(RegionShortcutWrapper.PARTITION_PROXY_REDUNDANT.isRedundant()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT.isRedundant()); + assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_HDFS.isRedundant()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_HEAP_LRU.isRedundant()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_OVERFLOW.isRedundant()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT.isRedundant()); assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_PERSISTENT_OVERFLOW.isRedundant()); + assertTrue(RegionShortcutWrapper.PARTITION_REDUNDANT_WRITEONLY_HDFS_STORE.isRedundant()); + assertFalse(RegionShortcutWrapper.PARTITION_WRITEONLY_HDFS_STORE.isRedundant()); assertFalse(RegionShortcutWrapper.REPLICATE.isRedundant()); assertFalse(RegionShortcutWrapper.REPLICATE_HEAP_LRU.isRedundant()); assertFalse(RegionShortcutWrapper.REPLICATE_OVERFLOW.isRedundant()); @@ -273,7 +303,7 @@ public class RegionShortcutWrapperTest { } @Test - public void testIsReplicate() { + public void isReplicate() { assertFalse(RegionShortcutWrapper.LOCAL.isReplicate()); assertFalse(RegionShortcutWrapper.LOCAL_HEAP_LRU.isReplicate()); assertFalse(RegionShortcutWrapper.LOCAL_OVERFLOW.isReplicate()); diff --git a/src/test/java/org/springframework/data/gemfire/test/StubCache.java b/src/test/java/org/springframework/data/gemfire/test/StubCache.java index e6a08535..d050e4c3 100644 --- a/src/test/java/org/springframework/data/gemfire/test/StubCache.java +++ b/src/test/java/org/springframework/data/gemfire/test/StubCache.java @@ -37,6 +37,9 @@ import com.gemstone.gemfire.cache.TimeoutException; import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue; import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueueFactory; import com.gemstone.gemfire.cache.control.ResourceManager; +import com.gemstone.gemfire.cache.hdfs.HDFSStore; +import com.gemstone.gemfire.cache.hdfs.HDFSStoreFactory; +import com.gemstone.gemfire.cache.lucene.LuceneService; import com.gemstone.gemfire.cache.query.Index; import com.gemstone.gemfire.cache.query.IndexExistsException; import com.gemstone.gemfire.cache.query.IndexInvalidException; @@ -127,7 +130,7 @@ public class StubCache implements Cache { @Override public CacheTransactionManager getCacheTransactionManager() { if (cacheTransactionManager == null) { - cacheTransactionManager = new StubCacheTransactionMananger(); + cacheTransactionManager = new StubCacheTransactionManager(); } return cacheTransactionManager; @@ -266,9 +269,11 @@ public class StubCache implements Cache { @Override public Map> listRegionAttributes() { Map> attributes = new HashMap>(); + for (Entry entry: allRegions().entrySet()) { attributes.put(entry.getKey(), entry.getValue().getAttributes()); } + return attributes; } @@ -333,14 +338,12 @@ public class StubCache implements Cache { */ @Override public QueryService getQueryService() { - QueryService qs = null; try { - qs = mockQueryService(); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return qs; + return mockQueryService(); + } + catch (Exception ignore) { + return null; + } } /* (non-Javadoc) @@ -366,11 +369,13 @@ public class StubCache implements Cache { @Override public Set> rootRegions() { Set> rootRegions = new HashSet>(); + for (String key: allRegions().keySet()) { - if (!key.contains("/")) { + if (!key.contains(Region.SEPARATOR)) { rootRegions.add(allRegions().get(key)); } } + return rootRegions; } @@ -580,12 +585,10 @@ public class StubCache implements Cache { /* (non-Javadoc) * @see com.gemstone.gemfire.cache.Cache#getLuceneService() */ - /* @Override public LuceneService getLuceneService() { throw new UnsupportedOperationException(NOT_IMPLEMENTED); } - */ /* (non-Javadoc) * @see com.gemstone.gemfire.cache.Cache#getMembers() @@ -846,4 +849,14 @@ public class StubCache implements Cache { return false; } + @Override + public HDFSStoreFactory createHDFSStoreFactory() { + throw new UnsupportedOperationException("Not Implemented!"); + } + + @Override + public HDFSStore findHDFSStore(final String s) { + throw new UnsupportedOperationException("Not Implemented!"); + } + } diff --git a/src/test/java/org/springframework/data/gemfire/test/StubCacheTransactionMananger.java b/src/test/java/org/springframework/data/gemfire/test/StubCacheTransactionManager.java similarity index 88% rename from src/test/java/org/springframework/data/gemfire/test/StubCacheTransactionMananger.java rename to src/test/java/org/springframework/data/gemfire/test/StubCacheTransactionManager.java index 87796f20..25739ee2 100644 --- a/src/test/java/org/springframework/data/gemfire/test/StubCacheTransactionMananger.java +++ b/src/test/java/org/springframework/data/gemfire/test/StubCacheTransactionManager.java @@ -28,9 +28,10 @@ import com.gemstone.gemfire.cache.TransactionWriter; * @author David Turanski * */ -public class StubCacheTransactionMananger implements CacheTransactionManager { +public class StubCacheTransactionManager implements CacheTransactionManager { private List listeners = new ArrayList(); + private TransactionWriter writer; /* (non-Javadoc) @@ -38,8 +39,7 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public void begin() { - // TODO Auto-generated method stub - + throw new UnsupportedOperationException("Not Implemented!"); } /* (non-Javadoc) @@ -47,7 +47,7 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public void commit() throws CommitConflictException { - + throw new UnsupportedOperationException("Not Implemented!"); } /* (non-Javadoc) @@ -55,8 +55,7 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public void rollback() { - // TODO Auto-generated method stub - + throw new UnsupportedOperationException("Not Implemented!"); } /* (non-Javadoc) @@ -64,8 +63,7 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public TransactionId suspend() { - // TODO Auto-generated method stub - return null; + throw new UnsupportedOperationException("Not Implemented!"); } /* (non-Javadoc) @@ -73,8 +71,7 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public void resume(TransactionId transactionId) { - // TODO Auto-generated method stub - + throw new UnsupportedOperationException("Not Implemented!"); } /* (non-Javadoc) @@ -82,7 +79,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public boolean isSuspended(TransactionId transactionId) { - // TODO Auto-generated method stub return false; } @@ -91,7 +87,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public boolean tryResume(TransactionId transactionId) { - // TODO Auto-generated method stub return false; } @@ -100,7 +95,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public boolean tryResume(TransactionId transactionId, long time, TimeUnit unit) { - // TODO Auto-generated method stub return false; } @@ -109,7 +103,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public boolean exists(TransactionId transactionId) { - // TODO Auto-generated method stub return false; } @@ -118,7 +111,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public boolean exists() { - // TODO Auto-generated method stub return false; } @@ -127,7 +119,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { */ @Override public TransactionId getTransactionId() { - // TODO Auto-generated method stub return null; } @@ -137,7 +128,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { @Override @Deprecated public TransactionListener getListener() { - // TODO Auto-generated method stub return null; } @@ -148,14 +138,14 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { public TransactionListener[] getListeners() { return listeners.toArray(new TransactionListener[listeners.size()]); } + /* (non-Javadoc) * @see com.gemstone.gemfire.cache.CacheTransactionManager#setListener(com.gemstone.gemfire.cache.TransactionListener) */ @Override @Deprecated public TransactionListener setListener(TransactionListener newListener) { - // TODO Auto-generated method stub - return null; + throw new UnsupportedOperationException("Not Implemented!"); } /* (non-Javadoc) @@ -164,7 +154,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { @Override public void addListener(TransactionListener aListener) { this.listeners.add(aListener); - } /* (non-Javadoc) @@ -181,7 +170,6 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { @Override public void initListeners(TransactionListener[] newListeners) { this.listeners = Arrays.asList(newListeners); - } /* (non-Javadoc) @@ -200,4 +188,14 @@ public class StubCacheTransactionMananger implements CacheTransactionManager { return this.writer; } + @Override + public void setDistributed(final boolean b) { + throw new UnsupportedOperationException("Not Implemented!"); + } + + @Override + public boolean isDistributed() { + return false; + } + }