diff --git a/pom.xml b/pom.xml
index bf7764b7..d024fa61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@
2.7.7
1.3.2
1.0.0
- 9.4.0
+ 9.5.0
2.0.2
1.01
0.4
diff --git a/src/test/java/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest.java b/src/test/java/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest.java
index dddfb79d..a81099b2 100644
--- a/src/test/java/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest.java
+++ b/src/test/java/org/springframework/data/gemfire/LookupRegionMutationIntegrationTest.java
@@ -153,13 +153,8 @@ public class LookupRegionMutationIntegrationTest {
assertCacheListeners(example.getAttributes().getCacheListeners(), Arrays.asList("A", "B"));
assertGemFireComponent(example.getAttributes().getCacheLoader(), "C");
assertGemFireComponent(example.getAttributes().getCacheWriter(), "D");
- // TODO: re-instate the original assertion after Apache Geode fixes bug GEODE-5039!
- /*
assertEvictionAttributes(example.getAttributes().getEvictionAttributes(), EvictionAction.OVERFLOW_TO_DISK,
EvictionAlgorithm.LRU_ENTRY, 1000);
- */
- assertEvictionAttributes(example.getAttributes().getEvictionAttributes(), EvictionAction.OVERFLOW_TO_DISK,
- EvictionAlgorithm.LRU_ENTRY, 500);
assertExpirationAttributes(example.getAttributes().getRegionTimeToLive(), "Region TTL",
120, ExpirationAction.LOCAL_DESTROY);
assertExpirationAttributes(example.getAttributes().getRegionIdleTimeout(), "Region TTI",
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 6c08bfaf..334e38a0 100644
--- a/src/test/java/org/springframework/data/gemfire/test/StubCache.java
+++ b/src/test/java/org/springframework/data/gemfire/test/StubCache.java
@@ -62,13 +62,11 @@ import org.apache.geode.i18n.LogWriterI18n;
import org.apache.geode.pdx.PdxInstance;
import org.apache.geode.pdx.PdxInstanceFactory;
import org.apache.geode.pdx.PdxSerializer;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
@SuppressWarnings({ "deprecation", "unused" })
public class StubCache implements Cache, ClientCache {
- private static final AtomicReference queryServiceReference = new AtomicReference(null);
+ private static final AtomicReference queryServiceReference = new AtomicReference<>(null);
protected static final String NOT_IMPLEMENTED = "Not Implemented";
@@ -94,7 +92,7 @@ public class StubCache implements Cache, ClientCache {
private GatewayConflictResolver gatewayConflictResolver;
- private HashMap allRegions;
+ private Map rootRegions;
private LogWriter logWriter;
private LogWriter securityLogWriter;
@@ -112,7 +110,7 @@ public class StubCache implements Cache, ClientCache {
private String name;
public StubCache(){
- allRegions = new HashMap<>();
+ rootRegions = new HashMap<>();
resourceManager = new StubResourceManager();
}
@@ -138,7 +136,7 @@ public class StubCache implements Cache, ClientCache {
@Override
public CacheTransactionManager getCacheTransactionManager() {
if (cacheTransactionManager == null) {
- cacheTransactionManager = new StubCacheTransactionMananger();
+ cacheTransactionManager = new StubCacheTransactionManager();
}
return cacheTransactionManager;
@@ -276,10 +274,13 @@ public class StubCache implements Cache, ClientCache {
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public Map> listRegionAttributes() {
+
Map> attributes = new HashMap<>();
+
for (Entry entry: allRegions().entrySet()) {
attributes.put(entry.getKey(), entry.getValue().getAttributes());
}
+
return attributes;
}
@@ -376,12 +377,15 @@ public class StubCache implements Cache, ClientCache {
*/
@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;
}
@@ -393,6 +397,7 @@ public class StubCache implements Cache, ClientCache {
return mockCacheServer();
}
+
/* (non-Javadoc)
* @see org.apache.geode.cache.Cache#close(boolean)
*/
@@ -570,8 +575,8 @@ public class StubCache implements Cache, ClientCache {
}
/* (non-Javadoc)
- * @see org.apache.geode.cache.Cache#getMembers()
- */
+ * @see org.apache.geode.cache.Cache#getMembers()
+ */
@Override
public Set getMembers() {
throw new UnsupportedOperationException(NOT_IMPLEMENTED);
@@ -647,9 +652,8 @@ public class StubCache implements Cache, ClientCache {
* @see org.apache.geode.cache.Cache#setIsServer(boolean)
*/
@Override
- public void setIsServer(boolean arg0) {
- this.server = arg0;
-
+ public void setIsServer(boolean server) {
+ this.server = server;
}
/* (non-Javadoc)
@@ -685,14 +689,10 @@ public class StubCache implements Cache, ClientCache {
}
DistributedSystem mockDistributedSystem() {
+
DistributedSystem mockDistributedSystem = mock(DistributedSystem.class);
- when(mockDistributedSystem.getName()).thenAnswer(new Answer() {
- @Override
- public String answer(InvocationOnMock invocation) throws Throwable {
- return getName();
- }
- });
+ when(mockDistributedSystem.getName()).thenAnswer(invocation -> getName());
when(mockDistributedSystem.getProperties()).thenReturn(this.properties);
@@ -714,69 +714,63 @@ public class StubCache implements Cache, ClientCache {
return new StubCacheServer();
}
- QueryService mockQueryService() throws RegionNotFoundException, IndexInvalidException, IndexNameConflictException, IndexExistsException, UnsupportedOperationException {
+ QueryService mockQueryService() throws RegionNotFoundException, IndexInvalidException, IndexNameConflictException,
+ IndexExistsException, UnsupportedOperationException {
+
QueryService queryService = mock(QueryService.class);
- when(queryService.getIndexes()).thenReturn(new ArrayList());
+ when(queryService.getIndexes()).thenReturn(new ArrayList<>());
- when(queryService.createIndex(anyString(), anyString(),anyString())).thenAnswer(new Answer() {
- @Override
- public Index answer(InvocationOnMock invocation) throws Throwable {
- String indexName = (String) invocation.getArguments()[0];
- String indexedExpression = (String) invocation.getArguments()[1];
- String fromClause = (String) invocation.getArguments()[2];
- return mockIndex(indexName, org.apache.geode.cache.query.IndexType.FUNCTIONAL, indexedExpression,
- fromClause, null);
- }
+ when(queryService.createIndex(anyString(), anyString(),anyString())).thenAnswer(invocation -> {
+
+ String indexName = (String) invocation.getArguments()[0];
+ String indexedExpression = (String) invocation.getArguments()[1];
+ String fromClause = (String) invocation.getArguments()[2];
+
+ return mockIndex(indexName, org.apache.geode.cache.query.IndexType.FUNCTIONAL, indexedExpression,
+ fromClause, null);
});
- when(queryService.createIndex(anyString(), anyString(),anyString(),anyString())).thenAnswer(new Answer() {
- @Override
- public Index answer(InvocationOnMock invocation) throws Throwable {
- String indexName = (String) invocation.getArguments()[0];
- String indexedExpression = (String) invocation.getArguments()[1];
- String fromClause = (String) invocation.getArguments()[2];
- String imports = (String) invocation.getArguments()[3];
- return mockIndex(indexName, org.apache.geode.cache.query.IndexType.FUNCTIONAL, indexedExpression,
- fromClause, imports);
- }
+ when(queryService.createIndex(anyString(), anyString(),anyString(),anyString())).thenAnswer(invocation -> {
+
+ String indexName = (String) invocation.getArguments()[0];
+ String indexedExpression = (String) invocation.getArguments()[1];
+ String fromClause = (String) invocation.getArguments()[2];
+ String imports = (String) invocation.getArguments()[3];
+
+ return mockIndex(indexName, org.apache.geode.cache.query.IndexType.FUNCTIONAL, indexedExpression,
+ fromClause, imports);
});
- when(queryService.createKeyIndex(anyString(), anyString(),anyString())).thenAnswer(new Answer() {
- @Override
- public Index answer(InvocationOnMock invocation) throws Throwable {
- String indexName = (String) invocation.getArguments()[0];
- String indexedExpression = (String) invocation.getArguments()[1];
- String fromClause = (String) invocation.getArguments()[2];
+ when(queryService.createKeyIndex(anyString(), anyString(),anyString())).thenAnswer(invocation -> {
- return mockIndex(indexName, org.apache.geode.cache.query.IndexType.PRIMARY_KEY, indexedExpression,
- fromClause, null);
- }
+ String indexName = (String) invocation.getArguments()[0];
+ String indexedExpression = (String) invocation.getArguments()[1];
+ String fromClause = (String) invocation.getArguments()[2];
+
+ return mockIndex(indexName, org.apache.geode.cache.query.IndexType.PRIMARY_KEY, indexedExpression,
+ fromClause, null);
});
- when(queryService.createHashIndex(anyString(), anyString(),anyString())).thenAnswer(new Answer() {
- @Override
- public Index answer(InvocationOnMock invocation) throws Throwable {
- String indexName = (String) invocation.getArguments()[0];
- String indexedExpression = (String) invocation.getArguments()[1];
- String fromClause = (String) invocation.getArguments()[2];
+ when(queryService.createHashIndex(anyString(), anyString(),anyString())).thenAnswer(invocation -> {
- return mockIndex(indexName, org.apache.geode.cache.query.IndexType.HASH, indexedExpression,
- fromClause, null);
- }
+ String indexName = (String) invocation.getArguments()[0];
+ String indexedExpression = (String) invocation.getArguments()[1];
+ String fromClause = (String) invocation.getArguments()[2];
+
+ return mockIndex(indexName, org.apache.geode.cache.query.IndexType.HASH, indexedExpression,
+ fromClause, null);
});
- when(queryService.createHashIndex(anyString(), anyString(),anyString(),anyString())).thenAnswer(new Answer() {
- @Override
- public Index answer(InvocationOnMock invocation) throws Throwable {
- String indexName = (String) invocation.getArguments()[0];
- String indexedExpression = (String) invocation.getArguments()[1];
- String fromClause = (String) invocation.getArguments()[2];
- String imports = (String) invocation.getArguments()[3];
+ when(queryService.createHashIndex(anyString(), anyString(),anyString(),anyString())).thenAnswer(invocation -> {
- return mockIndex(indexName, org.apache.geode.cache.query.IndexType.HASH, indexedExpression,
- fromClause, imports);
- }
+ String indexName = (String) invocation.getArguments()[0];
+ String indexedExpression = (String) invocation.getArguments()[1];
+ String fromClause = (String) invocation.getArguments()[2];
+ String imports = (String) invocation.getArguments()[3];
+
+ return mockIndex(indexName, org.apache.geode.cache.query.IndexType.HASH, indexedExpression,
+ fromClause, imports);
});
return queryService;
@@ -784,7 +778,7 @@ public class StubCache implements Cache, ClientCache {
@SuppressWarnings({ "rawtypes", "unchecked", "unused" })
Index mockIndex(String indexName, org.apache.geode.cache.query.IndexType indexType, String indexedExpression,
- String fromClause, String imports){
+ String fromClause, String imports){
Index idx = mock(Index.class);
when(idx.getFromClause()).thenReturn(fromClause);
when(idx.getIndexedExpression()).thenReturn(indexedExpression);
@@ -803,7 +797,7 @@ public class StubCache implements Cache, ClientCache {
@SuppressWarnings("rawtypes")
public Map allRegions() {
- return this.allRegions;
+ return this.rootRegions;
}
public void setProperties(Properties gemfireProperties) {
@@ -829,7 +823,6 @@ public class StubCache implements Cache, ClientCache {
return false;
}
- @Override
public RegionService createAuthenticatedView(final Properties userSecurityProperties) {
return this;
}
@@ -868,4 +861,8 @@ public class StubCache implements Cache, ClientCache {
public QueryService getQueryService(final String poolName) {
return getQueryService();
}
+
+ @Override
+ public void registerPdxMetaData(Object objectToSerializeAndRegister) { }
+
}
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 97%
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 1535b744..d24763a4 100644
--- a/src/test/java/org/springframework/data/gemfire/test/StubCacheTransactionMananger.java
+++ b/src/test/java/org/springframework/data/gemfire/test/StubCacheTransactionManager.java
@@ -23,7 +23,7 @@ import org.apache.geode.cache.TransactionId;
import org.apache.geode.cache.TransactionListener;
import org.apache.geode.cache.TransactionWriter;
-public class StubCacheTransactionMananger implements CacheTransactionManager {
+public class StubCacheTransactionManager implements CacheTransactionManager {
private boolean distributed = false;