demery-pivotal commented on code in PR #7556:
URL: https://github.com/apache/geode/pull/7556#discussion_r845408507


##########
geode-core/src/test/java/org/apache/geode/internal/cache/tier/sockets/MessageDispatcherTest.java:
##########
@@ -173,6 +174,32 @@ public void 
oldClientWillNotGetClientReAuthenticateMessage() throws Exception {
     verify(dispatcher, never()).dispatchResidualMessages();
   }
 
+
+  @Test
+  public void oldClientWillContinueToDeliverMessageIfNotified() throws 
Exception {
+    doReturn(false, false, true).when(dispatcher).isStopped();
+    // make sure wait time is short
+    
doReturn(10000L).when(dispatcher).getSystemProperty(eq(RE_AUTHENTICATE_WAIT_TIME),
 anyLong());
+    
doThrow(AuthenticationExpiredException.class).when(dispatcher).dispatchMessage(any());
+    when(messageQueue.peek()).thenReturn(message);
+    when(proxy.getVersion()).thenReturn(KnownVersion.GEODE_1_14_0);
+
+    Thread dispatcherThread = new Thread(() -> dispatcher.runDispatcher());
+    Thread notifyThread = new Thread(() -> 
dispatcher.notifyReAuthentication());
+
+    dispatcherThread.start();
+    await().until(() -> dispatcher.isWaitingForReAuthentication());
+    notifyThread.start();
+
+    dispatcherThread.join();
+    notifyThread.join();

Review Comment:
   A well-behaved rule can work in JUnit 5. Here's how:
   
   - Add 
`testImplementation('org.junit.jupiter:junit-jupiter-migrationsupport')` to the 
`build.gradle` file. (Whoever does this first will also have to add a version 
to `DependencyConstraings.groovy`.)
   - Add `@EnableRuleMigrationSupport` to the test class.
   
   This works as long as the rule doesn't need to be on the call stack. 
`ExecutorServiceRule` probably doesn't need to be on the call stack.



-- 
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: notifications-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to