@@ -668,9 +668,43 @@ public static void listObject_test4() throws Exception {
668668 }
669669
670670 /**
671- * Test: listObjects(bucketName, final String prefix, final boolean recursive, final boolean useVersion1 ).
671+ * Test: recursive: listObjects(bucketName, final String prefix, final boolean recursive).
672672 */
673673 public static void listObject_test5 () throws Exception {
674+ int i ;
675+ int objCount = 1050 ;
676+
677+ System .out .println ("Test: recursive: listObjects(final String bucketName, final String prefix"
678+ + ", final boolean recursive)" );
679+ String [] objectNames = new String [objCount ];
680+
681+ String baseFilename = createFile (1 );
682+ for (i = 0 ; i < objCount ; i ++) {
683+ objectNames [i ] = baseFilename + "-" + i ;
684+ client .putObject (bucketName , objectNames [i ], baseFilename );
685+ }
686+ Files .delete (Paths .get (baseFilename ));
687+
688+ i = 0 ;
689+ for (Result <?> r : client .listObjects (bucketName , "minio" , true )) {
690+ ignore (i ++, r .get ());
691+ }
692+
693+ // Check the number of uploaded objects
694+ if (i != objCount ) {
695+ throw new Exception ("[FAILED] Test: recursive: listObject_test5(), number of items, expected: "
696+ + objCount + ", found: " + i );
697+ }
698+
699+ for (i = 0 ; i < objCount ; i ++) {
700+ client .removeObject (bucketName , objectNames [i ]);
701+ }
702+ }
703+
704+ /**
705+ * Test: listObjects(bucketName, final String prefix, final boolean recursive, final boolean useVersion1).
706+ */
707+ public static void listObject_test6 () throws Exception {
674708 int i ;
675709 System .out .println ("Test: listObjects(final String bucketName, final String prefix, final boolean recursive,"
676710 + " final boolean useVersion1)" );
@@ -1544,6 +1578,7 @@ public static void runTests() throws Exception {
15441578 listObject_test3 ();
15451579 listObject_test4 ();
15461580 listObject_test5 ();
1581+ listObject_test6 ();
15471582
15481583 removeObject_test1 ();
15491584 removeObject_test2 ();
0 commit comments