You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by "kezhuw (via GitHub)" <gi...@apache.org> on 2023/08/07 15:28:22 UTC

[GitHub] [curator] kezhuw commented on a diff in pull request #473: CURATOR-457: Custom service discovery path

kezhuw commented on code in PR #473:
URL: https://github.com/apache/curator/pull/473#discussion_r1286042942


##########
curator-x-discovery/src/test/java/org/apache/curator/x/discovery/details/TestServiceDiscovery.java:
##########
@@ -261,6 +262,49 @@ public void testBasic() throws Exception {
         }
     }
 
+    private static class CustomPathConstructor implements DiscoveryPathConstructor {
+        @Override
+        public String getBasePath() {
+            return "/test";
+        }
+
+        @Override
+        public String getPathForInstances(String serviceName) {
+            return String.format("/test/%s/instances", serviceName);
+        }

Review Comment:
   In case of old version, there is one more method `getPathForInstance`(with no trailing `s` character). In this concrete test case, `getPathForInstance` can't return anything other than `String.format("/test/%s/instances/%s", serviceName, instanceId)`, otherwise it breaks `queryForInstances`.
   
   `queryForInstances` relies on `getPathForInstances` which states "Return the (parent) path where all instances of the service registered".



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@curator.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org