some final clean up for 3.1.0.M1
This commit is contained in:
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.gemfire;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.BeanFactoryAware;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
* Work around to ensure dependent disk stores are created before gateway senders
|
||||
*
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
public class GemfireBeanPostProcessor implements BeanPostProcessor, BeanFactoryAware {
|
||||
|
||||
private DefaultListableBeanFactory beanFactory;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessBeforeInitialization(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.config.BeanPostProcessor#postProcessAfterInitialization(java.lang.Object, java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
return bean;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.springframework.beans.factory.BeanFactoryAware#setBeanFactory(org.springframework.beans.factory.BeanFactory)
|
||||
*/
|
||||
@Override
|
||||
public void setBeanFactory(BeanFactory beanFactory) throws BeansException {
|
||||
this.beanFactory = (DefaultListableBeanFactory)beanFactory;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,8 +24,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.gemstone.gemfire.cache.RegionService;
|
||||
import com.gemstone.gemfire.cache.client.Pool;
|
||||
import com.gemstone.gemfire.cache.client.PoolManager;
|
||||
import com.gemstone.gemfire.cache.client.ClientCache;
|
||||
import com.gemstone.gemfire.cache.query.Index;
|
||||
import com.gemstone.gemfire.cache.query.IndexExistsException;
|
||||
import com.gemstone.gemfire.cache.query.QueryService;
|
||||
@@ -34,12 +33,12 @@ import com.gemstone.gemfire.cache.query.QueryService;
|
||||
* Factory bean for easy declarative creation of GemFire Indexes.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author David Turanski
|
||||
*/
|
||||
public class IndexFactoryBean implements InitializingBean, BeanNameAware, FactoryBean<Index> {
|
||||
|
||||
private Index index;
|
||||
private QueryService queryService;
|
||||
private String poolName;
|
||||
private RegionService cache;
|
||||
private String beanName;
|
||||
private String name;
|
||||
@@ -52,16 +51,12 @@ public class IndexFactoryBean implements InitializingBean, BeanNameAware, Factor
|
||||
public void afterPropertiesSet() throws Exception {
|
||||
if (queryService == null) {
|
||||
if (cache != null) {
|
||||
Assert.isTrue(!ClientCache.class.isAssignableFrom(cache.getClass()),
|
||||
"You cannot create an index from a client cache");
|
||||
queryService = cache.getQueryService();
|
||||
}
|
||||
}
|
||||
|
||||
if (queryService != null && StringUtils.hasText(poolName)) {
|
||||
Pool pool = PoolManager.find(poolName);
|
||||
Assert.notNull(pool, "No pool named [" + poolName + "] found");
|
||||
queryService = pool.getQueryService();
|
||||
}
|
||||
|
||||
Assert.notNull(queryService, "Query service required for index creation");
|
||||
Assert.hasText(expression, "Index expression is required");
|
||||
Assert.hasText(from, "Index from clause (regionPath) is required");
|
||||
@@ -82,7 +77,7 @@ public class IndexFactoryBean implements InitializingBean, BeanNameAware, Factor
|
||||
private Index createIndex(QueryService queryService, String indexName) throws Exception {
|
||||
|
||||
Index existingIndex = null;
|
||||
|
||||
|
||||
for (Index idx : queryService.getIndexes()) {
|
||||
if (idx.getName().equals(indexName)) {
|
||||
existingIndex = idx;
|
||||
@@ -154,7 +149,7 @@ public class IndexFactoryBean implements InitializingBean, BeanNameAware, Factor
|
||||
* @param cache cache used for creating indexes.
|
||||
*/
|
||||
public void setCache(RegionService cache) {
|
||||
this.queryService = cache.getQueryService();
|
||||
this.cache = cache;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -166,15 +161,6 @@ public class IndexFactoryBean implements InitializingBean, BeanNameAware, Factor
|
||||
this.queryService = service;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the beanName of the {@link Pool} used for used for creating indexes.
|
||||
*
|
||||
* @param poolName the beanName of the pool used for creating indexes.
|
||||
*/
|
||||
public void setPoolName(String poolName) {
|
||||
this.poolName = poolName;
|
||||
}
|
||||
|
||||
public void setBeanName(String name) {
|
||||
this.beanName = name;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.data.gemfire.function.execution.GemfireFunctionOperations;
|
||||
import org.springframework.data.gemfire.function.execution.GemfireOnServersFunctionTemplate;
|
||||
import org.springframework.data.gemfire.repository.support.ListRegionsOnServerFunction;
|
||||
import org.springframework.data.gemfire.support.ListRegionsOnServerFunction;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
@@ -42,7 +42,7 @@ class ClientCacheParser extends CacheParser {
|
||||
|
||||
@Override
|
||||
protected void postProcessDynamicRegionSupport(Element element, BeanDefinitionBuilder dynamicRegionSupport) {
|
||||
ParsingUtils.setPropertyValue(element, dynamicRegionSupport, "pool-name");
|
||||
ParsingUtils.setPropertyValue(element, dynamicRegionSupport, "pool-name");
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,17 +13,13 @@
|
||||
package org.springframework.data.gemfire.function;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.util.ObjectUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.gemstone.gemfire.cache.execute.Function;
|
||||
import com.gemstone.gemfire.cache.execute.FunctionContext;
|
||||
import com.gemstone.gemfire.cache.execute.ResultSender;
|
||||
|
||||
@@ -25,7 +25,6 @@ import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
|
||||
import com.gemstone.gemfire.cache.execute.FunctionException;
|
||||
import com.gemstone.gemfire.cache.execute.FunctionService;
|
||||
|
||||
/**
|
||||
@@ -120,31 +119,4 @@ public class GemfireFunctionProxyFactoryBean implements FactoryBean<Object>, Met
|
||||
this.serviceProxy = proxyFactory.getProxy(this.beanClassLoader);
|
||||
this.initialized = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Match the result to the declared return type
|
||||
*/
|
||||
private Object extractResult(Iterable<?> results, Class<?> returnType) {
|
||||
Object result = null;
|
||||
if (results != null) {
|
||||
if (Iterable.class.isAssignableFrom(returnType)) {
|
||||
result = results;
|
||||
} else {
|
||||
int nonNullItems = 0;
|
||||
for (Object obj : results) {
|
||||
if (obj != null) {
|
||||
if (++nonNullItems > 1) {
|
||||
throw new FunctionException("multiple results found for single valued return type");
|
||||
} else {
|
||||
result = obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("returning result as " + result.getClass().getName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ package org.springframework.data.gemfire.function.execution;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.gemstone.gemfire.cache.client.ClientCache;
|
||||
import com.gemstone.gemfire.cache.client.Pool;
|
||||
import com.gemstone.gemfire.cache.client.PoolManager;
|
||||
import com.gemstone.gemfire.cache.execute.Execution;
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.springframework.data.gemfire.listener.adapter.ContinuousQueryListener
|
||||
* @author Costin Leau
|
||||
* @see ContinuousQueryListenerAdapter
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class GemfireListenerExecutionFailedException extends InvalidDataAccessApiUsageException {
|
||||
|
||||
/**
|
||||
|
||||
@@ -52,14 +52,4 @@ public class GemfirePersistentProperty extends AnnotationBasedPersistentProperty
|
||||
protected Association<GemfirePersistentProperty> createAssociation() {
|
||||
return new Association<GemfirePersistentProperty>(this, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAssociation() {
|
||||
return field.isAnnotationPresent(RegionRef.class) || super.isAssociation();
|
||||
}
|
||||
|
||||
public RegionRef geRegionRef() {
|
||||
return getField().getAnnotation(RegionRef.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.gemfire.mapping;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
import org.springframework.data.annotation.Reference;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
@Documented
|
||||
@Reference
|
||||
public @interface RegionRef {
|
||||
String value() default "";
|
||||
}
|
||||
@@ -43,7 +43,6 @@ public class Regions implements Iterable<Region<?, ?>> {
|
||||
* @param regions must not be {@literal null}.
|
||||
* @param context must not be {@literal null}.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public Regions(Iterable<Region<?, ?>> regions, MappingContext<? extends GemfirePersistentEntity<?>, ?> context) {
|
||||
|
||||
Assert.notNull(regions);
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
|
||||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations under the License.
|
||||
*/
|
||||
package org.springframework.data.gemfire.repository.support;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.CacheFactory;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.cache.execute.Function;
|
||||
import com.gemstone.gemfire.cache.execute.FunctionContext;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class ListRegionsOnServerFunction implements Function {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.execute.Function#hasResult()
|
||||
*/
|
||||
@Override
|
||||
public boolean hasResult() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.execute.Function#execute(com.gemstone.gemfire.cache.execute.FunctionContext)
|
||||
*/
|
||||
@Override
|
||||
public void execute(FunctionContext context) {
|
||||
Cache cache = CacheFactory.getAnyInstance();
|
||||
List<String> regionNames = new ArrayList<String>();
|
||||
for (Region<?,?> region: cache.rootRegions()) {
|
||||
regionNames.add(region.getName());
|
||||
}
|
||||
context.getResultSender().lastResult(regionNames);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.execute.Function#getId()
|
||||
*/
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.getClass().getName();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.execute.Function#optimizeForWrite()
|
||||
*/
|
||||
@Override
|
||||
public boolean optimizeForWrite() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.execute.Function#isHA()
|
||||
*/
|
||||
@Override
|
||||
public boolean isHA() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,7 +12,8 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@@ -33,7 +34,6 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.DataPolicy;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.cache.client.ClientCache;
|
||||
import com.gemstone.gemfire.cache.client.Pool;
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,10 +12,7 @@
|
||||
*/
|
||||
package org.springframework.data.gemfire.client;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
@@ -25,16 +22,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.data.gemfire.ForkUtil;
|
||||
import org.springframework.data.gemfire.fork.SpringCacheServerProcess;
|
||||
import org.springframework.data.gemfire.repository.sample.Person;
|
||||
import org.springframework.data.gemfire.repository.sample.PersonRepository;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
import com.gemstone.gemfire.cache.DataPolicy;
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
import com.gemstone.gemfire.cache.client.ClientCache;
|
||||
import com.gemstone.gemfire.cache.client.Pool;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
|
||||
@@ -14,7 +14,6 @@ package org.springframework.data.gemfire.config;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertSame;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
@@ -82,6 +82,7 @@ public class FunctionCacheServerProcess {
|
||||
bufferedReader.readLine();
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
static class ServerFunction extends FunctionAdapter {
|
||||
|
||||
/* (non-Javadoc)
|
||||
@@ -104,6 +105,7 @@ public class FunctionCacheServerProcess {
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
static class EchoFunction extends FunctionAdapter {
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -63,12 +63,6 @@ public class ListenerContainerTests {
|
||||
ClientCacheFactory ccf = new ClientCacheFactory(props);
|
||||
ccf.setPoolSubscriptionEnabled(true);
|
||||
cache = ccf.create();
|
||||
|
||||
// not really used but here just for future tests :)
|
||||
// PoolFactory pf = PoolManager.createFactory();
|
||||
// pf.addServer("localhost", 40404);
|
||||
// pf.setSubscriptionEnabled(true);
|
||||
// Pool pool = pf.create("client");
|
||||
}
|
||||
|
||||
|
||||
@@ -94,7 +88,6 @@ public class ListenerContainerTests {
|
||||
|
||||
container = new ContinuousQueryListenerContainer();
|
||||
container.setCache(cache);
|
||||
//container.setPoolName("client");
|
||||
container.setBeanName("container");
|
||||
container.afterPropertiesSet();
|
||||
container.addListener(new ContinuousQueryDefinition("test", query, adapter));
|
||||
|
||||
@@ -63,6 +63,7 @@ public class ContainerXmlSetupTest {
|
||||
assertEquals(3, cqs.length);
|
||||
assertEquals(3, pcqs.length);
|
||||
ForkUtil.sendSignal();
|
||||
Thread.sleep(3000);
|
||||
ctx.close();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.RegionFactoryBean;
|
||||
import org.springframework.data.gemfire.test.StubCache;
|
||||
|
||||
|
||||
@@ -28,10 +28,12 @@ import org.springframework.data.gemfire.GemfireTemplate;
|
||||
*/
|
||||
public class GemfireDaoSupportTests extends TestCase {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void testGemfireDaoSupportWithTemplate() throws Exception {
|
||||
GemfireTemplate template = new GemfireTemplate();
|
||||
final List test = new ArrayList();
|
||||
GemfireDaoSupport dao = new GemfireDaoSupport() {
|
||||
@SuppressWarnings("unchecked")
|
||||
protected void initDao() {
|
||||
test.add("test");
|
||||
}
|
||||
|
||||
@@ -20,8 +20,6 @@ import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
import org.springframework.data.gemfire.server.CacheServerFactoryBean;
|
||||
|
||||
import com.gemstone.gemfire.cache.Cache;
|
||||
|
||||
/**
|
||||
* @author David Turanski
|
||||
*
|
||||
|
||||
@@ -14,10 +14,8 @@ package org.springframework.data.gemfire.test;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.springframework.data.gemfire.CacheFactoryBean;
|
||||
import org.springframework.data.gemfire.client.ClientCacheFactoryBean;
|
||||
|
||||
import com.gemstone.gemfire.cache.CacheFactory;
|
||||
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
|
||||
|
||||
/**
|
||||
|
||||
@@ -485,11 +485,12 @@ public class MockRegionFactory<K,V> {
|
||||
return regionFactory;
|
||||
}
|
||||
|
||||
RegionFactory createRegionFactory() {
|
||||
@SuppressWarnings("rawtypes")
|
||||
RegionFactory createRegionFactory() {
|
||||
return createMockRegionFactory();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public Region mockRegion(String name) {
|
||||
RegionService regionService = mockRegionService();
|
||||
Region region = mock(Region.class);
|
||||
@@ -527,7 +528,6 @@ public class MockRegionFactory<K,V> {
|
||||
|
||||
when(region.createSubregion(anyString(),any(RegionAttributes.class))).thenAnswer(new Answer<Region>() {
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
@Override
|
||||
public Region answer(InvocationOnMock invocation) throws Throwable {
|
||||
String name = (String)invocation.getArguments()[0];
|
||||
|
||||
@@ -17,7 +17,6 @@ package org.springframework.data.gemfire.test;
|
||||
*
|
||||
*/
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.*;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.gemstone.gemfire.cache.Region;
|
||||
|
||||
@@ -247,6 +247,7 @@ public class StubCache implements Cache {
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.GemFireCache#getRegionAttributes(java.lang.String)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <K, V> RegionAttributes<K, V> getRegionAttributes(String region) {
|
||||
return allRegions().get(region).getAttributes();
|
||||
@@ -271,6 +272,7 @@ public class StubCache implements Cache {
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.GemFireCache#listRegionAttributes()
|
||||
*/
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
public <K, V> Map<String, RegionAttributes<K, V>> listRegionAttributes() {
|
||||
Map<String, RegionAttributes<K, V>> attributes = new HashMap<String, RegionAttributes<K, V>>();
|
||||
@@ -355,6 +357,7 @@ public class StubCache implements Cache {
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.RegionService#getRegion(java.lang.String)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <K, V> Region<K, V> getRegion(String name) {
|
||||
return allRegions().get(name);
|
||||
@@ -466,6 +469,7 @@ public class StubCache implements Cache {
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.Cache#createRegionFactory(com.gemstone.gemfire.cache.RegionShortcut)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <K, V> RegionFactory<K, V> createRegionFactory(RegionShortcut shortCut) {
|
||||
RegionFactory<K, V> regionFactory = new MockRegionFactory<K,V>(this).createRegionFactory();
|
||||
@@ -475,6 +479,7 @@ public class StubCache implements Cache {
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.Cache#createRegionFactory(java.lang.String)
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public <K, V> RegionFactory<K, V> createRegionFactory(String arg0) {
|
||||
RegionFactory<K, V> regionFactory = new MockRegionFactory<K,V>(this).createRegionFactory();
|
||||
@@ -635,6 +640,7 @@ public class StubCache implements Cache {
|
||||
/* (non-Javadoc)
|
||||
* @see com.gemstone.gemfire.cache.Cache#getMembers(com.gemstone.gemfire.cache.Region)
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
@Override
|
||||
public Set<DistributedMember> getMembers(Region arg0) {
|
||||
throw new UnsupportedOperationException();
|
||||
@@ -859,6 +865,7 @@ public class StubCache implements Cache {
|
||||
return qs;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
Index mockIndex(String indexName, IndexType indexType,String indexedExpression, String fromClause, String imports){
|
||||
Index idx = mock(Index.class);
|
||||
when(idx.getFromClause()).thenReturn(fromClause);
|
||||
@@ -876,6 +883,7 @@ public class StubCache implements Cache {
|
||||
return idx;
|
||||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public Map<String,Region> allRegions() {
|
||||
return this.allRegions;
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ public class StubCacheServer implements CacheServer {
|
||||
*/
|
||||
@Override
|
||||
public void setLoadProbe(ServerLoadProbe loadProbe) {
|
||||
this.serverLoadProbe = serverLoadProbe;
|
||||
this.serverLoadProbe = loadProbe;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
Reference in New Issue
Block a user