You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by hi...@apache.org on 2016/06/15 16:42:23 UTC
[42/97] [abbrv] [partial] incubator-geode git commit: GEODE-837:
update tests from JUnit3 to JUnit4
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
index bc50219..010b1f9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml30DUnitTest.java
@@ -16,16 +16,7 @@
*/
package com.gemstone.gemfire.cache30;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.util.ObjectSizer;
-import com.gemstone.gemfire.internal.cache.DiskWriteAttributesImpl;
-import com.gemstone.gemfire.internal.cache.xmlcache.*;
-import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.IgnoredException;
-import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-import com.gemstone.gemfire.util.test.TestUtil;
-import junit.framework.AssertionFailedError;
-import org.xml.sax.SAXException;
+import static org.junit.Assert.*;
import java.io.File;
import java.io.FileInputStream;
@@ -33,11 +24,46 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.xml.sax.SAXException;
+
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheLoaderException;
+import com.gemstone.gemfire.cache.CacheWriter;
+import com.gemstone.gemfire.cache.CacheXmlException;
+import com.gemstone.gemfire.cache.Declarable;
+import com.gemstone.gemfire.cache.DiskWriteAttributesFactory;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.ExpirationAction;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.MirrorType;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.util.ObjectSizer;
+import com.gemstone.gemfire.internal.cache.DiskWriteAttributesImpl;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXmlParser;
+import com.gemstone.gemfire.internal.cache.xmlcache.Declarable2;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionCreation;
+import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+import com.gemstone.gemfire.util.test.TestUtil;
+
/**
* Tests the functionality of loading a declarative caching file when
* a <code>Cache</code> is {@link CacheFactory#create created}. The
* fact that it is a subclass of {@link RegionTestCase} allows us to
- * take advantage of methods like {@link #getCache}.
+ * take advantage of methods like getCache().
*
* <P>
*
@@ -47,15 +73,13 @@ import java.util.Properties;
*
* @since GemFire 3.0
*/
+@Category(DistributedTest.class)
public class CacheXml30DUnitTest extends CacheXmlTestCase {
- public CacheXml30DUnitTest(String name) {
- super(name);
- }
-
/**
* Tests creating a cache with a non-existent XML file
*/
+ @Test
public void testNonExistentFile() throws IOException {
// System.out.println("testNonExistentFile - start: " + System.currentTimeMillis());
File nonExistent = new File(this.getName() + ".xml");
@@ -81,6 +105,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests creating a cache with a XML file that is a directory
*/
+ @Test
public void testXmlFileIsDirectory() {
File dir = new File(this.getName() + "dir");
dir.mkdirs();
@@ -104,6 +129,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests creating a cache with the default lock-timeout, lock-lease,
* and search-timeout.
*/
+ @Test
public void testDefaultCache() {
CacheCreation cache = new CacheCreation();
@@ -114,6 +140,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests creating a cache with non-default lock-timeout, lock-lease,
* and search-timeout.
*/
+ @Test
public void testNonDefaultCache() {
CacheCreation cache = new CacheCreation();
cache.setLockTimeout(42);
@@ -130,6 +157,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests creating a cache with entries defined in the root region
*/
+ @Test
public void testEntriesInRootRegion() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -144,6 +172,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests creating a cache whose keys are constrained
*/
+ @Test
public void testConstrainedKeys() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -157,6 +186,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests creating a cache with a various {@link
* ExpirationAttributes}.
*/
+ @Test
public void testExpirationAttriubutes() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -194,6 +224,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests a cache loader an interesting combination of declarables
*/
+ @Test
public void testCacheLoaderWithDeclarables() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -210,6 +241,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests a cache writer with no parameters
*/
+ @Test
public void testCacheWriter() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -225,6 +257,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests a cache listener with no parameters
*/
+ @Test
public void testCacheListener() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -240,6 +273,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests a region with non-default region attributes
*/
+ @Test
public void testNonDefaultRegionAttributes() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -258,6 +292,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests parsing a malformed XML file
*/
+ @Test
public void testMalformed() {
setXmlFile(findFile("malformed.xml"));
@@ -276,6 +311,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests parsing an XML file with a bad integer
*/
+ @Test
public void testBadInt() {
setXmlFile(findFile("badInt.xml"));
@@ -298,6 +334,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests parsing an XML file with a bad float
*/
+ @Test
public void testBadFloat() {
setXmlFile(findFile("badFloat.xml"));
@@ -317,6 +354,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests parsing an XML file with a bad scope. This error should be
* caught by the XML parser.
*/
+ @Test
public void testBadScope() {
setXmlFile(findFile("badScope.xml"));
@@ -336,6 +374,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests parsing an XML file with a non-existent key constraint
* class.
*/
+ @Test
public void testBadKeyConstraintClass() {
setXmlFile(findFile("badKeyConstraintClass.xml"));
@@ -355,6 +394,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests parsing an XML file that specifies a cache listener that is
* not {@link Declarable}.
*/
+ @Test
public void testCallbackNotDeclarable() {
setXmlFile(findFile("callbackNotDeclarable.xml"));
@@ -375,8 +415,9 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests parsing an XML file that specifies a cache listener whose
- * constructor throws an {@linkplain TestException exception}.
+ * constructor throws an {@linkplain AssertionError exception}.
*/
+ @Test
public void testCallbackWithException() {
setXmlFile(findFile("callbackWithException.xml"));
@@ -386,7 +427,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
fail("Should have thrown a CacheXmlException");
} catch (CacheXmlException ex) {
- if (!(ex.getCause() instanceof TestException)) {
+ if (!(ex.getCause() instanceof AssertionError)) {
throw ex;
}
} finally {
@@ -399,6 +440,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests parsing an XML file that specifies a cache listener that is
* not a <code>CacheLoader</code>.
*/
+ @Test
public void testLoaderNotLoader() {
setXmlFile(findFile("loaderNotLoader.xml"));
@@ -418,6 +460,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests nested regions
*/
+ @Test
public void testNestedRegions() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -462,6 +505,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests whether or not XML attributes can appear in any order. See
* bug 30050.
*/
+ @Test
public void testAttributesUnordered() {
setXmlFile(findFile("attributesUnordered.xml"));
getCache();
@@ -470,6 +514,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests disk directories
*/
+ @Test
public void testDiskDirs() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -494,6 +539,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
* Tests the <code>overflowThreshold</code> and
* <code>persistBackup</code> related attributes
*/
+ @Test
public void testOverflowAndBackup() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -509,6 +555,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
/**
* Tests <code>DiskWriteAttributes</code>
*/
+ @Test
public void testDiskWriteAttributes() throws CacheException {
CacheCreation cache = new CacheCreation();
// Set properties for Asynch writes
@@ -545,13 +592,14 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
*
* @since GemFire 3.2.1
*/
+ @Test
public void testExampleCacheXmlFile() throws Exception {
// Check for old example files
String dirName = "examples_" + this.getGemFireVersion();
File dir = null;
try {
dir = findFile(dirName);
- } catch(AssertionFailedError e) {
+ } catch(AssertionError e) {
//ignore, no directory.
}
if (dir != null && dir.exists()) {
@@ -585,6 +633,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
}
}
+ @Test
public void testEvictionLRUEntryAttributes() throws Exception {
final String rName = getUniqueName();
CacheCreation cache = new CacheCreation();
@@ -626,6 +675,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
return true;
}
}
+ @Test
public void testEvictionLRUMemoryAttributes() throws Exception {
final String rName = getUniqueName();
CacheCreation cache = new CacheCreation();
@@ -635,6 +685,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
testXml(cache);
}
+ @Test
public void testEvictionLRUHeapAttributes() throws Exception {
final String rName = getUniqueName();
CacheCreation cache = new CacheCreation();
@@ -659,8 +710,8 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
}
- public static class TestException extends RuntimeException {
- public TestException() {
+ public static class AssertionError extends RuntimeException {
+ public AssertionError() {
super("Test Exception");
}
}
@@ -674,7 +725,7 @@ public class CacheXml30DUnitTest extends CacheXmlTestCase {
extends TestCacheListener {
public ExceptionalCacheListener() {
- throw new TestException();
+ throw new AssertionError();
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java
index 134cf5f..279b563 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml40DUnitTest.java
@@ -16,6 +16,11 @@
*/
package com.gemstone.gemfire.cache30;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.MirrorType;
import com.gemstone.gemfire.cache.Scope;
@@ -24,6 +29,7 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheTransactionManagerCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests the declarative caching functionality introduced in GemFire
@@ -31,27 +37,19 @@ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
*
* @since GemFire 4.0
*/
+@Category(DistributedTest.class)
public class CacheXml40DUnitTest extends CacheXml30DUnitTest {
- //////// Constructors
-
- public CacheXml40DUnitTest(String name) {
- super(name);
- }
-
- //////// Helper methods
-
protected String getGemFireVersion() {
return CacheXml.VERSION_4_0;
}
- //////// Test methods
-
/**
* Tests the cache server attribute
*
* @since GemFire 4.0
*/
+ @Test
public void testServer() {
CacheCreation cache = new CacheCreation();
cache.setIsServer(true);
@@ -65,6 +63,7 @@ public class CacheXml40DUnitTest extends CacheXml30DUnitTest {
*
* @since GemFire 4.0
*/
+ @Test
public void testBridgeServers() {
CacheCreation cache = new CacheCreation();
@@ -90,6 +89,7 @@ public class CacheXml40DUnitTest extends CacheXml30DUnitTest {
/**
* Tests the is-lock-grantor attribute in xml.
*/
+ @Test
public void testIsLockGrantorAttribute() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -110,6 +110,7 @@ public class CacheXml40DUnitTest extends CacheXml30DUnitTest {
*
* @since GemFire 4.0
*/
+ @Test
public void testTransactionListener() {
CacheCreation cache = new CacheCreation();
CacheTransactionManagerCreation txMgrCreation = new CacheTransactionManagerCreation();
@@ -123,6 +124,7 @@ public class CacheXml40DUnitTest extends CacheXml30DUnitTest {
*
* @since GemFire 4.0
*/
+ @Test
public void testCacheTransactionManager() {
CacheCreation cache = new CacheCreation();
CacheTransactionManagerCreation txMgrCreation = new CacheTransactionManagerCreation();
@@ -136,6 +138,7 @@ public class CacheXml40DUnitTest extends CacheXml30DUnitTest {
*
* @since GemFire 4.1
*/
+ @Test
public void testConstrainedValues() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
index 617f9ca..9c7d37a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml41DUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.cache30;
+import static org.junit.Assert.*;
+
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -23,6 +25,8 @@ import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import org.xml.sax.SAXException;
import com.gemstone.gemfire.cache.Cache;
@@ -44,6 +48,7 @@ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests the declarative caching functionality introduced in GemFire 4.1.
@@ -51,13 +56,14 @@ import com.gemstone.gemfire.test.dunit.IgnoredException;
* @since GemFire 4.1
*/
+@Category(DistributedTest.class)
public class CacheXml41DUnitTest extends CacheXml40DUnitTest
{
// ////// Constructors
- public CacheXml41DUnitTest(String name) {
- super(name);
+ public CacheXml41DUnitTest() {
+ super();
}
// ////// Helper methods
@@ -82,6 +88,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
* Tests that named region attributes are registered when the cache is
* created.
*/
+ @Test
public void testRegisteringNamedRegionAttributes()
{
CacheCreation cache = new CacheCreation();
@@ -113,6 +120,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
* Tests that a region created with a named attributes has the correct
* attributes.
*/
+ @Test
public void testNamedAttributes() throws CacheException
{
setXmlFile(findFile("namedAttributes.xml"));
@@ -158,6 +166,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
* attributes refer to an unknown named region attributes throws an
* {@link IllegalStateException}.
*/
+ @Test
public void testUnknownNamedAttributes()
{
setXmlFile(findFile("unknownNamedAttributes.xml"));
@@ -179,6 +188,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
* Tests to make sure that we cannot create the same region multiple times in
* a <code>cache.xml</code> file.
*/
+ @Test
public void testCreateSameRegionTwice() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -221,6 +231,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
* Tests to make sure that we cannot create the same subregion multiple times
* in a <code>cache.xml</code> file.
*/
+ @Test
public void testCreateSameSubregionTwice() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -283,6 +294,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
/**
* Tests that loading cache XML effects mutable cache attributes.
*/
+ @Test
public void testModifyCacheAttributes() throws CacheException
{
boolean copyOnRead1 = false;
@@ -332,6 +344,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
/**
* Tests that loading cache XML can create a region.
*/
+ @Test
public void testAddRegionViaCacheXml() throws CacheException
{
CacheCreation creation = new CacheCreation();
@@ -394,6 +407,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
/**
* Tests that loading cache XML can modify a region.
*/
+ @Test
public void testModifyRegionViaCacheXml() throws CacheException
{
CacheCreation creation = new CacheCreation();
@@ -467,6 +481,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
/**
* Tests that loading cache XML can add/update entries to a region.
*/
+ @Test
public void testAddEntriesViaCacheXml() throws CacheException
{
String key1 = "KEY1";
@@ -535,6 +550,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
* @since GemFire 4.2.3
* @deprecated as of GemFire 6.5.
*/
+ @Test
public void testPublisherAttribute() throws CacheException {
// CacheCreation cache = new CacheCreation();
@@ -549,6 +565,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
* Test EnableBridgeConflation region attribute
* @since GemFire 4.2
*/
+ @Test
public void testEnableBridgeConflationAttribute() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -563,6 +580,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
* Test EnableAsyncConflation region attribute
* @since GemFire 4.2
*/
+ @Test
public void testEnableAsyncConflationAttribute() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -575,6 +593,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
/**
* @since GemFire 4.3
*/
+ @Test
public void testDynamicRegionFactoryDefault() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config());
@@ -593,6 +612,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
}
}
+ @Test
public void testDynamicRegionFactoryNonDefault() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setDynamicRegionFactoryConfig(new DynamicRegionFactory.Config((File)null, null, false, false));
@@ -615,6 +635,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
/**
* @since GemFire 4.3
*/
+ @Test
public void testDynamicRegionFactoryDiskDir() throws CacheException {
CacheCreation cache = new CacheCreation();
File f = new File("diskDir");
@@ -636,6 +657,7 @@ public class CacheXml41DUnitTest extends CacheXml40DUnitTest
/**
* Remove this override when bug #52052 is fixed.
*/
+ @Test
public void testExampleCacheXmlFile() {
return;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
index a6705ee..1662dfe 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml45DUnitTest.java
@@ -16,8 +16,40 @@
*/
package com.gemstone.gemfire.cache30;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+
import com.company.app.DBLoader;
-import com.gemstone.gemfire.cache.*;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.AttributesMutator;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.CacheTransactionManager;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Declarable;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.InterestPolicy;
+import com.gemstone.gemfire.cache.LossAction;
+import com.gemstone.gemfire.cache.MembershipAttributes;
+import com.gemstone.gemfire.cache.MirrorType;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.ResumptionAction;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.SubscriptionAttributes;
+import com.gemstone.gemfire.cache.TransactionListener;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.internal.cache.DistributedRegion;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
@@ -26,13 +58,7 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
-
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests the declarative caching functionality introduced in GemFire
@@ -40,30 +66,20 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
*
* @since GemFire 5.0
*/
+@Category(DistributedTest.class)
public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
- //////// Constructors
-
- public CacheXml45DUnitTest(String name) {
- super(name);
- }
-
- //////// Helper methods
-
protected String getGemFireVersion() {
return CacheXml.VERSION_5_0;
}
- //////// Test methods
-
-
-
public void setBridgeAttributes(CacheServer bridge1)
{
super.setBridgeAttributes(bridge1);
bridge1.setMaxConnections(100);
}
+ @Test
public void testDataPolicy() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -125,6 +141,7 @@ public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
/**
* Test xml support of MembershipAttributes.
*/
+ @Test
public void testMembershipAttributes() throws Exception {
final String MY_ROLES = "Foo, Bip, BAM";
final String[][] roles = new String[][] {{"Foo"}, {"Bip", "BAM"}};
@@ -184,6 +201,7 @@ public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
* Tests multiple cache listeners on one region
* @since GemFire 5.0
*/
+ @Test
public void testMultipleCacheListener() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -234,6 +252,7 @@ public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
}
}
+ @Test
public void testHeapLRUEviction() throws Exception {
final String name = getUniqueName();
beginCacheXml();
@@ -254,6 +273,7 @@ public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
* Tests multiple transaction listeners
* @since GemFire 5.0
*/
+ @Test
public void testMultipleTXListener() throws CacheException {
CacheCreation cache = new CacheCreation();
CacheTransactionManagerCreation txMgrCreation = new CacheTransactionManagerCreation();
@@ -303,6 +323,7 @@ public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
* Tests that a region created with a named attributes has the correct
* attributes.
*/
+ @Test
public void testPartitionedRegionXML() throws CacheException
{
setXmlFile(findFile("partitionedRegion.xml"));
@@ -376,6 +397,7 @@ public class CacheXml45DUnitTest extends CacheXml41DUnitTest {
* attributes.
*
*/
+ @Test
public void testPartitionedRegionInstantiation() throws CacheException
{
CacheCreation cache = new CacheCreation();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java
index 47f3825..ea258dd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml51DUnitTest.java
@@ -16,15 +16,31 @@
*/
package com.gemstone.gemfire.cache30;
-import com.gemstone.gemfire.cache.*;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskWriteAttributesFactory;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.internal.AvailablePortHelper;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
-import com.gemstone.gemfire.internal.cache.DiskWriteAttributesImpl;
-import com.gemstone.gemfire.internal.cache.xmlcache.*;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.internal.cache.xmlcache.RegionCreation;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests the declarative caching functionality introduced in the GemFire
@@ -33,13 +49,14 @@ import com.gemstone.gemfire.test.dunit.VM;
* @since GemFire 5.0
*/
+@Category(DistributedTest.class)
public class CacheXml51DUnitTest extends CacheXml45DUnitTest
{
// ////// Constructors
- public CacheXml51DUnitTest(String name) {
- super(name);
+ public CacheXml51DUnitTest() {
+ super();
}
// ////// Helper methods
@@ -53,6 +70,7 @@ public class CacheXml51DUnitTest extends CacheXml45DUnitTest
* Tests that a region created with a named attributes has the correct
* attributes.
*/
+ @Test
public void testPartitionedRegionXML() throws CacheException
{
setXmlFile(findFile("partitionedRegion51.xml"));
@@ -133,7 +151,8 @@ public class CacheXml51DUnitTest extends CacheXml45DUnitTest
*
* @throws CacheException
*/
-public void testMessageSyncInterval() throws CacheException {
+ @Test
+ public void testMessageSyncInterval() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setMessageSyncInterval(123);
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -152,7 +171,8 @@ public void testMessageSyncInterval() throws CacheException {
*
* @throws CacheException
*/
-public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException {
+ @Test
+ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setMessageSyncInterval(3445);
CacheServer bs = cache.addCacheServer();
@@ -182,6 +202,7 @@ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException
* the functionality for future comparisons (by hand of course). -- Mitch
* Thomas 01/18/2006
*/
+ @Test
public void testPartitionedRegionInstantiation() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -201,6 +222,7 @@ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException
*
* @throws CacheException
*/
+ @Test
public void testBridgeMaxThreads()
throws CacheException
{
@@ -219,6 +241,7 @@ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException
/**
* Tests that loading cache XML with multi-cast set will set the multi-cast
*/
+ @Test
public void testRegionMulticastSetViaCacheXml() throws CacheException
{
final String rNameBase = getUniqueName();
@@ -284,6 +307,7 @@ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException
}
}
+ @Test
public void testRollOplogs() throws CacheException {
CacheCreation cache = new CacheCreation();
// Set properties for Asynch writes
@@ -316,6 +340,7 @@ public void testBridgeAttributesRelatedToClientQueuesHA() throws CacheException
testXml(cache);
}
+ @Test
public void testMaxOplogSize() throws CacheException {
CacheCreation cache = new CacheCreation();
// Set properties for Asynch writes
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml55DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml55DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml55DUnitTest.java
index 315567f..d6387d6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml55DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml55DUnitTest.java
@@ -16,8 +16,12 @@
*/
package com.gemstone.gemfire.cache30;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests the declarative caching functionality introduced in the GemFire
@@ -26,13 +30,14 @@ import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
* @since GemFire 5.0
*/
+@Category(DistributedTest.class)
public class CacheXml55DUnitTest extends CacheXml51DUnitTest
{
// ////// Constructors
- public CacheXml55DUnitTest(String name) {
- super(name);
+ public CacheXml55DUnitTest() {
+ super();
}
// ////// Helper methods
@@ -46,6 +51,7 @@ public class CacheXml55DUnitTest extends CacheXml51DUnitTest
* Tests that a region created with a named attributes has the correct
* attributes.
*/
+ @Test
public void testEmpty() throws CacheException
{}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
index 2cb61f8..84a25cb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml57DUnitTest.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.cache30;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import java.net.InetAddress;
import java.net.InetSocketAddress;
@@ -23,6 +25,9 @@ import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.CustomExpiry;
@@ -53,58 +58,40 @@ import com.gemstone.gemfire.internal.cache.xmlcache.Declarable2;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
+import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.NetworkUtils;
-import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.SerializableCallable;
import com.gemstone.gemfire.test.dunit.VM;
-
-import junit.framework.Assert;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests 5.7 cache.xml features.
*
* @since GemFire 5.7
*/
+@Category(DistributedTest.class)
+public class CacheXml57DUnitTest extends CacheXml55DUnitTest {
-public class CacheXml57DUnitTest extends CacheXml55DUnitTest
-{
- //
private final static String ALIAS1;
private final static String ALIAS2;
static {
String tmp_alias1 = "localhost";
String tmp_alias2 = "localhost";
-// try {
-// tmp_alias1 = getServerHostName(Host.getHost(0));
-// InetSocketAddress addr = createINSA(tmp_alias1, 10000);
-// tmp_alias2 = addr.getHostName();
-// } catch (IllegalArgumentException suppress) {
-// //The runnables dont have a Host object initialized, but they dont need
-// //access to the aliases so its ok to suppress this.
-// } finally {
- ALIAS1 = tmp_alias1;
- ALIAS2 = tmp_alias2;
-// }
+ ALIAS1 = tmp_alias1;
+ ALIAS2 = tmp_alias2;
}
- // ////// Constructors
-
- public CacheXml57DUnitTest(String name) {
- super(name);
- }
-
- // ////// Helper methods
-
- protected String getGemFireVersion()
- {
+ @Override
+ protected String getGemFireVersion() {
return CacheXml.VERSION_5_7;
}
/**
* Tests the groups subelement on bridge-server.
*/
+ @Test
public void testDefaultCacheServerGroups() throws CacheException {
CacheCreation cache = new CacheCreation();
CacheServer bs = cache.addCacheServer();
@@ -117,6 +104,8 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertNotNull(server);
assertEquals(CacheServer.DEFAULT_GROUPS, server.getGroups());
}
+
+ @Test
public void testOneCacheServerGroups() throws CacheException {
CacheCreation cache = new CacheCreation();
CacheServer bs = cache.addCacheServer();
@@ -130,6 +119,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertNotNull(server);
assertEquals(Arrays.asList(groups), Arrays.asList(server.getGroups()));
}
+ @Test
public void testTwoCacheServerGroups() throws CacheException {
CacheCreation cache = new CacheCreation();
CacheServer bs = cache.addCacheServer();
@@ -143,6 +133,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertNotNull(server);
assertEquals(Arrays.asList(groups), Arrays.asList(server.getGroups()));
}
+ @Test
public void testDefaultCacheServerBindAddress() throws CacheException {
CacheCreation cache = new CacheCreation();
CacheServer bs = cache.addCacheServer();
@@ -154,6 +145,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertNotNull(server);
assertEquals(CacheServer.DEFAULT_BIND_ADDRESS, server.getBindAddress());
}
+ @Test
public void testCacheServerBindAddress() throws CacheException {
CacheCreation cache = new CacheCreation();
CacheServer bs = cache.addCacheServer();
@@ -167,6 +159,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertNotNull(server);
assertEquals(BA, server.getBindAddress());
}
+ @Test
public void testCacheServerHostnameForClients() throws CacheException {
CacheCreation cache = new CacheCreation();
CacheServer bs = cache.addCacheServer();
@@ -182,6 +175,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertEquals(BA, server.getBindAddress());
assertEquals("clientHostName", server.getHostnameForClients());
}
+ @Test
public void testExplicitConnectionPool() throws CacheException {
getSystem();
CacheCreation cache = new CacheCreation();
@@ -239,6 +233,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertEquals(12345, cp.getSubscriptionMessageTrackingTimeout());
assertEquals(333, cp.getSubscriptionAckInterval());
}
+ @Test
public void testDefaultConnectionPool() throws CacheException {
getSystem();
CacheCreation cache = new CacheCreation();
@@ -276,6 +271,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertEquals(PoolFactory.DEFAULT_SUBSCRIPTION_MESSAGE_TRACKING_TIMEOUT, cp.getSubscriptionMessageTrackingTimeout());
assertEquals(PoolFactory.DEFAULT_SUBSCRIPTION_ACK_INTERVAL, cp.getSubscriptionAckInterval());
}
+ @Test
public void testTwoConnectionPools() throws CacheException {
getSystem();
CacheCreation cache = new CacheCreation();
@@ -322,6 +318,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
throw ex;
}
}
+ @Test
public void testNoConnectionPools() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -336,6 +333,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
expectedException.remove();
}
}
+ @Test
public void testAlreadyExistingPool() throws CacheException {
getSystem();
PoolFactoryImpl f = (PoolFactoryImpl)
@@ -358,6 +356,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
}
}
+ @Test
public void testDynamicRegionFactoryConnectionPool() throws CacheException, IOException {
IgnoredException.addIgnoredException("Connection reset");
IgnoredException.addIgnoredException("SocketTimeoutException");
@@ -407,6 +406,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
* @throws CacheException
* @since GemFire 5.7
*/
+ @Test
public void testBridgeAttributesRelatedToHAOverFlow() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setMessageSyncInterval(3445);
@@ -438,6 +438,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
assertEquals("overFlow", chaqf.getOverflowDirectory());
}
+ @Test
public void testBridgeLoadProbe() {
CacheCreation cache = new CacheCreation();
CacheServer server = cache.addCacheServer();
@@ -448,9 +449,10 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
Cache c= getCache();
server = c.getCacheServers().get(0);
- Assert.assertEquals(MyLoadProbe.class,server.getLoadProbe().getClass());
+ assertEquals(MyLoadProbe.class,server.getLoadProbe().getClass());
}
+ @Test
public void testLoadPollInterval() {
CacheCreation cache = new CacheCreation();
CacheServer server = cache.addCacheServer();
@@ -461,7 +463,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
Cache c = getCache();
server = c.getCacheServers().get(0);
- Assert.assertEquals(12345, server.getLoadPollInterval());
+ assertEquals(12345, server.getLoadPollInterval());
}
public static class MyLoadProbe extends ServerLoadProbeAdapter implements Declarable {
@@ -550,6 +552,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
/**
* Test both customEntryIdleTime and customEntryTimeToLife
*/
+ @Test
public void testCustomEntryXml() {
CacheCreation cache = new CacheCreation();
@@ -595,6 +598,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
testXml(cache);
}
+ @Test
public void testPreloadDataPolicy() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -645,6 +649,7 @@ public class CacheXml57DUnitTest extends CacheXml55DUnitTest
* Test EnableSubscriptionConflation region attribute
* @since GemFire 5.7
*/
+ @Test
public void testEnableSubscriptionConflationAttribute() throws CacheException {
CacheCreation cache = new CacheCreation();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java
index f61158f..aaf3251 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml58DUnitTest.java
@@ -16,13 +16,17 @@
*/
package com.gemstone.gemfire.cache30;
+import static org.junit.Assert.*;
+
import java.util.Map;
import java.util.Properties;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheException;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.DiskWriteAttributesFactory;
import com.gemstone.gemfire.cache.EvictionAction;
@@ -36,15 +40,14 @@ import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.execute.Function;
import com.gemstone.gemfire.cache.execute.FunctionService;
-import com.gemstone.gemfire.cache.util.ObjectSizerImpl;
-import com.gemstone.gemfire.internal.cache.DistributedRegion;
-import com.gemstone.gemfire.internal.cache.functions.*;
+import com.gemstone.gemfire.internal.cache.functions.TestFunction;
import com.gemstone.gemfire.internal.cache.lru.MemLRUCapacityController;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.FunctionServiceCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests 5.8 cache.xml features.
@@ -52,13 +55,14 @@ import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation;
* @since GemFire 5.8
*/
+@Category(DistributedTest.class)
public class CacheXml58DUnitTest extends CacheXml57DUnitTest
{
// ////// Constructors
- public CacheXml58DUnitTest(String name) {
- super(name);
+ public CacheXml58DUnitTest() {
+ super();
}
// ////// Helper methods
@@ -74,6 +78,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
* for partition-resolver has the correct attributes.
*
*/
+ @Test
public void testPartitionedRegionAttributesForCustomPartitioning() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -124,6 +129,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
* has correct registered Function
*
*/
+ @Test
public void testCacheCreationWithFuntionService() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -152,6 +158,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
* for ExpirationAttributes
*
*/
+ @Test
public void testPartitionedRegionAttributesForExpiration() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -218,6 +225,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
* for ExpirationAttributes
*
*/
+ @Test
public void testPartitionedRegionAttributesForEviction() throws CacheException
{
final int redundantCopies = 1;
@@ -311,6 +319,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
assertEquals(ea.getAction(), EvictionAction.OVERFLOW_TO_DISK);
}
+ @Test
public void testPartitionedRegionAttributesForCoLocation(){
closeCache();
CacheCreation cache = new CacheCreation();
@@ -345,6 +354,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
}
+ @Test
public void testPartitionedRegionAttributesForCoLocation2(){
closeCache();
setXmlFile(findFile("coLocation.xml"));
@@ -360,6 +370,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
}
+ @Test
public void testPartitionedRegionAttributesForMemLruWithoutMaxMem() throws CacheException
{
final int redundantCopies = 1;
@@ -401,6 +412,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
assertEquals(ea.getMaximum(), pa.getLocalMaxMemory());
}
+ @Test
public void testPartitionedRegionAttributesForMemLruWithMaxMem() throws CacheException
{
final int redundantCopies = 1;
@@ -444,6 +456,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
assertEquals(ea.getMaximum(), pa.getLocalMaxMemory());
}
+ @Test
public void testReplicatedRegionAttributesForMemLruWithoutMaxMem() throws CacheException
{
final int redundantCopies = 1;
@@ -472,6 +485,7 @@ public class CacheXml58DUnitTest extends CacheXml57DUnitTest
assertEquals(ea.getMaximum(), MemLRUCapacityController.DEFAULT_MAXIMUM_MEGABYTES);
}
+ @Test
public void testReplicatedRegionAttributesForMemLruWithMaxMem() throws CacheException
{
final int redundantCopies = 1;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java
index 992956a..bd30e07 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml60DUnitTest.java
@@ -16,11 +16,16 @@
*/
package com.gemstone.gemfire.cache30;
+import static org.junit.Assert.*;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.io.Serializable;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.cache.Cache;
@@ -38,6 +43,7 @@ import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.SerializerCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests 6.0 cache.xml features.
@@ -45,13 +51,14 @@ import com.gemstone.gemfire.test.dunit.IgnoredException;
* @since GemFire 6.0
*/
+@Category(DistributedTest.class)
public class CacheXml60DUnitTest extends CacheXml58DUnitTest
{
// ////// Constructors
- public CacheXml60DUnitTest(String name) {
- super(name);
+ public CacheXml60DUnitTest() {
+ super();
}
// ////// Helper methods
@@ -67,6 +74,7 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
* for recovery-delay has the correct attributes.
*
*/
+ @Test
public void testRecoveryDelayAttributes() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -113,6 +121,7 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
* for recovery-delay has the correct attributes.
*
*/
+ @Test
public void testDefaultRecoveryDelayAttributes() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -156,6 +165,7 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
* eviction-heap-percentage attributes
* @throws Exception
*/
+ @Test
public void testResourceManagerThresholds() throws Exception {
CacheCreation cache = new CacheCreation();
final float low = 90.0f;
@@ -169,8 +179,8 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
testXml(cache);
{
c = getCache();
- assertEquals(low, c.getResourceManager().getEvictionHeapPercentage());
- assertEquals(high, c.getResourceManager().getCriticalHeapPercentage());
+ assertEquals(low, c.getResourceManager().getEvictionHeapPercentage(),0);
+ assertEquals(high, c.getResourceManager().getCriticalHeapPercentage(),0);
}
closeCache();
@@ -182,8 +192,8 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
testXml(cache);
{
c = getCache();
- assertEquals(low, c.getResourceManager().getEvictionHeapPercentage());
- assertEquals(low + 1, c.getResourceManager().getCriticalHeapPercentage());
+ assertEquals(low, c.getResourceManager().getEvictionHeapPercentage(),0);
+ assertEquals(low + 1, c.getResourceManager().getCriticalHeapPercentage(),0);
}
closeCache();
@@ -209,8 +219,8 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
testXml(cache);
{
c = getCache();
- assertEquals(0f, c.getResourceManager().getEvictionHeapPercentage());
- assertEquals(low, c.getResourceManager().getCriticalHeapPercentage());
+ assertEquals(0f, c.getResourceManager().getEvictionHeapPercentage(),0);
+ assertEquals(low, c.getResourceManager().getCriticalHeapPercentage(),0);
}
closeCache();
@@ -222,8 +232,8 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
testXml(cache);
{
c = getCache();
- assertEquals(low, c.getResourceManager().getEvictionHeapPercentage());
- assertEquals(0f, c.getResourceManager().getCriticalHeapPercentage());
+ assertEquals(low, c.getResourceManager().getEvictionHeapPercentage(),0);
+ assertEquals(0f, c.getResourceManager().getCriticalHeapPercentage(),0);
}
closeCache();
@@ -234,8 +244,8 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
cache.setResourceManagerCreation(rmc);
testXml(cache);
c = getCache();
- assertEquals(0f, c.getResourceManager().getEvictionHeapPercentage());
- assertEquals(0f, c.getResourceManager().getCriticalHeapPercentage());
+ assertEquals(0f, c.getResourceManager().getEvictionHeapPercentage(),0);
+ assertEquals(0f, c.getResourceManager().getCriticalHeapPercentage(),0);
}
// A bunch of classes for use in testing the serialization schtuff
@@ -286,6 +296,7 @@ public class CacheXml60DUnitTest extends CacheXml58DUnitTest
{return false;}
}
+ @Test
public void testSerializationRegistration()
{
CacheCreation cc = new CacheCreation();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml61DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml61DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml61DUnitTest.java
index 5bbdc59..424cc01 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml61DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml61DUnitTest.java
@@ -16,56 +16,29 @@
*/
package com.gemstone.gemfire.cache30;
-import java.util.Properties;
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
-import com.gemstone.gemfire.DataSerializable;
-import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
-import com.gemstone.gemfire.cache.PartitionAttributes;
-import com.gemstone.gemfire.cache.PartitionAttributesFactory;
-import com.gemstone.gemfire.cache.PartitionResolver;
import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.cache.client.Pool;
-import com.gemstone.gemfire.cache.client.PoolFactory;
-import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.internal.InternalDataSerializer;
-import com.gemstone.gemfire.internal.InternalInstantiator;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation;
-import com.gemstone.gemfire.internal.cache.xmlcache.SerializerCreation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
-import com.gemstone.gemfire.test.dunit.Host;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests 6.1 cache.xml features.
*
* @since GemFire 6.1
*/
-
+@Category(DistributedTest.class)
public class CacheXml61DUnitTest extends CacheXml60DUnitTest {
- // ////// Constructors
-
- public CacheXml61DUnitTest(String name) {
- super(name);
- }
-
- // ////// Helper methods
-
protected String getGemFireVersion()
{
return CacheXml.VERSION_6_1;
@@ -77,6 +50,7 @@ public class CacheXml61DUnitTest extends CacheXml60DUnitTest {
* for delta propogation has the correct attributes.
*
*/
+ @Test
public void testRegionAttributesForRegionEntryCloning() throws CacheException
{
final String rNameBase = getUniqueName();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java
index 7ad424a..a957796 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml65DUnitTest.java
@@ -20,6 +20,8 @@
*/
package com.gemstone.gemfire.cache30;
+import static org.junit.Assert.*;
+
import java.io.File;
import java.io.IOException;
import java.net.InetAddress;
@@ -27,6 +29,9 @@ import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -62,12 +67,14 @@ import com.gemstone.gemfire.internal.cache.xmlcache.ResourceManagerCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests 6.5 cache.xml features.
*
* @since GemFire 6.5
*/
+@Category(DistributedTest.class)
public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
private final static String ALIAS1;
@@ -106,8 +113,8 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
}
// ////// Constructors
- public CacheXml65DUnitTest(String name) {
- super(name);
+ public CacheXml65DUnitTest() {
+ super();
}
// ////// Helper methods
@@ -120,6 +127,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
* test for checking default value of PR_Single_Hop feature.
* Test for checking default value of multiuser-authentication attribute.
*/
+ @Test
public void testDefaultConnectionPool() throws CacheException {
getSystem();
CacheCreation cache = new CacheCreation();
@@ -171,6 +179,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
.getMultiuserAuthentication());
}
+ @Test
public void testDiskStore() throws CacheException {
CacheCreation cache = new CacheCreation();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -224,6 +233,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
* test for enabling PRsingleHop feature.
* Test for enabling multiuser-authentication attribute.
*/
+ @Test
public void testExplicitConnectionPool() throws CacheException {
getSystem();
CacheCreation cache = new CacheCreation();
@@ -282,6 +292,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(true, cp.getMultiuserAuthentication());
}
+ @Test
public void testDiskStoreValidation() throws CacheException {
CacheCreation cache = new CacheCreation();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -342,6 +353,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
testXml(cache);
}
+ @Test
public void testDiskStoreFactory() throws CacheException {
CacheCreation cache = new CacheCreation();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -403,6 +415,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
testXml(cache);
}
+ @Test
public void testRedefineOfDefaultDiskStore() throws CacheException {
CacheCreation cache = new CacheCreation();
DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -435,6 +448,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
/**
* Make sure you can create a persistent partitioned region from xml.
*/
+ @Test
public void testPersistentPartition() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -458,6 +472,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
region.localDestroyRegion();
}
+ @Test
public void testBridgeAttributesRelatedToHAOverFlow65() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setMessageSyncInterval(3445);
@@ -505,6 +520,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals("overFlow", dsi.getDiskDirs()[0].toString());
}
+ @Test
public void testClientSubscriptionQueueUsingDefaultDS() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setMessageSyncInterval(3445);
@@ -543,6 +559,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
* for delta propogation has the correct attributes.
*
*/
+ @Test
public void testTransactionWriter() throws CacheException
{
CacheCreation creation = new CacheCreation();
@@ -563,6 +580,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
/**
* Tests that a region created with a named attributes with diskstore
*/
+ @Test
public void testDiskStoreInTemplates() throws CacheException
{
File dir = new File("west");
@@ -628,6 +646,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(DataPolicy.PERSISTENT_PARTITION, attrs.getDataPolicy());
}
+ @Test
public void testBackupFiles() throws CacheException
{
CacheCreation cache = new CacheCreation();
@@ -640,6 +659,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Arrays.asList(new File[] {backup1, backup2}), c.getBackupFiles());
}
+ @Test
public void testClientCache() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
cache.setCopyOnRead(true);
@@ -653,6 +673,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(ClientRegionShortcut.values().length,
c.listRegionAttributes().size());
}
+ @Test
public void testNormalCache() throws CacheException {
CacheCreation cache = new CacheCreation();
cache.setCopyOnRead(true);
@@ -666,6 +687,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(RegionShortcut.values().length,
c.listRegionAttributes().size());
}
+ @Test
public void testPARTITION() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -679,6 +701,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertNotNull(ra.getPartitionAttributes());
assertEquals(0, ra.getPartitionAttributes().getRedundantCopies());
}
+ @Test
public void testPARTITION_REDUNDANT() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -692,6 +715,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertNotNull(ra.getPartitionAttributes());
assertEquals(1, ra.getPartitionAttributes().getRedundantCopies());
}
+ @Test
public void testPARTITION_PERSISTENT() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -705,6 +729,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertNotNull(ra.getPartitionAttributes());
assertEquals(0, ra.getPartitionAttributes().getRedundantCopies());
}
+ @Test
public void testPARTITION_REDUNDANT_PERSISTENT() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -718,6 +743,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertNotNull(ra.getPartitionAttributes());
assertEquals(1, ra.getPartitionAttributes().getRedundantCopies());
}
+ @Test
public void testPARTITION_OVERFLOW() throws CacheException {
CacheCreation cache = new CacheCreation();
ResourceManagerCreation rmc = new ResourceManagerCreation();
@@ -736,10 +762,11 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(0, ra.getPartitionAttributes().getRedundantCopies());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(55.0f,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
assertEquals(80.0f,
- c.getResourceManager().getCriticalHeapPercentage());
+ c.getResourceManager().getCriticalHeapPercentage(),0);
}
+ @Test
public void testPARTITION_REDUNDANT_OVERFLOW() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -754,8 +781,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(1, ra.getPartitionAttributes().getRedundantCopies());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testPARTITION_PERSISTENT_OVERFLOW() throws CacheException {
CacheCreation cache = new CacheCreation();
ResourceManagerCreation rmc = new ResourceManagerCreation();
@@ -773,10 +801,11 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(0, ra.getPartitionAttributes().getRedundantCopies());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(80.0f,
- c.getResourceManager().getCriticalHeapPercentage());
+ c.getResourceManager().getCriticalHeapPercentage(),0);
assertEquals(75.0f,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testPARTITION_REDUNDANT_PERSISTENT_OVERFLOW() throws CacheException {
CacheCreation cache = new CacheCreation();
ResourceManagerCreation rmc = new ResourceManagerCreation();
@@ -794,8 +823,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(1, ra.getPartitionAttributes().getRedundantCopies());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(0.0f,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testPARTITION_HEAP_LRU() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -810,8 +840,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(0, ra.getPartitionAttributes().getRedundantCopies());
assertEquals(EvictionAttributes.createLRUHeapAttributes(), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testPARTITION_REDUNDANT_HEAP_LRU() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -826,9 +857,10 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(1, ra.getPartitionAttributes().getRedundantCopies());
assertEquals(EvictionAttributes.createLRUHeapAttributes(), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testREPLICATE() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -841,6 +873,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(DataPolicy.REPLICATE, ra.getDataPolicy());
assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope());
}
+ @Test
public void testREPLICATE_PERSISTENT() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -853,6 +886,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(DataPolicy.PERSISTENT_REPLICATE, ra.getDataPolicy());
assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope());
}
+ @Test
public void testREPLICATE_OVERFLOW() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -866,8 +900,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testREPLICATE_PERSISTENT_OVERFLOW() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -881,8 +916,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testREPLICATE_HEAP_LRU() throws CacheException, IOException
{
CacheCreation cache = new CacheCreation();
@@ -899,8 +935,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope());
assertEquals(EvictionAttributes.createLRUHeapAttributes(), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testLOCAL() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -913,6 +950,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(DataPolicy.NORMAL, ra.getDataPolicy());
assertEquals(Scope.LOCAL, ra.getScope());
}
+ @Test
public void testLOCAL_PERSISTENT() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -925,6 +963,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(DataPolicy.PERSISTENT_REPLICATE, ra.getDataPolicy());
assertEquals(Scope.LOCAL, ra.getScope());
}
+ @Test
public void testLOCAL_HEAP_LRU() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -938,8 +977,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(EvictionAttributes.createLRUHeapAttributes(), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testLOCAL_OVERFLOW() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -953,8 +993,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testLOCAL_PERSISTENT_OVERFLOW() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -968,9 +1009,10 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testPARTITION_PROXY() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -985,6 +1027,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(0, ra.getPartitionAttributes().getRedundantCopies());
assertEquals(0, ra.getPartitionAttributes().getLocalMaxMemory());
}
+ @Test
public void testPARTITION_PROXY_REDUNDANT() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -999,6 +1042,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(1, ra.getPartitionAttributes().getRedundantCopies());
assertEquals(0, ra.getPartitionAttributes().getLocalMaxMemory());
}
+ @Test
public void testREPLICATE_PROXY() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionCreation root = (RegionCreation)
@@ -1012,6 +1056,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope());
}
+ @Test
public void testPROXY() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1026,6 +1071,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals("DEFAULT", ra.getPoolName());
}
+ @Test
public void testCACHING_PROXY() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1040,6 +1086,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals("DEFAULT", ra.getPoolName());
}
+ @Test
public void testCACHING_PROXY_HEAP_LRU() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1055,8 +1102,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals("DEFAULT", ra.getPoolName());
assertEquals(EvictionAttributes.createLRUHeapAttributes(), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(), 0);
}
+ @Test
public void testCACHING_PROXY_OVERFLOW() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1072,8 +1120,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals("DEFAULT", ra.getPoolName());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testClientLOCAL() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1088,6 +1137,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(null, ra.getPoolName());
}
+ @Test
public void testClientLOCAL_HEAP_LRU() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1103,8 +1153,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(null, ra.getPoolName());
assertEquals(EvictionAttributes.createLRUHeapAttributes(), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testClientLOCAL_OVERFLOW() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1120,8 +1171,9 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(null, ra.getPoolName());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
+ @Test
public void testClientLOCAL_PERSISTENT() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1136,6 +1188,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(Scope.LOCAL, ra.getScope());
assertEquals(null, ra.getPoolName());
}
+ @Test
public void testClientLOCAL_PERSISTENT_OVERFLOW() throws CacheException {
ClientCacheCreation cache = new ClientCacheCreation();
RegionCreation root = (RegionCreation)
@@ -1151,7 +1204,7 @@ public class CacheXml65DUnitTest extends CacheXml61DUnitTest {
assertEquals(null, ra.getPoolName());
assertEquals(EvictionAttributes.createLRUHeapAttributes(null, EvictionAction.OVERFLOW_TO_DISK), ra.getEvictionAttributes());
assertEquals(LocalRegion.DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE,
- c.getResourceManager().getEvictionHeapPercentage());
+ c.getResourceManager().getEvictionHeapPercentage(),0);
}
// @todo add some tests to make sure the new smarter region-attribut defaults work from xml
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java
index 8600214..6e4271d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml66DUnitTest.java
@@ -16,10 +16,15 @@
*/
package com.gemstone.gemfire.cache30;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.CacheFactory;
@@ -43,18 +48,20 @@ import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests 7.0 cache.xml feature : Fixed Partitioning.
*
* @since GemFire 6.6
*/
+@Category(DistributedTest.class)
public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
//////// Constructors
- public CacheXml66DUnitTest(String name) {
- super(name);
+ public CacheXml66DUnitTest() {
+ super();
}
// ////// Helper methods
@@ -71,6 +78,7 @@ public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
* FixedPartitionAttributes
*
*/
+ @Test
public void testFixedPartitioning() throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -110,6 +118,7 @@ public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
validateAttributes(region, fpattrsList, resolver, false);
}
+ @Test
public void testFixedPartitioning_colocation_WithAttributes()
throws CacheException {
CacheCreation cache = new CacheCreation();
@@ -227,6 +236,7 @@ public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
}
+ @Test
public void testPdxDefaults() {
CacheCreation creation = new CacheCreation();
testXml(creation);
@@ -242,6 +252,7 @@ public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
assertEquals(false, c.getPdxIgnoreUnreadFields());
}
+ @Test
public void testPdxAttributes() {
CacheCreation creation = new CacheCreation();
creation.setPdxPersistent(true);
@@ -329,6 +340,7 @@ public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
}
+ @Test
public void testTXManagerOnClientCache() {
ClientCacheCreation cc = new ClientCacheCreation();
//CacheCreation cc = new CacheCreation();
@@ -348,6 +360,7 @@ public class CacheXml66DUnitTest extends CacheXml65DUnitTest{
}
+ @Test
public void testNoTXWriterOnClient() {
//test writer is not created
ClientCacheCreation cc = new ClientCacheCreation();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml70DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml70DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml70DUnitTest.java
index f502396..4492aa5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml70DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/cache30/CacheXml70DUnitTest.java
@@ -20,10 +20,15 @@
*/
package com.gemstone.gemfire.cache30;
+import static org.junit.Assert.*;
+
import java.util.List;
import java.util.Properties;
import java.util.Set;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.DataPolicy;
@@ -40,15 +45,13 @@ import com.gemstone.gemfire.internal.cache.xmlcache.AsyncEventQueueCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheCreation;
import com.gemstone.gemfire.internal.cache.xmlcache.CacheXml;
import com.gemstone.gemfire.internal.cache.xmlcache.RegionAttributesCreation;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-/**
- *
- */
+@Category(DistributedTest.class)
public class CacheXml70DUnitTest extends CacheXml66DUnitTest {
- private static final long serialVersionUID = 225193925777688541L;
- public CacheXml70DUnitTest(String name) {
- super(name);
+ public CacheXml70DUnitTest() {
+ super();
}
@@ -60,6 +63,7 @@ public class CacheXml70DUnitTest extends CacheXml66DUnitTest {
}
/** make sure we can create regions with concurrencyChecksEnabled=true */
+ @Test
public void testConcurrencyChecksEnabled() throws CacheException {
CacheCreation cache = new CacheCreation();
RegionAttributesCreation attrs = new RegionAttributesCreation(cache);
@@ -110,6 +114,7 @@ public class CacheXml70DUnitTest extends CacheXml66DUnitTest {
region.localDestroyRegion();
}
+ @Test
public void testAsyncEventQueue() {
getSystem();
CacheCreation cache = new CacheCreation();
@@ -143,6 +148,7 @@ public class CacheXml70DUnitTest extends CacheXml66DUnitTest {
}
}
+ @Test
public void testConcurrentAsyncEventQueue() {
getSystem();
CacheCreation cache = new CacheCreation();
@@ -179,6 +185,7 @@ public class CacheXml70DUnitTest extends CacheXml66DUnitTest {
/**
* Added to test the scenario of defect #50600.
*/
+ @Test
public void testAsyncEventQueueWithGatewayEventFilter() {
getSystem();
CacheCreation cache = new CacheCreation();
@@ -257,6 +264,7 @@ public class CacheXml70DUnitTest extends CacheXml66DUnitTest {
}
// test bug 47197
+ @Test
public void testPartitionedRegionAttributesForCoLocation3(){
closeCache();
setXmlFile(findFile("coLocation3.xml"));
@@ -271,6 +279,7 @@ public class CacheXml70DUnitTest extends CacheXml66DUnitTest {
assertTrue(order.getAttributes().getPartitionAttributes().getColocatedWith().equals("Customer"));
}
+ @Test
public void testBug44710() {
closeCache();
setXmlFile(findFile("bug44710.xml"));