SGF-504 - Add additional tests and polish.
This commit is contained in:
@@ -27,14 +27,15 @@ import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.data.gemfire.mapping.GemfireMappingContext;
|
||||
import org.springframework.data.gemfire.repository.support.GemfireRepositoryFactoryBean;
|
||||
import org.springframework.data.repository.config.DefaultRepositoryBaseClass;
|
||||
import org.springframework.data.gemfire.repository.support.SimpleGemfireRepository;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy;
|
||||
import org.springframework.data.repository.query.QueryLookupStrategy.Key;
|
||||
|
||||
/**
|
||||
* Annotation to enable Gemfire repositories.
|
||||
*
|
||||
*
|
||||
* @author Oliver Gierke
|
||||
* @author John Blum
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@@ -90,7 +91,7 @@ public @interface EnableGemfireRepositories {
|
||||
* Returns the postfix to be used when looking up custom repository implementations. Defaults to {@literal Impl}. So
|
||||
* for a repository named {@code PersonRepository} the corresponding implementation class will be looked up scanning
|
||||
* for {@code PersonRepositoryImpl}.
|
||||
*
|
||||
*
|
||||
* @return a String indicating the postfix to append to the Repository interface name when looking up the custom
|
||||
* Repository implementing class.
|
||||
*/
|
||||
@@ -99,7 +100,7 @@ public @interface EnableGemfireRepositories {
|
||||
/**
|
||||
* Configures the location of where to find the Spring Data named queries properties file. Will default to
|
||||
* {@code META-INFO/jpa-named-queries.properties}.
|
||||
*
|
||||
*
|
||||
* @return a String indicating the location of the name queries properties file.
|
||||
*/
|
||||
String namedQueriesLocation() default "";
|
||||
@@ -107,7 +108,7 @@ public @interface EnableGemfireRepositories {
|
||||
/**
|
||||
* Returns the key of the {@link QueryLookupStrategy} to be used for lookup queries for query methods. Defaults to
|
||||
* {@link Key#CREATE_IF_NOT_FOUND}.
|
||||
*
|
||||
*
|
||||
* @return the Key used to determine the Query lookup and creation strategy.
|
||||
*/
|
||||
Key queryLookupStrategy() default Key.CREATE_IF_NOT_FOUND;
|
||||
@@ -115,7 +116,7 @@ public @interface EnableGemfireRepositories {
|
||||
/**
|
||||
* Returns the {@link FactoryBean} class to be used for each repository instance. Defaults to
|
||||
* {@link GemfireRepositoryFactoryBean}.
|
||||
*
|
||||
*
|
||||
* @return the {@link FactoryBean} class type used for each Repository interface.
|
||||
*/
|
||||
Class<?> repositoryFactoryBeanClass() default GemfireRepositoryFactoryBean.class;
|
||||
@@ -125,12 +126,12 @@ public @interface EnableGemfireRepositories {
|
||||
*
|
||||
* @since 1.7
|
||||
*/
|
||||
Class<?> repositoryBaseClass() default DefaultRepositoryBaseClass.class;
|
||||
Class<?> repositoryBaseClass() default SimpleGemfireRepository.class;
|
||||
|
||||
/**
|
||||
* Configures the name of the {@link GemfireMappingContext} bean definition to be used to create repositories
|
||||
* discovered through this annotation. If not configured a default one will be created.
|
||||
*
|
||||
*
|
||||
* @return the bean name of the {@link org.springframework.data.mapping.context.MappingContext} used by the
|
||||
* Repository to map entities to the underlying data store.
|
||||
*/
|
||||
|
||||
@@ -46,8 +46,7 @@ public class GemfireRepositoryConfigurationExtension extends RepositoryConfigura
|
||||
|
||||
private static final String GEMFIRE_MODULE_PREFIX = "gemfire";
|
||||
private static final String MAPPING_CONTEXT_PROPERTY_NAME = "gemfireMappingContext";
|
||||
private static final String MAPPING_CONTEXT_REF_ANNOTATION_ATTRIBUTE = "mappingContextRef";
|
||||
private static final String MAPPING_CONTEXT_REF_XML_ATTRIBUTE = "mapping-context-ref";
|
||||
private static final String MAPPING_CONTEXT_REF_ATTRIBUTE_NAME = "mappingContextRef";
|
||||
|
||||
static final String DEFAULT_MAPPING_CONTEXT_BEAN_NAME = String.format("%1$s.%2$s",
|
||||
GemfireMappingContext.class.getName(), "DEFAULT");
|
||||
@@ -95,7 +94,7 @@ public class GemfireRepositoryConfigurationExtension extends RepositoryConfigura
|
||||
@Override
|
||||
public void postProcess(BeanDefinitionBuilder builder, AnnotationRepositoryConfigurationSource configurationSource) {
|
||||
builder.addPropertyReference(MAPPING_CONTEXT_PROPERTY_NAME, resolveMappingContextBeanName(
|
||||
configurationSource.getAttribute(MAPPING_CONTEXT_REF_ANNOTATION_ATTRIBUTE)));
|
||||
configurationSource.getAttribute(MAPPING_CONTEXT_REF_ATTRIBUTE_NAME)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -105,7 +104,7 @@ public class GemfireRepositoryConfigurationExtension extends RepositoryConfigura
|
||||
@Override
|
||||
public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource configurationSource) {
|
||||
builder.addPropertyReference(MAPPING_CONTEXT_PROPERTY_NAME, resolveMappingContextBeanName(
|
||||
configurationSource.getElement().getAttribute(MAPPING_CONTEXT_REF_XML_ATTRIBUTE)));
|
||||
configurationSource.getAttribute(MAPPING_CONTEXT_REF_ATTRIBUTE_NAME)));
|
||||
}
|
||||
|
||||
/* (non-Javadoc) */
|
||||
@@ -122,7 +121,7 @@ public class GemfireRepositoryConfigurationExtension extends RepositoryConfigura
|
||||
|
||||
super.registerBeansForRoot(registry, configurationSource);
|
||||
|
||||
if (!StringUtils.hasText(configurationSource.getAttribute(MAPPING_CONTEXT_REF_ANNOTATION_ATTRIBUTE))) {
|
||||
if (!StringUtils.hasText(configurationSource.getAttribute(MAPPING_CONTEXT_REF_ATTRIBUTE_NAME))) {
|
||||
registry.registerBeanDefinition(DEFAULT_MAPPING_CONTEXT_BEAN_NAME,
|
||||
new RootBeanDefinition(GemfireMappingContext.class));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user