You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/06/09 20:14:58 UTC
[30/70] [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/internal/cache/DiskRegionTestingBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionTestingBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionTestingBase.java
index edcc089..4c1434f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionTestingBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskRegionTestingBase.java
@@ -21,18 +21,7 @@
package com.gemstone.gemfire.internal.cache;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-import com.gemstone.gemfire.LogWriter;
-import com.gemstone.gemfire.SystemFailure;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.FileUtil;
-import com.gemstone.gemfire.internal.cache.LocalRegion.NonTXEntry;
-import com.gemstone.gemfire.internal.cache.versions.VersionTag;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.rules.TestName;
+import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
@@ -40,42 +29,53 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Properties;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.LogWriter;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.CacheTransactionManager;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionDestroyedException;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.FileUtil;
+import com.gemstone.gemfire.internal.cache.LocalRegion.NonTXEntry;
+import com.gemstone.gemfire.internal.cache.versions.VersionTag;
/**
* All disk region unit tests extend this base class , common method to be used in
* all tests are present here.
*
* @since GemFire 5.1
- *
*/
-public class DiskRegionTestingBase
-{
- @Rule public TestName name = new TestName();
-
- boolean testFailed = false;
- String failureCause = "";
- protected static Cache cache = null;
+public abstract class DiskRegionTestingBase {
+
+ protected static final boolean debug = false;
+ protected static Cache cache = null;
protected static DistributedSystem ds = null;
protected static Properties props = new Properties();
-
protected static File[] dirs = null;
-
protected static int[] diskDirSize = null;
- protected Region region = null;
-
- protected static final boolean debug = false;
-
+ protected Region region;
protected LogWriter logWriter;
+ boolean testFailed;
+ String failureCause = "";
+
+ @Rule
+ public TestName name = new TestName();
@Before
- public void setUp() throws Exception
- {
+ public final void setUp() throws Exception {
+ preSetUp();
+
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
props.setProperty(LOG_LEVEL, "config"); // to keep diskPerf logs smaller
@@ -116,14 +116,20 @@ public class DiskRegionTestingBase
deleteFiles();
DiskStoreImpl.SET_IGNORE_PREALLOCATE = true;
+
+ postSetUp();
+ }
+
+ protected void preSetUp() throws Exception {
+ }
+
+ protected void postSetUp() throws Exception {
}
@After
- public void tearDown() throws Exception
- {
- /*if (cache != null && !cache.isClosed()) {
- cache.close();
- }*/
+ public final void tearDown() throws Exception {
+ preTearDown();
+
try {
if (cache != null && !cache.isClosed()) {
for (Iterator itr = cache.rootRegions().iterator(); itr.hasNext();) {
@@ -139,13 +145,6 @@ public class DiskRegionTestingBase
catch (RegionDestroyedException e) {
// ignore
}
- catch (VirtualMachineError e) {
- SystemFailure.initiateFailure(e);
- throw e;
- }
- catch (Throwable t) {
- logWriter.error(t);
- }
}
}
@@ -154,22 +153,20 @@ public class DiskRegionTestingBase
}
}
finally {
- try {
- closeCache();
- }
- catch (VirtualMachineError e) {
- SystemFailure.initiateFailure(e);
- throw e;
- }
- catch (Throwable t) {
- logWriter.error("Error in closing the cache ", t);
-
- }
+ closeCache();
}
ds.disconnect();
//Asif : below is not needed but leave it
deleteFiles();
DiskStoreImpl.SET_IGNORE_PREALLOCATE = false;
+
+ postTearDown();
+ }
+
+ protected void preTearDown() throws Exception {
+ }
+
+ protected void postTearDown() throws Exception {
}
protected Cache createCache() {
@@ -202,8 +199,7 @@ public class DiskRegionTestingBase
/**
* cleans all the directory of all the files present in them
*/
- protected static void deleteFiles()
- {
+ protected static void deleteFiles() {
closeDiskStores();
for (int i = 0; i < dirs.length; i++) {
System.out.println("trying to delete files in " + dirs[i].getAbsolutePath());
@@ -230,7 +226,6 @@ public class DiskRegionTestingBase
}
}
}
-
}
protected static void closeDiskStores() {
@@ -243,34 +238,30 @@ public class DiskRegionTestingBase
* clears and closes the region
*
*/
-
- protected void closeDown()
- {
- try{
- if(!region.isDestroyed()) {
+ protected void closeDown() {
+ try {
+ if (!region.isDestroyed()) {
region.destroyRegion();
}
- }catch(Exception e) {
+ } catch(Exception e) {
this.logWriter.error("DiskRegionTestingBase::closeDown:Exception in destroyiong the region",e);
}
}
/**
* puts a 100 integers into the region
- *
*/
- protected void put100Int()
- {
+ protected void put100Int() {
for (int i = 0; i < 100; i++) {
region.put(new Integer(i), new Integer(i));
}
}
+
protected void verify100Int() {
verify100Int(true);
}
- protected void verify100Int(boolean verifySize)
- {
+ protected void verify100Int(boolean verifySize) {
if (verifySize) {
assertEquals(100,region.size());
}
@@ -283,31 +274,26 @@ public class DiskRegionTestingBase
/**
* will keep on putting till region overflows
- *
*/
- protected void putTillOverFlow(Region region)
- {
+ protected void putTillOverFlow(Region region) {
int i = 0;
for (i = 0; i < 1010; i++) {
region.put(new Integer(i + 200), new Integer(i + 200));
}
}
- /*
+ /**
* put an entry
- *
*/
- protected void putForValidation(Region region)
- {
+ protected void putForValidation(Region region) {
final byte[] value = new byte[1024];
region.put("testKey", value);
}
- /*
+ /**
* get val from disk
*/
- protected void validatePut(Region region)
- {
+ protected void validatePut(Region region) {
// flush data to disk
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
@@ -316,9 +302,7 @@ public class DiskRegionTestingBase
catch (Exception ex) {
ex.printStackTrace();
fail("Failed to get the value on disk");
-
}
-
}
protected HashMap<String, VersionTag> saveVersionTags(LocalRegion region) {
@@ -345,17 +329,15 @@ public class DiskRegionTestingBase
}
}
- /** Since these are not visible to cache.diskPerf we add wrapper methods to
+ /**
+ * Since these are not visible to cache.diskPerf we add wrapper methods to
* make the following parameters/visible
- *
*/
- public static void setCacheObserverCallBack()
- {
+ public static void setCacheObserverCallBack() {
LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
}
- public static void unSetCacheObserverCallBack()
- {
+ public static void unSetCacheObserverCallBack() {
LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskStoreFactoryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskStoreFactoryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskStoreFactoryJUnitTest.java
index 7a8a3d5..8993d3d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskStoreFactoryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DiskStoreFactoryJUnitTest.java
@@ -16,35 +16,40 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.io.File;
import java.io.FilenameFilter;
import java.util.Arrays;
import java.util.Properties;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-import static org.junit.Assert.*;
+import org.junit.After;
+import org.junit.Before;
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* Tests DiskStoreFactory
- *
- *
*/
@Category(IntegrationTest.class)
-public class DiskStoreFactoryJUnitTest
-{
+public class DiskStoreFactoryJUnitTest {
- protected static Cache cache = null;
+ private static Cache cache = null;
- protected static DistributedSystem ds = null;
- protected static Properties props = new Properties();
+ private static DistributedSystem ds = null;
+ private static Properties props = new Properties();
static {
props.setProperty(MCAST_PORT, "0");
@@ -60,7 +65,7 @@ public class DiskStoreFactoryJUnitTest
createCache();
}
- protected Cache createCache() {
+ private Cache createCache() {
cache = new CacheFactory(props).create();
ds = cache.getDistributedSystem();
return cache;
@@ -71,7 +76,7 @@ public class DiskStoreFactoryJUnitTest
cache.close();
}
- /*
+ /**
* Test method for
* 'com.gemstone.gemfire.cache.DiskWriteAttributes.getDefaultInstance()'
*/
@@ -188,6 +193,7 @@ public class DiskStoreFactoryJUnitTest
} catch (IllegalArgumentException expected) {
}
}
+
@Test
public void testTimeInterval() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -208,6 +214,7 @@ public class DiskStoreFactoryJUnitTest
} catch (IllegalArgumentException expected) {
}
}
+
@Test
public void testMaxOplogSize() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -234,6 +241,7 @@ public class DiskStoreFactoryJUnitTest
} catch (IllegalArgumentException expected) {
}
}
+
@Test
public void testFlush() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
@@ -348,7 +356,7 @@ public class DiskStoreFactoryJUnitTest
removeFiles(diskStore);
}
- protected void removeFiles(DiskStore diskStore) {
+ private void removeFiles(DiskStore diskStore) {
final String diskStoreName = diskStore.getName();
File[] dirs = diskStore.getDiskDirs();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java
index 7d78d69..a54218a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistrbutedRegionProfileOffHeapDUnitTest.java
@@ -16,24 +16,30 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.IgnoredException;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class DistrbutedRegionProfileOffHeapDUnitTest extends CacheTestCase {
- private static final long serialVersionUID = 1L;
-
- public DistrbutedRegionProfileOffHeapDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class DistrbutedRegionProfileOffHeapDUnitTest extends JUnit4CacheTestCase {
@Override
public final void preTearDownAssertions() throws Exception {
@@ -55,6 +61,7 @@ public class DistrbutedRegionProfileOffHeapDUnitTest extends CacheTestCase {
* region as on-heap and the other as having the region as off-heap, will
* cause an exception and the region will not be created.
*/
+ @Test
public void testPartitionedRegionProfileWithConflict() throws Exception {
final String regionName = getTestMethodName() + "Region";
@@ -110,6 +117,7 @@ public class DistrbutedRegionProfileOffHeapDUnitTest extends CacheTestCase {
* same off-heap status, will not cause an exception and the region will be
* created.
*/
+ @Test
public void testPartitionedRegionProfileWithoutConflict() throws Exception {
final String offHeapRegionName = getTestMethodName() + "OffHeapRegion";
final String onHeapRegionName = getTestMethodName() + "OnHeapRegion";
@@ -148,6 +156,7 @@ public class DistrbutedRegionProfileOffHeapDUnitTest extends CacheTestCase {
* storage and the other being on-heap without local storage, will not cause an
* exception.
*/
+ @Test
public void testPartitionedRegionProfileWithAccessor() throws Exception {
final String regionName = getTestMethodName() + "Region";
@@ -201,6 +210,7 @@ public class DistrbutedRegionProfileOffHeapDUnitTest extends CacheTestCase {
* Asserts that creating a region on two members, with one being off-heap with local
* storage and the other being a proxy will not cause an exception.
*/
+ @Test
public void testPartitionedRegionProfileWithProxy() throws Exception {
final String regionName = getTestMethodName() + "Region";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
index 4f5a3e7..acce19a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DistributedCacheTestCase.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import com.gemstone.gemfire.InternalGemFireException;
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
@@ -31,32 +33,26 @@ import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.DistributionManagerDUnitTest;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
/**
* This is the abstract superclass of tests that validate the
* functionality of GemFire's distributed caches. It provides a
* number of convenient helper classes.
*/
-public abstract class DistributedCacheTestCase
- extends DistributedTestCase {
+public abstract class DistributedCacheTestCase extends JUnit4DistributedTestCase {
/** The current cache in this VM */
protected static Cache cache = null;
- /////////////////////// Constructors ///////////////////////
-
- public DistributedCacheTestCase(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
setUpDistributedCacheTestCase(true);
}
+
/**
* Creates the {@link Cache} and root region in each remote VM
* and, if createLocalCache, in this VM.
@@ -93,7 +89,7 @@ public abstract class DistributedCacheTestCase
Assert.assertTrue(cache == null, "cache should be null");
- DistributedCacheTestCase x = new DistributedCacheTestCase("Lame") { };
+ DistributedCacheTestCase x = new DistributedCacheTestCase() { };
cache = CacheFactory.create(x.getSystem());
AttributesFactory factory = new AttributesFactory();
@@ -164,8 +160,6 @@ public abstract class DistributedCacheTestCase
return exceptionInThreads;
}
- ////////////////////// Helper Methods //////////////////////
-
/**
* Returns the root region of the cache. We assume that the {@link
* Cache} and the root region have already been created.
@@ -250,9 +244,6 @@ public abstract class DistributedCacheTestCase
remoteDefineEntry(regionName, entryName, scope, true);
}
-
-
-
/**
* Defines an entry in the Region with the given name and scope. In
* 3.0 this method create a subregion named <code>entryName</code>
@@ -304,7 +295,6 @@ public abstract class DistributedCacheTestCase
"Defined Entry named '" + entryName + "' in region '" +
sub.getFullPath() +"'");
}
-
/**
* Puts (or creates) a value in a subregion of <code>region</code>
@@ -348,8 +338,7 @@ public abstract class DistributedCacheTestCase
throws CacheException {
remotePut(regionName, entryName, value, Scope.DISTRIBUTED_NO_ACK);
}
-
-
+
/**
* Replaces the value of an entry in a region in a remote VM
*
@@ -462,11 +451,19 @@ public abstract class DistributedCacheTestCase
* every VM that host knows about.
*/
public void forEachVMInvoke(String methodName, Object[] args) {
+ forEachVMInvoke(getClass(), methodName, args);
+ }
+
+ /**
+ * Assumes there is only one host, and invokes the given method in
+ * every VM that host knows about.
+ */
+ public void forEachVMInvoke(Class<?> targetClass, String methodName, Object[] args) {
Host host = Host.getHost(0);
int vmCount = host.getVMCount();
for (int i=0; i<vmCount; i++) {
LogWriterUtils.getLogWriter().info("Invoking " + methodName + "on VM#" + i);
- host.getVM(i).invoke(this.getClass(), methodName, args);
+ host.getVM(i).invoke(targetClass, methodName, args);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EventTrackerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EventTrackerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EventTrackerDUnitTest.java
index 263b130..ee68866 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EventTrackerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EventTrackerDUnitTest.java
@@ -16,28 +16,46 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentMap;
+
+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.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.cache30.ClientServerTestCase;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.EventTracker.BulkOpHolder;
import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.ConcurrentMap;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests <code>EventTracker</code> management.
*
- *
* @since GemFire 6.5
*/
-public class EventTrackerDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class EventTrackerDUnitTest extends JUnit4CacheTestCase {
/** The port on which the <code>CacheServer</code> was started in this VM */
private static int cacheServerPort;
@@ -45,22 +63,6 @@ public class EventTrackerDUnitTest extends CacheTestCase {
/** The <code>Cache</code>'s <code>ExpiryTask</code>'s ping interval */
private static final String MESSAGE_TRACKING_TIMEOUT = "5000";
- /**
- * Creates a new <code>EventTrackerDUnitTest</code>
- */
- public EventTrackerDUnitTest(String name) {
- super(name);
- }
-
- //////// Test Methods
- public static void caseSetUp() throws Exception {
- disconnectAllFromDS();
- }
-
- public static void caseTearDown() throws Exception {
- disconnectAllFromDS();
- }
-
@Override
public final void postTearDownCacheTestCase() throws Exception {
disconnectAllFromDS();
@@ -70,6 +72,7 @@ public class EventTrackerDUnitTest extends CacheTestCase {
* Tests <code>EventTracker</code> is created and destroyed when a <code>Region</code> is created
* and destroyed.
*/
+ @Test
public void testEventTrackerCreateDestroy() throws CacheException {
// Verify the Cache's ExpiryTask contains no EventTrackers
GemFireCacheImpl cache = (GemFireCacheImpl) getCache();
@@ -108,6 +111,7 @@ public class EventTrackerDUnitTest extends CacheTestCase {
/**
* Tests adding threads to an <code>EventTracker</code>.
*/
+ @Test
public void testEventTrackerAddThreadIdentifier() throws CacheException {
Host host = Host.getHost(0);
VM serverVM = host.getVM(0);
@@ -178,6 +182,7 @@ public class EventTrackerDUnitTest extends CacheTestCase {
/**
* Tests adding events to and removing events from an <code>EventTracker</code>.
*/
+ @Test
public void testEventTrackerAddRemoveThreadIdentifier() throws CacheException {
Host host = Host.getHost(0);
VM serverVM = host.getVM(0);
@@ -261,6 +266,7 @@ public class EventTrackerDUnitTest extends CacheTestCase {
* Test to make sure we don't leak put all events in the event tracker
* after multiple putAlls
*/
+ @Test
public void testPutAllHoldersInEventTracker() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionDUnitTest.java
index 2d19ba5..3b0a95b 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionDUnitTest.java
@@ -16,11 +16,14 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import org.junit.Ignore;
+import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.cache.EvictionAlgorithm;
@@ -30,14 +33,10 @@ import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.junit.categories.DistributedTest;
@Category(DistributedTest.class)
-@Ignore("Test was disabled by renaming to DisabledTest")
+@Ignore("TODO: Test was disabled by renaming to DisabledTest")
public class EvictionDUnitTest extends EvictionTestBase {
- private static final long serialVersionUID = 270073077723092256L;
- public EvictionDUnitTest(String name) {
- super(name);
- }
-
+ @Test
public void testDummyInlineNCentralizedEviction() {
prepareScenario1(EvictionAlgorithm.LRU_HEAP,0);
putData("PR1", 50, 1);
@@ -53,6 +52,7 @@ public class EvictionDUnitTest extends EvictionTestBase {
validateNoOfEvictions("PR1", 4 + expectedEviction1 + expectedEviction2);
}
+ @Test
public void testThreadPoolSize() {
prepareScenario1(EvictionAlgorithm.LRU_HEAP,0);
putData("PR1", 50, 1);
@@ -60,6 +60,7 @@ public class EvictionDUnitTest extends EvictionTestBase {
verifyThreadPoolTaskCount(HeapEvictor.MAX_EVICTOR_THREADS);
}
+ @Test
public void testCentralizedEvictionnForDistributedRegionWithDummyEvent() {
prepareScenario1(EvictionAlgorithm.LRU_HEAP,0);
createDistributedRegion();
@@ -77,6 +78,7 @@ public class EvictionDUnitTest extends EvictionTestBase {
* goes down and then comes up again causing GII to take place, the system
* doesnot throw an OOME.
*/
+ @Test
public void testEvictionWithNodeDown() {
prepareScenario2(EvictionAlgorithm.LRU_HEAP, "PR3", "PR4");
putDataInDataStore3("PR3", 100, 1);
@@ -88,6 +90,7 @@ public class EvictionDUnitTest extends EvictionTestBase {
assertEquals(0, getPRSize("PR4"));
}
+ @Test
public void testEntryLruEvictions() {
int extraEntries=1;
createCache();
@@ -104,8 +107,8 @@ public class EvictionDUnitTest extends EvictionTestBase {
assertEquals(extraEntries,((AbstractLRURegionMap)pr.entries)._getLruList().stats().getEvictions());
}
-
-
+
+ @Test
public void testEntryLru() {
createCache();
maxEnteries=12;
@@ -132,6 +135,7 @@ public class EvictionDUnitTest extends EvictionTestBase {
assertEquals(0,((AbstractLRURegionMap)pr.entries)._getLruList().stats().getEvictions());
}
+ @Test
public void testCheckEntryLruEvictionsIn1DataStore() {
int extraEntries=10;
createCache();
@@ -162,14 +166,15 @@ public class EvictionDUnitTest extends EvictionTestBase {
}
}
+ @Test
public void testCheckEntryLruEvictionsIn2DataStore() {
maxEnteries=20;
prepareScenario1(EvictionAlgorithm.LRU_ENTRY,maxEnteries);
putData("PR1", 60, 1);
validateNoOfEvictions("PR1", 20);
}
-
-
+
+ @Test
public void testMemLruForPRAndDR() {
createCache();
createPartitionedRegion(true, EvictionAlgorithm.LRU_MEMORY, "PR1", 4, 1, 1000,40);
@@ -195,6 +200,7 @@ public class EvictionDUnitTest extends EvictionTestBase {
assertTrue(((AbstractLRURegionMap)dr.entries)._getLruList().stats().getEvictions()<=2);
}
+ @Test
public void testEachTaskSize() {
createCache();
createPartitionedRegion(true, EvictionAlgorithm.LRU_HEAP, "PR1", 6, 1,
@@ -211,37 +217,5 @@ public class EvictionDUnitTest extends EvictionTestBase {
assertEquals(8, size.intValue());
}
}
-
- /*
- final PartitionedRegion pr1 = (PartitionedRegion)cache.getRegion("PR1");
- final PartitionedRegion pr2 = (PartitionedRegion)cache.getRegion("PR2");
- final PartitionedRegion pr3 = (PartitionedRegion)cache.getRegion("PR3");
- final DistributedRegion dr1 = (DistributedRegion)cache.getRegion("DR1");
-
- for (int counter = 1; counter <= 18; counter++) {
- pr1.put(new Integer(counter), new byte[1 * 1024 * 1024]);
- }
- getLogWriter().info("Size of PR1 before eviction = "+ pr1.size());
-
- for (int counter = 1; counter <= 30; counter++) {
- pr2.put(new Integer(counter), new byte[1 * 1024 * 1024]);
- }
- getLogWriter().info("Size of PR2 before eviction = "+ pr2.size());
-
- for (int counter = 1; counter <= 45; counter++) {
- pr3.put(new Integer(counter), new byte[1 * 1024 * 1024]);
- }
- getLogWriter().info("Size of PR3 before eviction = "+ pr3.size());
-
- for (int counter = 1; counter <= 150; counter++) {
- dr1.put(new Integer(counter), new byte[1 * 1024 * 1024]);
- }
- getLogWriter().info("Size of DR1 before eviction = "+ dr1.size());
-
-
- getLogWriter().info("Size of PR1 after eviction = "+ pr1.size());
- getLogWriter().info("Size of PR2 after eviction = "+ pr2.size());
- getLogWriter().info("Size of PR3 after eviction = "+ pr3.size());
- getLogWriter().info("Size of PR4 after eviction = "+ dr1.size());*/
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionObjectSizerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionObjectSizerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionObjectSizerDUnitTest.java
index 2eee95f..c016e1e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionObjectSizerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionObjectSizerDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.io.File;
import java.util.Iterator;
import java.util.Map;
@@ -40,7 +49,8 @@ import com.gemstone.gemfire.internal.size.ReflectionSingleObjectSizer;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
-public class EvictionObjectSizerDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class EvictionObjectSizerDUnitTest extends JUnit4CacheTestCase {
protected static Cache cache = null;
@@ -54,13 +64,14 @@ public class EvictionObjectSizerDUnitTest extends CacheTestCase {
// Removed CONCURRENT_OVERHEAD since it is included in the regionEntrySize.
- public EvictionObjectSizerDUnitTest(String name) {
- super(name);
+ public EvictionObjectSizerDUnitTest() {
+ super();
}
/**
* Without object sizer
*/
+ @Test
public void testWithoutObjectSizerForHeapLRU() {
prepareScenario(EvictionAlgorithm.LRU_HEAP, null);
@@ -83,6 +94,7 @@ public class EvictionObjectSizerDUnitTest extends CacheTestCase {
* With object sizer for standard objects.Key -Integer Value ByteArray
*
*/
+ @Test
public void testObjectSizerForHeapLRU_StandardObjects() {
prepareScenario(EvictionAlgorithm.LRU_HEAP, new TestObjectSizerImpl());
@@ -118,6 +130,7 @@ public class EvictionObjectSizerDUnitTest extends CacheTestCase {
* With object sizer for customized value object implementing ObjectSizer .Key
* -Integer Value TestNonSizerObject
*/
+ @Test
public void testObjectSizerForHeapLRU_CustomizedNonSizerObject() {
prepareScenario(EvictionAlgorithm.LRU_HEAP, new TestObjectSizerImpl());
@@ -154,6 +167,7 @@ public class EvictionObjectSizerDUnitTest extends CacheTestCase {
* With object sizer for customized value object implementing ObjectSizer .Key
* -Integer Value TestObjectSizerImpl
*/
+ @Test
public void testObjectSizerForHeapLRU_CustomizedSizerObject() {
prepareScenario(EvictionAlgorithm.LRU_HEAP, new TestObjectSizerImpl());
@@ -172,6 +186,7 @@ public class EvictionObjectSizerDUnitTest extends CacheTestCase {
/**
* With object sizer for customized key and value objects.
*/
+ @Test
public void testObjectSizerForHeapLRU_CustomizedSizerObjects() {
prepareScenario(EvictionAlgorithm.LRU_HEAP, new TestObjectSizerImpl());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java
index e820e1f..4e6ed58 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionStatsDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.io.File;
import java.util.Iterator;
import java.util.Map;
@@ -46,7 +55,8 @@ import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
-public class EvictionStatsDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class EvictionStatsDUnitTest extends JUnit4CacheTestCase {
protected static Cache cache = null;
@@ -62,8 +72,8 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
static int totalNoOfBuckets = 2;
- public EvictionStatsDUnitTest(String name) {
- super(name);
+ public EvictionStatsDUnitTest() {
+ super();
// TODO Auto-generated constructor stub
}
@@ -74,6 +84,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
dataStore2 = host.getVM(1);
}
+ @Test
public void testEntryLruLimitNDestroyLimit() {
prepareScenario(EvictionAlgorithm.LRU_ENTRY);
putData("PR1", 100);
@@ -112,6 +123,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testMemLruLimitNDestroyLimit() {
prepareScenario(EvictionAlgorithm.LRU_MEMORY);
putData("PR1", 100);
@@ -156,6 +168,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
}
+ @Test
public void testEntryLruCounter() {
prepareScenario(EvictionAlgorithm.LRU_ENTRY);
putData("PR1", 10);
@@ -170,6 +183,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
assertEquals(sizeOfPr2, totalBucketSizeForPR2);
}
+ @Test
public void testMemLruCounter() {
prepareScenario(EvictionAlgorithm.LRU_MEMORY);
putData("PR1", 10);
@@ -184,6 +198,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
assertEquals(sizeOfPr2, totalBucketSizeForPR2);
}
+ @Test
public void testHeapLruCounter() {
prepareScenario(EvictionAlgorithm.LRU_HEAP);
System.setProperty(
@@ -198,6 +213,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
long totalBucketSizeForPR2 = getCounterForBucketsOfPR("PR2");
}
+ @Test
public void testEntryLruAllCounterMethods() {
final long ONE_MEG = 1024L * 1024L;
createCache();
@@ -269,6 +285,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
+ @Test
public void testEntryLRUEvictionNDestroyNNumOverflowOnDiskCount() {
final int extraEnteries = 24;
prepareScenario(EvictionAlgorithm.LRU_ENTRY);
@@ -317,6 +334,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testMemLRUEvictionNDestroyNNumOverflowOnDiskCount() {
int localMaxMem=50;
final int extraEntries = 6;
@@ -400,7 +418,7 @@ public class EvictionStatsDUnitTest extends CacheTestCase {
}
public static void createCacheInVm() {
- new EvictionStatsDUnitTest("temp").createCache();
+ new EvictionStatsDUnitTest().createCache();
}
public void createCache() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java
index 6bf8ec0..f262609 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/EvictionTestBase.java
@@ -16,10 +16,29 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAlgorithm;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.util.ObjectSizerImpl;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.OSProcess;
@@ -29,12 +48,19 @@ import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.Resou
import com.gemstone.gemfire.internal.cache.control.MemoryEvent;
import com.gemstone.gemfire.internal.cache.control.MemoryThresholds.MemoryState;
import com.gemstone.gemfire.internal.cache.lru.HeapEvictor;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.File;
-import java.util.*;
-
-public class EvictionTestBase extends CacheTestCase {
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class EvictionTestBase extends JUnit4CacheTestCase {
protected static Cache cache = null;
@@ -54,10 +80,6 @@ public class EvictionTestBase extends CacheTestCase {
static int totalNoOfBuckets = 4;
- public EvictionTestBase(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -245,7 +267,7 @@ public class EvictionTestBase extends CacheTestCase {
}
public static void createCacheInVm() {
- new EvictionTestBase("temp").createCache();
+ new EvictionTestBase().createCache();
}
public void createCache() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FaultingInJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FaultingInJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FaultingInJUnitTest.java
index 76d8bc9..6a0e660 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FaultingInJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FaultingInJUnitTest.java
@@ -16,32 +16,27 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* Tests faulting in from current oplog, old oplog
* and htree for different modes (overflow only, persist+overflow : Sync/Async)
- *
- *
*/
@Category(IntegrationTest.class)
-public class FaultingInJUnitTest extends DiskRegionTestingBase
-{
- protected volatile boolean hasBeenNotified;
-
-
+public class FaultingInJUnitTest extends DiskRegionTestingBase {
+
+ private volatile boolean hasBeenNotified;
+
private DiskRegionProperties diskProps = new DiskRegionProperties();
- @Before
- public void setUp() throws Exception {
- super.setUp();
+ @Override
+ protected final void postSetUp() throws Exception {
deleteFiles();
diskProps.setDiskDirs(dirs);
diskProps.setCompactionThreshold(100);
@@ -49,19 +44,16 @@ public class FaultingInJUnitTest extends DiskRegionTestingBase
LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
}
- @After
- public void tearDown() throws Exception {
+ @Override
+ protected final void preTearDown() throws Exception {
closeDown();
deleteFiles();
- super.tearDown();
}
/**
* fault in a value from teh current oplog
- *
*/
- void faultInFromCurrentOplog()
- {
+ private void faultInFromCurrentOplog() {
put100Int();
putTillOverFlow(region);
region.put(new Integer(200), new Integer(200));
@@ -73,10 +65,8 @@ public class FaultingInJUnitTest extends DiskRegionTestingBase
/**
* fault in a value from an old oplog
- *
*/
- void faultInFromOldOplog()
- {
+ private void faultInFromOldOplog() {
put100Int();
putTillOverFlow(region);
region.put(new Integer(200), new Integer(200));
@@ -89,10 +79,8 @@ public class FaultingInJUnitTest extends DiskRegionTestingBase
/**
* fault in a value that has been copied forward by compaction
- *
*/
- void faultInFromCompactedOplog()
- {
+ private void faultInFromCompactedOplog() {
put100Int();
putTillOverFlow(region);
region.put(new Integer(101), new Integer(101));
@@ -147,89 +135,74 @@ public class FaultingInJUnitTest extends DiskRegionTestingBase
* test OverflowOnly Sync Faultin From CurrentOplog
*/
@Test
- public void testOverflowOnlyFaultinSyncFromCurrentOplog()
- {
+ public void testOverflowOnlyFaultinSyncFromCurrentOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowOnlyRegion(cache,diskProps);
faultInFromCurrentOplog();
}
@Test
- public void testOverflowOnlyFaultinSyncFromOldOplog()
- {
+ public void testOverflowOnlyFaultinSyncFromOldOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowOnlyRegion(cache,diskProps);
faultInFromOldOplog();
}
@Test
- public void testOverflowOnlyFaultinSyncFromCompactedOplog()
- {
+ public void testOverflowOnlyFaultinSyncFromCompactedOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowOnlyRegion(cache,diskProps);
faultInFromCompactedOplog();
}
@Test
- public void testOverflowOnlyFaultinAsyncFromCurrentOplog()
- {
+ public void testOverflowOnlyFaultinAsyncFromCurrentOplog() {
region = DiskRegionHelperFactory.getAsyncOverFlowOnlyRegion(cache,diskProps);
faultInFromCurrentOplog();
}
@Test
- public void testOverflowOnlyFaultinAsyncFromOldOplog()
- {
+ public void testOverflowOnlyFaultinAsyncFromOldOplog() {
region = DiskRegionHelperFactory.getAsyncOverFlowOnlyRegion(cache,diskProps);
faultInFromOldOplog();
}
@Test
- public void testOverflowOnlyFaultinAsyncFromCompactedOplog()
- {
+ public void testOverflowOnlyFaultinAsyncFromCompactedOplog() {
region = DiskRegionHelperFactory.getAsyncOverFlowOnlyRegion(cache,diskProps);
faultInFromCompactedOplog();
}
@Test
- public void testOverflowAndPersistFaultinSyncFromCurrentOplog()
- {
+ public void testOverflowAndPersistFaultinSyncFromCurrentOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowAndPersistRegion(cache,diskProps);
faultInFromCurrentOplog();
}
@Test
- public void testOverflowAndPersistFaultinSyncFromOldOplog()
- {
+ public void testOverflowAndPersistFaultinSyncFromOldOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowAndPersistRegion(cache,diskProps);
faultInFromOldOplog();
}
@Test
- public void testOverflowAndPersistFaultinSyncFromCompactedOplog()
- {
+ public void testOverflowAndPersistFaultinSyncFromCompactedOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowAndPersistRegion(cache,diskProps);
faultInFromCompactedOplog();
}
@Test
- public void testOverflowAndPersistFaultinAsyncFromCurrentOplog()
- {
+ public void testOverflowAndPersistFaultinAsyncFromCurrentOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowAndPersistRegion(cache,diskProps);
faultInFromCurrentOplog();
}
@Test
- public void testOverflowAndPersistFaultinAsyncFromOldOplog()
- {
+ public void testOverflowAndPersistFaultinAsyncFromOldOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowAndPersistRegion(cache,diskProps);
faultInFromOldOplog();
}
@Test
- public void testOverflowAndPersistFaultinAsyncFromCompactedOplog()
- {
+ public void testOverflowAndPersistFaultinAsyncFromCompactedOplog() {
region = DiskRegionHelperFactory.getSyncOverFlowAndPersistRegion(cache,diskProps);
faultInFromCompactedOplog();
}
-
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java
index cf279cc..4da2b61 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/FixedPRSinglehopDUnitTest.java
@@ -16,32 +16,54 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.FixedPartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.internal.ClientMetadataService;
import com.gemstone.gemfire.cache.client.internal.ClientPartitionAdvisor;
import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.partitioned.fixed.QuarterPartitionResolver;
import com.gemstone.gemfire.internal.cache.partitioned.fixed.SingleHopQuarterPartitionResolver;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallableIF;
+import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import org.junit.experimental.categories.Category;
-import java.io.File;
-import java.io.IOException;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class FixedPRSinglehopDUnitTest extends CacheTestCase {
-
- private static final long serialVersionUID = 1L;
+@Category(DistributedTest.class)
+public class FixedPRSinglehopDUnitTest extends JUnit4CacheTestCase {
private static final String PR_NAME = "fixed_single_hop_pr";
@@ -75,10 +97,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
private static final Date q4dateDec1 = new Date(2010, 11, 1);
- public FixedPRSinglehopDUnitTest(String name) {
- super(name);
- }
-
+ @Test
public void testNoClientConnected() {
final Host host = Host.getHost(0);
VM accessorServer = host.getVM(0);
@@ -135,6 +154,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
// 2 AccessorServers, 2 Peers
// 1 Client connected to 2 AccessorServers. Hence metadata should not be
// fetched.
+ @Test
public void testClientConnectedToAccessors() {
final Host host = Host.getHost(0);
VM accessorServer1 = host.getVM(0);
@@ -178,6 +198,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
// Now verify that metadata has all 8 buckets info.
// Now update and ensure the fetch service is never called.
@Category(FlakyTest.class) // GEODE-1176: random ports, time sensitive, waitForCriterion
+ @Test
public void test_MetadataContents() {
final Host host = Host.getHost(0);
@@ -243,6 +264,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
* the metadata are fetched and then later up one more partition and do some operations on them. It should
* fetch new fpa.
*/
+ @Test
public void test_FPAmetadataFetch() {
final Host host = Host.getHost(0);
@@ -323,8 +345,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
public static int createServer(boolean isAccessor,
List<FixedPartitionAttributes> fpaList) {
- CacheTestCase test = new FixedPRSinglehopDUnitTest(
- "FixedPRSinglehopDUnitTest");
+ FixedPRSinglehopDUnitTest test = new FixedPRSinglehopDUnitTest();
cache = test.getCache();
CacheServer server = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
@@ -363,8 +384,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
public static int createServerWithLocator(String locator, boolean isAccessor,
List<FixedPartitionAttributes> fpaList, boolean simpleFPR) {
- CacheTestCase test = new FixedPRSinglehopDUnitTest(
- "FixedPRSinglehopDUnitTest");
+ FixedPRSinglehopDUnitTest test = new FixedPRSinglehopDUnitTest();
Properties props = new Properties();
props = new Properties();
props.setProperty(LOCATORS, locator);
@@ -425,8 +445,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
}
public static int totalNumBucketsCreated () {
- CacheTestCase test = new FixedPRSinglehopDUnitTest(
- "FixedPRSinglehopDUnitTest");
+ FixedPRSinglehopDUnitTest test = new FixedPRSinglehopDUnitTest();
PartitionedRegion pr = (PartitionedRegion)cache.getRegion(PR_NAME);
assertNotNull(pr);
return pr.getLocalPrimaryBucketsListTestOnly().size();
@@ -434,8 +453,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
public static void createPeer(boolean isAccessor,
List<FixedPartitionAttributes> fpaList) {
- CacheTestCase test = new FixedPRSinglehopDUnitTest(
- "FixedPRSinglehopDUnitTest");
+ FixedPRSinglehopDUnitTest test = new FixedPRSinglehopDUnitTest();
cache = test.getCache();
PartitionAttributesFactory paf = new PartitionAttributesFactory();
@@ -463,8 +481,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new FixedPRSinglehopDUnitTest(
- "FixedPRSinglehopDUnitTest");
+ FixedPRSinglehopDUnitTest test = new FixedPRSinglehopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -489,8 +506,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new FixedPRSinglehopDUnitTest(
- "FixedPRSinglehopDUnitTest");
+ FixedPRSinglehopDUnitTest test = new FixedPRSinglehopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -515,8 +531,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new FixedPRSinglehopDUnitTest(
- "FixedPRSinglehopDUnitTest");
+ FixedPRSinglehopDUnitTest test = new FixedPRSinglehopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -540,8 +555,7 @@ public class FixedPRSinglehopDUnitTest extends CacheTestCase {
props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new FixedPRSinglehopDUnitTest(
- "FixedPRSinglehopDUnitTest");
+ FixedPRSinglehopDUnitTest test = new FixedPRSinglehopDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java
index ce309a1..c92a436 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIDeltaDUnitTest.java
@@ -19,6 +19,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import com.gemstone.gemfire.DataSerializer;
import com.gemstone.gemfire.GemFireIOException;
import com.gemstone.gemfire.cache.*;
@@ -49,7 +58,8 @@ import java.io.DataInputStream;
import java.io.IOException;
import java.util.concurrent.CountDownLatch;
-public class GIIDeltaDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class GIIDeltaDUnitTest extends JUnit4CacheTestCase {
VM P; // GII provider
VM R; // GII requester
@@ -65,8 +75,8 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
/**
* @param name
*/
- public GIIDeltaDUnitTest(String name) {
- super(name);
+ public GIIDeltaDUnitTest() {
+ super();
}
@Override
@@ -228,6 +238,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* vm1 becomes offline then restarts.
* The deltaGII should only exchange RVV. No need to send data from vm0 to vm1.
*/
+ @Test
public void testDeltaGIIWithSameRVV() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -282,6 +293,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* vm1 becomes offline then restarts. https://wiki.gemstone.com/display/gfepersistence/DeltaGII+Spec+for+8.0
* The deltaGII should send delta to R, revoke unfinished opeation R4,R5
*/
+ @Test
public void testDeltaGIIWithExceptionList() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -342,6 +354,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* vm1 becomes offline then restarts.
* The deltaGII should send delta which only contains unfinished opeation R4,R5
*/
+ @Test
public void testDeltaGIIWithOnlyUnfinishedOp() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -416,6 +429,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* vm1 becomes offline then restarts.
* The deltaGII should send delta which only contains unfinished opeation R4,R5
*/
+ @Test
public void testDeltaGIIWithOnlyUnfinishedOp_GCAtR() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -475,6 +489,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* vm1 becomes offline then restarts. https://wiki.gemstone.com/display/gfepersistence/DeltaGII+Spec+for+8.0
* The deltaGII should send delta to R, revoke unfinished opeation R4,R5
*/
+ @Test
public void testDeltaGIIWithDifferentRVVGC() throws Throwable {
final String testcase = "testDeltaGIIWithExceptionList";
prepareForEachTest();
@@ -534,6 +549,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* i.e. before GII, P's RVVGC=P0,R0, upon received RequestImageMessage, it becomes P4,R0
* it should cause the fullGII.
*/
+ @Test
public void testFullGIITriggeredByHigherRVVGC() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -601,6 +617,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* If R did not save the rvvgc, restarted R will have a way smaller rvvgc (maybe the same as T's)
* Let T requests GII from R, it wll become deltaGII, which is wrong.
*/
+ @Test
public void testSavingRVVGC() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -669,6 +686,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* vm1 becomes offline then restarts. https://wiki.gemstone.com/display/gfepersistence/DeltaGII+Spec+for+8.0
* The deltaGII should send delta to R, revoke unfinished opeation R4,R5
*/
+ @Test
public void testDeltaGIIWithoutRVVGC() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -719,6 +737,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* P's RVV=P9,R6(3-6), RVVGC=P8,R0, R's RVV=P9(7-9),R6, RVV
* It should trigger fullGII
*/
+ @Test
public void testFullGIINotDorminatedByProviderRVVGC() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -776,6 +795,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* still P:x,R3, without exception list. But actually R4, R5 are unfinished ops by
* all means.
*/
+ @Test
public void testUnfinishedOpsWithoutExceptionList() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -844,6 +864,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
*
* When image (which contains P4, P5) arrives, it should fill the special exception
*/
+ @Test
public void testFillSpecialException() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -898,6 +919,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* This test will let the 2 operations happen before RIM, so the rvv will match between R and P and
* no gii will happen. In this way, the chunk will not contain the missing entries.
*/
+ @Test
public void testFillSpecialException2() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -946,6 +968,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* 3. gii packing should wait for tombstone GC
* 4. gii packing should wait for other on-fly operations
*/
+ @Test
public void testHooks() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1169,6 +1192,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* wait for all GIIs to finish
*/
@Category(FlakyTest.class) // GEODE-633: SLOW_DISTRIBUTION_MS, non-thread safe test hook, async actions, time sensitive, waitForCriterion, thread joins, forceGC
+ @Test
public void testTombstoneGCInMiddleOfGII() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1300,6 +1324,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* The deltaGII should send nothing to R since the RVVs are the same. So after GII, P and R will
* have different tombstone number. But P's tombstones should be expired.
*/
+ @Test
public void testExpiredTombstoneSkippedAtProviderOnly() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1395,6 +1420,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* vm1 becomes offline then restarts.
* The deltaGII should only exchange RVV. No need to send data from vm0 to vm1.
*/
+ @Test
public void testRequesterHasHigherRVVGC() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1447,6 +1473,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* P8 is clear() operation. After that, R offline. Run P9 is a put. Restart R.
* R will do deltaGII to get P9 as delta
*/
+ @Test
public void testDeltaGIIAfterClear() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1513,6 +1540,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* After that, do clear(). Make sure R should not contain key1 after GII.
*/
@Category(FlakyTest.class) // GEODE-1068: time sensitive, SLOW_DISTRIBUTION_MS, waitForCriterion, possible thread unsafe test hooks, async actions, depends on stats
+ @Test
public void testClearAfterChunkEntries() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1583,6 +1611,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* R off line, then run P7. Restart R. When P's RVV arrives, do clear(). It should trigger
* fullGII. Make sure R should not contain key1 after GII.
*/
+ @Test
public void testClearAfterSavedRVV() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1647,6 +1676,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* R offline, then P8 is clear() operation. Run P9 is a put. Restart R.
* R will do fullGII since R missed a clear
*/
+ @Test
public void testFullGIIAfterClear() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1699,6 +1729,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* By changing MAX_UNFINISHED_OPERATIONS to be 1, 2. It should be fullGII then deltaGII.
*/
@Category(FlakyTest.class) // GEODE-686: time sensitive, SLOW_DISTRIBUTION_MS, forceGC
+ @Test
public void testFullGIITriggeredByTooManyUnfinishedOps() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1734,6 +1765,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* R off line, then run P7. Restart R. When P's RVV arrives, restart R. It should trigger
* fullGII.
*/
+ @Test
public void testRestartWithOnlyGIIBegion() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1798,6 +1830,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* still initializes from the local data. See bug 48066
* @throws Throwable
*/
+ @Test
public void testRecoverFromUntrustedRVV() throws Throwable {
prepareForEachTest();
final DiskStoreID memberP = getMemberID(P);
@@ -1870,6 +1903,7 @@ public class GIIDeltaDUnitTest extends CacheTestCase {
* @throws Throwable
*/
@Category(FlakyTest.class) // GEODE-1137: orphaned AsyncInvocations, time sensitive, GC, waitForCriterion, thread unsafe test hooks/observers, expiration
+ @Test
public void testTombstoneGCDuringFullGII() throws Throwable {
prepareForEachTest();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java
index 3ded889..405ff45 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GIIFlowControlDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
@@ -43,7 +52,8 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
*
*/
-public class GIIFlowControlDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class GIIFlowControlDUnitTest extends JUnit4CacheTestCase {
protected static final String REGION_NAME = "region";
private static final long MAX_WAIT = 10 * 1000;
@@ -53,8 +63,8 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
/**
* @param name
*/
- public GIIFlowControlDUnitTest(String name) {
- super(name);
+ public GIIFlowControlDUnitTest() {
+ super();
}
@Override
@@ -67,6 +77,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testLotsOfChunks() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -88,6 +99,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
}
+ @Test
public void testFlowControlHappening() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -157,6 +169,7 @@ public class GIIFlowControlDUnitTest extends CacheTestCase {
closeCache(vm0);
}
+ @Test
public void testKillSenderNoHang() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java
index 4120fca..2c7d1d4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/GridAdvisorDUnitTest.java
@@ -16,6 +16,18 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Arrays;
+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.CacheFactory;
import com.gemstone.gemfire.cache.server.CacheServer;
@@ -26,32 +38,27 @@ import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.distributed.internal.InternalLocator;
import com.gemstone.gemfire.internal.AvailablePort.Keeper;
import com.gemstone.gemfire.internal.AvailablePortHelper;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests the GridAdvisor
*
* @since GemFire 5.7
*/
-public class GridAdvisorDUnitTest extends DistributedTestCase {
-
- public GridAdvisorDUnitTest(String name) {
- super(name);
- }
-
- //////// Test Methods
+@Category(DistributedTest.class)
+public class GridAdvisorDUnitTest extends JUnit4DistributedTestCase {
/**
* Tests 2 controllers and 2 bridge servers
*/
+ @Test
public void test2by2() throws Exception {
disconnectAllFromDS();
@@ -562,6 +569,7 @@ public class GridAdvisorDUnitTest extends DistributedTestCase {
vm3.invoke(stopLocator);
}
+ @Test
public void test2by2usingGroups() throws Exception {
disconnectAllFromDS();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java
index b441ef1..05340a1 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/HAOverflowMemObjectSizerDUnitTest.java
@@ -19,7 +19,23 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Set;
+
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+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.cache30.ClientServerTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
@@ -28,24 +44,19 @@ import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.lru.EnableLRU;
import com.gemstone.gemfire.internal.cache.tier.sockets.ClientUpdateMessageImpl;
import com.gemstone.gemfire.internal.cache.tier.sockets.ConflationDUnitTest;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.NetworkUtils;
import com.gemstone.gemfire.test.dunit.VM;
-
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.Set;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests the size of clientUpdateMessageImpl with the size calculated by
* {@link com.gemstone.gemfire.internal.cache.lru.MemLRUCapacityController} for HA overFlow
* @since GemFire 5.7
*/
-public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class HAOverflowMemObjectSizerDUnitTest extends JUnit4DistributedTestCase {
/* entry over head used by memCapacityController */
private static final int OVERHEAD_PER_ENTRY = 250;
@@ -57,7 +68,7 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
/** The distributedSystem instance */
static DistributedSystem ds = null;
- static String regionName = "HAOverflowMemObjectSizerDUnitTest-region";
+ static String regionName = HAOverflowMemObjectSizerDUnitTest.class.getSimpleName() + "-region";
/* handler for LRU capacity controller */
private static EnableLRU cc = null;
@@ -77,11 +88,6 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
/* store the reference of Client Messages Region */
static Region region = null;
- /* Create new instance of HAOverflowMemObjectSizerTest */
- public HAOverflowMemObjectSizerDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
disconnectAllFromDS();
@@ -125,7 +131,7 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
* @param notification property of BridgeServer
*/
public static Integer createCacheServer(Boolean notification) throws Exception {
- new HAOverflowMemObjectSizerDUnitTest("temp").createCache(new Properties());
+ new HAOverflowMemObjectSizerDUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.NORMAL);
@@ -158,7 +164,7 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- new HAOverflowMemObjectSizerDUnitTest("temp").createCache(props);
+ new HAOverflowMemObjectSizerDUnitTest().createCache(props);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.NORMAL);
@@ -175,6 +181,7 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
* 1)Verify size calculated by getSizeInByte() of ClientUpdateMessagesImpl is
* equal to the size calculated by memCapacity controller <br>
*/
+ @Test
public void testSizerImplementationofMemCapacityControllerWhenNotificationBySubscriptionIsTrue() {
Integer port1 = (Integer)serverVM.invoke(() -> HAOverflowMemObjectSizerDUnitTest.createCacheServer( new Boolean(true) ));
@@ -194,6 +201,7 @@ public class HAOverflowMemObjectSizerDUnitTest extends DistributedTestCase {
* 1)Verify size calculated by getSizeInByte() of ClientUpdateMessagesImpl is
* equal to the size calculated by memCapacity controller <br>
*/
+ @Test
public void testSizerImplementationofMemCapacityControllerWhenNotificationBySubscriptionIsFalse() {
Integer port2 = (Integer)serverVM.invoke(() -> HAOverflowMemObjectSizerDUnitTest.createCacheServer( new Boolean(false) ));
serverPort2 = port2;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java
index b4f1c98..9b527e4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IncrementalBackupDUnitTest.java
@@ -16,11 +16,36 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.admin.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.admin.AdminDistributedSystem;
+import com.gemstone.gemfire.admin.AdminDistributedSystemFactory;
+import com.gemstone.gemfire.admin.AdminException;
+import com.gemstone.gemfire.admin.BackupStatus;
+import com.gemstone.gemfire.admin.DistributedSystemConfig;
import com.gemstone.gemfire.admin.internal.AdminDistributedSystemImpl;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache.persistence.PersistentID;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.ClassBuilder;
@@ -30,18 +55,22 @@ import com.gemstone.gemfire.internal.JarDeployer;
import com.gemstone.gemfire.internal.cache.persistence.BackupManager;
import com.gemstone.gemfire.internal.util.IOUtils;
import com.gemstone.gemfire.internal.util.TransformUtils;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.*;
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests for the incremental backup feature.
*/
+@Category(DistributedTest.class)
@SuppressWarnings("serial")
-public class IncrementalBackupDUnitTest extends CacheTestCase {
+public class IncrementalBackupDUnitTest extends JUnit4CacheTestCase {
/**
* Data load increment.
*/
@@ -93,14 +122,6 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
};
/**
- * Creates a new IncrementalBackupDUnitTest.
- * @param name test case name.
- */
- public IncrementalBackupDUnitTest(String name) {
- super(name);
- }
-
- /**
* Abstracts the logging mechanism.
* @param message a message to log.
*/
@@ -658,6 +679,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
* Additionally, the restore script should reference and copy operation logs from the baseline backup.
* @throws Exception
*/
+ @Test
public void testIncrementalBackup()
throws Exception {
String memberId = getMemberId(Host.getHost(0).getVM(1));
@@ -785,6 +807,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
* incremental backup. This means that the member peformed a full backup because its oplogs were missing
* in the baseline.
*/
+ @Test
public void testMissingMemberInBaseline()
throws Exception {
// Simulate the missing member by forcing a persistent member
@@ -868,6 +891,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
* Successful if a member performs a full backup if their backup is marked as
* incomplete in the baseline.
*/
+ @Test
public void testIncompleteInBaseline()
throws Exception {
/*
@@ -916,6 +940,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
* Successful if all members perform a full backup when they share the baseline directory
* and it is missing.
*/
+ @Test
public void testMissingBaseline()
throws Exception {
/*
@@ -987,6 +1012,7 @@ public class IncrementalBackupDUnitTest extends CacheTestCase {
* Successful if a user deployed jar file is included as part of the backup.
* @throws Exception
*/
+ @Test
public void testBackupUserDeployedJarFiles() throws Exception {
final String jarName = "BackupJarDeploymentDUnit";
final String jarNameRegex = ".*" + jarName + ".*";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java
index 0a8c63f..79b58d6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptClientServerDUnitTest.java
@@ -16,6 +16,16 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.Ignore;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -43,14 +53,15 @@ import com.gemstone.gemfire.test.dunit.VM;
* Tests interrupting gemfire threads and seeing what happens
*
*/
-public class InterruptClientServerDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class InterruptClientServerDUnitTest extends JUnit4CacheTestCase {
private static volatile Thread puttingThread;
private static final long MAX_WAIT = 60 * 1000;
private static AtomicBoolean doInterrupt = new AtomicBoolean(false);
- public InterruptClientServerDUnitTest(String name) {
- super(name);
+ public InterruptClientServerDUnitTest() {
+ super();
}
@@ -66,23 +77,13 @@ public class InterruptClientServerDUnitTest extends CacheTestCase {
}
});
}
-
- public void _testLoop() throws Throwable {
- for(int i=0; i < 100; i++) {
- System.err.println("i=" +i);
- System.out.println("i=" +i);
- testClientPutWithInterrupt();
- tearDown();
- setUp();
- }
- }
-
/**
* A simple test case that we are actually
* persisting with a PR.
* @throws Throwable
*/
+ @Test
public void testClientPutWithInterrupt() throws Throwable {
IgnoredException.addIgnoredException("InterruptedException");
Host host = Host.getHost(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsConserveSocketsFalseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsConserveSocketsFalseDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsConserveSocketsFalseDUnitTest.java
index d8d68f3..ef7d240 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsConserveSocketsFalseDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsConserveSocketsFalseDUnitTest.java
@@ -20,11 +20,15 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
import java.util.Properties;
-public class InterruptsConserveSocketsFalseDUnitTest extends
- InterruptsDUnitTest {
+import org.junit.experimental.categories.Category;
- public InterruptsConserveSocketsFalseDUnitTest(String name) {
- super(name);
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class InterruptsConserveSocketsFalseDUnitTest extends InterruptsDUnitTest {
+
+ public InterruptsConserveSocketsFalseDUnitTest() {
+ super();
}
@Override
@@ -33,7 +37,4 @@ public class InterruptsConserveSocketsFalseDUnitTest extends
props.setProperty(CONSERVE_SOCKETS, "false");
return props;
}
-
-
-
}