Caideyipi commented on code in PR #11457:
URL: https://github.com/apache/iotdb/pull/11457#discussion_r1384824800


##########
iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/utils/NodeUrlUtilsTest.java:
##########
@@ -59,4 +59,41 @@ public void parseAndConvertTConfigNodeUrlsTest() throws 
BadNodeUrlException {
     Assert.assertEquals(configNodeUrls, 
NodeUrlUtils.convertTConfigNodeUrls(configNodeLocations));
     Assert.assertEquals(configNodeLocations, 
NodeUrlUtils.parseTConfigNodeUrls(configNodeUrls));
   }
+
+  @Test
+  public void parseAndConvertTEndPointUrlsIPV4AndIPV6Test() throws 
BadNodeUrlException {
+    final List<TEndPoint> endPoints =
+        Arrays.asList(
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6667),
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6668),
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6669));
+    final String endPointUrls =
+        
"AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6667,AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6668,AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6669";
+
+    Assert.assertEquals(endPointUrls, 
NodeUrlUtils.convertTEndPointUrls(endPoints));
+    Assert.assertEquals(endPoints, 
NodeUrlUtils.parseTEndPointUrls(endPointUrls));
+  }
+
+  @Test
+  public void parseAndConvertTConfigNodeUrlsIPV4AndIPV6Test() throws 
BadNodeUrlException {
+    final List<TConfigNodeLocation> configNodeLocations =
+        Arrays.asList(
+            new TConfigNodeLocation(
+                0,
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22277),
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22278)),
+            new TConfigNodeLocation(
+                1,
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22279),
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22280)),
+            new TConfigNodeLocation(
+                2,
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22281),

Review Comment:
   IPv6 addresses contains 8 substrings separated by ":",  if there are no "::" 
indicating "0"s.



##########
iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/utils/NodeUrlUtilsTest.java:
##########
@@ -59,4 +59,41 @@ public void parseAndConvertTConfigNodeUrlsTest() throws 
BadNodeUrlException {
     Assert.assertEquals(configNodeUrls, 
NodeUrlUtils.convertTConfigNodeUrls(configNodeLocations));
     Assert.assertEquals(configNodeLocations, 
NodeUrlUtils.parseTConfigNodeUrls(configNodeUrls));
   }
+
+  @Test
+  public void parseAndConvertTEndPointUrlsIPV4AndIPV6Test() throws 
BadNodeUrlException {
+    final List<TEndPoint> endPoints =
+        Arrays.asList(
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6667),
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6668),
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6669));
+    final String endPointUrls =
+        
"AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6667,AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6668,AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6669";

Review Comment:
   https://www.rfc-editor.org/rfc/pdfrfc/rfc2732.txt.pdf



##########
iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/utils/NodeUrlUtilsTest.java:
##########
@@ -59,4 +59,41 @@ public void parseAndConvertTConfigNodeUrlsTest() throws 
BadNodeUrlException {
     Assert.assertEquals(configNodeUrls, 
NodeUrlUtils.convertTConfigNodeUrls(configNodeLocations));
     Assert.assertEquals(configNodeLocations, 
NodeUrlUtils.parseTConfigNodeUrls(configNodeUrls));
   }
+
+  @Test
+  public void parseAndConvertTEndPointUrlsIPV4AndIPV6Test() throws 
BadNodeUrlException {
+    final List<TEndPoint> endPoints =
+        Arrays.asList(
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6667),
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6668),
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6669));
+    final String endPointUrls =
+        
"AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6667,AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6668,AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6669";
+
+    Assert.assertEquals(endPointUrls, 
NodeUrlUtils.convertTEndPointUrls(endPoints));
+    Assert.assertEquals(endPoints, 
NodeUrlUtils.parseTEndPointUrls(endPointUrls));
+  }
+
+  @Test
+  public void parseAndConvertTConfigNodeUrlsIPV4AndIPV6Test() throws 
BadNodeUrlException {
+    final List<TConfigNodeLocation> configNodeLocations =
+        Arrays.asList(
+            new TConfigNodeLocation(
+                0,
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22277),
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22278)),
+            new TConfigNodeLocation(
+                1,
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22279),
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22280)),
+            new TConfigNodeLocation(
+                2,
+                new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE", 22281),

Review Comment:
   https://www.rfc-editor.org/rfc/pdfrfc/rfc1884.txt.pdf



##########
iotdb-core/node-commons/src/test/java/org/apache/iotdb/commons/utils/NodeUrlUtilsTest.java:
##########
@@ -59,4 +59,41 @@ public void parseAndConvertTConfigNodeUrlsTest() throws 
BadNodeUrlException {
     Assert.assertEquals(configNodeUrls, 
NodeUrlUtils.convertTConfigNodeUrls(configNodeLocations));
     Assert.assertEquals(configNodeLocations, 
NodeUrlUtils.parseTConfigNodeUrls(configNodeUrls));
   }
+
+  @Test
+  public void parseAndConvertTEndPointUrlsIPV4AndIPV6Test() throws 
BadNodeUrlException {
+    final List<TEndPoint> endPoints =
+        Arrays.asList(
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6667),
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6668),
+            new TEndPoint("AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345", 6669));
+    final String endPointUrls =
+        
"AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6667,AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6668,AD80:E32B:CR25:B3WE:DG4G:DWTF:CGDE:2345:6669";

Review Comment:
   I think it's better use '[]' in the test cases containing ports.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to