You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/06/09 20:14:55 UTC
[27/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/PartitionedRegionSingleHopWithServerGroupDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java
index bd121fb..e47a1a8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSingleHopWithServerGroupDUnitTest.java
@@ -19,13 +19,31 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.internal.ClientMetadataService;
import com.gemstone.gemfire.cache.client.internal.ClientPartitionAdvisor;
import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.Locator;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
@@ -34,23 +52,22 @@ import com.gemstone.gemfire.internal.cache.execute.data.CustId;
import com.gemstone.gemfire.internal.cache.execute.data.OrderId;
import com.gemstone.gemfire.internal.cache.execute.data.ShipmentId;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
-
-/**
- *
- */
-public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTestCase{
-
- private static final long serialVersionUID = 1L;
+import com.gemstone.gemfire.test.dunit.Assert;
+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.Invoke;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.SerializableRunnable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends JUnit4CacheTestCase {
protected static final String PR_NAME = "single_hop_pr";
protected static final String PR_NAME2 = "single_hop_pr_2";
@@ -62,41 +79,25 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
private static final String CUSTOMER2 = "CUSTOMER2";
private static final String ORDER2 = "ORDER2";
private static final String SHIPMENT2 = "SHIPMENT2";
-
- protected VM member0 = null;
- protected VM member1 = null;
+ protected static final int locatorPort = 12345;
+ protected VM member0 = null;
+ protected VM member1 = null;
protected VM member2 = null;
-
protected VM member3 = null;
protected static Region region = null;
-
protected static Region customerRegion = null;
-
protected static Region orderRegion = null;
-
protected static Region shipmentRegion = null;
-
protected static Region region2 = null;
-
protected static Region customerRegion2 = null;
-
protected static Region orderRegion2 = null;
-
protected static Region shipmentRegion2 = null;
-
protected static Cache cache = null;
-
- protected static final int locatorPort = 12345;
-
protected static Locator locator = null;
- public PartitionedRegionSingleHopWithServerGroupDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -157,6 +158,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWith2ServerGroup() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -187,6 +189,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWith2ServerGroup2() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -217,6 +220,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWith2ServerGroup2WithoutSystemProperty() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -242,6 +246,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWithServerGroupAccessor() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -271,6 +276,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWithServerGroupOneServerInTwoGroups() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -301,10 +307,9 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
} finally {
member3.invoke(() -> PartitionedRegionSingleHopWithServerGroupDUnitTest.stopLocator());
}
-
-
}
+ @Test
public void test_SingleHopWithServerGroupWithOneDefaultServer() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -334,6 +339,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWithServerGroupClientServerGroupNull() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -362,6 +368,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWithServerGroupTwoClientServerGroup() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -399,6 +406,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWithServerGroupTwoClientServerGroup2() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -433,6 +441,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWithServerGroupTwoClientOneWithOneWithoutServerGroup() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -464,6 +473,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWithServerGroup2ClientInOneVMServerGroup() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -498,6 +508,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
+ @Test
public void test_SingleHopWithServerGroupColocatedRegionsInDifferentGroup() {
int port3 = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
final String host0 = NetworkUtils.getServerHostName(member3.getHost());
@@ -526,7 +537,6 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
}
-
public static void verifyMetadata(final int numRegions, final int numBucketLocations) {
ClientMetadataService cms = ((GemFireCacheImpl)cache).getClientMetadataService();
final Map<String, ClientPartitionAdvisor> regionMetaData = cms
@@ -713,8 +723,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
}
public static int createServer(int redundantCopies, int totalNoofBuckets, String group) {
- CacheTestCase test = new PartitionedRegionSingleHopWithServerGroupDUnitTest(
- "PartitionedRegionSingleHopWithServerGroupDUnitTest");
+ PartitionedRegionSingleHopWithServerGroupDUnitTest test = new PartitionedRegionSingleHopWithServerGroupDUnitTest();
cache = test.getCache();
CacheServer server = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
@@ -789,8 +798,8 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
props.setProperty(LOCATORS, locator);
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.honourServerGroupsInPRSingleHop", "true");
- CacheTestCase test = new PartitionedRegionSingleHopWithServerGroupDUnitTest(
- "PartitionedRegionSingleHopWithServerGroupDUnitTest");
+ PartitionedRegionSingleHopWithServerGroupDUnitTest test = new PartitionedRegionSingleHopWithServerGroupDUnitTest();
+
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
@@ -875,8 +884,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
props.setProperty(LOCATORS, locator);
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.honourServerGroupsInPRSingleHop", "true");
- CacheTestCase test = new PartitionedRegionSingleHopWithServerGroupDUnitTest(
- "PartitionedRegionSingleHopWithServerGroupDUnitTest");
+ PartitionedRegionSingleHopWithServerGroupDUnitTest test = new PartitionedRegionSingleHopWithServerGroupDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
@@ -950,9 +958,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
LogWriterUtils.getLogWriter().info(
"Partitioned Region SHIPMENT created Successfully :"
+ shipmentRegion.toString());
-
-
-
+
paf = new PartitionAttributesFactory();
paf.setRedundantCopies(redundantCopies).setLocalMaxMemory(localMaxMemory)
.setTotalNumBuckets(totalNoofBuckets);
@@ -964,7 +970,6 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
"Partitioned Region " + PR_NAME2 + " created Successfully :"
+ region2.toString());
-
paf = new PartitionAttributesFactory();
paf.setRedundantCopies(redundantCopies).setLocalMaxMemory(localMaxMemory)
.setTotalNumBuckets(totalNoofBuckets).setPartitionResolver(
@@ -1008,12 +1013,10 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
public static void createClientWithLocator(String host, int port0, String group) {
Properties props = new Properties();
- props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
props.setProperty(LOG_FILE, "");
- CacheTestCase test = new PartitionedRegionSingleHopWithServerGroupDUnitTest(
- "PartitionedRegionSingleHopWithServerGroupDUnitTest");
+ PartitionedRegionSingleHopWithServerGroupDUnitTest test = new PartitionedRegionSingleHopWithServerGroupDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1034,11 +1037,9 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
public static void create2ClientWithLocator(String host, int port0, String group1, String group2) {
Properties props = new Properties();
- props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PartitionedRegionSingleHopWithServerGroupDUnitTest(
- "PartitionedRegionSingleHopWithServerGroupDUnitTest");
+ PartitionedRegionSingleHopWithServerGroupDUnitTest test = new PartitionedRegionSingleHopWithServerGroupDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1063,11 +1064,9 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
public static void createClientWith3PoolLocator(String host, int port0, String group1, String group2,String group3) {
Properties props = new Properties();
- props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PartitionedRegionSingleHopWithServerGroupDUnitTest(
- "PartitionedRegionSingleHopWithServerGroupDUnitTest");
+ PartitionedRegionSingleHopWithServerGroupDUnitTest test = new PartitionedRegionSingleHopWithServerGroupDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1086,8 +1085,6 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
250).setSubscriptionEnabled(true).setSubscriptionRedundancy(-1)
.setReadTimeout(2000).setSocketBufferSize(1000).setMinConnections(6)
.setMaxConnections(10).setRetryAttempts(3).create(PR_NAME3);
-
-
}
finally {
CacheServerTestUtil.enableShufflingOfEndpoints();
@@ -1248,13 +1245,10 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
LogWriterUtils.getLogWriter().info(
"Distributed Region SHIPMENT created Successfully :"
+ shipmentRegion.toString());
-
}
-
public static int createAccessorServer(int redundantCopies, int numBuckets, String group) {
- CacheTestCase test = new PartitionedRegionSingleHopWithServerGroupDUnitTest(
- "PartitionedRegionSingleHopWithServerGroupDUnitTest");
+ PartitionedRegionSingleHopWithServerGroupDUnitTest test = new PartitionedRegionSingleHopWithServerGroupDUnitTest();
cache = test.getCache();
CacheServer server = cache.addCacheServer();
int port = AvailablePort.getRandomAvailablePort(AvailablePort.SOCKET);
@@ -1322,11 +1316,9 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
public static void createClientWithLocatorWithoutSystemProperty(String host, int port0, String group) {
Properties props = new Properties();
- props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new PartitionedRegionSingleHopWithServerGroupDUnitTest(
- "PartitionedRegionSingleHopWithServerGroupDUnitTest");
+ PartitionedRegionSingleHopWithServerGroupDUnitTest test = new PartitionedRegionSingleHopWithServerGroupDUnitTest();
DistributedSystem ds = test.getSystem(props);
cache = CacheFactory.create(ds);
assertNotNull(cache);
@@ -1345,7 +1337,6 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
createRegionsInClientCache(p.getName());
}
-
public static void putIntoPartitionedRegions() {
for (int i = 0; i <= 800; i++) {
CustId custid = new CustId(i);
@@ -1394,56 +1385,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
region.put(new Integer(7), "update33");
}
-// public static void putIntoPartitionedRegions2() {
-// for (int i = 801; i <= 1600; i++) {
-// CustId custid = new CustId(i);
-// Customer customer = new Customer("name" + i, "Address" + i);
-// customerRegion.put(custid, customer);
-// }
-// for (int j = 801; j <= 1600; j++) {
-// CustId custid = new CustId(j);
-// OrderId orderId = new OrderId(j, custid);
-// Order order = new Order("OREDR" + j);
-// orderRegion.put(orderId, order);
-// }
-// for (int k = 801; k <= 1600; k++) {
-// CustId custid = new CustId(k);
-// OrderId orderId = new OrderId(k, custid);
-// ShipmentId shipmentId = new ShipmentId(k, orderId);
-// Shipment shipment = new Shipment("Shipment" + k);
-// shipmentRegion.put(shipmentId, shipment);
-// }
-//
-// region.put(new Integer(8), "create0");
-// region.put(new Integer(9), "create1");
-// region.put(new Integer(10), "create2");
-// region.put(new Integer(11), "create3");
-// region.put(new Integer(12), "create0");
-// region.put(new Integer(13), "create1");
-// region.put(new Integer(14), "create2");
-// region.put(new Integer(15), "create3");
-//
-// region.put(new Integer(8), "update0");
-// region.put(new Integer(9), "update1");
-// region.put(new Integer(10), "update2");
-// region.put(new Integer(11), "update3");
-// region.put(new Integer(12), "update0");
-// region.put(new Integer(13), "update1");
-// region.put(new Integer(14), "update2");
-// region.put(new Integer(15), "update3");
-//
-// region.put(new Integer(8), "update00");
-// region.put(new Integer(9), "update11");
-// region.put(new Integer(10), "update22");
-// region.put(new Integer(11), "update33");
-// region.put(new Integer(12), "update00");
-// region.put(new Integer(13), "update11");
-// region.put(new Integer(14), "update22");
-// region.put(new Integer(15), "update33");
-// }
-
public static void putIntoPartitionedRegions2Client() {
-
for (int i = 0; i <= 800; i++) {
CustId custid = new CustId(i);
Customer customer = new Customer("name" + i, "Address" + i);
@@ -1519,7 +1461,6 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
region2.put(new Integer(5), "update11");
region2.put(new Integer(6), "update22");
region2.put(new Integer(7), "update33");
-
}
public static void getFromPartitionedRegions() {
@@ -1549,34 +1490,6 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
region.get(new Integer(7));
}
-
-// public static void getFromPartitionedRegions2() {
-// for (int i = 801; i <= 1600; i++) {
-// CustId custid = new CustId(i);
-// customerRegion.get(custid);
-// }
-// for (int j = 801; j <= 1600; j++) {
-// CustId custid = new CustId(j);
-// OrderId orderId = new OrderId(j, custid);
-// orderRegion.get(orderId);
-// }
-// for (int k = 801; k <= 1600; k++) {
-// CustId custid = new CustId(k);
-// OrderId orderId = new OrderId(k, custid);
-// ShipmentId shipmentId = new ShipmentId(k, orderId);
-// shipmentRegion.get(shipmentId);
-// }
-// region.get(new Integer(8));
-// region.get(new Integer(9));
-// region.get(new Integer(10));
-// region.get(new Integer(11));
-// region.get(new Integer(12));
-// region.get(new Integer(13));
-// region.get(new Integer(14));
-// region.get(new Integer(15));
-//
-// }
-
public static void getFromPartitionedRegions2Client() {
for (int i = 0; i <= 800; i++) {
@@ -1615,10 +1528,9 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
region2.get(new Integer(5));
region2.get(new Integer(6));
region.get(new Integer(7));
-
}
- public static void startLocatorInVM(final int locatorPort) {
+ public static void startLocatorInVM(final int locatorPort) {
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(ENABLE_CLUSTER_CONFIGURATION, "false");
@@ -1628,8 +1540,7 @@ public class PartitionedRegionSingleHopWithServerGroupDUnitTest extends CacheTes
locator = Locator.startLocatorAndDS(locatorPort, null, null, props);
}
catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ throw new AssertionError(e);
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSizeDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSizeDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSizeDUnitTest.java
index c4e4780..cb56a21 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSizeDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionSizeDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.io.File;
import com.gemstone.gemfire.cache.AttributesFactory;
@@ -48,12 +57,13 @@ import com.gemstone.gemfire.test.dunit.VM;
*
*
*/
+@Category(DistributedTest.class)
public class PartitionedRegionSizeDUnitTest extends
PartitionedRegionDUnitTestCase
{
- public PartitionedRegionSizeDUnitTest(String name) {
- super(name);
+ public PartitionedRegionSizeDUnitTest() {
+ super();
}
public static final String PR_PREFIX = "PR";
@@ -380,12 +390,14 @@ public class PartitionedRegionSizeDUnitTest extends
*
* @throws Exception
*/
+ @Test
public void testSize() throws Throwable
{
sizeOpsForDistAckSync();
sizeOpsForDistAckASync();
}
+ @Test
public void testBug39868() throws Exception {
Host host = Host.getHost(0);
@@ -438,6 +450,7 @@ public class PartitionedRegionSizeDUnitTest extends
});
}
+ @Test
public void testByteSize() throws Exception {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -465,6 +478,7 @@ public class PartitionedRegionSizeDUnitTest extends
};
}
+ @Test
public void testByteSizeWithEviction() throws Exception {
Host host = Host.getHost(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsDUnitTest.java
index 79a52a9..ceff1a8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionStatsDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.concurrent.CancellationException;
import com.gemstone.gemfire.Statistics;
@@ -40,13 +49,14 @@ import com.gemstone.gemfire.test.dunit.WaitCriterion;
/**
*
*/
+@Category(DistributedTest.class)
public class PartitionedRegionStatsDUnitTest extends
PartitionedRegionDUnitTestCase
{
//////constructor //////////
- public PartitionedRegionStatsDUnitTest(String name) {
- super(name);
+ public PartitionedRegionStatsDUnitTest() {
+ super();
}//end of constructor
public static final String PR_PREFIX = "PR";
@@ -72,6 +82,7 @@ public class PartitionedRegionStatsDUnitTest extends
final int totalNumBuckets = 5;
static final int REDUNDANT_COPIES = 1;
//////////test methods ////////////////
+ @Test
public void testClose() throws Exception
{
@@ -335,6 +346,7 @@ public class PartitionedRegionStatsDUnitTest extends
*/
}
+ @Test
public void testDataStoreEntryCountWithRebalance() throws InterruptedException {
//Ok, first problem, GC'd tombstone is counted as an entry
//To test
@@ -386,6 +398,7 @@ public class PartitionedRegionStatsDUnitTest extends
validateEntryCount(vm1, 1);
}
+ @Test
public void testDataStoreEntryCount2WithRebalance() throws InterruptedException {
final Host host = Host.getHost(0);
@@ -438,6 +451,7 @@ public class PartitionedRegionStatsDUnitTest extends
* accurate.
* @throws InterruptedException
*/
+ @Test
public void testDataStoreEntryCount() throws InterruptedException {
//Ok, first problem, GC'd tombstone is counted as an entry
//To test
@@ -554,6 +568,7 @@ public class PartitionedRegionStatsDUnitTest extends
}
+ @Test
public void testTotalNumBuckets() {
final Host host = Host.getHost(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java
index d1083ad..1bd35f9 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionTestUtilsDUnitTest.java
@@ -17,6 +17,8 @@
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
@@ -26,6 +28,9 @@ import java.util.List;
import java.util.Random;
import java.util.Set;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.DataSerializable;
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
@@ -38,25 +43,23 @@ import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Confirm that the utils used for testing work as advertised
- * @since GemFire 5.0
*
+ * @since GemFire 5.0
*/
-public class PartitionedRegionTestUtilsDUnitTest extends
- PartitionedRegionDUnitTestCase
-{
+@Category(DistributedTest.class)
+public class PartitionedRegionTestUtilsDUnitTest extends PartitionedRegionDUnitTestCase {
+
final int totalNumBuckets = 5;
- public PartitionedRegionTestUtilsDUnitTest(String name) {
- super(name);
- }
/**
* Test the {@link PartitionedRegion#getSomeKeys(java.util.Random)} method, making sure it
* returns keys when there are keys and {@link java.util.Collections#EMPTY_SET} when there are none.
- * @throws Exception
*/
+ @Test
public void testGetKeys() throws Exception {
final String r = getUniqueName();
Host host = Host.getHost(0);
@@ -140,7 +143,6 @@ public class PartitionedRegionTestUtilsDUnitTest extends
* Verify that it returns nodes after a value has been placed into the PartitionedRegion.
* @see PartitionedRegion#getAllNodes()
*/
-
public static class TestGetNodesKey implements DataSerializable {
int hc;
public TestGetNodesKey(int hc) { this.hc = hc; }
@@ -149,6 +151,8 @@ public class PartitionedRegionTestUtilsDUnitTest extends
public void toData(DataOutput out) throws IOException {out.writeInt(this.hc); }
public void fromData(DataInput in) throws IOException, ClassNotFoundException { this.hc = in.readInt(); }
}
+
+ @Test
public void testGetNodes() throws Exception {
final String r = getUniqueName();
Host host = Host.getHost(0);
@@ -188,7 +192,6 @@ public class PartitionedRegionTestUtilsDUnitTest extends
}
};
-
validator.invoke(createAndTest);
validator.invoke(new CacheSerializableRunnable("AssertGetNodesCreation1") {
public void run2() throws CacheException
@@ -229,14 +232,13 @@ public class PartitionedRegionTestUtilsDUnitTest extends
}
/**
- * Test the test utiltities that allow investigation of a PartitionedRegion's local cache.
- * @throws Exception
+ * Test the test utilities that allow investigation of a PartitionedRegion's local cache.
*/
+ @Test
public void testLocalCacheOps() throws Exception {
final String r = getUniqueName();
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
-// VM vm1 = host.getVM(1);
VM vm2 = host.getVM(2);
vm0.invoke(new CacheSerializableRunnable("CreatePR") {
@@ -343,9 +345,8 @@ public class PartitionedRegionTestUtilsDUnitTest extends
* Test the test method PartitionedRegion.getAllNodes
* Verify that it returns nodes after a value has been placed into the PartitionedRegion.
* @see PartitionedRegion#getAllNodes()
- *
- * @throws Exception
*/
+ @Test
public void testGetBucketKeys() throws Exception {
final String r = getUniqueName();
Host host = Host.getHost(0);
@@ -438,8 +439,8 @@ public class PartitionedRegionTestUtilsDUnitTest extends
/**
* Test the test method {@link PartitionedRegion#getBucketOwnersForValidation(int)}
* Verify that the information it discovers is the same as the local advisor.
- * @throws Exception
*/
+ @Test
public void testGetBucketOwners() throws Exception {
final String rName0 = getUniqueName() + "-r0";
final String rName1 = getUniqueName() + "-r1";
@@ -568,6 +569,5 @@ public class PartitionedRegionTestUtilsDUnitTest extends
datastore1.invoke(oneBucketOwner);
datastore2.invoke(oneBucketOwner);
datastore3.invoke(oneBucketOwner);
-
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionWithSameNameDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionWithSameNameDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionWithSameNameDUnitTest.java
index 20048c5..bba30ef 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionWithSameNameDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PartitionedRegionWithSameNameDUnitTest.java
@@ -22,6 +22,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@@ -47,6 +56,7 @@ import com.gemstone.gemfire.test.dunit.VM;
* This test is to verify creation of partition region and
* distributed region with same name.
*/
+@Category(DistributedTest.class)
public class PartitionedRegionWithSameNameDUnitTest extends
PartitionedRegionDUnitTestCase
{
@@ -73,8 +83,8 @@ public class PartitionedRegionWithSameNameDUnitTest extends
static protected final int PARTITIONED_REGION = 1;
- public PartitionedRegionWithSameNameDUnitTest(String name) {
- super(name);
+ public PartitionedRegionWithSameNameDUnitTest() {
+ super();
}
/**
@@ -85,6 +95,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* on vm0 </br> In this test RegionExistException is expected while creating
* region with the same as partition region.
*/
+ @Test
public void testNameWithPartitionRegionFirstOnSameVM()
{
Host host = Host.getHost(0);
@@ -131,6 +142,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* In this test RegionExistException is expected while creating Partition
* region with the same as region.
*/
+ @Test
public void testNameWithDistributedRegionFirstOnSameVM()
{
Host host = Host.getHost(0);
@@ -174,6 +186,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* region.
*/
+ @Test
public void testNameWithPartitionRegionFirstOnDifferentVM()
{
Host host = Host.getHost(0);
@@ -222,6 +235,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* InternalGemFireException is expected while creating region.
*/
+ @Test
public void testNameWithDistributedRegionFirstOnDifferentVM()
{
Host host = Host.getHost(0);
@@ -263,6 +277,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* 2. creates partition region with the same name as distributed region on
* vm1,vm2,vm3</br> NoException is expected.
*/
+ @Test
public void testLocalRegionFirst()
{
Host host = Host.getHost(0);
@@ -305,6 +320,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* 2. creates distributed region scope = LOCAL with the same name as
* partitioned region on vm1,vm2,vm3</br> NoException is expected.
*/
+ @Test
public void testLocalRegionSecond()
{
Host host = Host.getHost(0);
@@ -346,6 +362,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* 2. Creates distributed subregion of parent region </br>
* OperationNotSupportedException is expected.
*/
+ @Test
public void testWithPartitionedRegionAsParentRegionAndDistributedSubRegion()
{
Host host = Host.getHost(0);
@@ -384,6 +401,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* OperationNotSupportedException is expected
*/
+ @Test
public void testWithPartitionedRegionAsParentRegionAndPartitionedSubRegion()
{
Host host = Host.getHost(0);
@@ -422,6 +440,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* 3.Creates a distributed region as subregion of parent on vm1,vm2,vm3 </br>
* In this case InternalGemFireException is expected.
*/
+ @Test
public void testWithSubRegionPartitionedRegionFirst()
{
Host host = Host.getHost(0);
@@ -471,6 +490,7 @@ public class PartitionedRegionWithSameNameDUnitTest extends
* 3.Creates a partitioned region as subregion of parent on vm1,vm2,vm3 </br>
* In this case IllegalStateException is expected.
*/
+ @Test
public void testWithSubRegionDistributedRegionFirst()
{
Host host = Host.getHost(0);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllDAckDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllDAckDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllDAckDUnitTest.java
index b51c789..6f3ba94 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllDAckDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllDAckDUnitTest.java
@@ -21,10 +21,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -39,20 +44,15 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-/**
- *
- */
-public class PutAllDAckDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class PutAllDAckDUnitTest extends JUnit4DistributedTestCase { // TODO: reformat
- /** Creates a new instance of PutAllDAckDunitTest */
- public PutAllDAckDUnitTest(String name) {
- super(name);
- }
static Cache cache;
static Properties props = new Properties();
static Properties propsWork = new Properties();
@@ -84,7 +84,7 @@ public class PutAllDAckDUnitTest extends DistributedTestCase {
}
public static void createCacheForVM0() throws Exception {
- ds = (new PutAllDAckDUnitTest("temp")).getSystem(props);
+ ds = (new PutAllDAckDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -94,7 +94,7 @@ public class PutAllDAckDUnitTest extends DistributedTestCase {
public static void createCacheForVM1() throws Exception {
CacheWriter aWriter = new BeforeCreateCallback();
- ds = (new PutAllDAckDUnitTest("temp")).getSystem(props);
+ ds = (new PutAllDAckDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -111,7 +111,8 @@ public class PutAllDAckDUnitTest extends DistributedTestCase {
//test methods
- public void testputAllRemoteVM(){
+ @Test
+ public void testputAllRemoteVM(){
// Test PASS.
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/PutAllGlobalDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllGlobalDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllGlobalDUnitTest.java
index cd96294..2ca78bf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllGlobalDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/PutAllGlobalDUnitTest.java
@@ -21,6 +21,8 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
@@ -29,6 +31,9 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -46,18 +51,17 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.distributed.internal.locks.DLockGrantor;
import com.gemstone.gemfire.test.dunit.Assert;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.Invoke;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-/**
- *
- */
-public class PutAllGlobalDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class PutAllGlobalDUnitTest extends JUnit4DistributedTestCase { // TODO: reformat
/**
* timeout period for the put() operation, when it is run
* concurrent with a conflicting putAll() operation
@@ -66,10 +70,6 @@ public class PutAllGlobalDUnitTest extends DistributedTestCase {
private static ServerSocket serverSocket;
- /** Creates a new instance of PutAllGlobalDUnitTest */
- public PutAllGlobalDUnitTest(String name) {
- super(name);
- }
static Cache cache;
static Properties props = new Properties();
static Properties propsWork = new Properties();
@@ -103,7 +103,7 @@ public class PutAllGlobalDUnitTest extends DistributedTestCase {
public static void createCacheForVM0(){
try{
- ds = (new PutAllGlobalDUnitTest("temp")).getSystem(props);
+ ds = (new PutAllGlobalDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.GLOBAL);
@@ -117,7 +117,7 @@ public class PutAllGlobalDUnitTest extends DistributedTestCase {
public static void createCacheForVM1(){
try{
CacheWriter aWriter = new BeforeCreateCallback();
- ds = (new PutAllGlobalDUnitTest("temp")).getSystem(props);
+ ds = (new PutAllGlobalDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
cache.setLockTimeout(TIMEOUT_PERIOD/1000);
AttributesFactory factory = new AttributesFactory();
@@ -148,8 +148,9 @@ public class PutAllGlobalDUnitTest extends DistributedTestCase {
//test methods
- public void testputAllGlobalRemoteVM() throws Throwable {
- // Test Fails: AssertionFailedError: Should have thrown TimeoutException
+ @Test
+ public void testputAllGlobalRemoteVM() throws Throwable {
+ // Test Fails: AssertionError: Should have thrown TimeoutException
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RegionEntryFlagsJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RegionEntryFlagsJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RegionEntryFlagsJUnitTest.java
index c2795cf..72caae4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RegionEntryFlagsJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RegionEntryFlagsJUnitTest.java
@@ -19,6 +19,8 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.util.Set;
import org.junit.After;
@@ -26,10 +28,6 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
-import junit.framework.TestCase;
-
import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.Region.Entry;
import com.gemstone.gemfire.cache.Scope;
@@ -41,13 +39,10 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* This test verifies the flag's on-off switching for
* boolean flags in AbstractRegionEntry.
* Currently a byte array is used to maintain two flags.
- *
- *
*/
@Category(IntegrationTest.class)
public class RegionEntryFlagsJUnitTest {
-
@Before
public void setUp() throws Exception {
CacheUtils.startCache();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionCCEDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionCCEDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionCCEDUnitTest.java
index 3f5830e..d067ed1 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionCCEDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionCCEDUnitTest.java
@@ -16,17 +16,20 @@
*/
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;
+
+@Category(DistributedTest.class)
public class RemoteTransactionCCEDUnitTest extends RemoteTransactionDUnitTest {
private static final long serialVersionUID = 5960292521068781262L;
- public RemoteTransactionCCEDUnitTest(String name) {
- super(name);
- }
-
@Override
protected boolean getConcurrencyChecksEnabled() {
return true;
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java
index 0b82c98..69b16a6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoteTransactionDUnitTest.java
@@ -17,22 +17,78 @@
package com.gemstone.gemfire.internal.cache;
import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Arrays;
+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.Set;
+import java.util.concurrent.CountDownLatch;
+import javax.naming.Context;
+import javax.naming.NamingException;
+import javax.transaction.RollbackException;
+import javax.transaction.Status;
+import javax.transaction.UserTransaction;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
import com.gemstone.gemfire.TXExpiryJUnitTest;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.AttributesMutator;
+import com.gemstone.gemfire.cache.CacheEvent;
+import com.gemstone.gemfire.cache.CacheListener;
+import com.gemstone.gemfire.cache.CacheLoader;
+import com.gemstone.gemfire.cache.CacheLoaderException;
+import com.gemstone.gemfire.cache.CacheTransactionManager;
+import com.gemstone.gemfire.cache.CacheWriter;
+import com.gemstone.gemfire.cache.CacheWriterException;
+import com.gemstone.gemfire.cache.CommitConflictException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.EntryNotFoundException;
+import com.gemstone.gemfire.cache.ExpirationAction;
+import com.gemstone.gemfire.cache.ExpirationAttributes;
+import com.gemstone.gemfire.cache.InterestPolicy;
+import com.gemstone.gemfire.cache.InterestResultPolicy;
+import com.gemstone.gemfire.cache.LoaderHelper;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
import com.gemstone.gemfire.cache.Region.Entry;
+import com.gemstone.gemfire.cache.RegionEvent;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
+import com.gemstone.gemfire.cache.Scope;
+import com.gemstone.gemfire.cache.SubscriptionAttributes;
+import com.gemstone.gemfire.cache.TransactionDataNotColocatedException;
+import com.gemstone.gemfire.cache.TransactionDataRebalancedException;
+import com.gemstone.gemfire.cache.TransactionEvent;
+import com.gemstone.gemfire.cache.TransactionException;
+import com.gemstone.gemfire.cache.TransactionId;
+import com.gemstone.gemfire.cache.TransactionListener;
+import com.gemstone.gemfire.cache.TransactionWriter;
+import com.gemstone.gemfire.cache.TransactionWriterException;
+import com.gemstone.gemfire.cache.UnsupportedOperationInTransactionException;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
-import com.gemstone.gemfire.cache.execute.*;
+import com.gemstone.gemfire.cache.execute.Function;
+import com.gemstone.gemfire.cache.execute.FunctionAdapter;
+import com.gemstone.gemfire.cache.execute.FunctionContext;
+import com.gemstone.gemfire.cache.execute.FunctionService;
+import com.gemstone.gemfire.cache.execute.RegionFunctionContext;
import com.gemstone.gemfire.cache.partition.PartitionRegionHelper;
import com.gemstone.gemfire.cache.query.CqEvent;
import com.gemstone.gemfire.cache.query.CqListener;
import com.gemstone.gemfire.cache.server.CacheServer;
import com.gemstone.gemfire.cache.util.CacheListenerAdapter;
import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedMember;
import com.gemstone.gemfire.distributed.internal.membership.InternalDistributedMember;
import com.gemstone.gemfire.internal.AvailablePort;
@@ -43,23 +99,23 @@ import com.gemstone.gemfire.internal.cache.execute.data.Customer;
import com.gemstone.gemfire.internal.cache.execute.data.Order;
import com.gemstone.gemfire.internal.cache.execute.data.OrderId;
import com.gemstone.gemfire.internal.cache.versions.VersionTag;
-import com.gemstone.gemfire.test.dunit.*;
-
-import javax.naming.Context;
-import javax.naming.NamingException;
-import javax.transaction.RollbackException;
-import javax.transaction.Status;
-import javax.transaction.UserTransaction;
-import java.util.*;
-import java.util.concurrent.CountDownLatch;
-
-/**
- *
- */
-public class RemoteTransactionDUnitTest extends CacheTestCase {
- final protected String CUSTOMER = "custRegion";
- final protected String ORDER = "orderRegion";
- final protected String D_REFERENCE = "distrReference";
+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.SerializableCallable;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
+@Category(DistributedTest.class)
+public class RemoteTransactionDUnitTest extends JUnit4CacheTestCase {
+
+ protected final String CUSTOMER = "custRegion";
+ protected final String ORDER = "orderRegion";
+ protected final String D_REFERENCE = "distrReference";
private final SerializableCallable getNumberOfTXInProgress = new SerializableCallable() {
public Object call() throws Exception {
@@ -86,12 +142,6 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
return null;
}
};
- /**
- * @param name
- */
- public RemoteTransactionDUnitTest(String name) {
- super(name);
- }
protected enum OP {
PUT, GET, DESTROY, INVALIDATE, KEYS, VALUES, ENTRIES, PUTALL, GETALL, REMOVEALL
@@ -468,10 +518,12 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
+ @Test
public void testTXCreationAndCleanupAtCommit() throws Exception {
doBasicChecks(true);
}
+ @Test
public void testTXCreationAndCleanupAtRollback() throws Exception {
doBasicChecks(false);
}
@@ -531,6 +583,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
}
}
+ @Test
public void testPRTXGet() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -571,6 +624,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testPRTXGetOnRemoteWithLoader() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -617,6 +671,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
/**
* Make sure that getEntry returns null properly and values when it should
*/
+ @Test
public void testPRTXGetEntryOnRemoteSide() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -669,6 +724,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
+ @Test
public void testPRTXGetOnLocalWithLoader() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -710,6 +766,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
+ @Test
public void testTXPut() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -753,6 +810,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testTXInvalidate() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -794,6 +852,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
}
+ @Test
public void testTXDestroy() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -834,6 +893,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testTxPutIfAbsent() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -930,6 +990,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
return accessor;
}
+ @Test
public void testTxRemove() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -1003,6 +1064,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testTxRemoveAll() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -1096,6 +1158,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testTxRemoveAllNotColocated() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -1141,6 +1204,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testTxRemoveAllWithRedundancy() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -1188,6 +1252,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
datastore2.invoke(checkArtifacts);
}
+ @Test
public void testTxReplace() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -1267,6 +1332,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
* When we have narrowed down on a target node for a transaction, test that
* we throw an exception if that node does not host primary for subsequent entries
*/
+ @Test
public void testNonColocatedTX() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -1318,18 +1384,22 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testListenersForPut() {
doTestListeners(OP.PUT);
}
+ @Test
public void testListenersForDestroy() {
doTestListeners(OP.DESTROY);
}
+ @Test
public void testListenersForInvalidate() {
doTestListeners(OP.INVALIDATE);
}
+ @Test
public void testListenersForRemoveAll() {
doTestListeners(OP.REMOVEALL);
}
@@ -1641,6 +1711,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
}
}
+ @Test
public void testRemoteExceptionThrown() {
Host host = Host.getHost(0);
VM acc = host.getVM(0);
@@ -1655,7 +1726,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
}
public void beforeCommit(TransactionEvent event)
throws TransactionWriterException {
- throw new TransactionWriterException("TestException");
+ throw new TransactionWriterException("AssertionError");
}
});
return null;
@@ -1671,17 +1742,19 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
getGemfireCache().getTxManager().commit();
fail("Expected exception not thrown");
} catch (Exception e) {
- assertEquals("TestException", e.getCause().getMessage());
+ assertEquals("AssertionError", e.getCause().getMessage());
}
return null;
}
});
}
+ @Test
public void testSizeForTXHostedOnRemoteNode() {
doSizeTest(false);
}
+ @Test
public void testSizeOnAccessor() {
doSizeTest(true);
}
@@ -1759,50 +1832,62 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
assertEquals(0, txOnDatastore2_2.intValue());
}
+ @Test
public void testKeysIterator() {
doTestIterator(OP.KEYS, 0, OP.PUT);
}
+ @Test
public void testValuesIterator() {
doTestIterator(OP.VALUES, 0, OP.PUT);
}
+ @Test
public void testEntriesIterator() {
doTestIterator(OP.ENTRIES, 0, OP.PUT);
}
+ @Test
public void testKeysIterator1() {
doTestIterator(OP.KEYS, 1, OP.PUT);
}
+ @Test
public void testValuesIterator1() {
doTestIterator(OP.VALUES, 1, OP.PUT);
}
+ @Test
public void testEntriesIterator1() {
doTestIterator(OP.ENTRIES, 1, OP.PUT);
}
+ @Test
public void testKeysIteratorOnDestroy() {
doTestIterator(OP.KEYS, 0, OP.DESTROY);
}
+ @Test
public void testValuesIteratorOnDestroy() {
doTestIterator(OP.VALUES, 0, OP.DESTROY);
}
+ @Test
public void testEntriesIteratorOnDestroy() {
doTestIterator(OP.ENTRIES, 0, OP.DESTROY);
}
+ @Test
public void testKeysIterator1OnDestroy() {
doTestIterator(OP.KEYS, 1, OP.DESTROY);
}
+ @Test
public void testValuesIterator1OnDestroy() {
doTestIterator(OP.VALUES, 1, OP.DESTROY);
}
+ @Test
public void testEntriesIterator1OnDestroy() {
doTestIterator(OP.ENTRIES, 1, OP.DESTROY);
}
@@ -2046,6 +2131,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testKeyIterationOnRR() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2095,6 +2181,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testValuesIterationOnRR() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2144,6 +2231,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testEntriesIterationOnRR() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2193,6 +2281,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testIllegalIteration() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2327,10 +2416,12 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
OnMember
}
+ @Test
public void testTxFunctionOnRegion() {
doTestTxFunction(Executions.OnRegion);
}
+ @Test
public void testTxFunctionOnMember() {
doTestTxFunction(Executions.OnMember);
}
@@ -2446,6 +2537,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testNestedTxFunction() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2518,6 +2610,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testDRFunctionExecution() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2607,6 +2700,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testTxFunctionWithOtherOps() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2820,10 +2914,12 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
return expectedSet;
}
+ @Test
public void testRemoteJTACommit() {
doRemoteJTA(true);
}
+ @Test
public void testRemoteJTARollback() {
doRemoteJTA(false);
}
@@ -2889,6 +2985,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
}
+ @Test
public void testOriginRemoteIsTrueForRemoteReplicatedRegions() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -2993,6 +3090,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
+ @Test
public void testRemoteCreateInReplicatedRegion() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -3031,6 +3129,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testRemoteTxCleanupOnCrash() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -3062,16 +3161,19 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testNonColocatedPutAll() {
doNonColocatedbulkOp(OP.PUTALL);
}
/**
- * disabled because rather than throwing an exception,
+ * disabled because rather than throwing an exception,
* getAll catches all exceptions and logs a warning
* message
*/
- public void _SWAP_testNonColocatedGetAll() {
+ @Ignore("TODO: disabled because rather than throwing an exception, getAll catches all exceptions and logs a warning message")
+ @Test
+ public void testNonColocatedGetAll() {
doNonColocatedbulkOp(OP.GETALL);
}
@@ -3114,10 +3216,12 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testBasicPutAll() {
doTestBasicBulkOP(OP.PUTALL);
}
+ @Test
public void testBasicRemoveAll() {
doTestBasicBulkOP(OP.REMOVEALL);
}
@@ -3259,6 +3363,7 @@ public class RemoteTransactionDUnitTest extends CacheTestCase {
});
}
+ @Test
public void testDestroyCreateConflation() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -3551,6 +3656,7 @@ protected static class ClientListener extends CacheListenerAdapter {
}
+ @Test
public void testTXWithRI() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -3599,6 +3705,7 @@ protected static class ClientListener extends CacheListenerAdapter {
private static final String EMPTY_REGION = "emptyRegionName";
+ @Test
public void testBug43176() {
Host host = Host.getHost(0);
VM datastore = host.getVM(0);
@@ -3672,6 +3779,7 @@ protected static class ClientListener extends CacheListenerAdapter {
});
}
+ @Test
public void testTXWithRICommitInDatastore() throws Exception {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -3719,6 +3827,7 @@ protected static class ClientListener extends CacheListenerAdapter {
}
+ @Test
public void testListenersNotInvokedOnSecondary() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -3769,6 +3878,7 @@ protected static class ClientListener extends CacheListenerAdapter {
}
}
+ @Test
public void testBug33073() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -3807,6 +3917,7 @@ protected static class ClientListener extends CacheListenerAdapter {
});
}
+ @Test
public void testBug43081() throws Exception {
createRegion(false, 0, null);
Context ctx = getCache().getJNDIContext();
@@ -3891,6 +4002,7 @@ protected static class ClientListener extends CacheListenerAdapter {
}
}
+ @Test
public void testBug45556() {
Host host = Host.getHost(0);
VM accessor = host.getVM(0);
@@ -3985,6 +4097,7 @@ protected static class ClientListener extends CacheListenerAdapter {
});
}
+ @Test
public void testExpirySuspend_bug45984() {
Host host = Host.getHost(0);
VM vm1 = host.getVM(0);
@@ -4061,6 +4174,7 @@ protected static class ClientListener extends CacheListenerAdapter {
}
+ @Test
public void testRemoteFetchVersionMessage() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -4097,6 +4211,7 @@ protected static class ClientListener extends CacheListenerAdapter {
});
}
+ @Test
public void testTransactionWithRemoteVersionFetch() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -4148,6 +4263,7 @@ protected static class ClientListener extends CacheListenerAdapter {
});
}
+ @Test
public void testBug49398() {
disconnectAllFromDS();
Host host = Host.getHost(0);
@@ -4202,6 +4318,7 @@ protected static class ClientListener extends CacheListenerAdapter {
* Install Listeners and verify that they are invoked after all tx events have been applied to the cache
* see GEODE-278
*/
+ @Test
public void testNonInlineRemoteEvents() {
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/RemoveAllDAckDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveAllDAckDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveAllDAckDUnitTest.java
index d672cf1..67beab4 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveAllDAckDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveAllDAckDUnitTest.java
@@ -21,9 +21,14 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.util.ArrayList;
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -37,20 +42,18 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.Assert;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Adapted from RemoveAllDAckDUnitTest
*/
-public class RemoveAllDAckDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class RemoveAllDAckDUnitTest extends JUnit4DistributedTestCase { // TODO: reformat
- /** Creates a new instance of RemoveAllDAckDunitTest */
- public RemoveAllDAckDUnitTest(String name) {
- super(name);
- }
static Cache cache;
static Properties props = new Properties();
static Properties propsWork = new Properties();
@@ -81,7 +84,7 @@ public class RemoveAllDAckDUnitTest extends DistributedTestCase {
}
public static void createCacheForVM0() throws Exception {
- ds = (new RemoveAllDAckDUnitTest("temp")).getSystem(props);
+ ds = (new RemoveAllDAckDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -91,7 +94,7 @@ public class RemoveAllDAckDUnitTest extends DistributedTestCase {
public static void createCacheForVM1() throws Exception {
CacheWriter aWriter = new BeforeDestroyCallback();
- ds = (new RemoveAllDAckDUnitTest("temp")).getSystem(props);
+ ds = (new RemoveAllDAckDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -108,7 +111,8 @@ public class RemoveAllDAckDUnitTest extends DistributedTestCase {
//test methods
- public void testRemoveAllRemoteVM() {
+ @Test
+ public void testRemoveAllRemoteVM() {
// Test PASS.
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/RemoveDAckDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveDAckDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveDAckDUnitTest.java
index 405a2fe..59405f6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveDAckDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveDAckDUnitTest.java
@@ -21,8 +21,13 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -33,20 +38,14 @@ import com.gemstone.gemfire.cache.RegionAttributes;
import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-/**
- *
- */
-public class RemoveDAckDUnitTest extends DistributedTestCase {
-
- /** Creates a new instance of RemoveDAckDUnitTest */
- public RemoveDAckDUnitTest(String name) {
- super(name);
- }
+@Category(DistributedTest.class)
+public class RemoveDAckDUnitTest extends JUnit4DistributedTestCase { // TODO: reformat
static Cache cache;
static Properties props = new Properties();
@@ -78,7 +77,7 @@ public class RemoveDAckDUnitTest extends DistributedTestCase {
public static void createCacheVM0(){
try{
- ds = (new RemoveDAckDUnitTest("temp")).getSystem(props);
+ ds = (new RemoveDAckDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -91,7 +90,7 @@ public class RemoveDAckDUnitTest extends DistributedTestCase {
} //end of create cache for VM0
public static void createCacheVM1(){
try{
- ds = (new RemoveDAckDUnitTest("temp")).getSystem(props);
+ ds = (new RemoveDAckDUnitTest()).getSystem(props);
AttributesFactory factory = new AttributesFactory();
cache = CacheFactory.create(ds);
factory.setScope(Scope.DISTRIBUTED_ACK);
@@ -113,8 +112,9 @@ public class RemoveDAckDUnitTest extends DistributedTestCase {
}
- public void testRemoveMultiVM(){
- //Commented the Test.As it is failing @ line no 133 : AssertionFailedError
+ @Test
+ public void testRemoveMultiVM(){
+ //Commented the Test.As it is failing @ line no 133 : AssertionError
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
VM vm1 = host.getVM(1);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveGlobalDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveGlobalDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveGlobalDUnitTest.java
index 9b28de1..ab51551 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveGlobalDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/RemoveGlobalDUnitTest.java
@@ -22,8 +22,13 @@
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.util.Properties;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheException;
@@ -37,22 +42,17 @@ import com.gemstone.gemfire.cache.util.CacheWriterAdapter;
import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.test.dunit.AsyncInvocation;
-import com.gemstone.gemfire.test.dunit.DistributedTestCase;
import com.gemstone.gemfire.test.dunit.Host;
import com.gemstone.gemfire.test.dunit.LogWriterUtils;
import com.gemstone.gemfire.test.dunit.SerializableRunnable;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-/**
- *
- */
-public class RemoveGlobalDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class RemoveGlobalDUnitTest extends JUnit4DistributedTestCase { // TODO: reformat
- /** Creates a new instance of RemoveGlobalDUintTest */
- public RemoveGlobalDUnitTest(String name) {
- super(name);
- }
static Cache cache;
static Properties props = new Properties();
static Properties propsWork = new Properties();
@@ -86,7 +86,7 @@ public class RemoveGlobalDUnitTest extends DistributedTestCase {
public static void createCache(){
try{
- ds = (new RemoveGlobalDUnitTest("temp")).getSystem(props);
+ ds = (new RemoveGlobalDUnitTest()).getSystem(props);
cache = CacheFactory.create(ds);
} catch (Exception ex){
ex.printStackTrace();
@@ -105,7 +105,8 @@ public class RemoveGlobalDUnitTest extends DistributedTestCase {
//test methods
- public void testRemoveGlobalSingleVM() throws Throwable{
+ @Test
+ public void testRemoveGlobalSingleVM() throws Throwable{
SerializableRunnable createRegionWithWriter = new CacheSerializableRunnable("create region with cache writer"){
@@ -157,8 +158,9 @@ public class RemoveGlobalDUnitTest extends DistributedTestCase {
}//end of testRemoveGlobalSingleVM
- public void testRemoveGlobalMultiVM() throws Throwable{
- //Commented the Test.As it is failing @ line no 145 : AssertionFailedError
+ @Test
+ public void testRemoveGlobalMultiVM() throws Throwable{
+ //Commented the Test.As it is failing @ line no 145 : AssertionError
SerializableRunnable createSimpleRegion = new CacheSerializableRunnable("create region with cache writer"){
public void run2() throws CacheException{
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java
index 6bef30b..6466b41 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SimpleDiskRegionJUnitTest.java
@@ -22,17 +22,16 @@
*/
package com.gemstone.gemfire.internal.cache;
+import static org.junit.Assert.*;
+
import java.io.File;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
-import org.junit.Before;
import org.junit.Test;
import org.junit.experimental.categories.Category;
-import static org.junit.Assert.*;
-
import com.gemstone.gemfire.StatisticsFactory;
import com.gemstone.gemfire.test.dunit.ThreadUtils;
import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
@@ -41,19 +40,16 @@ import com.gemstone.gemfire.test.junit.categories.IntegrationTest;
* Testing methods for SimpleDiskRegion.java api's
*
* @since GemFire 5.1
- *
*/
@Category(IntegrationTest.class)
-public class SimpleDiskRegionJUnitTest extends DiskRegionTestingBase
-{
+public class SimpleDiskRegionJUnitTest extends DiskRegionTestingBase {
- protected Set keyIds = Collections.synchronizedSet(new HashSet());
+ private Set keyIds = Collections.synchronizedSet(new HashSet());
private DiskRegionProperties diskProps = new DiskRegionProperties();
- @Before
- public void setUp() throws Exception {
- super.setUp();
+ @Override
+ protected final void postSetUp() throws Exception {
diskProps.setDiskDirs(dirs);
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
index ec6645f..eae57c6 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SingleHopStatsDUnitTest.java
@@ -16,32 +16,48 @@
*/
package com.gemstone.gemfire.internal.cache;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.TimeUnit;
+
+import com.jayway.awaitility.Awaitility;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheClosedException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.Pool;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.internal.ClientMetadataService;
import com.gemstone.gemfire.cache.client.internal.ClientPartitionAdvisor;
import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.cache30.CacheTestCase;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.execute.data.CustId;
import com.gemstone.gemfire.internal.cache.execute.data.OrderId;
import com.gemstone.gemfire.internal.cache.execute.data.ShipmentId;
import com.gemstone.gemfire.internal.cache.tier.sockets.CacheServerTestUtil;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.DistributedTestUtils;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import com.jayway.awaitility.Awaitility;
-import org.junit.experimental.categories.Category;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.TimeUnit;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-public class SingleHopStatsDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class SingleHopStatsDUnitTest extends JUnit4CacheTestCase {
private final String Region_Name = "42010";
private final String ORDER_REGION_NAME = "ORDER";
@@ -61,11 +77,6 @@ public class SingleHopStatsDUnitTest extends CacheTestCase {
private static long metaDataRefreshCount_Shipment;
private static long nonSingleHopsCount_Shipment;
-
- public SingleHopStatsDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -109,6 +120,7 @@ public class SingleHopStatsDUnitTest extends CacheTestCase {
}
@Category(FlakyTest.class) // GEODE-364: random ports, time sensitive, waitForCriterions, magic numbers (113, 226)
+ @Test
public void testClientStatsPR() {
Integer port0 = (Integer) member0.invoke(() -> createServerForStats(0, 113, "No_Colocation"));
Integer port1 = (Integer) member1.invoke(() -> createServerForStats(0, 113, "No_Colocation"));
@@ -126,6 +138,7 @@ public class SingleHopStatsDUnitTest extends CacheTestCase {
member3.invoke(() -> updatePR("FirstClient", "No_Colocation"));
}
+ @Test
public void testClientStatsColocationPR() {
Integer port0 = (Integer) member0.invoke(() -> createServerForStats(0, 4, "Colocation"));
Integer port1 = (Integer) member1.invoke(() -> createServerForStats(0, 4, "Colocation"));
@@ -140,12 +153,9 @@ public class SingleHopStatsDUnitTest extends CacheTestCase {
private void createClient(int port0, int port1, int port2, String colocation) {
Properties props = new Properties();
- props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- CacheTestCase test = new SingleHopStatsDUnitTest(
- "SingleHopStatsDUnitTest");
- DistributedSystem distributedSystem = test.getSystem(props);
+ DistributedSystem distributedSystem = getSystem(props);
Cache cache = CacheFactory.create(distributedSystem);
assertNotNull(cache);
CacheServerTestUtil.disableShufflingOfEndpoints();
@@ -165,9 +175,7 @@ public class SingleHopStatsDUnitTest extends CacheTestCase {
}
private int createServerForStats(int redundantCopies, int totalNoofBuckets, String colocation) {
- CacheTestCase test = new SingleHopStatsDUnitTest(
- "SingleHopStatsDUnitTest");
- Cache cache = test.getCache();
+ Cache cache = getCache();
CacheServer server = cache.addCacheServer();
server.setPort(0);
server.setHostnameForClients("localhost");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SizingFlagDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SizingFlagDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SizingFlagDUnitTest.java
index 14b1a72..11bc209 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SizingFlagDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/SizingFlagDUnitTest.java
@@ -16,6 +16,15 @@
*/
package com.gemstone.gemfire.internal.cache;
+import org.junit.experimental.categories.Category;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+import com.gemstone.gemfire.test.dunit.cache.internal.JUnit4CacheTestCase;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
+
import java.io.DataInput;
import java.io.DataOutput;
import java.io.File;
@@ -63,27 +72,32 @@ import com.gemstone.gemfire.test.dunit.VM;
* indexes on regions with overflow to disk.
*
*/
-public class SizingFlagDUnitTest extends CacheTestCase {
+@Category(DistributedTest.class)
+public class SizingFlagDUnitTest extends JUnit4CacheTestCase {
/**
* @param name
*/
- public SizingFlagDUnitTest(String name) {
- super(name);
+ public SizingFlagDUnitTest() {
+ super();
}
+ @Test
public void testRRMemLRU() {
doRRMemLRUTest();
}
+ @Test
public void testRRMemLRUDeltaAndFlag() {
doRRMemLRUDeltaTest(true);
}
+ @Test
public void testRRMemLRUDelta() {
doRRMemLRUDeltaTest(false);
}
+ @Test
public void testRRListener() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -98,34 +112,42 @@ public class SizingFlagDUnitTest extends CacheTestCase {
doListenerTestRR(vm0, vm1);
}
+ @Test
public void testPRMemLRU() {
doPRMemLRUTest();
}
+ @Test
public void testPRMemLRUAndFlagDeltaPutOnPrimary() {
doPRDeltaTestLRU(false, false, true, false);
}
+ @Test
public void testPRMemLRUDeltaPutOnPrimary() {
doPRDeltaTestLRU(false, false, true, false);
}
+ @Test
public void testPRMemLRUAndFlagDeltaPutOnSecondary() {
doPRDeltaTestLRU(false, false, false, true);
}
+ @Test
public void testPRMemLRUDeltaPutOnSecondary() {
doPRDeltaTestLRU(false, false, false, true);
}
+ @Test
public void testPRNoLRUDelta() {
doPRNoLRUDeltaTest(false);
}
+ @Test
public void testPRNoLRUAndFlagDelta() {
doPRNoLRUDeltaTest(true);
}
+ @Test
public void testPRListener() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -140,6 +162,7 @@ public class SizingFlagDUnitTest extends CacheTestCase {
doListenerTestPR(vm0, vm1);
}
+ @Test
public void testPRHeapLRU() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -172,6 +195,7 @@ public class SizingFlagDUnitTest extends CacheTestCase {
//Test what happens when we reach the heap threshold??
}
+ @Test
public void testRRHeapLRU() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);
@@ -198,23 +222,28 @@ public class SizingFlagDUnitTest extends CacheTestCase {
//Test what happens when we reach the heap threshold??
}
+ @Test
public void testPRHeapLRUDeltaWithFlagPutOnPrimary() {
doPRDeltaTestLRU(false, true, true, false);
}
+ @Test
public void testPRHeapLRUDeltaPutOnPrimary() {
doPRDeltaTestLRU(false, true, true, false);
}
+ @Test
public void testPRHeapLRUDeltaWithFlagPutOnSecondary() {
doPRDeltaTestLRU(false, true, false, true);
}
+ @Test
public void testPRHeapLRUDeltaPutOnSecondary() {
doPRDeltaTestLRU(false, true, false, true);
}
// test to cover bug41916
+ @Test
public void testLargeDelta() {
Host host = Host.getHost(0);
VM vm0 = host.getVM(0);