SGF-742 - Upgrade to Pivotal GemFire 9.5.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -22,7 +22,7 @@
|
||||
<antlr.version>2.7.7</antlr.version>
|
||||
<apache-shiro.version>1.3.2</apache-shiro.version>
|
||||
<cache-api.version>1.0.0</cache-api.version>
|
||||
<gemfire.version>9.4.0</gemfire.version>
|
||||
<gemfire.version>9.5.0</gemfire.version>
|
||||
<google-code-findbugs.version>2.0.2</google-code-findbugs.version>
|
||||
<multithreadedtc.version>1.01</multithreadedtc.version>
|
||||
<snappy.version>0.4</snappy.version>
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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<QueryService> queryServiceReference = new AtomicReference<QueryService>(null);
|
||||
private static final AtomicReference<QueryService> 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<String, Region> allRegions;
|
||||
private Map<String, Region> 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 <K, V> Map<String, RegionAttributes<K, V>> listRegionAttributes() {
|
||||
|
||||
Map<String, RegionAttributes<K, V>> attributes = new HashMap<>();
|
||||
|
||||
for (Entry<String, Region> 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<Region<?, ?>> rootRegions() {
|
||||
|
||||
Set<Region<?,?>> 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<DistributedMember> 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<String>() {
|
||||
@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<Index>());
|
||||
when(queryService.getIndexes()).thenReturn(new ArrayList<>());
|
||||
|
||||
when(queryService.createIndex(anyString(), anyString(),anyString())).thenAnswer(new Answer<Index>() {
|
||||
@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<Index>() {
|
||||
@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<Index>() {
|
||||
@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<Index>() {
|
||||
@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<Index>() {
|
||||
@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<String,Region> 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) { }
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user