[
https://issues.apache.org/jira/browse/GEODE-2635?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=15902230#comment-15902230
]
ASF GitHub Bot commented on GEODE-2635:
---
Github user upthewaterspout commented on a diff in the pull request:
https://github.com/apache/geode/pull/420#discussion_r105061375
--- Diff:
geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
---
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
contributor license
+ * agreements. See the NOTICE file distributed with this work for
additional information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
ANY KIND, either express
+ * or implied. See the License for the specific language governing
permissions and limitations under
+ * the License.
+ */
+package org.apache.geode.cache.lucene;
+
+import static
org.apache.geode.cache.lucene.test.LuceneTestUtilities.INDEX_NAME;
+import static
org.apache.geode.cache.lucene.test.LuceneTestUtilities.REGION_NAME;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.Region;
+import org.apache.geode.distributed.internal.DistributionConfig;
+import org.apache.geode.internal.cache.GemFireCacheImpl;
+import org.apache.geode.internal.cache.PartitionedRegion;
+import org.apache.geode.internal.cache.control.HeapMemoryMonitor;
+import org.apache.geode.test.dunit.SerializableRunnableIF;
+import org.apache.geode.test.junit.categories.DistributedTest;
+import org.awaitility.Awaitility;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.IntStream;
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+
+
+@Category(DistributedTest.class)
+@RunWith(JUnitParamsRunner.class)
+public class EvictionDUnitTest extends LuceneQueriesAccessorBase {
+
+ protected final static float INITIAL_EVICTION_HEAP_PERCENTAGE = 50.9f;
+ protected final static float EVICTION_HEAP_PERCENTAGE_FAKE_NOTIFICATION
= 85.0f;
+ protected final static int TEST_MAX_MEMORY = 100;
+ protected final static int MEMORY_USED_FAKE_NOTIFICATION = 90;
+
+ protected RegionTestableType[]
getPartitionRedundantOverflowEvictionRegionType() {
+return new RegionTestableType[]
{RegionTestableType.PARTITION_REDUNDANT_EVICTION_OVERFLOW,
+
RegionTestableType.PARTITION_PERSISTENT_REDUNDANT_EVICTION_OVERFLOW};
+ }
+
+ protected RegionTestableType[]
getPartitionRedundantLocalDestroyEvictionRegionType() {
+return new RegionTestableType[]
{RegionTestableType.PARTITION_REDUNDANT_EVICTION_LOCAL_DESTROY};
+ }
+
+ @Test
+ @Parameters(method =
"getPartitionRedundantLocalDestroyEvictionRegionType")
+ public void
regionWithEvictionWithLocalDestroyMustNotbeAbleToCreateLuceneIndexes(
+ RegionTestableType regionTestType) {
+SerializableRunnableIF createIndex = () -> {
+ LuceneService luceneService = LuceneServiceProvider.get(getCache());
+ luceneService.createIndex(INDEX_NAME, REGION_NAME, "text");
+};
+
+dataStore1.invoke(() -> {
+ try {
+initDataStore(createIndex, regionTestType);
+ } catch (UnsupportedOperationException e) {
+assertEquals(
+"Lucene indexes on regions with eviction and action local
destroy are not supported",
+e.getMessage());
+assertNull(getCache().getRegion(REGION_NAME));
+ }
+});
+
+ }
+
+ @Test
+ @Parameters(method = "getPartitionRedundantOverflowEvictionRegionType")
+ public void
regionsWithEvictionWithOverflowMustBeAbleToCreateLuceneIndexes(
+ RegionTestableType regionTestType) {
+SerializableRunnableIF createIndex = () -> {
+ LuceneService luceneService = LuceneServiceProvider.get(getCache());
+ luceneService.createIndex(INDEX_NAME, REGION_NAME, "text");
+};
+
+dataStore1.invoke(() -> initDataStore(createIndex, regionTestType));
+
+