pivotal-jbarrett commented on code in PR #7608:
URL: https://github.com/apache/geode/pull/7608#discussion_r860034989


##########
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableClientNoServerAvailabileDUnitTest.java:
##########
@@ -0,0 +1,98 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode.internal.cache.tier.sockets;
+
+import static 
org.apache.geode.distributed.ConfigurationProperties.DURABLE_CLIENT_ID;
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+
+import java.util.Properties;
+
+import org.junit.Test;
+import org.junit.experimental.categories.Category;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.NoSubscriptionServersAvailableException;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.Scope;
+import org.apache.geode.cache.client.PoolManager;
+import org.apache.geode.cache.client.internal.PoolImpl;
+import org.apache.geode.cache.server.CacheServer;
+import org.apache.geode.internal.AvailablePortHelper;
+import org.apache.geode.test.awaitility.GeodeAwaitility;
+import org.apache.geode.test.dunit.VM;
+import org.apache.geode.test.dunit.cache.internal.JUnit4CacheTestCase;
+import org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;
+import org.apache.geode.test.junit.categories.ClientSubscriptionTest;
+
+@Category({ClientSubscriptionTest.class})
+public class DurableClientNoServerAvailabileDUnitTest extends 
JUnit4CacheTestCase {

Review Comment:
   Please use the current naming convention. 
`DurableClientNoServerAvailabileDistributedTest`



##########
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableClientStatsDUnitTest.java:
##########
@@ -18,9 +18,15 @@
 import static 
org.apache.geode.distributed.ConfigurationProperties.DURABLE_CLIENT_TIMEOUT;
 import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
 import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
-import static org.apache.geode.test.dunit.Assert.assertEquals;
-import static org.apache.geode.test.dunit.Assert.assertNotNull;
-import static org.apache.geode.test.dunit.Assert.fail;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.createCacheClient;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.createCacheServer;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.disableShufflingOfEndpoints;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.getCache;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.getClientCache;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.resetDisableShufflingOfEndpointsFlag;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.entry;
+import static org.assertj.core.api.AssertionsForClassTypes.fail;

Review Comment:
   Imports the wrong class.



##########
geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableClientCQDUnitTest.java:
##########
@@ -16,14 +16,19 @@
 
 
 import static org.apache.geode.cache.Region.SEPARATOR;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.ControlCqListener;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.createCacheClient;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.createCacheClientFromXml;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.createCacheServer;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.createCacheServerFromXml;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.getCache;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.getClientCache;
+import static 
org.apache.geode.internal.cache.tier.sockets.CacheServerTestUtil.getPool;
 import static org.apache.geode.test.awaitility.GeodeAwaitility.await;
-import static org.apache.geode.test.dunit.NetworkUtils.getServerHostName;
 import static org.assertj.core.api.Assertions.assertThat;
 import static org.assertj.core.api.Assertions.fail;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;

Review Comment:
   Looks like there are still usage of the JUnit assertions.



##########
geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableClientSimpleDUnitTest.java:
##########
@@ -139,16 +135,16 @@ public void run2() throws CacheException {
         checkNumberOfClientProxies(2);
         String firstProxyRegionName = null;
         for (CacheClientProxy proxy : notifier.getClientProxies()) {
-          assertTrue(proxy.isDurable());
-          assertEquals(durableClientId, proxy.getDurableId());
-          assertEquals(DistributionConfig.DEFAULT_DURABLE_CLIENT_TIMEOUT,
-              proxy.getDurableTimeout());
+          assertThat(proxy.isDurable()).isTrue();
+          assertThat(durableClientId).isEqualTo(proxy.getDurableId());
+          assertThat(DistributionConfig.DEFAULT_DURABLE_CLIENT_TIMEOUT)
+              .isEqualTo(proxy.getDurableTimeout());
 
           // Verify the two HA region names aren't the same
           if (firstProxyRegionName == null) {
             firstProxyRegionName = proxy.getHARegionName();
           } else {
-            assertTrue(!firstProxyRegionName.equals(proxy.getHARegionName()));
+            
assertThat(!firstProxyRegionName.equals(proxy.getHARegionName())).isTrue();

Review Comment:
   Can we please remove the `!` and assert the value is false.



##########
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableClientStatsDUnitTest.java:
##########
@@ -292,71 +262,60 @@ public static void checkStatistics() {
   public static void checkStatisticsWithExpectedValues(int reconnectionCount, 
int queueDropCount,
       int enqueueCount) {
     try {
-      Cache cache = CacheServerTestUtil.getCache();
+      Cache cache = getCache();
       org.apache.geode.LogWriter logger = cache.getLogger();
       CacheServerImpl currentServer =
-          (CacheServerImpl) (new ArrayList(cache.getCacheServers()).get(0));
+          (CacheServerImpl) (new ArrayList<>(cache.getCacheServers()).get(0));
       Acceptor ai = currentServer.getAcceptor();
       CacheClientNotifier notifier = ai.getCacheClientNotifier();
       CacheClientNotifierStats stats = notifier.getStats();
       logger.info("Stats:" + "\nDurableReconnectionCount:" + 
stats.get_durableReconnectionCount()
           + "\nQueueDroppedCount" + stats.get_queueDroppedCount()
           + "\nEventsEnqueuedWhileClientAwayCount" + 
stats.get_eventEnqueuedWhileClientAwayCount());
-      assertEquals(reconnectionCount, stats.get_durableReconnectionCount());
-      assertEquals(queueDropCount, stats.get_queueDroppedCount());
-      assertEquals(enqueueCount, 
stats.get_eventEnqueuedWhileClientAwayCount());
+      
assertThat(stats.get_durableReconnectionCount()).isEqualTo(reconnectionCount);

Review Comment:
   If these stats are internally implemented with `Statistics` type we need to 
`await` on the assertion because `Statistics.getX()` calls are not thread 
synchronized. It could take a few hits for the threads to all see the same 
value in a steady state.



-- 
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