test_class.declarator: change = new ChangeTelnetHandler()
test_class.modifier: private static
test_class.original_string: private static TelnetHandler change = new ChangeTelnetHandler();
test_class.type: TelnetHandler
test_class.var_name: change
test_class.declarator: mockChannel
test_class.modifier: private
test_class.original_string: private Channel mockChannel;
test_class.type: Channel
test_class.var_name: mockChannel
test_class.declarator: mockInvoker
test_class.modifier: private
test_class.original_string: private Invoker<DemoService> mockInvoker;
test_class.type: Invoker<DemoService>
test_class.var_name: mockInvoker
test_class.file: dubbo-plugin/dubbo-qos/src/test/java/org/apache/dubbo/qos/legacy/ChangeTelnetHandlerTest.java
test_class.identifier: ChangeTelnetHandlerTest
test_case.body: @Test
      public void testChangeServiceNotExport() throws RemotingException {
          String result = change.telnet(mockChannel, "demo");
          assertEquals("No such service demo", result);
      }
test_case.class_method_signature: ChangeTelnetHandlerTest.testChangeServiceNotExport()
test_case.full_signature: @Test public void testChangeServiceNotExport()
test_case.identifier: testChangeServiceNotExport
test_case.invocations: telnet assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testChangeServiceNotExport()
focal_class.declarator: SERVICE_KEY = "telnet.service"
focal_class.modifier: public static final
focal_class.original_string: public static final String SERVICE_KEY = "telnet.service";
focal_class.type: String
focal_class.var_name: SERVICE_KEY
focal_class.file: dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/legacy/ChangeTelnetHandler.java
focal_class.identifier: ChangeTelnetHandler
focal_class.interfaces: implements TelnetHandler
focal_class.class_method_signature: ChangeTelnetHandler.telnet(Channel channel, String message)
focal_class.full_signature: @Override public String telnet(Channel channel, String message)
focal_class.identifier: telnet
focal_class.modifiers: @Override public
focal_class.parameters: (Channel channel, String message)
focal_class.return: String
focal_class.signature: String telnet(Channel channel, String message)
focal_method.body: @Override
      public String telnet(Channel channel, String message) {
          if (message == null || message.length() == 0) {
              return "Please input service name, eg: \r\ncd XxxService\r\ncd com.xxx.XxxService";
          }
          StringBuilder buf = new StringBuilder();
          if ("/".equals(message) || "..".equals(message)) {
              String service = (String) channel.getAttribute(SERVICE_KEY);
              channel.removeAttribute(SERVICE_KEY);
              buf.append("Cancelled default service ").append(service).append(".");
          } else {
              boolean found = false;
              for (Exporter<?> exporter : DubboProtocol.getDubboProtocol().getExporters()) {
                  if (message.equals(exporter.getInvoker().getInterface().getSimpleName())
                          || message.equals(exporter.getInvoker().getInterface().getName())
                          || message.equals(exporter.getInvoker().getUrl().getPath())) {
                      found = true;
                      break;
                  }
              }
              if (found) {
                  channel.setAttribute(SERVICE_KEY, message);
                  buf.append("Used the ").append(message).append(" as default.\r\nYou can cancel default service by command: cd /");
              } else {
                  buf.append("No such service ").append(message);
              }
          }
          return buf.toString();
      }
focal_method.class_method_signature: ChangeTelnetHandler.telnet(Channel channel, String message)
focal_method.full_signature: @Override public String telnet(Channel channel, String message)
focal_method.identifier: telnet
focal_method.invocations: length equals equals getAttribute removeAttribute append append append getExporters getDubboProtocol equals getSimpleName getInterface getInvoker equals getName getInterface getInvoker equals getPath getUrl getInvoker setAttribute append append append append append toString
focal_method.modifiers: @Override public
focal_method.parameters: (Channel channel, String message)
focal_method.return: String
focal_method.signature: String telnet(Channel channel, String message)