You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/06/09 20:15:01 UTC
[33/70] [abbrv] [partial] incubator-geode git commit: GEODE-837:
update tests from JUnit3 to JUnit4
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
index 22efdea..1c9b401 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ClientServerTransactionDUnitTest.java
@@ -16,6 +16,30 @@
*/
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 static com.gemstone.gemfire.test.dunit.LogWriterUtils.*;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.naming.Context;
+import javax.transaction.UserTransaction;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
import com.gemstone.gemfire.cache.*;
@@ -52,6 +76,7 @@ import static com.gemstone.gemfire.test.dunit.LogWriterUtils.getLogWriter;
/**
* Tests the basic client-server transaction functionality
*/
+@Category(DistributedTest.class)
public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest {
protected static final int MAX_ENTRIES = 10;
@@ -59,8 +84,8 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
protected static final String OTHER_REGION = "OtherRegion";
- public ClientServerTransactionDUnitTest(String name) {
- super(name);
+ public ClientServerTransactionDUnitTest() {
+ super();
}
@Override
@@ -195,6 +220,7 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
+ @Test
public void testTwoPoolsNotAllowed() {
Host host = Host.getHost(0);
VM datastore1 = host.getVM(0);
@@ -265,6 +291,7 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
}
+ @Test
public void testCleanupAfterClientFailure() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -343,22 +370,27 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
}
}
+ @Test
public void testBasicCommitOnEmpty() {
doBasicTransaction(false, false, true);
}
+ @Test
public void testBasicCommitOnEmptyUsingJTA() {
doBasicTransaction(false, true, true);
}
+ @Test
public void testBasicCommit() {
doBasicTransaction(true, false, true);
}
+ @Test
public void testBasicCommitUsingJTA() {
doBasicTransaction(true, true, true);
}
+ @Test
public void testBasicRollbackUsingJTA() {
doBasicTransaction(true, true, false);
}
@@ -498,10 +530,12 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
verifyVersionTags(client, server, null, null);
}
+ @Test
public void testTXCreationAndCleanupAtCommit() throws Exception {
doBasicChecks(true);
}
+ @Test
public void testTXCreationAndCleanupAtRollback() throws Exception {
doBasicChecks(false);
}
@@ -572,6 +606,7 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
}
+ @Test
public void testPutallRollbackInServer() throws Exception {
Host host = Host.getHost(0);
VM server = host.getVM(0);
@@ -597,6 +632,7 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
});
}
+ @Test
public void testPutallRollbackInClient() throws Exception {
Host host = Host.getHost(0);
VM server = host.getVM(0);
@@ -691,7 +727,8 @@ public class ClientServerTransactionDUnitTest extends RemoteTransactionDUnitTest
});
}
-public void testClientCommitAndDataStoreGetsEvent() throws Exception {
+ @Test
+ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
VM datastore = host.getVM(1);
@@ -742,6 +779,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
+ @Test
public void testClientCreateAndTwoInvalidates() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -786,6 +824,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
+ @Test
public void testClientCommitsAndJustGets() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -825,6 +864,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
}
+ @Test
public void testClientDoesUnsupportedLocalOps() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -878,6 +918,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
}
+ @Test
public void testClientCommitsWithRIAndOnlyGetsOneEvent() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -927,6 +968,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testDatastoreCommitsWithPutAllAndRI() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -994,6 +1036,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
+ @Test
public void testClientCommitsWithPutAllAndRI() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -1048,6 +1091,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
}
+ @Test
public void testClientRollsbackWithPutAllAndRI() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -1101,6 +1145,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testClientInitiatedInvalidates() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -1275,6 +1320,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
/**
* client connectes to an accessor and completes a transaction
*/
+ @Test
public void testServerDelegate() {
Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -1313,10 +1359,12 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testCommitWithPRAccessor() {
doTxWithPRAccessor(true);
}
+ @Test
public void testRollbackWithPRAccessor() {
doTxWithPRAccessor(false);
}
@@ -1400,6 +1448,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* there is one txState and zero or more txProxyStates
* @throws Exception
*/
+ @Test
public void testConnectionAffinity() throws Exception {
Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -1491,6 +1540,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* pool connects to the accessor and datastore
* we then close the server in the accessor and verify failover
*/
+ @Test
public void testFailover() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -1500,6 +1550,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
doFailoverWork(accessor, null, datastore, client, true, false);
}
+ @Test
public void testFailoverAndCachingProxy() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -1513,6 +1564,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* pool connects to two accessors.
* we then close the server in first accessor and verify failover
*/
+ @Test
public void testFailoverWithP2PMessaging() {
Host host = Host.getHost(0);
VM accessor1 = host.getVM(0);
@@ -1523,6 +1575,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
doFailoverWork(accessor1, accessor2, datastore, client, false, false);
}
+ @Test
public void testFailoverWithP2PMessagingAndCachingProxy() {
Host host = Host.getHost(0);
VM accessor1 = host.getVM(0);
@@ -1624,6 +1677,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testGetEntry() {
Host host = Host.getHost(0);
//VM accessor = host.getVM(0);
@@ -1677,6 +1731,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
+ @Test
public void testBug42920() {
Host host = Host.getHost(0);
VM datastore = host.getVM(1);
@@ -1889,6 +1944,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testTXListenerOnRedundant() {
Host host = Host.getHost(0);
VM datastore1 = host.getVM(0);
@@ -1937,6 +1993,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
assertEquals(1, listenerInvokedCount);
}
+ @Test
public void testBasicFunctionExecution() {
Host host = Host.getHost(0);
VM datastore = host.getVM(0);
@@ -1944,6 +2001,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
doBasicFunctionExecution(client, null, datastore);
}
+ @Test
public void testRemotedFunctionExecution() {
Host host = Host.getHost(0);
VM datastore = host.getVM(0);
@@ -2026,6 +2084,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testEmptyTX() {
Host host = Host.getHost(0);
VM datastore = host.getVM(0);
@@ -2045,6 +2104,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testSuspendResumeOnDifferentThreads() {
Host host = Host.getHost(0);
VM server1 = host.getVM(0);
@@ -2103,177 +2163,221 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
@Override
+ @Test
public void testPRTXGet() {
}
@Override
+ @Test
public void testPRTXGetOnRemoteWithLoader() {
}
@Override
+ @Test
public void testPRTXGetEntryOnRemoteSide() {
}
@Override
+ @Test
public void testPRTXGetOnLocalWithLoader() {
}
@Override
+ @Test
public void testNonColocatedTX() {
}
@Override
+ @Test
public void testRemoteExceptionThrown() {
}
@Override
+ @Test
public void testSizeForTXHostedOnRemoteNode() {
}
@Override
+ @Test
public void testSizeOnAccessor() {
}
@Override
+ @Test
public void testKeysIterator() {
}
@Override
+ @Test
public void testValuesIterator() {
}
@Override
+ @Test
public void testEntriesIterator() {
}
@Override
+ @Test
public void testKeysIterator1() {
}
@Override
+ @Test
public void testValuesIterator1() {
}
@Override
+ @Test
public void testEntriesIterator1() {
}
@Override
+ @Test
public void testKeysIteratorOnDestroy() {
}
@Override
+ @Test
public void testValuesIteratorOnDestroy() {
}
@Override
+ @Test
public void testEntriesIteratorOnDestroy() {
}
@Override
+ @Test
public void testKeysIterator1OnDestroy() {
}
@Override
+ @Test
public void testValuesIterator1OnDestroy() {
}
@Override
+ @Test
public void testEntriesIterator1OnDestroy() {
}
@Override
+ @Test
public void testKeyIterationOnRR() {
}
@Override
+ @Test
public void testValuesIterationOnRR() {
}
@Override
+ @Test
public void testEntriesIterationOnRR() {
}
@Override
+ @Test
public void testIllegalIteration() {
}
@Override
+ @Test
public void testTxFunctionOnRegion() {
}
@Override
+ @Test
public void testTxFunctionOnMember() {
}
@Override
+ @Test
public void testNestedTxFunction() {
}
@Override
+ @Test
public void testDRFunctionExecution() {
}
@Override
+ @Test
public void testTxFunctionWithOtherOps() {
}
@Override
+ @Test
public void testRemoteJTACommit() {
}
@Override
+ @Test
public void testRemoteJTARollback() {
}
@Override
+ @Test
public void testOriginRemoteIsTrueForRemoteReplicatedRegions() {
}
@Override
+ @Test
public void testRemoteCreateInReplicatedRegion() {
}
@Override
+ @Test
public void testRemoteTxCleanupOnCrash() {
}
@Override
+ @Test
public void testNonColocatedPutAll() {
}
@Override
+ @Test
public void testDestroyCreateConflation() {
}
@Override
+ @Test
public void testTXWithRI() throws Exception {
}
@Override
+ @Test
public void testBug43176() {
}
@Override
+ @Test
public void testTXWithRICommitInDatastore() throws Exception {
}
@Override
+ @Test
public void testListenersNotInvokedOnSecondary() {
}
@Override
+ @Test
public void testBug33073() {
}
@Override
+ @Test
public void testBug43081() throws Exception {
}
@Override
+ @Test
public void testBug45556() {
}
+ @Test
public void testBug42942() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2316,6 +2420,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testOnlyGet() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2337,6 +2442,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testBug43237() {
Host host = Host.getHost(0);
VM server = host.getVM(0);
@@ -2412,6 +2518,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* start 3 servers, accessor has r1 and r2; ds1 has r1, ds2 has r2
* stop server after distributing commit but b4 replying to client
*/
+ @Test
public void testFailoverAfterCommitDistribution() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2526,6 +2633,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* start a tx in a thread, obtain local locks and wait. start
* another tx and commit, make sure 2nd thread gets CCE
*/
+ @Test
public void testClientTxLocks() {
Host host = Host.getHost(0);
VM server = host.getVM(0);
@@ -2608,6 +2716,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
}
}
+ @Test
public void testBasicResumableTX() {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -2649,10 +2758,12 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* transactional ops in functions, commit is done using internal
* ClientCommitFunction.
*/
+ @Test
public void testClientCommitFunction() {
doFunctionWork(true);
}
+ @Test
public void testClientRollbackFunction() {
doFunctionWork(false);
}
@@ -2756,9 +2867,11 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
}
}
+ @Test
public void testClientCommitFunctionWithFailure() {
doFunctionWithFailureWork(true);
}
+ @Test
public void testRollbackFunctionWithFailure() {
doFunctionWithFailureWork(false);
}
@@ -2831,9 +2944,11 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* start an accessor and two peers, then commit transaction
* from accessor
*/
+ @Test
public void testCommitFunctionFromPeer() {
doTestFunctionFromPeer(true);
}
+ @Test
public void testRollbackFunctionFromPeer() {
doTestFunctionFromPeer(false);
}
@@ -2888,6 +3003,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testBug43752() {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -2917,6 +3033,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
});
}
+ @Test
public void testSuspendTimeout() throws Exception {
Host host = Host.getHost(0);
VM server = host.getVM(0);
@@ -2971,6 +3088,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
/**
* test that re-tried operations from client do not result in multiple ops in tx
*/
+ @Test
public void testEventTracker() {
Host host = Host.getHost(0);
VM delegate = host.getVM(0);
@@ -3081,6 +3199,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* verify that the exception does not cause the client to failover to the second server
* see bug 51666
*/
+ @Test
public void testTransactionException() {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -3173,6 +3292,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
* that the client ignores this region.
* see bug 51922
*/
+ @Test
public void testNotAllRegionsHaveClient() {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -3239,6 +3359,7 @@ public void testClientCommitAndDataStoreGetsEvent() throws Exception {
}
+ @Test
public void testAdjunctMessage() {
Host host = Host.getHost(0);
VM server1 = 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/ComplexDiskRegionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java
index bc33f3a..1506f96 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ComplexDiskRegionJUnitTest.java
@@ -16,43 +16,31 @@
*/
package com.gemstone.gemfire.internal.cache;
-import org.junit.After;
-import org.junit.Before;
+import static org.junit.Assert.*;
+
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
import com.gemstone.gemfire.StatisticsFactory;
import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.internal.cache.DirectoryHolder;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* Unit testing for ComplexDiskRegion API's
- *
- *
- *
*/
@Category(IntegrationTest.class)
-public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase
-{
+public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase {
- DiskRegionProperties diskProps = new DiskRegionProperties();
-
-
+ private DiskRegionProperties diskProps = new DiskRegionProperties();
@Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
+ protected final void postSetUp() throws Exception {
diskProps.setDiskDirs(dirs);
DiskStoreImpl.SET_IGNORE_PREALLOCATE = true;
}
- @After
- public void tearDown() throws Exception {
- super.tearDown();
+ @Override
+ protected final void postTearDown() throws Exception {
DiskStoreImpl.SET_IGNORE_PREALLOCATE = false;
}
@@ -63,8 +51,7 @@ public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase
* The test will test that an oplog is correctly being added to be rolled
*/
@Test
- public void testAddToBeCompacted()
- {
+ public void testAddToBeCompacted() {
deleteFiles();
diskProps.setRolling(false);
diskProps.setAllowForceCompaction(true);
@@ -113,11 +100,9 @@ public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase
oplog3.destroy();
closeDown();
deleteFiles();
-
}
/**
- *
* Test method for
* 'com.gemstone.gemfire.internal.cache.ComplexDiskRegion.removeFirstOplog(Oplog)'
*
@@ -125,8 +110,7 @@ public class ComplexDiskRegionJUnitTest extends DiskRegionTestingBase
* the firs to be rolled).
*/
@Test
- public void testRemoveFirstOplog()
- {
+ public void testRemoveFirstOplog() {
deleteFiles();
diskProps.setRolling(false);
region = DiskRegionHelperFactory.getSyncPersistOnlyRegion(cache, diskProps, Scope.LOCAL);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentDestroySubRegionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentDestroySubRegionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentDestroySubRegionDUnitTest.java
index 6c1dac1..ab3a5de 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentDestroySubRegionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentDestroySubRegionDUnitTest.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.DataPolicy;
@@ -32,7 +41,8 @@ import com.gemstone.gemfire.test.dunit.VM;
/**
*
*/
-public class ConcurrentDestroySubRegionDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ConcurrentDestroySubRegionDUnitTest extends JUnit4CacheTestCase {
@Override
public final void postSetUp() throws Exception {
@@ -45,10 +55,11 @@ public class ConcurrentDestroySubRegionDUnitTest extends CacheTestCase {
/**
* @param name
*/
- public ConcurrentDestroySubRegionDUnitTest(String name) {
- super(name);
+ public ConcurrentDestroySubRegionDUnitTest() {
+ super();
}
+ @Test
public void test() throws Throwable {
final Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -109,6 +120,7 @@ public class ConcurrentDestroySubRegionDUnitTest extends CacheTestCase {
}
}
+ @Test
public void testPartitionedRegion() throws Throwable {
final 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/ConcurrentFlushingAndRegionOperationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java
index 0cab6f9..aeef265 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentFlushingAndRegionOperationsJUnitTest.java
@@ -16,12 +16,8 @@
*/
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.fail;
-import junit.framework.Assert;
+import static org.junit.Assert.*;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -36,25 +32,9 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* A region operation is done on the same key that is about to be rolled or has
* just been rolled and the region operation is verified to have been correctly
* executed.
- *
- *
*/
@Category(IntegrationTest.class)
-public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
- DiskRegionTestingBase
-{
-
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
- }
-
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
+public class ConcurrentFlushingAndRegionOperationsJUnitTest extends DiskRegionTestingBase {
protected boolean alreadyComeHere = false;
@@ -84,8 +64,8 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
region.put("Key", "Value1");
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
- Assert.assertEquals("Value2", region.get("Key"));
- Assert.assertEquals("Value2", getValueOnDisk(region));
+ assertEquals("Value2", region.get("Key"));
+ assertEquals("Value2", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
@@ -118,7 +98,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
region.put("Key", "Value1");
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
- Assert.assertEquals("Value1", getValueOnDisk(region));
+ assertEquals("Value1", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
@@ -320,7 +300,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
long newOplogOffset = id.getOffsetInOplog();
id.setOplogId(oldOplogId);
id.setOffsetInOplog(oldOplogOffset);
- Assert.assertEquals("Value1", ((LocalRegion)region).getDiskRegion()
+ assertEquals("Value1", ((LocalRegion)region).getDiskRegion()
.getNoBuffer(id));
id.setOplogId(newOplogId);
id.setOffsetInOplog(newOplogOffset);
@@ -336,7 +316,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
// region.getCache().getLogger().info("getting value2");
- Assert.assertEquals("Value2", region.get("Key"));
+ assertEquals("Value2", region.get("Key"));
}
catch (Exception e) {
logWriter.error("Exception occured", e);
@@ -346,7 +326,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
- Assert.assertEquals("Value2", getValueOnDisk(region));
+ assertEquals("Value2", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
@@ -372,7 +352,7 @@ public class ConcurrentFlushingAndRegionOperationsJUnitTest extends
region.put("Key", "Value1");
((LocalRegion)region).getDiskRegion().flushForTesting();
try {
- Assert.assertEquals("Value1", getValueOnDisk(region));
+ assertEquals("Value1", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapLocalJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapLocalJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapLocalJUnitTest.java
index 315caff..3b7c6df 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapLocalJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapLocalJUnitTest.java
@@ -16,20 +16,23 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import 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 com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@Category(IntegrationTest.class)
-public class ConcurrentMapLocalJUnitTest {
+public class ConcurrentMapLocalJUnitTest { // TODO: reformat
private Cache cache;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
index 919556d..7f03ad1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentMapOpsDUnitTest.java
@@ -14,14 +14,31 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-/**
- *
- */
package com.gemstone.gemfire.internal.cache;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.Delta;
import com.gemstone.gemfire.InvalidDeltaException;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Operation;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
@@ -29,32 +46,29 @@ import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
import com.gemstone.gemfire.cache.client.internal.DestroyOp;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.membership.MembershipManager;
import com.gemstone.gemfire.distributed.internal.membership.gms.MembershipManagerHelper;
import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.test.dunit.*;
-import junit.framework.AssertionFailedError;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+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.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* tests for the concurrentMapOperations. there are more tests in ClientServerMiscDUnitTest
- *
*/
-public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ConcurrentMapOpsDUnitTest extends JUnit4CacheTestCase {
- protected static final String REP_REG_NAME = "repRegion";
- protected static final String PR_REG_NAME = "prRegion";
+ private static final String REP_REG_NAME = "repRegion";
+ private static final String PR_REG_NAME = "prRegion";
private static final int MAX_ENTRIES = 113;
enum OP {PUTIFABSENT, REPLACE, REMOVE}
@@ -79,11 +93,11 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
- protected Region createReplicateRegion() {
+ private Region createReplicateRegion() {
return getCache().createRegionFactory(RegionShortcut.REPLICATE).setConcurrencyChecksEnabled(true).create(REP_REG_NAME);
}
- protected Region createPartitionedRegion() {
+ private Region createPartitionedRegion() {
return getCache().createRegionFactory(RegionShortcut.PARTITION).setConcurrencyChecksEnabled(true).create(PR_REG_NAME);
}
@@ -151,8 +165,8 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
}
});
}
-
- static abstract class AbstractConcMapOpsListener implements CacheListener<Integer, String> {
+
+ private static abstract class AbstractConcMapOpsListener implements CacheListener<Integer, String> {
public void afterCreate(EntryEvent<Integer, String> event) {
validate(event);
}
@@ -179,15 +193,15 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
}
abstract void validate(EntryEvent event);
}
-
- static class NotInvokedListener extends AbstractConcMapOpsListener {
+
+ private static class NotInvokedListener extends AbstractConcMapOpsListener {
@Override
void validate(EntryEvent event) {
fail("should not be called. Event="+event);
}
}
- static class InitialCreatesListener extends AbstractConcMapOpsListener {
+ private static class InitialCreatesListener extends AbstractConcMapOpsListener {
AtomicInteger numCreates = new AtomicInteger();
@Override
void validate(EntryEvent event) {
@@ -197,14 +211,9 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
numCreates.incrementAndGet();
}
}
- /**
- * @param name
- */
- public ConcurrentMapOpsDUnitTest(String name) {
- super(name);
- }
// test for bug #42164
+ @Test
public void testListenerNotInvokedForRejectedOperation() {
Host host = Host.getHost(0);
VM vm1 = host.getVM(0);
@@ -324,10 +333,12 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testBug42162() {
dotestConcOps(false);
}
+ @Test
public void testBug42162EmptyClient() {
dotestConcOps(true);
}
@@ -372,7 +383,7 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
final Region r = getCache().getRegion(REP_REG_NAME);
final Region pr = getCache().getRegion(PR_REG_NAME);
WaitCriterion wc = new WaitCriterion() {
- AssertionFailedError e = null;
+ AssertionError e = null;
public boolean done() {
try {
if (!emptyClient) {
@@ -389,7 +400,7 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
assertNull(pr.putIfAbsent("keyForNull", null));
assertNull(r.putIfAbsent("clientNullKey", null));
assertNull(pr.putIfAbsent("clientNullKey", null));
- } catch (AssertionFailedError ex) {
+ } catch (AssertionError ex) {
r.getCache().getLoggerI18n().fine("SWAP:caught ", ex);
e = ex;
return false;
@@ -424,7 +435,7 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
final Region r = getCache().getRegion(REP_REG_NAME);
final Region pr = getCache().getRegion(PR_REG_NAME);
WaitCriterion wc = new WaitCriterion() {
- AssertionFailedError e = null;
+ AssertionError e = null;
public boolean done() {
try {
assertEquals("value2", r.putIfAbsent("key0", null));
@@ -438,7 +449,7 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
assertNull(r.replace("NoKeyOnServer", "value"));
assertTrue(r.replace("clientNullKey", null, "newValue"));
assertTrue(pr.replace("clientNullKey", null, "newValue"));
- } catch (AssertionFailedError ex) {
+ } catch (AssertionError ex) {
e = ex;
return false;
}
@@ -463,6 +474,7 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testNullValueFromNonEmptyClients() {
Host host = Host.getHost(0);
VM server = host.getVM(0);
@@ -496,10 +508,12 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testPutIfAbsent() {
doPutIfAbsentWork(false);
}
+ @Test
public void testPutIfAbsentCS() {
doPutIfAbsentWork(true);
}
@@ -547,10 +561,12 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testRemove() {
doRemoveWork(false);
}
+ @Test
public void testRemoveCS() {
doRemoveWork(true);
}
@@ -609,10 +625,12 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testReplaceCS() {
doReplaceWork(true);
}
+ @Test
public void testReplace() {
doReplaceWork(false);
}
@@ -674,15 +692,19 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testBug42167() {
do42167Work(false, REP_REG_NAME);
}
+ @Test
public void testBug42167PR() {
do42167Work(false, PR_REG_NAME);
}
+ @Test
public void testBug42167Empty() {
do42167Work(true, REP_REG_NAME);
}
+ @Test
public void testBug42167EmptyPR() {
do42167Work(true, PR_REG_NAME);
}
@@ -759,9 +781,11 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testBug42189() {
doBug42189Work(REP_REG_NAME);
}
+ @Test
public void testBug42189PR() {
doBug42189Work(PR_REG_NAME);
}
@@ -802,13 +826,25 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
}
});
}
-
- public void _testBug42195() {
+
+ /**
+ * Replicate Region test for bug #42195: putIfAbsent from client does not put old value in local cache
+ */
+ @Ignore("TODO")
+ @Test
+ public void testBug42195() {
doPutIfAbsentPutsKeyInLocalClientCacheWork(REP_REG_NAME);
}
- public void _testBug42195PR() {
+
+ /**
+ * Partitioned Region test for bug #42195: putIfAbsent from client does not put old value in local cache
+ */
+ @Ignore("TODO")
+ @Test
+ public void testBug42195PR() {
doPutIfAbsentPutsKeyInLocalClientCacheWork(PR_REG_NAME);
}
+
private void doPutIfAbsentPutsKeyInLocalClientCacheWork(final String regionName) {
Host host = Host.getHost(0);
VM server = host.getVM(0);
@@ -836,9 +872,11 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testReplacePutsKeyInLocalClientCache() {
doReplacePutsKeyInLocalClientCacheWork(REP_REG_NAME);
}
+ @Test
public void testReplacePutsKeyInLocalClientCachePR() {
doReplacePutsKeyInLocalClientCacheWork(PR_REG_NAME);
}
@@ -961,15 +999,19 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
}
});
}
+ @Test
public void testWithDelta() {
doTestWithDeltaWork(false, REP_REG_NAME);
}
+ @Test
public void testWithDeltaPR() {
doTestWithDeltaWork(false, PR_REG_NAME);
}
+ @Test
public void testWithDeltaCS() {
doTestWithDeltaWork(true, REP_REG_NAME);
}
+ @Test
public void testWithDeltaPRCS() {
doTestWithDeltaWork(true, PR_REG_NAME);
}
@@ -1005,26 +1047,32 @@ public class ConcurrentMapOpsDUnitTest extends CacheTestCase {
}
/** test putIfAbsent with failover & retry. This is bugs 42559 and 43640 */
+ @Test
public void testRetriedPutIfAbsent() throws Exception {
doRetriedOperation(Operation.PUT_IF_ABSENT, false);
}
+ @Test
public void testRetriedReplace() throws Exception {
doRetriedOperation(Operation.REPLACE, false);
}
+ @Test
public void testRetriedRemove() throws Exception {
doRetriedOperation(Operation.REMOVE, false);
}
+ @Test
public void testRetriedPutIfAbsentPR() throws Exception {
doRetriedOperation(Operation.PUT_IF_ABSENT, false);
}
+ @Test
public void testRetriedReplacePR() throws Exception {
doRetriedOperation(Operation.REPLACE, false);
}
+ @Test
public void testRetriedRemovePR() throws Exception {
doRetriedOperation(Operation.REMOVE, false);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java
index 754fb34..032301f 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRegionOperationsJUnitTest.java
@@ -16,9 +16,7 @@
*/
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.util.Collection;
import java.util.Iterator;
@@ -31,8 +29,6 @@ import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
-import org.junit.After;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -60,12 +56,9 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* recover the old values and again the two regions are checked for equality.
* * This test is run for all modes persist, persist+overflow, overflow only in
* syn and async mode.
- *
- *
*/
@Category(IntegrationTest.class)
-public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
-{
+public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase {
private int numberOfPutsThreads = 5;
@@ -107,10 +100,8 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
private static int counter = 0;
- @Before
- public void setUp() throws Exception
- {
- super.setUp();
+ @Override
+ protected final void postSetUp() throws Exception {
counter++;
if (longTest) {
TIME_TO_RUN = 10000;
@@ -122,12 +113,6 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
}
}
- @After
- public void tearDown() throws Exception
- {
- super.tearDown();
- }
-
@Test
public void testPersistSyncConcurrency()
{
@@ -330,11 +315,10 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
p);
validate(region1, region2);
}
+
/**
* Tests the bug where a get operation on an evicted entry fails to get value
* as the oplog is deleted by the roller, but the entry was not rolled.
- *
- *
*/
@Test
public void testBug35048()
@@ -445,7 +429,6 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
ThreadUtils.join(t1, 30 * 1000);
ThreadUtils.join(t2, 30 * 1000);
assertTrue(!failure);
-
}
private final AtomicBoolean timeToStop = new AtomicBoolean();
@@ -459,9 +442,9 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
try {
startLine.await();
} catch (InterruptedException ie) {
- fail("unexpected " + ie);
+ throw new AssertionError("unexpected ", ie);
} catch (BrokenBarrierException ex) {
- fail("unexpected " + ex);
+ throw new AssertionError("unexpected ", ex);
}
}
@@ -691,7 +674,7 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
catch (Exception e) {
exceptionOccuredInGets = true;
logWriter.severe("Exception occured in get ", e);
- fail(" failed during get due to " + e);
+ throw new AssertionError(" failed during get due to ", e);
}
} finally {
if (lock != null) {
@@ -764,7 +747,7 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
catch (Exception e) {
exceptionOccuredInClears = true;
logWriter.severe("Exception occured in clear=",e);
- fail("Exception occured in clear");
+ throw new AssertionError("Exception occured in clear", e);
}
}
@@ -776,8 +759,6 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
* because a clear operation stop/starts the roller) & the destroy operation
* actually joined with the new thread ( different from the one on which
* notification was issued to exit).
- *
- *
*/
@Test
public void testConcurrentClearAndRegionDestroyBug()
@@ -912,8 +893,7 @@ public class ConcurrentRegionOperationsJUnitTest extends DiskRegionTestingBase
catch (Exception e) {
exceptionOccuredInForceRolls = true;
logWriter.severe("Exception occured in forceRolling ", e);
- fail(" Exception occured here");
-
+ throw new AssertionError(" Exception occured here", e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java
index 4a8210f..224b700 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConcurrentRollingAndRegionOperationsJUnitTest.java
@@ -16,31 +16,18 @@
*/
package com.gemstone.gemfire.internal.cache;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
-import junit.framework.Assert;
-
-import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.cache.EntryNotFoundException;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.Scope;
-import com.gemstone.gemfire.internal.cache.CacheObserver;
-import com.gemstone.gemfire.internal.cache.CacheObserverAdapter;
-import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
-import com.gemstone.gemfire.internal.cache.DiskEntry;
-import com.gemstone.gemfire.internal.cache.DiskRegionHelperFactory;
-import com.gemstone.gemfire.internal.cache.DiskRegionProperties;
-import com.gemstone.gemfire.internal.cache.DiskRegionTestingBase;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.internal.cache.RegionEntry;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@@ -51,13 +38,9 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* A region operation is done on the same key that is about to be rolled or has
* just been rolled and the region operation is verified to have been correctly
* executed.
- *
- *
*/
@Category(IntegrationTest.class)
-public class ConcurrentRollingAndRegionOperationsJUnitTest extends
- DiskRegionTestingBase
-{
+public class ConcurrentRollingAndRegionOperationsJUnitTest extends DiskRegionTestingBase {
protected volatile boolean hasBeenNotified;
@@ -65,12 +48,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
protected boolean encounteredFailure = false;
-
- @Before
- public void setUp() throws Exception
- {
+ @Override
+ protected final void preSetUp() throws Exception {
this.hasBeenNotified = false;
- super.setUp();
}
void putBeforeRoll(final Region region)
@@ -99,16 +79,16 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
assertTrue(hasBeenNotified);
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
try {
- Assert.assertEquals("Value2", getValueOnDisk(region));
+ assertEquals("Value2", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
- fail("Entry not found although was supposed to be there");
+ throw new AssertionError("Entry not found although was supposed to be there", e);
}
}
@@ -138,17 +118,17 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
assertTrue(hasBeenNotified);
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
try {
- Assert.assertEquals("Value1", getValueOnDisk(region));
- Assert.assertEquals("Value1", getValueInHTree(region));
+ assertEquals("Value1", getValueOnDisk(region));
+ assertEquals("Value1", getValueInHTree(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
- fail("Entry not found although was supposed to be there");
+ throw new AssertionError("Entry not found although was supposed to be there", e);
}
}
@@ -173,7 +153,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
assertTrue(hasBeenNotified);
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
@@ -182,7 +162,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
}
catch (Exception e) {
logWriter.error("Exception occured", e);
- fail("failed while trying to destroy due to " + e);
+ throw new AssertionError("failed while trying to destroy due to ", e);
}
boolean entryNotFound = false;
try {
@@ -226,7 +206,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
assertTrue(hasBeenNotified);
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
@@ -277,17 +257,17 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
assertTrue(hasBeenNotified);
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
region.put("Key", "Value2");
try {
- Assert.assertEquals("Value2", getValueOnDisk(region));
+ assertEquals("Value2", getValueOnDisk(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
- fail("Entry not found although was supposed to be there");
+ throw new AssertionError("Entry not found although was supposed to be there", e);
}
}
@@ -312,18 +292,18 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
assertTrue(hasBeenNotified);
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
region.get("Key");
try {
- Assert.assertEquals("Value1", getValueOnDisk(region));
- Assert.assertEquals("Value1", getValueInHTree(region));
+ assertEquals("Value1", getValueOnDisk(region));
+ assertEquals("Value1", getValueInHTree(region));
}
catch (EntryNotFoundException e) {
logWriter.error("Exception occured", e);
- fail("Entry not found although was supposed to be there");
+ throw new AssertionError("Entry not found although was supposed to be there", e);
}
}
@@ -348,7 +328,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
assertTrue(hasBeenNotified);
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
@@ -357,7 +337,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
}
catch (Exception e1) {
logWriter.error("Exception occured", e1);
- fail("encounter exception when not expected " + e1);
+ throw new AssertionError("encounter exception when not expected ", e1);
}
boolean entryNotFound = false;
try {
@@ -400,7 +380,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
assertTrue(hasBeenNotified);
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
@@ -444,7 +424,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
((DiskEntry)re).getDiskId());
}
- public void DARREL_DISABLE_testSyncPutBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testSyncPutBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -457,7 +439,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testAsyncPutBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsyncPutBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -470,7 +454,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testSyncPutAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testSyncPutAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -483,7 +469,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testAsyncPutAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsyncPutAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -496,7 +484,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testSyncGetBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testSyncGetBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -509,7 +499,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testAsyncGetBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsyncGetBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -522,7 +514,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testSyncGetAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testSyncGetAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -535,7 +529,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testAsyncGetAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsyncGetAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -548,7 +544,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testSyncClearBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testSyncClearBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -561,7 +559,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testAsyncClearBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsyncClearBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -574,7 +574,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testSyncClearAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testSyncClearAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -587,7 +589,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testAsyncClearAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsyncClearAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -600,7 +604,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testSyncDelBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testSyncDelBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -613,7 +619,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testAsyncDelBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsyncDelBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -626,7 +634,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testSyncDelAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testSyncDelAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -639,7 +649,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testAsyncDelAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testAsyncDelAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -652,7 +664,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
region.destroyRegion();
}
- public void DARREL_DISABLE_testCloseBeforeRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testCloseBeforeRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -664,7 +678,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
closeBeforeRoll(region);
}
- public void DARREL_DISABLE_testCloseAfterRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testCloseAfterRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -679,7 +695,9 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
diskRegionProperties, Scope.LOCAL);
}
- public void DARREL_DISABLE_testconcurrentPutAndRoll()
+ @Ignore("TODO:DARREL_DISABLE: test is disabled")
+ @Test
+ public void testconcurrentPutAndRoll()
{
DiskRegionProperties diskRegionProperties = new DiskRegionProperties();
diskRegionProperties.setDiskDirs(dirs);
@@ -722,7 +740,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
testFailed = true;
failureCause = "Exception occured when it was not supposed to occur, Exception is "
+ e + "in concurrentPutAndRoll";
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
}
@@ -739,7 +757,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
testFailed = true;
failureCause = "Exception occured when it was not supposed to occur, Exception is "
+ e + "in concurrentPutAndRoll";
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
startTime = System.currentTimeMillis();
@@ -766,7 +784,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
}
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
if (this.totalTime < 2000) {
@@ -782,8 +800,6 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
* is not yet destroyed but by the time a basicGet is done,the oplog gets
* destroyed & the get operation sees the file length zero or it may encounter
* null pointer exception while retrieving the oplog.
- *
- *
*/
@Test
public void testConcurrentRollingAndGet()
@@ -826,8 +842,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
catch (Exception e) {
encounteredFailure = true;
logWriter.error("Test encountered exception ", e);
- fail(" Test failed as could not obtain value from disk.Exception = "
- + e);
+ throw new AssertionError(" Test failed as could not obtain value from disk.Exception = ", e);
}
}
@@ -854,9 +869,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
}
catch (InterruptedException e) {
logWriter.error("Main thread encountered exception ", e);
-
- fail(" Test failed as main thread encountered exception = " + e);
-
+ throw new AssertionError(" Test failed as main thread encountered exception = ", e);
}
}
@@ -897,7 +910,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
}
catch (Exception e) {
logWriter.error("Exception occured", e);
- fail("Exception occured when it was not supposed to occur");
+ throw new AssertionError("Exception occured when it was not supposed to occur", e);
}
}
});
@@ -911,13 +924,13 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
}
}
catch (InterruptedException e) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", e);
}
}
try {
th.join(5000);
} catch (InterruptedException ignore) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", ignore);
}
assertFalse(th.isAlive());
assertFalse(failureCause, testFailed);
@@ -938,7 +951,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
}
catch (Exception e) {
logWriter.error("Exception occured", e);
- fail("Exception occured when it was not supposed to occur");
+ throw new AssertionError("Exception occured when it was not supposed to occur", e);
}
}
});
@@ -958,7 +971,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
try {
th.join(5000);
} catch (InterruptedException ignore) {
- fail("exception not expected here");
+ throw new AssertionError("exception not expected here", ignore);
}
assertFalse(th.isAlive());
assertFalse(failureCause, testFailed);
@@ -987,7 +1000,7 @@ public class ConcurrentRollingAndRegionOperationsJUnitTest extends
testFailed = true;
failureCause = "Exception occured when it was not supposed to occur, due to "
+ e;
- fail("Exception occured when it was not supposed to occur, due to " + e);
+ throw new AssertionError("Exception occured when it was not supposed to occur, due to ", e);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java
index d7493de..238d641 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConflationJUnitTest.java
@@ -34,7 +34,6 @@ import static org.junit.Assert.*;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
- *
* This test does a check that conflation in the buffer happen correctly
*
* Conflation cases tested include:
@@ -47,198 +46,164 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* <li> create, invalidate, modify
* </ul>
* The test is done for persist only, overflow only and persist + overflow only (async modes).
- *
- *
*/
@Category(IntegrationTest.class)
-public class ConflationJUnitTest extends DiskRegionTestingBase
-{
+public class ConflationJUnitTest extends DiskRegionTestingBase {
+
private DiskRegionProperties diskProps = new DiskRegionProperties();
+ private long flushCount;
+
@Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
+ protected final void postSetUp() throws Exception {
diskProps.setDiskDirs(dirs);
diskProps.setBytesThreshold(100000000);
diskProps.setTimeInterval(100000000);
diskProps.setSynchronous(false);
}
-
-
- protected void createOverflowOnly()
- {
- region = DiskRegionHelperFactory.getAsyncOverFlowOnlyRegion(cache,
- diskProps);
- }
-
- protected void createPersistOnly()
- {
+ private void createPersistOnly() {
region = DiskRegionHelperFactory
.getAsyncPersistOnlyRegion(cache, diskProps);
}
- protected void createOverflowAndPersist()
- {
+ private void createOverflowAndPersist() {
region = DiskRegionHelperFactory.getAsyncOverFlowAndPersistRegion(cache,
diskProps);
}
/**
* do a put followed by a put
- *
*/
- void putAndPut()
- {
+ private void putAndPut() {
region.put(new Integer(1), new Integer(1));
region.put(new Integer(1), new Integer(2));
}
/**
* do a put followed by a destroy on the same entry
- *
*/
- void putAndDestroy()
- {
+ private void putAndDestroy() {
region.put(new Integer(1), new Integer(1));
try {
region.destroy(new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
+ logWriter.error("Exception occurred",e);
fail(" failed to destory Integer");
}
}
/**
* do a put destroy the same entry and put it again
- *
*/
- void putDestroyPut()
- {
+ private void putDestroyPut() {
putAndDestroy();
region.put(new Integer(1), new Integer(2));
}
/**
* put a key and then invalidate it
- *
*/
- void putAndInvalidate()
- {
+ private void putAndInvalidate() {
region.put(new Integer(1), new Integer(1));
try {
region.invalidate(new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed to invalidate Integer");
+ logWriter.error("Exception occurred",e);
+ throw new AssertionError(" failed to invalidate Integer", e);
}
}
/**
* put a key, invalidate it and the perform a put on it
- *
*/
- void putInvalidatePut()
- {
+ private void putInvalidatePut() {
putAndInvalidate();
region.put(new Integer(1), new Integer(2));
}
/**
* do a create and then a put on the same key
- *
*/
- void createAndPut()
- {
+ private void createAndPut() {
try {
region.create(new Integer(1), new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed in trying to create");
+ logWriter.error("Exception occurred",e);
+ throw new AssertionError(" failed in trying to create", e);
}
region.put(new Integer(1), new Integer(2));
}
/**
* do a create and then a destroy
- *
*/
- void createAndDestroy()
- {
+ private void createAndDestroy() {
try {
region.create(new Integer(1), new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed in trying to create");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed in trying to create", e);
}
try {
region.destroy(new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed to destory Integer");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed to destroy Integer", e);
}
}
/**
* do a create then destroy the entry and create it again
- *
*/
- void createDestroyCreate()
- {
+ private void createDestroyCreate() {
createAndDestroy();
try {
region.create(new Integer(1), new Integer(2));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed in trying to create");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed in trying to create", e);
}
}
/**
* create an entry and then invalidate it
- *
*/
- void createAndInvalidate()
- {
+ private void createAndInvalidate() {
try {
region.create(new Integer(1), new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed in trying to create");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed in trying to create", e);
}
try {
region.invalidate(new Integer(1));
}
catch (Exception e) {
- logWriter.error("Exception occured",e);
- fail(" failed to invalidate Integer");
+ logWriter.error("Exception occurred", e);
+ throw new AssertionError("failed to invalidate Integer", e);
}
}
/**
* create an entry, invalidate it and then perform a put on the same key
- *
*/
- void createInvalidatePut()
- {
+ private void createInvalidatePut() {
createAndInvalidate();
region.put(new Integer(1), new Integer(2));
}
/**
* validate whether a modification of an entry was correctly done
- *
*/
- void validateModification()
- {
+ private void validateModification() {
Collection entries = ((LocalRegion)region).entries.regionEntries();
if (entries.size() != 1) {
fail("expected size to be 1 but is not so");
@@ -247,16 +212,14 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
DiskId id = ((DiskEntry)entry).getDiskId();
Object obj = ((LocalRegion)region).getDiskRegion().get(id);
if (!(obj.equals(new Integer(2)))) {
- fail(" incorrect modification");
+ fail("incorrect modification");
}
}
/**
* validate whether nothing was written
- */
-
- void validateNothingWritten()
- {
+ */
+ private void validateNothingWritten() {
Collection entries = ((LocalRegion)region).entries.regionEntries();
//We actually will have a tombstone in the region, hence
//the 1 entry
@@ -264,19 +227,12 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
fail("expected size to be 1 but is " + entries.size());
}
assertEquals(this.flushCount, getCurrentFlushCount());
-// Oplog oplog = ((LocalRegion)region).getDiskRegion().getChild();
-// if (oplog.getOplogSize() != 0) {
-// fail(" expected zero bytes to have been written but is "
-// + oplog.getOplogSize());
-// }
}
/**
* validate whether invalidate was done
- *
*/
- void validateTombstone()
- {
+ private void validateTombstone() {
Collection entries = ((LocalRegion)region).entries.regionEntries();
if (entries.size() != 1) {
fail("expected size to be 1 but is " + entries.size());
@@ -289,10 +245,8 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
/**
* validate whether invalidate was done
- *
*/
- void validateInvalidate()
- {
+ private void validateInvalidate() {
Collection entries = ((LocalRegion)region).entries.regionEntries();
if (entries.size() != 1) {
fail("expected size to be 1 but is " + entries.size());
@@ -305,31 +259,26 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
}
}
- private long flushCount;
-
private long getCurrentFlushCount() {
return ((LocalRegion)region).getDiskStore().getStats().getFlushes();
}
- void pauseFlush() {
+
+ private void pauseFlush() {
((LocalRegion)region).getDiskRegion().pauseFlusherForTesting();
this.flushCount = getCurrentFlushCount();
}
/**
* force a flush on the region
- *
*/
- void forceFlush()
- {
+ private void forceFlush() {
((LocalRegion)region).getDiskRegion().flushForTesting();
}
/**
* all the operations done here
- *
*/
- void allTest()
- {
+ private void allTest() {
pauseFlush();
createAndPut();
forceFlush();
@@ -370,16 +319,13 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
forceFlush();
validateInvalidate();
region.clear();
-
}
/**
* test conflation for perist only
- *
*/
@Test
- public void testPersistOnlyConflation()
- {
+ public void testPersistOnlyConflation() throws Exception {
createPersistOnly();
allTest();
closeDown();
@@ -387,22 +333,11 @@ public class ConflationJUnitTest extends DiskRegionTestingBase
/**
* test conflation for overflow and persist
- *
*/
@Test
- public void testOverFlowAndPersistOnlyConflation()
- {
- try {
- createOverflowAndPersist();
- allTest();
- closeDown();
- }
- catch (Exception e) {
- e.printStackTrace();
- fail(e.toString());
- }
+ public void testOverFlowAndPersistOnlyConflation() throws Exception {
+ createOverflowAndPersist();
+ allTest();
+ closeDown();
}
-
-
-
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConnectDisconnectDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConnectDisconnectDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConnectDisconnectDUnitTest.java
index d585d26..c0be121 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConnectDisconnectDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/ConnectDisconnectDUnitTest.java
@@ -16,29 +16,31 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache30.CacheTestCase;
-import com.gemstone.gemfire.test.dunit.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
import java.util.Properties;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+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.IgnoredException;
+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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/** A test of 46438 - missing response to an update attributes message */
-public class ConnectDisconnectDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class ConnectDisconnectDUnitTest extends JUnit4CacheTestCase {
- static {
-// System.setProperty("DistributionManager.VERBOSE", "true");
- }
-
-
private IgnoredException ex;
- public ConnectDisconnectDUnitTest(String name) {
- super(name);
- }
-
-
- // see bugs #50785 and #46438
+ // see bugs #50785 and #46438
+ @Test
public void testManyConnectsAndDisconnects() throws Throwable {
// invokeInEveryVM(new SerializableRunnable() {
//
@@ -63,7 +65,7 @@ public class ConnectDisconnectDUnitTest extends CacheTestCase {
static int LOCATOR_PORT;
static String LOCATORS_STRING;
-
+
static int[] locatorPorts;
public void setLocatorPorts(int[] ports) {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DeltaFaultInDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DeltaFaultInDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DeltaFaultInDUnitTest.java
index 78855fd..83436da 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DeltaFaultInDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/DeltaFaultInDUnitTest.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.DataPolicy;
@@ -35,16 +44,18 @@ import com.gemstone.gemfire.test.dunit.VM;
* we fault out and in a delta object.
*
*/
-public class DeltaFaultInDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class DeltaFaultInDUnitTest extends JUnit4CacheTestCase {
/**
* @param name
*/
- public DeltaFaultInDUnitTest(String name) {
- super(name);
+ public DeltaFaultInDUnitTest() {
+ super();
}
+ @Test
public void test() throws Exception {
final Host host = Host.getHost(0);
VM vm0 = host.getVM(0);