[ISSUE #5216] Enable checkstyle for test code (rocketmq-controller, rocketmq-remoting and rocketmq-proxy) (#5218)

* style(remoting):Enable checkstyle for test code

* style(controller):Enable checkstyle for test code

* style(proxy):Enable checkstyle for test code
This commit is contained in:
Nowinkey
2022-09-29 11:46:00 +08:00
committed by GitHub
parent 0e16aa261d
commit 0ad7db6956
15 changed files with 159 additions and 96 deletions
@@ -104,7 +104,6 @@ public class ControllerManagerTest {
for (ControllerManager controllerManager : controllers) {
final DLedgerController controller = (DLedgerController) controllerManager.getController();
if (controller.getMemberState().getSelfId().equals(leaderId) && controller.isLeaderState()) {
System.out.println("New leader " + leaderId);
return controllerManager;
}
}
@@ -169,7 +168,6 @@ public class ControllerManagerTest {
heartbeatRequestHeader.setBrokerName("broker1");
heartbeatRequestHeader.setBrokerAddr("127.0.0.1:8001");
final RemotingCommand request = RemotingCommand.createRequestCommand(RequestCode.BROKER_HEARTBEAT, heartbeatRequestHeader);
System.out.println("send heartbeat success");
try {
final RemotingCommand remotingCommand = this.remotingClient1.invokeSync(leaderAddr, request, 3000);
} catch (Exception e) {
@@ -196,7 +194,6 @@ public class ControllerManagerTest {
controller.shutdown();
}
for (String dir : this.baseDirs) {
System.out.println("Delete file " + dir);
new File(dir).delete();
}
this.remotingClient.shutdown();
@@ -25,9 +25,7 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.common.ControllerConfig;
import org.apache.rocketmq.common.protocol.ResponseCode;
@@ -92,7 +90,6 @@ public class DLedgerControllerTest {
controller.shutdown();
}
for (String dir : this.baseDirs) {
System.out.println("Delete file " + dir);
new File(dir).delete();
}
}
@@ -115,7 +112,6 @@ public class DLedgerControllerTest {
}, item -> item != null);
final RegisterBrokerToControllerResponseHeader registerResult = (RegisterBrokerToControllerResponseHeader) response.readCustomHeader();
System.out.println("------------- Register broker done, the result is :" + registerResult);
if (!isFirstRegisteredBroker) {
assertTrue(registerResult.getBrokerId() > 0);
@@ -151,7 +147,6 @@ public class DLedgerControllerTest {
}
for (DLedgerController controller : controllers) {
if (controller.getMemberState().getSelfId().equals(leaderId) && controller.isLeaderState()) {
System.out.println("New leader " + leaderId);
return controller;
}
}
@@ -41,7 +41,6 @@ public class DefaultBrokerHeartbeatManagerTest {
public void testDetectBrokerAlive() throws InterruptedException {
final CountDownLatch latch = new CountDownLatch(1);
this.heartbeatManager.addBrokerLifecycleListener((clusterName, brokerName, brokerAddress, brokerId) -> {
System.out.println("Broker shutdown:" + brokerAddress);
latch.countDown();
});
this.heartbeatManager.registerBroker("cluster1", "broker1", "127.0.0.1:7000", 1L, 3000L, null, 1, 1L);
@@ -171,9 +171,7 @@ public class ReplicasInfoManagerTest {
mockHeartbeatDataHigherEpoch();
final ControllerResult<ElectMasterResponseHeader> cResult = this.replicasInfoManager.electMaster(request,
electPolicy);
System.out.println(cResult.getResponseCode());
final ElectMasterResponseHeader response = cResult.getResponse();
System.out.println(response);
assertEquals(response.getMasterEpoch(), 2);
assertFalse(response.getNewMasterAddress().isEmpty());
assertEquals("127.0.0.1:9001", response.getNewMasterAddress());
@@ -187,9 +185,7 @@ public class ReplicasInfoManagerTest {
mockHeartbeatDataHigherOffset();
final ControllerResult<ElectMasterResponseHeader> cResult = this.replicasInfoManager.electMaster(request,
electPolicy);
System.out.println(cResult.getResponseCode());
final ElectMasterResponseHeader response = cResult.getResponse();
System.out.println(response);
assertEquals(response.getMasterEpoch(), 2);
assertFalse(response.getNewMasterAddress().isEmpty());
assertEquals("127.0.0.1:9002", response.getNewMasterAddress());