devmadhuu commented on code in PR #5982:
URL: https://github.com/apache/ozone/pull/5982#discussion_r1461352820


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestListKeys.java:
##########
@@ -265,26 +269,147 @@ private static Stream<Arguments> 
shallowListDataWithoutTrailingSlash() {
     );
   }
 
+  private static Stream<Arguments> deepListDataWithTrailingSlash() {
+    return Stream.of(
+
+            // Case-1: StartKey is less than prefixKey, return emptyList.
+            of("a1/b2/", "a1", newLinkedList(Collections.emptyList())),
+
+            // Case-2: StartKey is empty, return all immediate node.
+            of("a1/b2/", "", newLinkedList(Arrays.asList(
+                    "a1/b2/",
+                    "a1/b2/d1/",
+                    "a1/b2/d1/d11.tx",
+                    "a1/b2/d2/",
+                    "a1/b2/d2/d21.tx",
+                    "a1/b2/d2/d22.tx",
+                    "a1/b2/d3/",
+                    "a1/b2/d3/d31.tx"
+            ))),
+
+            // Case-3: StartKey is same as prefixKey, return all immediate 
nodes.
+            of("a1/b2/", "a1/b2", newLinkedList(Arrays.asList(
+                    "a1/b2/",
+                    "a1/b2/d1/",
+                    "a1/b2/d1/d11.tx",
+                    "a1/b2/d2/",
+                    "a1/b2/d2/d21.tx",
+                    "a1/b2/d2/d22.tx",
+                    "a1/b2/d3/",
+                    "a1/b2/d3/d31.tx"
+            ))),
+
+            // Case-4: StartKey is greater than prefixKey
+            of("a1/b2/", "a1/b2/d2/d21.tx", newLinkedList(Arrays.asList(
+                    "a1/b2/d2/d22.tx",
+                    "a1/b2/d3/",
+                    "a1/b2/d3/d31.tx"
+            ))),
+
+            // Case-5: StartKey reaches last element, return emptyList
+            of("a1/b2/", "a1/b2/d3/d31.tx", newLinkedList(
+                    Collections.emptyList()
+            )),
+
+            // Case-6: Mix result
+            of("a1/b1/", "a1/b1/c12", newLinkedList(Arrays.asList(
+                    "a1/b1/c12/",
+                    "a1/b1/c12/c2.tx",
+                    "a1/b1/c12/c3.tx",
+                    "a1/b1/c1222.tx",
+                    "a1/b1/c1333.tx",
+                    "a1/b1/c1444.tx",
+                    "a1/b1/c1555.tx"
+            )))
+    );
+  }
+
+
+  private static Stream<Arguments> deepListDataWithoutTrailingSlash() {
+    return Stream.of(
+
+            // Case-1: StartKey is less than prefixKey, return emptyList.
+            of("a1/b2", "a1", newLinkedList(Collections.emptyList())),
+
+            // Case-2: StartKey is empty, return all immediate node.
+            of("a1/b2", "", newLinkedList(Arrays.asList(
+                    "a1/b2/",
+                    "a1/b2/d1/",
+                    "a1/b2/d1/d11.tx",
+                    "a1/b2/d2/",
+                    "a1/b2/d2/d21.tx",
+                    "a1/b2/d2/d22.tx",
+                    "a1/b2/d3/",
+                    "a1/b2/d3/d31.tx"
+            ))),
+
+            // Case-3: StartKey is same as prefixKey.
+            of("a1/b2", "a1/b2", newLinkedList(Arrays.asList(
+                    "a1/b2/",
+                    "a1/b2/d1/",
+                    "a1/b2/d1/d11.tx",
+                    "a1/b2/d2/",
+                    "a1/b2/d2/d21.tx",
+                    "a1/b2/d2/d22.tx",
+                    "a1/b2/d3/",
+                    "a1/b2/d3/d31.tx"
+            ))),
+
+            // Case-4: StartKey is greater than prefixKey, return immediate
+            // nodes which after startKey.
+            of("a1/b2", "a1/b2/d2/d21.tx", newLinkedList(Arrays.asList(
+                    "a1/b2/d2/d22.tx",
+                    "a1/b2/d3/",
+                    "a1/b2/d3/d31.tx"
+            ))),
+
+            // Case-5: StartKey reaches last element, return emptyList
+            of("a1/b2", "a1/b2/d3/d31.tx", newLinkedList(
+                    Collections.emptyList()
+            ))
+    );
+  }
+
+
   @ParameterizedTest
   @MethodSource("shallowListDataWithTrailingSlash")
-  public void testShallowListKeysWithPrefixTrailingSlash(String keyPrefix,
-      String startKey, List<String> expectedKeys) throws Exception {
-    checkKeyShallowList(keyPrefix, startKey, expectedKeys, legacyOzoneBucket);
+  public void testShallowListKeysWithPrefixTrailingSlash(String keyPrefix, 
String startKey, List<String> expectedKeys)
+          throws Exception {
+    System.out.println("testShallowListKeysWithPrefixTrailingSlash for " + 
legacyOzoneBucket.toString());
+    checkKeyList(keyPrefix, startKey, expectedKeys, legacyOzoneBucket, true);
+    System.out.println("testShallowListKeysWithPrefixTrailingSlash for " + 
fsoOzoneBucket.toString());

Review Comment:
   Thanks @TaiJuWu for the patch. Are these System.out needed ?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to