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:10 UTC
[29/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/internal/cache/InterruptsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.java
index be41318..7596b82 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/InterruptsDUnitTest.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.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -38,14 +47,15 @@ import com.gemstone.gemfire.test.dunit.VM;
* Tests interrupting gemfire threads during a put operation to see what happens
*
*/
-public class InterruptsDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class InterruptsDUnitTest extends JUnit4CacheTestCase {
private static volatile Thread puttingThread;
private static final long MAX_WAIT = 60 * 1000;
private static AtomicBoolean doInterrupt = new AtomicBoolean(false);
- public InterruptsDUnitTest(String name) {
- super(name);
+ public InterruptsDUnitTest() {
+ super();
}
@@ -62,22 +72,12 @@ public class InterruptsDUnitTest extends CacheTestCase {
});
}
- public void _testLoop() throws Throwable {
- for(int i=0; i < 10; i++) {
- System.err.println("i=" +i);
- System.out.println("i=" +i);
- testDRPutWithInterrupt();
- tearDown();
- setUp();
- }
- }
-
-
/**
* A simple test case that we are actually
* persisting with a PR.
* @throws Throwable
*/
+ @Test
public void testDRPutWithInterrupt() throws Throwable {
Host host = Host.getHost(0);
final 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/IteratorDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IteratorDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IteratorDUnitTest.java
index 8d5184c..5421c20 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IteratorDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/IteratorDUnitTest.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.cache.RegionShortcut;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache30.CacheTestCase;
@@ -32,15 +41,17 @@ import java.util.Iterator;
* Test that keys iterator do not returned keys with removed token as its values
*
*/
-public class IteratorDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class IteratorDUnitTest extends JUnit4CacheTestCase {
/**
* @param name
*/
- public IteratorDUnitTest(String name) {
- super(name);
+ public IteratorDUnitTest() {
+ super();
}
+ @Test
public void testKeysIteratorOnLR() throws Exception {
final String regionName = getUniqueName();
Region r = getGemfireCache().createRegionFactory(RegionShortcut.REPLICATE).create(regionName);
@@ -60,6 +71,7 @@ public class IteratorDUnitTest extends CacheTestCase {
assertEquals(2, numKeys);
}
+ @Test
public void testKeysIteratorOnPR() {
Host host = Host.getHost(0);
VM accessor = 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/MapClearGIIDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java
index 7c227d8..6a88662 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MapClearGIIDUnitTest.java
@@ -21,76 +21,42 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
-import com.gemstone.gemfire.cache30.CacheTestCase;
-import com.gemstone.gemfire.test.dunit.*;
+import static org.junit.Assert.*;
import java.util.Properties;
-/**
- *
- *
- */
-public class MapClearGIIDUnitTest extends CacheTestCase {
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+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 MapClearGIIDUnitTest extends JUnit4CacheTestCase {
protected static boolean wasGIIInProgressDuringClear = false;
- public MapClearGIIDUnitTest(String name) {
- super(name);
- }
volatile static Region region;
- /*
- public void setUp() {
- super.setUp();
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- vm0.invoke(() -> MapClearGIIDUnitTest.createCacheVM0());
- vm1.invoke(() -> MapClearGIIDUnitTest.createCacheVM1());
- System.out.println("Cache created in successfully");
- }*/
-/*
- public void tearDown() {
- Host host = Host.getHost(0);
- VM vm0 = host.getVM(0);
- VM vm1 = host.getVM(1);
- vm0.invoke(() -> MapClearGIIDUnitTest.closeCache());
- vm1.invoke(() -> MapClearGIIDUnitTest.closeCache());
- }*/
-
-/* public static void createCacheVM0() throws Exception {
- InitialImageOperation.slowImageProcessing = 200;
- Properties mprops = new Properties();
- // mprops.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "7777");
-
- ds = (new MapClearGIIDUnitTest("Clear")).getSystem(mprops);
- //ds = DistributedSystem.connect(props);
- cache = CacheFactory.create(ds);
- CacheObserverImpl observer = new CacheObserverImpl();
- CacheObserverHolder.setInstance(observer);
- LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
- } //end of create cache for VM0
-
- public static void createCacheVM1() throws Exception {
- Properties mprops = new Properties();
- // mprops.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, "7777");
- ds = (new MapClearGIIDUnitTest("Clear")).getSystem(mprops);
- // ds = DistributedSystem.connect(null);
- cache = CacheFactory.create(ds);
- AttributesFactory factory = new AttributesFactory();
- factory.setScope(Scope.DISTRIBUTED_ACK);
- factory.setDataPolicy(DataPolicy.REPLICATE);
- RegionAttributes attr = factory.create();
- region = cache.createRegion("map", attr);
- //region = region.createSubregion("map",attr);
- for (int i = 0; i < 10000; ++i) {
- region.put("" + i, "" + i);
- }
- }*/
public static boolean checkImageStateFlag() throws Exception {
- Region rgn = new MapClearGIIDUnitTest("dumb object to get cache").getCache().getRegion("/map");
+ Region rgn = new MapClearGIIDUnitTest().getCache().getRegion("/map");
if (rgn == null) {
fail("Map region not yet created");
}
@@ -124,21 +90,10 @@ public class MapClearGIIDUnitTest extends CacheTestCase {
factory.setConcurrencyChecksEnabled(true);
RegionAttributes attr = factory.create();
- region = new MapClearGIIDUnitTest("dumb object to get cache").getCache().createRegion("map", attr);
+ region = new MapClearGIIDUnitTest().getCache().createRegion("map", attr);
- // region = region.createSubregion("map",attr);
LogWriterUtils.getLogWriter().info("Region in VM0 created ");
}
-/*
- public static void closeCache() {
- try {
- cache.close();
- ds.disconnect();
- }
- catch (Exception ex) {
- ex.printStackTrace();
- }
- }*/
public static void clearRegionInVm1() {
// wait for profile of getInitialImage cache to show up
@@ -161,6 +116,7 @@ public class MapClearGIIDUnitTest extends CacheTestCase {
}
//test methods
+ @Test
public void testClearImageStateFlag() 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/MapInterfaceJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterfaceJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterfaceJUnitTest.java
index 7b24f96..911f6ca 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterfaceJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MapInterfaceJUnitTest.java
@@ -16,26 +16,37 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import junit.framework.Assert;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.util.HashMap;
import java.util.Map;
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.assertEquals;
-import static org.junit.Assert.fail;
+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.CacheWriterException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@Category(IntegrationTest.class)
public class MapInterfaceJUnitTest {
+ protected boolean hasBeenNotified = false;
+
+ protected Region region2 = null;
+ protected int counter = 0;
+
@Test
public void testLocalClear() {
Properties props = new Properties();
@@ -53,14 +64,14 @@ public class MapInterfaceJUnitTest {
.create());
}
catch (Exception e) {
- fail(" failed due to " + e);
+ throw new AssertionError(" failed due to ", e);
}
for (int i = 0; i < 100; i++) {
region.put(new Integer(i), new Integer(i));
}
- Assert.assertEquals(new Integer(50), region.get(new Integer(50)));
+ assertEquals(new Integer(50), region.get(new Integer(50)));
region.localClear();
- Assert.assertEquals(null, region.get(new Integer(50)));
+ assertEquals(null, region.get(new Integer(50)));
region.close();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
@@ -69,7 +80,7 @@ public class MapInterfaceJUnitTest {
.create());
}
catch (Exception e) {
- fail(" failed in creating region due to " + e);
+ throw new AssertionError(" failed in creating region due to ", e);
}
boolean exceptionOccured = false;
try {
@@ -106,7 +117,7 @@ public class MapInterfaceJUnitTest {
.create());
}
catch (Exception e) {
- fail(" failed due to " + e);
+ throw new AssertionError(" failed due to ", e);
}
HashMap m = new HashMap();
m.put("aKey", "aValue");
@@ -117,9 +128,9 @@ public class MapInterfaceJUnitTest {
for (int i = 0; i < 100; i++) {
region.put(new Integer(i), new Integer(i));
}
- Assert.assertEquals(new Integer(50), region.get(new Integer(50)));
+ assertEquals(new Integer(50), region.get(new Integer(50)));
region.localClear();
- Assert.assertEquals(null, region.get(new Integer(50)));
+ assertEquals(null, region.get(new Integer(50)));
region.close();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
@@ -128,7 +139,7 @@ public class MapInterfaceJUnitTest {
.create());
}
catch (Exception e) {
- fail(" failed in creating region due to " + e);
+ throw new AssertionError(" failed in creating region due to ", e);
}
boolean exceptionOccured = false;
try {
@@ -145,11 +156,8 @@ public class MapInterfaceJUnitTest {
ds.disconnect();
}
- protected boolean hasBeenNotified = false;
-
@Test
public void testBeforeRegionClearCallBack() {
-
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
@@ -163,6 +171,7 @@ public class MapInterfaceJUnitTest {
factory.setScope(Scope.LOCAL);
factory.setCacheWriter(new CacheWriterAdapter() {
+ @Override
public void beforeRegionClear(RegionEvent event) throws CacheWriterException {
synchronized (this) {
this.notify();
@@ -184,14 +193,14 @@ public class MapInterfaceJUnitTest {
}
}
catch (Exception e) {
- fail(" failed due to " + e);
+ throw new AssertionError(" failed due to ", e);
}
for (int i = 0; i < 100; i++) {
region.put(new Integer(i), new Integer(i));
}
- Assert.assertEquals(new Integer(50), region.get(new Integer(50)));
+ assertEquals(new Integer(50), region.get(new Integer(50)));
region.localClear();
- Assert.assertEquals(null, region.get(new Integer(50)));
+ assertEquals(null, region.get(new Integer(50)));
region.close();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
@@ -200,7 +209,7 @@ public class MapInterfaceJUnitTest {
.create());
}
catch (Exception e) {
- fail(" failed in creating region due to " + e);
+ throw new AssertionError(" failed in creating region due to ", e);
}
boolean exceptionOccured = false;
try {
@@ -217,11 +226,8 @@ public class MapInterfaceJUnitTest {
ds.disconnect();
}
- protected Region region2 = null;
- protected int counter = 0;
@Test
public void testSetValue() {
-
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
@@ -235,6 +241,7 @@ public class MapInterfaceJUnitTest {
factory.setScope(Scope.LOCAL);
factory.setCacheWriter(new CacheWriterAdapter() {
+ @Override
public void beforeUpdate(EntryEvent event) throws CacheWriterException {
synchronized (this) {
this.notify();
@@ -259,12 +266,11 @@ public class MapInterfaceJUnitTest {
fail(" beforeCreate call back did not come");
}
- Assert.assertEquals(counter,1);
+ assertEquals(counter,1);
}
catch (Exception e) {
- fail(" failed due to " + e);
+ throw new AssertionError(" failed due to ", e);
}
-
}
class DoesClear implements Runnable {
@@ -275,6 +281,7 @@ public class MapInterfaceJUnitTest {
this.region = reg;
}
+ @Override
public void run() {
this.region.clear();
}
@@ -282,10 +289,10 @@ public class MapInterfaceJUnitTest {
class DoesPut implements Runnable {
-
DoesPut() {
}
+ @Override
public void run() {
((Map.Entry)(MapInterfaceJUnitTest.this.region2.entrySet().iterator().next())).setValue(new Integer(8));
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
index 4a5967e..825dd3f 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/MultipleOplogsRollingFeatureJUnitTest.java
@@ -16,39 +16,39 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.After;
+import static org.junit.Assert.*;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.distributed.internal.DistributionConfig;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* The test will verify <br>
* 1. Multiple oplogs are being rolled at once <br>
* 2. The Number of entries getting logged to the HTree are taking care of creation
- *
*/
@Category(IntegrationTest.class)
-public class MultipleOplogsRollingFeatureJUnitTest extends
- DiskRegionTestingBase
-{
+public class MultipleOplogsRollingFeatureJUnitTest extends DiskRegionTestingBase {
- protected Object mutex = new Object();
+ private volatile boolean FLAG = false;
- protected boolean CALLBACK_SET = false;
+ private Object mutex = new Object();
- protected volatile boolean FLAG = false;
+ private boolean CALLBACK_SET = false;
- DiskRegionProperties diskProps = new DiskRegionProperties();
+ private DiskRegionProperties diskProps = new DiskRegionProperties();
- @After
- public void tearDown() throws Exception
- {
+ @Override
+ protected final void preTearDown() throws Exception {
LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = false;
- super.tearDown();
+ }
+
+ @Override
+ protected final void postTearDown() throws Exception {
+ System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "MAX_OPLOGS_PER_COMPACTION");
diskProps.setDiskDirs(dirs);
}
@@ -58,21 +58,21 @@ public class MultipleOplogsRollingFeatureJUnitTest extends
* 2. The Number of entries are properly conflated
*/
@Test
- public void testMultipleRolling()
- {
+ public void testMultipleRolling() throws Exception {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "MAX_OPLOGS_PER_COMPACTION", "17");
+
+ deleteFiles();
+ diskProps.setMaxOplogSize(450);
+ diskProps.setCompactionThreshold(100);
+ region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache,
+ diskProps, Scope.LOCAL);
+ assertNotNull(region);
+ DiskRegion diskRegion = ((LocalRegion)region).getDiskRegion();
+ assertNotNull(diskRegion);
+ LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
+ CacheObserverHolder.setInstance(getCacheObserver());
+
try {
- deleteFiles();
- diskProps.setMaxOplogSize(450);
- diskProps.setCompactionThreshold(100);
- region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache,
- diskProps, Scope.LOCAL);
- assertNotNull(region);
- DiskRegion diskRegion = ((LocalRegion)region).getDiskRegion();
- assertNotNull(diskRegion);
- LocalRegion.ISSUE_CALLBACKS_TO_CACHE_OBSERVER = true;
- CacheObserverHolder.setInstance(getCacheObserver());
- try {
CALLBACK_SET = true;
@@ -85,7 +85,7 @@ public class MultipleOplogsRollingFeatureJUnitTest extends
waitForCompactor(3000/*wait for forceRolling to finish */);
logWriter.info("testMultipleRolling after waitForCompactor");
// the compactor copied two tombstone and 1 entry to oplog #2
- // The total oplog size will become 429, that why we need to
+ // The total oplog size will become 429, that why we need to
// set oplogmaxsize to be 450. After compaction, the size become 151
// the compactor thread is now stuck waiting for mutex.notify
@@ -127,42 +127,33 @@ public class MultipleOplogsRollingFeatureJUnitTest extends
region.forceRolling();
assertEquals(3, diskRegion.getOplogToBeCompacted().length);
- } finally {
+ } finally {
synchronized (mutex) {
// let the compactor go
CALLBACK_SET = false;
FLAG = false;
logWriter.info("testMultipleRolling letting compactor go");
mutex.notify();
-
- }
}
-
- // let the main thread sleep so that rolling gets over
- waitForCompactor(5000);
-
- assertTrue(
- "Number of Oplogs to be rolled is not null : this is unexpected",
- diskRegion.getOplogToBeCompacted() == null);
- cache.close();
- cache = createCache();
- region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache,
- diskProps, Scope.LOCAL);
- assertTrue("Recreated region size is not 1 ", region.size() == 1);
-
- closeDown();
- deleteFiles();
- }
- catch (Exception ex) {
- ex.printStackTrace();
- fail("testMultipleRolling: test failed due to " + ex);
- } finally {
- System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "MAX_OPLOGS_PER_COMPACTION");
}
+
+ // let the main thread sleep so that rolling gets over
+ waitForCompactor(5000);
+
+ assertTrue(
+ "Number of Oplogs to be rolled is not null : this is unexpected",
+ diskRegion.getOplogToBeCompacted() == null);
+ cache.close();
+ cache = createCache();
+ region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache,
+ diskProps, Scope.LOCAL);
+ assertTrue("Recreated region size is not 1 ", region.size() == 1);
+
+ closeDown();
+ deleteFiles();
}
- private void waitForCompactor(long maxWaitingTime)
- {
+ private void waitForCompactor(long maxWaitingTime) {
long maxWaitTime = maxWaitingTime;
long start = System.currentTimeMillis();
while (!FLAG) { // wait until
@@ -179,8 +170,7 @@ public class MultipleOplogsRollingFeatureJUnitTest extends
}
}
- private void addEntries(int opLogNum, int valueSize)
- {
+ private void addEntries(int opLogNum, int valueSize) {
assertNotNull(region);
byte[] val = new byte[valueSize];
for (int i = 0; i < valueSize; ++i) {
@@ -217,8 +207,7 @@ public class MultipleOplogsRollingFeatureJUnitTest extends
}
}
- private CacheObserver getCacheObserver()
- {
+ private CacheObserver getCacheObserver() {
return (new CacheObserverAdapter() {
public void beforeGoingToCompact()
@@ -251,6 +240,5 @@ public class MultipleOplogsRollingFeatureJUnitTest extends
}
});
-
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
index 1b63aec..98d52a0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/NetSearchMessagingDUnitTest.java
@@ -16,22 +16,40 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache30.CacheTestCase;
+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.DataPolicy;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.InterestPolicy;
+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.SubscriptionAttributes;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.DistributionMessage;
import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
import com.gemstone.gemfire.internal.cache.SearchLoadAndWriteProcessor.NetSearchRequestMessage;
-import com.gemstone.gemfire.test.dunit.*;
+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;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import org.junit.experimental.categories.Category;
-public class NetSearchMessagingDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class NetSearchMessagingDUnitTest extends JUnit4CacheTestCase {
- public NetSearchMessagingDUnitTest(String name) {
- super(name);
- }
-
+ @Test
public void testOneMessageWithReplicates() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -90,6 +108,7 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
}
@Category(FlakyTest.class) // GEODE-1155: time sensitive, waitForCriterion
+ @Test
public void testNetSearchNormals() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -147,6 +166,7 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
* demonstrate that a netsearch that gets the value of an overflow entry
* does not update the LRU status of that entry.
*/
+ @Test
public void testNetSearchNoLRU() {
Host host = Host.getHost(0);
VM vm2 = host.getVM(2);
@@ -208,6 +228,7 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
* Make sure that even if we start out by net searching replicates,
* we'll fall back to net searching normal members.
*/
+ @Test
public void testNetSearchFailoverFromReplicate() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -259,6 +280,7 @@ public class NetSearchMessagingDUnitTest extends CacheTestCase {
}
+ @Test
public void testNetSearchFailoverFromOneReplicateToAnother() {
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/OffHeapEvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
index 3d094a0..7c16568 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionDUnitTest.java
@@ -16,26 +16,34 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager.ResourceType;
import com.gemstone.gemfire.internal.cache.lru.HeapEvictor;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+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.junit.categories.DistributedTest;
/**
* Performs eviction dunit tests for off-heap memory.
*/
+@Category(DistributedTest.class)
public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
- public OffHeapEvictionDUnitTest(String name) {
- super(name);
- }
-
+
@Override
public final void preTearDownAssertions() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@@ -59,6 +67,7 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
return properties;
}
+ @Override
public void createCache() {
try {
Properties props = new Properties();
@@ -80,6 +89,7 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
}
}
+ @Override
public void raiseFakeNotification(VM vm, final String prName,
final int noOfExpectedEvictions) {
vm.invoke(new CacheSerializableRunnable("fakeNotification") {
@@ -117,12 +127,14 @@ public class OffHeapEvictionDUnitTest extends EvictionDUnitTest {
@Override
public boolean getOffHeapEnabled() {
return true;
- }
+ }
+ @Override
public HeapEvictor getEvictor() {
return ((GemFireCacheImpl)cache).getOffHeapEvictor();
- }
+ }
+ @Override
public ResourceType getResourceType() {
return ResourceType.OFFHEAP_MEMORY;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
index 7ac1a9a..35697d8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapEvictionStatsDUnitTest.java
@@ -16,28 +16,29 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Performs eviction stat dunit tests for off-heap regions.
+ *
* @since Geode 1.0
*/
+@Category(DistributedTest.class)
public class OffHeapEvictionStatsDUnitTest extends EvictionStatsDUnitTest {
- public OffHeapEvictionStatsDUnitTest(String name) {
- super(name);
- // TODO Auto-generated constructor stub
- }
-
@Override
public final void preTearDownAssertions() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
@@ -61,6 +62,7 @@ public class OffHeapEvictionStatsDUnitTest extends EvictionStatsDUnitTest {
return properties;
}
+ @Override
public void createCache() {
try {
Properties props = new Properties();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java
index f9d2c2a..2d74ab9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OffHeapTestUtil.java
@@ -16,11 +16,11 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.util.Collections;
import java.util.List;
-import junit.framework.Assert;
-
import com.gemstone.gemfire.cache.CacheClosedException;
import com.gemstone.gemfire.internal.offheap.MemoryBlock;
import com.gemstone.gemfire.internal.offheap.RefCountChangeInfo;
@@ -30,7 +30,7 @@ import com.gemstone.gemfire.internal.offheap.MemoryAllocatorImpl;
@SuppressWarnings("deprecation")
public class OffHeapTestUtil {
- public static void checkOrphans() { // TODO:KIRK: need to do something special to guarantee proper tearDown
+ public static void checkOrphans() {
MemoryAllocatorImpl allocator = null;
try {
allocator = MemoryAllocatorImpl.getAllocator();
@@ -57,7 +57,7 @@ public class OffHeapTestUtil {
System.out.println("Sample orphan: " + orphans.get(0));
System.out.println("Orphan info: " + info);
}
- Assert.assertEquals(Collections.emptyList(), orphans);
+ assertEquals(Collections.emptyList(), orphans);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OfflineSnapshotJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OfflineSnapshotJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OfflineSnapshotJUnitTest.java
index 748588f..639d7ea 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OfflineSnapshotJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OfflineSnapshotJUnitTest.java
@@ -16,8 +16,20 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.HashMap;
+import java.util.Map;
+
import com.examples.snapshot.MyObject;
import com.examples.snapshot.MyPdxSerializer;
+import org.junit.After;
+import org.junit.Before;
+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.DiskStore;
@@ -26,20 +38,10 @@ import com.gemstone.gemfire.cache.snapshot.RegionGenerator;
import com.gemstone.gemfire.cache.snapshot.RegionGenerator.RegionType;
import com.gemstone.gemfire.cache.snapshot.RegionGenerator.SerializationType;
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 java.io.File;
-import java.io.FilenameFilter;
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
@Category(IntegrationTest.class)
public class OfflineSnapshotJUnitTest {
+
private RegionGenerator rgen;
private Cache cache;
@@ -88,7 +90,7 @@ public class OfflineSnapshotJUnitTest {
}
}
- public Map<Integer, MyObject> createExpected(SerializationType type, int count) {
+ private Map<Integer, MyObject> createExpected(SerializationType type, int count) {
Map<Integer, MyObject> expected = new HashMap<Integer, MyObject>();
for (int i = 0; i < count; i++) {
expected.put(i, rgen.createData(type, i, "The number is " + i));
@@ -118,7 +120,7 @@ public class OfflineSnapshotJUnitTest {
}
}
- public void reset() {
+ private void reset() {
CacheFactory cf = new CacheFactory()
.set(MCAST_PORT, "0")
.set(LOG_LEVEL, "error")
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
index d1be04d..b283ec3 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/OplogJUnitTest.java
@@ -16,12 +16,7 @@
*/
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.io.File;
import java.io.FileInputStream;
@@ -36,10 +31,10 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.IntStream;
+import com.jayway.awaitility.Awaitility;
import org.apache.commons.io.FileUtils;
-import org.junit.After;
import org.junit.Assert;
-import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -62,13 +57,13 @@ import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.jayway.awaitility.Awaitility;
/**
* Testing Oplog API's
*/
@Category(IntegrationTest.class)
public class OplogJUnitTest extends DiskRegionTestingBase {
+
boolean proceed = false;
private final DiskRegionProperties diskProps = new DiskRegionProperties();
@@ -117,17 +112,13 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
protected volatile Thread rollerThread = null;
@Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
+ protected final void postSetUp() throws Exception {
diskProps.setDiskDirs(dirs);
DiskStoreImpl.SET_IGNORE_PREALLOCATE = true;
}
@Override
- @After
- public void tearDown() throws Exception {
- super.tearDown();
+ protected final void postTearDown() throws Exception {
DiskStoreImpl.SET_IGNORE_PREALLOCATE = false;
}
@@ -2297,10 +2288,10 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
/**
* Tests if buffer size is set but time is not set , the asynch writer gets
* awakened on buffer size basis
- *
*/
- public void DARREL_DISABLE_testAsynchWriterAttribBehaviour2()
- {
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsynchWriterAttribBehaviour2() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
((DiskStoreFactoryImpl)dsf).setMaxOplogSizeInBytes(10000);
dsf.setQueueSize(2);
@@ -2449,8 +2440,9 @@ public class OplogJUnitTest extends DiskRegionTestingBase {
*/
//Now we preallocate spaces for if files and also crfs and drfs. So the below test is not valid
// any more. See revision: r42359 and r42320. So disabling this test.
- public void _testPreblowErrorCondition()
- {
+ @Ignore("TODO: test is disabled")
+ @Test
+ public void testPreblowErrorCondition() {
DiskStoreFactory dsf = cache.createDiskStoreFactory();
((DiskStoreFactoryImpl)dsf).setMaxOplogSizeInBytes(100000000L * 1024L * 1024L * 1024L);
dsf.setAutoCompact(false);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java
index d9260a6..28ddd12 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/P2PDeltaPropagationDUnitTest.java
@@ -16,29 +16,40 @@
*/
package com.gemstone.gemfire.internal.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.DeltaTestImpl;
-import com.gemstone.gemfire.cache.*;
+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.EntryEvent;
+import com.gemstone.gemfire.cache.InterestPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.SubscriptionAttributes;
import com.gemstone.gemfire.cache.client.internal.PoolImpl;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.tcp.ConnectionTable;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
- *
* Tests the P2P delta propagation functionality.
- *
*/
-public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class P2PDeltaPropagationDUnitTest extends JUnit4DistributedTestCase {
static VM server1 = null;
@@ -72,17 +83,12 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
private static boolean check = false;
protected static Object waitLock = new Object();
- /**
- * Constructor
- */
- public P2PDeltaPropagationDUnitTest(String name) {
- super(name);
- }
-
+
/*
* Delta gets distributed in P2P D-ACK.
*/
+ @Test
public void testP2PDeltaPropagationEnableScopeDAck() throws Exception
{
Object args[] = new Object[] { Boolean.TRUE, DataPolicy.REPLICATE,
@@ -102,6 +108,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
* Delta gets distributed in P2P GLOBAL.
*/
+ @Test
public void testP2PDeltaPropagationEnableScopeGlobal() throws Exception
{
Object args[] = new Object[] { Boolean.TRUE, DataPolicy.REPLICATE,
@@ -118,6 +125,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
/*
* Full object gets resend in P2P D-ACK if delta can not be applied.
*/
+ @Test
public void testP2PDACKInvalidDeltaException() throws Exception
{
server1.invoke(() -> P2PDeltaPropagationDUnitTest.createServerCache(Boolean.TRUE));
@@ -136,6 +144,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
/*
* Full object will be send in case of P2P D-ACK(direct-ack = true).
*/
+ @Test
public void testP2PDeltaPropagationEnableDirectAckTrue() throws Exception
{
@@ -154,6 +163,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
/*
* Full object will be send in case of P2P D-NO-ACK
*/
+ @Test
public void testP2PDeltaPropagationEnableScopeDNoAck()throws Exception
{
Object args[] = new Object[] { Boolean.TRUE, DataPolicy.NORMAL,
@@ -169,6 +179,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
/*
* Check for full object gets distributed when DS level delta property is OFF.
*/
+ @Test
public void testP2PDeltaPropagationDisable() throws Exception
{
server1.invoke(() -> P2PDeltaPropagationDUnitTest.createServerCache(Boolean.FALSE));
@@ -180,6 +191,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
/*
* Delta gets distributed in P2P D-ACK with data policy empty on feeder.
*/
+ @Test
public void testP2PDeltaPropagationEnableScopeDAckDataPolicyEmpty()
throws Exception {
Object args[] = new Object[] { Boolean.TRUE, DataPolicy.REPLICATE,
@@ -202,6 +214,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
/*
* Full Onject is gets distributed in P2P D-ACK with data policy empty on feeder when its uses regions create API.
*/
+ @Test
public void testP2PDeltaPropagationEnableScopeDAckDataPolicyEmptyWithRegionsCreateApi()
throws Exception {
Object args[] = new Object[] { Boolean.TRUE, DataPolicy.REPLICATE,
@@ -226,6 +239,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
server3.invoke(() -> P2PDeltaPropagationDUnitTest.verifyNoFailurePeer());
}
+ @Test
public void testPeerWithEmptyRegionIterestPolicyALLReceivesNoDelta() throws Exception {
// 1. Setup three peers, one with a region data policy set to EMPTY.
// 2. Do delta feeds on any one of the two peers with non-EMPTY region data policy.
@@ -250,6 +264,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
server3.invoke(() -> P2PDeltaPropagationDUnitTest.verifyNoDeltaReceived( Integer.valueOf(3) ));
}
+ @Test
public void testPeerWithEmptyRegionDefaultIterestPolicyReceivesNoEvents() throws Exception {
// 1. Setup three peers, one with a region data policy set to EMPTY.
// 2. Do delta feeds on any one of the two peers with non-EMPTY region data policy.
@@ -274,6 +289,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
server3.invoke(() -> P2PDeltaPropagationDUnitTest.verifyNoDeltaReceived( Integer.valueOf(0/* no events */) ));
}
+ @Test
public void testPeerWithEmptyRegionAndNoCacheServerReceivesOnlyFullValue() throws Exception {
// 1. Setup three peers, two with region data policy set to EMPTY.
// 2. Of these two EMPTY peers, only one has a cache server.
@@ -436,7 +452,7 @@ public class P2PDeltaPropagationDUnitTest extends DistributedTestCase
public static void createServerCache(Boolean flag, DataPolicy policy,
Scope scope, Boolean listener, Boolean interestPolicyAll,
Integer port) throws Exception {
- P2PDeltaPropagationDUnitTest test = new P2PDeltaPropagationDUnitTest("temp");
+ P2PDeltaPropagationDUnitTest test = new P2PDeltaPropagationDUnitTest();
Properties props = new Properties();
if (!flag) {
props.setProperty(DELTA_PROPAGATION, "false");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java
index e26b0ae..9ab247e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRBadToDataDUnitTest.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.*;
import com.gemstone.gemfire.*;
@@ -37,12 +46,10 @@ import com.gemstone.gemfire.test.dunit.VM;
*
*
*/
-public class PRBadToDataDUnitTest extends CacheTestCase {
-
- public PRBadToDataDUnitTest(final String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class PRBadToDataDUnitTest extends JUnit4CacheTestCase {
+ @Test
public void testBadToData() {
final Host host = Host.getHost(0);
final VM vm1 = 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/PRDataStoreMemoryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRDataStoreMemoryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRDataStoreMemoryJUnitTest.java
index c28a54d..fe2ca3f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRDataStoreMemoryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PRDataStoreMemoryJUnitTest.java
@@ -16,29 +16,33 @@
*/
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 static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static org.junit.Assert.assertEquals;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* Tests memory allocation operations on a PartitionedRegion on a single node.
- *
*/
@Category(IntegrationTest.class)
public class PRDataStoreMemoryJUnitTest {
- static DistributedSystem sys;
+ private static DistributedSystem sys;
- static Cache cache;
+ private static Cache cache;
@Before
public void setUp() throws Exception {
@@ -71,8 +75,7 @@ public class PRDataStoreMemoryJUnitTest {
}
@Test
- public void testCurrentAllocatedMemory() throws Exception
- {
+ public void testCurrentAllocatedMemory() throws Exception {
PartitionedRegion regionAck1 = (PartitionedRegion)defineRegionFactory()
.create("testCurrentAllocatedemory");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionListenerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionListenerDUnitTest.java
index 3eb3b7d..ec2cd65 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionListenerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionListenerDUnitTest.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.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -38,12 +47,14 @@ import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.VM;
@SuppressWarnings({"serial", "rawtypes", "deprecation", "unchecked"})
-public class PartitionListenerDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionListenerDUnitTest extends JUnit4CacheTestCase {
- public PartitionListenerDUnitTest(String name) {
- super(name);
+ public PartitionListenerDUnitTest() {
+ super();
}
+ @Test
public void testAfterBucketRemovedCreated() 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/PartitionedRegionAPIConserveSocketsFalseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIConserveSocketsFalseDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIConserveSocketsFalseDUnitTest.java
index 8882238..b53aa5a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIConserveSocketsFalseDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIConserveSocketsFalseDUnitTest.java
@@ -20,25 +20,23 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
import java.util.Properties;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
/**
* Test all the PartitionedRegion api calls when ConserveSockets is set to false
+ *
* @since GemFire 5.0
* @see com.gemstone.gemfire.distributed.DistributedSystem#setThreadsSocketPolicy(boolean)
*/
-public class PartitionedRegionAPIConserveSocketsFalseDUnitTest extends
- PartitionedRegionAPIDUnitTest
-{
+@Category(DistributedTest.class)
+public class PartitionedRegionAPIConserveSocketsFalseDUnitTest extends PartitionedRegionAPIDUnitTest {
- public PartitionedRegionAPIConserveSocketsFalseDUnitTest(String name) {
- super(name);
- }
-
-
- public Properties getDistributedSystemProperties()
- {
+ @Override
+ public Properties getDistributedSystemProperties() {
Properties ret = new Properties();
ret.setProperty(CONSERVE_SOCKETS, "false");
return ret;
}
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.java
index a23baf6..45e784a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAPIDUnitTest.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.Iterator;
import java.util.NoSuchElementException;
import java.util.Properties;
@@ -50,10 +59,11 @@ import com.gemstone.gemfire.test.dunit.VM;
* functionality. This test is performed for different region scopes - D_ACK and
* D_NO_ACK for PartitionedRegion.
*/
+@Category(DistributedTest.class)
public class PartitionedRegionAPIDUnitTest extends PartitionedRegionDUnitTestCase {
- public PartitionedRegionAPIDUnitTest(String name) {
- super(name);
+ public PartitionedRegionAPIDUnitTest() {
+ super();
}
Properties props = new Properties();
@@ -1259,7 +1269,8 @@ public class PartitionedRegionAPIDUnitTest extends PartitionedRegionDUnitTestCas
* This is a PartitionedRegion test for scope = D_ACK. 4 VMs are used to
* create the PR with and without(Only Accessor) the DataStore.
*/
- public void testPartitionedRegionOperationsScopeDistAck() throws Exception {
+ @Test
+ public void testPartitionedRegionOperationsScopeDistAck() throws Exception {
Host host = Host.getHost(0);
// create the VM(0 - 4)
vm0 = host.getVM(0);
@@ -1296,6 +1307,7 @@ public class PartitionedRegionAPIDUnitTest extends PartitionedRegionDUnitTestCas
* for scope = D_ACK. 4 VMs are used to
* create the PR with and without(Only Accessor) the DataStore.
*/
+ @Test
public void testPartitionedRegionConcurrentOperations() throws Exception {
Host host = Host.getHost(0);
// create the VM(0 - 4)
@@ -1320,6 +1332,7 @@ public class PartitionedRegionAPIDUnitTest extends PartitionedRegionDUnitTestCas
*
* @throws Exception
*/
+ @Test
public void testPartitionedRegionsOperationsScopeDistEarlyAck()
throws Exception {
final String rName = getUniqueName();
@@ -1384,6 +1397,7 @@ public class PartitionedRegionAPIDUnitTest extends PartitionedRegionDUnitTestCas
*
* @throws Exception
*/
+ @Test
public void testBug36685() throws Exception {
final String rName = getUniqueName();
Host host = Host.getHost(0);
@@ -1429,7 +1443,8 @@ public class PartitionedRegionAPIDUnitTest extends PartitionedRegionDUnitTestCas
});
}
- public void testCacherLoaderHelper() throws Exception
+ @Test
+ public void testCacherLoaderHelper() throws Exception
{
final String rName = getUniqueName();
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/PartitionedRegionAsSubRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAsSubRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAsSubRegionDUnitTest.java
index d8f7c21..fa47bf2 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAsSubRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionAsSubRegionDUnitTest.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 com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -34,13 +43,14 @@ import com.gemstone.gemfire.test.dunit.VM;
*
*
*/
+@Category(DistributedTest.class)
public class PartitionedRegionAsSubRegionDUnitTest extends
PartitionedRegionDUnitTestCase
{
//////constructor //////////
- public PartitionedRegionAsSubRegionDUnitTest(String name) {
- super(name);
+ public PartitionedRegionAsSubRegionDUnitTest() {
+ super();
}//end of constructor
public static final String PR_PREFIX = "PR";
@@ -222,6 +232,7 @@ public class PartitionedRegionAsSubRegionDUnitTest extends
*
* @throws Exception
*/
+ @Test
public void testSubRegionDestroyRegion() throws Exception
{
@@ -254,6 +265,7 @@ public class PartitionedRegionAsSubRegionDUnitTest extends
*
* @throws Exception
*/
+ @Test
public void testSubRegionLocalDestroyRegion() throws Exception
{
@@ -283,6 +295,7 @@ public class PartitionedRegionAsSubRegionDUnitTest extends
*
* @throws Exception
*/
+ @Test
public void testSubRegionClose() throws Exception
{
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
index bb41d50..f451b01 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionBucketCreationDistributionDUnitTest.java
@@ -16,25 +16,53 @@
*/
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.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.Ignore;
+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.CacheExistsException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.MirrorType;
+import com.gemstone.gemfire.cache.PartitionAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.PartitionedRegionStorageException;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.cache.PartitionedRegionDataStore.BucketVisitor;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.ThreadUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
- *
* This class tests bucket Creation and distribution for the multiple Partition
* regions.
*/
-public class PartitionedRegionBucketCreationDistributionDUnitTest extends
- PartitionedRegionDUnitTestCase
-{
+@Category(DistributedTest.class)
+public class PartitionedRegionBucketCreationDistributionDUnitTest extends PartitionedRegionDUnitTestCase {
/** Prefix is used in name of Partition Region */
protected static String prPrefix = null;
@@ -54,11 +82,6 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
/** to store references of 4 vms */
VM vm[] = new VM[4];
- /** constructor */
- public PartitionedRegionBucketCreationDistributionDUnitTest(String name) {
- super(name);
- }
-
/**
* This test performs following operations <br>
* 1. Validate bucket2Node region of the partition regions.</br><br>
@@ -77,6 +100,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
* (c) In case of the partition regions with redundancy > 0 no two bucket
* regions with same bucketId should not be present on the same node.</br>
*/
+ @Test
public void testBucketCreationInMultiplePartitionRegion() throws Throwable
{
Host host = Host.getHost(0);
@@ -126,6 +150,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
* 3. Validates bucket distribution over all the nodes for multiple partition
* regions.</br>
*/
+ @Test
public void testBucketCreationInPRPutFromOneNode() throws Throwable
{
Host host = Host.getHost(0);
@@ -182,6 +207,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
* 3. Validates bucket distribution over all the nodes for multiple partition
* regions.</br>
*/
+ @Test
public void testBucketCreationInMultiplePartitionRegionFromAllNodes()
throws Throwable
{
@@ -242,6 +268,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
* to enIndexForRegion.</br><br>
* 5. Validate bucket creation on new node.</br>
*/
+ @Test
public void testBucketDistributionAfterNodeAdditionInPR() throws Throwable
{
Host host = Host.getHost(0);
@@ -317,6 +344,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
* for the keys in the range 0 to 100 4.test number of buckets created. It
* should be = 11
*/
+ @Test
public void testTotalNumBucketProperty() throws Throwable
{
Host host = Host.getHost(0);
@@ -362,8 +390,9 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
* 2. do put() operations so that size of the objects that were put >
* localMaxMemory of partition region
*/
- public void _testLocalMaxMemoryInPartitionedRegion() throws Throwable
- {
+ @Ignore("TODO")
+ @Test
+ public void testLocalMaxMemoryInPartitionedRegion() throws Throwable {
Host host = Host.getHost(0);
/** creating 4 VMs */
createVMs(host);
@@ -399,6 +428,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
* different reasons, in this case VMs may refuse because they are above
* their maximum.
*/
+ @Test
public void testCompleteBucketAllocation() throws Exception {
final String regionName = getUniqueName();
final int maxBuckets = 23;
@@ -446,6 +476,7 @@ public class PartitionedRegionBucketCreationDistributionDUnitTest extends
* enforce-unique-host = true
* redundancy-zone = "zone"
*/
+ @Test
public void testEnforceUniqueHostForLonerDistributedSystem() {
Cache myCache = createLonerCacheWithEnforceUniqueHost();
try {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheCloseDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
index 17085c7..be8eef6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheCloseDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheCloseDUnitTest.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.Set;
import com.gemstone.gemfire.LogWriter;
@@ -43,13 +52,14 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
*
*
*/
+@Category(DistributedTest.class)
public class PartitionedRegionCacheCloseDUnitTest extends
PartitionedRegionDUnitTestCase
{
//////constructor //////////
- public PartitionedRegionCacheCloseDUnitTest(String name) {
- super(name);
+ public PartitionedRegionCacheCloseDUnitTest() {
+ super();
}//end of constructor
final static int MAX_REGIONS = 1;
@@ -57,6 +67,7 @@ public class PartitionedRegionCacheCloseDUnitTest extends
final int totalNumBuckets = 5;
//////////test methods ////////////////
+ @Test
public void testCacheClose() throws Exception, Throwable
{
final String rName = getUniqueName();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForRootRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForRootRegion.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForRootRegion.java
index 3e9ac02..b9aa48a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForRootRegion.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForRootRegion.java
@@ -16,9 +16,9 @@
*/
package com.gemstone.gemfire.internal.cache;
-import java.util.Properties;
+import static org.junit.Assert.*;
-import junit.framework.Assert;
+import java.util.Properties;
import com.gemstone.gemfire.cache.CacheLoader;
import com.gemstone.gemfire.cache.CacheLoaderException;
@@ -28,18 +28,17 @@ import com.gemstone.gemfire.cache.Declarable;
/**
* This class is CacheLoader for partition region
*/
-public class PartitionedRegionCacheLoaderForRootRegion implements CacheLoader,
- Declarable {
+public class PartitionedRegionCacheLoaderForRootRegion implements CacheLoader, Declarable {
+ @Override
public Object load(LoaderHelper helper) throws CacheLoaderException {
/* checking the attributes set in xml file. */
PartitionedRegion pr = (PartitionedRegion) helper.getRegion();
if (pr.getAttributes().getPartitionAttributes().getRedundantCopies() != 1)
- Assert
- .fail("Redundancy of the partition region is not 1");
+ fail("Redundancy of the partition region is not 1");
- Assert.assertEquals(
+ assertEquals(
pr.getAttributes().getPartitionAttributes().getLocalMaxMemory(), 200);
/*
@@ -47,15 +46,14 @@ public class PartitionedRegionCacheLoaderForRootRegion implements CacheLoader,
* not
*/
return helper.getKey();
-
}
+ @Override
public void close() {
-
}
+ @Override
public void init(Properties props) {
-
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForSubRegion.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForSubRegion.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForSubRegion.java
index e0ba2c2..f824ab5 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForSubRegion.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheLoaderForSubRegion.java
@@ -16,9 +16,9 @@
*/
package com.gemstone.gemfire.internal.cache;
-import java.util.Properties;
+import static org.junit.Assert.*;
-import junit.framework.Assert;
+import java.util.Properties;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache.CacheLoader;
@@ -31,34 +31,33 @@ import com.gemstone.gemfire.cache.Declarable;
*/
public class PartitionedRegionCacheLoaderForSubRegion implements CacheLoader, Declarable {
+ @Override
public Object load(LoaderHelper helper) throws CacheLoaderException {
/* checking the attributes set in xml file */
PartitionedRegion pr = (PartitionedRegion) helper.getRegion();
if (pr.getAttributes().getPartitionAttributes().getRedundantCopies() != 1)
- Assert
- .fail("Redundancy of the partition region is not 1");
+ fail("Redundancy of the partition region is not 1");
- Assert.assertEquals(pr.getAttributes()
+ assertEquals(pr.getAttributes()
.getPartitionAttributes().getGlobalProperties().getProperty(
PartitionAttributesFactory.GLOBAL_MAX_BUCKETS_PROPERTY),
"11");
- Assert.assertEquals(pr.getAttributes()
+ assertEquals(pr.getAttributes()
.getPartitionAttributes().getLocalMaxMemory(), 200);
/*
* Returning the same key. This is to check CaccheLoader is invoked or
* not
*/
return helper.getKey();
-
}
+ @Override
public void close() {
-
}
+ @Override
public void init(Properties props) {
-
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheXMLExampleDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheXMLExampleDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheXMLExampleDUnitTest.java
index a480b4c..63c46f1 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheXMLExampleDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCacheXMLExampleDUnitTest.java
@@ -16,31 +16,33 @@
*/
package com.gemstone.gemfire.internal.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.Cache;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.util.test.TestUtil;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-import java.util.Properties;
-
/**
* This class tests regions created by xml files
*/
-public class PartitionedRegionCacheXMLExampleDUnitTest extends
- PartitionedRegionDUnitTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionCacheXMLExampleDUnitTest extends PartitionedRegionDUnitTestCase {
protected static Cache cache;
- public PartitionedRegionCacheXMLExampleDUnitTest(String name) {
- super(name);
- }
-
- public void testExampleWithBothRootRegion() {
+ @Test
+ public void testExampleWithBothRootRegion() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -94,7 +96,8 @@ public class PartitionedRegionCacheXMLExampleDUnitTest extends
vm1.invoke(validateRegion);
}
- public void testExampleWithSubRegion() {
+ @Test
+ public void testExampleWithSubRegion() {
Host host = Host.getHost(0);
VM vm2 = host.getVM(2);
VM vm3 = host.getVM(3);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java
index e8ce840..6c89ab7 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionCreationDUnitTest.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.Properties;
import org.junit.experimental.categories.Category;
@@ -46,15 +55,16 @@ import com.gemstone.gemfire.test.junit.categories.FlakyTest;
* vm scenario. This will verify the functionality under distributed scenario.
*/
@SuppressWarnings("serial")
+@Category(DistributedTest.class)
public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTestCase {
/**
* constructor
*
* @param name
*/
- public PartitionedRegionCreationDUnitTest(String name) {
+ public PartitionedRegionCreationDUnitTest() {
- super(name);
+ super();
}
static Properties props = new Properties();
@@ -66,6 +76,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
* This tests creates partition regions with scope = DISTRIBUTED_ACK and then
* validating thoes partition regions
*/
+ @Test
public void testSequentialCreation() throws Exception
{
LogWriterUtils.getLogWriter().info("*****CREATION TEST ACK STARTED*****");
@@ -102,6 +113,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
*/
// TODO: fix the hang that concurent creation often runs into -- mthomas
// 2/8/06
+ @Test
public void testConcurrentCreation() throws Throwable
{
LogWriterUtils.getLogWriter().info("*****CREATION TEST NO_ACK STARTED*****");
@@ -148,6 +160,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
*
* @throws Exception
*/
+ @Test
public void testConcurrentCreation_2() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -275,6 +288,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
* Test Partitioned Region names that contain spaces
* @throws Exception
*/
+ @Test
public void testPartitionedRegionNameWithSpaces() throws Exception
{
final String rName = getUniqueName() + " with some spaces";
@@ -305,6 +319,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
* Test whether partition region creation is preveented when
* an instance is created that has the incorrect redundancy
*/
+ @Test
public void testPartitionedRegionRedundancyConflict() throws Exception
{
Host host = Host.getHost(0);
@@ -420,6 +435,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
* @throws Exception
*/
@Category(FlakyTest.class) // GEODE-1104: time sensitive, async actions
+ @Test
public void testPartitionRegionInitialization() throws Throwable
{
final String name = getUniqueName();
@@ -475,6 +491,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
*
* @throws Exception
*/
+ @Test
public void testPartitionRegionRegistration() throws Throwable
{
final String name = getUniqueName();
@@ -534,6 +551,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
*
* @throws Exception
*/
+ @Test
public void testPartitionRegionPersistenceConflicts() throws Throwable
{
IgnoredException.addIgnoredException("IllegalStateException");
@@ -903,6 +921,7 @@ public class PartitionedRegionCreationDUnitTest extends PartitionedRegionDUnitTe
*
* @throws Exception
*/
+ @Test
public void testTotalNumberOfBuckets() throws Exception
{
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/PartitionedRegionDUnitTestCase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDUnitTestCase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDUnitTestCase.java
index d964e5d..0cbab39 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDUnitTestCase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDUnitTestCase.java
@@ -16,6 +16,12 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.CacheException;
import com.gemstone.gemfire.cache.EvictionAction;
@@ -33,15 +39,18 @@ import com.gemstone.gemfire.internal.logging.PureLogWriter;
import com.gemstone.gemfire.test.dunit.Host;
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.dunit.standalone.DUnitLauncher;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* This class is extended by some PartitionedRegion related DUnit test cases
- *
*/
-public class PartitionedRegionDUnitTestCase extends CacheTestCase
-{
+@Category(DistributedTest.class)
+public class PartitionedRegionDUnitTestCase extends JUnit4CacheTestCase {
+
static int oldLogLevel;
+
public void setVMInfoLogLevel() {
SerializableRunnable runnable = new SerializableRunnable() {
public void run() {
@@ -63,6 +72,7 @@ public class PartitionedRegionDUnitTestCase extends CacheTestCase
Host.getHost(0).getVM(i).invoke(runnable);
}
}
+
/**
* Sets the loglevel for the provided log writer
* @param l the {@link LogWriter}
@@ -84,10 +94,6 @@ public class PartitionedRegionDUnitTestCase extends CacheTestCase
return ret;
}
- public PartitionedRegionDUnitTestCase(String name) {
- super(name);
- }
-
/**
* Tear down a PartitionedRegionTestCase by cleaning up the existing cache (mainly
* because we want to destroy any existing PartitionedRegions)
@@ -101,12 +107,15 @@ public class PartitionedRegionDUnitTestCase extends CacheTestCase
protected void preTearDownPartitionedRegionDUnitTest() throws Exception {
}
-
+
+ @BeforeClass
public static void caseSetUp() {
DUnitLauncher.launchIfNeeded();
// this makes sure we don't have any connection left over from previous tests
disconnectAllFromDS();
}
+
+ @AfterClass
public static void caseTearDown() {
// this makes sure we don't leave anything for the next tests
disconnectAllFromDS();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDelayedRecoveryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDelayedRecoveryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDelayedRecoveryDUnitTest.java
index 6a2512f..bdadd8a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDelayedRecoveryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDelayedRecoveryDUnitTest.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.TimeUnit;
@@ -38,10 +47,11 @@ import com.gemstone.gemfire.test.dunit.VM;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
@SuppressWarnings("synthetic-access")
-public class PartitionedRegionDelayedRecoveryDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionDelayedRecoveryDUnitTest extends JUnit4CacheTestCase {
- public PartitionedRegionDelayedRecoveryDUnitTest(String name) {
- super(name);
+ public PartitionedRegionDelayedRecoveryDUnitTest() {
+ super();
}
@Override
@@ -54,6 +64,7 @@ public class PartitionedRegionDelayedRecoveryDUnitTest extends CacheTestCase {
InternalResourceManager.setResourceObserver(null);
}
+ @Test
public void testNoRecovery() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -127,6 +138,7 @@ public class PartitionedRegionDelayedRecoveryDUnitTest extends CacheTestCase {
}
@Category(FlakyTest.class) // GEODE-860: time sensitive, thread unsafe test hook, CountDownLatch, 1 minute timeout, waitForBucketRecovery loops eating InterruptedException
+ @Test
public void testDelay() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -193,6 +205,7 @@ public class PartitionedRegionDelayedRecoveryDUnitTest extends CacheTestCase {
}
@Category(FlakyTest.class) // GEODE-757: time sensitive, fails because event occurs 2 millis too soon, waitForBucketRecovery wait loop eats InterruptedException, thread unsafe test hook
+ @Test
public void testStartupDelay() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);