Fix bugs in mock Index logic regarding (mock) Region references.
This commit is contained in:
@@ -40,10 +40,13 @@ import org.apache.geode.cache.lucene.LuceneIndex;
|
||||
import org.apache.geode.cache.lucene.LuceneIndexFactory;
|
||||
import org.apache.geode.cache.lucene.LuceneSerializer;
|
||||
import org.apache.geode.cache.lucene.LuceneService;
|
||||
import org.apache.geode.cache.query.Index;
|
||||
import org.apache.geode.cache.server.ClientSubscriptionConfig;
|
||||
|
||||
import org.apache.lucene.analysis.Analyzer;
|
||||
|
||||
import org.springframework.data.gemfire.IndexType;
|
||||
|
||||
/**
|
||||
* Unit Tests for {@link GemFireMockObjectsSupport}.
|
||||
*
|
||||
@@ -139,7 +142,32 @@ public class GemFireMockObjectsSupportUnitTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mockLuceneFunctionality() {
|
||||
public void mockIndexIsCorrect() {
|
||||
|
||||
RegionService mockRegionService = mock(RegionService.class);
|
||||
|
||||
RegionAttributes<?, ?> mockRegionAttributes = mock(RegionAttributes.class);
|
||||
|
||||
Region<?, ?> mockRegion =
|
||||
GemFireMockObjectsSupport.mockRegion(mockRegionService, "MockIndexRegion", mockRegionAttributes);
|
||||
|
||||
assertThat(mockRegion).isNotNull();
|
||||
|
||||
Index mockIndex = GemFireMockObjectsSupport
|
||||
.mockIndex("MockIndex", "*", "/MockIndexRegion alias", IndexType.FUNCTIONAL);
|
||||
|
||||
assertThat(mockIndex).isNotNull();
|
||||
assertThat(mockIndex.getName()).isEqualTo("MockIndex");
|
||||
assertThat(mockIndex.getRegion()).isNotNull();
|
||||
assertThat(mockIndex.getRegion()).isEqualTo(mockRegion);
|
||||
assertThat(mockIndex.getRegion().getName()).isEqualTo("MockIndexRegion");
|
||||
assertThat(mockIndex.getFromClause()).isEqualTo("/MockIndexRegion alias");
|
||||
assertThat(mockIndex.getIndexedExpression()).isEqualTo("*");
|
||||
assertThat(mockIndex.getType()).isEqualTo(IndexType.FUNCTIONAL.getGemfireIndexType());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mockLuceneFunctionalityIsCorrect() {
|
||||
|
||||
Cache mockCache = mock(Cache.class);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user