SGF-576 - Adapt API in GemfireRepositoryFactoryBean.

Related ticket: DATACMNS-891.
This commit is contained in:
Oliver Gierke
2016-12-15 21:56:34 +01:00
parent add1fd9e71
commit aaa925e263
3 changed files with 17 additions and 10 deletions

View File

@@ -58,6 +58,15 @@ public class GemfireRepositoryFactoryBean<T extends Repository<S, ID>, S, ID ext
private MappingContext<? extends GemfirePersistentEntity<?>, GemfirePersistentProperty> mappingContext;
/**
* Creates a new {@link GemfireRepositoryFactoryBean} for the given repository interface.
*
* @param repositoryInterface must not be {@literal null}.
*/
public GemfireRepositoryFactoryBean(Class<? extends T> repositoryInterface) {
super(repositoryInterface);
}
/**
* Sets a reference to the Spring {@link ApplicationContext} in which this object runs.
*

View File

@@ -54,7 +54,7 @@ public class GemfireRepositoryFactoryBeanTest {
@Before
public void setup() {
repositoryFactoryBean = new GemfireRepositoryFactoryBean();
repositoryFactoryBean = new GemfireRepositoryFactoryBean(PersonRepository.class);
}
@Test
@@ -81,7 +81,6 @@ public class GemfireRepositoryFactoryBeanTest {
doReturn(Collections.singletonMap("simple", region)).when(applicationContext).getBeansOfType(Region.class);
repositoryFactoryBean.setApplicationContext(applicationContext);
repositoryFactoryBean.setRepositoryInterface(PersonRepository.class);
repositoryFactoryBean.setGemfireMappingContext(new GemfireMappingContext());
repositoryFactoryBean.afterPropertiesSet();

View File

@@ -17,7 +17,11 @@
package org.springframework.data.gemfire.support;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.*;
import lombok.Data;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import java.io.Serializable;
import java.util.List;
@@ -26,8 +30,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import javax.annotation.Resource;
import com.gemstone.gemfire.cache.GemFireCache;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -52,9 +54,7 @@ import org.springframework.stereotype.Service;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import lombok.Data;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import com.gemstone.gemfire.cache.GemFireCache;
/**
* Integration tests testing the contractual behavior and combination of using Spring'a {@link CachePut} annotation
@@ -183,10 +183,9 @@ public class CompoundCachePutCacheEvictIntegrationTests {
@Bean
GemfireRepositoryFactoryBean<PersonRepository, Person, Long> personRepository() {
GemfireRepositoryFactoryBean<PersonRepository, Person, Long> personRepository =
new GemfireRepositoryFactoryBean<PersonRepository, Person, Long>();
new GemfireRepositoryFactoryBean<PersonRepository, Person, Long>(PersonRepository.class);
personRepository.setGemfireMappingContext(new GemfireMappingContext());
personRepository.setRepositoryInterface(PersonRepository.class);
return personRepository;
}