This is an automated email from the ASF dual-hosted git repository.

klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git

commit f542032fa73c483c82eef1a5ac56def5c3d499dd
Author: Kirk Lund <[email protected]>
AuthorDate: Thu Mar 22 12:40:13 2018 -0700

    GEODE-1279: Rename Bug40632DUnitTest as 
CreatePRWithLocalExpirationRegressionTest
    
    * Changed to IntegrationTest
    * Cleaned up test
---
 .../geode/internal/cache/Bug40632DUnitTest.java    | 109 ---------------------
 .../CreatePRWithLocalExpirationRegressionTest.java |  96 ++++++++++++++++++
 2 files changed, 96 insertions(+), 109 deletions(-)

diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug40632DUnitTest.java
 
b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug40632DUnitTest.java
deleted file mode 100644
index 76f46fb..0000000
--- 
a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug40632DUnitTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.internal.cache;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import org.apache.geode.cache.AttributesFactory;
-import org.apache.geode.cache.Cache;
-import org.apache.geode.cache.ExpirationAction;
-import org.apache.geode.cache.ExpirationAttributes;
-import org.apache.geode.cache.PartitionAttributes;
-import org.apache.geode.cache.PartitionAttributesFactory;
-import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class Bug40632DUnitTest extends JUnit4CacheTestCase {
-
-  @Test
-  public void testLocalDestroyIdleTimeout() throws Exception {
-    Cache cache = getCache();
-    AttributesFactory attr = new AttributesFactory();
-    PartitionAttributesFactory paf = new PartitionAttributesFactory();
-    paf.setRedundantCopies(1);
-    paf.setRecoveryDelay(-1);
-    paf.setStartupRecoveryDelay(-1);
-    PartitionAttributes prAttr = paf.create();
-    attr.setStatisticsEnabled(true);
-    attr.setEntryIdleTimeout(new ExpirationAttributes(1000, 
ExpirationAction.LOCAL_DESTROY));
-    attr.setPartitionAttributes(prAttr);
-    try {
-      cache.createRegion("region1", attr.create());
-      fail("We should not have been able to create the region");
-    } catch (IllegalStateException expected) {
-    }
-  }
-
-  @Test
-  public void testLocalDestroyTimeToLive() throws Exception {
-    Cache cache = getCache();
-    AttributesFactory attr = new AttributesFactory();
-    PartitionAttributesFactory paf = new PartitionAttributesFactory();
-    paf.setRedundantCopies(1);
-    paf.setRecoveryDelay(-1);
-    paf.setStartupRecoveryDelay(-1);
-    PartitionAttributes prAttr = paf.create();
-    attr.setStatisticsEnabled(true);
-    attr.setEntryTimeToLive(new ExpirationAttributes(1000, 
ExpirationAction.LOCAL_DESTROY));
-    attr.setPartitionAttributes(prAttr);
-    try {
-      cache.createRegion("region1", attr.create());
-      fail("We should not have been able to create the region");
-    } catch (IllegalStateException expected) {
-    }
-  }
-
-  @Test
-  public void testLocalInvalidateIdleTimeout() throws Exception {
-    Cache cache = getCache();
-    AttributesFactory attr = new AttributesFactory();
-    PartitionAttributesFactory paf = new PartitionAttributesFactory();
-    paf.setRedundantCopies(1);
-    paf.setRecoveryDelay(-1);
-    paf.setStartupRecoveryDelay(-1);
-    PartitionAttributes prAttr = paf.create();
-    attr.setStatisticsEnabled(true);
-    attr.setEntryIdleTimeout(new ExpirationAttributes(1000, 
ExpirationAction.LOCAL_INVALIDATE));
-    attr.setPartitionAttributes(prAttr);
-    try {
-      cache.createRegion("region1", attr.create());
-      fail("We should not have been able to create the region");
-    } catch (IllegalStateException expected) {
-    }
-  }
-
-  @Test
-  public void testLocalInvalidateTimeToLive() throws Exception {
-    Cache cache = getCache();
-    AttributesFactory attr = new AttributesFactory();
-    PartitionAttributesFactory paf = new PartitionAttributesFactory();
-    paf.setRedundantCopies(1);
-    paf.setRecoveryDelay(-1);
-    paf.setStartupRecoveryDelay(-1);
-    PartitionAttributes prAttr = paf.create();
-    attr.setStatisticsEnabled(true);
-    attr.setEntryTimeToLive(new ExpirationAttributes(1000, 
ExpirationAction.LOCAL_INVALIDATE));
-    attr.setPartitionAttributes(prAttr);
-    try {
-      cache.createRegion("region1", attr.create());
-      fail("We should not have been able to create the region");
-    } catch (IllegalStateException expected) {
-    }
-  }
-}
diff --git 
a/geode-core/src/test/java/org/apache/geode/internal/cache/CreatePRWithLocalExpirationRegressionTest.java
 
b/geode-core/src/test/java/org/apache/geode/internal/cache/CreatePRWithLocalExpirationRegressionTest.java
new file mode 100644
index 0000000..c88f8bf
--- /dev/null
+++ 
b/geode-core/src/test/java/org/apache/geode/internal/cache/CreatePRWithLocalExpirationRegressionTest.java
@@ -0,0 +1,96 @@
+/*
+ * 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.internal.cache;
+
+import static org.apache.geode.cache.ExpirationAction.LOCAL_DESTROY;
+import static org.apache.geode.cache.ExpirationAction.LOCAL_INVALIDATE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.ExpirationAttributes;
+import org.apache.geode.cache.PartitionAttributesFactory;
+import org.apache.geode.test.junit.categories.IntegrationTest;
+
+/**
+ * PRWithLocalExpirationRegressionTest
+ *
+ * TRAC #40632: PR expiration with localDestroy fails with InternalGemFireError
+ */
+@Category(IntegrationTest.class)
+public class CreatePRWithLocalExpirationRegressionTest {
+
+  private Cache cache;
+  private AttributesFactory attributesFactory;
+
+  @Before
+  public void setUp() {
+    cache = new CacheFactory().set(LOCATORS, "").set(MCAST_PORT, "0").create();
+
+    PartitionAttributesFactory paf = new PartitionAttributesFactory();
+    paf.setRecoveryDelay(-1);
+    paf.setRedundantCopies(1);
+    paf.setStartupRecoveryDelay(-1);
+
+    attributesFactory = new AttributesFactory();
+    attributesFactory.setPartitionAttributes(paf.create());
+    attributesFactory.setStatisticsEnabled(true);
+  }
+
+  @After
+  public void tearDown() {
+    cache.close();
+  }
+
+  @Test
+  public void createPrWithEntryIdleTimeoutLocalDestroyThrows() throws 
Exception {
+    attributesFactory.setEntryIdleTimeout(new ExpirationAttributes(1000, 
LOCAL_DESTROY));
+
+    assertThatThrownBy(() -> cache.createRegion("region1", 
attributesFactory.create()))
+        .isInstanceOf(IllegalStateException.class);
+  }
+
+  @Test
+  public void createPrWithEntryTimeToLiveLocalDestroyThrows() throws Exception 
{
+    attributesFactory.setEntryTimeToLive(new ExpirationAttributes(1000, 
LOCAL_DESTROY));
+
+    assertThatThrownBy(() -> cache.createRegion("region1", 
attributesFactory.create()))
+        .isInstanceOf(IllegalStateException.class);
+  }
+
+  @Test
+  public void createPrWithEntryIdleTimeoutLocalInvalidateThrows() throws 
Exception {
+    attributesFactory.setEntryIdleTimeout(new ExpirationAttributes(1000, 
LOCAL_INVALIDATE));
+
+    assertThatThrownBy(() -> cache.createRegion("region1", 
attributesFactory.create()))
+        .isInstanceOf(IllegalStateException.class);
+  }
+
+  @Test
+  public void createPrWithEntryTimeToLiveLocalInvalidateThrows() throws 
Exception {
+    attributesFactory.setEntryTimeToLive(new ExpirationAttributes(1000, 
LOCAL_INVALIDATE));
+
+    assertThatThrownBy(() -> cache.createRegion("region1", 
attributesFactory.create()))
+        .isInstanceOf(IllegalStateException.class);
+  }
+}

-- 
To stop receiving notification emails like this one, please contact
[email protected].

Reply via email to