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:
@@ -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
|
||||
|
||||
@@ -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 {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user