SGF-106 - Add additional test case to test that no Indexes are created when @EnableIndexes is not present.
(cherry picked from commit add1fd9e7100e26265c9e5d0dc699b837a4ee29e) Signed-off-by: John Blum <jblum@pivotal.io>
This commit is contained in:
@@ -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