mhansonp commented on code in PR #7442:
URL: https://github.com/apache/geode/pull/7442#discussion_r842499933


##########
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableRegistrationDUnitTest.java:
##########
@@ -105,132 +106,117 @@ public DurableRegistrationDUnitTest() {
 
   @Override
   public final void postSetUp() throws Exception {
-    Host host = Host.getHost(0);
-    server1VM = host.getVM(0);
-    server2VM = host.getVM(1);
-    durableClientVM = host.getVM(2);
+    server1VM = VM.getVM(0);
+    server2VM = VM.getVM(1);
+    durableClientVM = VM.getVM(2);
+    hostName = VM.getHostName();
     regionName = DurableRegistrationDUnitTest.class.getName() + "_region";
-    CacheServerTestUtil.disableShufflingOfEndpoints();
+    disableShufflingOfEndpoints();
   }
 
   @Test
   public void testSimpleDurableClient() {
 
     // Step 1: Starting the servers
-    PORT1 = server1VM
-        .invoke(() -> CacheServerTestUtil.createCacheServer(regionName, 
Boolean.TRUE));
-    PORT2 = server2VM
-        .invoke(() -> CacheServerTestUtil.createCacheServer(regionName, 
Boolean.TRUE));
+    PORT1 = server1VM.invoke(() -> createCacheServer(regionName, 
Boolean.TRUE));
+    PORT2 = server2VM.invoke(() -> createCacheServer(regionName, 
Boolean.TRUE));
 
     // Step 2: Bring Up the Client
-    // Start a durable client that is not kept alive on the server when it
-    // stops normally
+    // Start a durable client that is not kept alive on the server when it 
stops normally
     final String durableClientId = getName() + "_client";
 
     final int durableClientTimeout = 600; // keep the client alive for 600
     // seconds
-    durableClientVM.invoke(() -> CacheServerTestUtil.createCacheClient(
-        
getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), PORT1, 
PORT2, true,
+    durableClientVM.invoke(() -> createCacheClient(
+        getClientPool(hostName, PORT1, PORT2, true,
             0),
         regionName, getClientDistributedSystemProperties(durableClientId, 
durableClientTimeout),
         Boolean.TRUE));
 
-    // Send clientReady message
-    durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") {
-      @Override
-      public void run2() throws CacheException {
-        CacheServerTestUtil.getCache().readyForEvents();
-      }
-    });
+
 
     // Step 3: Client registers Interests
     // KEY_STONE1, KEY_STONE2 are registered as durableKeys & KEY_STONE3,
     // KEY_STONE4 as non-durableKeys
+    durableClientVM.invoke(() -> registerKey(K1, Boolean.FALSE));
+    durableClientVM.invoke(() -> registerKey(K2, Boolean.FALSE));
+    durableClientVM.invoke(() -> registerKey(K3, Boolean.TRUE));
+    durableClientVM.invoke(() -> registerKey(K4, Boolean.TRUE));
 
-    durableClientVM
-        .invoke(() -> DurableRegistrationDUnitTest.registerKey(K1, 
Boolean.FALSE));
-    durableClientVM
-        .invoke(() -> DurableRegistrationDUnitTest.registerKey(K2, 
Boolean.FALSE));
-    durableClientVM
-        .invoke(() -> DurableRegistrationDUnitTest.registerKey(K3, 
Boolean.TRUE));
-    durableClientVM
-        .invoke(() -> DurableRegistrationDUnitTest.registerKey(K4, 
Boolean.TRUE));
+
+    // Send clientReady message
+    durableClientVM.invoke("Send clientReady", new CacheSerializableRunnable() 
{
+      @Override
+      public void run2() throws CacheException {
+        getCache().readyForEvents();
+      }
+    });
 
     // Step 4: Update Values on the Server for KEY_STONE1, KEY_STONE2,
     // KEY_STONE3, KEY_STONE4
-
-    server2VM.invoke(() -> DurableRegistrationDUnitTest.putValue(K1, 
"Value1"));
-    server2VM.invoke(() -> DurableRegistrationDUnitTest.putValue(K2, 
"Value2"));
-    server2VM.invoke(() -> DurableRegistrationDUnitTest.putValue(K3, 
"Value3"));
-    server2VM.invoke(() -> DurableRegistrationDUnitTest.putValue(K4, 
"Value4"));
+    server2VM.invoke(() -> putValue(K1, "Value1"));
+    server2VM.invoke(() -> putValue(K2, "Value2"));
+    server2VM.invoke(() -> putValue(K3, "Value3"));
+    server2VM.invoke(() -> putValue(K4, "Value4"));
 
     Wait.pause(1000);
-    // Step 5: Verify Updates on the Client
 
-    assertEquals("Value1", server2VM.invoke(() -> 
DurableRegistrationDUnitTest.getValue(K1)));
-    assertEquals("Value1", server1VM.invoke(() -> 
DurableRegistrationDUnitTest.getValue(K1)));
+    // Step 5: Verify Updates on the Client
+    assertEquals("Value1", server2VM.invoke(() -> getValue(K1)));
+    assertEquals("Value1", server1VM.invoke(() -> getValue(K1)));
 
-    assertEquals("Value1",
-        durableClientVM.invoke(() -> 
DurableRegistrationDUnitTest.getValue(K1)));
-    assertEquals("Value2",
-        durableClientVM.invoke(() -> 
DurableRegistrationDUnitTest.getValue(K2)));
-    assertEquals("Value3",
-        durableClientVM.invoke(() -> 
DurableRegistrationDUnitTest.getValue(K3)));
-    assertEquals("Value4",
-        durableClientVM.invoke(() -> 
DurableRegistrationDUnitTest.getValue(K4)));
+    assertEquals("Value1", durableClientVM.invoke(() -> getValue(K1)));
+    assertEquals("Value2", durableClientVM.invoke(() -> getValue(K2)));
+    assertEquals("Value3", durableClientVM.invoke(() -> getValue(K3)));
+    assertEquals("Value4", durableClientVM.invoke(() -> getValue(K4)));
 
     // Step 6: Close Cache of the DurableClient
-    durableClientVM.invoke(DurableRegistrationDUnitTest::closeCache);
-    // pause(5000);
+    durableClientVM.invoke(this::closeCache);
+
     // Step 7: Update KEY_STONE1,KEY_STONE2,KEY_STONE3,KEY_STONE4 on the
     // Server say with values PingPong1, PingPong2, PingPong3, PingPong4
-    server2VM.invoke(() -> DurableRegistrationDUnitTest.putValue(K1, 
"PingPong1"));
-    server2VM.invoke(() -> DurableRegistrationDUnitTest.putValue(K2, 
"PingPong2"));
-    server2VM.invoke(() -> DurableRegistrationDUnitTest.putValue(K3, 
"PingPong3"));
-    server2VM.invoke(() -> DurableRegistrationDUnitTest.putValue(K4, 
"PingPong4"));
+    server2VM.invoke(() -> putValue(K1, "PingPong1"));
+    server2VM.invoke(() -> putValue(K2, "PingPong2"));
+    server2VM.invoke(() -> putValue(K3, "PingPong3"));
+    server2VM.invoke(() -> putValue(K4, "PingPong4"));
 
     // Step 8: Re-start the Client
-    durableClientVM
-        .invoke(() -> CacheServerTestUtil.createCacheClient(
-            
getClientPool(NetworkUtils.getServerHostName(durableClientVM.getHost()), PORT1, 
PORT2,
-                true, 0),
-            regionName, getClientDistributedSystemProperties(durableClientId), 
Boolean.TRUE));
+    durableClientVM.invoke(() -> createCacheClient(
+        getClientPool(hostName, PORT1, PORT2,
+            true, 0),
+        regionName, getClientDistributedSystemProperties(durableClientId), 
Boolean.TRUE));
 
     // Send clientReady message
-    durableClientVM.invoke(new CacheSerializableRunnable("Send clientReady") {
+    durableClientVM.invoke("Send clientReady", new CacheSerializableRunnable() 
{

Review Comment:
   not possible.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to