提交 03adb63c 编写于 作者: E ezlippi.ouyang

feat: add some test case

上级 33a533b3
......@@ -11,20 +11,33 @@ public class NettyClientConfigTest {
@Test
public void testChangeConfigBySystemProperty() throws NoSuchFieldException, IllegalAccessException {
System.setProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_WORKER_SIZE, "1");
System.setProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_ONEWAY_SEMAPHORE_VALUE, "1023");
System.setProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_ASYNC_SEMAPHORE_VALUE, "1024");
System.setProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_CONNECT_TIMEOUT, "2000");
System.setProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_CHANNEL_MAX_IDLE_SECONDS, "60");
System.setProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_SOCKET_SNDBUF_SIZE, "16383");
System.setProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_SOCKET_RCVBUF_SIZE, "16384");
System.setProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_CLOSE_SOCKET_IF_TIMEOUT, "false");
NettySystemConfig.socketSndbufSize =
Integer.parseInt(System.getProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_SOCKET_SNDBUF_SIZE, "65535"));
NettySystemConfig.socketRcvbufSize =
Integer.parseInt(System.getProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_SOCKET_RCVBUF_SIZE, "65535"));
NettySystemConfig.clientWorkerSize =
Integer.parseInt(System.getProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_WORKER_SIZE, "4"));
NettySystemConfig.connectTimeoutMillis =
Integer.parseInt(System.getProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_CONNECT_TIMEOUT, "3000"));
NettySystemConfig.clientChannelMaxIdleTimeSeconds =
Integer.parseInt(System.getProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_CHANNEL_MAX_IDLE_SECONDS, "120"));
NettySystemConfig.clientCloseSocketIfTimeout =
Boolean.parseBoolean(System.getProperty(NettySystemConfig.COM_ROCKETMQ_REMOTING_CLIENT_CLOSE_SOCKET_IF_TIMEOUT, "true"));
NettyClientConfig changedConfig = new NettyClientConfig();
assertThat(changedConfig.getClientWorkerThreads()).isEqualTo(1);
assertThat(changedConfig.getClientOnewaySemaphoreValue()).isEqualTo(1023);
assertThat(changedConfig.getClientAsyncSemaphoreValue()).isEqualTo(1024);
assertThat(changedConfig.getClientOnewaySemaphoreValue()).isEqualTo(65535);
assertThat(changedConfig.getClientAsyncSemaphoreValue()).isEqualTo(65535);
assertThat(changedConfig.getConnectTimeoutMillis()).isEqualTo(2000);
assertThat(changedConfig.getClientChannelMaxIdleTimeSeconds()).isEqualTo(60);
assertThat(changedConfig.getClientSocketSndBufSize()).isEqualTo(16383);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册