use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class ListTelnetHandlerTest method testList.
@Test
public void testList() 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, "");
assertEquals("PROVIDER:\r\norg.apache.dubbo.qos.legacy.service.DemoService\r\n", result);
}
use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class SelectTelnetHandlerTest method testInvokeWithNull.
@Test
public void testInvokeWithNull() throws RemotingException {
mockChannel = mock(Channel.class);
given(mockChannel.getAttribute("telnet.service")).willReturn(DemoService.class.getName());
given(mockChannel.getAttribute(InvokeTelnetHandler.INVOKE_METHOD_LIST_KEY)).willReturn(methods);
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 = select.telnet(mockChannel, null);
assertTrue(result.contains("Please input the index of the method you want to invoke"));
}
use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class InvokerTelnetHandlerTest method testInvokeDefaultService.
@SuppressWarnings("unchecked")
@Test
public void testInvokeDefaultService() 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, "echo(\"ok\")");
assertTrue(result.contains("result: \"ok\""));
}
use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class InvokerTelnetHandlerTest method testInvokeWithSpecifyService.
@SuppressWarnings("unchecked")
@Test
public void testInvokeWithSpecifyService() throws RemotingException {
mockChannel = mock(Channel.class);
given(mockChannel.getAttribute("telnet.service")).willReturn(null);
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, "DemoService.echo(\"ok\")");
assertTrue(result.contains("result: \"ok\""));
}
use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class InvokerTelnetHandlerTest method testInvokeMultiJsonParamMethod.
@Test
public void testInvokeMultiJsonParamMethod() throws RemotingException {
mockChannel = mock(Channel.class);
given(mockChannel.getAttribute("telnet.service")).willReturn(null);
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 param = "{\"name\":\"Dubbo\",\"age\":8},{\"name\":\"Apache\",\"age\":20}";
String result = invoke.telnet(mockChannel, "getPerson(" + param + ")");
assertTrue(result.contains("result: 28"));
}
Aggregations