You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ag...@apache.org on 2016/05/17 00:38:40 UTC
[31/50] [abbrv] incubator-geode git commit: GEODE-11: Tests of
indexes on regions with overflow, eviction, expiration
GEODE-11: Tests of indexes on regions with overflow,eviction,expiration
Adding integration tests of indexes on these types of regions.
Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/77ff2577
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/77ff2577
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/77ff2577
Branch: refs/heads/feature/GEODE-1209
Commit: 77ff2577efd06b9dd9e6bb86fc3098343f34a451
Parents: f740181
Author: Dan Smith <up...@apache.org>
Authored: Wed May 11 17:51:12 2016 -0700
Committer: Anil <ag...@pivotal.io>
Committed: Mon May 16 17:31:55 2016 -0700
----------------------------------------------------------------------
.../LuceneIndexCreationIntegrationTest.java | 75 +++++++++++++++++---
1 file changed, 67 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/77ff2577/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
index 1dfaf51..2d16e32 100644
--- a/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
+++ b/geode-lucene/src/test/java/com/gemstone/gemfire/cache/lucene/LuceneIndexCreationIntegrationTest.java
@@ -29,7 +29,10 @@ import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
+import java.util.function.Function;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache.lucene.LuceneIndex;
@@ -74,26 +77,82 @@ public class LuceneIndexCreationIntegrationTest extends LuceneIntegrationTest {
}
@Test
- public void verifyLuceneRegionInternal() {
+ public void shouldUseRedundancyForInternalRegionsWhenUserRegionHasRedundancy() {
+ createIndex("text");
+ cache.createRegionFactory(RegionShortcut.PARTITION_REDUNDANT).create(REGION_NAME);
+ verifyInternalRegions(region -> {
+ assertEquals(1, region.getAttributes().getPartitionAttributes().getRedundantCopies());
+ });
+ }
+
+ @Test
+ public void shouldNotUseEvictionForInternalRegionsWhenUserRegionHasEviction() {
+ createIndex("text");
+ cache.createRegionFactory(RegionShortcut.PARTITION)
+ .setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(1))
+ .create(REGION_NAME);
+
+ verifyInternalRegions(region -> {
+ assertEquals(true, region.getAttributes().getEvictionAttributes().getAction().isNone());
+ });
+ }
+
+ @Test
+ public void shouldNotUseIdleTimeoutForInternalRegionsWhenUserRegionHasIdleTimeout() {
+ createIndex("text");
+ cache.createRegionFactory(RegionShortcut.PARTITION)
+ .setEntryIdleTimeout(new ExpirationAttributes(5))
+ .create(REGION_NAME);
+
+ verifyInternalRegions(region -> {
+ assertEquals(0, region.getAttributes().getEntryIdleTimeout().getTimeout());
+ });
+ }
+
+ @Test
+ public void shouldNotUseTTLForInternalRegionsWhenUserRegionHasTTL() {
+ createIndex("text");
+ cache.createRegionFactory(RegionShortcut.PARTITION)
+ .setEntryTimeToLive(new ExpirationAttributes(5))
+ .create(REGION_NAME);
+
+ verifyInternalRegions(region -> {
+ assertEquals(0, region.getAttributes().getEntryTimeToLive().getTimeout());
+ });
+ }
+
+ @Test
+ public void shouldNotUseOverflowForInternalRegionsWhenUserRegionHasOverflow() {
+ createIndex("text");
+ cache.createRegionFactory(RegionShortcut.PARTITION_OVERFLOW).create(REGION_NAME);
+ verifyInternalRegions(region -> {
+ assertTrue(region.getAttributes().getEvictionAttributes().getAction().isNone());
+ });
+ }
+
+ @Test
+ public void shouldCreateInternalRegionsForIndex() {
createIndex("text");
// Create partitioned region
createRegion();
+ verifyInternalRegions(region -> {
+ region.isInternalRegion();
+ cache.rootRegions().contains(region);
+ });
+ }
+
+ private void verifyInternalRegions(Consumer<LocalRegion> verify) {
// Get index
LuceneIndexForPartitionedRegion index = (LuceneIndexForPartitionedRegion) luceneService.getIndex(INDEX_NAME, REGION_NAME);
// Verify the meta regions exist and are internal
LocalRegion chunkRegion = (LocalRegion) cache.getRegion(index.createChunkRegionName());
- assertTrue(chunkRegion.isInternalRegion());
LocalRegion fileRegion = (LocalRegion) cache.getRegion(index.createFileRegionName());
- assertTrue(fileRegion.isInternalRegion());
+ verify.accept(chunkRegion);
+ verify.accept(fileRegion);
- // Verify the meta regions are not contained in the root regions
- for (Region region : cache.rootRegions()) {
- assertNotEquals(chunkRegion.getFullPath(), region.getFullPath());
- assertNotEquals(fileRegion.getFullPath(), region.getFullPath());
- }
}
private Region createRegion() {