This is an automated email from the ASF dual-hosted git repository.

szetszwo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ratis.git


The following commit(s) were added to refs/heads/master by this push:
     new 29bba5943 RATIS-2088. Fix name and imports related check in 
test-directory (#1092)
29bba5943 is described below

commit 29bba5943ae9c7b5d538da62de683edc2eb9d8f0
Author: Symious <[email protected]>
AuthorDate: Tue May 14 09:15:50 2024 +0800

    RATIS-2088. Fix name and imports related check in test-directory (#1092)
---
 .../src/test/java/org/apache/ratis/BaseTest.java   |  4 ++--
 .../org/apache/ratis/util/TestRefCountingMap.java  |  1 -
 .../ratis/examples/ParameterizedBaseTest.java      |  8 +++----
 .../examples/arithmetic/TestArithmeticLogDump.java |  8 +++----
 .../ratis/examples/common/TestSubCommand.java      |  3 ---
 .../apache/ratis/grpc/MiniRaftClusterWithGrpc.java |  4 ++--
 .../ratis/netty/MiniRaftClusterWithNetty.java      |  4 ++--
 .../ratis/InstallSnapshotNotificationTests.java    | 24 +++++++++----------
 .../org/apache/ratis/OutputStreamBaseTest.java     |  2 --
 .../org/apache/ratis/RaftAsyncExceptionTests.java  |  2 +-
 .../test/java/org/apache/ratis/RaftAsyncTests.java |  6 ++---
 .../test/java/org/apache/ratis/RaftTestUtil.java   |  6 ++---
 .../java/org/apache/ratis/WatchRequestTests.java   |  2 --
 .../ratis/server/impl/GroupManagementBaseTest.java | 10 ++++----
 .../apache/ratis/server/impl/MiniRaftCluster.java  |  8 +++----
 .../server/impl/RaftReconfigurationBaseTest.java   | 12 +++++-----
 .../ratis/server/simulation/RaftServerReply.java   |  1 -
 .../ratis/statemachine/RaftSnapshotBaseTest.java   |  1 -
 .../impl/SimpleStateMachine4Testing.java           |  1 -
 .../ratis/TestRaftServerNoLeaderTimeout.java       |  8 +++----
 .../ratis/TestRaftServerSlownessDetection.java     |  8 +++----
 .../ratis/grpc/TestLeaderElectionWithGrpc.java     |  2 +-
 .../apache/ratis/grpc/util/TestGrpcZeroCopy.java   | 20 ++++++++--------
 .../ratis/netty/TestLeaderElectionWithNetty.java   |  2 +-
 .../apache/ratis/netty/TestTlsConfWithNetty.java   |  2 +-
 .../ratis/server/TestRaftServerConfigKeys.java     |  8 +++----
 .../ratis/server/impl/TestRaftServerJmx.java       |  4 ++--
 .../raftlog/segmented/TestCacheEviction.java       | 28 +++++++++++-----------
 .../raftlog/segmented/TestSegmentedRaftLog.java    | 24 +++++++++----------
 .../segmented/TestSegmentedRaftLogCache.java       |  4 ++--
 .../ratis/server/storage/TestStorageImplUtils.java | 12 +++++-----
 .../shell/cli/sh/GroupCommandIntegrationTest.java  | 10 ++++----
 32 files changed, 114 insertions(+), 125 deletions(-)

diff --git a/ratis-common/src/test/java/org/apache/ratis/BaseTest.java 
b/ratis-common/src/test/java/org/apache/ratis/BaseTest.java
index fb34d64f1..e28978403 100644
--- a/ratis-common/src/test/java/org/apache/ratis/BaseTest.java
+++ b/ratis-common/src/test/java/org/apache/ratis/BaseTest.java
@@ -124,7 +124,7 @@ public abstract class BaseTest {
     return 100;
   }
 
-  private static final Supplier<File> rootTestDir = JavaUtils.memoize(
+  private static final Supplier<File> ROOT_TEST_DIR = JavaUtils.memoize(
       () -> JavaUtils.callAsUnchecked(() -> {
         final File dir = new File(System.getProperty("test.build.data", 
"target/test/data"),
             Integer.toHexString(ThreadLocalRandom.current().nextInt()));
@@ -138,7 +138,7 @@ public abstract class BaseTest {
 
 
   public static File getRootTestDir() {
-    return rootTestDir.get();
+    return ROOT_TEST_DIR.get();
   }
 
   public File getClassTestDir() {
diff --git 
a/ratis-common/src/test/java/org/apache/ratis/util/TestRefCountingMap.java 
b/ratis-common/src/test/java/org/apache/ratis/util/TestRefCountingMap.java
index db6e9239a..6c438e247 100644
--- a/ratis-common/src/test/java/org/apache/ratis/util/TestRefCountingMap.java
+++ b/ratis-common/src/test/java/org/apache/ratis/util/TestRefCountingMap.java
@@ -26,7 +26,6 @@ import java.util.Collection;
 import java.util.Set;
 
 import org.apache.ratis.thirdparty.com.google.common.collect.Lists;
-import org.apache.ratis.util.RefCountingMap;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
diff --git 
a/ratis-examples/src/test/java/org/apache/ratis/examples/ParameterizedBaseTest.java
 
b/ratis-examples/src/test/java/org/apache/ratis/examples/ParameterizedBaseTest.java
index df2fce13e..fc3c4c8be 100644
--- 
a/ratis-examples/src/test/java/org/apache/ratis/examples/ParameterizedBaseTest.java
+++ 
b/ratis-examples/src/test/java/org/apache/ratis/examples/ParameterizedBaseTest.java
@@ -48,11 +48,11 @@ public abstract class ParameterizedBaseTest extends 
BaseTest {
   }
 
   /** For {@link ParameterizedTest} so that a cluster can be shared by 
multiple {@link Test} */
-  private static final AtomicReference<MiniRaftCluster> currentCluster = new 
AtomicReference<>();
+  private static final AtomicReference<MiniRaftCluster> CURRENT_CLUSTER = new 
AtomicReference<>();
 
-  /** Set {@link #currentCluster} to the given cluster and start it if {@link 
#currentCluster} is changed. */
+  /** Set {@link #CURRENT_CLUSTER} to the given cluster and start it if {@link 
#CURRENT_CLUSTER} is changed. */
   public static void setAndStart(MiniRaftCluster cluster) throws 
InterruptedException, IOException {
-    final MiniRaftCluster previous = currentCluster.getAndSet(cluster);
+    final MiniRaftCluster previous = CURRENT_CLUSTER.getAndSet(cluster);
     if (previous != cluster) {
       if (previous != null) {
         previous.shutdown();
@@ -65,7 +65,7 @@ public abstract class ParameterizedBaseTest extends BaseTest {
 
   @AfterAll
   public static void shutdownCurrentCluster() {
-    final MiniRaftCluster cluster = currentCluster.getAndSet(null);
+    final MiniRaftCluster cluster = CURRENT_CLUSTER.getAndSet(null);
     if (cluster != null) {
       cluster.shutdown();
     }
diff --git 
a/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/TestArithmeticLogDump.java
 
b/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/TestArithmeticLogDump.java
index c39335308..f17ebe260 100644
--- 
a/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/TestArithmeticLogDump.java
+++ 
b/ratis-examples/src/test/java/org/apache/ratis/examples/arithmetic/TestArithmeticLogDump.java
@@ -47,17 +47,17 @@ public class TestArithmeticLogDump extends BaseTest {
 
   public static final int NUM_SERVERS = 1;
 
-  protected static final RaftProperties properties = new RaftProperties();
+  protected static final RaftProperties PROPERTIES = new RaftProperties();
 
   private final MiniRaftClusterWithSimulatedRpc cluster = 
MiniRaftClusterWithSimulatedRpc
       .FACTORY.newCluster(NUM_SERVERS, getProperties());
 
   public RaftProperties getProperties() {
     RaftServerConfigKeys.Rpc
-        .setSlownessTimeout(properties, TimeDuration.valueOf(1, 
TimeUnit.SECONDS));
-    properties.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY,
+        .setSlownessTimeout(PROPERTIES, TimeDuration.valueOf(1, 
TimeUnit.SECONDS));
+    PROPERTIES.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY,
         SimpleStateMachine4Testing.class, StateMachine.class);
-    return properties;
+    return PROPERTIES;
   }
 
   @BeforeEach
diff --git 
a/ratis-examples/src/test/java/org/apache/ratis/examples/common/TestSubCommand.java
 
b/ratis-examples/src/test/java/org/apache/ratis/examples/common/TestSubCommand.java
index 5ef034809..c47dbb82a 100644
--- 
a/ratis-examples/src/test/java/org/apache/ratis/examples/common/TestSubCommand.java
+++ 
b/ratis-examples/src/test/java/org/apache/ratis/examples/common/TestSubCommand.java
@@ -21,12 +21,9 @@ package org.apache.ratis.examples.common;
 
 import java.util.Collection;
 import java.util.Collections;
-import org.junit.Test;
 import org.junit.jupiter.api.Assertions;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.MethodSource;
-import org.junit.runner.RunWith;
-import org.junit.runners.Parameterized;
 
 public class TestSubCommand {
 
diff --git 
a/ratis-grpc/src/test/java/org/apache/ratis/grpc/MiniRaftClusterWithGrpc.java 
b/ratis-grpc/src/test/java/org/apache/ratis/grpc/MiniRaftClusterWithGrpc.java
index 68556afb8..aeee7c050 100644
--- 
a/ratis-grpc/src/test/java/org/apache/ratis/grpc/MiniRaftClusterWithGrpc.java
+++ 
b/ratis-grpc/src/test/java/org/apache/ratis/grpc/MiniRaftClusterWithGrpc.java
@@ -61,7 +61,7 @@ public class MiniRaftClusterWithGrpc extends 
MiniRaftCluster.RpcBase {
     }
   }
 
-  public static final DelayLocalExecutionInjection sendServerRequestInjection =
+  public static final DelayLocalExecutionInjection 
SEND_SERVER_REQUEST_INJECTION =
       new DelayLocalExecutionInjection(GrpcService.GRPC_SEND_SERVER_REQUEST);
 
   protected MiniRaftClusterWithGrpc(String[] ids, String[] listenerIds, 
RaftProperties properties,
@@ -82,7 +82,7 @@ public class MiniRaftClusterWithGrpc extends 
MiniRaftCluster.RpcBase {
   @Override
   protected void blockQueueAndSetDelay(String leaderId, int delayMs)
       throws InterruptedException {
-    RaftTestUtil.blockQueueAndSetDelay(getServers(), 
sendServerRequestInjection,
+    RaftTestUtil.blockQueueAndSetDelay(getServers(), 
SEND_SERVER_REQUEST_INJECTION,
         leaderId, delayMs, getTimeoutMax());
   }
 
diff --git 
a/ratis-netty/src/test/java/org/apache/ratis/netty/MiniRaftClusterWithNetty.java
 
b/ratis-netty/src/test/java/org/apache/ratis/netty/MiniRaftClusterWithNetty.java
index 990b63d90..b912e1492 100644
--- 
a/ratis-netty/src/test/java/org/apache/ratis/netty/MiniRaftClusterWithNetty.java
+++ 
b/ratis-netty/src/test/java/org/apache/ratis/netty/MiniRaftClusterWithNetty.java
@@ -48,7 +48,7 @@ public class MiniRaftClusterWithNetty extends 
MiniRaftCluster.RpcBase {
     }
   }
 
-  public static final DelayLocalExecutionInjection sendServerRequest
+  public static final DelayLocalExecutionInjection SEND_SERVER_REQUEST
       = new DelayLocalExecutionInjection(NettyRpcService.SEND_SERVER_REQUEST);
 
   protected MiniRaftClusterWithNetty(String[] ids, String[] listenerIds, 
RaftProperties properties) {
@@ -64,7 +64,7 @@ public class MiniRaftClusterWithNetty extends 
MiniRaftCluster.RpcBase {
   @Override
   protected void blockQueueAndSetDelay(String leaderId, int delayMs)
       throws InterruptedException {
-    RaftTestUtil.blockQueueAndSetDelay(getServers(), sendServerRequest,
+    RaftTestUtil.blockQueueAndSetDelay(getServers(), SEND_SERVER_REQUEST,
         leaderId, delayMs, getTimeoutMax());
   }
 }
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java
 
b/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java
index 72ddd06f2..6aaa8acc3 100644
--- 
a/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java
+++ 
b/ratis-server/src/test/java/org/apache/ratis/InstallSnapshotNotificationTests.java
@@ -83,7 +83,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
 
   private static final int SNAPSHOT_TRIGGER_THRESHOLD = 64;
   private static final int PURGE_GAP = 8;
-  private static final AtomicReference<SnapshotInfo> leaderSnapshotInfoRef = 
new AtomicReference<>();
+  private static final AtomicReference<SnapshotInfo> LEADER_SNAPSHOT_INFO_REF 
= new AtomicReference<>();
 
   private static final AtomicInteger numSnapshotRequests = new AtomicInteger();
   private static final AtomicInteger numNotifyInstallSnapshotFinished = new 
AtomicInteger();
@@ -102,7 +102,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
       }
       numSnapshotRequests.incrementAndGet();
 
-      final SingleFileSnapshotInfo leaderSnapshotInfo = 
(SingleFileSnapshotInfo) leaderSnapshotInfoRef.get();
+      final SingleFileSnapshotInfo leaderSnapshotInfo = 
(SingleFileSnapshotInfo) LEADER_SNAPSHOT_INFO_REF.get();
       LOG.info("{}: leaderSnapshotInfo = {}", getId(), leaderSnapshotInfo);
       if (leaderSnapshotInfo == null) {
         return super.notifyInstallSnapshotFromLeader(roleInfoProto, termIndex);
@@ -137,7 +137,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
         return;
       }
       numNotifyInstallSnapshotFinished.incrementAndGet();
-      final SingleFileSnapshotInfo leaderSnapshotInfo = 
(SingleFileSnapshotInfo) leaderSnapshotInfoRef.get();
+      final SingleFileSnapshotInfo leaderSnapshotInfo = 
(SingleFileSnapshotInfo) LEADER_SNAPSHOT_INFO_REF.get();
       File leaderSnapshotFile = 
leaderSnapshotInfo.getFile().getPath().toFile();
       synchronized (this) {
         try {
@@ -184,7 +184,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
 
   private void testAddNewFollowers(CLUSTER cluster, int numRequests) throws 
Exception {
     final boolean shouldInstallSnapshot = numRequests >= 
SNAPSHOT_TRIGGER_THRESHOLD;
-    leaderSnapshotInfoRef.set(null);
+    LEADER_SNAPSHOT_INFO_REF.set(null);
     final List<LogSegmentPath> logs;
     int i = 0;
     try {
@@ -236,7 +236,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
 
       final SnapshotInfo leaderSnapshotInfo = 
cluster.getLeader().getStateMachine().getLatestSnapshot();
       LOG.info("LeaderSnapshotInfo: {}", leaderSnapshotInfo.getTermIndex());
-      final boolean set = leaderSnapshotInfoRef.compareAndSet(null, 
leaderSnapshotInfo);
+      final boolean set = LEADER_SNAPSHOT_INFO_REF.compareAndSet(null, 
leaderSnapshotInfo);
       Assert.assertTrue(set);
 
       // add two more peers
@@ -271,7 +271,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
   }
 
   private void testRestartFollower(CLUSTER cluster) throws Exception {
-    leaderSnapshotInfoRef.set(null);
+    LEADER_SNAPSHOT_INFO_REF.set(null);
     int i = 0;
     final RaftServer.Division leader = RaftTestUtil.waitForLeader(cluster);
     final RaftPeerId leaderId = leader.getId();
@@ -321,7 +321,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
 
 
   private void testInstallSnapshotNotificationCount(CLUSTER cluster) throws 
Exception {
-    leaderSnapshotInfoRef.set(null);
+    LEADER_SNAPSHOT_INFO_REF.set(null);
     numSnapshotRequests.set(0);
 
     int i = 0;
@@ -352,7 +352,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
       Assert.assertEquals(20, snapshotIndex);
       final SnapshotInfo leaderSnapshotInfo = 
cluster.getLeader().getStateMachine().getLatestSnapshot();
       Assert.assertEquals(20, leaderSnapshotInfo.getIndex());
-      final boolean set = leaderSnapshotInfoRef.compareAndSet(null, 
leaderSnapshotInfo);
+      final boolean set = LEADER_SNAPSHOT_INFO_REF.compareAndSet(null, 
leaderSnapshotInfo);
       Assert.assertTrue(set);
 
       // Wait for the snapshot to be done.
@@ -425,7 +425,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
   }
 
   private void testInstallSnapshotInstalledEvent(CLUSTER cluster) throws 
Exception{
-    leaderSnapshotInfoRef.set(null);
+    LEADER_SNAPSHOT_INFO_REF.set(null);
     numNotifyInstallSnapshotFinished.set(0);
     final List<LogSegmentPath> logs;
     int i = 0;
@@ -475,7 +475,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
 
       final SnapshotInfo leaderSnapshotInfo = 
cluster.getLeader().getStateMachine().getLatestSnapshot();
       LOG.info("LeaderSnapshotInfo: {}", leaderSnapshotInfo.getTermIndex());
-      final boolean set = leaderSnapshotInfoRef.compareAndSet(null, 
leaderSnapshotInfo);
+      final boolean set = LEADER_SNAPSHOT_INFO_REF.compareAndSet(null, 
leaderSnapshotInfo);
       Assert.assertTrue(set);
 
       // add one new peer
@@ -524,7 +524,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
   }
 
   private void testInstallSnapshotDuringBootstrap(CLUSTER cluster) throws 
Exception {
-    leaderSnapshotInfoRef.set(null);
+    LEADER_SNAPSHOT_INFO_REF.set(null);
     numSnapshotRequests.set(0);
     int i = 0;
     try {
@@ -553,7 +553,7 @@ public abstract class 
InstallSnapshotNotificationTests<CLUSTER extends MiniRaftC
       RaftSnapshotBaseTest.assertLeaderContent(cluster);
 
       final SnapshotInfo leaderSnapshotInfo = 
cluster.getLeader().getStateMachine().getLatestSnapshot();
-      final boolean set = leaderSnapshotInfoRef.compareAndSet(null, 
leaderSnapshotInfo);
+      final boolean set = LEADER_SNAPSHOT_INFO_REF.compareAndSet(null, 
leaderSnapshotInfo);
       Assert.assertTrue(set);
 
       // add two more peers
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/OutputStreamBaseTest.java 
b/ratis-server/src/test/java/org/apache/ratis/OutputStreamBaseTest.java
index d86170d0b..0c1a5164f 100644
--- a/ratis-server/src/test/java/org/apache/ratis/OutputStreamBaseTest.java
+++ b/ratis-server/src/test/java/org/apache/ratis/OutputStreamBaseTest.java
@@ -22,13 +22,11 @@ import org.apache.ratis.proto.RaftProtos.LogEntryProto;
 import org.apache.ratis.proto.RaftProtos.LogEntryProto.LogEntryBodyCase;
 import org.apache.ratis.server.RaftServer;
 import org.apache.ratis.server.impl.MiniRaftCluster;
-import org.apache.ratis.server.protocol.TermIndex;
 import org.apache.ratis.server.raftlog.LogEntryHeader;
 import org.apache.ratis.server.raftlog.RaftLog;
 import org.apache.ratis.util.SizeInBytes;
 import org.apache.ratis.util.StringUtils;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 import java.io.IOException;
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/RaftAsyncExceptionTests.java 
b/ratis-server/src/test/java/org/apache/ratis/RaftAsyncExceptionTests.java
index 1ad53a838..33e085733 100644
--- a/ratis-server/src/test/java/org/apache/ratis/RaftAsyncExceptionTests.java
+++ b/ratis-server/src/test/java/org/apache/ratis/RaftAsyncExceptionTests.java
@@ -104,7 +104,7 @@ public abstract class RaftAsyncExceptionTests<CLUSTER 
extends MiniRaftCluster>
       final RaftClientReply reply = client.io().send(new SimpleMessage("m0"));
       Assert.assertTrue(reply.isSuccess());
 
-      RaftClientConfigKeys.Rpc.setRequestTimeout(properties.get(), ONE_SECOND);
+      RaftClientConfigKeys.Rpc.setRequestTimeout(PROPERTIES.get(), ONE_SECOND);
       // Block StartTransaction
       StreamSupport.stream(cluster.getServers().spliterator(), false)
           .map(cluster::getDivision)
diff --git a/ratis-server/src/test/java/org/apache/ratis/RaftAsyncTests.java 
b/ratis-server/src/test/java/org/apache/ratis/RaftAsyncTests.java
index 71c5c5ef0..1ac704f59 100644
--- a/ratis-server/src/test/java/org/apache/ratis/RaftAsyncTests.java
+++ b/ratis-server/src/test/java/org/apache/ratis/RaftAsyncTests.java
@@ -77,7 +77,7 @@ public abstract class RaftAsyncTests<CLUSTER extends 
MiniRaftCluster> extends Ba
 
   public static final int NUM_SERVERS = 3;
 
-  private static final DelayLocalExecutionInjection logSyncDelay = 
RaftServerTestUtil.getLogSyncDelay();
+  private static final DelayLocalExecutionInjection LOG_SYNC_DELAY = 
RaftServerTestUtil.getLogSyncDelay();
 
   {
     getProperties().setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY,
@@ -430,7 +430,7 @@ public abstract class RaftAsyncTests<CLUSTER extends 
MiniRaftCluster> extends Ba
       cluster.getServerAliveStream()
           .filter(impl -> !impl.getInfo().isLeader())
           .map(SimpleStateMachine4Testing::get)
-          .forEach(peer -> logSyncDelay.setDelayMs(peer.getId().toString(), 
1000));
+          .forEach(peer -> LOG_SYNC_DELAY.setDelayMs(peer.getId().toString(), 
1000));
 
       // trigger append entries request
       client.async().send(new SimpleMessage("abc"));
@@ -446,7 +446,7 @@ public abstract class RaftAsyncTests<CLUSTER extends 
MiniRaftCluster> extends Ba
 
     } finally {
       // unblock append entries request
-      logSyncDelay.clear();
+      LOG_SYNC_DELAY.clear();
     }
 
     waitForLeader(cluster);
diff --git a/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java 
b/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
index 024a60d3a..2c1d34e27 100644
--- a/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
+++ b/ratis-server/src/test/java/org/apache/ratis/RaftTestUtil.java
@@ -407,8 +407,8 @@ public interface RaftTestUtil {
   }
 
   class SimpleOperation {
-    private static final ClientId clientId = ClientId.randomId();
-    private static final AtomicLong callId = new AtomicLong();
+    private static final ClientId CLIENT_ID = ClientId.randomId();
+    private static final AtomicLong CALL_ID = new AtomicLong();
 
     private final String op;
     private final StateMachineLogEntryProto smLogEntryProto;
@@ -418,7 +418,7 @@ public interface RaftTestUtil {
     }
 
     public SimpleOperation(String op, boolean hasStateMachineData) {
-      this(clientId, callId.incrementAndGet(), op, hasStateMachineData);
+      this(CLIENT_ID, CALL_ID.incrementAndGet(), op, hasStateMachineData);
     }
 
     private SimpleOperation(ClientId clientId, long callId, String op, boolean 
hasStateMachineData) {
diff --git a/ratis-server/src/test/java/org/apache/ratis/WatchRequestTests.java 
b/ratis-server/src/test/java/org/apache/ratis/WatchRequestTests.java
index a9bdd1a3a..6f381ca13 100644
--- a/ratis-server/src/test/java/org/apache/ratis/WatchRequestTests.java
+++ b/ratis-server/src/test/java/org/apache/ratis/WatchRequestTests.java
@@ -49,14 +49,12 @@ import org.slf4j.Logger;
 import org.slf4j.event.Level;
 
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.List;
 import java.util.concurrent.CompletableFuture;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
-import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
 import static org.junit.Assert.fail;
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/server/impl/GroupManagementBaseTest.java
 
b/ratis-server/src/test/java/org/apache/ratis/server/impl/GroupManagementBaseTest.java
index 311a2150d..30f9f7579 100644
--- 
a/ratis-server/src/test/java/org/apache/ratis/server/impl/GroupManagementBaseTest.java
+++ 
b/ratis-server/src/test/java/org/apache/ratis/server/impl/GroupManagementBaseTest.java
@@ -63,20 +63,20 @@ public abstract class GroupManagementBaseTest extends 
BaseTest {
     Slf4jUtils.setLogLevel(RaftClient.LOG, Level.DEBUG);
   }
 
-  static final RaftProperties prop = new RaftProperties();
+  static final RaftProperties PROP = new RaftProperties();
 
   static {
     // avoid flaky behaviour in CI environment
-    RaftServerConfigKeys.Rpc.setTimeoutMin(prop, TimeDuration.valueOf(1500, 
TimeUnit.MILLISECONDS));
-    RaftServerConfigKeys.Rpc.setTimeoutMax(prop, TimeDuration.valueOf(2000, 
TimeUnit.MILLISECONDS));
+    RaftServerConfigKeys.Rpc.setTimeoutMin(PROP, TimeDuration.valueOf(1500, 
TimeUnit.MILLISECONDS));
+    RaftServerConfigKeys.Rpc.setTimeoutMax(PROP, TimeDuration.valueOf(2000, 
TimeUnit.MILLISECONDS));
     // it takes 5s+ to finish the blocking group add call
-    RaftClientConfigKeys.Rpc.setRequestTimeout(prop, TimeDuration.valueOf(12, 
TimeUnit.SECONDS));
+    RaftClientConfigKeys.Rpc.setRequestTimeout(PROP, TimeDuration.valueOf(12, 
TimeUnit.SECONDS));
   }
 
   public abstract MiniRaftCluster.Factory<? extends MiniRaftCluster> 
getClusterFactory();
 
   public MiniRaftCluster getCluster(int peerNum) {
-    return getClusterFactory().newCluster(peerNum, prop);
+    return getClusterFactory().newCluster(peerNum, PROP);
   }
 
   @Test
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java 
b/ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java
index 933a995cc..29f1f84cb 100644
--- 
a/ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java
+++ 
b/ratis-server/src/test/java/org/apache/ratis/server/impl/MiniRaftCluster.java
@@ -93,14 +93,14 @@ public abstract class MiniRaftCluster implements Closeable {
       TimeDuration.valueOf(100, TimeUnit.MILLISECONDS);
   static final AtomicInteger THREAD_COUNT = new AtomicInteger(0);
 
-  public static abstract class Factory<CLUSTER extends MiniRaftCluster> {
+  public abstract static class Factory<CLUSTER extends MiniRaftCluster> {
     public interface Get<CLUSTER extends MiniRaftCluster> {
-      Supplier<RaftProperties> properties = 
JavaUtils.memoize(RaftProperties::new);
+      Supplier<RaftProperties> PROPERTIES = 
JavaUtils.memoize(RaftProperties::new);
 
       Factory<CLUSTER> getFactory();
 
       default RaftProperties getProperties() {
-        return properties.get();
+        return PROPERTIES.get();
       }
 
       default RaftProperties setStateMachine(Class<? extends StateMachine> 
stateMachineClass) {
@@ -199,7 +199,7 @@ public abstract class MiniRaftCluster implements Closeable {
     }
   }
 
-  public static abstract class RpcBase extends MiniRaftCluster {
+  public abstract static class RpcBase extends MiniRaftCluster {
     public RpcBase(String[] ids, String[] listenerIds, RaftProperties 
properties, Parameters parameters) {
       super(ids, listenerIds, properties, parameters);
     }
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java
 
b/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java
index 3b8e206de..c8c7fd026 100644
--- 
a/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java
+++ 
b/ratis-server/src/test/java/org/apache/ratis/server/impl/RaftReconfigurationBaseTest.java
@@ -70,8 +70,8 @@ public abstract class RaftReconfigurationBaseTest<CLUSTER 
extends MiniRaftCluste
     Slf4jUtils.setLogLevel(RaftServer.Division.LOG, Level.DEBUG);
   }
 
-  private static final DelayLocalExecutionInjection logSyncDelay = 
RaftServerTestUtil.getLogSyncDelay();
-  private static final DelayLocalExecutionInjection leaderPlaceHolderDelay =
+  private static final DelayLocalExecutionInjection LOG_SYNC_DELAY = 
RaftServerTestUtil.getLogSyncDelay();
+  private static final DelayLocalExecutionInjection LEADER_PLACE_HOLDER_DELAY =
       new DelayLocalExecutionInjection(LeaderStateImpl.APPEND_PLACEHOLDER);
 
   static final int STAGING_CATCHUP_GAP = 10;
@@ -654,7 +654,7 @@ public abstract class RaftReconfigurationBaseTest<CLUSTER 
extends MiniRaftCluste
 
       // delay every peer's logSync so that the setConf request is delayed
       cluster.getPeers()
-          .forEach(peer -> logSyncDelay.setDelayMs(peer.getId().toString(), 
1000));
+          .forEach(peer -> LOG_SYNC_DELAY.setDelayMs(peer.getId().toString(), 
1000));
 
       final CountDownLatch latch = new CountDownLatch(1);
       final RaftPeer[] peersInRequest2 = cluster.getPeers().toArray(new 
RaftPeer[0]);
@@ -691,7 +691,7 @@ public abstract class RaftReconfigurationBaseTest<CLUSTER 
extends MiniRaftCluste
       Assert.assertTrue(confChanged.get());
       Assert.assertTrue(caughtException.get());
     } finally {
-      logSyncDelay.clear();
+      LOG_SYNC_DELAY.clear();
     }
   }
 
@@ -792,7 +792,7 @@ public abstract class RaftReconfigurationBaseTest<CLUSTER 
extends MiniRaftCluste
     try {
       // delay 1s for each logSync call
       cluster.getServers().forEach(
-          peer -> leaderPlaceHolderDelay.setDelayMs(peer.getId().toString(), 
2000));
+          peer -> 
LEADER_PLACE_HOLDER_DELAY.setDelayMs(peer.getId().toString(), 2000));
       cluster.start();
 
       AtomicBoolean caughtNotReady = new AtomicBoolean(false);
@@ -833,7 +833,7 @@ public abstract class RaftReconfigurationBaseTest<CLUSTER 
extends MiniRaftCluste
       Assert.assertTrue(success.get());
       Assert.assertTrue(caughtNotReady.get());
     } finally {
-      leaderPlaceHolderDelay.clear();
+      LEADER_PLACE_HOLDER_DELAY.clear();
       cluster.shutdown();
     }
   }
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/server/simulation/RaftServerReply.java
 
b/ratis-server/src/test/java/org/apache/ratis/server/simulation/RaftServerReply.java
index 5d9d871f8..8b7f88ed4 100644
--- 
a/ratis-server/src/test/java/org/apache/ratis/server/simulation/RaftServerReply.java
+++ 
b/ratis-server/src/test/java/org/apache/ratis/server/simulation/RaftServerReply.java
@@ -17,7 +17,6 @@
  */
 package org.apache.ratis.server.simulation;
 
-import org.apache.ratis.proto.RaftProtos;
 import org.apache.ratis.protocol.RaftGroupId;
 import org.apache.ratis.protocol.RaftRpcMessage;
 import org.apache.ratis.proto.RaftProtos.AppendEntriesReplyProto;
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/statemachine/RaftSnapshotBaseTest.java
 
b/ratis-server/src/test/java/org/apache/ratis/statemachine/RaftSnapshotBaseTest.java
index 9a716cad3..0351b0587 100644
--- 
a/ratis-server/src/test/java/org/apache/ratis/statemachine/RaftSnapshotBaseTest.java
+++ 
b/ratis-server/src/test/java/org/apache/ratis/statemachine/RaftSnapshotBaseTest.java
@@ -44,7 +44,6 @@ import org.apache.ratis.server.metrics.RaftServerMetricsImpl;
 import org.apache.ratis.server.raftlog.RaftLog;
 import org.apache.ratis.server.raftlog.segmented.LogSegmentPath;
 import org.apache.ratis.proto.RaftProtos.LogEntryProto;
-import org.apache.ratis.server.storage.RaftStorageTestUtils;
 import org.apache.ratis.statemachine.impl.SimpleStateMachine4Testing;
 import org.apache.ratis.statemachine.impl.SimpleStateMachineStorage;
 import org.apache.ratis.util.FileUtils;
diff --git 
a/ratis-server/src/test/java/org/apache/ratis/statemachine/impl/SimpleStateMachine4Testing.java
 
b/ratis-server/src/test/java/org/apache/ratis/statemachine/impl/SimpleStateMachine4Testing.java
index 7dd1db3c7..e2e29238f 100644
--- 
a/ratis-server/src/test/java/org/apache/ratis/statemachine/impl/SimpleStateMachine4Testing.java
+++ 
b/ratis-server/src/test/java/org/apache/ratis/statemachine/impl/SimpleStateMachine4Testing.java
@@ -42,7 +42,6 @@ import org.apache.ratis.server.storage.RaftStorage;
 import org.apache.ratis.statemachine.StateMachine;
 import org.apache.ratis.statemachine.TransactionContext;
 import org.apache.ratis.thirdparty.com.google.protobuf.ByteString;
-import 
org.apache.ratis.thirdparty.com.google.protobuf.InvalidProtocolBufferException;
 import org.apache.ratis.util.Daemon;
 import org.apache.ratis.util.JavaUtils;
 import org.apache.ratis.util.LifeCycle;
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/TestRaftServerNoLeaderTimeout.java 
b/ratis-test/src/test/java/org/apache/ratis/TestRaftServerNoLeaderTimeout.java
index c10dc105a..61bacc3cf 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/TestRaftServerNoLeaderTimeout.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/TestRaftServerNoLeaderTimeout.java
@@ -48,16 +48,16 @@ public class TestRaftServerNoLeaderTimeout extends BaseTest 
{
 
   private static final int NUM_SERVERS = 3;
 
-  private static final RaftProperties properties = new RaftProperties();
+  private static final RaftProperties PROPERTIES = new RaftProperties();
 
   private final MiniRaftClusterWithSimulatedRpc cluster = 
MiniRaftClusterWithSimulatedRpc
       .FACTORY.newCluster(NUM_SERVERS, getProperties());
 
   private static RaftProperties getProperties() {
-    RaftServerConfigKeys.Notification.setNoLeaderTimeout(properties, 
TimeDuration.valueOf(1, TimeUnit.SECONDS));
-    properties.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY,
+    RaftServerConfigKeys.Notification.setNoLeaderTimeout(PROPERTIES, 
TimeDuration.valueOf(1, TimeUnit.SECONDS));
+    PROPERTIES.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY,
         SimpleStateMachine4Testing.class, StateMachine.class);
-    return properties;
+    return PROPERTIES;
   }
 
   @BeforeEach
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/TestRaftServerSlownessDetection.java
 
b/ratis-test/src/test/java/org/apache/ratis/TestRaftServerSlownessDetection.java
index b150a1aa0..fd4aa1e06 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/TestRaftServerSlownessDetection.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/TestRaftServerSlownessDetection.java
@@ -56,17 +56,17 @@ public class TestRaftServerSlownessDetection extends 
BaseTest {
 
   public static final int NUM_SERVERS = 3;
 
-  protected static final RaftProperties properties = new RaftProperties();
+  protected static final RaftProperties PROPERTIES = new RaftProperties();
 
   private final MiniRaftClusterWithSimulatedRpc cluster = 
MiniRaftClusterWithSimulatedRpc
       .FACTORY.newCluster(NUM_SERVERS, getProperties());
 
   public RaftProperties getProperties() {
     RaftServerConfigKeys.Rpc
-        .setSlownessTimeout(properties, TimeDuration.valueOf(1, 
TimeUnit.SECONDS));
-    properties.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY,
+        .setSlownessTimeout(PROPERTIES, TimeDuration.valueOf(1, 
TimeUnit.SECONDS));
+    PROPERTIES.setClass(MiniRaftCluster.STATEMACHINE_CLASS_KEY,
         SimpleStateMachine4Testing.class, StateMachine.class);
-    return properties;
+    return PROPERTIES;
   }
 
   @BeforeEach
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/grpc/TestLeaderElectionWithGrpc.java
 
b/ratis-test/src/test/java/org/apache/ratis/grpc/TestLeaderElectionWithGrpc.java
index ef6bc2a86..797124bc1 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/grpc/TestLeaderElectionWithGrpc.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/grpc/TestLeaderElectionWithGrpc.java
@@ -30,7 +30,7 @@ public class TestLeaderElectionWithGrpc
   public void testEnforceLeader() throws Exception {
     super.testEnforceLeader();
 
-    MiniRaftClusterWithGrpc.sendServerRequestInjection.clear();
+    MiniRaftClusterWithGrpc.SEND_SERVER_REQUEST_INJECTION.clear();
     BlockRequestHandlingInjection.getInstance().unblockAll();
   }
 
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/grpc/util/TestGrpcZeroCopy.java 
b/ratis-test/src/test/java/org/apache/ratis/grpc/util/TestGrpcZeroCopy.java
index a5f61ee26..9ffe7ecd0 100644
--- a/ratis-test/src/test/java/org/apache/ratis/grpc/util/TestGrpcZeroCopy.java
+++ b/ratis-test/src/test/java/org/apache/ratis/grpc/util/TestGrpcZeroCopy.java
@@ -39,26 +39,26 @@ import java.util.concurrent.CompletableFuture;
  */
 public final class TestGrpcZeroCopy extends BaseTest {
   static class RandomData {
-    private static final Random random = new Random();
-    private static final byte[] array = new byte[4096];
+    private static final Random RANDOM = new Random();
+    private static final byte[] ARRAY = new byte[4096];
 
     static void fill(long seed, int size, ByteBuf buf) {
-      random.setSeed(seed);
+      RANDOM.setSeed(seed);
       for(int offset = 0; offset < size; ) {
-        final int remaining = Math.min(size - offset, array.length);
-        random.nextBytes(array);
-        buf.writeBytes(array, 0, remaining);
+        final int remaining = Math.min(size - offset, ARRAY.length);
+        RANDOM.nextBytes(ARRAY);
+        buf.writeBytes(ARRAY, 0, remaining);
         offset += remaining;
       }
     }
 
     static void verify(long seed, ByteString b) {
-      random.setSeed(seed);
+      RANDOM.setSeed(seed);
       final int size = b.size();
       for(int offset = 0; offset < size; ) {
-        final int remaining = Math.min(size - offset, array.length);
-        random.nextBytes(array);
-        final ByteString expected = UnsafeByteOperations.unsafeWrap(array, 0, 
remaining);
+        final int remaining = Math.min(size - offset, ARRAY.length);
+        RANDOM.nextBytes(ARRAY);
+        final ByteString expected = UnsafeByteOperations.unsafeWrap(ARRAY, 0, 
remaining);
         final ByteString computed = b.substring(offset, offset + remaining);
         Assertions.assertEquals(expected.size(), computed.size());
         Assertions.assertEquals(expected, computed);
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/netty/TestLeaderElectionWithNetty.java
 
b/ratis-test/src/test/java/org/apache/ratis/netty/TestLeaderElectionWithNetty.java
index f3b760bf2..0b77b5bed 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/netty/TestLeaderElectionWithNetty.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/netty/TestLeaderElectionWithNetty.java
@@ -29,7 +29,7 @@ public class TestLeaderElectionWithNetty
   public void testEnforceLeader() throws Exception {
     super.testEnforceLeader();
 
-    MiniRaftClusterWithNetty.sendServerRequest.clear();
+    MiniRaftClusterWithNetty.SEND_SERVER_REQUEST.clear();
     BlockRequestHandlingInjection.getInstance().unblockAll();
   }
 
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/netty/TestTlsConfWithNetty.java 
b/ratis-test/src/test/java/org/apache/ratis/netty/TestTlsConfWithNetty.java
index 77910b248..dbdcf1ebd 100644
--- a/ratis-test/src/test/java/org/apache/ratis/netty/TestTlsConfWithNetty.java
+++ b/ratis-test/src/test/java/org/apache/ratis/netty/TestTlsConfWithNetty.java
@@ -58,7 +58,7 @@ import java.util.concurrent.TimeUnit;
  * Testing {@link TlsConf} and the security related utility methods in {@link 
NettyUtils}.
  */
 public class TestTlsConfWithNetty {
-  private final static Logger LOG = 
LoggerFactory.getLogger(TestTlsConfWithNetty.class);
+  private static final Logger LOG = 
LoggerFactory.getLogger(TestTlsConfWithNetty.class);
 
   static String buffer2String(ByteBuf buf){
     try {
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/server/TestRaftServerConfigKeys.java
 
b/ratis-test/src/test/java/org/apache/ratis/server/TestRaftServerConfigKeys.java
index 2026398e3..a9e509e7a 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/server/TestRaftServerConfigKeys.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/server/TestRaftServerConfigKeys.java
@@ -46,14 +46,14 @@ import static 
org.apache.ratis.server.RaftServerConfigKeys.Write.BYTE_LIMIT_KEY;
  */
 public class TestRaftServerConfigKeys {
 
-  private static final Supplier<File> rootTestDir = JavaUtils.memoize(
+  private static final Supplier<File> ROOT_TEST_DIR = JavaUtils.memoize(
       () -> new File(BaseTest.getRootTestDir(),
           JavaUtils.getClassSimpleName(TestRaftServerConfigKeys.class) +
               Integer.toHexString(ThreadLocalRandom.current().nextInt())));
 
   @AfterAll
   public static void tearDown() throws IOException {
-    FileUtils.deleteFully(rootTestDir.get());
+    FileUtils.deleteFully(ROOT_TEST_DIR.get());
   }
 
   /**
@@ -63,7 +63,7 @@ public class TestRaftServerConfigKeys {
   @Test
   public void testStorageDirProperty() {
     final File testDir = new File(
-        rootTestDir.get(), UUID.randomUUID().toString());
+        ROOT_TEST_DIR.get(), UUID.randomUUID().toString());
     final List<File> directories = new ArrayList<>();
     final  RaftProperties properties = new RaftProperties();
 
@@ -84,7 +84,7 @@ public class TestRaftServerConfigKeys {
   @Test
   public void testStorageDir() {
     final File testDir = new File(
-        rootTestDir.get(), UUID.randomUUID().toString());
+        ROOT_TEST_DIR.get(), UUID.randomUUID().toString());
     final List<File> directories = new ArrayList<>();
     IntStream.range(0, 10).mapToObj((i) -> new File(testDir,
         Integer.toString(i))).forEach(directories::add);
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/server/impl/TestRaftServerJmx.java 
b/ratis-test/src/test/java/org/apache/ratis/server/impl/TestRaftServerJmx.java
index 6302c7e8b..d549e3781 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/server/impl/TestRaftServerJmx.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/server/impl/TestRaftServerJmx.java
@@ -42,7 +42,7 @@ public class TestRaftServerJmx extends BaseTest {
   @Test
   @Timeout(value = 30)
   public void testJmxBeans() throws Exception {
-    final int NUM_SERVERS = 3;
+    final int numServers = 3;
     final MiniRaftClusterWithSimulatedRpc cluster
         = MiniRaftClusterWithSimulatedRpc.FACTORY.newCluster(3, new 
RaftProperties());
     cluster.start();
@@ -50,7 +50,7 @@ public class TestRaftServerJmx extends BaseTest {
 
     MBeanServer platformMBeanServer = 
ManagementFactory.getPlatformMBeanServer();
     Set<ObjectInstance> objectInstances = platformMBeanServer.queryMBeans(new 
ObjectName("Ratis:*"), null);
-    Assertions.assertEquals(NUM_SERVERS, objectInstances.size());
+    Assertions.assertEquals(numServers, objectInstances.size());
 
     for (ObjectInstance instance : objectInstances) {
       Object groupId = 
platformMBeanServer.getAttribute(instance.getObjectName(), "GroupId");
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestCacheEviction.java
 
b/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestCacheEviction.java
index ee73a7079..ae8bf3432 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestCacheEviction.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestCacheEviction.java
@@ -53,7 +53,7 @@ import java.util.concurrent.CompletableFuture;
 import static 
org.apache.ratis.server.raftlog.segmented.SegmentedRaftLogTestUtils.MAX_OP_SIZE;
 
 public class TestCacheEviction extends BaseTest {
-  private static final CacheInvalidationPolicy policy = new 
CacheInvalidationPolicyDefault();
+  private static final CacheInvalidationPolicy POLICY = new 
CacheInvalidationPolicyDefault();
 
   static LogSegmentList prepareSegments(int numSegments, boolean[] cached, 
long start, long size) {
     Assertions.assertEquals(numSegments, cached.length);
@@ -77,35 +77,35 @@ public class TestCacheEviction extends BaseTest {
         new boolean[]{true, true, true, true, true}, 0, 10);
 
     // case 1, make sure we do not evict cache for segments behind local 
flushed index
-    List<LogSegment> evicted = policy.evict(null, 5, 15, segments, maxCached);
+    List<LogSegment> evicted = POLICY.evict(null, 5, 15, segments, maxCached);
     Assertions.assertEquals(0, evicted.size());
 
     // case 2, suppose the local flushed index is in the 3rd segment, then we
     // can evict the first two segment
-    evicted = policy.evict(null, 25, 30, segments, maxCached);
+    evicted = POLICY.evict(null, 25, 30, segments, maxCached);
     Assertions.assertEquals(2, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(0));
     Assertions.assertSame(evicted.get(1), segments.get(1));
 
     // case 3, similar with case 2, but the local applied index is less than
     // the local flushed index.
-    evicted = policy.evict(null, 25, 15, segments, maxCached);
+    evicted = POLICY.evict(null, 25, 15, segments, maxCached);
     Assertions.assertEquals(1, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(0));
 
     // case 4, the local applied index is very small, then evict cache behind 
it
     // first and let the state machine load the segments later
-    evicted = policy.evict(null, 35, 5, segments, maxCached);
+    evicted = POLICY.evict(null, 35, 5, segments, maxCached);
     Assertions.assertEquals(1, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(2));
 
     Mockito.when(segments.get(2).hasCache()).thenReturn(false);
-    evicted = policy.evict(null, 35, 5, segments, maxCached);
+    evicted = POLICY.evict(null, 35, 5, segments, maxCached);
     Assertions.assertEquals(1, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(1));
 
     Mockito.when(segments.get(1).hasCache()).thenReturn(false);
-    evicted = policy.evict(null, 35, 5, segments, maxCached);
+    evicted = POLICY.evict(null, 35, 5, segments, maxCached);
     Assertions.assertEquals(0, evicted.size());
   }
 
@@ -117,38 +117,38 @@ public class TestCacheEviction extends BaseTest {
 
     // case 1, no matter where the followers are, we do not evict segments 
behind local
     // flushed index
-    List<LogSegment> evicted = policy.evict(new long[]{20, 40, 40}, 5, 15, 
segments,
+    List<LogSegment> evicted = POLICY.evict(new long[]{20, 40, 40}, 5, 15, 
segments,
         maxCached);
     Assertions.assertEquals(0, evicted.size());
 
     // case 2, the follower indices are behind the local flushed index
-    evicted = policy.evict(new long[]{30, 40, 45}, 25, 30, segments, 
maxCached);
+    evicted = POLICY.evict(new long[]{30, 40, 45}, 25, 30, segments, 
maxCached);
     Assertions.assertEquals(2, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(0));
     Assertions.assertSame(evicted.get(1), segments.get(1));
 
     // case 3, similar with case 3 in basic eviction test
-    evicted = policy.evict(new long[]{30, 40, 45}, 25, 15, segments, 
maxCached);
+    evicted = POLICY.evict(new long[]{30, 40, 45}, 25, 15, segments, 
maxCached);
     Assertions.assertEquals(1, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(0));
 
     // case 4, the followers are slower than local flush
-    evicted = policy.evict(new long[]{15, 45, 45}, 55, 50, segments, 
maxCached);
+    evicted = POLICY.evict(new long[]{15, 45, 45}, 55, 50, segments, 
maxCached);
     Assertions.assertEquals(1, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(0));
 
     Mockito.when(segments.get(0).hasCache()).thenReturn(false);
-    evicted = policy.evict(new long[]{15, 45, 45}, 55, 50, segments, 
maxCached);
+    evicted = POLICY.evict(new long[]{15, 45, 45}, 55, 50, segments, 
maxCached);
     Assertions.assertEquals(1, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(2));
 
     Mockito.when(segments.get(2).hasCache()).thenReturn(false);
-    evicted = policy.evict(new long[]{15, 45, 45}, 55, 50, segments, 
maxCached);
+    evicted = POLICY.evict(new long[]{15, 45, 45}, 55, 50, segments, 
maxCached);
     Assertions.assertEquals(1, evicted.size());
     Assertions.assertSame(evicted.get(0), segments.get(3));
 
     Mockito.when(segments.get(3).hasCache()).thenReturn(false);
-    evicted = policy.evict(new long[]{15, 45, 45}, 55, 50, segments, 
maxCached);
+    evicted = POLICY.evict(new long[]{15, 45, 45}, 55, 50, segments, 
maxCached);
     Assertions.assertEquals(0, evicted.size());
   }
 
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLog.java
 
b/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLog.java
index 7b20babf4..5b1a8beec 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLog.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLog.java
@@ -97,9 +97,9 @@ public class TestSegmentedRaftLog extends BaseTest {
     return 
((SegmentedRaftLog)raftLog).getRaftLogCache().getOpenSegment().getTotalFileSize();
   }
 
-  private static final RaftPeerId peerId = RaftPeerId.valueOf("s0");
-  private static final RaftGroupId groupId = RaftGroupId.randomId();
-  private static final RaftGroupMemberId memberId = 
RaftGroupMemberId.valueOf(peerId, groupId);
+  private static final RaftPeerId PEER_ID = RaftPeerId.valueOf("s0");
+  private static final RaftGroupId GROUP_ID = RaftGroupId.randomId();
+  private static final RaftGroupMemberId MEMBER_ID = 
RaftGroupMemberId.valueOf(PEER_ID, GROUP_ID);
 
   static class SegmentRange {
     final long start;
@@ -136,7 +136,7 @@ public class TestSegmentedRaftLog extends BaseTest {
 
   static SegmentedRaftLog newSegmentedRaftLog(RaftStorage storage, 
RaftProperties properties) {
     return SegmentedRaftLog.newBuilder()
-        .setMemberId(memberId)
+        .setMemberId(MEMBER_ID)
         .setStorage(storage)
         .setProperties(properties)
         .build();
@@ -145,7 +145,7 @@ public class TestSegmentedRaftLog extends BaseTest {
   private SegmentedRaftLog newSegmentedRaftLogWithSnapshotIndex(RaftStorage 
storage, RaftProperties properties,
                                                                 LongSupplier 
getSnapshotIndexFromStateMachine) {
     return SegmentedRaftLog.newBuilder()
-        .setMemberId(memberId)
+        .setMemberId(MEMBER_ID)
         .setStorage(storage)
         .setSnapshotIndexSupplier(getSnapshotIndexFromStateMachine)
         .setProperties(properties)
@@ -239,7 +239,7 @@ public class TestSegmentedRaftLog extends BaseTest {
       Assertions.assertArrayEquals(entries, entriesFromLog);
       Assertions.assertEquals(entries[entries.length - 1], 
getLastEntry(raftLog));
 
-      final RatisMetricRegistry metricRegistryForLogWorker = 
RaftLogMetricsBase.createRegistry(memberId);
+      final RatisMetricRegistry metricRegistryForLogWorker = 
RaftLogMetricsBase.createRegistry(MEMBER_ID);
 
       final DefaultTimekeeperImpl load = (DefaultTimekeeperImpl) 
metricRegistryForLogWorker.timer("segmentLoadLatency");
       assertTrue(load.getTimer().getMeanRate() > 0);
@@ -501,7 +501,7 @@ public class TestSegmentedRaftLog extends BaseTest {
     int segmentSize = 200;
     long endIndexOfClosedSegment = segmentSize * (endTerm - startTerm - 1) - 1;
     long expectedIndex = segmentSize * (endTerm - startTerm - 1);
-    final RatisMetricRegistry metricRegistryForLogWorker = 
RaftLogMetricsBase.createRegistry(memberId);
+    final RatisMetricRegistry metricRegistryForLogWorker = 
RaftLogMetricsBase.createRegistry(MEMBER_ID);
     purgeAndVerify(startTerm, endTerm, segmentSize, 1, 
endIndexOfClosedSegment, expectedIndex);
     final DefaultTimekeeperImpl purge = (DefaultTimekeeperImpl) 
metricRegistryForLogWorker.timer("purgeLog");
     assertTrue(purge.getTimer().getCount() > 0);
@@ -546,7 +546,7 @@ public class TestSegmentedRaftLog extends BaseTest {
     List<LogEntryProto> entries = prepareLogEntries(ranges, null);
 
     final RetryCache retryCache = RetryCacheTestUtil.createRetryCache();
-    try (SegmentedRaftLog raftLog = 
RetryCacheTestUtil.newSegmentedRaftLog(memberId, retryCache, storage, 
properties)) {
+    try (SegmentedRaftLog raftLog = 
RetryCacheTestUtil.newSegmentedRaftLog(MEMBER_ID, retryCache, storage, 
properties)) {
       raftLog.open(RaftLog.INVALID_LOG_INDEX, null);
       entries.forEach(entry -> RetryCacheTestUtil.createEntry(retryCache, 
entry));
       // append entries to the raftlog
@@ -561,7 +561,7 @@ public class TestSegmentedRaftLog extends BaseTest {
     List<LogEntryProto> newEntries = prepareLogEntries(
         Arrays.asList(r1, r2, r3), null);
 
-    try (SegmentedRaftLog raftLog = 
RetryCacheTestUtil.newSegmentedRaftLog(memberId, retryCache, storage, 
properties)) {
+    try (SegmentedRaftLog raftLog = 
RetryCacheTestUtil.newSegmentedRaftLog(MEMBER_ID, retryCache, storage, 
properties)) {
       raftLog.open(RaftLog.INVALID_LOG_INDEX, null);
       LOG.info("newEntries[0] = {}", newEntries.get(0));
       final int last = newEntries.size() - 1;
@@ -578,7 +578,7 @@ public class TestSegmentedRaftLog extends BaseTest {
     }
 
     // load the raftlog again and check
-    try (SegmentedRaftLog raftLog = 
RetryCacheTestUtil.newSegmentedRaftLog(memberId, retryCache, storage, 
properties)) {
+    try (SegmentedRaftLog raftLog = 
RetryCacheTestUtil.newSegmentedRaftLog(MEMBER_ID, retryCache, storage, 
properties)) {
       raftLog.open(RaftLog.INVALID_LOG_INDEX, null);
       checkEntries(raftLog, entries, 0, 650);
       checkEntries(raftLog, newEntries, 100, 100);
@@ -602,7 +602,7 @@ public class TestSegmentedRaftLog extends BaseTest {
 
     final SimpleStateMachine4Testing sm = new SimpleStateMachine4Testing();
     try (SegmentedRaftLog raftLog = SegmentedRaftLog.newBuilder()
-        .setMemberId(memberId)
+        .setMemberId(MEMBER_ID)
         .setStateMachine(sm)
         .setStorage(storage)
         .setProperties(properties)
@@ -675,7 +675,7 @@ public class TestSegmentedRaftLog extends BaseTest {
 
     ExecutionException ex;
     try (SegmentedRaftLog raftLog = SegmentedRaftLog.newBuilder()
-        .setMemberId(memberId)
+        .setMemberId(MEMBER_ID)
         .setStateMachine(sm)
         .setStorage(storage)
         .setProperties(properties)
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLogCache.java
 
b/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLogCache.java
index 87172323d..9f0df2fab 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLogCache.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/server/raftlog/segmented/TestSegmentedRaftLogCache.java
@@ -43,7 +43,7 @@ import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
 public class TestSegmentedRaftLogCache {
-  private static final RaftProperties prop = new RaftProperties();
+  private static final RaftProperties PROP = new RaftProperties();
 
   private SegmentedRaftLogCache cache;
   private SegmentedRaftLogMetrics raftLogMetrics;
@@ -53,7 +53,7 @@ public class TestSegmentedRaftLogCache {
   public void setup() {
     raftLogMetrics = new 
SegmentedRaftLogMetrics(RaftServerTestUtil.TEST_MEMBER_ID);
     ratisMetricRegistry = (RatisMetricRegistryImpl) 
raftLogMetrics.getRegistry();
-    cache = new SegmentedRaftLogCache(null, null, prop, raftLogMetrics);
+    cache = new SegmentedRaftLogCache(null, null, PROP, raftLogMetrics);
   }
 
   @AfterEach
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/server/storage/TestStorageImplUtils.java
 
b/ratis-test/src/test/java/org/apache/ratis/server/storage/TestStorageImplUtils.java
index 4f75f793f..905fc0345 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/server/storage/TestStorageImplUtils.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/server/storage/TestStorageImplUtils.java
@@ -43,7 +43,7 @@ import java.util.stream.IntStream;
  */
 public class TestStorageImplUtils extends BaseTest {
 
-  private static final Supplier<File> rootTestDir = JavaUtils.memoize(
+  private static final Supplier<File> ROOT_TEST_DIR = JavaUtils.memoize(
       () -> new File(BaseTest.getRootTestDir(),
           JavaUtils.getClassSimpleName(TestStorageImplUtils.class) +
               Integer.toHexString(ThreadLocalRandom.current().nextInt())));
@@ -57,7 +57,7 @@ public class TestStorageImplUtils extends BaseTest {
 
   @AfterAll
   public static void tearDown() throws IOException {
-    FileUtils.deleteFully(rootTestDir.get());
+    FileUtils.deleteFully(ROOT_TEST_DIR.get());
   }
 
   /**
@@ -67,7 +67,7 @@ public class TestStorageImplUtils extends BaseTest {
    */
   @Test
   public void testChooseStorageDirWithOneVolume() throws IOException {
-    File testDir = new File(rootTestDir.get(), UUID.randomUUID().toString());
+    File testDir = new File(ROOT_TEST_DIR.get(), UUID.randomUUID().toString());
     List<File> directories = Collections.singletonList(testDir);
     String subDirOne = UUID.randomUUID().toString();
     String subDirTwo = UUID.randomUUID().toString();
@@ -88,7 +88,7 @@ public class TestStorageImplUtils extends BaseTest {
    */
   @Test
   public void testChooseStorageDirWithMultipleVolumes() throws IOException {
-    File testDir = new File(rootTestDir.get(), UUID.randomUUID().toString());
+    File testDir = new File(ROOT_TEST_DIR.get(), UUID.randomUUID().toString());
     List<File> directories = new ArrayList<>();
     IntStream.range(0, 10).mapToObj((i) -> new File(testDir,
         Integer.toString(i))).forEach((dir) -> {
@@ -136,7 +136,7 @@ public class TestStorageImplUtils extends BaseTest {
    */
   @Test
   public void testAutoFormatSingleDirectory() throws Exception {
-    final File testDir = new File(rootTestDir.get(), 
UUID.randomUUID().toString());
+    final File testDir = new File(ROOT_TEST_DIR.get(), 
UUID.randomUUID().toString());
     FileUtils.createDirectories(testDir);
 
     final RaftProperties properties = new RaftProperties();
@@ -153,7 +153,7 @@ public class TestStorageImplUtils extends BaseTest {
    */
   @Test
   public void testAutoFormatMultiDirectories() throws Exception {
-    final File testDir = new File(rootTestDir.get(), 
UUID.randomUUID().toString());
+    final File testDir = new File(ROOT_TEST_DIR.get(), 
UUID.randomUUID().toString());
     final List<File> directories = new ArrayList<>();
     IntStream.range(0, 3).mapToObj((i) -> new File(testDir,
         Integer.toString(i))).forEach((dir) -> {
diff --git 
a/ratis-test/src/test/java/org/apache/ratis/shell/cli/sh/GroupCommandIntegrationTest.java
 
b/ratis-test/src/test/java/org/apache/ratis/shell/cli/sh/GroupCommandIntegrationTest.java
index 6900d4804..c020075e7 100644
--- 
a/ratis-test/src/test/java/org/apache/ratis/shell/cli/sh/GroupCommandIntegrationTest.java
+++ 
b/ratis-test/src/test/java/org/apache/ratis/shell/cli/sh/GroupCommandIntegrationTest.java
@@ -124,18 +124,18 @@ public abstract class GroupCommandIntegrationTest<CLUSTER 
extends MiniRaftCluste
     String info = result.substring(0, hearder.length());
     Assertions.assertEquals(hearder, info);
     long currentTerm = leader.getInfo().getCurrentTerm();
-    String LogInfoProtoFormat = "%s {" + NEW_LINE + "  term: " + currentTerm + 
NEW_LINE + "  index: %s";
+    String logInfoProtoFormat = "%s {" + NEW_LINE + "  term: " + currentTerm + 
NEW_LINE + "  index: %s";
     Assertions.assertTrue(result.contains(
-        String.format(LogInfoProtoFormat, "applied",
+        String.format(logInfoProtoFormat, "applied",
             leader.getStateMachine().getLastAppliedTermIndex().getIndex())));
     Assertions.assertTrue(result.contains(
-        String.format(LogInfoProtoFormat, "committed",
+        String.format(logInfoProtoFormat, "committed",
             leader.getRaftLog().getLastCommittedIndex())));
     Assertions.assertTrue(result.contains(
-        String.format(LogInfoProtoFormat, "lastSnapshot",
+        String.format(logInfoProtoFormat, "lastSnapshot",
             leader.getStateMachine().getLatestSnapshot().getIndex())));
     Assertions.assertTrue(result.contains(
-        String.format(LogInfoProtoFormat, "lastEntry",
+        String.format(logInfoProtoFormat, "lastEntry",
             leader.getRaftLog().getLastCommittedIndex())));
   }
 

Reply via email to