use of org.apache.dubbo.qos.legacy.service.DemoServiceImpl in project dubbo by alibaba.
the class InvokerTelnetHandlerTest method testInvokeOverriddenMethodBySelect.
@Test
public void testInvokeOverriddenMethodBySelect() throws RemotingException {
// create a real instance to keep the attribute values;
mockChannel = spy(getChannelInstance());
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 param = "{\"name\":\"Dubbo\",\"age\":8}";
String result = invoke.telnet(mockChannel, "getPerson(" + param + ")");
assertTrue(result.contains("Please use the select command to select the method you want to invoke. eg: select 1"));
result = select.telnet(mockChannel, "1");
// result dependent on method order.
assertTrue(result.contains("result: 8") || result.contains("result: \"Dubbo\""));
result = select.telnet(mockChannel, "2");
assertTrue(result.contains("result: 8") || result.contains("result: \"Dubbo\""));
}
Aggregations