SGF-106 - Add additional test case to test that no Indexes are created when @EnableIndexes is not present.

(cherry picked from commit add1fd9e71)
Signed-off-by: John Blum <jblum@pivotal.io>
This commit is contained in:
John Blum
2016-12-11 23:12:32 -08:00
parent ed7a1ade7b
commit aedfcdfb8e
2 changed files with 21 additions and 1 deletions

View File

@@ -16,7 +16,7 @@ servletApiVersion=2.5
slf4jVersion=1.7.21
shiroVersion=1.3.1
spring.range="[5.0.0, 6.0.0)"
springVersion=5.0.0.M3
springVersion=5.0.0.BUILD-SNAPSHOT
springDataBuildVersion=2.0.0.BUILD-SNAPSHOT
springDataCommonsVersion=2.0.0.BUILD-SNAPSHOT
springShellVersion=1.2.0.RELEASE

View File

@@ -23,6 +23,8 @@ import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Map;
import org.apache.geode.cache.Cache;
import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.RegionFactory;
@@ -102,6 +104,16 @@ public class EnableIndexesConfigurationUnitTests {
assertIndex(lastNameIdx, "LastNameIdx", "lastName", "Customers", IndexType.HASH);
}
@Test
public void noIndexesCreatedForIndexedPersistentEntities() {
applicationContext = newApplicationContext(NoIndexesCreatedForIndexedPersistentEntityConfiguration.class);
Map<String, Index> indexes = applicationContext.getBeansOfType(Index.class);
assertThat(indexes).isNotNull();
assertThat(indexes.isEmpty()).isTrue();
}
@Configuration
@SuppressWarnings("unused")
static class CacheConfiguration {
@@ -186,4 +198,12 @@ public class EnableIndexesConfigurationUnitTests {
static class IndexedPersistentEntityConfiguration extends CacheConfiguration {
}
@EnableEntityDefinedRegions(basePackageClasses = NonEntity.class,
excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {
ClientRegionEntity.class, CollocatedPartitionRegionEntity.class, GenericRegionEntity.class,
LocalRegionEntity.class, ReplicateRegionEntity.class }))
static class NoIndexesCreatedForIndexedPersistentEntityConfiguration extends CacheConfiguration {
}
}