You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by kl...@apache.org on 2016/06/09 17:05:30 UTC
[13/51] [partial] incubator-geode git commit: GEODE-837: update tests
from JUnit3 to JUnit4
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java
index f1fba88..e7e128b 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart1DUnitTest.java
@@ -16,27 +16,29 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
+import static org.junit.Assert.*;
+
+import org.junit.BeforeClass;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
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.NetworkUtils;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests Redundancy Level Functionality
- *
- *
*/
-public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
-{
- /** constructor */
- public RedundancyLevelPart1DUnitTest(String name) {
- super(name);
- }
-
+@Category(DistributedTest.class)
+public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase {
+
+ @BeforeClass
public static void caseSetUp() throws Exception {
- DistributedTestCase.disconnectAllFromDS();
+ disconnectAllFromDS();
}
private void waitConnectedServers(final int expected) {
@@ -52,12 +54,12 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
Wait.waitForCriterion(wc, 60 * 1000, 1000, true);
}
- /*
+ /**
* Redundancy level not specifed, an EP which dies of should be removed from
* the fail over set as well as the live server map
*/
- public void testRedundancyNotSpecifiedNonPrimaryServerFail()
- {
+ @Test
+ public void testRedundancyNotSpecifiedNonPrimaryServerFail() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 0);
verifyOrderOfEndpoints();
@@ -86,13 +88,13 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level not specified. If an EP which dies of is a Primary EP ,
* then the EP should be removed from the live server map, added to dead
* server map.
*/
- public void testRedundancyNotSpecifiedPrimaryServerFails()
- {
+ @Test
+ public void testRedundancyNotSpecifiedPrimaryServerFails() {
/*ClientServerObserver oldBo = ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
public void beforeFailoverByCacheClientUpdater(Endpoint epFailed)
{
@@ -139,14 +141,14 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
}*/
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & was not
* part of the fail over list , then it should be removed from Live Server Map &
* added to dead server map. It should not change the current failover set.
* Failover detection by LSM
*/
- public void testRedundancySpecifiedNonFailoverEPFails()
- {
+ @Test
+ public void testRedundancySpecifiedNonFailoverEPFails() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1);
waitConnectedServers(4);
@@ -175,132 +177,111 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & was not
* part of the fail over list , then it should be removed from Live Server Map &
* added to dead server map. It should not change the current failover set.
* Failover detection by CCU
*/
-
- public void _testRedundancySpecifiedNonFailoverEPFailsDetectionByCCU()
- {
- try {
-
- FailOverDetectionByCCU = true;
- createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1, 250, 500);
- waitConnectedServers(4);
- assertEquals(1, pool.getRedundantNames().size());
- // assertTrue(pool.getRedundantNames()
- // .contains(SERVER1));
- assertTrue(pool.getRedundantNames().contains(SERVER4));
- //assertIndexDetailsEquals(0, proxy.getDeadServers().size());
- verifyOrderOfEndpoints();
- server2.invoke(() -> RedundancyLevelTestBase.stopServer());
- // pause(5000);
- verifyDeadServers(1);
- verifyRedundantServersContain(SERVER4);
- verifyLiveAndRedundantServers(3, 1);
- verifyOrderOfEndpoints();
- // assertTrue(proxy.getDeadServers().contains(SERVER3));
- // assertIndexDetailsEquals(2, pool.getRedundantNames().size());
- // assertTrue(pool.getRedundantNames()
- // .contains(SERVER1));
- // assertIndexDetailsEquals(3, pool.getConnectedServerCount());
- //assertIndexDetailsEquals(1, proxy.getDeadServers().size());
- }
- catch (Exception ex) {
- Assert.fail(
- "test failed due to exception in test testRedundancySpecifiedNonFailoverEPFailsDetectionByCCU ",
- ex);
- }
+ @Ignore("TODO")
+ @Test
+ public void testRedundancySpecifiedNonFailoverEPFailsDetectionByCCU() throws Exception {
+ FailOverDetectionByCCU = true;
+ createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1, 250, 500);
+ waitConnectedServers(4);
+ assertEquals(1, pool.getRedundantNames().size());
+ // assertTrue(pool.getRedundantNames()
+ // .contains(SERVER1));
+ assertTrue(pool.getRedundantNames().contains(SERVER4));
+ //assertIndexDetailsEquals(0, proxy.getDeadServers().size());
+ verifyOrderOfEndpoints();
+ server2.invoke(() -> RedundancyLevelTestBase.stopServer());
+ // pause(5000);
+ verifyDeadServers(1);
+ verifyRedundantServersContain(SERVER4);
+ verifyLiveAndRedundantServers(3, 1);
+ verifyOrderOfEndpoints();
+ // assertTrue(proxy.getDeadServers().contains(SERVER3));
+ // assertIndexDetailsEquals(2, pool.getRedundantNames().size());
+ // assertTrue(pool.getRedundantNames()
+ // .contains(SERVER1));
+ // assertIndexDetailsEquals(3, pool.getConnectedServerCount());
+ //assertIndexDetailsEquals(1, proxy.getDeadServers().size());
}
- /*
+
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & was not
* part of the fail over list , then it should be removed from Live Server Map &
* added to dead server map. It should not change the current failover set.
* Failover detection by Register Interest
*/
-
- public void _testRedundancySpecifiedNonFailoverEPFailsDetectionByRegisterInterest()
- {
- try {
- createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,250, 500);
- waitConnectedServers(4);
- assertEquals(1, pool.getRedundantNames().size());
- // assertTrue(pool.getRedundantNames()
- // .contains(SERVER1));
- assertTrue(pool.getRedundantNames().contains(SERVER4));
- //assertIndexDetailsEquals(0, proxy.getDeadServers().size());
- verifyOrderOfEndpoints();
- server2.invoke(() -> RedundancyLevelTestBase.stopServer());
- // pause(5000);
- createEntriesK1andK2();
- registerK1AndK2();
- verifyDeadServers(1);
- verifyRedundantServersContain(SERVER4);
- verifyLiveAndRedundantServers(3, 1);
- verifyOrderOfEndpoints();
- // assertTrue(proxy.getDeadServers().contains(SERVER3));
- // assertIndexDetailsEquals(2, pool.getRedundantNames().size());
- // assertTrue(pool.getRedundantNames()
- // .contains(SERVER1));
- // assertIndexDetailsEquals(3, pool.getConnectedServerCount());
- //assertIndexDetailsEquals(1, proxy.getDeadServers().size());
- }
- catch (Exception ex) {
- Assert.fail(
- "test failed due to exception in test testRedundancySpecifiedNonFailoverEPFailsDetectionByRegisterInterest ",
- ex);
- }
+ @Ignore("TODO")
+ @Test
+ public void testRedundancySpecifiedNonFailoverEPFailsDetectionByRegisterInterest() throws Exception {
+ createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,250, 500);
+ waitConnectedServers(4);
+ assertEquals(1, pool.getRedundantNames().size());
+ // assertTrue(pool.getRedundantNames()
+ // .contains(SERVER1));
+ assertTrue(pool.getRedundantNames().contains(SERVER4));
+ //assertIndexDetailsEquals(0, proxy.getDeadServers().size());
+ verifyOrderOfEndpoints();
+ server2.invoke(() -> RedundancyLevelTestBase.stopServer());
+ // pause(5000);
+ createEntriesK1andK2();
+ registerK1AndK2();
+ verifyDeadServers(1);
+ verifyRedundantServersContain(SERVER4);
+ verifyLiveAndRedundantServers(3, 1);
+ verifyOrderOfEndpoints();
+ // assertTrue(proxy.getDeadServers().contains(SERVER3));
+ // assertIndexDetailsEquals(2, pool.getRedundantNames().size());
+ // assertTrue(pool.getRedundantNames()
+ // .contains(SERVER1));
+ // assertIndexDetailsEquals(3, pool.getConnectedServerCount());
+ //assertIndexDetailsEquals(1, proxy.getDeadServers().size());
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & was not
* part of the fail over list , then it should be removed from Live Server Map &
* added to dead server map. It should not change the current failover set.
* Failover detection by Unregister Interest
*/
-
- public void _testRedundancySpecifiedNonFailoverEPFailsDetectionByUnregisterInterest()
- {
- try {
- createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,250,500);
- waitConnectedServers(4);
- assertEquals(1, pool.getRedundantNames().size());
- // assertTrue(pool.getRedundantNames()
- // .contains(SERVER1));
- assertTrue(pool.getRedundantNames().contains(SERVER4));
- //assertIndexDetailsEquals(0, proxy.getDeadServers().size());
- verifyOrderOfEndpoints();
- server2.invoke(() -> RedundancyLevelTestBase.stopServer());
- // pause(5000);
- unregisterInterest();
- verifyDeadServers(1);
- verifyRedundantServersContain(SERVER4);
- verifyLiveAndRedundantServers(3, 1);
- verifyOrderOfEndpoints();
- // assertTrue(proxy.getDeadServers().contains(SERVER3));
- // assertIndexDetailsEquals(2, pool.getRedundantNames().size());
- // assertTrue(pool.getRedundantNames()
- // .contains(SERVER1));
- // assertIndexDetailsEquals(3, pool.getConnectedServerCount());
- //assertIndexDetailsEquals(1, proxy.getDeadServers().size());
- }
- catch (Exception ex) {
- Assert.fail(
- "test failed due to exception in test testRedundancySpecifiedNonFailoverEPFailsDetectionByUnregisterInterest ",
- ex);
- }
+ @Ignore("TODO")
+ @Test
+ public void testRedundancySpecifiedNonFailoverEPFailsDetectionByUnregisterInterest() throws Exception {
+ createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,250,500);
+ waitConnectedServers(4);
+ assertEquals(1, pool.getRedundantNames().size());
+ // assertTrue(pool.getRedundantNames()
+ // .contains(SERVER1));
+ assertTrue(pool.getRedundantNames().contains(SERVER4));
+ //assertIndexDetailsEquals(0, proxy.getDeadServers().size());
+ verifyOrderOfEndpoints();
+ server2.invoke(() -> RedundancyLevelTestBase.stopServer());
+ // pause(5000);
+ unregisterInterest();
+ verifyDeadServers(1);
+ verifyRedundantServersContain(SERVER4);
+ verifyLiveAndRedundantServers(3, 1);
+ verifyOrderOfEndpoints();
+ // assertTrue(proxy.getDeadServers().contains(SERVER3));
+ // assertIndexDetailsEquals(2, pool.getRedundantNames().size());
+ // assertTrue(pool.getRedundantNames()
+ // .contains(SERVER1));
+ // assertIndexDetailsEquals(3, pool.getConnectedServerCount());
+ //assertIndexDetailsEquals(1, proxy.getDeadServers().size());
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & was not
* part of the fail over list , then it should be removed from Live Server Map &
* added to dead server map. It should not change the current failover set.
* Failover detection by Put operation.
*/
- public void testRedundancySpecifiedNonFailoverEPFailsDetectionByPut()
- {
+ @Test
+ public void testRedundancySpecifiedNonFailoverEPFailsDetectionByPut() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,500,1000);
waitConnectedServers(4);
@@ -331,16 +312,15 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & is part
* of the fail over list , then it should be removed from live server map &
* added to dead server map. A new EP should be picked from the Live Server
* Map to compensate for the failure.
* Failure Detection by LSM.
*/
-
- public void testRedundancySpecifiedNonPrimaryEPFails()
- {
+ @Test
+ public void testRedundancySpecifiedNonPrimaryEPFails() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1);
waitConnectedServers(4);
@@ -369,16 +349,15 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & is part
* of the fail over list , then it should be removed from live server map &
* added to dead server map. A new EP should be picked from the Live Server
* Map to compensate for the failure.
* Failure Detection by CCU.
*/
-
- public void testRedundancySpecifiedNonPrimaryEPFailsDetectionByCCU()
- {
+ @Test
+ public void testRedundancySpecifiedNonPrimaryEPFailsDetectionByCCU() {
try {
FailOverDetectionByCCU = true;
@@ -409,16 +388,15 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & is part
* of the fail over list , then it should be removed from live server map &
* added to dead server map. A new EP should be picked from the Live Server
* Map to compensate for the failure.
* Failure Detection by Register Interest.
*/
-
- public void testRedundancySpecifiedNonPrimaryEPFailsDetectionByRegisterInterest()
- {
+ @Test
+ public void testRedundancySpecifiedNonPrimaryEPFailsDetectionByRegisterInterest() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,250, 500);
waitConnectedServers(4);
@@ -449,16 +427,15 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & is part
* of the fail over list , then it should be removed from live server map &
* added to dead server map. A new EP should be picked from the Live Server
* Map to compensate for the failure.
* Failure Detection by Unregister Interest.
*/
-
- public void testRedundancySpecifiedNonPrimaryEPFailsDetectionByUnregisterInterest()
- {
+ @Test
+ public void testRedundancySpecifiedNonPrimaryEPFailsDetectionByUnregisterInterest() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,250,500);
waitConnectedServers(4);
@@ -489,16 +466,15 @@ public class RedundancyLevelPart1DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & is part
* of the fail over list , then it should be removed from live server map &
* added to dead server map. A new EP should be picked from the Live Server
* Map to compensate for the failure.
* Failure Detection by Put operation.
*/
-
- public void testRedundancySpecifiedNonPrimaryEPFailsDetectionByPut()
- {
+ @Test
+ public void testRedundancySpecifiedNonPrimaryEPFailsDetectionByPut() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,250,500);
waitConnectedServers(4);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart2DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart2DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart2DUnitTest.java
index 0499847..7847092 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart2DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart2DUnitTest.java
@@ -16,24 +16,25 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
+import static org.junit.Assert.*;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
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.NetworkUtils;
import com.gemstone.gemfire.test.dunit.Wait;
import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
-public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
-{
-
-
- /** constructor */
- public RedundancyLevelPart2DUnitTest(String name) {
- super(name);
- }
-
+@Category(DistributedTest.class)
+public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase {
+
+ @BeforeClass
public static void caseSetUp() throws Exception {
- DistributedTestCase.disconnectAllFromDS();
+ disconnectAllFromDS();
}
private void waitConnectedServers(final int expected) {
@@ -49,7 +50,7 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
Wait.waitForCriterion(wc, 2 * 60 * 1000, 1000, true);
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & is part
* of the fail over list , then it should be removed from live server map &
* added to dead server map. A new EP should be picked from the live server
@@ -59,8 +60,8 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
* registartion.
* Failure Detection by LSM
*/
- public void testRedundancySpecifiedPrimaryEPFails()
- {
+ @Test
+ public void testRedundancySpecifiedPrimaryEPFails() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1);
waitConnectedServers(4);
@@ -89,7 +90,7 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level specified & less than total Eps. If an EP dies & is part
* of the fail over list , then it should be removed from live server map &
* added to dead server map. A new EP should be picked from the live server
@@ -99,8 +100,8 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
* registartion.
* Failure Detection by CCU
*/
- public void testRedundancySpecifiedPrimaryEPFailsDetectionByCCU()
- {
+ @Test
+ public void testRedundancySpecifiedPrimaryEPFailsDetectionByCCU() {
try {
FailOverDetectionByCCU = true;
@@ -140,8 +141,8 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
* registartion.
* Failure Detection by Register Interest
*/
- public void testRedundancySpecifiedPrimaryEPFailsDetectionByRegisterInterest()
- {
+ @Test
+ public void testRedundancySpecifiedPrimaryEPFailsDetectionByRegisterInterest() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,3000, 100);
waitConnectedServers(4);
@@ -181,8 +182,8 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
* registartion.
* Failure Detection by Unregister Interest
*/
- public void testRedundancySpecifiedPrimaryEPFailsDetectionByUnregisterInterest()
- {
+ @Test
+ public void testRedundancySpecifiedPrimaryEPFailsDetectionByUnregisterInterest() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,3000,100);
waitConnectedServers(4);
@@ -221,8 +222,8 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
* registartion.
* Failure Detection by put operation
*/
- public void testRedundancySpecifiedPrimaryEPFailsDetectionByPut()
- {
+ @Test
+ public void testRedundancySpecifiedPrimaryEPFailsDetectionByPut() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1,3000, 100);
waitConnectedServers(4);
@@ -257,8 +258,8 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
* existing EP in the set should be the new primary and make sure that CCP is
* created on both the server with relevant interest registartion.
*/
- public void testRedundancySpecifiedPrimarySecondaryEPFails()
- {
+ @Test
+ public void testRedundancySpecifiedPrimarySecondaryEPFails() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1);
waitConnectedServers(4);
@@ -287,7 +288,7 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* There are 4 Eps in Live serevr Map with redundancy level as 2. Kill two Eps
* (excluding the primary). As a result live server map will contain 2 ,
* active list will contain two & dead server map will contain 2. Redundancy
@@ -296,8 +297,8 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
* sure that CCP is created on the server with relevant interest registartion.
* Bringing the 4th EP alive should simply add it to Live server map.
*/
- public void testRedundancySpecifiedEPFails()
- {
+ @Test
+ public void testRedundancySpecifiedEPFails() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 2);
waitConnectedServers(4);
@@ -345,13 +346,13 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level specified but not satisfied, new EP is added then it
* should be added in Live server map as well as failover set and make sure
* that CCP is created on the server with relevant interest registartion.
*/
- public void testRedundancyLevelSpecifiedButNotSatisfied()
- {
+ @Test
+ public void testRedundancyLevelSpecifiedButNotSatisfied() {
try {
// stop two secondaries
server2.invoke(() -> RedundancyLevelTestBase.stopServer());
@@ -403,13 +404,13 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
}
- /*
+ /**
* Redundancy level specified and satisfied, new EP is added then it should be
* added only in Live server map and make sure that no CCP is created on the
* server.
*/
- public void testRedundancyLevelSpecifiedAndSatisfied()
- {
+ @Test
+ public void testRedundancyLevelSpecifiedAndSatisfied() {
try {
// TODO: Yogesh
server1.invoke(() -> RedundancyLevelTestBase.stopServer());
@@ -443,13 +444,13 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
}
}
- /*
+ /**
* Redundancy level not specified, new EP is added then it should be added in
* live server map as well as failover set and make sure that CCP is created
* on the server with relevant interest registartion.
*/
- public void testRedundancyLevelNotSpecified()
- {
+ @Test
+ public void testRedundancyLevelNotSpecified() {
try {
// TODO: Yogesh
server2.invoke(() -> RedundancyLevelTestBase.stopServer());
@@ -486,36 +487,12 @@ public class RedundancyLevelPart2DUnitTest extends RedundancyLevelTestBase
}
}
- /*
- * There are 4 EndPoints. Redundancy level is 1. The load balancing policy is round
- * robin. 4 Explicit calls to proxy.acquireConnection should given Connections to all
- * the 4 end points & not just the Eps satisfying redundancy.
-
- public void testAcquireConnectionWithRedundancy()
- {
- try {
- createClientCache(getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 1);
- assertIndexDetailsEquals(1, proxy.getRedundantServers().size());
- assertIndexDetailsEquals(PORT3, proxy.acquireConnection().getEndpoint().getPort());
- assertIndexDetailsEquals(PORT4, proxy.acquireConnection().getEndpoint().getPort());
- assertIndexDetailsEquals(PORT1, proxy.acquireConnection().getEndpoint().getPort());
- assertIndexDetailsEquals(PORT2, proxy.acquireConnection().getEndpoint().getPort());
- assertIndexDetailsEquals(PORT3, proxy.acquireConnection().getEndpoint().getPort());
- }
- catch (Exception ex) {
- ex.printStackTrace();
- fail(
- "test failed due to exception in test testAcquireConnectionWithRedundancy ",
- ex);
- }
- }*/
-
- /*
+ /**
* Redundancy level specified is more than the total EndPoints. In such situation there should
* not be any exception & all the EPs should has CacheClientProxy created.
*/
- public void testRedundancySpecifiedMoreThanEPs()
- {
+ @Test
+ public void testRedundancySpecifiedMoreThanEPs() {
try {
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 5);
assertEquals(3, pool.getRedundantNames().size());
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart3DUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart3DUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart3DUnitTest.java
index 484d7e9..88dca25 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart3DUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelPart3DUnitTest.java
@@ -16,28 +16,29 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
+import static org.junit.Assert.*;
+
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.client.internal.PoolImpl;
import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
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.NetworkUtils;
-import com.gemstone.gemfire.cache.client.internal.PoolImpl;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Tests Redundancy Level Functionality
- *
- *
*/
-public class RedundancyLevelPart3DUnitTest extends RedundancyLevelTestBase
-{
- /** constructor */
- public RedundancyLevelPart3DUnitTest(String name) {
- super(name);
- }
-
+@Category(DistributedTest.class)
+public class RedundancyLevelPart3DUnitTest extends RedundancyLevelTestBase {
+
+ @BeforeClass
public static void caseSetUp() throws Exception {
- DistributedTestCase.disconnectAllFromDS();
+ disconnectAllFromDS();
}
/**
@@ -45,10 +46,9 @@ public class RedundancyLevelPart3DUnitTest extends RedundancyLevelTestBase
* After every failure, the order, the dispatcher, the interest registration and the makePrimary calls
* are verified. The failure detection in these tests could be either through CCU or cache operation,
* whichever occurs first
- *
*/
- public void testRegisterInterestAndMakePrimaryWithFullRedundancy()
- {
+ @Test
+ public void testRegisterInterestAndMakePrimaryWithFullRedundancy() {
try {
CacheServerTestUtil.disableShufflingOfEndpoints();
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 3);
@@ -148,11 +148,9 @@ public class RedundancyLevelPart3DUnitTest extends RedundancyLevelTestBase
* After every failure, the order, the dispatcher, the interest registration and the makePrimary calls
* are verified. The failure detection in these tests could be either through CCU or cache operation,
* whichever occurs first
- *
*/
-
- public void testRegisterInterestAndMakePrimaryWithZeroRedundancy()
- {
+ @Test
+ public void testRegisterInterestAndMakePrimaryWithZeroRedundancy() {
try {
CacheServerTestUtil.disableShufflingOfEndpoints();
createClientCache(NetworkUtils.getServerHostName(Host.getHost(0)), PORT1, PORT2, PORT3, PORT4, 0);
@@ -200,10 +198,9 @@ public class RedundancyLevelPart3DUnitTest extends RedundancyLevelTestBase
* After every failure, the order, the dispatcher, the interest registration and the makePrimary calls
* are verified. The failure detection in these tests could be either through CCU or cache operation,
* whichever occurs first
- *
*/
- public void testRegisterInterestAndMakePrimaryWithRedundancyOne()
- {
+ @Test
+ public void testRegisterInterestAndMakePrimaryWithRedundancyOne() {
try {
// long maxWaitTime = 60000;
CacheServerTestUtil.disableShufflingOfEndpoints();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelTestBase.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelTestBase.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelTestBase.java
index 0d2c80a..a426b8e 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelTestBase.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RedundancyLevelTestBase.java
@@ -16,7 +16,26 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static com.gemstone.gemfire.test.dunit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.junit.BeforeClass;
+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.InterestResultPolicy;
+import com.gemstone.gemfire.cache.MirrorType;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.internal.PoolImpl;
import com.gemstone.gemfire.cache.client.internal.RegisterInterestTracker;
@@ -28,36 +47,35 @@ import com.gemstone.gemfire.internal.cache.CacheServerImpl;
import com.gemstone.gemfire.internal.cache.ClientServerObserver;
import com.gemstone.gemfire.internal.cache.ClientServerObserverAdapter;
import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.*;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+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.NetworkUtils;
+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;
/**
* Tests Redundancy Level Functionality
- *
- *
*/
-public class RedundancyLevelTestBase extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class RedundancyLevelTestBase extends JUnit4DistributedTestCase {
+
+ protected static volatile boolean registerInterestCalled = false;
+ protected static volatile boolean makePrimaryCalled = false;
+
static Cache cache = null;
VM server0 = null;
-
VM server1 = null;
-
VM server2 = null;
-
VM server3 = null;
static int PORT1;
-
static int PORT2;
-
static int PORT3;
-
static int PORT4;
static String SERVER1;
@@ -66,7 +84,6 @@ public class RedundancyLevelTestBase extends DistributedTestCase
static String SERVER4;
static final String k1 = "k1";
-
static final String k2 = "k2";
static final String REGION_NAME = "RedundancyLevelTestBase_region";
@@ -77,13 +94,9 @@ public class RedundancyLevelTestBase extends DistributedTestCase
static boolean FailOverDetectionByCCU = false;
- /** constructor */
- public RedundancyLevelTestBase(String name) {
- super(name);
- }
-
+ @BeforeClass
public static void caseSetUp() throws Exception {
- DistributedTestCase.disconnectAllFromDS();
+ disconnectAllFromDS();
}
@Override
@@ -112,9 +125,6 @@ public class RedundancyLevelTestBase extends DistributedTestCase
CacheServerTestUtil.disableShufflingOfEndpoints();
}
- protected static volatile boolean registerInterestCalled = false;
- protected static volatile boolean makePrimaryCalled = false;
-
public static void doPuts()
{
putEntriesK1andK2();
@@ -133,16 +143,14 @@ public class RedundancyLevelTestBase extends DistributedTestCase
assertEquals(r1.getEntry(k1).getValue(), k1);
assertEquals(r1.getEntry(k2).getValue(), k2);
}
- catch (Exception ex) {
- //ignore
+ catch (Exception ignore) {
+ // not sure why it's ok to ignore but if you don't ignore it, RedundancyLevelPart3DUnitTest will fail
}
}
public static void verifyDispatcherIsAlive()
{
try {
-// assertIndexDetailsEquals("More than one BridgeServer", 1, cache.getCacheServers()
-// .size());
WaitCriterion wc = new WaitCriterion() {
String excuse;
public boolean done() {
@@ -200,8 +208,6 @@ public class RedundancyLevelTestBase extends DistributedTestCase
public static void verifyDispatcherIsNotAlive()
{
try {
- // assertIndexDetailsEquals("More than one BridgeServer", 1,
- // cache.getCacheServers().size());
WaitCriterion wc = new WaitCriterion() {
String excuse;
public boolean done() {
@@ -242,8 +248,7 @@ public class RedundancyLevelTestBase extends DistributedTestCase
Assert.fail("while setting verifyDispatcherIsNotAlive ", ex);
}
}
-
-
+
public static void verifyRedundantServersContain(final String server) {
WaitCriterion wc = new WaitCriterion() {
public boolean done() {
@@ -458,7 +463,7 @@ public class RedundancyLevelTestBase extends DistributedTestCase
}
}
catch (Exception ex) {
- fail("while setting verifyInterestRegistration " + ex);
+ fail("while setting verifyInterestRegistration", ex);
}
}
@@ -486,7 +491,7 @@ public class RedundancyLevelTestBase extends DistributedTestCase
bs.start();
}
catch (Exception ex) {
- Assert.fail("while startServer() ", ex);
+ Assert.fail("while startServer()", ex);
}
}
@@ -501,19 +506,13 @@ public class RedundancyLevelTestBase extends DistributedTestCase
}
- public static void createClientCache(String host, int port1, int port2, int port3,
- int port4, int redundancy)
- throws Exception {
+ public static void createClientCache(String host, int port1, int port2, int port3, int port4, int redundancy) throws Exception {
createClientCache(host, port1, port2, port3,
port4, redundancy, 3000, /* defaul socket timeout of 250 millisec*/
10 /*default retry interval*/);
}
- public static void createClientCache(String host, int port1, int port2, int port3,
- int port4, int redundancy,
- int socketReadTimeout,
- int retryInterval) throws Exception
- {
-
+
+ public static void createClientCache(String host, int port1, int port2, int port3, int port4, int redundancy, int socketReadTimeout, int retryInterval) throws Exception {
if(!FailOverDetectionByCCU)
{
oldBo = ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
@@ -534,7 +533,7 @@ public class RedundancyLevelTestBase extends DistributedTestCase
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- new RedundancyLevelTestBase("temp").createCache(props);
+ new RedundancyLevelTestBase().createCache(props);
PoolImpl p = (PoolImpl)PoolManager.createFactory()
.addServer(host, PORT1)
@@ -562,7 +561,7 @@ public class RedundancyLevelTestBase extends DistributedTestCase
public static Integer createServerCache() throws Exception
{
- new RedundancyLevelTestBase("temp").createCache(new Properties());
+ new RedundancyLevelTestBase().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setEnableConflation(true);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegionCloseDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegionCloseDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegionCloseDUnitTest.java
index 193e329..468d82a 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegionCloseDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegionCloseDUnitTest.java
@@ -16,29 +16,43 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+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.server.CacheServer;
import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.CacheServerImpl;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Iterator;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Test to verify that client side region.close() should unregister the client with the server.
* It also checks that client region queue also gets removed properly.
- *
*/
-
-public class RegionCloseDUnitTest extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class RegionCloseDUnitTest extends JUnit4DistributedTestCase {
VM server1 = null;
@@ -53,8 +67,8 @@ public class RegionCloseDUnitTest extends DistributedTestCase
private static Cache cache = null;
/** constructor */
- public RegionCloseDUnitTest(String name) {
- super(name);
+ public RegionCloseDUnitTest() {
+ super();
}
@Override
@@ -81,6 +95,7 @@ public class RegionCloseDUnitTest extends DistributedTestCase
}
+ @Test
public void testCloseRegionOnClient()
{
server1.invoke(() -> RegionCloseDUnitTest.VerifyClientProxyOnServerBeforeClose());
@@ -95,7 +110,7 @@ public class RegionCloseDUnitTest extends DistributedTestCase
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- new RegionCloseDUnitTest("temp").createCache(props);
+ new RegionCloseDUnitTest().createCache(props);
Pool p = PoolManager.createFactory()
.addServer(host, PORT1)
.setSubscriptionEnabled(true)
@@ -118,7 +133,7 @@ public class RegionCloseDUnitTest extends DistributedTestCase
public static Integer createServerCache() throws Exception
{
- new RegionCloseDUnitTest("temp").createCache(new Properties());
+ new RegionCloseDUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestBeforeRegionCreationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestBeforeRegionCreationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestBeforeRegionCreationDUnitTest.java
index 7b8cd12..b390f51 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestBeforeRegionCreationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestBeforeRegionCreationDUnitTest.java
@@ -16,7 +16,24 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheException;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.InterestResultPolicy;
+import com.gemstone.gemfire.cache.MirrorType;
+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.cache30.CacheSerializableRunnable;
@@ -25,12 +42,13 @@ import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.CacheObserverAdapter;
import com.gemstone.gemfire.internal.cache.CacheObserverHolder;
import com.gemstone.gemfire.internal.cache.CacheServerImpl;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.WaitCriterion;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* This test tests the scenario whereby a register interest has been called before
@@ -47,13 +65,9 @@ import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties
* - mirrored region1 is created on server2
* - data will come to region1 on server2 via GII
* - data should be sent to client2
- *
- *
- *
*/
-
-public class RegisterInterestBeforeRegionCreationDUnitTest extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class RegisterInterestBeforeRegionCreationDUnitTest extends JUnit4DistributedTestCase {
/** Server1 VM **/
static VM server1 = null;
@@ -68,14 +82,10 @@ public class RegisterInterestBeforeRegionCreationDUnitTest extends DistributedTe
/** Server2 port **/
public static int PORT2;
/** Region name **/
- private static final String REGION_NAME = "RegisterInterestBeforeRegionCreationDUnitTest_Region";
+ private static final String REGION_NAME = RegisterInterestBeforeRegionCreationDUnitTest.class.getSimpleName() + "_Region";
/** Server2 VM **/
protected static Cache cache = null;
- public RegisterInterestBeforeRegionCreationDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
final Host host = Host.getHost(0);
@@ -88,7 +98,6 @@ public class RegisterInterestBeforeRegionCreationDUnitTest extends DistributedTe
/**
* close the cache on all the vms
- * @throws Exception
*/
@Override
public final void preTearDown() throws Exception {
@@ -98,7 +107,6 @@ public class RegisterInterestBeforeRegionCreationDUnitTest extends DistributedTe
server2.invoke(() -> RegisterInterestBeforeRegionCreationDUnitTest.closeCache());
}
-
/**
* - Creates the client-server configuration (which also registers interest)
* - put on server1
@@ -106,11 +114,10 @@ public class RegisterInterestBeforeRegionCreationDUnitTest extends DistributedTe
* - create region on server2
* - verify puts received on server2 via GII
* - verify puts received on client2 via server2
- *
- * @throws Exception
*/
- public void YOGESH_testRegisterInterestHappeningBeforeRegionCreation() throws Exception
- {
+ @Ignore("TODO:YOGESH: test is disabled")
+ @Test
+ public void testRegisterInterestHappeningBeforeRegionCreation() throws Exception {
createClientServerConfigurationForClearTest();
server1.invoke(putFromServer());
client1.invoke(verifyIfAllPutsGot());
@@ -118,9 +125,6 @@ public class RegisterInterestBeforeRegionCreationDUnitTest extends DistributedTe
server2.invoke(verifyIfAllPutsGot());
client2.invoke(verifyIfAllPutsGot());
}
- public void testDummyAsThereIsNoOtherTestInThisClass(){
- //DO NOTHING
- }
private CacheSerializableRunnable putFromServer()
{
@@ -196,7 +200,7 @@ public class RegisterInterestBeforeRegionCreationDUnitTest extends DistributedTe
public static Integer createServer(Boolean createRegion) throws Exception
{
- new RegisterInterestBeforeRegionCreationDUnitTest("temp").createCache(new Properties());
+ new RegisterInterestBeforeRegionCreationDUnitTest().createCache(new Properties());
boolean isCreateRegion = createRegion.booleanValue();
if (isCreateRegion) {
AttributesFactory factory = new AttributesFactory();
@@ -230,7 +234,7 @@ public class RegisterInterestBeforeRegionCreationDUnitTest extends DistributedTe
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- new RegisterInterestBeforeRegionCreationDUnitTest("temp").createCache(props);
+ new RegisterInterestBeforeRegionCreationDUnitTest().createCache(props);
Pool p = PoolManager.createFactory()
.addServer(host, PORT1)
.setSubscriptionEnabled(true)
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysDUnitTest.java
index f22544b..a4a8d16 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysDUnitTest.java
@@ -16,30 +16,44 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
-import com.gemstone.gemfire.cache.client.Pool;
-import com.gemstone.gemfire.cache.client.PoolManager;
-import com.gemstone.gemfire.cache.server.CacheServer;
-import com.gemstone.gemfire.distributed.DistributedSystem;
-import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.test.dunit.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+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.InterestResultPolicy;
+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.server.CacheServer;
+import com.gemstone.gemfire.distributed.DistributedSystem;
+import com.gemstone.gemfire.internal.AvailablePort;
+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.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* Test code copied from UpdatePropagationDUnitTest
* Tests that registering interest KEYS works correctly.
- *
- *
*/
-
-public class RegisterInterestKeysDUnitTest extends DistributedTestCase
-{
+@Category(DistributedTest.class)
+public class RegisterInterestKeysDUnitTest extends JUnit4DistributedTestCase {
VM server1 = null;
@@ -60,8 +74,8 @@ public class RegisterInterestKeysDUnitTest extends DistributedTestCase
static RegisterInterestKeysDUnitTest impl;
/** constructor */
- public RegisterInterestKeysDUnitTest(String name) {
- super(name);
+ public RegisterInterestKeysDUnitTest() {
+ super();
}
@Override
@@ -100,7 +114,7 @@ public class RegisterInterestKeysDUnitTest extends DistributedTestCase
/** subclass support */
public static void createImpl() {
- impl = new RegisterInterestKeysDUnitTest("temp");
+ impl = new RegisterInterestKeysDUnitTest();
}
private void createCache(Properties props) throws Exception
@@ -116,6 +130,7 @@ public class RegisterInterestKeysDUnitTest extends DistributedTestCase
* situation of Interest List fail over
*
*/
+ @Test
public void testRegisterCreatesInvalidEntry()
{
// First create entries on both servers via the two client
@@ -148,7 +163,7 @@ public class RegisterInterestKeysDUnitTest extends DistributedTestCase
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
- new RegisterInterestKeysDUnitTest("temp").createCache(props);
+ new RegisterInterestKeysDUnitTest().createCache(props);
CacheServerTestUtil.disableShufflingOfEndpoints();
Pool p;
try {
@@ -176,7 +191,7 @@ public class RegisterInterestKeysDUnitTest extends DistributedTestCase
public static Integer createServerCache() throws Exception
{
- new RegisterInterestKeysDUnitTest("temp").createCache(new Properties());
+ new RegisterInterestKeysDUnitTest().createCache(new Properties());
RegionAttributes attrs = impl.createServerCacheAttributes();
cache.createRegion(REGION_NAME, attrs);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysPRDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysPRDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysPRDUnitTest.java
index 310112c..62d41e5 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysPRDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/RegisterInterestKeysPRDUnitTest.java
@@ -16,19 +16,29 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
+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.*;
/**
* subclass of UpdatePropagationDUnitTest to exercise partitioned regions
*
*/
+@Category(DistributedTest.class)
public class RegisterInterestKeysPRDUnitTest extends RegisterInterestKeysDUnitTest {
- public RegisterInterestKeysPRDUnitTest(String name) {
- super(name);
+ public RegisterInterestKeysPRDUnitTest() {
+ super();
}
public static void createImpl() {
- impl = new RegisterInterestKeysPRDUnitTest("temp");
+ impl = new RegisterInterestKeysPRDUnitTest();
}
protected RegionAttributes createServerCacheAttributes()
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ReliableMessagingDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ReliableMessagingDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ReliableMessagingDUnitTest.java
index f4a4fa5..e69d3d8 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ReliableMessagingDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/ReliableMessagingDUnitTest.java
@@ -16,7 +16,23 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Iterator;
+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.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.PoolManager;
import com.gemstone.gemfire.cache.client.internal.PoolImpl;
import com.gemstone.gemfire.cache.client.internal.QueueStateImpl.SequenceIdAndExpirationObject;
@@ -29,22 +45,24 @@ import com.gemstone.gemfire.internal.cache.ClientServerObserverHolder;
import com.gemstone.gemfire.internal.cache.ha.HAHelper;
import com.gemstone.gemfire.internal.cache.ha.HARegionQueue;
import com.gemstone.gemfire.internal.cache.ha.ThreadIdentifier;
-import com.gemstone.gemfire.test.dunit.*;
+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.LogWriterUtils;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+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;
import com.gemstone.gemfire.test.junit.categories.FlakyTest;
-import org.junit.experimental.categories.Category;
-
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
/**
* Tests the reliable messaging functionality - Client sends a periodic
* ack to the primary server for the messages received.
*/
-public class ReliableMessagingDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class ReliableMessagingDUnitTest extends JUnit4DistributedTestCase {
static VM server1 = null;
@@ -69,19 +87,13 @@ public class ReliableMessagingDUnitTest extends DistributedTestCase {
static int CLIENT_ACK_INTERVAL = 5000;
/** name of the test region */
- private static final String REGION_NAME = "ReliableMessagingDUnitTest_Region";
+ private static final String REGION_NAME = ReliableMessagingDUnitTest.class.getSimpleName() + "_Region";
- /**
- * Constructor
- */
- public ReliableMessagingDUnitTest(String name) {
- super(name);
- }
-
/*
* Test verifies that client is sending periodic ack to the primary
* server for messages received.
*/
+ @Test
public void testPeriodicAckSendByClient() throws Exception
{
createEntries();
@@ -98,6 +110,7 @@ public class ReliableMessagingDUnitTest extends DistributedTestCase {
* QRM to other redundant servers.
*/
@Category(FlakyTest.class) // GEODE-694: async queuing
+ @Test
public void testPeriodicAckSendByClientPrimaryFailover() throws Exception {
IgnoredException.addIgnoredException("java.net.ConnectException");
createEntries();
@@ -341,7 +354,7 @@ public class ReliableMessagingDUnitTest extends DistributedTestCase {
public static Integer createServerCache() throws Exception
{
- ReliableMessagingDUnitTest test = new ReliableMessagingDUnitTest("temp");
+ ReliableMessagingDUnitTest test = new ReliableMessagingDUnitTest();
Properties props = new Properties();
cache = test.createCache(props);
AttributesFactory factory = new AttributesFactory();
@@ -365,7 +378,7 @@ public class ReliableMessagingDUnitTest extends DistributedTestCase {
public static void createClientCache(int port1, int port2) throws Exception
{
- ReliableMessagingDUnitTest test = new ReliableMessagingDUnitTest("temp");
+ ReliableMessagingDUnitTest test = new ReliableMessagingDUnitTest();
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UnregisterInterestDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UnregisterInterestDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UnregisterInterestDUnitTest.java
index a5059f7..3638eaf 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UnregisterInterestDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UnregisterInterestDUnitTest.java
@@ -19,7 +19,21 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.ArrayList;
+import java.util.Properties;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.GemFireCache;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionFactory;
+import com.gemstone.gemfire.cache.RegionShortcut;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
@@ -30,17 +44,17 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.FilterProfile;
import com.gemstone.gemfire.internal.cache.GemFireCacheImpl;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.ArrayList;
-import java.util.Properties;
+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.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;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-
-/**
- */
-public class UnregisterInterestDUnitTest extends DistributedTestCase {
+@Category(DistributedTest.class)
+public class UnregisterInterestDUnitTest extends JUnit4DistributedTestCase {
private VM server0 = null;
private VM client1 = null;
@@ -48,20 +62,13 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
private static GemFireCache cache = null;
- private static final String regionname = "UnregisterInterestDUnitTest_region";
+ private static final String regionname = UnregisterInterestDUnitTest.class.getSimpleName() + "_region";
private static final int all_keys = 0;
private static final int list = 1;
private static final int regex = 2;
private static final int filter = 3;
private static final boolean receiveValuesConstant = true;
- /**
- * @param name
- */
- public UnregisterInterestDUnitTest(String name) {
- super(name);
- }
-
@Override
public final void postSetUp() throws Exception {
Host host = Host.getHost(0);
@@ -98,6 +105,7 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
*
* @throws Exception
*/
+ @Test
public void testUnregisterInterestAllKeys() throws Exception {
server0.invoke(() -> UnregisterInterestDUnitTest.checkRIArtifacts(all_keys, 0, 0));
client1.invoke(() -> UnregisterInterestDUnitTest.registerInterest(all_keys, receiveValuesConstant, null));
@@ -117,6 +125,7 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
*
* @throws Exception
*/
+ @Test
public void testUnregisterInterestKeys() throws Exception {
server0.invoke(() -> UnregisterInterestDUnitTest.checkRIArtifacts(list, 0, 0));
client1.invoke(UnregisterInterestDUnitTest.class, "registerInterest", new Object[] {list, receiveValuesConstant, new String[]{"key_1", "key_2", "key_3", "key_4", "key_5"}});
@@ -137,6 +146,7 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
*
* @throws Exception
*/
+ @Test
public void testUnregisterInterestPatterns() throws Exception {
server0.invoke(() -> UnregisterInterestDUnitTest.checkRIArtifacts(regex, 0, 0));
client1.invoke(UnregisterInterestDUnitTest.class, "registerInterest", new Object[] {regex, receiveValuesConstant, new String[] {"[a-z]*[0-9]"}});
@@ -158,6 +168,7 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
*
* @throws Exception
*/
+ @Test
public void testUnregisterInterestKeysInvForOneClientDoesNotAffectOtherClient() throws Exception {
server0.invoke(() -> UnregisterInterestDUnitTest.checkRIArtifacts(list, 0, 0));
client1.invoke(UnregisterInterestDUnitTest.class, "registerInterest", new Object[] {list, !receiveValuesConstant, new String[] {"key_1", "key_2", "key_3", "key_4", "key_5"}});
@@ -181,6 +192,7 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
*
* @throws Exception
*/
+ @Test
public void testUnregisterInterestRegexInvForOneClientDoesNotAffectOtherClient() throws Exception {
server0.invoke(() -> UnregisterInterestDUnitTest.checkRIArtifacts(regex, 0, 0));
client1.invoke(UnregisterInterestDUnitTest.class, "registerInterest", new Object[] {regex, !receiveValuesConstant, new String[] {"[a-z]*[0-9]"}});
@@ -192,8 +204,9 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
client2.invoke(() -> UnregisterInterestDUnitTest.timedWaitForInvalidates(5));
}
- public void _testUnregisterInterestFilters() throws Exception {
-
+ @Ignore("TODO: never implemented")
+ @Test
+ public void testUnregisterInterestFilters() throws Exception {
}
public static void checkRIArtifacts(Integer interestType, Integer value, Integer valueInv) {
@@ -303,7 +316,7 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
}
public static Integer createCacheAndStartServer() throws Exception {
- DistributedSystem ds = new UnregisterInterestDUnitTest("UnregisterInterestDUnitTest").getSystem();
+ DistributedSystem ds = new UnregisterInterestDUnitTest().getSystem();
ds.disconnect();
Properties props = new Properties();
props.setProperty(LOCATORS, "localhost[" + DistributedTestUtils.getDUnitLocatorPort() + "]");
@@ -318,7 +331,7 @@ public class UnregisterInterestDUnitTest extends DistributedTestCase {
}
public static void createClientCache(Host host, Integer port) throws Exception {
- DistributedSystem ds = new UnregisterInterestDUnitTest("UnregisterInterestDUnitTest").getSystem();
+ DistributedSystem ds = new UnregisterInterestDUnitTest().getSystem();
ds.disconnect();
Properties props = new Properties();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java
index 54d993f..055a424 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationDUnitTest.java
@@ -16,7 +16,30 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static junit.framework.TestCase.assertNotNull;
+import static org.junit.Assert.assertEquals;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+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.CacheException;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.EntryEvent;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.RegionAttributes;
+import com.gemstone.gemfire.cache.Scope;
import com.gemstone.gemfire.cache.client.ClientCache;
import com.gemstone.gemfire.cache.client.ClientCacheFactory;
import com.gemstone.gemfire.cache.client.ClientRegionShortcut;
@@ -29,21 +52,12 @@ import com.gemstone.gemfire.cache30.CacheSerializableRunnable;
import com.gemstone.gemfire.distributed.internal.DistributionConfig;
import com.gemstone.gemfire.distributed.internal.ServerLocation;
import com.gemstone.gemfire.internal.AvailablePort;
-import com.gemstone.gemfire.test.dunit.*;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.IgnoredException;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+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.jayway.awaitility.Awaitility;
-import org.junit.Test;
-import org.junit.experimental.categories.Category;
-
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
-import static junit.framework.TestCase.assertNotNull;
-import static org.junit.Assert.assertEquals;
/**
* Start client 1
@@ -64,20 +78,16 @@ import static org.junit.Assert.assertEquals;
@Category(DistributedTest.class)
public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
- VM server1 = null;
-
- VM server2 = null;
-
- VM client1 = null;
+ private static final String REGION_NAME = "UpdatePropagationDUnitTest_region";
- VM client2 = null;
+ private VM server1 = null;
+ private VM server2 = null;
+ private VM client1 = null;
+ private VM client2 = null;
private int PORT1 ;
-
private int PORT2 ;
- private static final String REGION_NAME = "UpdatePropagationDUnitTest_region";
-
@Override
public final void postSetUp() throws Exception {
disconnectAllFromDS();
@@ -173,27 +183,23 @@ public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
return servers.stream().anyMatch(location -> location.getPort() == port);
}
- public void acquireConnectionsAndPutonK1andK2(String host)
- {
+ private void acquireConnectionsAndPutonK1andK2(String host) {
Region r1 = getCache().getRegion(Region.SEPARATOR + REGION_NAME);
r1.put("key1", "server-value1");
r1.put("key2", "server-value2");
}
- public void killServer(Integer port )
- {
+ private void killServer(Integer port ) {
Iterator iter = getCache().getCacheServers().iterator();
if (iter.hasNext()) {
CacheServer server = (CacheServer)iter.next();
if(server.getPort() == port.intValue()){
server.stop();
}
-
}
}
- public void startServer(Integer port) throws IOException
- {
+ private void startServer(Integer port) throws IOException {
CacheServer server1 = getCache().addCacheServer();
server1.setPort(port.intValue());
server1.setNotifyBySubscription(true);
@@ -202,10 +208,8 @@ public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
/**
* Creates entries on the server
- *
*/
- public void createEntriesK1andK2()
- {
+ private void createEntriesK1andK2() {
Region r1 = getCache().getRegion(Region.SEPARATOR+REGION_NAME);
assertNotNull(r1);
if (!r1.containsKey("key1")) {
@@ -225,8 +229,7 @@ public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
}
}
- public void createClientCache(String host, Integer port1 , Integer port2 ) throws Exception
- {
+ private void createClientCache(String host, Integer port1 , Integer port2 ) throws Exception {
ClientCache cache;
try {
System.setProperty(DistributionConfig.GEMFIRE_PREFIX + "PoolImpl.DISABLE_RANDOM", "true");
@@ -254,8 +257,7 @@ public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
.create(REGION_NAME);
}
- public Integer createServerCache() throws Exception
- {
+ private Integer createServerCache() throws Exception {
Cache cache = getCache();
RegionAttributes attrs = createCacheServerAttributes();
cache.createRegion(REGION_NAME, attrs);
@@ -268,32 +270,23 @@ public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
return new Integer(server.getPort());
}
- protected RegionAttributes createCacheServerAttributes()
- {
+ protected RegionAttributes createCacheServerAttributes() {
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
return factory.create();
}
- public void registerKeysK1andK2()
- {
- try {
- Region r = getCache().getRegion(Region.SEPARATOR+ REGION_NAME);
- assertNotNull(r);
- List list = new ArrayList();
- list.add("key1");
- list.add("key2");
- r.registerInterest(list);
-
- }
- catch (Exception ex) {
- Assert.fail("failed while registering interest", ex);
- }
+ private void registerKeysK1andK2() {
+ Region r = getCache().getRegion(Region.SEPARATOR+ REGION_NAME);
+ assertNotNull(r);
+ List list = new ArrayList();
+ list.add("key1");
+ list.add("key2");
+ r.registerInterest(list);
}
- public void verifySenderUpdateCount()
- {
+ private void verifySenderUpdateCount() {
Region r = getCache().getRegion(Region.SEPARATOR+ REGION_NAME);
EventTrackingCacheListener listener = (EventTrackingCacheListener) r.getAttributes().getCacheListeners()[0];
@@ -304,8 +297,7 @@ public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
assertEquals("Expected only 2 events for key2", 2, events.stream().filter(event -> event.getKey().equals("key2")).count());
}
- public void verifyUpdates()
- {
+ private void verifyUpdates() {
Awaitility.await().atMost(60, TimeUnit.SECONDS).until(() -> {
Region r = getCache().getRegion(Region.SEPARATOR + REGION_NAME);
// verify updates
@@ -321,21 +313,23 @@ public class UpdatePropagationDUnitTest extends JUnit4CacheTestCase {
}
private static class EventTrackingCacheListener extends CacheListenerAdapter {
+
List<EntryEvent> receivedEvents = new ArrayList<>();
- @Override public void afterCreate(final EntryEvent event) {
+ @Override
+ public void afterCreate(final EntryEvent event) {
receivedEvents.add(event);
}
- @Override public void afterUpdate(final EntryEvent event) {
+ @Override
+ public void afterUpdate(final EntryEvent event) {
receivedEvents.add(event);
}
- @Override public void afterDestroy(final EntryEvent event) {
+ @Override
+ public void afterDestroy(final EntryEvent event) {
receivedEvents.add(event);
}
-
-
}
}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java
index 589b455..45bf2b8 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/UpdatePropagationPRDUnitTest.java
@@ -16,17 +16,17 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.PartitionAttributesFactory;
+import com.gemstone.gemfire.cache.RegionAttributes;
/**
* subclass of UpdatePropagationDUnitTest to exercise partitioned regions
- *
*/
public class UpdatePropagationPRDUnitTest extends UpdatePropagationDUnitTest {
@Override
- protected RegionAttributes createCacheServerAttributes()
- {
+ protected RegionAttributes createCacheServerAttributes() {
AttributesFactory factory = new AttributesFactory();
factory.setPartitionAttributes((new PartitionAttributesFactory()).create());
return factory.create();
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyEventIDGenerationInP2PDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyEventIDGenerationInP2PDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyEventIDGenerationInP2PDUnitTest.java
index 167063e..b3fafe7 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyEventIDGenerationInP2PDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyEventIDGenerationInP2PDUnitTest.java
@@ -16,8 +16,14 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
+import static org.junit.Assert.*;
+
import java.util.Properties;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
import com.gemstone.gemfire.cache.AttributesFactory;
import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.CacheFactory;
@@ -31,21 +37,19 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.cache.EntryEventImpl;
import com.gemstone.gemfire.internal.cache.EventID;
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.VM;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
- *
* To verify that new events get generated on the node by get operation for key
* that is not present in the node's region.
* Currently test is commented because of the bug.
- *
- *
*/
+@Category(DistributedTest.class)
+public class VerifyEventIDGenerationInP2PDUnitTest extends JUnit4DistributedTestCase {
-public class VerifyEventIDGenerationInP2PDUnitTest extends DistributedTestCase
-{
private static Cache cache = null;
static VM vm0 = null;
@@ -62,8 +66,8 @@ public class VerifyEventIDGenerationInP2PDUnitTest extends DistributedTestCase
/* Constructor */
- public VerifyEventIDGenerationInP2PDUnitTest(String name) {
- super(name);
+ public VerifyEventIDGenerationInP2PDUnitTest() {
+ super();
}
@Override
@@ -76,19 +80,15 @@ public class VerifyEventIDGenerationInP2PDUnitTest extends DistributedTestCase
receiver = false;
}
- public void _testEventIDGeneration() throws Exception
- {
+ @Ignore("TODO")
+ @Test
+ public void testEventIDGeneration() throws Exception {
createEntry();
vm0.invoke(() -> VerifyEventIDGenerationInP2PDUnitTest.get());
Boolean pass = (Boolean)vm0.invoke(() -> VerifyEventIDGenerationInP2PDUnitTest.verifyResult());
assertFalse(pass.booleanValue());
}
- public void testDummy() throws Exception
- {
-
- }
-
private void createCache(Properties props) throws Exception
{
DistributedSystem ds = getSystem(props);
@@ -106,7 +106,7 @@ public class VerifyEventIDGenerationInP2PDUnitTest extends DistributedTestCase
public static void createServerCache() throws Exception
{
- new VerifyEventIDGenerationInP2PDUnitTest("temp")
+ new VerifyEventIDGenerationInP2PDUnitTest()
.createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b914df23/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyUpdatesFromNonInterestEndPointDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyUpdatesFromNonInterestEndPointDUnitTest.java b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyUpdatesFromNonInterestEndPointDUnitTest.java
index 897cd87..53267b5 100755
--- a/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyUpdatesFromNonInterestEndPointDUnitTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/internal/cache/tier/sockets/VerifyUpdatesFromNonInterestEndPointDUnitTest.java
@@ -16,7 +16,21 @@
*/
package com.gemstone.gemfire.internal.cache.tier.sockets;
-import com.gemstone.gemfire.cache.*;
+import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.*;
+import static org.junit.Assert.*;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import com.gemstone.gemfire.cache.AttributesFactory;
+import com.gemstone.gemfire.cache.Cache;
+import com.gemstone.gemfire.cache.CacheFactory;
+import com.gemstone.gemfire.cache.DataPolicy;
+import com.gemstone.gemfire.cache.Region;
+import com.gemstone.gemfire.cache.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.Connection;
@@ -27,38 +41,36 @@ import com.gemstone.gemfire.distributed.DistributedSystem;
import com.gemstone.gemfire.internal.AvailablePort;
import com.gemstone.gemfire.internal.cache.EventID;
import com.gemstone.gemfire.internal.cache.LocalRegion;
-import com.gemstone.gemfire.test.dunit.*;
-
-import java.util.Properties;
-
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.LOCATORS;
-import static com.gemstone.gemfire.distributed.DistributedSystemConfigProperties.MCAST_PORT;
+import com.gemstone.gemfire.test.dunit.Assert;
+import com.gemstone.gemfire.test.dunit.Host;
+import com.gemstone.gemfire.test.dunit.NetworkUtils;
+import com.gemstone.gemfire.test.dunit.VM;
+import com.gemstone.gemfire.test.dunit.Wait;
+import com.gemstone.gemfire.test.dunit.internal.JUnit4DistributedTestCase;
+import com.gemstone.gemfire.test.junit.categories.DistributedTest;
/**
* One Client , two servers.
* Ensure that client 1 has registered interest list on server 2.
* Now Client does a put on server1 .
* The Client should not receive callback of his own put.
-
- *
*/
-public class VerifyUpdatesFromNonInterestEndPointDUnitTest extends DistributedTestCase
-{
- VM vm0 = null;
-
- VM vm1 = null;
+@Category(DistributedTest.class)
+public class VerifyUpdatesFromNonInterestEndPointDUnitTest extends JUnit4DistributedTestCase {
- VM vm2 = null;
+ private VM vm0 = null;
+ private VM vm1 = null;
+ private VM vm2 = null;
private int PORT1;
private int PORT2;
- private static final String REGION_NAME = "VerifyUpdatesFromNonInterestEndPointDUnitTest_region";
+ private static final String REGION_NAME = VerifyUpdatesFromNonInterestEndPointDUnitTest.class.getSimpleName() + "_region";
private static Cache cache = null;
/** constructor */
- public VerifyUpdatesFromNonInterestEndPointDUnitTest(String name) {
- super(name);
+ public VerifyUpdatesFromNonInterestEndPointDUnitTest() {
+ super();
}
@Override
@@ -87,7 +99,7 @@ public class VerifyUpdatesFromNonInterestEndPointDUnitTest extends DistributedTe
return cache;
}
-
+ @Test
public void testVerifyUpdatesFromNonInterestEndPoint()
{
vm2.invoke(() -> VerifyUpdatesFromNonInterestEndPointDUnitTest.createEntries());
@@ -101,7 +113,6 @@ public class VerifyUpdatesFromNonInterestEndPointDUnitTest extends DistributedTe
vm2.invoke(() -> VerifyUpdatesFromNonInterestEndPointDUnitTest.verifyPut());
}
-
public static void acquireConnectionsAndPut(Integer port)
{
try {
@@ -148,7 +159,7 @@ public class VerifyUpdatesFromNonInterestEndPointDUnitTest extends DistributedTe
public static void createClientCache(String host, Integer port1, Integer port2) throws Exception
{
- VerifyUpdatesFromNonInterestEndPointDUnitTest test = new VerifyUpdatesFromNonInterestEndPointDUnitTest("temp");
+ VerifyUpdatesFromNonInterestEndPointDUnitTest test = new VerifyUpdatesFromNonInterestEndPointDUnitTest();
Properties props = new Properties();
props.setProperty(MCAST_PORT, "0");
props.setProperty(LOCATORS, "");
@@ -180,7 +191,7 @@ public class VerifyUpdatesFromNonInterestEndPointDUnitTest extends DistributedTe
public static Integer createServerCache() throws Exception
{
- cache = new VerifyUpdatesFromNonInterestEndPointDUnitTest("temp").createCache(new Properties());
+ cache = new VerifyUpdatesFromNonInterestEndPointDUnitTest().createCache(new Properties());
AttributesFactory factory = new AttributesFactory();
factory.setScope(Scope.DISTRIBUTED_ACK);
factory.setDataPolicy(DataPolicy.REPLICATE);
@@ -194,7 +205,6 @@ public class VerifyUpdatesFromNonInterestEndPointDUnitTest extends DistributedTe
return new Integer(server1.getPort());
}
-
public static void registerKey()
{
try {