use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class InvokerTelnetHandlerTest method testOverriddenMethodWithSpecifyParamType.
@SuppressWarnings("unchecked")
@Test
public void testOverriddenMethodWithSpecifyParamType() throws RemotingException {
mockChannel = mock(Channel.class);
given(mockChannel.getAttribute("telnet.service")).willReturn(DemoService.class.getName());
given(mockChannel.getLocalAddress()).willReturn(NetUtils.toAddress("127.0.0.1:5555"));
given(mockChannel.getRemoteAddress()).willReturn(NetUtils.toAddress("127.0.0.1:20886"));
registerProvider(DemoService.class.getName(), new DemoServiceImpl(), DemoService.class);
String result = invoke.telnet(mockChannel, "getPerson({\"name\":\"zhangsan\",\"age\":12,\"class\":\"org.apache.dubbo.qos.legacy.service.Person\"})");
assertTrue(result.contains("result: 12"));
}
use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl 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()));
}
}
use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class ListTelnetHandlerTest method testListDetail.
@Test
public void testListDetail() throws RemotingException {
mockChannel = mock(Channel.class);
given(mockChannel.getAttribute("telnet.service")).willReturn(null);
registerProvider(DemoService.class.getName(), new DemoServiceImpl(), DemoService.class);
String result = list.telnet(mockChannel, "-l");
assertEquals("PROVIDER:\r\norg.apache.dubbo.qos.legacy.service.DemoService -> published: N\r\n", result);
}
use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl 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)));
}
}
use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class ListTelnetHandlerTest method testListDefault.
@Test
public void testListDefault() 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, "");
assertTrue(result.startsWith("Use default service org.apache.dubbo.qos.legacy.service.DemoService.\r\n" + "org.apache.dubbo.qos.legacy.service.DemoService (as provider):\r\n"));
for (Method method : DemoService.class.getMethods()) {
assertTrue(result.contains(method.getName()));
}
}
Aggregations