mirror of
https://github.com/apache/rocketmq.git
synced 2026-09-24 16:04:00 +08:00
[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:
-3
@@ -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();
|
||||
|
||||
-5
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
-1
@@ -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);
|
||||
|
||||
-4
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user