This is an automated email from the ASF dual-hosted git repository.

albumenj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/master by this push:
     new 9022ad9  Fix the problem that it does not work when using telnet for 
online/offline (#7901)
9022ad9 is described below

commit 9022ad9bb0a884d167a7a8e63f5d7e4f7a13d47e
Author: 灼华 <[email protected]>
AuthorDate: Mon May 31 10:04:34 2021 +0800

    Fix the problem that it does not work when using telnet for online/offline 
(#7901)
    
    * Fix the problem that it does not work when using telnet for online/offline
    
    * Add some examples to readyCommand
    
    * Fix unit test
---
 .../main/java/org/apache/dubbo/common/BaseServiceMetadata.java   | 9 +++++++--
 .../java/org/apache/dubbo/common/BaseServiceMetadataTest.java    | 6 +++---
 .../src/main/java/org/apache/dubbo/qos/command/impl/Ready.java   | 5 ++++-
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git 
a/dubbo-common/src/main/java/org/apache/dubbo/common/BaseServiceMetadata.java 
b/dubbo-common/src/main/java/org/apache/dubbo/common/BaseServiceMetadata.java
index a2600f0..16e0488 100644
--- 
a/dubbo-common/src/main/java/org/apache/dubbo/common/BaseServiceMetadata.java
+++ 
b/dubbo-common/src/main/java/org/apache/dubbo/common/BaseServiceMetadata.java
@@ -74,8 +74,13 @@ public class BaseServiceMetadata {
      */
     public String getDisplayServiceKey() {
         StringBuilder serviceNameBuilder = new StringBuilder();
-        serviceNameBuilder.append(serviceInterfaceName);
-        serviceNameBuilder.append(COLON_SEPARATOR).append(version);
+        if(StringUtils.isNotEmpty(serviceInterfaceName)){
+            serviceNameBuilder.append(serviceInterfaceName);
+        }
+
+        if(StringUtils.isNotEmpty(version)){
+            serviceNameBuilder.append(COLON_SEPARATOR).append(version);
+        }
         return serviceNameBuilder.toString();
     }
 
diff --git 
a/dubbo-common/src/test/java/org/apache/dubbo/common/BaseServiceMetadataTest.java
 
b/dubbo-common/src/test/java/org/apache/dubbo/common/BaseServiceMetadataTest.java
index 1075aec..937e7bd 100644
--- 
a/dubbo-common/src/test/java/org/apache/dubbo/common/BaseServiceMetadataTest.java
+++ 
b/dubbo-common/src/test/java/org/apache/dubbo/common/BaseServiceMetadataTest.java
@@ -59,8 +59,8 @@ public class BaseServiceMetadataTest {
         
assertEquals(BaseServiceMetadata.revertDisplayServiceKey("org.apache.dubbo.common.TestInterface:1.0.0").getDisplayServiceKey(),
                 "org.apache.dubbo.common.TestInterface:1.0.0");
         
assertEquals(BaseServiceMetadata.revertDisplayServiceKey("org.apache.dubbo.common.TestInterface").getDisplayServiceKey(),
-                "org.apache.dubbo.common.TestInterface:null");
-        
assertEquals(BaseServiceMetadata.revertDisplayServiceKey(null).getDisplayServiceKey(),"null:null");
-        
assertEquals(BaseServiceMetadata.revertDisplayServiceKey("org.apache.dubbo.common.TestInterface:1.0.0:1").getDisplayServiceKey(),"null:null");
+                "org.apache.dubbo.common.TestInterface");
+        
assertEquals(BaseServiceMetadata.revertDisplayServiceKey(null).getDisplayServiceKey(),"");
+        
assertEquals(BaseServiceMetadata.revertDisplayServiceKey("org.apache.dubbo.common.TestInterface:1.0.0:1").getDisplayServiceKey(),"");
     }
 }
diff --git 
a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/Ready.java
 
b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/Ready.java
index 2c6b422..156a8a7 100644
--- 
a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/Ready.java
+++ 
b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/impl/Ready.java
@@ -32,7 +32,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.stream.Collectors;
 
-@Cmd(name = "ready",summary = "Judge if application or service has started? ")
+@Cmd(name = "ready", summary = "Judge if application or service has started? 
", example = {
+        "ready",
+        "ready xx.xx.xxx.service"
+})
 public class Ready implements BaseCommand {
 
     @Override

Reply via email to