From cd92d4b373a46cf1ee91ddb30b01a2b285703107 Mon Sep 17 00:00:00 2001 From: John Blum Date: Fri, 10 Mar 2017 11:18:08 -0800 Subject: [PATCH] SGF-602 - Rename @EnableIndexes to @EnableIndexing. --- ...EnableIndexes.java => EnableIndexing.java} | 6 +-- .../config/annotation/IndexConfiguration.java | 52 +++++++++---------- ...EnableIndexingConfigurationUnitTests.java} | 12 ++--- .../gemfire/util/SpringUtilsUnitTests.java | 2 +- 4 files changed, 36 insertions(+), 36 deletions(-) rename src/main/java/org/springframework/data/gemfire/config/annotation/{EnableIndexes.java => EnableIndexing.java} (86%) rename src/test/java/org/springframework/data/gemfire/config/annotation/{EnableIndexesConfigurationUnitTests.java => EnableIndexingConfigurationUnitTests.java} (98%) diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/EnableIndexes.java b/src/main/java/org/springframework/data/gemfire/config/annotation/EnableIndexing.java similarity index 86% rename from src/main/java/org/springframework/data/gemfire/config/annotation/EnableIndexes.java rename to src/main/java/org/springframework/data/gemfire/config/annotation/EnableIndexing.java index 21f53c06..b015935c 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/EnableIndexes.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/EnableIndexing.java @@ -27,9 +27,9 @@ import java.lang.annotation.Target; import org.apache.geode.cache.query.Index; /** - * The {@link EnableIndexes} annotation marks a Spring {@link org.springframework.context.annotation.Configuration @Configuration} + * The {@link EnableIndexing} annotation marks a Spring {@link org.springframework.context.annotation.Configuration @Configuration} * annotated application class to enable the creation of GemFire/Geode Indexes based on application persistent entity - * field/property annotations, such as the {@link @Id} and @Indexed annotations. + * field/property annotations, such as the {@link @Id}, {@link @Indexed} and {@link @LuceneIndex} annotations. * * @author John Blum * @see org.springframework.data.gemfire.config.annotation.IndexConfiguration @@ -41,7 +41,7 @@ import org.apache.geode.cache.query.Index; @Inherited @Documented @SuppressWarnings({ "unused" }) -public @interface EnableIndexes { +public @interface EnableIndexing { /** * Determines whether all GemFire/Geode {@link Index Indexes} will be defined before created. diff --git a/src/main/java/org/springframework/data/gemfire/config/annotation/IndexConfiguration.java b/src/main/java/org/springframework/data/gemfire/config/annotation/IndexConfiguration.java index e74d91ed..8fa95875 100644 --- a/src/main/java/org/springframework/data/gemfire/config/annotation/IndexConfiguration.java +++ b/src/main/java/org/springframework/data/gemfire/config/annotation/IndexConfiguration.java @@ -42,7 +42,7 @@ import org.springframework.util.StringUtils; /** * The {@link IndexConfiguration} class is a Spring {@link org.springframework.context.annotation.ImportBeanDefinitionRegistrar} - * and extension of {@link EntityDefinedRegionsConfiguration} used in the {@link EnableIndexes} annotation + * and extension of {@link EntityDefinedRegionsConfiguration} used in the {@link EnableIndexing} annotation * to dynamically create GemFire/Geode {@link org.apache.geode.cache.Region} {@link Index Indexes} based on * {@link GemfirePersistentEntity} {@link GemfirePersistentProperty} annotations. * @@ -71,12 +71,12 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { * * @return the {@link Annotation} {@link Class type} that configures and creates {@link Region Region} Indexes * from application persistent entity properties. - * @see org.springframework.data.gemfire.config.annotation.EnableIndexes + * @see EnableIndexing * @see java.lang.annotation.Annotation * @see java.lang.Class */ - protected Class getEnableIndexesAnnotationType() { - return EnableIndexes.class; + protected Class getEnableIndexingAnnotationType() { + return EnableIndexing.class; } /** @@ -85,11 +85,11 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { * * @return the name of the {@link Annotation} {@link Class type} that configures and creates {@link Region Region} * Indexes from application persistent entity properties. - * @see #getEnableIndexesAnnotationType() + * @see #getEnableIndexingAnnotationType() * @see java.lang.Class#getName() */ - protected String getEnableIndexesAnnotationTypeName() { - return getEnableIndexesAnnotationType().getName(); + protected String getEnableIndexingAnnotationTypeName() { + return getEnableIndexingAnnotationType().getName(); } /** @@ -98,12 +98,12 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { * * @return the simple name of the {@link Annotation} {@link Class type} that configures and creates * {@link Region Region} Indexes from application persistent entity properties. - * @see #getEnableIndexesAnnotationType() + * @see #getEnableIndexingAnnotationType() * @see java.lang.Class#getSimpleName() */ @SuppressWarnings("unused") - protected String getEnableIndexesAnnotationTypeSimpleName() { - return getEnableIndexesAnnotationType().getSimpleName(); + protected String getEnableIndexingAnnotationTypeSimpleName() { + return getEnableIndexingAnnotationType().getSimpleName(); } /** @@ -116,21 +116,21 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { GemfirePersistentEntity localPersistentEntity = super.postProcess(importingClassMetadata, registry, persistentEntity); - if (isAnnotationPresent(importingClassMetadata, getEnableIndexesAnnotationTypeName())) { - AnnotationAttributes enableIndexesAttributes = - getAnnotationAttributes(importingClassMetadata, getEnableIndexesAnnotationTypeName()); + if (isAnnotationPresent(importingClassMetadata, getEnableIndexingAnnotationTypeName())) { + AnnotationAttributes enableIndexingAttributes = + getAnnotationAttributes(importingClassMetadata, getEnableIndexingAnnotationTypeName()); localPersistentEntity.doWithProperties((PropertyHandler) persistentProperty -> { Optional.ofNullable(persistentProperty.findAnnotation(Id.class)).ifPresent(idAnnotation -> - registerIndexBeanDefinition(enableIndexesAttributes, localPersistentEntity, persistentProperty, + registerIndexBeanDefinition(enableIndexingAttributes, localPersistentEntity, persistentProperty, IndexType.KEY, idAnnotation, registry)); Optional.ofNullable(persistentProperty.findAnnotation(Indexed.class)).ifPresent(indexedAnnotation -> - registerIndexBeanDefinition(enableIndexesAttributes, localPersistentEntity, persistentProperty, + registerIndexBeanDefinition(enableIndexingAttributes, localPersistentEntity, persistentProperty, indexedAnnotation.type(), indexedAnnotation, registry)); Optional.ofNullable(persistentProperty.findAnnotation(LuceneIndexed.class)).ifPresent( - luceneIndexAnnotation -> registerLuceneIndexBeanDefinition(enableIndexesAttributes, + luceneIndexAnnotation -> registerLuceneIndexBeanDefinition(enableIndexingAttributes, localPersistentEntity, persistentProperty, luceneIndexAnnotation, registry)); }); } @@ -142,8 +142,8 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { * Registers an Index of the given {@link IndexType} for the {@link GemfirePersistentProperty} * on the {@link GemfirePersistentEntity} using the {@link Annotation} meta-data to define the Index. * - * @param enableIndexesAttributes {@link AnnotationAttributes} containing meta-data - * for the {@link EnableIndexes} annotation. + * @param enableIndexingAttributes {@link AnnotationAttributes} containing meta-data + * for the {@link EnableIndexing} annotation. * @param persistentEntity {@link GemfirePersistentEntity} containing the {@link GemfirePersistentProperty} * to be indexed. * @param persistentProperty {@link GemfirePersistentProperty} for which the Index will be created. @@ -157,7 +157,7 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { * @see org.springframework.data.gemfire.mapping.GemfirePersistentEntity * @see org.springframework.data.gemfire.mapping.GemfirePersistentProperty */ - protected void registerIndexBeanDefinition(AnnotationAttributes enableIndexesAttributes, + protected void registerIndexBeanDefinition(AnnotationAttributes enableIndexingAttributes, GemfirePersistentEntity persistentEntity, GemfirePersistentProperty persistentProperty, IndexType indexType, Annotation indexAnnotation, BeanDefinitionRegistry registry) { @@ -171,7 +171,7 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { indexFactoryBeanBuilder.addPropertyReference("cache", GemfireConstants.DEFAULT_GEMFIRE_CACHE_NAME); - indexFactoryBeanBuilder.addPropertyValue("define", resolveDefine(enableIndexesAttributes)); + indexFactoryBeanBuilder.addPropertyValue("define", resolveDefine(enableIndexingAttributes)); indexFactoryBeanBuilder.addPropertyValue("expression", resolveExpression(persistentEntity, persistentProperty, indexedAttributes)); @@ -195,8 +195,8 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { * Registers a {@link LuceneIndex} for the {@link GemfirePersistentProperty} on the {@link GemfirePersistentEntity} * using the {@link Annotation} meta-data to define the Index. * - * @param enableIndexesAttributes {@link AnnotationAttributes} containing meta-data - * for the {@link EnableIndexes} annotation. + * @param enableIndexingAttributes {@link AnnotationAttributes} containing meta-data + * for the {@link EnableIndexing} annotation. * @param persistentEntity {@link GemfirePersistentEntity} containing the {@link GemfirePersistentProperty} * to be indexed. * @param persistentProperty {@link GemfirePersistentProperty} for which the {@link LuceneIndex} will be created. @@ -210,7 +210,7 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { * @see org.springframework.data.gemfire.mapping.annotation.LuceneIndexed */ @SuppressWarnings("unused") - protected void registerLuceneIndexBeanDefinition(AnnotationAttributes enableIndexesAttributes, + protected void registerLuceneIndexBeanDefinition(AnnotationAttributes enableIndexingAttributes, GemfirePersistentEntity persistentEntity, GemfirePersistentProperty persistentProperty, Annotation luceneIndexAnnotation, BeanDefinitionRegistry registry) { @@ -239,9 +239,9 @@ public class IndexConfiguration extends EntityDefinedRegionsConfiguration { } /* (non-Javadoc) */ - private boolean resolveDefine(AnnotationAttributes enableIndexesAnnotationAttributes) { - return (enableIndexesAnnotationAttributes.containsKey("define") - && enableIndexesAnnotationAttributes.getBoolean("define")); + private boolean resolveDefine(AnnotationAttributes enableIndexingAttributes) { + return (enableIndexingAttributes.containsKey("define") + && enableIndexingAttributes.getBoolean("define")); } /* (non-Javadoc) */ diff --git a/src/test/java/org/springframework/data/gemfire/config/annotation/EnableIndexesConfigurationUnitTests.java b/src/test/java/org/springframework/data/gemfire/config/annotation/EnableIndexingConfigurationUnitTests.java similarity index 98% rename from src/test/java/org/springframework/data/gemfire/config/annotation/EnableIndexesConfigurationUnitTests.java rename to src/test/java/org/springframework/data/gemfire/config/annotation/EnableIndexingConfigurationUnitTests.java index c63dabff..82001d43 100644 --- a/src/test/java/org/springframework/data/gemfire/config/annotation/EnableIndexesConfigurationUnitTests.java +++ b/src/test/java/org/springframework/data/gemfire/config/annotation/EnableIndexingConfigurationUnitTests.java @@ -60,16 +60,16 @@ import org.springframework.data.gemfire.config.annotation.test.entities.NonEntit import org.springframework.data.gemfire.config.annotation.test.entities.ReplicateRegionEntity; /** - * Unit tests for the {@link EnableIndexes} and {@link IndexConfiguration} class. + * Unit tests for the {@link EnableIndexing} and {@link IndexConfiguration} class. * * @author John Blum * @see org.junit.Test * @see org.mockito.Mockito - * @see org.springframework.data.gemfire.config.annotation.EnableIndexes + * @see EnableIndexing * @see org.springframework.data.gemfire.config.annotation.IndexConfiguration * @since 1.9.0 */ -public class EnableIndexesConfigurationUnitTests { +public class EnableIndexingConfigurationUnitTests { private static final Set indexes = new HashSet<>(); @@ -281,7 +281,7 @@ public class EnableIndexesConfigurationUnitTests { } } - @EnableIndexes + @EnableIndexing @EnableEntityDefinedRegions(basePackageClasses = NonEntity.class, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = { ClientRegionEntity.class, CollocatedPartitionRegionEntity.class, GenericRegionEntity.class, @@ -298,7 +298,7 @@ public class EnableIndexesConfigurationUnitTests { } - @EnableIndexes + @EnableIndexing @EnableEntityDefinedRegions(basePackageClasses = NonEntity.class, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = { ClientRegionEntity.class, CollocatedPartitionRegionEntity.class, GenericRegionEntity.class, @@ -320,7 +320,7 @@ public class EnableIndexesConfigurationUnitTests { } } - @EnableIndexes + @EnableIndexing @EnableEntityDefinedRegions(basePackageClasses = NonEntity.class, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = { ClientRegionEntity.class, CollocatedPartitionRegionEntity.class, GenericRegionEntity.class, diff --git a/src/test/java/org/springframework/data/gemfire/util/SpringUtilsUnitTests.java b/src/test/java/org/springframework/data/gemfire/util/SpringUtilsUnitTests.java index a32f70c6..0ae9e2ff 100644 --- a/src/test/java/org/springframework/data/gemfire/util/SpringUtilsUnitTests.java +++ b/src/test/java/org/springframework/data/gemfire/util/SpringUtilsUnitTests.java @@ -222,7 +222,7 @@ public class SpringUtilsUnitTests { @Test public void safeGetValueReturnsNull() { - assertThat(SpringUtils.safeGetValue(() -> { throw new RuntimeException("error"); })) + assertThat(SpringUtils.safeGetValue(() -> { throw new RuntimeException("error"); }, "test")) .isEqualTo("test"); } }