You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/06/09 17:05:36 UTC
[19/51] [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/locks/TXLockServiceDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java
index 1be5f8e..d939fd4 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/locks/TXLockServiceDUnitTest.java
@@ -16,24 +16,45 @@
*/
package com.gemstone.gemfire.internal.cache.locks;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+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.CommitConflictException;
import com.gemstone.gemfire.distributed.DistributedLockService;
import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.distributed.internal.*;
+import com.gemstone.gemfire.distributed.internal.DM;
+import com.gemstone.gemfire.distributed.internal.DistributionMessage;
+import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
+import com.gemstone.gemfire.distributed.internal.ReplyProcessor21;
import com.gemstone.gemfire.distributed.internal.locks.DLockRecoverGrantorProcessor;
import com.gemstone.gemfire.distributed.internal.locks.DLockService;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.cache.TXRegionLockRequestImpl;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+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.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* This class tests distributed ownership via the DistributedLockService api.
*/
-public class TXLockServiceDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class TXLockServiceDUnitTest extends JUnit4DistributedTestCase {
private static DistributedSystem system;
@@ -42,8 +63,8 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
private InternalDistributedMember lockGrantor;
- public TXLockServiceDUnitTest(String name) {
- super(name);
+ public TXLockServiceDUnitTest() {
+ super();
}
// -------------------------------------------------------------------------
@@ -99,18 +120,23 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
// Test methods
// -------------------------------------------------------------------------
+ @Test
public void testGetAndDestroy() {
forEachVMInvoke("checkGetAndDestroy", new Object[] {});
/*invokeInEveryVM(TXLockServiceDUnitTest.class,
"destroyServices");
forEachVMInvoke("checkGetAndDestroy", new Object[] {});*/
}
-
- public void _ttestGetAndDestroyAgain() {
+
+ @Ignore("TODO: test is disabled")
+ @Test
+ public void testGetAndDestroyAgain() {
testGetAndDestroy();
}
-
- public void disable_testTXRecoverGrantorMessageProcessor() throws Exception {
+
+ @Ignore("TODO: test is disabled")
+ @Test
+ public void testTXRecoverGrantorMessageProcessor() throws Exception {
LogWriterUtils.getLogWriter().info("[testTXOriginatorRecoveryProcessor]");
TXLockService.createDTLS();
checkDLockRecoverGrantorMessageProcessor();
@@ -169,6 +195,8 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
}
protected static volatile TXLockId testTXLock_TXLockId;
+
+ @Test
public void testTXLock() {
LogWriterUtils.getLogWriter().info("[testTXLock]");
final int grantorVM = 0;
@@ -280,6 +308,8 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
}
protected static volatile TXLockId testTXOriginatorRecoveryProcessor_TXLockId;
+
+ @Test
public void testTXOriginatorRecoveryProcessor() {
LogWriterUtils.getLogWriter().info("[testTXOriginatorRecoveryProcessor]");
final int originatorVM = 0;
@@ -374,7 +404,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
TXLockService.destroyServices();
}
});
- Host.getHost(0).getVM(originatorVM).invoke(() -> DistributedTestCase.disconnectFromDS());
+ Host.getHost(0).getVM(originatorVM).invoke(() -> disconnectFromDS());
// grantor sends TXOriginatorRecoveryMessage...
@@ -402,6 +432,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
});
}
+ @Test
public void testDTLSIsDistributed() {
LogWriterUtils.getLogWriter().info("[testDTLSIsDistributed]");
@@ -475,7 +506,7 @@ public class TXLockServiceDUnitTest extends DistributedTestCase {
* Connects a DistributedSystem, saves it in static variable "system"
*/
private static void connectDistributedSystem() {
- system = (new TXLockServiceDUnitTest("dummy")).getSystem();
+ system = (new TXLockServiceDUnitTest()).getSystem();
}
private static InternalDistributedMember identifyLockGrantor(String serviceName) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/lru/LRUClockJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/lru/LRUClockJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/lru/LRUClockJUnitTest.java
index 24685e4..2e596e9 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/lru/LRUClockJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/lru/LRUClockJUnitTest.java
@@ -16,76 +16,54 @@
*/
package com.gemstone.gemfire.internal.cache.lru;
-import com.gemstone.gemfire.*;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.rules.TestName;
+
+import com.gemstone.gemfire.StatisticDescriptor;
+import com.gemstone.gemfire.StatisticsFactory;
+import com.gemstone.gemfire.StatisticsType;
+import com.gemstone.gemfire.StatisticsTypeFactory;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheExistsException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAlgorithm;
+import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.StatisticsTypeFactoryImpl;
import com.gemstone.gemfire.internal.cache.InternalRegionArguments;
import com.gemstone.gemfire.internal.cache.PlaceHolderDiskRegion;
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.util.Properties;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-
-/** This class tests the LRUCapacityController's core clock algorithm. */
+/**
+ * This class tests the LRUCapacityController's core clock algorithm.
+ */
@Category(IntegrationTest.class)
-public class LRUClockJUnitTest extends junit.framework.TestCase {
+public class LRUClockJUnitTest {
private String myTestName;
- //static int unusedPort = AvailablePort.getRandomAvailablePort(AvailablePort.JGROUPS);
-
static Properties sysProps = new Properties();
- static {
- //sysProps.setProperty(DistributionConfig.DistributedSystemConfigProperties.MCAST_PORT, String.valueOf(unusedPort));
- // a loner is all this test needs
- sysProps.setProperty(MCAST_PORT, "0");
- sysProps.setProperty(LOCATORS, "");
- }
- public LRUClockJUnitTest( String name ) {
- super( name );
- this.myTestName = name;
- }
+ @Rule
+ public TestName testName = new TestName();
- protected LRUClockJUnitTest( String prefix, String methodName ) {
- super( methodName );
- this.myTestName = prefix + methodName;
- }
-
- /**
- * The JUnit setup method
- *
- * @exception Exception Description of the Exception
- */
@Before
public void setUp() throws Exception {
- super.setUp();
- System.out.println( "\n\n### beginning " + this.myTestName + "###" );
- }
-
- /**
- * The teardown method for JUnit
- *
- * @exception Exception Description of the Exception
- */
- @After
- public void tearDown() throws Exception {
- super.tearDown();
- System.out.println( "### finished " + this.myTestName + "###" );
+ sysProps = new Properties();
+ sysProps.setProperty(MCAST_PORT, "0");
+ sysProps.setProperty(LOCATORS, "");
}
- /**
- * A unit test for JUnit
- *
- * @exception Exception Description of the Exception
- */
@Test
public void testAddToClockFace() throws Exception {
NewLRUClockHand clock = getAClockHand( getARegion(), new TestEnableLRU() );
@@ -110,8 +88,7 @@ public class LRUClockJUnitTest extends junit.framework.TestCase {
}
@Test
- public void testFIFO() {
- try {
+ public void testFIFO() throws Exception {
NewLRUClockHand clock = getAClockHand( getARegion(), new TestEnableLRU() );
for( int i = 0; i < 100; i++ ) {
@@ -139,15 +116,6 @@ public class LRUClockJUnitTest extends junit.framework.TestCase {
le = (LRUTestEntry) clock.getLRUEntry();
}
assertTrue( "expected 100, found " + counter, counter == 100);
- }
- catch (VirtualMachineError e) {
- SystemFailure.initiateFailure(e);
- throw e;
- }
- catch ( Throwable t ) {
- t.printStackTrace();
- assertTrue( "failed", false );
- }
}
@Test
@@ -267,16 +235,16 @@ public class LRUClockJUnitTest extends junit.framework.TestCase {
}
/** manufacture a node so that a shared type can be used by SharedLRUClockTest. */
- protected LRUTestEntry getANode( int id ) {
+ private LRUTestEntry getANode( int id ) {
return new LocalLRUTestEntry( id );
}
-
- public static interface LRUTestEntry extends LRUClockNode {
+
+ private interface LRUTestEntry extends LRUClockNode {
public int id();
}
/** test implementation of an LRUClockNode */
- public static class LocalLRUTestEntry implements LRUTestEntry {
+ private static class LocalLRUTestEntry implements LRUTestEntry {
int id;
LRUClockNode next;
@@ -293,7 +261,8 @@ public class LRUClockJUnitTest extends junit.framework.TestCase {
recentlyUsed = false;
evicted = false;
}
-
+
+ @Override
public int id() {
return id;
}
@@ -301,108 +270,121 @@ public class LRUClockJUnitTest extends junit.framework.TestCase {
public boolean isTombstone() {
return false;
}
-
+
+ @Override
public void setNextLRUNode( LRUClockNode next ) {
this.next = next;
}
-
+
+ @Override
public LRUClockNode nextLRUNode() {
return this.next;
}
+ @Override
public void setPrevLRUNode( LRUClockNode prev ) {
this.prev = prev;
}
-
+
+ @Override
public LRUClockNode prevLRUNode() {
return this.prev;
}
-
-
+
+ @Override
public int updateEntrySize( EnableLRU cc ) {
return this.size = 1;
}
+ @Override
public int updateEntrySize(EnableLRU cc, Object value) {
return this.size = 1;
}
-
+
+ @Override
public int getEntrySize() {
return this.size;
}
/** this should only happen with the LRUClockHand sync'ed */
+ @Override
public void setEvicted() {
evicted = true;
}
+ @Override
public void unsetEvicted() {
evicted = false;
}
-
+
+ @Override
public boolean testEvicted( ) {
return evicted;
}
-
+
+ @Override
public boolean testRecentlyUsed() {
return recentlyUsed;
}
-
+
+ @Override
public void setRecentlyUsed() {
recentlyUsed = true;
}
-
+
+ @Override
public void unsetRecentlyUsed() {
recentlyUsed = false;
}
+
public LRUClockNode absoluteSelf( ) { return this; }
public LRUClockNode clearClones( ) { return this; }
public int cloneCount( ) { return 0; }
}
-
- public class TestEnableLRU implements EnableLRU {
+ private class TestEnableLRU implements EnableLRU {
private final StatisticsType statType;
{
- // create the stats type for MemLRU.
- StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
-
- final String bytesAllowedDesc =
- "Number of total bytes allowed in this region.";
- final String byteCountDesc =
- "Number of bytes in region.";
- final String lruEvictionsDesc =
- "Number of total entry evictions triggered by LRU.";
- final String lruEvaluationsDesc =
- "Number of entries evaluated during LRU operations.";
- final String lruGreedyReturnsDesc =
- "Number of non-LRU entries evicted during LRU operations";
- final String lruDestroysDesc =
- "Number of entry destroys triggered by LRU.";
- final String lruDestroysLimitDesc =
- "Maximum number of entry destroys triggered by LRU before scan occurs.";
-
- statType = f.createType( "TestLRUStatistics",
- "Statistics about byte based Least Recently Used region entry disposal",
- new StatisticDescriptor[] {
- f.createLongGauge("bytesAllowed", bytesAllowedDesc, "bytes" ),
- f.createLongGauge("byteCount", byteCountDesc, "bytes" ),
- f.createLongCounter("lruEvictions", lruEvictionsDesc, "entries" ),
- f.createLongCounter("lruEvaluations", lruEvaluationsDesc, "entries" ),
- f.createLongCounter("lruGreedyReturns", lruGreedyReturnsDesc, "entries"),
- f.createLongCounter("lruDestroys", lruDestroysDesc, "entries" ),
- f.createLongCounter("lruDestroysLimit", lruDestroysLimitDesc, "entries" ),
- }
- );
- }
-
-
+ // create the stats type for MemLRU.
+ StatisticsTypeFactory f = StatisticsTypeFactoryImpl.singleton();
+
+ final String bytesAllowedDesc =
+ "Number of total bytes allowed in this region.";
+ final String byteCountDesc =
+ "Number of bytes in region.";
+ final String lruEvictionsDesc =
+ "Number of total entry evictions triggered by LRU.";
+ final String lruEvaluationsDesc =
+ "Number of entries evaluated during LRU operations.";
+ final String lruGreedyReturnsDesc =
+ "Number of non-LRU entries evicted during LRU operations";
+ final String lruDestroysDesc =
+ "Number of entry destroys triggered by LRU.";
+ final String lruDestroysLimitDesc =
+ "Maximum number of entry destroys triggered by LRU before scan occurs.";
+
+ statType = f.createType( "TestLRUStatistics",
+ "Statistics about byte based Least Recently Used region entry disposal",
+ new StatisticDescriptor[] {
+ f.createLongGauge("bytesAllowed", bytesAllowedDesc, "bytes" ),
+ f.createLongGauge("byteCount", byteCountDesc, "bytes" ),
+ f.createLongCounter("lruEvictions", lruEvictionsDesc, "entries" ),
+ f.createLongCounter("lruEvaluations", lruEvaluationsDesc, "entries" ),
+ f.createLongCounter("lruGreedyReturns", lruGreedyReturnsDesc, "entries"),
+ f.createLongCounter("lruDestroys", lruDestroysDesc, "entries" ),
+ f.createLongCounter("lruDestroysLimit", lruDestroysLimitDesc, "entries" ),
+ }
+ );
+ }
+
+ @Override
public int entrySize( Object key, Object value ) throws IllegalArgumentException {
return 1;
}
-
+
+ @Override
public long limit( ) {
return 20;
}
@@ -410,66 +392,79 @@ public class LRUClockJUnitTest extends junit.framework.TestCase {
public boolean usesMem( ) {
return false;
}
-
+
+ @Override
public EvictionAlgorithm getEvictionAlgorithm() {
return EvictionAlgorithm.LRU_ENTRY;
}
-
+
+ @Override
public LRUStatistics getStats() {
return null;
}
+ @Override
public EvictionAction getEvictionAction() {
return EvictionAction.DEFAULT_EVICTION_ACTION;
}
- public StatisticsType getStatisticsType() {
- return statType;
- }
+ @Override
+ public StatisticsType getStatisticsType() {
+ return statType;
+ }
- public String getStatisticsName() {
- return "TestLRUStatistics";
- }
+ @Override
+ public String getStatisticsName() {
+ return "TestLRUStatistics";
+ }
- public int getLimitStatId() {
- return statType.nameToId("bytesAllowed");
+ @Override
+ public int getLimitStatId() {
+ return statType.nameToId("bytesAllowed");
+ }
- }
+ @Override
+ public int getCountStatId() {
+ return statType.nameToId("byteCount");
+ }
- public int getCountStatId() {
- return statType.nameToId("byteCount");
- }
+ @Override
+ public int getEvictionsStatId() {
+ return statType.nameToId("lruEvictions");
+ }
- public int getEvictionsStatId() {
- return statType.nameToId("lruEvictions");
- }
+ @Override
+ public int getDestroysStatId() {
+ return statType.nameToId("lruDestroys");
+ }
- public int getDestroysStatId() {
- return statType.nameToId("lruDestroys");
- }
+ @Override
+ public int getDestroysLimitStatId() {
+ return statType.nameToId("lruDestroysLimit");
+ }
- public int getDestroysLimitStatId() {
- return statType.nameToId("lruDestroysLimit");
- }
+ @Override
+ public int getEvaluationsStatId() {
+ return statType.nameToId("lruEvaluations");
+ }
- public int getEvaluationsStatId() {
- return statType.nameToId("lruEvaluations");
- }
-
- public int getGreedyReturnsStatId() {
- return statType.nameToId("lruGreedyReturns");
- }
+ @Override
+ public int getGreedyReturnsStatId() {
+ return statType.nameToId("lruGreedyReturns");
+ }
+ @Override
public boolean mustEvict(LRUStatistics stats, Region region, int delta) {
throw new UnsupportedOperationException("Not implemented");
}
+ @Override
public void afterEviction() {
throw new UnsupportedOperationException("Not implemented");
}
- public LRUStatistics initStats(Object region, StatisticsFactory sf)
- {
+ @Override
+ public LRUStatistics initStats(Object region, StatisticsFactory sf) {
String regionName;
if (region instanceof Region) {
regionName = ((Region)region).getName();
@@ -486,7 +481,7 @@ public class LRUClockJUnitTest extends junit.framework.TestCase {
}
/** overridden in SharedLRUClockTest to test SharedLRUClockHand */
- protected NewLRUClockHand getAClockHand( Region reg, EnableLRU elru ) {
+ private NewLRUClockHand getAClockHand( Region reg, EnableLRU elru ) {
return new NewLRUClockHand( reg, elru,new InternalRegionArguments());
}
@@ -503,7 +498,7 @@ public class LRUClockJUnitTest extends junit.framework.TestCase {
if ( root == null ) {
root = c.createRegion("root", af.create() );
}
- Region sub = root.createSubregion( myTestName, af.create() );
+ Region sub = root.createSubregion( testName.getMethodName(), af.create() );
return sub;
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
index f796945..90b8ecc 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug39356DUnitTest.java
@@ -16,11 +16,14 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+import static org.junit.Assert.*;
+
import java.io.Serializable;
import java.util.List;
import java.util.Set;
-import junit.framework.Assert;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.CancelException;
import com.gemstone.gemfire.LogWriter;
@@ -30,7 +33,6 @@ import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.PartitionAttributes;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.internal.DistributionManager;
import com.gemstone.gemfire.distributed.internal.DistributionMessage;
import com.gemstone.gemfire.distributed.internal.DistributionMessageObserver;
@@ -39,28 +41,24 @@ import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedM
import com.gemstone.gemfire.internal.cache.ForceReattemptException;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.PartitionedRegionDataStore;
-import com.gemstone.gemfire.internal.cache.partitioned.ManageBucketMessage;
import com.gemstone.gemfire.test.dunit.Host;
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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+@Category(DistributedTest.class)
+public class Bug39356DUnitTest extends JUnit4CacheTestCase {
-/**
- *
- */
-public class Bug39356DUnitTest extends CacheTestCase {
protected static final String REGION_NAME = "myregion";
- public Bug39356DUnitTest(String name) {
- super(name);
- }
-
/**
* This tests the case where the VM forcing other
* VMs to create a bucket crashes while creating the bucket.
*/
+ @Test
public void testCrashWhileCreatingABucket() {
Host host = Host.getHost(0);
final VM vm0 = host.getVM(0);
@@ -127,9 +125,9 @@ public class Bug39356DUnitTest extends CacheTestCase {
log.info("skipping bucket " + i + " because it has no data");
continue;
}
- Assert.assertEquals("Expecting bucket " + i + " to have two copies", 2, owners.size());
+ assertEquals("Expecting bucket " + i + " to have two copies", 2, owners.size());
log.info("bucket " + i + " had two copies");
- }
+ }
}
};
vm1.invoke(verifyBuckets);
@@ -174,6 +172,7 @@ public class Bug39356DUnitTest extends CacheTestCase {
* A test to make sure that we cannot move a bucket to a member which already
* hosts the bucket, thereby reducing our redundancy.
*/
+ @Test
public void testMoveBucketToHostThatHasTheBucketAlready() {
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/partitioned/Bug43684DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java
index 939e09a..2dd4dc3 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug43684DUnitTest.java
@@ -16,7 +16,21 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+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.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
@@ -27,24 +41,22 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.LocalRegion;
import com.gemstone.gemfire.internal.cache.RegionEntry;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* TODO This doesn't really test the optimised RI behaviour but only that RI
* works. But there must be other tests doing the same.
- *
- *
*/
+@Category(DistributedTest.class)
@SuppressWarnings("serial")
-public class Bug43684DUnitTest extends DistributedTestCase {
+public class Bug43684DUnitTest extends JUnit4DistributedTestCase {
- private static final String REGION_NAME = "Bug43684DUnitTest";
+ private static final String REGION_NAME = Bug43684DUnitTest.class.getSimpleName();
private static GemFireCacheImpl cache;
@@ -60,10 +72,6 @@ public class Bug43684DUnitTest extends DistributedTestCase {
private static int numBuckets = 11;
- public Bug43684DUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
host = Host.getHost(0);
@@ -87,17 +95,20 @@ public class Bug43684DUnitTest extends DistributedTestCase {
if (cache != null && !cache.isClosed()) {
cache.close();
}
- DistributedTestCase.disconnectFromDS();
+ disconnectFromDS();
}
+ @Test
public void testRIWithSingleKeyOnRR() throws Exception {
doRegisterInterest("KEY_1", null, numBuckets, true, false);
}
+ @Test
public void testRIWithAllKeysOnRR() throws Exception {
doRegisterInterest(null, null, numBuckets, true, false);
}
+ @Test
public void testRIWithKeyListOnRR() throws Exception {
ArrayList<String> riKeys = new ArrayList<String>();
riKeys.add("KEY_0");
@@ -111,18 +122,22 @@ public class Bug43684DUnitTest extends DistributedTestCase {
doRegisterInterest(riKeys, null, numBuckets, true, false);
}
+ @Test
public void testRIWithRegularExpressionOnRR() throws Exception{
doRegisterInterest(null, "^[X][_].*", numBuckets, true, false);
}
+ @Test
public void testRIWithSingleKeyOnPR() throws Exception {
doRegisterInterest("KEY_1", null);
}
+ @Test
public void testRIWithAllKeysOnPR() throws Exception {
doRegisterInterest(null, null);
}
+ @Test
public void testRIWithKeyListOnPR() throws Exception {
ArrayList<String> riKeys = new ArrayList<String>();
riKeys.add("KEY_0");
@@ -136,22 +151,27 @@ public class Bug43684DUnitTest extends DistributedTestCase {
doRegisterInterest(riKeys, null);
}
+ @Test
public void testRIWithRegularExpressionOnPR() throws Exception{
doRegisterInterest(null, "^[X][_].*");
}
+ @Test
public void testRIWithMoreEntriesOnPR() throws Exception{
doRegisterInterest(null, null, 5147, false, false);
}
+ @Test
public void testRIWithSingleKeyOnEmptyPrimaryOnPR() throws Exception {
doRegisterInterest("KEY_1", null, numBuckets, false, true);
}
+ @Test
public void testRIWithAllKeysOnEmptyPrimaryOnPR() throws Exception {
doRegisterInterest(null, null, numBuckets, false, true);
}
+ @Test
public void testRIWithKeyListOnEmptyPrimaryOnPR() throws Exception {
ArrayList<String> riKeys = new ArrayList<String>();
riKeys.add("KEY_0");
@@ -165,10 +185,12 @@ public class Bug43684DUnitTest extends DistributedTestCase {
doRegisterInterest(riKeys, null, numBuckets, false, true);
}
+ @Test
public void testRIWithRegularExpressionOnEmptyPrimaryOnPR() throws Exception{
doRegisterInterest(null, "^[X][_].*", numBuckets, false, true);
}
+ @Test
public void testNativeClientIssueOnPR() throws Exception{
ArrayList<String> riKeys = new ArrayList<String>();
riKeys.add("OPKEY_0");
@@ -229,7 +251,7 @@ public class Bug43684DUnitTest extends DistributedTestCase {
@SuppressWarnings("rawtypes")
public static Integer createServerCache(Boolean isReplicated, Boolean isPrimaryEmpty) throws Exception {
- DistributedTestCase.disconnectFromDS();
+ disconnectFromDS();
Properties props = new Properties();
props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
props.setProperty(STATISTIC_ARCHIVE_FILE, "server_" + OSProcess.getId()
@@ -256,7 +278,7 @@ public class Bug43684DUnitTest extends DistributedTestCase {
@SuppressWarnings({ "unchecked", "rawtypes" })
public static void createClientCache(Host host, Integer port) {
- DistributedTestCase.disconnectFromDS();
+ disconnectFromDS();
Properties props = new Properties();
props.setProperty(STATISTIC_ARCHIVE_FILE, "client_" + OSProcess.getId()
+ ".gfs");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java
index ba24fe1..d46b0f5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug47388DUnitTest.java
@@ -19,7 +19,22 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
+import java.util.Properties;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.ExpirationAction;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
+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.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
@@ -31,11 +46,12 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.ha.HARegionQueueStats;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.dunit.Host;
+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.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* The test creates two datastores with a partitioned region, and also running a
@@ -45,11 +61,10 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
* ensures that the EXPIRE_DESTROY events are propagated to the subscriber
* client and the secondary server does process the QRMs for the EXPIRE_DESTROY
* events.
- *
- *
*/
+@Category(DistributedTest.class)
@SuppressWarnings("serial")
-public class Bug47388DUnitTest extends DistributedTestCase {
+public class Bug47388DUnitTest extends JUnit4DistributedTestCase {
private static VM vm0 = null;
private static VM vm1 = null;
@@ -60,14 +75,7 @@ public class Bug47388DUnitTest extends DistributedTestCase {
private static volatile boolean lastKeyDestroyed = false;
- public static final String REGION_NAME = "Bug47388DUnitTest_region";
-
- /**
- * @param name
- */
- public Bug47388DUnitTest(String name) {
- super(name);
- }
+ public static final String REGION_NAME = Bug47388DUnitTest.class.getSimpleName() + "_region";
@Override
public final void postSetUp() throws Exception {
@@ -109,10 +117,9 @@ public class Bug47388DUnitTest extends DistributedTestCase {
}
@SuppressWarnings("deprecation")
- public static Integer createCacheServerWithPRDatastore()//Integer mcastPort)
- throws Exception {
+ public static Integer createCacheServerWithPRDatastore() throws Exception {
Properties props = new Properties();
- Bug47388DUnitTest test = new Bug47388DUnitTest("Bug47388DUnitTest");
+ Bug47388DUnitTest test = new Bug47388DUnitTest();
DistributedSystem ds = test.getSystem(props);
ds.disconnect();
cache = (GemFireCacheImpl)CacheFactory.create(test.getSystem());
@@ -135,15 +142,13 @@ public class Bug47388DUnitTest extends DistributedTestCase {
}
@SuppressWarnings("deprecation")
- public static void createClientCache(Host host, Integer[] ports, Boolean doRI)
- throws Exception {
-
+ public static void createClientCache(Host host, Integer[] ports, Boolean doRI) throws Exception {
Properties props = new Properties();
props.setProperty(DURABLE_CLIENT_ID,
"my-durable-client-" + ports.length);
props.setProperty(DURABLE_CLIENT_TIMEOUT, "300000");
- DistributedSystem ds = new Bug47388DUnitTest("Bug47388DUnitTest").getSystem(props);
+ DistributedSystem ds = new Bug47388DUnitTest().getSystem(props);
ds.disconnect();
ClientCacheFactory ccf = new ClientCacheFactory(props);
ccf.setPoolSubscriptionEnabled(doRI);
@@ -174,12 +179,10 @@ public class Bug47388DUnitTest extends DistributedTestCase {
region.registerInterest("ALL_KEYS", true);
cache.readyForEvents();
}
-
}
@SuppressWarnings("unchecked")
- public static void doPuts(Integer numOfSets, Integer numOfPuts)
- throws Exception {
+ public static void doPuts(Integer numOfSets, Integer numOfPuts) throws Exception {
Region<String, String> region = cache.getRegion(REGION_NAME);
for (int i = 0; i < numOfSets; i++) {
@@ -195,8 +198,7 @@ public class Bug47388DUnitTest extends DistributedTestCase {
.getClientProxies().toArray()[0]).isPrimary();
}
- public static void verifyClientSubscriptionStats(final Boolean isPrimary,
- final Integer events) throws Exception {
+ public static void verifyClientSubscriptionStats(final Boolean isPrimary, final Integer events) throws Exception {
WaitCriterion wc = new WaitCriterion() {
private long dispatched;
@@ -254,7 +256,9 @@ public class Bug47388DUnitTest extends DistributedTestCase {
Wait.waitForCriterion(wc, 60 * 1000, 500, true);
}
- public void bug51931_testQRMOfExpiredEventsProcessedSuccessfully() throws Exception {
+ @Ignore("TODO: test is disabled due to bug51931")
+ @Test
+ public void testQRMOfExpiredEventsProcessedSuccessfully() throws Exception {
int numOfSets = 2, numOfPuts = 5;
int totalEvents = 23; // = (numOfSets * numOfPuts) * 2 [eviction-destroys] +
// 2 [last key's put and eviction-destroy] + 1 [marker
@@ -269,8 +273,4 @@ public class Bug47388DUnitTest extends DistributedTestCase {
vm0.invoke(() -> Bug47388DUnitTest.verifyClientSubscriptionStats( isvm0Primary, totalEvents ));
vm1.invoke(() -> Bug47388DUnitTest.verifyClientSubscriptionStats( !isvm0Primary, totalEvents ));
}
- public void testNothingBecauseOfBug51931() {
- // remove this when bug #51931 is fixed
- }
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java
index 9193719..d7366eb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/Bug51400DUnitTest.java
@@ -19,6 +19,14 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+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.CacheFactory;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.RegionFactory;
@@ -33,17 +41,16 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientNotifier;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxy;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheClientProxyStats;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.AsyncInvocation;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-
-/**
- *
- *
- */
-public class Bug51400DUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class Bug51400DUnitTest extends JUnit4DistributedTestCase {
private static VM server0 = null;
private static VM server1 = null;
@@ -54,13 +61,6 @@ public class Bug51400DUnitTest extends DistributedTestCase {
public static final String REGION_NAME = "Bug51400DUnitTest_region";
- /**
- * @param name
- */
- public Bug51400DUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -92,7 +92,7 @@ public class Bug51400DUnitTest extends DistributedTestCase {
Properties props = new Properties();
props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
- Bug51400DUnitTest test = new Bug51400DUnitTest("Bug51400DUnitTest");
+ Bug51400DUnitTest test = new Bug51400DUnitTest();
DistributedSystem ds = test.getSystem(props);
ds.disconnect();
cache = (GemFireCacheImpl)CacheFactory.create(test.getSystem());
@@ -116,7 +116,7 @@ public class Bug51400DUnitTest extends DistributedTestCase {
Integer interval) throws Exception {
Properties props = new Properties();
- DistributedSystem ds = new Bug51400DUnitTest("Bug51400DUnitTest").getSystem(props);
+ DistributedSystem ds = new Bug51400DUnitTest().getSystem(props);
ds.disconnect();
ClientCacheFactory ccf = new ClientCacheFactory(props);
ccf.setPoolSubscriptionEnabled(true);
@@ -148,6 +148,7 @@ public class Bug51400DUnitTest extends DistributedTestCase {
+ (isPrimary ? "primary." : "secondary."), numOfEvents.intValue(), qSize);
}
+ @Test
public void testNothing() {
// remove when ticket #51932 is fixed
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java
index aa03833..56f6f99 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/ElidedPutAllDUnitTest.java
@@ -15,6 +15,15 @@
* limitations under the License.
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+
+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.HashMap;
import java.util.Map;
@@ -44,17 +53,19 @@ import com.gemstone.gemfire.test.dunit.VM;
/**
*
*/
-public class ElidedPutAllDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ElidedPutAllDUnitTest extends JUnit4CacheTestCase {
private static final long serialVersionUID = -184003583877999750L;
- public ElidedPutAllDUnitTest(String name) {
- super(name);
+ public ElidedPutAllDUnitTest() {
+ super();
}
/**
* bug #47425 - elided putAll event causes PutAllPartialResultException
*/
+ @Test
public void testElidedPutAllOnPR() throws Exception {
final String regionName = getUniqueName() + "Region";
final String key = "key-1";
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java
index 8d05dea..2330cb9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionResolverDUnitTest.java
@@ -19,6 +19,16 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+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 com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.CacheTransactionManager;
import com.gemstone.gemfire.cache.EntryOperation;
@@ -54,7 +64,8 @@ import java.util.concurrent.atomic.AtomicInteger;
* and not called while local iteration.
*
*/
-public class PartitionResolverDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionResolverDUnitTest extends JUnit4CacheTestCase {
final private static String CUSTOMER = "custRegion";
final private static String ORDER = "orderRegion";
@@ -65,8 +76,8 @@ public class PartitionResolverDUnitTest extends CacheTestCase {
/**
* @param name
*/
- public PartitionResolverDUnitTest(String name) {
- super(name);
+ public PartitionResolverDUnitTest() {
+ super();
}
@Override
@@ -178,36 +189,42 @@ public class PartitionResolverDUnitTest extends CacheTestCase {
}
});
}
+ @Test
public void testKeysInIterationOnAccessor() {
resolverInIteration(IteratorType.KEYS, accessor);
verifyResolverCountInVM(accessor, 0);
verifyResolverCountInVM(datastore1, 0);
verifyResolverCountInVM(datastore2, 0);
}
+ @Test
public void testValuesInIterationOnAccessor() {
resolverInIteration(IteratorType.VALUES, accessor);
verifyResolverCountInVM(accessor, 0);
verifyResolverCountInVM(datastore1, getNumberOfKeysOwnedByVM(datastore1));
verifyResolverCountInVM(datastore2, getNumberOfKeysOwnedByVM(datastore2));
}
+ @Test
public void testEntriesInIterationOnAccessor() {
resolverInIteration(IteratorType.ENTRIES, accessor);
verifyResolverCountInVM(accessor, 0);
verifyResolverCountInVM(datastore1, getNumberOfKeysOwnedByVM(datastore1));
verifyResolverCountInVM(datastore2, getNumberOfKeysOwnedByVM(datastore2));
}
+ @Test
public void testKeysInIterationOnDataStore() {
resolverInIteration(IteratorType.KEYS, datastore1);
verifyResolverCountInVM(accessor, 0);
verifyResolverCountInVM(datastore1, 0);
verifyResolverCountInVM(datastore2, 0);
}
+ @Test
public void testValuesInIterationOnDataStore() {
resolverInIteration(IteratorType.VALUES, datastore1);
verifyResolverCountInVM(accessor, 0);
verifyResolverCountInVM(datastore1, 0);
verifyResolverCountInVM(datastore2, getNumberOfKeysOwnedByVM(datastore2));
}
+ @Test
public void testEntriesInIterationOnDataStore() {
resolverInIteration(IteratorType.ENTRIES, datastore1);
verifyResolverCountInVM(accessor, 0);
@@ -250,6 +267,7 @@ public class PartitionResolverDUnitTest extends CacheTestCase {
vm.invoke(doIteration);
}
+ @Test
public void testKeysIterationInFunctionExection() {
doIterationInFunction(IteratorType.KEYS);
verifyResolverCountInVM(accessor, 0);
@@ -257,6 +275,7 @@ public class PartitionResolverDUnitTest extends CacheTestCase {
verifyResolverCountInVM(datastore2, 0);
}
+ @Test
public void testValuesIterationInFunctionExection() {
doIterationInFunction(IteratorType.VALUES);
verifyResolverCountInVM(accessor, 0);
@@ -264,6 +283,7 @@ public class PartitionResolverDUnitTest extends CacheTestCase {
verifyResolverCountInVM(datastore2, 0);
}
+ @Test
public void testEntriesIterationInFunctionExection() {
doIterationInFunction(IteratorType.ENTRIES);
verifyResolverCountInVM(accessor, 0);
@@ -337,6 +357,7 @@ public class PartitionResolverDUnitTest extends CacheTestCase {
}
}
+ @Test
public void testOps() {
initAccessorAndDataStore(0);
doOps(false);
@@ -345,7 +366,9 @@ public class PartitionResolverDUnitTest extends CacheTestCase {
verifyResolverCountInVM(datastore2, getResolverCountForVM(datastore2));
}
- public void _testTxOps() {
+ @Ignore("TODO")
+ @Test
+ public void testTxOps() {
initAccessorAndDataStore(0);
doOps(true);
verifyResolverCountInVM(accessor, 7);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java
index 61b5c69..4cef3c8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionLoaderWriterDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+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.Serializable;
import java.util.Properties;
@@ -36,7 +45,8 @@ import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.VM;
-public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionLoaderWriterDUnitTest extends JUnit4CacheTestCase {
private static final String PartitionedRegionName = "PartitionedRegionTest";
@@ -53,10 +63,11 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
/**
* @param name
*/
- public PartitionedRegionLoaderWriterDUnitTest(String name) {
- super(name);
+ public PartitionedRegionLoaderWriterDUnitTest() {
+ super();
}
+ @Test
public void testLoader_OnAccessor_NotOnDataStore(){
host = Host.getHost(0);
accessor = host.getVM(0);
@@ -65,6 +76,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
datastore1.invoke(() -> PartitionedRegionLoaderWriterDUnitTest.createRegion(null, null, 10));
}
+ @Test
public void testWriter_NotOnAccessor_OnDataStore(){
host = Host.getHost(0);
accessor = host.getVM(1);
@@ -73,6 +85,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
datastore1.invoke(() -> PartitionedRegionLoaderWriterDUnitTest.createRegion(null, new CacheWriter2(), 10));
}
+ @Test
public void testWriter_OnDataStore_NotOnAccessor(){
host = Host.getHost(0);
accessor = host.getVM(1);
@@ -81,6 +94,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
accessor.invoke(() -> PartitionedRegionLoaderWriterDUnitTest.createRegion(null, null, 0));
}
+ @Test
public void testLoader_OnAccessor_NotOnFirstDataStore_OnSecondDataStore(){
host = Host.getHost(0);
accessor = host.getVM(1);
@@ -91,6 +105,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
datastore2.invoke(() -> PartitionedRegionLoaderWriterDUnitTest.createRegionWithPossibleFail(new CacheLoader2(),null, 10));
}
+ @Test
public void testLoader_NotOnFirstDataStore_OnAccessor_OnSecondDataStore(){
host = Host.getHost(0);
accessor = host.getVM(1);
@@ -101,6 +116,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
datastore2.invoke(() -> PartitionedRegionLoaderWriterDUnitTest.createRegionWithPossibleFail(new CacheLoader2(),null, 10));
}
+ @Test
public void testLoader_OnFirstDataStore_OnSecondDataStore_OnAccessor(){
host = Host.getHost(0);
accessor = host.getVM(1);
@@ -111,6 +127,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
accessor.invoke(() -> PartitionedRegionLoaderWriterDUnitTest.createRegion(new CacheLoader2(), null, 0));
}
+ @Test
public void testLoader_OnFirstDataStore_OnSecondDataStore_NotOnAccessor(){
host = Host.getHost(0);
accessor = host.getVM(1);
@@ -124,7 +141,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
public static void createRegion(CacheLoader cacheLoader, CacheWriter cacheWriter, Integer localMaxMemory) {
try {
- new PartitionedRegionLoaderWriterDUnitTest("DUnitTests")
+ new PartitionedRegionLoaderWriterDUnitTest()
.createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setCacheLoader(cacheLoader);
@@ -144,7 +161,7 @@ public class PartitionedRegionLoaderWriterDUnitTest extends CacheTestCase {
public static void createRegionWithPossibleFail(CacheLoader cacheLoader,
CacheWriter cacheWriter, Integer localMaxMemory) {
final PartitionedRegionLoaderWriterDUnitTest test =
- new PartitionedRegionLoaderWriterDUnitTest("DUnitTests");
+ new PartitionedRegionLoaderWriterDUnitTest();
test.createCache(new Properties());
// add expected exception
test.cache.getLogger().info("<ExpectedException action=add>"
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java
index 31b6c48..a6716b2 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PartitionedRegionMetaDataCleanupDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+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.ExpirationAttributes;
import com.gemstone.gemfire.cache.RegionFactory;
import com.gemstone.gemfire.cache.RegionShortcut;
@@ -32,12 +41,14 @@ import com.gemstone.gemfire.test.dunit.Wait;
/**
*
*/
-public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class PartitionedRegionMetaDataCleanupDUnitTest extends JUnit4CacheTestCase {
- public PartitionedRegionMetaDataCleanupDUnitTest(String name) {
- super(name);
+ public PartitionedRegionMetaDataCleanupDUnitTest() {
+ super();
}
+ @Test
public void testCleanupOnCloseCache() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -58,6 +69,7 @@ public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
waitForCreate(vm0, "region1", 15);
}
+ @Test
public void testCleanupOnCloseRegion() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -78,6 +90,7 @@ public class PartitionedRegionMetaDataCleanupDUnitTest extends CacheTestCase {
waitForCreate(vm0, "region1", 15);
}
+ @Test
public void testCrash() throws InterruptedException {
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/partitioned/PersistPRKRFDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java
index 641982f..3da750f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistPRKRFDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+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 com.gemstone.gemfire.cache.CacheClosedException;
@@ -38,21 +47,19 @@ import com.gemstone.gemfire.test.dunit.Wait;
* Tests the basic use cases for PR persistence.
*
*/
+@Category(DistributedTest.class)
public class PersistPRKRFDUnitTest extends PersistentPartitionedRegionTestBase {
private static final int NUM_BUCKETS = 15;
private static final int MAX_WAIT = 30 * 1000;
static Object lockObject = new Object();
- public PersistPRKRFDUnitTest(String name) {
- super(name);
- }
-
/**
* do a put/modify/destroy while closing disk store
*
* to turn on debug, add following parameter in local.conf:
* hydra.VmPrms-extraVMArgs += "-Ddisk.KRF_DEBUG=true";
*/
+ @Test
public void testCloseDiskStoreWhenPut() {
final String title = "testCloseDiskStoreWhenPut:";
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/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
index 6df3dec..d8b3514 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentColocatedPartitionedRegionDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+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.IOException;
import java.util.Collections;
import java.util.Set;
@@ -56,13 +65,14 @@ import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
+@Category(DistributedTest.class)
public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPartitionedRegionTestBase {
private static final int NUM_BUCKETS = 15;
private static final int MAX_WAIT = 30 * 1000;
- public PersistentColocatedPartitionedRegionDUnitTest(String name) {
- super(name);
+ public PersistentColocatedPartitionedRegionDUnitTest() {
+ super();
}
@Override
@@ -70,6 +80,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
FileUtil.delete(getBackupDir());
}
+ @Test
public void testColocatedPRAttributes() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(1);
@@ -133,6 +144,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
/**
* Testing that we can colocate persistent PRs
*/
+ @Test
public void testColocatedPRs() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -224,6 +236,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
* Testing what happens we we recreate colocated persistent PRs by creating
* one PR everywhere and then the other PR everywhere.
*/
+ @Test
public void testColocatedPRsRecoveryOnePRAtATime() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -355,6 +368,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
};
}
+ @Test
public void testColocatedPRsRecoveryOneMemberLater() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -458,6 +472,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
assertEquals(vm2PrimaryBuckets, getPrimaryBucketList(vm2, "region2"));
}
+ @Test
public void testReplaceOfflineMemberAndRestart() throws Throwable {
SerializableRunnable createPRs = new SerializableRunnable("region1") {
public void run() {
@@ -509,6 +524,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
* in different disk stores, we still keep our metadata consistent.
* @throws Throwable
*/
+ @Test
public void testReplaceOfflineMemberAndRestartTwoDiskStores() throws Throwable {
SerializableRunnable createPRs = new SerializableRunnable("region1") {
public void run() {
@@ -661,6 +677,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
}
}
+ @Test
public void testReplaceOfflineMemberAndRestartCreateColocatedPRLate() throws Throwable {
SerializableRunnable createParentPR = new SerializableRunnable() {
public void run() {
@@ -720,6 +737,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
replaceOfflineMemberAndRestartCreateColocatedPRLate(createParentPR, createChildPR);
}
+ @Test
public void testReplaceOfflineMemberAndRestartCreateColocatedPRLateTwoDiskStores() throws Throwable {
SerializableRunnable createParentPR = new SerializableRunnable() {
public void run() {
@@ -907,6 +925,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
//This test method is disabled because it is failing
//periodically and causing cruise control failures
//See bug #46748
+ @Test
public void testCrashDuringRedundancySatisfaction() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1042,6 +1061,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
* Test what happens when we restart persistent members while
* there is an accessor concurrently performing puts. This is for bug 43899
*/
+ @Test
public void testRecoverySystemWithConcurrentPutter() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1181,6 +1201,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
}
@Category(FlakyTest.class) // GEODE-506: time sensitive, async actions with 30 sec max
+ @Test
public void testRebalanceWithOfflineChildRegion() throws Throwable {
SerializableRunnable createParentPR = new SerializableRunnable() {
public void run() {
@@ -1230,6 +1251,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
* because in this case all of the regions have been created, but
* they are in the middle of actually recovering buckets from disk.
*/
+ @Test
public void testRebalanceDuringRecovery() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1356,6 +1378,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
}
@Category(FlakyTest.class) // GEODE-1380: time sensitive, async actions with 30 sec max
+ @Test
public void testRebalanceWithOfflineChildRegionTwoDiskStores() throws Throwable {
SerializableRunnable createParentPR = new SerializableRunnable() {
public void run() {
@@ -1408,6 +1431,7 @@ public class PersistentColocatedPartitionedRegionDUnitTest extends PersistentPar
* @throws Throwable
*/
@Category(FlakyTest.class) // GEODE-900: disk dependency, filesystem sensitive
+ @Test
public void testModifyColocation() throws Throwable {
//Create PRs where region3 is colocated with region1.
createColocatedPRs("region1");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
index e6a765b..ef63848 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionDUnitTest.java
@@ -16,9 +16,49 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.jayway.awaitility.Awaitility.*;
+import static java.util.concurrent.TimeUnit.*;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.*;
+import static org.junit.Assert.fail;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.File;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.Collections;
+import java.util.ConcurrentModificationException;
+import java.util.HashSet;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.cache.CustomExpiry;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.DiskAccessException;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.EvictionAction;
+import com.gemstone.gemfire.cache.EvictionAttributes;
+import com.gemstone.gemfire.cache.ExpirationAction;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.PartitionedRegionStorageException;
+import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.Region.Entry;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.PoolFactory;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.ServerOperationException;
@@ -41,39 +81,42 @@ import com.gemstone.gemfire.internal.cache.InitialImageOperation.RequestImageMes
import com.gemstone.gemfire.internal.cache.control.InternalResourceManager;
import com.gemstone.gemfire.internal.cache.partitioned.ManageBucketMessage.ManageBucketReplyMessage;
import com.gemstone.gemfire.internal.i18n.LocalizedStrings;
-import com.gemstone.gemfire.test.dunit.*;
+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.IgnoredException;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.RMIException;
+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.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import org.junit.Ignore;
-import org.junit.experimental.categories.Category;
-
-import java.io.*;
-import java.util.*;
-import java.util.concurrent.CountDownLatch;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static com.jayway.awaitility.Awaitility.await;
-import static java.util.concurrent.TimeUnit.SECONDS;
-import static org.assertj.core.api.Assertions.assertThat;
/**
* Tests the basic use cases for PR persistence.
*/
+@Category(DistributedTest.class)
public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedRegionTestBase {
+
private static final int NUM_BUCKETS = 15;
//This must be bigger than the dunit ack-wait-threshold for the revoke
//tests. The command line is setting the ack-wait-threshold to be
//60 seconds.
private static final int MAX_WAIT = 65 * 1000;
- public PersistentPartitionedRegionDUnitTest(String name) {
- super(name);
+ public PersistentPartitionedRegionDUnitTest() {
+ super();
}
/**
* A simple test case that we are actually
* persisting with a PR.
*/
+ @Test
public void testSinglePR() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -108,6 +151,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* Test total-buckets-num getting bigger, which cause exception.
* but changed to smaller should be ok.
*/
+ @Test
public void testChangedToalBucketNumberSinglePR() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -142,6 +186,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
/**
* Test for bug 44184
*/
+ @Test
public void testSinglePRWithCustomExpiry() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(1);
@@ -189,6 +234,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* 0
* @throws Throwable
*/
+ @Test
public void testTotalRecoverRedundancy0() throws Throwable {
totalRecoverTest(0);
}
@@ -199,6 +245,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* 1
* @throws Throwable
*/
+ @Test
public void testTotalRecoverRedundancy1() throws Throwable {
totalRecoverTest(1);
}
@@ -354,6 +401,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
checkData(vm0, 0, numBuckets, null);
}
+ @Test
public void testRevokeAfterStartup() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -409,6 +457,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
}
@Category(FlakyTest.class) // GEODE-974: async actions, time sensitive, 65 second timeouts
+ @Test
public void testRevokeBeforeStartup() throws Throwable {
IgnoredException.addIgnoredException("RevokeFailedException");
Host host = Host.getHost(0);
@@ -492,6 +541,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* Test that we wait for missing data to come back
* if the redundancy was 0.
*/
+ @Test
public void testMissingMemberRedundancy0() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -681,6 +731,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
/**Test to make sure that we recreate
* a bucket if a member is destroyed
*/
+ @Test
public void testDestroyedMemberRedundancy0() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -721,7 +772,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
/**Test to make sure that we recreate
* a bucket if a member is destroyed
*/
- public void testDestroyedMemberRedundancy1() {
+ @Test
+ public void testDestroyedMemberRedundancy1() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -755,7 +807,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
/**Test to make sure that we recreate
* a bucket if a member is revoked
*/
- public void testRevokedMemberRedundancy0() {
+ @Test
+ public void testRevokedMemberRedundancy0() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -827,7 +880,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* a bucket if a member is revoked
* @throws Throwable
*/
- public void testRevokedMemberRedundancy1() throws Throwable {
+ @Test
+ public void testRevokedMemberRedundancy1() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -903,7 +957,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* is set to 0.
* @throws Throwable
*/
- public void testRevokedMemberRedundancy1ImmediateRecovery() throws Throwable {
+ @Test
+ public void testRevokedMemberRedundancy1ImmediateRecovery() throws Throwable {
disconnectAllFromDS(); // I see this test failing because it finds the ds disconnected. Trying this as a fix.
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -977,7 +1032,8 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* we replace buckets where are offline on A by creating them on C
* We then shutdown C and restart A, which recovers those buckets
*/
- public void testBug41340() throws Throwable {
+ @Test
+ public void testBug41340() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
@@ -1043,6 +1099,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* missing member comes back online.
*/
@Category(FlakyTest.class) // GEODE-1047: thread unsafe test hook, CountDownLatch, async behavior
+ @Test
public void testMissingMemberRedundancy1() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1092,6 +1149,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* member ID as offline, preventing redundancy
* recovery in the future.
*/
+ @Test
public void testBug41341() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1216,6 +1274,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
checkData(vm0, 0, NUM_BUCKETS, "a");
}
+ @Test
public void testMoveBucket() throws Throwable {
int redundancy = 0;
Host host = Host.getHost(0);
@@ -1266,6 +1325,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
checkData(vm0, 226, 227, "a");
}
+ @Test
public void testCleanStop() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1309,6 +1369,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
+ @Test
public void testRegisterInterestNoDataStores() {
//Closing the client may log a warning on the server
IgnoredException.addIgnoredException("Connection reset");
@@ -1383,6 +1444,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* sure that we don't get a suspect string
* with an exception during cache closure.
*/
+ @Test
public void testOverflowCacheClose() {
Cache cache = getCache();
RegionFactory rf = new RegionFactory();
@@ -1401,6 +1463,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
/**
* Test for bug 41336
*/
+ @Test
public void testCrashDuringBucketCreation() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1416,7 +1479,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
DistributionMessage msg) {
if(msg instanceof ManageBucketReplyMessage) {
Cache cache = getCache();
- DistributedTestCase.disconnectFromDS();
+ disconnectFromDS();
await().atMost(30, SECONDS).until(() -> {return (cache == null || cache.isClosed());});
LogWriterUtils.getLogWriter().info("Cache is confirmed closed");
@@ -1462,6 +1525,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
assertEquals(Collections.emptySet(), getBucketList(vm0));
}
+ @Test
public void testNestedPRRegions() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1519,6 +1583,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
checkData(vm2, numBuckets, 113, "d", "parent2/"+PR_REGION_NAME);
}
+ @Test
public void testCloseDuringRegionOperation() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1598,6 +1663,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* @throws Throwable
*/
@Category(FlakyTest.class) // GEODE-1208: time sensitive, multiple non-thread-safe test hooks, async actions
+ @Test
public void testBug42226() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1680,6 +1746,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
*
* @throws Throwable
*/
+ @Test
public void testAllowRegionUseBeforeRedundancyRecovery() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1796,6 +1863,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* crashes before the GII is complete, we need
* to make sure that later we can recover redundancy.
*/
+ @Test
public void testCrashDuringBucketGII() {
IgnoredException.addIgnoredException("PartitionOfflineException");
Host host = Host.getHost(0);
@@ -1850,6 +1918,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* discovers that the GII target is no longer hosting the bucket.
* @throws InterruptedException
*/
+ @Test
public void testCrashDuringBucketGII2() throws InterruptedException {
IgnoredException.addIgnoredException("PartitionOfflineException");
Host host = Host.getHost(0);
@@ -1913,6 +1982,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
assertEquals(Collections.singleton(0), getBucketList(vm1));
}
+ @Test
public void testCleanupAfterConflict() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -1975,6 +2045,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
* Test to make sure that primaries are rebalanced after recovering from
* disk.
*/
+ @Test
public void testPrimaryBalanceAfterRecovery() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -2031,6 +2102,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
assertThat(vm0Primaries.size()).isBetween(9, 11);
}
+ @Test
public void testConcurrencyChecksEnabled() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -2074,6 +2146,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
vm3.invoke(verifyConcurrenyChecks);
}
+ @Test
public void testNonPersistentProxy() {
Host host = Host.getHost(0);
VM vm1 = host.getVM(0);
@@ -2111,6 +2184,7 @@ public class PersistentPartitionedRegionDUnitTest extends PersistentPartitionedR
vm3.invoke(verifyConcurrencyChecks);
}
+ @Test
public void testReplicateAfterPersistent() {
Host host = Host.getHost(0);
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/partitioned/PersistentPartitionedRegionOldConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionOldConfigDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionOldConfigDUnitTest.java
index c37ac69..9731097 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionOldConfigDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionOldConfigDUnitTest.java
@@ -16,16 +16,26 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+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.DataPolicy;
import com.gemstone.gemfire.cache.PartitionAttributesFactory;
import com.gemstone.gemfire.cache.RegionAttributes;
+@Category(DistributedTest.class)
public class PersistentPartitionedRegionOldConfigDUnitTest extends PersistentPartitionedRegionDUnitTest {
- public PersistentPartitionedRegionOldConfigDUnitTest(String name) {
- super(name);
+ public PersistentPartitionedRegionOldConfigDUnitTest() {
+ super();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
index 59700d9..692378c 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionTestBase.java
@@ -16,6 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
@@ -44,8 +46,6 @@ import com.gemstone.gemfire.cache.control.RebalanceFactory;
import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
import com.gemstone.gemfire.cache.partition.PartitionRegionInfo;
import com.gemstone.gemfire.cache.persistence.PersistentID;
-import com.gemstone.gemfire.cache.persistence.RevokeFailedException;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.FileUtil;
import com.gemstone.gemfire.internal.cache.DiskRegion;
@@ -65,19 +65,16 @@ 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;
+
+public abstract class PersistentPartitionedRegionTestBase extends JUnit4CacheTestCase {
-/**
- *
- */
-public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase {
public static String PR_REGION_NAME = "region";
//This must be bigger than the dunit ack-wait-threshold for the revoke
//tests. The command line is setting the ack-wait-threshold to be
//60 seconds.
private static final int MAX_WAIT = 70 * 1000;
-
-
/* (non-Javadoc)
* Set the region name for this test so that multiple subclasses of this
* test base do not conflict with one another during parallel dunit runs
@@ -99,13 +96,6 @@ public abstract class PersistentPartitionedRegionTestBase extends CacheTestCase
PR_REGION_NAME = testName + "Region";
}
- /**
- * @param name
- */
- public PersistentPartitionedRegionTestBase(String name) {
- super(name);
- }
-
protected void checkRecoveredFromDisk(VM vm, final int bucketId, final boolean recoveredLocally) {
vm.invoke(new SerializableRunnable("check recovered from disk") {
public void run() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
index 94ca51c..0eacca3 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/partitioned/PersistentPartitionedRegionWithTransactionDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.partitioned;
+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.Cache;
import com.gemstone.gemfire.cache.CacheTransactionManager;
import com.gemstone.gemfire.cache.Region;
@@ -32,12 +41,13 @@ import com.gemstone.gemfire.test.dunit.VM;
* Tests the basic use cases for PR persistence.
*
*/
+@Category(DistributedTest.class)
public class PersistentPartitionedRegionWithTransactionDUnitTest extends PersistentPartitionedRegionTestBase {
private static final long MAX_WAIT = 0;
- public PersistentPartitionedRegionWithTransactionDUnitTest(String name) {
- super(name);
+ public PersistentPartitionedRegionWithTransactionDUnitTest() {
+ super();
}
@Override
@@ -61,6 +71,7 @@ public class PersistentPartitionedRegionWithTransactionDUnitTest extends Persist
});
}
+ @Test
public void testRollback() throws Throwable {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);