Search in sources :

Example 1 with DemoService

use of org.apache.dubbo.qos.legacy.service.DemoService in project dubbo by alibaba.

the class ListTelnetHandlerTest method testListService.

@Test
public void testListService() throws RemotingException {
    mockChannel = mock(Channel.class);
    given(mockChannel.getAttribute("telnet.service")).willReturn(DemoService.class.getName());
    registerProvider(DemoService.class.getName(), new DemoServiceImpl(), DemoService.class);
    String result = list.telnet(mockChannel, "DemoService");
    for (Method method : DemoService.class.getMethods()) {
        assertTrue(result.contains(method.getName()));
    }
}
Also used : Channel(org.apache.dubbo.remoting.Channel) DemoService(org.apache.dubbo.qos.legacy.service.DemoService) Method(java.lang.reflect.Method) DemoServiceImpl(org.apache.dubbo.qos.legacy.service.DemoServiceImpl) Test(org.junit.jupiter.api.Test)

Example 2 with DemoService

use of org.apache.dubbo.qos.legacy.service.DemoService in project dubbo by alibaba.

the class ListTelnetHandlerTest method testListDetailService.

@Test
public void testListDetailService() throws RemotingException {
    mockChannel = mock(Channel.class);
    given(mockChannel.getAttribute("telnet.service")).willReturn(DemoService.class.getName());
    registerProvider(DemoService.class.getName(), new DemoServiceImpl(), DemoService.class);
    String result = list.telnet(mockChannel, "-l DemoService");
    for (Method method : DemoService.class.getMethods()) {
        assertTrue(result.contains(ReflectUtils.getName(method)));
    }
}
Also used : Channel(org.apache.dubbo.remoting.Channel) DemoService(org.apache.dubbo.qos.legacy.service.DemoService) Method(java.lang.reflect.Method) DemoServiceImpl(org.apache.dubbo.qos.legacy.service.DemoServiceImpl) Test(org.junit.jupiter.api.Test)

Aggregations

Method (java.lang.reflect.Method)2 DemoService (org.apache.dubbo.qos.legacy.service.DemoService)2 DemoServiceImpl (org.apache.dubbo.qos.legacy.service.DemoServiceImpl)2 Channel (org.apache.dubbo.remoting.Channel)2 Test (org.junit.jupiter.api.Test)2