Search in sources :

Example 1 with StatusTelnetHandler

use of org.apache.dubbo.remoting.telnet.support.command.StatusTelnetHandler in project dubbo by alibaba.

the class StatusTelnetHandlerTest method test.

@Test
public void test() {
    Channel channel = Mockito.mock(Channel.class);
    Mockito.when(channel.getUrl()).thenReturn(URL.valueOf("dubbo://127.0.0.1:12345"));
    StatusTelnetHandler statusTelnetHandler = new StatusTelnetHandler();
    Assertions.assertNotNull(statusTelnetHandler.telnet(channel, ""));
    Assertions.assertNotNull(statusTelnetHandler.telnet(channel, "-l"));
    String errorPrompt = "Unsupported parameter ";
    Assertions.assertTrue(statusTelnetHandler.telnet(channel, "other").contains(errorPrompt));
    Mockito.when(channel.getUrl()).thenReturn(URL.valueOf("dubbo://127.0.0.1:12345?status=load,memory"));
    Assertions.assertNotNull(statusTelnetHandler.telnet(channel, ""));
    Assertions.assertNotNull(statusTelnetHandler.telnet(channel, "-l"));
}
Also used : Channel(org.apache.dubbo.remoting.Channel) StatusTelnetHandler(org.apache.dubbo.remoting.telnet.support.command.StatusTelnetHandler) Test(org.junit.jupiter.api.Test)

Aggregations

Channel (org.apache.dubbo.remoting.Channel)1 StatusTelnetHandler (org.apache.dubbo.remoting.telnet.support.command.StatusTelnetHandler)1 Test (org.junit.jupiter.api.Test)1