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 18:49:40 UTC
[12/54] [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/wan/AsyncEventQueueTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/AsyncEventQueueTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/AsyncEventQueueTestBase.java
index 1e48447..cfde00a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/AsyncEventQueueTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/AsyncEventQueueTestBase.java
@@ -16,9 +16,48 @@
*/
package com.gemstone.gemfire.internal.cache.wan;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.DataInput;
+import java.io.DataOutput;
+import java.io.File;
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+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.StringTokenizer;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.DataSerializer;
-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.CacheFactory;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Declarable;
+import com.gemstone.gemfire.cache.DiskStore;
+import com.gemstone.gemfire.cache.DiskStoreFactory;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEvent;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventListener;
import com.gemstone.gemfire.cache.asyncqueue.AsyncEventQueue;
@@ -32,8 +71,13 @@ import com.gemstone.gemfire.cache.control.RebalanceResults;
import com.gemstone.gemfire.cache.control.ResourceManager;
import com.gemstone.gemfire.cache.persistence.PartitionOfflineException;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
-import com.gemstone.gemfire.cache.wan.*;
+import com.gemstone.gemfire.cache.wan.GatewayEventFilter;
+import com.gemstone.gemfire.cache.wan.GatewayEventSubstitutionFilter;
+import com.gemstone.gemfire.cache.wan.GatewayReceiver;
+import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
+import com.gemstone.gemfire.cache.wan.GatewaySender;
import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
+import com.gemstone.gemfire.cache.wan.GatewaySenderFactory;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
import com.gemstone.gemfire.internal.AvailablePortHelper;
@@ -42,20 +86,19 @@ import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
import com.gemstone.gemfire.internal.cache.PartitionedRegion;
import com.gemstone.gemfire.internal.cache.RegionQueue;
import com.gemstone.gemfire.internal.cache.lru.Sizeable;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.DataInput;
-import java.io.DataOutput;
-import java.io.File;
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-public class AsyncEventQueueTestBase extends DistributedTestCase {
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+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;
+
+@Category(DistributedTest.class)
+public class AsyncEventQueueTestBase extends JUnit4DistributedTestCase {
protected static Cache cache;
@@ -84,8 +127,8 @@ public class AsyncEventQueueTestBase extends DistributedTestCase {
// list
protected static int numDispatcherThreadsForTheRun = 1;
- public AsyncEventQueueTestBase(String name) {
- super(name);
+ public AsyncEventQueueTestBase() {
+ super();
}
@Override
@@ -118,7 +161,7 @@ public class AsyncEventQueueTestBase extends DistributedTestCase {
if (Locator.hasLocator()) {
Locator.getLocator().stop();
}
- AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(getTestMethodName());
+ AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
@@ -132,7 +175,7 @@ public class AsyncEventQueueTestBase extends DistributedTestCase {
}
public static Integer createFirstRemoteLocator(int dsId, int remoteLocPort) {
- AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(getTestMethodName());
+ AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
int port = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
@@ -651,7 +694,7 @@ public class AsyncEventQueueTestBase extends DistributedTestCase {
}
protected static void createCache(Integer locPort) {
- AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(getTestMethodName());
+ AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + locPort
@@ -661,7 +704,7 @@ public class AsyncEventQueueTestBase extends DistributedTestCase {
}
public static void createCacheWithoutLocator(Integer mCastPort) {
- AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(getTestMethodName());
+ AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "" + mCastPort);
InternalDistributedSystem ds = test.getSystem(props);
@@ -872,7 +915,7 @@ public class AsyncEventQueueTestBase extends DistributedTestCase {
}
public static int createReceiver(int locPort) {
- AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(getTestMethodName());
+ AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
Properties props = test.getDistributedSystemProperties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "localhost[" + locPort
@@ -1520,7 +1563,7 @@ public class AsyncEventQueueTestBase extends DistributedTestCase {
cache = null;
}
else {
- AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(getTestMethodName());
+ AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
if (test.isConnectedToDS()) {
test.getSystem().disconnect();
}
@@ -1528,7 +1571,7 @@ public class AsyncEventQueueTestBase extends DistributedTestCase {
}
public static void shutdownLocator() {
- AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(getTestMethodName());
+ AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
test.getSystem().disconnect();
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerDUnitTest.java
index 5ef8909..3a1d901 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerDUnitTest.java
@@ -16,6 +16,18 @@
*/
package com.gemstone.gemfire.internal.cache.wan.asyncqueue;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+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.asyncqueue.AsyncEventQueueFactory;
import com.gemstone.gemfire.cache.asyncqueue.internal.AsyncEventQueueFactoryImpl;
@@ -27,31 +39,23 @@ import com.gemstone.gemfire.internal.cache.wan.AsyncEventQueueTestBase;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnableIF;
import com.gemstone.gemfire.test.dunit.Wait;
+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.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+@Category(DistributedTest.class)
public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
- private static final long serialVersionUID = 1L;
-
- public AsyncEventListenerDUnitTest(String name) {
- super(name);
+ public AsyncEventListenerDUnitTest() {
+ super();
}
/**
* Test to verify that AsyncEventQueue can not be created when null listener
* is passed.
*/
+ @Test
public void testCreateAsyncEventQueueWithNullListener() {
- AsyncEventQueueTestBase test = new AsyncEventQueueTestBase(getTestMethodName());
+ AsyncEventQueueTestBase test = new AsyncEventQueueTestBase();
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
InternalDistributedSystem ds = test.getSystem(props);
@@ -69,6 +73,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
}
+ @Test
public void testSerialAsyncEventQueueAttributes() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -80,6 +85,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
vm1.invoke(() -> AsyncEventQueueTestBase.validateAsyncEventQueueAttributes( "ln", 100, 150, AsyncEventQueueFactoryImpl.DEFAULT_BATCH_TIME_INTERVAL, true, "testDS", true, true ));
}
+ @Test
public void testSerialAsyncEventQueueSize() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -138,38 +144,39 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Added to reproduce defect #50366:
* NullPointerException with AsyncEventQueue#size() when number of dispatchers is more than 1
*/
+ @Test
public void testConcurrentSerialAsyncEventQueueSize() {
- Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
+ Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
- vm1.invoke(createCacheRunnable(lnPort));
- vm2.invoke(createCacheRunnable(lnPort));
- vm3.invoke(createCacheRunnable(lnPort));
- vm4.invoke(createCacheRunnable(lnPort));
+ vm1.invoke(createCacheRunnable(lnPort));
+ vm2.invoke(createCacheRunnable(lnPort));
+ vm3.invoke(createCacheRunnable(lnPort));
+ vm4.invoke(createCacheRunnable(lnPort));
vm1.invoke(() -> AsyncEventQueueTestBase.createConcurrentAsyncEventQueue( "ln",
false, 100, 150, true, false, null, false, 2, OrderPolicy.KEY ));
vm2.invoke(() -> AsyncEventQueueTestBase.createConcurrentAsyncEventQueue( "ln",
false, 100, 150, true, false, null, false, 2, OrderPolicy.KEY ));
- vm1.invoke(createReplicatedRegionRunnable());
- vm2.invoke(createReplicatedRegionRunnable());
- vm3.invoke(createReplicatedRegionRunnable());
- vm4.invoke(createReplicatedRegionRunnable());
+ vm1.invoke(createReplicatedRegionRunnable());
+ vm2.invoke(createReplicatedRegionRunnable());
+ vm3.invoke(createReplicatedRegionRunnable());
+ vm4.invoke(createReplicatedRegionRunnable());
- vm1
- .invoke(pauseAsyncEventQueueRunnable());
- vm2
- .invoke(pauseAsyncEventQueueRunnable());
+ vm1
+ .invoke(pauseAsyncEventQueueRunnable());
+ vm2
+ .invoke(pauseAsyncEventQueueRunnable());
- Wait.pause(1000);// pause at least for the batchTimeInterval
+ Wait.pause(1000);// pause at least for the batchTimeInterval
- vm1.invoke(() -> AsyncEventQueueTestBase.doPuts( getTestMethodName() + "_RR",
- 1000 ));
+ vm1.invoke(() -> AsyncEventQueueTestBase.doPuts( getTestMethodName() + "_RR",
+ 1000 ));
- int vm1size = (Integer)vm1.invoke(() -> AsyncEventQueueTestBase.getAsyncEventQueueSize( "ln" ));
- int vm2size = (Integer)vm2.invoke(() -> AsyncEventQueueTestBase.getAsyncEventQueueSize( "ln" ));
- assertEquals("Size of AsyncEventQueue is incorrect", 1000, vm1size);
- assertEquals("Size of AsyncEventQueue is incorrect", 1000, vm2size);
+ int vm1size = (Integer)vm1.invoke(() -> AsyncEventQueueTestBase.getAsyncEventQueueSize( "ln" ));
+ int vm2size = (Integer)vm2.invoke(() -> AsyncEventQueueTestBase.getAsyncEventQueueSize( "ln" ));
+ assertEquals("Size of AsyncEventQueue is incorrect", 1000, vm1size);
+ assertEquals("Size of AsyncEventQueue is incorrect", 1000, vm2size);
}
/**
@@ -178,7 +185,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Region: Replicated WAN: Serial Region persistence enabled: false Async
* channel persistence enabled: false
*/
-
+ @Test
public void testReplicatedSerialAsyncEventQueue() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -210,6 +217,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Verify that the events loaded by CacheLoader reach the AsyncEventListener
* with correct operation detail (added for defect #50237).
*/
+ @Test
public void testReplicatedSerialAsyncEventQueueWithCacheLoader() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -252,7 +260,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Error is thrown from AsyncEventListener implementation while processing the batch.
* Added to test the fix done for defect #45152.
*/
-
+ @Test
public void testReplicatedSerialAsyncEventQueue_ExceptionScenario() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -305,6 +313,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Region: Replicated WAN: Serial Region persistence enabled: false Async
* channel persistence enabled: false AsyncEventQueue conflation enabled: true
*/
+ @Test
public void testReplicatedSerialAsyncEventQueueWithConflationEnabled() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -381,8 +390,6 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
vm4.invoke(() -> AsyncEventQueueTestBase.validateAsyncEventListener( "ln", 0 ));// secondary
}
-
-
/**
* Test configuration::
*
@@ -391,8 +398,9 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
*
* Note: The test doesn't create a locator but uses MCAST port instead.
*/
- @Ignore("Disabled until I can sort out the hydra dependencies - see bug 52214")
- public void DISABLED_testReplicatedSerialAsyncEventQueueWithoutLocator() {
+ @Ignore("TODO: Disabled until I can sort out the hydra dependencies - see bug 52214")
+ @Test
+ public void testReplicatedSerialAsyncEventQueueWithoutLocator() {
int mPort = AvailablePortHelper.getRandomAvailablePortForDUnitSite();
vm1.invoke(() -> AsyncEventQueueTestBase.createCacheWithoutLocator( mPort ));
vm2.invoke(() -> AsyncEventQueueTestBase.createCacheWithoutLocator( mPort ));
@@ -427,6 +435,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* No VM is restarted.
*/
+ @Test
public void testReplicatedSerialAsyncEventQueueWithPeristenceEnabled() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -465,9 +474,9 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
*
* There is only one vm in the site and that vm is restarted
*/
-
- @Ignore("Disabled for 52351")
- public void DISABLED_testReplicatedSerialAsyncEventQueueWithPeristenceEnabled_Restart() {
+ @Ignore("TODO: Disabled for 52351")
+ @Test
+ public void testReplicatedSerialAsyncEventQueueWithPeristenceEnabled_Restart() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
vm1.invoke(createCacheRunnable(lnPort));
@@ -506,8 +515,9 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
*
* There are 3 VMs in the site and the VM with primary sender is shut down.
*/
- @Ignore("Disabled for 52351")
- public void DISABLED_testReplicatedSerialAsyncEventQueueWithPeristenceEnabled_Restart2() {
+ @Ignore("TODO: Disabled for 52351")
+ @Test
+ public void testReplicatedSerialAsyncEventQueueWithPeristenceEnabled_Restart2() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
vm1.invoke(createCacheRunnable(lnPort));
@@ -550,6 +560,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Dispatcher threads: more than 1
* Order policy: key based ordering
*/
+ @Test
public void testConcurrentSerialAsyncEventQueueWithReplicatedRegion() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -588,6 +599,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Region persistence enabled: false
* Async queue persistence enabled: false
*/
+ @Test
public void testConcurrentSerialAsyncEventQueueWithReplicatedRegion_2() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -628,6 +640,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Dispatcher threads set to more than 1 but no order policy set.
* Added for defect #50514.
*/
+ @Test
public void testConcurrentSerialAsyncEventQueueWithoutOrderPolicy() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -664,6 +677,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Region: Partitioned WAN: Serial Region persistence enabled: false Async
* channel persistence enabled: false
*/
+ @Test
public void testPartitionedSerialAsyncEventQueue() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -698,6 +712,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Region: Partitioned WAN: Serial Region persistence enabled: false Async
* channel persistence enabled: false AsyncEventQueue conflation enabled: true
*/
+ @Test
public void testPartitionedSerialAsyncEventQueueWithConflationEnabled() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -782,6 +797,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
*
* No VM is restarted.
*/
+ @Test
public void testPartitionedSerialAsyncEventQueueWithPeristenceEnabled() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -822,6 +838,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
*
* There is only one vm in the site and that vm is restarted
*/
+ @Test
public void testPartitionedSerialAsyncEventQueueWithPeristenceEnabled_Restart() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -854,6 +871,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
vm1.invoke(() -> AsyncEventQueueTestBase.validateAsyncEventListener( "ln", 1000 ));// primary sender
}
+ @Test
public void testParallelAsyncEventQueueWithReplicatedRegion() {
try {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -883,6 +901,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
}
}
+ @Test
public void testParallelAsyncEventQueue() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -921,6 +940,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
assertEquals(vm1size + vm2size + vm3size + vm4size, 256);
}
+ @Test
public void testParallelAsyncEventQueueWithSubstitutionFilter() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -940,6 +960,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
vm1.invoke(() -> verifySubstitutionFilterInvocations( "ln" ,numPuts ));
}
+ @Test
public void testParallelAsyncEventQueueWithSubstitutionFilterNoSubstituteValueToDataInvocations() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -963,6 +984,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Verify that the events reaching the AsyncEventListener have correct operation detail.
* (added for defect #50237).
*/
+ @Test
public void testParallelAsyncEventQueueWithCacheLoader() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -993,6 +1015,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
vm4.invoke(() -> AsyncEventQueueTestBase.validateAsyncEventForOperationDetail( "ln", 250, false, true ));
}
+ @Test
public void testParallelAsyncEventQueueSize() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -1039,6 +1062,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* Added to reproduce defect #50366:
* NullPointerException with AsyncEventQueue#size() when number of dispatchers is more than 1
*/
+ @Test
public void testConcurrentParallelAsyncEventQueueSize() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -1081,6 +1105,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
assertEquals("Size of AsyncEventQueue is incorrect", 1000, vm2size);
}
+ @Test
public void testParallelAsyncEventQueueWithConflationEnabled() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -1165,6 +1190,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
/**
* Added to reproduce defect #47213
*/
+ @Test
public void testParallelAsyncEventQueueWithConflationEnabled_bug47213() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -1242,6 +1268,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
}
+ @Test
public void testParallelAsyncEventQueueWithOneAccessor() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -1282,6 +1309,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
}
+ @Test
public void testParallelAsyncEventQueueWithPersistence() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -1320,12 +1348,13 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
assertEquals(vm1size + vm2size + vm3size + vm4size, 256);
}
-/**
- * Test case to test possibleDuplicates. vm1 & vm2 are hosting the PR. vm2 is
- * killed so the buckets hosted by it are shifted to vm1.
- */
- @Ignore("Disabled for 52349")
- public void DISABLED_testParallelAsyncEventQueueHA_Scenario1() {
+ /**
+ * Test case to test possibleDuplicates. vm1 & vm2 are hosting the PR. vm2 is
+ * killed so the buckets hosted by it are shifted to vm1.
+ */
+ @Ignore("TODO: Disabled for 52349")
+ @Test
+ public void testParallelAsyncEventQueueHA_Scenario1() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
vm1.invoke(createCacheRunnable(lnPort));
vm2.invoke(createCacheRunnable(lnPort));
@@ -1378,6 +1407,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* between vm1 & vm3.
*/
@Category(FlakyTest.class) // GEODE-688 & GEODE-713: random ports, thread sleeps, async actions
+ @Test
public void testParallelAsyncEventQueueHA_Scenario2() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -1444,6 +1474,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
* vm1, vm2 & vm3.
*/
@Ignore("Depends on hydra code. See bug ")
+ @Test
public void testParallelAsyncEventQueueHA_Scenario3() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -1502,6 +1533,7 @@ public class AsyncEventListenerDUnitTest extends AsyncEventQueueTestBase {
/**
* Added for defect #50364 Can't colocate region that has AEQ with a region that does not have that same AEQ
*/
+ @Test
public void testParallelAsyncEventQueueAttachedToChildRegionButNotToParentRegion() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerOffHeapDUnitTest.java
index e78dd6b..170383d 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventListenerOffHeapDUnitTest.java
@@ -16,11 +16,21 @@
*/
package com.gemstone.gemfire.internal.cache.wan.asyncqueue;
+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;
+
@SuppressWarnings("serial")
+@Category(DistributedTest.class)
public class AsyncEventListenerOffHeapDUnitTest extends AsyncEventListenerDUnitTest {
- public AsyncEventListenerOffHeapDUnitTest(String name) {
- super(name);
+ public AsyncEventListenerOffHeapDUnitTest() {
+ super();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java
index 8972595..ef1137b 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueStatsDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.wan.asyncqueue;
+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;
@@ -23,17 +32,19 @@ import com.gemstone.gemfire.internal.cache.wan.AsyncEventQueueTestBase;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
import com.gemstone.gemfire.test.dunit.Wait;
+@Category(DistributedTest.class)
public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
private static final long serialVersionUID = 1L;
- public AsyncEventQueueStatsDUnitTest(String name) {
- super(name);
+ public AsyncEventQueueStatsDUnitTest() {
+ super();
}
/**
* Normal replication scenario
*/
+ @Test
public void testReplicatedSerialPropagation() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -73,6 +84,7 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
/**
* Two listeners added to the same RR.
*/
+ @Test
public void testAsyncStatsTwoListeners() throws Exception {
Integer lnPort = createFirstLocatorWithDSId(1);
@@ -128,6 +140,7 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
/**
* HA scenario: kill one vm when puts are in progress on the other vm.
*/
+ @Test
public void testReplicatedSerialPropagationHA() throws Exception {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -174,6 +187,7 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
/**
* Two regions attached to same AsyncEventQueue
*/
+ @Test
public void testReplicatedSerialPropagationUNPorcessedEvents() throws Exception {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -228,6 +242,7 @@ public class AsyncEventQueueStatsDUnitTest extends AsyncEventQueueTestBase {
/**
* Test with conflation enabled
*/
+ @Test
public void testSerialPropagationConflation() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
index 3055c8e..5d2e8ac 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/asyncqueue/AsyncEventQueueValidationsJUnitTest.java
@@ -19,6 +19,21 @@
*/
package com.gemstone.gemfire.internal.cache.wan.asyncqueue;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static junitparams.JUnitParamsRunner.*;
+import static org.junit.Assert.*;
+
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+
+import com.jayway.awaitility.Awaitility;
+import junitparams.JUnitParamsRunner;
+import junitparams.Parameters;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+import org.junit.runner.RunWith;
+
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.cache.Region;
@@ -30,26 +45,7 @@ import com.gemstone.gemfire.internal.cache.wan.AsyncEventQueueConfigurationExcep
import com.gemstone.gemfire.internal.cache.wan.MyGatewayEventFilter;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
import com.gemstone.gemfire.util.test.TestUtil;
-import com.jayway.awaitility.Awaitility;
-import junitparams.JUnitParamsRunner;
-import junitparams.Parameters;
-import org.junit.After;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-import org.junit.runner.RunWith;
-import java.util.List;
-import java.util.concurrent.TimeUnit;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.CACHE_XML_FILE;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static junitparams.JUnitParamsRunner.$;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-/**
- *
- */
@Category(IntegrationTest.class)
@RunWith(JUnitParamsRunner.class)
public class AsyncEventQueueValidationsJUnitTest {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java
index 3e52393..e0216f1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.wan.concurrent;
+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.asyncqueue.internal.AsyncEventQueueFactoryImpl;
import com.gemstone.gemfire.cache.wan.GatewaySender.OrderPolicy;
import com.gemstone.gemfire.internal.cache.wan.AsyncEventQueueTestBase;
@@ -25,14 +34,16 @@ import com.gemstone.gemfire.test.dunit.AsyncInvocation;
/**
*
*/
+@Category(DistributedTest.class)
public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase {
private static final long serialVersionUID = 1L;
- public ConcurrentAsyncEventQueueDUnitTest(String name) {
- super(name);
+ public ConcurrentAsyncEventQueueDUnitTest() {
+ super();
}
+ @Test
public void testConcurrentSerialAsyncEventQueueAttributes() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -45,6 +56,7 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
}
+ @Test
public void testConcurrentParallelAsyncEventQueueAttributesOrderPolicyKey() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -56,6 +68,7 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
vm1.invoke(() -> AsyncEventQueueTestBase.validateConcurrentAsyncEventQueueAttributes( "ln", 100, 150, AsyncEventQueueFactoryImpl.DEFAULT_BATCH_TIME_INTERVAL, true, "testDS", true, true, 5, OrderPolicy.KEY ));
}
+ @Test
public void testConcurrentParallelAsyncEventQueueAttributesOrderPolicyPartition() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -76,6 +89,7 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
* Order policy: key based ordering
*/
+ @Test
public void testReplicatedSerialAsyncEventQueueWithMultipleDispatcherThreadsOrderPolicyKey() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -121,6 +135,7 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
* Order policy: Thread ordering
*/
+ @Test
public void testReplicatedSerialAsyncEventQueueWithMultipleDispatcherThreadsOrderPolicyThread() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -180,6 +195,7 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
* Order policy: key based ordering
*/
// Disabling test for bug #48323
+ @Test
public void testPartitionedParallelAsyncEventQueueWithMultipleDispatcherThreadsOrderPolicyKey() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
@@ -229,6 +245,7 @@ public class ConcurrentAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase
* Order policy: PARTITION based ordering
*/
// Disabled test for bug #48323
+ @Test
public void testPartitionedParallelAsyncEventQueueWithMultipleDispatcherThreadsOrderPolicyPartition() {
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueOffHeapDUnitTest.java
index ac6472e..8e5034f 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/concurrent/ConcurrentAsyncEventQueueOffHeapDUnitTest.java
@@ -16,12 +16,22 @@
*/
package com.gemstone.gemfire.internal.cache.wan.concurrent;
+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;
+
@SuppressWarnings("serial")
+@Category(DistributedTest.class)
public class ConcurrentAsyncEventQueueOffHeapDUnitTest extends
ConcurrentAsyncEventQueueDUnitTest {
- public ConcurrentAsyncEventQueueOffHeapDUnitTest(String name) {
- super(name);
+ public ConcurrentAsyncEventQueueOffHeapDUnitTest() {
+ super();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java
index 8a88d43..0261620 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache.wan.misc;
+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.internal.cache.wan.AsyncEventQueueTestBase;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.IgnoredException;
@@ -23,14 +32,16 @@ import com.gemstone.gemfire.test.dunit.IgnoredException;
/**
*
*/
+@Category(DistributedTest.class)
public class CommonParallelAsyncEventQueueDUnitTest extends AsyncEventQueueTestBase {
private static final long serialVersionUID = 1L;
- public CommonParallelAsyncEventQueueDUnitTest(String name) {
- super(name);
+ public CommonParallelAsyncEventQueueDUnitTest() {
+ super();
}
+ @Test
public void testSameSenderWithNonColocatedRegions() throws Exception {
IgnoredException.addIgnoredException("cannot have the same parallel async");
Integer lnPort = (Integer)vm0.invoke(() -> AsyncEventQueueTestBase.createFirstLocatorWithDSId( 1 ));
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueOffHeapDUnitTest.java
index bceae58..f570cfb 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/wan/misc/CommonParallelAsyncEventQueueOffHeapDUnitTest.java
@@ -16,12 +16,22 @@
*/
package com.gemstone.gemfire.internal.cache.wan.misc;
+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;
+
@SuppressWarnings("serial")
+@Category(DistributedTest.class)
public class CommonParallelAsyncEventQueueOffHeapDUnitTest extends
CommonParallelAsyncEventQueueDUnitTest {
- public CommonParallelAsyncEventQueueOffHeapDUnitTest(String name) {
- super(name);
+ public CommonParallelAsyncEventQueueOffHeapDUnitTest() {
+ super();
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
index 26832db..1092721 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheConfigDUnitTest.java
@@ -16,25 +16,36 @@
*/
package com.gemstone.gemfire.internal.compression;
-import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache30.CacheTestCase;
-import com.gemstone.gemfire.compression.Compressor;
-import com.gemstone.gemfire.compression.SnappyCompressor;
-import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.test.dunit.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.io.File;
import java.io.IOException;
import java.io.PrintStream;
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.cache.Region;
+import com.gemstone.gemfire.compression.Compressor;
+import com.gemstone.gemfire.compression.SnappyCompressor;
+import com.gemstone.gemfire.internal.cache.LocalRegion;
+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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests configured and badly configured cache.xml files with regards to compression.
- *
*/
-public class CompressionCacheConfigDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class CompressionCacheConfigDUnitTest extends JUnit4CacheTestCase {
+
/**
* The name of our test region.
*/
@@ -51,22 +62,14 @@ public class CompressionCacheConfigDUnitTest extends CacheTestCase {
private static final String BAD_COMPRESSOR = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE cache PUBLIC \"-//GemStone Systems, Inc.//GemFire Declarative Cache 8.0//EN\" \"http://www.gemstone.com/dtd/cache8_0.dtd\">\n<cache lock-lease=\"120\" lock-timeout=\"60\" search-timeout=\"300\" is-server=\"true\" copy-on-read=\"false\">\n<region name=\"compressedRegion\">\n<region-attributes data-policy=\"replicate\" cloning-enabled=\"true\">\n<compressor>\n<class-name>BAD_COMPRESSOR</class-name>\n</compressor>\n</region-attributes>\n</region>\n</cache>";
/**
- * Create a new CompressionCacheConfigDUnitTest.
- * @param name test name.
- */
- public CompressionCacheConfigDUnitTest(String name) {
- super(name);
- }
-
- /**
* Asserts that a member is successfully initialized with a compressed region when
* a compressor is included in the region attributes.
- * @throws Exception
*/
+ @Test
public void testCreateCacheWithGoodCompressor() throws Exception {
try {
SnappyCompressor.getDefaultInstance();
- } catch (Throwable t) {
+ } catch (Throwable t) { // TODO: use junit Assume
// Not a supported OS
return;
}
@@ -80,8 +83,8 @@ public class CompressionCacheConfigDUnitTest extends CacheTestCase {
/**
* Asserts that member initialization fails when an unrecognized compressor is declared in the
* cache.xml.
- * @throws Exception
*/
+ @Test
public void testCreateCacheWithBadCompressor() throws Exception {
IgnoredException.addIgnoredException("Unable to load class BAD_COMPRESSOR");
File cacheXml = createCacheXml(BAD_COMPRESSOR);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
index f6f7eac..f649d9a 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.compression;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.TimeUnit;
@@ -40,7 +49,8 @@ import com.gemstone.gemfire.test.dunit.VM;
* Asserts that values received in EntryEvents for CacheWriters and CacheListeners are not compressed.
*
*/
-public class CompressionCacheListenerDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class CompressionCacheListenerDUnitTest extends JUnit4CacheTestCase {
/**
* The name of our test region.
*/
@@ -156,8 +166,8 @@ public class CompressionCacheListenerDUnitTest extends CacheTestCase {
* @param name
* a test name.
*/
- public CompressionCacheListenerDUnitTest(String name) {
- super(name);
+ public CompressionCacheListenerDUnitTest() {
+ super();
}
@Override
@@ -219,6 +229,7 @@ public class CompressionCacheListenerDUnitTest extends CacheTestCase {
/**
* Tests CacheWriter and CacheListener events on the test vm.
*/
+ @Test
public void testCacheListenerAndWriter() {
testCacheListenerAndWriterWithVM(getVM(TEST_VM));
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
index e42a801..ddf814e 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionCacheListenerOffHeapDUnitTest.java
@@ -16,30 +16,21 @@
*/
package com.gemstone.gemfire.internal.compression;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.compression.SnappyCompressor;
-import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
@SuppressWarnings("serial")
-public class CompressionCacheListenerOffHeapDUnitTest extends
- CompressionCacheListenerDUnitTest {
-
- public CompressionCacheListenerOffHeapDUnitTest(String name) {
- super(name);
- }
-
- public static void caseSetUp() {
- System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "trackOffHeapRefCounts", "true");
- }
- public static void caseTearDown() {
- System.clearProperty(DistributionConfig.GEMFIRE_PREFIX + "trackOffHeapRefCounts");
- }
+@Category(DistributedTest.class)
+public class CompressionCacheListenerOffHeapDUnitTest extends CompressionCacheListenerDUnitTest {
@Override
public final void preTearDownAssertions() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
index 58cb117..93c8c00 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionConfigDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.compression;
+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 com.gemstone.gemfire.cache.DataPolicy;
@@ -41,7 +50,8 @@ import com.gemstone.gemfire.test.dunit.standalone.DUnitLauncher;
* Sanity checks on a number of basic cluster configurations with compression turned on.
*
*/
-public class CompressionRegionConfigDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class CompressionRegionConfigDUnitTest extends JUnit4CacheTestCase {
/**
* The name of our test region.
*/
@@ -66,14 +76,15 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
* Creates a new CompressionRegionOperationsDUnitTest.
* @param name a test name.
*/
- public CompressionRegionConfigDUnitTest(String name) {
- super(name);
+ public CompressionRegionConfigDUnitTest() {
+ super();
}
/**
* Sanity check using two peers sharing a replicated region.
* @throws Exception
*/
+ @Test
public void testReplicateRegion() throws Exception {
Compressor compressor = null;
try {
@@ -94,6 +105,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
* Sanity check for two peers sharing a persisted replicated region.
* @throws Exception
*/
+ @Test
public void testReplicatePersistentRegion() throws Exception {
Compressor compressor = null;
try {
@@ -116,6 +128,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
/**
* Sanity check for two peers hosting a partitioned region.
*/
+ @Test
public void testPartitionedRegion() {
Compressor compressor = null;
try {
@@ -135,6 +148,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
/**
* Sanity check for two peers hosting a persistent partitioned region.
*/
+ @Test
public void testPartitionedPersistentRegion() {
Compressor compressor = null;
try {
@@ -157,6 +171,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
/**
* Sanity check for a non caching client and a cache server.
*/
+ @Test
public void testClientProxyRegion() {
Compressor compressor = null;
try {
@@ -177,6 +192,7 @@ public class CompressionRegionConfigDUnitTest extends CacheTestCase {
/**
* Sanity check for a caching client and a cache server.
*/
+ @Test
public void testCachingClientProxyRegion() {
Compressor compressor = null;
try {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
index 9f8d228..43f7d23 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionFactoryDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.compression;
+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.DataPolicy;
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache30.CacheTestCase;
@@ -29,7 +38,8 @@ import com.gemstone.gemfire.test.dunit.VM;
/**
* Tests that the compressor region attribute is properly set or rejected by a RegionFactory.
*/
-public class CompressionRegionFactoryDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class CompressionRegionFactoryDUnitTest extends JUnit4CacheTestCase {
/**
* Compressed region name.
*/
@@ -49,14 +59,15 @@ public class CompressionRegionFactoryDUnitTest extends CacheTestCase {
* Creates a new CompressionRegionFactoryDUnitTest.
* @param name test name.
*/
- public CompressionRegionFactoryDUnitTest(String name) {
- super(name);
+ public CompressionRegionFactoryDUnitTest() {
+ super();
}
/**
* Asserts that a region is created when a valid compressor is used.
* Asserts that the region attributes contain the correct compressor value.
*/
+ @Test
public void testRegionFactoryCompressor() {
Compressor compressor = null;
try {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
index dedf3eb..1f56859 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsDUnitTest.java
@@ -16,14 +16,18 @@
*/
package com.gemstone.gemfire.internal.compression;
+import static org.junit.Assert.*;
+
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.DataPolicy;
import com.gemstone.gemfire.cache.Region;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.compression.Compressor;
import com.gemstone.gemfire.compression.SnappyCompressor;
import com.gemstone.gemfire.internal.cache.CachedDeserializableFactory;
@@ -32,12 +36,14 @@ 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.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests basic region operations with compression enabled.
- *
*/
-public class CompressionRegionOperationsDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class CompressionRegionOperationsDUnitTest extends JUnit4CacheTestCase {
/**
* The name of our test region.
*/
@@ -119,14 +125,6 @@ public class CompressionRegionOperationsDUnitTest extends CacheTestCase {
getAllCollection.add(KEY_3);
}
- /**
- * Creates a new CompressionRegionOperationsDUnitTest.
- * @param name a test name.
- */
- public CompressionRegionOperationsDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
createRegion();
@@ -177,6 +175,7 @@ public class CompressionRegionOperationsDUnitTest extends CacheTestCase {
/**
* Invokes basic get/put operations tests on the test vm.
*/
+ @Test
public void testGetPutOperations() {
testGetPutOperationsOnVM(getVM(TEST_VM));
}
@@ -244,6 +243,7 @@ public class CompressionRegionOperationsDUnitTest extends CacheTestCase {
/**
* Invokes key, value operations using the test VM.
*/
+ @Test
public void testKeysAndValuesOperations() {
testKeysAndValuesOperationsOnVM(getVM(TEST_VM));
}
@@ -334,6 +334,7 @@ public class CompressionRegionOperationsDUnitTest extends CacheTestCase {
* Tests compressed put/get region operations using CachedDeserializable values.
* @see CompressionRegionOperationsDUnitTest#testGetPutOperations()
*/
+ @Test
public void testGetPutOperationsWithCachedDeserializable() {
testGetPutOperationsWithCachedDeserializableOnVM(getVM(TEST_VM));
}
@@ -403,6 +404,7 @@ public class CompressionRegionOperationsDUnitTest extends CacheTestCase {
* Tests compressed put/get region operations using byte[] values.
* @see CompressionRegionOperationsDUnitTest#testGetPutOperations()
*/
+ @Test
public void testGetPutOperationsWithByteArrays() {
testGetPutOperationsWithByteArraysOnVM(getVM(TEST_VM));
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
index 7e15b12..16398a7 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionRegionOperationsOffHeapDUnitTest.java
@@ -16,22 +16,22 @@
*/
package com.gemstone.gemfire.internal.compression;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+
+import java.util.Properties;
+
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.compression.Compressor;
import com.gemstone.gemfire.compression.SnappyCompressor;
import com.gemstone.gemfire.internal.cache.OffHeapTestUtil;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-import java.util.Properties;
+@Category(DistributedTest.class)
+public class CompressionRegionOperationsOffHeapDUnitTest extends CompressionRegionOperationsDUnitTest {
-public class CompressionRegionOperationsOffHeapDUnitTest extends
- CompressionRegionOperationsDUnitTest {
-
- public CompressionRegionOperationsOffHeapDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void preTearDownAssertions() throws Exception {
SerializableRunnable checkOrphans = new SerializableRunnable() {
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionStatsDUnitTest.java
index 9f6dbf5..2f99ffd 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/compression/CompressionStatsDUnitTest.java
@@ -17,6 +17,15 @@
package com.gemstone.gemfire.internal.compression;
+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 com.gemstone.gemfire.cache.DataPolicy;
@@ -35,7 +44,8 @@ import com.gemstone.gemfire.test.dunit.VM;
* Tests compression statistics.
* @since GemFire 8.0
*/
-public class CompressionStatsDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class CompressionStatsDUnitTest extends JUnit4CacheTestCase {
/**
* The name of our test region.
*/
@@ -62,8 +72,8 @@ public class CompressionStatsDUnitTest extends CacheTestCase {
* Creates a new CompressionStatsDUnitTest.
* @param name test name.
*/
- public CompressionStatsDUnitTest(String name) {
- super(name);
+ public CompressionStatsDUnitTest() {
+ super();
}
/**
@@ -270,6 +280,7 @@ public class CompressionStatsDUnitTest extends CacheTestCase {
/**
* Asserts that compression stats are functioning properly.
*/
+ @Test
public void testCompressionStats() {
VM vm = Host.getHost(0).getVM(TEST_VM);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/AbstractPoolCacheJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/AbstractPoolCacheJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/AbstractPoolCacheJUnitTest.java
index 01343f5..abcca13 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/AbstractPoolCacheJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/AbstractPoolCacheJUnitTest.java
@@ -23,31 +23,31 @@
package com.gemstone.gemfire.internal.datasource;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.gemstone.gemfire.util.test.TestUtil;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
+import java.sql.Connection;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
import javax.naming.Context;
import javax.sql.PooledConnection;
import javax.sql.XAConnection;
import javax.transaction.xa.XAResource;
-import java.sql.Connection;
-import java.util.*;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.fail;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.util.test.TestUtil;
-/**
- */
@Category(IntegrationTest.class)
public class AbstractPoolCacheJUnitTest {
@@ -74,67 +74,38 @@ public class AbstractPoolCacheJUnitTest {
@Test
public void testGetSimpleDataSource() throws Exception {
- try {
- Context ctx = cache.getJNDIContext();
- GemFireBasicDataSource ds = (GemFireBasicDataSource) ctx
- .lookup("java:/SimpleDataSource");
- Connection conn = ds.getConnection();
- if (conn == null)
- fail("DataSourceFactoryTest-testGetSimpleDataSource() Error in creating the GemFireBasicDataSource");
- }
- catch (Exception e) {
- fail("Exception thrown in testGetSimpleDataSource due to " + e);
- e.printStackTrace();
- }
+ Context ctx = cache.getJNDIContext();
+ GemFireBasicDataSource ds = (GemFireBasicDataSource) ctx
+ .lookup("java:/SimpleDataSource");
+ Connection conn = ds.getConnection();
+ if (conn == null)
+ fail("DataSourceFactoryTest-testGetSimpleDataSource() Error in creating the GemFireBasicDataSource");
}
/**
- * Test of closeActiveConnection method, of class
- * com.gemstone.gemfire.internal.datasource.AbstractPoolCache.
- */
- /*
- * @Test
- public void testCloseActiveConnection() { try { Context ctx =
- * cache.getJNDIContext(); GemFireConnPooledDataSource ds =
- * (GemFireConnPooledDataSource) ctx .lookup("java:/PooledDataSource");
- * GemFireConnectionPoolManager provider = (GemFireConnectionPoolManager) ds
- * .getConnectionProvider(); ConnectionPoolCacheImpl poolCache =
- * (ConnectionPoolCacheImpl) provider .getConnectionPoolCache();
- * PooledConnection conn = poolCache.getPooledConnectionFromPool();
- * poolCache.closeActiveConnection(conn); if
- * (poolCache.activeCache.containsKey(conn)) fail("close active connection
- * failed"); } catch (Exception e) { e.printStackTrace(); } }
- */
- /**
* Test of returnPooledConnectionToPool method, of class
* com.gemstone.gemfire.internal.datasource.AbstractPoolCache.
*/
@Test
- public void testReturnPooledConnectionToPool() {
- try {
- Context ctx = cache.getJNDIContext();
- GemFireConnPooledDataSource ds = (GemFireConnPooledDataSource) ctx
- .lookup("java:/PooledDataSource");
- GemFireConnectionPoolManager provider = (GemFireConnectionPoolManager) ds
- .getConnectionProvider();
- ConnectionPoolCacheImpl poolCache = (ConnectionPoolCacheImpl) provider
- .getConnectionPoolCache();
- PooledConnection conn = (PooledConnection) poolCache
- .getPooledConnectionFromPool();
- if (poolCache.availableCache.containsKey(conn))
- fail("connection not removed from available cache list");
- if (!poolCache.activeCache.containsKey(conn))
- fail("connection not put in active connection list");
- provider.returnConnection(conn);
- if (!poolCache.availableCache.containsKey(conn))
- fail("connection not returned to pool");
- if (poolCache.activeCache.containsKey(conn))
- fail("connection not returned to active list");
- }
- catch (Exception e) {
- fail("Exception occured in testReturnPooledConnectionToPool due to " + e);
- e.printStackTrace();
- }
+ public void testReturnPooledConnectionToPool() throws Exception {
+ Context ctx = cache.getJNDIContext();
+ GemFireConnPooledDataSource ds = (GemFireConnPooledDataSource) ctx
+ .lookup("java:/PooledDataSource");
+ GemFireConnectionPoolManager provider = (GemFireConnectionPoolManager) ds
+ .getConnectionProvider();
+ ConnectionPoolCacheImpl poolCache = (ConnectionPoolCacheImpl) provider
+ .getConnectionPoolCache();
+ PooledConnection conn = (PooledConnection) poolCache
+ .getPooledConnectionFromPool();
+ if (poolCache.availableCache.containsKey(conn))
+ fail("connection not removed from available cache list");
+ if (!poolCache.activeCache.containsKey(conn))
+ fail("connection not put in active connection list");
+ provider.returnConnection(conn);
+ if (!poolCache.availableCache.containsKey(conn))
+ fail("connection not returned to pool");
+ if (poolCache.activeCache.containsKey(conn))
+ fail("connection not returned to active list");
}
/**
@@ -142,26 +113,20 @@ public class AbstractPoolCacheJUnitTest {
* com.gemstone.gemfire.internal.datasource.AbstractPoolCache.
*/
@Test
- public void testValidateConnection() {
- try {
- Context ctx = cache.getJNDIContext();
- GemFireConnPooledDataSource ds = (GemFireConnPooledDataSource) ctx
- .lookup("java:/PooledDataSource");
- GemFireConnectionPoolManager provider = (GemFireConnectionPoolManager) ds
- .getConnectionProvider();
- ConnectionPoolCacheImpl poolCache = (ConnectionPoolCacheImpl) provider
- .getConnectionPoolCache();
- PooledConnection poolConn = (PooledConnection) poolCache
- .getPooledConnectionFromPool();
- Connection conn = poolConn.getConnection();
- if (!ds.validateConnection(conn)) fail("validate connection failed");
- conn.close();
- if (ds.validateConnection(conn)) fail("validate connection failed");
- }
- catch (Exception e) {
- fail("Exception occured in testValidateConnection due to " + e);
- e.printStackTrace();
- }
+ public void testValidateConnection() throws Exception {
+ Context ctx = cache.getJNDIContext();
+ GemFireConnPooledDataSource ds = (GemFireConnPooledDataSource) ctx
+ .lookup("java:/PooledDataSource");
+ GemFireConnectionPoolManager provider = (GemFireConnectionPoolManager) ds
+ .getConnectionProvider();
+ ConnectionPoolCacheImpl poolCache = (ConnectionPoolCacheImpl) provider
+ .getConnectionPoolCache();
+ PooledConnection poolConn = (PooledConnection) poolCache
+ .getPooledConnectionFromPool();
+ Connection conn = poolConn.getConnection();
+ if (!ds.validateConnection(conn)) fail("validate connection failed");
+ conn.close();
+ if (ds.validateConnection(conn)) fail("validate connection failed");
}
/**
@@ -169,28 +134,22 @@ public class AbstractPoolCacheJUnitTest {
* com.gemstone.gemfire.internal.datasource.AbstractPoolCache.
*/
@Test
- public void testGetPooledConnectionFromPool() {
- try {
- Context ctx = cache.getJNDIContext();
- GemFireConnPooledDataSource ds = (GemFireConnPooledDataSource) ctx
- .lookup("java:/PooledDataSource");
- GemFireConnectionPoolManager provider = (GemFireConnectionPoolManager) ds
- .getConnectionProvider();
- ConnectionPoolCacheImpl poolCache = (ConnectionPoolCacheImpl) provider
- .getConnectionPoolCache();
- PooledConnection poolConn = (PooledConnection) poolCache
- .getPooledConnectionFromPool();
- if (poolConn == null)
- fail("getPooledConnectionFromPool failed to get a connection from pool");
- }
- catch (Exception e) {
- fail("Exception occured in testGetPooledConnectionFromPool due to " + e);
- e.printStackTrace();
- }
+ public void testGetPooledConnectionFromPool() throws Exception {
+ Context ctx = cache.getJNDIContext();
+ GemFireConnPooledDataSource ds = (GemFireConnPooledDataSource) ctx
+ .lookup("java:/PooledDataSource");
+ GemFireConnectionPoolManager provider = (GemFireConnectionPoolManager) ds
+ .getConnectionProvider();
+ ConnectionPoolCacheImpl poolCache = (ConnectionPoolCacheImpl) provider
+ .getConnectionPoolCache();
+ PooledConnection poolConn = (PooledConnection) poolCache
+ .getPooledConnectionFromPool();
+ if (poolConn == null)
+ fail("getPooledConnectionFromPool failed to get a connection from pool");
}
@Test
- public void testCleanUp() {
+ public void testCleanUp() throws Exception {
cache.close();
ds1.disconnect();
}
@@ -199,48 +158,41 @@ public class AbstractPoolCacheJUnitTest {
* Tests if an XAresource obtained from an XAConnection which is already
* closed , can return null or not.
*/
+ @Ignore("TODO: test used to eat its own exception and it fails")
@Test
- public void testEffectOfBlockingTimeoutOnXAConnection()
- {
- try {
- Map map = new HashMap();
- map.put("init-pool-size", "2");
- map.put("jndi-name", "TestXAPooledDataSource");
- map.put("max-pool-size", "7");
- map.put("idle-timeout-seconds", "20");
- map.put("blocking-timeout-seconds", "2");
- map.put("login-timeout-seconds", "5");
- //map.put("xa-datasource-class","org.apache.derby.jdbc.EmbeddedXADataSource");
- map.put("jdbc-driver-class", "org.apache.derby.jdbc.EmbeddedDriver");
- map.put("user-name", "mitul");
- map.put("password", "83f0069202c571faf1ae6c42b4ad46030e4e31c17409e19a");
- map.put("connection-url", "jdbc:derby:newDB;create=true");
- List props = new ArrayList();
- props
- .add(new ConfigProperty("databaseName", "newDB", "java.lang.String"));
-
- GemFireBasicDataSource gbds = (GemFireBasicDataSource)DataSourceFactory
- .getSimpleDataSource(map, props);
- map.put("xa-datasource-class",
- "org.apache.derby.jdbc.EmbeddedXADataSource");
-
- map.put("connection-url", "jdbc:derby:newDB;create=true");
-
- GemFireTransactionDataSource gtds = (GemFireTransactionDataSource)DataSourceFactory
- .getTranxDataSource(map, props);
-
- XAConnection xaconn = (XAConnection)gtds.provider.borrowConnection();
- try { Thread.sleep(4); } catch (InterruptedException e) { fail("interrupted"); }
- for (int i = 0; i < 1000; ++i) {
- XAResource xar = xaconn.getXAResource();
- System.out.println("XAResource=" + xar);
- assertNotNull(xar);
- }
-
- }
- catch (Exception ignore) {
- // TODO Auto-generated catch block
-
+ public void testEffectOfBlockingTimeoutOnXAConnection() throws Exception {
+ Map map = new HashMap();
+ map.put("init-pool-size", "2");
+ map.put("jndi-name", "TestXAPooledDataSource");
+ map.put("max-pool-size", "7");
+ map.put("idle-timeout-seconds", "20");
+ map.put("blocking-timeout-seconds", "2");
+ map.put("login-timeout-seconds", "5");
+ //map.put("xa-datasource-class","org.apache.derby.jdbc.EmbeddedXADataSource");
+ map.put("jdbc-driver-class", "org.apache.derby.jdbc.EmbeddedDriver");
+ map.put("user-name", "mitul");
+ map.put("password", "83f0069202c571faf1ae6c42b4ad46030e4e31c17409e19a");
+ map.put("connection-url", "jdbc:derby:newDB;create=true");
+ List props = new ArrayList();
+ props
+ .add(new ConfigProperty("databaseName", "newDB", "java.lang.String"));
+
+ GemFireBasicDataSource gbds = (GemFireBasicDataSource)DataSourceFactory
+ .getSimpleDataSource(map, props);
+ map.put("xa-datasource-class",
+ "org.apache.derby.jdbc.EmbeddedXADataSource");
+
+ map.put("connection-url", "jdbc:derby:newDB;create=true");
+
+ GemFireTransactionDataSource gtds = (GemFireTransactionDataSource)DataSourceFactory
+ .getTranxDataSource(map, props);
+
+ XAConnection xaconn = (XAConnection)gtds.provider.borrowConnection();
+ try { Thread.sleep(4); } catch (InterruptedException e) { fail("interrupted"); }
+ for (int i = 0; i < 1000; ++i) {
+ XAResource xar = xaconn.getXAResource();
+ System.out.println("XAResource=" + xar);
+ assertNotNull(xar);
}
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/DataSourceFactoryJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/DataSourceFactoryJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/DataSourceFactoryJUnitTest.java
index 8b6243d..768b0c0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/DataSourceFactoryJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/datasource/DataSourceFactoryJUnitTest.java
@@ -16,26 +16,24 @@
*/
package com.gemstone.gemfire.internal.datasource;
-import com.gemstone.gemfire.cache.Cache;
-import com.gemstone.gemfire.cache.CacheFactory;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import com.gemstone.gemfire.util.test.TestUtil;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.sql.Connection;
+import java.util.Properties;
+import javax.naming.Context;
+
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import javax.naming.Context;
-import java.sql.Connection;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-import static org.junit.Assert.fail;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
+import com.gemstone.gemfire.util.test.TestUtil;
-/*
- *
- */
@Category(IntegrationTest.class)
public class DataSourceFactoryJUnitTest {
@@ -60,52 +58,34 @@ public class DataSourceFactoryJUnitTest {
@Test
public void testGetSimpleDataSource() throws Exception {
- try {
- Context ctx = cache.getJNDIContext();
- GemFireBasicDataSource ds = (GemFireBasicDataSource) ctx
- .lookup("java:/SimpleDataSource");
- Connection conn = ds.getConnection();
- if (conn == null)
- fail("DataSourceFactoryJUnitTest-testGetSimpleDataSource() Error in creating the GemFireBasicDataSource");
- }
- catch (Exception e) {
- fail("Exception occured in testGetSimpleDataSource due to "+e);
- e.printStackTrace();
- }
+ Context ctx = cache.getJNDIContext();
+ GemFireBasicDataSource ds = (GemFireBasicDataSource) ctx
+ .lookup("java:/SimpleDataSource");
+ Connection conn = ds.getConnection();
+ if (conn == null)
+ fail("DataSourceFactoryJUnitTest-testGetSimpleDataSource() Error in creating the GemFireBasicDataSource");
}
@Test
public void testGetPooledDataSource() throws Exception {
- try {
- Context ctx = cache.getJNDIContext();
- GemFireConnPooledDataSource ds = (GemFireConnPooledDataSource) ctx
- .lookup("java:/PooledDataSource");
- Connection conn = ds.getConnection();
- if (conn == null)
- fail("DataSourceFactoryJUnitTest-testGetPooledDataSource() Error in creating the GemFireConnPooledDataSource");
- }
- catch (Exception e) {
- fail("Exception occured in testGetPooledDataSource due to "+e);
- e.printStackTrace();
- }
+ Context ctx = cache.getJNDIContext();
+ GemFireConnPooledDataSource ds = (GemFireConnPooledDataSource) ctx
+ .lookup("java:/PooledDataSource");
+ Connection conn = ds.getConnection();
+ if (conn == null)
+ fail("DataSourceFactoryJUnitTest-testGetPooledDataSource() Error in creating the GemFireConnPooledDataSource");
}
@Test
public void testGetTranxDataSource() throws Exception {
- try {
- Context ctx = cache.getJNDIContext();
- GemFireTransactionDataSource ds = (GemFireTransactionDataSource) ctx
- .lookup("java:/XAPooledDataSource");
- //DataSourceFactory dsf = new DataSourceFactory();
- //GemFireTransactionDataSource ds =
- // (GemFireTransactionDataSource)dsf.getTranxDataSource(map);
- Connection conn = ds.getConnection();
- if (conn == null)
- fail("DataSourceFactoryJUnitTest-testGetTranxDataSource() Error in creating the getTranxDataSource");
- }
- catch (Exception e) {
- fail("Exception occured in testGetTranxDataSource due to "+e);
- e.printStackTrace();
- }
+ Context ctx = cache.getJNDIContext();
+ GemFireTransactionDataSource ds = (GemFireTransactionDataSource) ctx
+ .lookup("java:/XAPooledDataSource");
+ //DataSourceFactory dsf = new DataSourceFactory();
+ //GemFireTransactionDataSource ds =
+ // (GemFireTransactionDataSource)dsf.getTranxDataSource(map);
+ Connection conn = ds.getConnection();
+ if (conn == null)
+ fail("DataSourceFactoryJUnitTest-testGetTranxDataSource() Error in creating the getTranxDataSource");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/ExceptionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/ExceptionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/ExceptionJUnitTest.java
index c056a5d..216e4b0 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/ExceptionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/jta/ExceptionJUnitTest.java
@@ -16,20 +16,27 @@
*/
package com.gemstone.gemfire.internal.jta;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
-import org.junit.*;
-import org.junit.experimental.categories.Category;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
-import javax.transaction.*;
import java.util.Properties;
+import javax.transaction.NotSupportedException;
+import javax.transaction.Status;
+import javax.transaction.SystemException;
+import javax.transaction.Transaction;
+import javax.transaction.UserTransaction;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static org.junit.Assert.fail;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
/**
* Check if the correct expectations are being thrown when they are supposed to.
- *
*/
@Category(IntegrationTest.class)
public class ExceptionJUnitTest {
@@ -59,10 +66,6 @@ public class ExceptionJUnitTest {
utx = new UserTransactionImpl();
}
- @After
- public void tearDown() {
- }
-
@Test
public void testNestedTransactionNotSupported() throws Exception {
try {