You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/09/30 21:31:14 UTC

[GitHub] [geode] kirklund commented on a change in pull request #6922: GEODE-9658: refactor test AuthInit to not use static field for creden…

kirklund commented on a change in pull request #6922:
URL: https://github.com/apache/geode/pull/6922#discussion_r719782124



##########
File path: geode-junit/src/main/java/org/apache/geode/security/UpdatableUserAuthInitialize.java
##########
@@ -28,45 +28,49 @@
  * make sure reset is called after each test to clean things up.
  */
 public class UpdatableUserAuthInitialize implements AuthInitialize {
+  private static final String TEST_UPDATABLE_USER = "test.updatable.user";
+  private static final String TEST_UPDATABLE_WAIT_TIME = "test.updatable.waitTime";
   // use static field for ease of testing since there is only one instance of this in each VM
-  private static final AtomicReference<String> user = new AtomicReference<>();
+  private String user = "";
   // this is used to simulate a slow client in milliseconds
-  private static final AtomicReference<Long> waitTime = new AtomicReference<>(0L);
+  private Long waitTime = 0L;
+
+  @Override
+  public void init(LogWriter systemLogger, LogWriter securityLogger)
+      throws AuthenticationFailedException {
+    user = System.getProperty(TEST_UPDATABLE_USER, "");
+    waitTime = Long.getLong(TEST_UPDATABLE_WAIT_TIME, 0L);
+  }
 
   @Override
   public Properties getCredentials(Properties securityProps, DistributedMember server,
       boolean isPeer) throws AuthenticationFailedException {
     Properties credentials = new Properties();
-    credentials.put("security-username", user.get());
-    credentials.put("security-password", user.get());
+    credentials.put("security-username", user);
+    credentials.put("security-password", user);

Review comment:
       While you're modifying this, you should change from `put` (Map) to `setProperty` (Properties). Both work, but `setProperty` is more correct for Properties.




-- 
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-unsubscribe@geode.apache.org

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