You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2018/03/20 17:00:03 UTC
[geode] branch develop updated: GEODE-1279: Rename several Bug*Test
tests to have descriptive names (#1645)
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
The following commit(s) were added to refs/heads/develop by this push:
new dca52c8 GEODE-1279: Rename several Bug*Test tests to have descriptive names (#1645)
dca52c8 is described below
commit dca52c8ae11bb6211b56c9c74c33be0d4fb324f6
Author: Kirk Lund <kl...@apache.org>
AuthorDate: Tue Mar 20 09:59:59 2018 -0700
GEODE-1279: Rename several Bug*Test tests to have descriptive names (#1645)
* Bug32947ValueConstraintJUnitTest -> ConstraintRegressionTest
* BugJUnitTest -> QueryServiceRegressionTest
* Bug40255JUnitTest -> CacheXmlParameterizationRegressionTest
* Bug40662JUnitTest -> DefaultEvictionActionRegressionTest
* Bug44418JUnitTest -> ShorteningExpirationTimeRegressionTest
* Bug40751DUnitTest -> ValueToDataThrowsRuntimeExceptionRegressionTest
* Bug49856JUnitTest -> SystemFailureThreadCleanupRegressionTest
Also fixed two tests that had missing resource files:
* CacheXmlParameterizationRegressionTest
* DefaultEvictionActionRegressionTest
---
...est.java => ValueConstraintRegressionTest.java} | 19 +-
...itTest.java => QueryServiceRegressionTest.java} | 264 +++++++++++++--------
...=> CacheXmlParameterizationRegressionTest.java} | 78 +++---
...va => DefaultEvictionActionRegressionTest.java} | 75 +++---
...=> ShorteningExpirationTimeRegressionTest.java} | 112 +++++----
...oDataThrowsRuntimeExceptionRegressionTest.java} | 28 ++-
... SystemFailureThreadCleanupRegressionTest.java} | 11 +-
...onCreateBeforeInitializationRegressionTest.java | 135 +++++++++++
.../geode/internal/cache/Bug33359DUnitTest.java | 153 ------------
.../geode/internal/cache/Bug33726DUnitTest.java | 156 ------------
.../geode/internal/cache/Bug33726JUnitTest.java | 27 +--
.../ClearRegionMessageAssertionRegressionTest.java | 121 ++++++++++
...acheXmlParameterizationRegressionTest_cache.xml | 42 ++++
...rameterizationRegressionTest_gemfire.properties | 19 ++
.../DefaultEvictionActionRegressionTest_cache.xml | 29 +++
15 files changed, 688 insertions(+), 581 deletions(-)
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/Bug32947ValueConstraintJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/ValueConstraintRegressionTest.java
similarity index 86%
rename from geode-core/src/test/java/org/apache/geode/cache/query/Bug32947ValueConstraintJUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/cache/ValueConstraintRegressionTest.java
index c52715e..76937ea 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/Bug32947ValueConstraintJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/ValueConstraintRegressionTest.java
@@ -12,7 +12,7 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-package org.apache.geode.cache.query;
+package org.apache.geode.cache;
import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
import static org.junit.Assert.fail;
@@ -26,11 +26,6 @@ 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.Region;
-import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.query.data.Address;
import org.apache.geode.cache.query.data.Data;
import org.apache.geode.cache.query.data.Employee;
@@ -38,13 +33,15 @@ import org.apache.geode.cache.query.data.Manager;
import org.apache.geode.cache.query.data.Portfolio;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.test.junit.categories.IntegrationTest;
-import org.apache.geode.test.junit.categories.OQLQueryTest;
/**
- * Junit test for checking the value constraint region attributes.
+ * Verifies that value constraint is used by Region.put
+ *
+ * <p>
+ * TRAC #32947: value constraint not enforced on Region.put or Region.create
*/
-@Category({IntegrationTest.class, OQLQueryTest.class})
-public class Bug32947ValueConstraintJUnitTest {
+@Category(IntegrationTest.class)
+public class ValueConstraintRegressionTest {
private DistributedSystem distributedSystem;
private Cache cache;
@@ -64,7 +61,7 @@ public class Bug32947ValueConstraintJUnitTest {
}
@Test
- public void testBug32947ValueConstraints() throws Exception {
+ public void testValueConstraints() throws Exception {
AttributesFactory factory = new AttributesFactory();
factory.setValueConstraint(Portfolio.class);
RegionAttributes regionAttributes = factory.create();
diff --git a/geode-core/src/test/java/org/apache/geode/cache/query/BugJUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache/query/QueryServiceRegressionTest.java
similarity index 67%
rename from geode-core/src/test/java/org/apache/geode/cache/query/BugJUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/cache/query/QueryServiceRegressionTest.java
index 151463a..333e748 100644
--- a/geode-core/src/test/java/org/apache/geode/cache/query/BugJUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache/query/QueryServiceRegressionTest.java
@@ -12,18 +12,18 @@
* or implied. See the License for the specific language governing permissions and limitations under
* the License.
*/
-/*
- * BugJUnitTest.java JUnit based test
- *
- * Created on April 13, 2005, 2:40 PM
- */
package org.apache.geode.cache.query;
import static org.apache.geode.cache.query.data.TestData.createAndPopulateSet;
-import static org.junit.Assert.*;
+import static org.assertj.core.api.Assertions.assertThatCode;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import java.io.Serializable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
import java.util.stream.IntStream;
import org.junit.After;
@@ -31,7 +31,13 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.EntryOperation;
+import org.apache.geode.cache.PartitionAttributesFactory;
+import org.apache.geode.cache.PartitionResolver;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.cache.query.data.Portfolio;
import org.apache.geode.cache.query.data.Position;
import org.apache.geode.cache.query.data.TestData.MyValue;
@@ -45,16 +51,15 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
import org.apache.geode.test.junit.categories.OQLQueryTest;
/**
- * Tests reported bugs
+ * Verifies bug fixes against QueryService
*/
@Category({IntegrationTest.class, OQLQueryTest.class})
-public class BugJUnitTest {
- Region region;
- Region region1;
- QueryService qs;
- Cache cache;
+public class QueryServiceRegressionTest {
- public BugJUnitTest() {}
+ private Region region;
+ private Region region1;
+ private QueryService qs;
+ private Cache cache;
@Before
public void setUp() throws Exception {
@@ -80,8 +85,11 @@ public class BugJUnitTest {
CacheUtils.closeCache();
}
+ /**
+ * TRAC #41509: ClassCastException running an OQL query
+ */
@Test
- public void testBug41509() throws Exception {
+ public void oqlQueryShouldNotThrowClassCastException() throws Exception {
// Create Index.
try {
this.qs.createIndex("pos1_secIdIndex", IndexType.FUNCTIONAL, "p1.position1.secId",
@@ -103,12 +111,12 @@ public class BugJUnitTest {
}
}
- /*
- * Bug: 32429 An issue with nested queries :Iterator for the region in inner query is not getting
- * resolved.
+ /**
+ * TRAC #32429: An issue with nested queries :Iterator for the region in inner query is not
+ * getting resolved.
*/
@Test
- public void testBug32429() throws Exception {
+ public void iteratingNestedQueriesShouldWork() throws Exception {
String[] queries = new String[] {
"SELECT DISTINCT * FROM /pos where NOT(SELECT DISTINCT * FROM /pos p where p.ID = 0).isEmpty",
"-- AMBIGUOUS\n" + "import org.apache.geode.cache.\"query\".data.Portfolio; "
@@ -135,11 +143,11 @@ public class BugJUnitTest {
}
}
- /*
- * Bug 32375 Issue with Nested Query
+ /**
+ * TRAC #32375: Issue with Nested Query
*/
@Test
- public void testBug32375() throws Exception {
+ public void nestedQueriesShouldNotThrowTypeMismatchException() throws Exception {
String queryStr;
Query q;
Object r;
@@ -147,13 +155,64 @@ public class BugJUnitTest {
queryStr = "import org.apache.geode.cache.\"query\".data.Portfolio; "
+ "select distinct * from /pos, (select distinct * from /pos p TYPE Portfolio, p.positions where value!=null)";
q = qs.newQuery(queryStr);
- r = q.execute();
+ assertThatCode(() -> q.execute()).doesNotThrowAnyException();
}
-
-
+ /**
+ * Confirms that #32251 still exists (it was never fixed).
+ *
+ * <p>
+ * TRAC #32251: Error: The attribute or method name 'value' could not be resolved
+ *
+ * <p>
+ * The problem is that the query processor currently is limited on what kind of "dependent"
+ * iterator expressions it is able to determine the type of. It is only able to determine the
+ * type of a path expression that is dependent on a previous iterator.
+ *
+ * <p>
+ * The reason why this is limited is that it doesn't fully evaluate the expression to determine
+ * its element type, since this is done before the select statement itself is evaluated.
+ *
+ * <p>
+ * This is exactly the same issue that we have with the inability to determine which untyped
+ * iterator an implicit attribute name goes to.
+ *
+ * <p>
+ * The workaround is to either type the iterator or use an explicit iterator variable.
+ *
+ * <p>
+ * The following query passes because the query processor is smart enough to determine the type
+ * of a simple path iterator:
+ *
+ * <pre>
+ * Select distinct value.secId from /pos , positions
+ * </pre>
+ *
+ * <p>
+ * The following query, however, fails because the query processor is not smart enough yet to
+ * fully type expressions:
+ *
+ * <pre>
+ * Select distinct value.secId from /pos , getPositions(23)
+ * </pre>
+ *
+ * <p>
+ * The following queries, however, succeed because the iterator is either explicitly named with
+ * a variable or it is typed:
+ *
+ * <pre>
+ * Select distinct e.value.secId from /pos , getPositions(23) e
+ *
+ * import com.gemstone.gemfire.cache.$1"query$1".data.Position;
+ * select distinct value.secId
+ * from /pos, (map<string, Position>)getPositions(23)
+ *
+ * import java.util.Map$Entry as Entry;
+ * select distinct value.secId from /pos, getPositions(23) type Entry
+ * </pre>
+ */
@Test
- public void testBug32251() throws QueryException {
+ public void dependentIteratorExpressionsAreLimited() throws Exception {
String queryStr;
Query q;
Object r;
@@ -227,45 +286,45 @@ public class BugJUnitTest {
}
+ /**
+ * TRAC #32624: NameNotFoundException occurs while index maintenance.
+ */
@Test
- public void testBug32624() throws Exception {
+ public void indexMaintenanceShouldNotThrowNameNotFoundException() throws Exception {
this.qs.createIndex("iIndex", IndexType.FUNCTIONAL, "e.value.status", "/pos.entries e");
this.region.put("0", new Portfolio(0));
}
/**
- * This bug was occuring in simulation of Outer Join query for Schwab
+ * This bug was occurring in simulation of Outer Join query
*/
@Test
- public void testBugResultMismatch() {
- try {
- Region region = CacheUtils.createRegion("portfolios", Portfolio.class);
- QueryService qs = CacheUtils.getQueryService();
- region.put("0", new Portfolio(0));
- region.put("1", new Portfolio(1));
- region.put("2", new Portfolio(2));
- region.put("3", new Portfolio(3));
- qs.createIndex("index1", IndexType.FUNCTIONAL, "status", "/portfolios pf");
- String query1 =
- "SELECT DISTINCT iD as portfolio_id, pos.secId as sec_id from /portfolios p , p.positions.values pos where p.status= 'active'";
- String query2 = "select DISTINCT * from "
- + "( SELECT DISTINCT iD as portfolio_id, pos.secId as sec_id from /portfolios p , p.positions.values pos where p.status= 'active')";
-
- Query q1 = CacheUtils.getQueryService().newQuery(query1);
- Query q2 = CacheUtils.getQueryService().newQuery(query2);
- SelectResults rs1 = (SelectResults) q1.execute();
- SelectResults rs2 = (SelectResults) q2.execute();
-
- SelectResults results = QueryUtils.union(rs1, rs2, null);
- } catch (Exception e) {
- e.printStackTrace();
- fail("Test failed due to exception= " + e);
- }
-
+ public void testBugResultMismatch() throws Exception {
+ Region region = CacheUtils.createRegion("portfolios", Portfolio.class);
+ QueryService qs = CacheUtils.getQueryService();
+ region.put("0", new Portfolio(0));
+ region.put("1", new Portfolio(1));
+ region.put("2", new Portfolio(2));
+ region.put("3", new Portfolio(3));
+ qs.createIndex("index1", IndexType.FUNCTIONAL, "status", "/portfolios pf");
+ String query1 =
+ "SELECT DISTINCT iD as portfolio_id, pos.secId as sec_id from /portfolios p , p.positions.values pos where p.status= 'active'";
+ String query2 = "select DISTINCT * from "
+ + "( SELECT DISTINCT iD as portfolio_id, pos.secId as sec_id from /portfolios p , p.positions.values pos where p.status= 'active')";
+
+ Query q1 = CacheUtils.getQueryService().newQuery(query1);
+ Query q2 = CacheUtils.getQueryService().newQuery(query2);
+ SelectResults rs1 = (SelectResults) q1.execute();
+ SelectResults rs2 = (SelectResults) q2.execute();
+
+ assertThatCode(() -> QueryUtils.union(rs1, rs2, null)).doesNotThrowAnyException();
}
+ /**
+ * TRAC #36659: Nested query failure due to incorrect scope resolution
+ */
@Test
- public void testBug36659() throws Exception {
+ public void multipleScopesShouldBeAllowedAtSameLevelOfNesting() throws Exception {
// Task ID: NQIU 9
CacheUtils.getQueryService();
String queries =
@@ -279,53 +338,46 @@ public class BugJUnitTest {
r1.put("3", new Position("YHOO", 2.272));
r1.put("4", new Position("GOOG", 2.272));
r1.put("5", new Position("MSFT", 2.272));
- Query q = null;
- try {
- q = CacheUtils.getQueryService().newQuery(queries);
- CacheUtils.getLogger().info("Executing query: " + queries);
- SelectResults rs = (SelectResults) q.execute();
- assertTrue("Resultset size should be > 0", rs.size() > 0);
- } catch (Exception e) {
- e.printStackTrace();
- }
+ Query q = CacheUtils.getQueryService().newQuery(queries);
+ CacheUtils.getLogger().info("Executing query: " + queries);
+ SelectResults rs = (SelectResults) q.execute();
+ assertTrue("Resultset size should be > 0", rs.size() > 0);
}
/**
* Tests the Bug 38422 where the index results intersection results in incorrect size
+ *
+ * <p>
+ * TRAC #38422: Non distinct select query may return a ResultsBag with incorrect size depending on
+ * the where clause
*/
@Test
- public void testBug38422() {
- try {
- QueryService qs;
- qs = CacheUtils.getQueryService();
- Region rgn = CacheUtils.getRegion("/pos");
- // The region already contains 3 Portfolio object. The 4th Portfolio object
- // has its status field explictly made null. Thus the query below will result
- // in intersection of two non empty sets. One which contains 4th Portfolio
- // object containing null status & the second condition does not contain the
- // 4th portfolio object
- Portfolio pf = new Portfolio(4);
- pf.status = null;
- rgn.put(new Integer(4), pf);
- String queryStr = "select * from /pos pf where pf.status != 'active' and pf.status != null";
-
- SelectResults r[][] = new SelectResults[1][2];
- Query qry = qs.newQuery(queryStr);
- SelectResults sr = null;
- sr = (SelectResults) qry.execute();
- r[0][0] = sr;
- qs.createIndex("statusIndx", IndexType.FUNCTIONAL, "pf.status", "/pos pf");
- sr = null;
- sr = (SelectResults) qry.execute();
- r[0][1] = sr;
- CacheUtils.compareResultsOfWithAndWithoutIndex(r, this);
- assertEquals(2, (r[0][0]).size());
- assertEquals(2, (r[0][1]).size());
-
- } catch (Exception e) {
- e.printStackTrace();
- fail("Test failed due to exception =" + e.toString());
- }
+ public void testBug38422() throws Exception {
+ QueryService qs;
+ qs = CacheUtils.getQueryService();
+ Region rgn = CacheUtils.getRegion("/pos");
+ // The region already contains 3 Portfolio object. The 4th Portfolio object
+ // has its status field explictly made null. Thus the query below will result
+ // in intersection of two non empty sets. One which contains 4th Portfolio
+ // object containing null status & the second condition does not contain the
+ // 4th portfolio object
+ Portfolio pf = new Portfolio(4);
+ pf.status = null;
+ rgn.put(new Integer(4), pf);
+ String queryStr = "select * from /pos pf where pf.status != 'active' and pf.status != null";
+
+ SelectResults r[][] = new SelectResults[1][2];
+ Query qry = qs.newQuery(queryStr);
+ SelectResults sr = null;
+ sr = (SelectResults) qry.execute();
+ r[0][0] = sr;
+ qs.createIndex("statusIndx", IndexType.FUNCTIONAL, "pf.status", "/pos pf");
+ sr = null;
+ sr = (SelectResults) qry.execute();
+ r[0][1] = sr;
+ CacheUtils.compareResultsOfWithAndWithoutIndex(r, this);
+ assertEquals(2, (r[0][0]).size());
+ assertEquals(2, (r[0][1]).size());
}
@Test
@@ -335,14 +387,17 @@ public class BugJUnitTest {
factory.setPartitionAttributes(new PartitionAttributesFactory().setRedundantCopies(1)
.setTotalNumBuckets(40).setPartitionResolver(new PartitionResolver() {
+ @Override
public String getName() {
return "blah";
}
+ @Override
public Serializable getRoutingObject(EntryOperation opDetails) {
return (Serializable) opDetails.getKey();
}
+ @Override
public void close() {
}
@@ -355,14 +410,17 @@ public class BugJUnitTest {
.setRedundantCopies(1).setTotalNumBuckets(40).setPartitionResolver(new PartitionResolver() {
+ @Override
public String getName() {
return "blah";
}
+ @Override
public Serializable getRoutingObject(EntryOperation opDetails) {
return (Serializable) opDetails.getKey();
}
+ @Override
public void close() {
}
@@ -400,14 +458,17 @@ public class BugJUnitTest {
factory.setPartitionAttributes(new PartitionAttributesFactory().setRedundantCopies(1)
.setTotalNumBuckets(40).setPartitionResolver(new PartitionResolver() {
+ @Override
public String getName() {
return "blah";
}
+ @Override
public Serializable getRoutingObject(EntryOperation opDetails) {
return (Serializable) opDetails.getKey();
}
+ @Override
public void close() {
}
@@ -420,14 +481,17 @@ public class BugJUnitTest {
.setRedundantCopies(1).setTotalNumBuckets(40).setPartitionResolver(new PartitionResolver() {
+ @Override
public String getName() {
return "blah";
}
+ @Override
public Serializable getRoutingObject(EntryOperation opDetails) {
return (Serializable) opDetails.getKey();
}
+ @Override
public void close() {
}
@@ -455,7 +519,6 @@ public class BugJUnitTest {
if (!observer.isIndexesUsed) {
fail("Indexes should have been used");
}
-
}
private void createAllNumPRAndEvenNumPR(final PartitionedRegion pr1, final PartitionedRegion pr2,
@@ -468,26 +531,25 @@ public class BugJUnitTest {
});
}
-
- class QueryObserverImpl extends QueryObserverAdapter {
+ private static class QueryObserverImpl extends QueryObserverAdapter {
boolean isIndexesUsed = false;
ArrayList indexesUsed = new ArrayList();
String IndexName;
+ @Override
public void beforeIndexLookup(Index index, int oper, Object key) {
IndexName = index.getName();
indexesUsed.add(index.getName());
}
+ @Override
public void afterIndexLookup(Collection results) {
if (results != null) {
isIndexesUsed = true;
}
}
}
-
-
}
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/Bug40255JUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest.java
similarity index 76%
rename from geode-core/src/test/java/org/apache/geode/cache30/Bug40255JUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest.java
index a13063d..1c9ab62 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/Bug40255JUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest.java
@@ -14,7 +14,9 @@
*/
package org.apache.geode.cache30;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -22,7 +24,6 @@ import java.io.File;
import java.util.Properties;
import org.junit.After;
-import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -35,45 +36,49 @@ import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.test.junit.categories.IntegrationTest;
/**
- *
+ * TRAC #40255: Parameterization of XML configuration file
*/
@Category(IntegrationTest.class)
-@Ignore("Test is broken and was named Bug40255JUnitDisabledTest")
-public class Bug40255JUnitTest {
+@Ignore("Test is broken and was named *JUnitDisabledTest")
+public class CacheXmlParameterizationRegressionTest {
- private static final String BUG_40255_XML =
- Bug40255JUnitTest.class.getResource("bug40255xmlparameterization.xml").getFile();
- private static final String BUG_40255_PROPS =
- Bug40255JUnitTest.class.getResource("bug40255_gemfire.properties").getFile();
+ private static final String CACHE_XML = CacheXmlParameterizationRegressionTest.class
+ .getResource("CacheXmlParameterizationRegressionTest_cache.xml").getFile();
+ private static final String GEMFIRE_PROPERTIES = CacheXmlParameterizationRegressionTest.class
+ .getResource("CacheXmlParameterizationRegressionTest_gemfire.properties").getFile();
private static final String ATTR_PROPERTY_STRING = "region.disk.store";
-
private static final String ATTR_PROPERTY_VALUE = "teststore";
-
private static final String NESTED_ATTR_PROPERTY_STRING = "custom-nested.test";
-
private static final String NESTED_ATTR_PROPERTY_VALUE = "disk";
-
private static final String ELEMENT_PROPERTY_STRING = "custom-string.element";
-
private static final String ELEMENT_PROPERTY_VALUE = "example-string";
-
private static final String CONCAT_ELEMENT_PROPERTY_STRING = "concat.test";
-
private static final String CONCAT_ELEMENT_PROPERTY_VALUE = "-name";
-
private static final String ELEMENT_KEY_VALUE = "example-value";
- DistributedSystem ds;
- Cache cache;
+ private DistributedSystem ds;
+ private Cache cache;
+
+ @After
+ public void tearDown() throws Exception {
+ if (cache != null) {
+ cache.close();
+ cache = null;
+ }
+ if (ds != null) {
+ ds.disconnect();
+ ds = null;
+ }
+ }
@Test
public void testResolveReplacePropertyStringForLonerCache() {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- System.setProperty("gemfirePropertyFile", BUG_40255_PROPS);
- props.setProperty(CACHE_XML_FILE, BUG_40255_XML);
+ System.setProperty("gemfirePropertyFile", GEMFIRE_PROPERTIES);
+ props.setProperty(CACHE_XML_FILE, CACHE_XML);
System.setProperty(NESTED_ATTR_PROPERTY_STRING, NESTED_ATTR_PROPERTY_VALUE);
System.setProperty(ATTR_PROPERTY_STRING, ATTR_PROPERTY_VALUE);
System.setProperty(ELEMENT_PROPERTY_STRING, ELEMENT_PROPERTY_VALUE);
@@ -83,10 +88,10 @@ public class Bug40255JUnitTest {
File dir = new File("persistData1");
dir.mkdir();
- this.ds = DistributedSystem.connect(props);
- this.cache = CacheFactory.create(this.ds);
+ ds = DistributedSystem.connect(props);
+ cache = CacheFactory.create(ds);
- Region exampleRegion = this.cache.getRegion("example-region");
+ Region exampleRegion = cache.getRegion("example-region");
RegionAttributes<Object, Object> attrs = exampleRegion.getAttributes();
// Check if disk store got same name as passed in system properties in setup().
@@ -103,8 +108,8 @@ public class Bug40255JUnitTest {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "10333");
props.setProperty(LOCATORS, "");
- System.setProperty("gemfirePropertyFile", BUG_40255_PROPS);
- props.setProperty(CACHE_XML_FILE, BUG_40255_XML);
+ System.setProperty("gemfirePropertyFile", GEMFIRE_PROPERTIES);
+ props.setProperty(CACHE_XML_FILE, CACHE_XML);
System.setProperty(NESTED_ATTR_PROPERTY_STRING, NESTED_ATTR_PROPERTY_VALUE);
System.setProperty(ATTR_PROPERTY_STRING, ATTR_PROPERTY_VALUE);
System.setProperty(ELEMENT_PROPERTY_STRING, ELEMENT_PROPERTY_VALUE);
@@ -114,10 +119,10 @@ public class Bug40255JUnitTest {
File dir = new File("persistData1");
dir.mkdir();
- this.ds = DistributedSystem.connect(props);
- this.cache = CacheFactory.create(this.ds);
+ ds = DistributedSystem.connect(props);
+ cache = CacheFactory.create(ds);
- Region exampleRegion = this.cache.getRegion("example-region");
+ Region exampleRegion = cache.getRegion("example-region");
RegionAttributes<Object, Object> attrs = exampleRegion.getAttributes();
// Check if disk store got same name as passed in system properties in setup().
@@ -126,19 +131,4 @@ public class Bug40255JUnitTest {
assertEquals(exampleRegion.get(ELEMENT_PROPERTY_VALUE + CONCAT_ELEMENT_PROPERTY_VALUE),
ELEMENT_KEY_VALUE);
}
-
- @After
- public void tearDown() throws Exception {
- if (this.cache != null) {
- this.cache.close();
- this.cache = null;
- }
- if (this.ds != null) {
- this.ds.disconnect();
- this.ds = null;
- }
- }
-
- @Before
- public void setUp() throws Exception {}
}
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/Bug40662JUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/DefaultEvictionActionRegressionTest.java
similarity index 64%
rename from geode-core/src/test/java/org/apache/geode/cache30/Bug40662JUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/cache30/DefaultEvictionActionRegressionTest.java
index be07746..e04584e 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/Bug40662JUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/DefaultEvictionActionRegressionTest.java
@@ -14,17 +14,24 @@
*/
package org.apache.geode.cache30;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
+import static org.apache.geode.distributed.ConfigurationProperties.CACHE_XML_FILE;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
import static org.junit.Assert.assertEquals;
import java.util.Properties;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
+import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.EvictionAction;
+import org.apache.geode.cache.EvictionAttributes;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.test.junit.categories.IntegrationTest;
@@ -33,51 +40,53 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
* CacheXmlParser when cache.xml has eviction attributes with no eviction action specified. which
* was being set to EvictionAction.NONE
*
+ * <p>
+ * TRAC #40662: LRU behavior different when action isn't specified
+ *
* @since GemFire 6.6
*/
@Category(IntegrationTest.class)
-@Ignore("Test is broken and was named Bug40662JUnitDisabledTest")
-public class Bug40662JUnitTest {
+public class DefaultEvictionActionRegressionTest {
+
+ private static final String BUG_40662_XML = DefaultEvictionActionRegressionTest.class
+ .getResource("DefaultEvictionActionRegressionTest_cache.xml").getFile();
- private static final String BUG_40662_XML =
- Bug40662JUnitTest.class.getResource("bug40662noevictionaction.xml").getFile();
+ private DistributedSystem ds;
+ private Cache cache;
- DistributedSystem ds;
- Cache cache;
+ @Before
+ public void setUp() throws Exception {
+ Properties props = new Properties();
+ props.setProperty(MCAST_PORT, "0");
+ props.setProperty(LOCATORS, "");
+ props.setProperty(CACHE_XML_FILE, BUG_40662_XML);
+ ds = DistributedSystem.connect(props);
+ cache = CacheFactory.create(ds);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (cache != null) {
+ cache.close();
+ cache = null;
+ }
+ if (ds != null) {
+ ds.disconnect();
+ ds = null;
+ }
+ }
/**
* Test for checking eviction action in eviction attributes if no evicition action is specified in
* cache.xml
*/
+ @Test
public void testEvictionActionSetLocalDestroyPass() {
- Region exampleRegion = this.cache.getRegion("example-region");
+ Region exampleRegion = cache.getRegion("example-region");
RegionAttributes<Object, Object> attrs = exampleRegion.getAttributes();
EvictionAttributes evicAttrs = attrs.getEvictionAttributes();
// Default eviction action is LOCAL_DESTROY always.
assertEquals(EvictionAction.LOCAL_DESTROY, evicAttrs.getAction());
}
-
- @After
- protected void tearDown() throws Exception {
- if (this.cache != null) {
- this.cache.close();
- this.cache = null;
- }
- if (this.ds != null) {
- this.ds.disconnect();
- this.ds = null;
- }
- }
-
- @Before
- protected void setUp() throws Exception {
- Properties props = new Properties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(LOCATORS, "");
- props.setProperty(CACHE_XML_FILE, BUG_40662_XML);
- this.ds = DistributedSystem.connect(props);
- this.cache = CacheFactory.create(this.ds);
- }
-
}
diff --git a/geode-core/src/test/java/org/apache/geode/cache30/Bug44418JUnitTest.java b/geode-core/src/test/java/org/apache/geode/cache30/ShorteningExpirationTimeRegressionTest.java
similarity index 69%
rename from geode-core/src/test/java/org/apache/geode/cache30/Bug44418JUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/cache30/ShorteningExpirationTimeRegressionTest.java
index 2b905c4..af0c6b4 100644
--- a/geode-core/src/test/java/org/apache/geode/cache30/Bug44418JUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/cache30/ShorteningExpirationTimeRegressionTest.java
@@ -31,43 +31,84 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CustomExpiry;
+import org.apache.geode.cache.ExpirationAttributes;
+import org.apache.geode.cache.Region;
import org.apache.geode.cache.Region.Entry;
+import org.apache.geode.cache.RegionShortcut;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.internal.cache.LocalRegion;
import org.apache.geode.test.junit.categories.FlakyTest;
import org.apache.geode.test.junit.categories.IntegrationTest;
/**
- * Test for Bug 44418.
- *
* If a new expiration time is specified that is shorter than an existing one, ensure the new
* shorter time is honored.
*
+ * <p>
+ * TRAC #44418: Serious limits to CustomExpiry functionality
+ *
* @since GemFire 7.0
*/
@Category(IntegrationTest.class)
-@SuppressWarnings({"unchecked", "rawtypes"})
-public class Bug44418JUnitTest { // TODO: rename this test to non-ticket descriptive name
+public class ShorteningExpirationTimeRegressionTest {
+
+ /**
+ * Initial expiration time for entry
+ */
+ private static final int LONG_WAIT_MS = 1000 * 60 * 3;
+
+ /**
+ * How long to wait for entry to expire
+ */
+ private static final int TEST_WAIT_MS = 1000 * 60 * 1;
+
+ /**
+ * New short expiration time for entry
+ */
+ private static final int SHORT_WAIT_MS = 1;
- DistributedSystem ds;
- Cache cache;
+ /**
+ * How often to check for expiration
+ */
+ private static final int POLL_INTERVAL_MS = 1;
- private static final int LONG_WAIT_MS = 1000 * 60 * 3; // Initial expiration time for entry
- private static final int TEST_WAIT_MS = 1000 * 60 * 1; // How long to wait for entry to expire
- private static final int SHORT_WAIT_MS = 1; // New short expiration time for entry
- private static final int POLL_INTERVAL_MS = 1; // How often to check for expiration
private static final String TEST_KEY = "key";
+ private DistributedSystem ds;
+ private Cache cache;
+
+ @Before
+ public void setUp() throws Exception {
+ Properties props = new Properties();
+ props.setProperty(MCAST_PORT, "0");
+ props.setProperty(LOCATORS, "");
+ ds = DistributedSystem.connect(props);
+ cache = CacheFactory.create(ds);
+ }
+
+ @After
+ public void tearDown() throws Exception {
+ if (cache != null) {
+ cache.close();
+ cache = null;
+ }
+ if (ds != null) {
+ ds.disconnect();
+ ds = null;
+ }
+ }
+
@Category(FlakyTest.class) // GEODE-1139: time sensitive, thread sleep, expiration
@Test
public void testPut() throws Exception {
System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true");
try {
- final Region r =
- this.cache.createRegionFactory(RegionShortcut.LOCAL).setStatisticsEnabled(true)
- .setCustomEntryTimeToLive(new CustomExpiryTestClass()).create("bug44418");
+ final Region r = cache.createRegionFactory(RegionShortcut.LOCAL).setStatisticsEnabled(true)
+ .setCustomEntryTimeToLive(new CustomExpiryTestClass()).create("bug44418");
r.put(TEST_KEY, "longExpire");
// should take LONG_WAIT_MS to expire.
@@ -89,9 +130,8 @@ public class Bug44418JUnitTest { // TODO: rename this test to non-ticket descrip
System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true");
try {
- final Region r =
- this.cache.createRegionFactory(RegionShortcut.LOCAL).setStatisticsEnabled(true)
- .setCustomEntryIdleTimeout(new CustomExpiryTestClass()).create("bug44418");
+ final Region r = cache.createRegionFactory(RegionShortcut.LOCAL).setStatisticsEnabled(true)
+ .setCustomEntryIdleTimeout(new CustomExpiryTestClass()).create("bug44418");
r.put(TEST_KEY, "longExpire");
// should take LONG_WAIT_MS to expire.
@@ -121,43 +161,25 @@ public class Bug44418JUnitTest { // TODO: rename this test to non-ticket descrip
return true;
}
- @After
- public void tearDown() throws Exception {
- if (this.cache != null) {
- this.cache.close();
- this.cache = null;
- }
- if (this.ds != null) {
- this.ds.disconnect();
- this.ds = null;
- }
- }
-
- @Before
- public void setUp() throws Exception {
- Properties props = new Properties();
- props.setProperty(MCAST_PORT, "0");
- props.setProperty(LOCATORS, "");
- this.ds = DistributedSystem.connect(props);
- this.cache = CacheFactory.create(this.ds);
- }
-
private class CustomExpiryTestClass implements CustomExpiry {
+
private boolean secondTime;
@Override
- public void close() {}
+ public void close() {
+ // nothing
+ }
@Override
public ExpirationAttributes getExpiry(Entry entry) {
ExpirationAttributes result;
- if (!this.secondTime) {
- result = new ExpirationAttributes(LONG_WAIT_MS); // Set long expiration first time entry
- // referenced
- this.secondTime = true;
+ if (!secondTime) {
+ // Set long expiration first time entry referenced
+ result = new ExpirationAttributes(LONG_WAIT_MS);
+ secondTime = true;
} else {
- result = new ExpirationAttributes(SHORT_WAIT_MS); // Set short expiration second time entry
- // referenced
+ // Set short expiration second time entry referenced
+ result = new ExpirationAttributes(SHORT_WAIT_MS);
}
return result;
}
diff --git a/geode-core/src/test/java/org/apache/geode/distributed/internal/Bug40751DUnitTest.java b/geode-core/src/test/java/org/apache/geode/distributed/internal/ValueToDataThrowsRuntimeExceptionRegressionTest.java
similarity index 91%
rename from geode-core/src/test/java/org/apache/geode/distributed/internal/Bug40751DUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/distributed/internal/ValueToDataThrowsRuntimeExceptionRegressionTest.java
index 0ae1279..32decb1 100644
--- a/geode-core/src/test/java/org/apache/geode/distributed/internal/Bug40751DUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/distributed/internal/ValueToDataThrowsRuntimeExceptionRegressionTest.java
@@ -14,8 +14,8 @@
*/
package org.apache.geode.distributed.internal;
-import static org.apache.geode.distributed.ConfigurationProperties.*;
-import static org.junit.Assert.*;
+import static org.apache.geode.distributed.ConfigurationProperties.CONSERVE_SOCKETS;
+import static org.junit.Assert.fail;
import java.io.DataInput;
import java.io.DataOutput;
@@ -41,8 +41,11 @@ import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
import org.apache.geode.test.junit.categories.DistributedTest;
import org.apache.geode.test.junit.categories.MembershipTest;
+/**
+ * TRAC #40751: A RuntimeException from a user's toData method causes a hang
+ */
@Category({DistributedTest.class, MembershipTest.class})
-public class Bug40751DUnitTest extends JUnit4CacheTestCase {
+public class ValueToDataThrowsRuntimeExceptionRegressionTest extends JUnit4CacheTestCase {
@Override
public final void postTearDownCacheTestCase() throws Exception {
@@ -58,6 +61,7 @@ public class Bug40751DUnitTest extends JUnit4CacheTestCase {
VM vm1 = host.getVM(2);
SerializableRunnable createDataRegion = new SerializableRunnable("createRegion") {
+ @Override
public void run() {
Cache cache = getCache();
AttributesFactory attr = new AttributesFactory();
@@ -71,6 +75,7 @@ public class Bug40751DUnitTest extends JUnit4CacheTestCase {
vm0.invoke(createDataRegion);
SerializableRunnable createEmptyRegion = new SerializableRunnable("createRegion") {
+ @Override
public void run() {
Cache cache = getCache();
AttributesFactory attr = new AttributesFactory();
@@ -91,6 +96,7 @@ public class Bug40751DUnitTest extends JUnit4CacheTestCase {
vm1.invoke(createEmptyRegion);
} finally {
Invoke.invokeInEveryVM(new SerializableCallable() {
+ @Override
public Object call() throws Exception {
System.getProperties().remove("p2p.oldIO");
System.getProperties().remove("p2p.nodirectBuffers");
@@ -102,7 +108,6 @@ public class Bug40751DUnitTest extends JUnit4CacheTestCase {
}
}
-
@Override
public Properties getDistributedSystemProperties() {
Properties props = new Properties();
@@ -113,19 +118,20 @@ public class Bug40751DUnitTest extends JUnit4CacheTestCase {
return props;
}
-
private static class MyClass implements DataSerializable {
+ public MyClass() {
+ // nothing
+ }
- public MyClass() {}
-
-
-
- public void fromData(DataInput in) throws IOException, ClassNotFoundException {}
+ @Override
+ public void fromData(DataInput in) throws IOException, ClassNotFoundException {
+ // nothing
+ }
+ @Override
public void toData(DataOutput out) throws IOException {
throw new RuntimeException("A Fake runtime exception in toData");
}
-
}
}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/Bug49856JUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/SystemFailureThreadCleanupRegressionTest.java
similarity index 93%
rename from geode-core/src/test/java/org/apache/geode/internal/Bug49856JUnitTest.java
rename to geode-core/src/test/java/org/apache/geode/internal/SystemFailureThreadCleanupRegressionTest.java
index cc6c00b..b9dfd38 100644
--- a/geode-core/src/test/java/org/apache/geode/internal/Bug49856JUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/SystemFailureThreadCleanupRegressionTest.java
@@ -24,17 +24,16 @@ import org.junit.experimental.categories.Category;
import org.apache.geode.SystemFailure;
import org.apache.geode.cache.client.ClientCacheFactory;
import org.apache.geode.internal.cache.GemFireCacheImpl;
-import org.apache.geode.internal.sequencelog.SequenceLoggerImpl;
import org.apache.geode.test.junit.categories.IntegrationTest;
+/**
+ * TRAC #49856: Some GemFire Threads not cleaned up in cache close.
+ */
@Category(IntegrationTest.class)
-public class Bug49856JUnitTest {
-
- public Bug49856JUnitTest() {}
+public class SystemFailureThreadCleanupRegressionTest {
@Test
public void testNoGFThreadsRunningPostCacheClose() throws Exception {
-
ClientCacheFactory ccf = new ClientCacheFactory();
GemFireCacheImpl cache = (GemFireCacheImpl) ccf.create();
@@ -54,7 +53,6 @@ public class Bug49856JUnitTest {
private void checkThreads(boolean expectThreads) {
boolean proctorRunning = false;
boolean watchDogRunning = false;
- boolean loggerConsumerRunning = false;
for (Thread t : Thread.getAllStackTraces().keySet()) {
if (t.getName().contains("SystemFailure WatchDog")) {
@@ -74,5 +72,4 @@ public class Bug49856JUnitTest {
assertTrue(sb.toString(), !proctorRunning && !watchDogRunning);
}
}
-
}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/AfterRegionCreateBeforeInitializationRegressionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/AfterRegionCreateBeforeInitializationRegressionTest.java
new file mode 100755
index 0000000..02bc354
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/AfterRegionCreateBeforeInitializationRegressionTest.java
@@ -0,0 +1,135 @@
+/*
+ * 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.assertTrue;
+import static org.junit.Assert.fail;
+
+import org.junit.After;
+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.DataPolicy;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.RegionEvent;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.cache.util.CacheListenerAdapter;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.test.dunit.DistributedTestCase;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+
+/**
+ * TRAC #33726: afterRegionCreate event delivered before region initialization occurs
+ */
+@Category(DistributedTest.class)
+public class AfterRegionCreateBeforeInitializationRegressionTest extends DistributedTestCase {
+
+ private static boolean[] flags = new boolean[2];
+ private static Cache cache = null;
+ private static DistributedSystem ds = null;
+ private static boolean isOK = false;
+
+ @After
+ public void tearDown() throws Exception {
+ disconnectAllFromDS();
+ }
+
+ @Test
+ public void testAfterRegionCreate() {
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+ VM vm1 = host.getVM(1);
+ vm0.invoke(() -> createCacheAndPopulateRegion1());
+ vm1.invoke(() -> createCacheAndRegion2());
+ boolean pass = vm1.invoke(() -> testFlag());
+ assertTrue("The test failed", pass);
+
+ }
+
+ private void createCacheAndPopulateRegion1() {
+ ds = getSystem();
+ cache = CacheFactory.create(ds);
+ AttributesFactory factory = new AttributesFactory();
+ factory.setScope(Scope.GLOBAL);
+ factory.setDataPolicy(DataPolicy.REPLICATE);
+ RegionAttributes attr = factory.create();
+ Region region = cache.createRegion("testRegion", attr);
+ Region subRegion = region.createSubregion("testSubRegion", attr);
+ for (int i = 1; i < 100; i++) {
+ region.put(i, i);
+ subRegion.put(i, i);
+ }
+ }
+
+ private void createCacheAndRegion2() {
+ ds = getSystem();
+ cache = CacheFactory.create(ds);
+ AttributesFactory factory = new AttributesFactory();
+ factory.setCacheListener(new TestCacheListener());
+ factory.setScope(Scope.GLOBAL);
+ factory.setDataPolicy(DataPolicy.REPLICATE);
+ RegionAttributes attr = factory.create();
+ Region region = cache.createRegion("testRegion", attr);
+ region.createSubregion("testSubRegion", attr);
+ }
+
+ private boolean testFlag() {
+ if (isOK) {
+ return isOK;
+ } else {
+ synchronized (AfterRegionCreateBeforeInitializationRegressionTest.class) {
+ if (isOK) {
+ return isOK;
+ } else {
+ try {
+ AfterRegionCreateBeforeInitializationRegressionTest.class.wait(120000);
+ } catch (InterruptedException ie) {
+ fail("interrupted");
+ }
+ }
+ }
+ return isOK;
+ }
+ }
+
+ private static class TestCacheListener extends CacheListenerAdapter {
+
+ @Override
+ public void afterRegionCreate(RegionEvent event) {
+ Region region = event.getRegion();
+ if (((LocalRegion) region).isInitialized()) {
+ String regionPath = event.getRegion().getFullPath();
+ if (regionPath.contains("/testRegion/testSubRegion")) {
+ flags[1] = true;
+ } else if (regionPath.contains("/testRegion")) {
+ flags[0] = true;
+ }
+
+ }
+ if (flags[0] && flags[1]) {
+ isOK = true;
+ synchronized (AfterRegionCreateBeforeInitializationRegressionTest.class) {
+ AfterRegionCreateBeforeInitializationRegressionTest.class.notify();
+ }
+ }
+ }
+ }
+}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33359DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33359DUnitTest.java
deleted file mode 100644
index 5941373..0000000
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33359DUnitTest.java
+++ /dev/null
@@ -1,153 +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.
- */
-/*
- * Bug33359DUnitTest.java
- *
- * Created on September 6, 2005, 2:57 PM
- */
-package org.apache.geode.internal.cache;
-
-import java.util.Properties;
-
-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.CacheException;
-import org.apache.geode.cache.CacheFactory;
-import org.apache.geode.cache.CacheTransactionManager;
-import org.apache.geode.cache.DataPolicy;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionAttributes;
-import org.apache.geode.cache.Scope;
-import org.apache.geode.cache30.CacheSerializableRunnable;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.LogWriterUtils;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class Bug33359DUnitTest extends JUnit4DistributedTestCase { // TODO: reformat
-
- static Cache cache;
- static Properties props = new Properties();
- static Properties propsWork = new Properties();
- static DistributedSystem ds = null;
- static Region region;
- static Region paperWork;
- static CacheTransactionManager cacheTxnMgr;
- static boolean IsAfterClear = false;
- static boolean flag = false;
-
- @Override
- public final void postSetUp() throws Exception {
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- vm0.invoke(() -> Bug33359DUnitTest.createCacheVM0());
- vm1.invoke(() -> Bug33359DUnitTest.createCacheVM1());
- LogWriterUtils.getLogWriter().fine("Cache created in successfully");
- }
-
- @Override
- public final void preTearDown() {
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- vm0.invoke(() -> Bug33359DUnitTest.closeCache());
- vm1.invoke(() -> Bug33359DUnitTest.closeCache());
- }
-
- public static void createCacheVM0() {
- try {
- ds = (new Bug33359DUnitTest()).getSystem(props);
- cache = CacheFactory.create(ds);
-
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.DISTRIBUTED_ACK);
- factory.setDataPolicy(DataPolicy.REPLICATE);
- factory.setEarlyAck(true);
- DistributedSystem.setThreadsSocketPolicy(false);
- RegionAttributes attr = factory.create();
-
- region = cache.createRegion("map", attr);
- paperWork = cache.createRegion("paperWork", attr);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- } // end of create cache for VM0
-
- public static void createCacheVM1() {
- try {
- ds = (new Bug33359DUnitTest()).getSystem(props);
- DistributedSystem.setThreadsSocketPolicy(false);
-
- cache = CacheFactory.create(ds);
-
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.DISTRIBUTED_ACK);
- factory.setDataPolicy(DataPolicy.REPLICATE);
-
- RegionAttributes attr = factory.create();
-
- region = cache.createRegion("map", attr);
- paperWork = cache.createRegion("paperWork", attr);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- public static void closeCache() {
- try {
- cache.close();
- ds.disconnect();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- // test methods
-
-
- @Test
- public void testClearMultiVM() {
-
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- // VM vm1 = host.getVM(1);
-
- vm0.invoke(new CacheSerializableRunnable("put initial data") {
- public void run2() throws CacheException {
- for (int i = 0; i < 10; i++) {
- region.put(new Integer(i), Integer.toString(i));
- }
- LogWriterUtils.getLogWriter().fine("Did all puts successfully");
- }
- });
-
- vm0.invoke(new CacheSerializableRunnable("perform clear on region") {
- public void run2() throws CacheException {
- region.clear();
- LogWriterUtils.getLogWriter().fine("region is cleared");
- }
- });
-
-
- }// end of test case
-
-}// end of test class
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33726DUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33726DUnitTest.java
deleted file mode 100755
index 56ed2a5..0000000
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33726DUnitTest.java
+++ /dev/null
@@ -1,156 +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 java.util.Properties;
-
-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.DataPolicy;
-import org.apache.geode.cache.Region;
-import org.apache.geode.cache.RegionAttributes;
-import org.apache.geode.cache.RegionEvent;
-import org.apache.geode.cache.Scope;
-import org.apache.geode.cache.util.CacheListenerAdapter;
-import org.apache.geode.distributed.DistributedSystem;
-import org.apache.geode.test.dunit.Host;
-import org.apache.geode.test.dunit.VM;
-import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
-import org.apache.geode.test.junit.categories.DistributedTest;
-
-@Category(DistributedTest.class)
-public class Bug33726DUnitTest extends JUnit4DistributedTestCase {
-
- static boolean[] flags = new boolean[2];
- static Cache cache = null;
- static DistributedSystem ds = null;
- static boolean isOK = false;
-
- @Override
- public final void preTearDown() throws Exception {
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- vm0.invoke(() -> Bug33726DUnitTest.closeCache());
- vm1.invoke(() -> Bug33726DUnitTest.closeCache());
- }
-
- public static void closeCache() {
- try {
- cache.close();
- cache = null;
- ds.disconnect();
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- }
-
- @Test
- public void testAfterRegionCreate() {
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- vm0.invoke(() -> Bug33726DUnitTest.createCacheAndPopulateRegion1());
- vm1.invoke(() -> Bug33726DUnitTest.createCacheAndRegion2());
- boolean pass = vm1.invoke(() -> Bug33726DUnitTest.testFlag());
- assertTrue("The test failed", pass);
-
- }
-
- public static void createCacheAndPopulateRegion1() {
- try {
- ds = (new Bug33726DUnitTest()).getSystem(new Properties());
- cache = CacheFactory.create(ds);
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.GLOBAL);
- factory.setDataPolicy(DataPolicy.REPLICATE);
- RegionAttributes attr = factory.create();
- Region region = cache.createRegion("testRegion", attr);
- Region subRegion = region.createSubregion("testSubRegion", attr);
- for (int i = 1; i < 100; i++) {
- region.put(new Integer(i), new Integer(i));
- subRegion.put(new Integer(i), new Integer(i));
- }
- } catch (Exception ex) {
- fail("Creation of cache failed due to " + ex);
- ex.printStackTrace();
- }
- }
-
- public static void createCacheAndRegion2() {
- try {
- ds = (new Bug33726DUnitTest()).getSystem(new Properties());
- cache = CacheFactory.create(ds);
- AttributesFactory factory = new AttributesFactory();
- factory.setCacheListener(new TestCacheListener());
- factory.setScope(Scope.GLOBAL);
- factory.setDataPolicy(DataPolicy.REPLICATE);
- RegionAttributes attr = factory.create();
- Region region = cache.createRegion("testRegion", attr);
- region.createSubregion("testSubRegion", attr);
- } catch (Exception ex) {
- fail("failed due to " + ex);
- ex.printStackTrace();
- }
- }
-
- public static boolean testFlag() {
- if (isOK) {
- return isOK;
- } else {
- synchronized (Bug33726DUnitTest.class) {
- if (isOK) {
- return isOK;
- } else {
- try {
- Bug33726DUnitTest.class.wait(120000);
- } catch (InterruptedException ie) {
- fail("interrupted");
- }
- }
- }
- return isOK;
- }
- }
-
- public static class TestCacheListener extends CacheListenerAdapter {
-
- public void afterRegionCreate(RegionEvent event) {
- Region region = event.getRegion();
- if (((LocalRegion) region).isInitialized()) {
- String regionPath = event.getRegion().getFullPath();
- if (regionPath.indexOf("/testRegion/testSubRegion") >= 0) {
- flags[1] = true;
- } else if (regionPath.indexOf("/testRegion") >= 0) {
- flags[0] = true;
- }
-
- }
- if (flags[0] && flags[1]) {
- isOK = true;
- synchronized (Bug33726DUnitTest.class) {
- Bug33726DUnitTest.class.notify();
- }
- }
- }
- }
-
-}
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33726JUnitTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33726JUnitTest.java
index 0563528..09e0b9a 100755
--- a/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33726JUnitTest.java
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/Bug33726JUnitTest.java
@@ -19,11 +19,14 @@ import static org.junit.Assert.fail;
import java.util.Properties;
-import org.junit.After;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import org.apache.geode.cache.*;
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionEvent;
import org.apache.geode.cache.util.CacheListenerAdapter;
import org.apache.geode.distributed.DistributedSystem;
import org.apache.geode.test.junit.categories.IntegrationTest;
@@ -36,25 +39,9 @@ import org.apache.geode.test.junit.categories.IntegrationTest;
@Category(IntegrationTest.class)
public class Bug33726JUnitTest {
- boolean[] flags = new boolean[2];
- // private boolean failed = false;
- // private boolean done = false;
- static boolean isOK = false;
-
- public Bug33726JUnitTest() {
-
- }
-
- public void setup() {
-
- }
-
- @After
- public void tearDown() {
-
- }
-
+ private boolean[] flags = new boolean[2];
+ private static boolean isOK = false;
@Test
public void testAfterRegionCreate() {
diff --git a/geode-core/src/test/java/org/apache/geode/internal/cache/ClearRegionMessageAssertionRegressionTest.java b/geode-core/src/test/java/org/apache/geode/internal/cache/ClearRegionMessageAssertionRegressionTest.java
new file mode 100644
index 0000000..b27ee16
--- /dev/null
+++ b/geode-core/src/test/java/org/apache/geode/internal/cache/ClearRegionMessageAssertionRegressionTest.java
@@ -0,0 +1,121 @@
+/*
+ * 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 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.CacheException;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.cache30.CacheSerializableRunnable;
+import org.apache.geode.distributed.DistributedSystem;
+import org.apache.geode.test.dunit.DistributedTestCase;
+import org.apache.geode.test.dunit.Host;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.junit.categories.DistributedTest;
+
+/**
+ * TRAC #33359: AssertionError thrown while processing
+ * cache.DistributedClearOperation$ClearRegionMessage
+ */
+@Category(DistributedTest.class)
+public class ClearRegionMessageAssertionRegressionTest extends DistributedTestCase {
+
+ private static Cache cache;
+ private static DistributedSystem ds = null;
+ private static Region region;
+
+ @Before
+ public void setUp() throws Exception {
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+ VM vm1 = host.getVM(1);
+ vm0.invoke(() -> createCacheVM0());
+ vm1.invoke(() -> createCacheVM1());
+ }
+
+ @After
+ public void tearDown() {
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+ VM vm1 = host.getVM(1);
+ vm0.invoke(() -> closeCache());
+ vm1.invoke(() -> closeCache());
+ }
+
+ private void createCacheVM0() {
+ ds = getSystem();
+ cache = CacheFactory.create(ds);
+
+ AttributesFactory factory = new AttributesFactory();
+ factory.setScope(Scope.DISTRIBUTED_ACK);
+ factory.setDataPolicy(DataPolicy.REPLICATE);
+ factory.setEarlyAck(true);
+ DistributedSystem.setThreadsSocketPolicy(false);
+ RegionAttributes attr = factory.create();
+
+ region = cache.createRegion("map", attr);
+ }
+
+ private void createCacheVM1() {
+ ds = getSystem();
+ DistributedSystem.setThreadsSocketPolicy(false);
+
+ cache = CacheFactory.create(ds);
+
+ AttributesFactory factory = new AttributesFactory();
+ factory.setScope(Scope.DISTRIBUTED_ACK);
+ factory.setDataPolicy(DataPolicy.REPLICATE);
+
+ RegionAttributes attr = factory.create();
+
+ region = cache.createRegion("map", attr);
+ }
+
+ private void closeCache() {
+ cache.close();
+ ds.disconnect();
+ }
+
+ @Test
+ public void testClearMultiVM() {
+ Host host = Host.getHost(0);
+ VM vm0 = host.getVM(0);
+
+ vm0.invoke(new CacheSerializableRunnable("put initial data") {
+ @Override
+ public void run2() throws CacheException {
+ for (int i = 0; i < 10; i++) {
+ region.put(i, Integer.toString(i));
+ }
+ }
+ });
+
+ vm0.invoke(new CacheSerializableRunnable("perform clear on region") {
+ @Override
+ public void run2() throws CacheException {
+ region.clear();
+ }
+ });
+ }
+}
diff --git a/geode-core/src/test/resources/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest_cache.xml b/geode-core/src/test/resources/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest_cache.xml
new file mode 100644
index 0000000..c62b2ee
--- /dev/null
+++ b/geode-core/src/test/resources/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest_cache.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!DOCTYPE cache PUBLIC
+ "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN"
+ "http://www.gemstone.com/dtd/cache7_0.dtd">
+
+<!-- This file has no eviction action specified with lru-memory-size -->
+<cache>
+ <disk-store name="teststore" auto-compact="true" max-oplog-size="1024" queue-size="10000" time-interval="15">
+ <disk-dirs>
+ <disk-dir dir-size="4096">persistData1</disk-dir>
+ </disk-dirs>
+ </disk-store>
+ <vm-root-region name="example-region">
+ <region-attributes disk-store-name="${custom-region.${custom-nested.test}.store}" refid="REPLICATE_PERSISTENT" disk-synchronous="false" id="sample">
+ </region-attributes>
+ <entry>
+ <key><string>${custom-string.element}${concat.test}</string></key>
+ <value><string>example-value</string></value>
+ </entry>
+ <entry>
+ <key><string>${custom-string.element}</string></key>
+ <value><string>${concat.test}</string></value>
+ </entry>
+ </vm-root-region>
+</cache>
diff --git a/geode-core/src/test/resources/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest_gemfire.properties b/geode-core/src/test/resources/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest_gemfire.properties
new file mode 100644
index 0000000..128ac23
--- /dev/null
+++ b/geode-core/src/test/resources/org/apache/geode/cache30/CacheXmlParameterizationRegressionTest_gemfire.properties
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+custom-nested.test=disk
+custom-region.disk.store=teststore
diff --git a/geode-core/src/test/resources/org/apache/geode/cache30/DefaultEvictionActionRegressionTest_cache.xml b/geode-core/src/test/resources/org/apache/geode/cache30/DefaultEvictionActionRegressionTest_cache.xml
new file mode 100644
index 0000000..4b3a09a
--- /dev/null
+++ b/geode-core/src/test/resources/org/apache/geode/cache30/DefaultEvictionActionRegressionTest_cache.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+
+<!DOCTYPE cache PUBLIC
+ "-//GemStone Systems, Inc.//GemFire Declarative Caching 7.0//EN"
+ "http://www.gemstone.com/dtd/cache7_0.dtd">
+
+<!-- This file has no eviction action specified with lru-memory-size -->
+<cache>
+ <vm-root-region name="example-region">
+ <region-attributes scope="distributed-no-ack" data-policy="replicate" id="sample">
+ <eviction-attributes><lru-memory-size maximum="1"></lru-memory-size></eviction-attributes></region-attributes>
+ </vm-root-region>
+</cache>
--
To stop receiving notification emails like this one, please contact
klund@apache.org.