@@ -45,6 +45,7 @@ public void testSyncListEndpoint() throws InterruptedException {
45
45
46
46
// Confirm all vector IDs from custom namespace are returned when pass customNamespace
47
47
ListResponse listResponseCustomNamespace = indexConnection .list (customNamespace );
48
+ assertEquals (listResponseCustomNamespace .getVectorsList ().size (), 4 );
48
49
assertTrue (listResponseCustomNamespace .getVectorsList ().toString ().contains ("cus-id1" ));
49
50
assertTrue (listResponseCustomNamespace .getVectorsList ().toString ().contains ("cus-id2" ));
50
51
assertTrue (listResponseCustomNamespace .getVectorsList ().toString ().contains ("cus-prefix-id3" ));
@@ -59,6 +60,23 @@ public void testSyncListEndpoint() throws InterruptedException {
59
60
// Confirm all vector IDs from custom namespace are returned when limit is specified
60
61
ListResponse listResponseWithLimit = indexConnection .list (customNamespace , 1 );
61
62
assertEquals (1 , listResponseWithLimit .getVectorsList ().size ());
63
+
64
+ // Confirm all vector IDs from custom namespace are returned using pagination
65
+ ListResponse listResponseWithPaginationNoPrefix1 = indexConnection .list (customNamespace , 2 );
66
+ assertEquals (listResponseWithPaginationNoPrefix1 .getVectorsList ().size (), 2 );
67
+ ListResponse listResponseWithPaginationNoPrefix2 = indexConnection .list (
68
+ customNamespace ,
69
+ 2 ,
70
+ listResponseWithPaginationNoPrefix1 .getPagination ().getNext ()
71
+ );
72
+ assertEquals (listResponseWithPaginationNoPrefix2 .getVectorsList ().size (), 2 );
73
+ ListResponse listResponseWithPaginationNoPrefix3 = indexConnection .list (
74
+ customNamespace ,
75
+ 2 ,
76
+ listResponseWithPaginationNoPrefix2 .getPagination ().getNext ()
77
+ );
78
+ assertEquals (listResponseWithPaginationNoPrefix3 .getVectorsList ().size (), 0 );
79
+ assertEquals (listResponseWithPaginationNoPrefix3 .getPagination ().getNext (), "" );
62
80
}
63
81
64
82
@ Test
@@ -92,6 +110,26 @@ public void testAsyncListEndpoint() throws InterruptedException {
92
110
ListenableFuture <ListResponse > futureResponseWithLimit = asyncIndexConnection .list (customNamespace , 1 );
93
111
ListResponse asyncListResponseWithLimit = Futures .getUnchecked (futureResponseWithLimit );
94
112
assertEquals (1 , asyncListResponseWithLimit .getVectorsList ().size ());
113
+
114
+ // Confirm all vector IDs from custom namespace are returned using pagination
115
+ ListenableFuture <ListResponse > futureResponseWithPaginationNoPrefix1 = asyncIndexConnection .list (customNamespace , 2 );
116
+ ListResponse asyncListResponseWithPaginationNoPrefix1 = Futures .getUnchecked (futureResponseWithPaginationNoPrefix1 );
117
+ assertEquals (asyncListResponseWithPaginationNoPrefix1 .getVectorsList ().size (), 2 );
118
+ ListenableFuture <ListResponse > futureResponseWithPaginationNoPrefix2 = asyncIndexConnection .list (
119
+ customNamespace ,
120
+ 2 ,
121
+ asyncListResponseWithPaginationNoPrefix1 .getPagination ().getNext ()
122
+ );
123
+ ListResponse asyncListResponseWithPaginationNoPrefix2 = Futures .getUnchecked (futureResponseWithPaginationNoPrefix2 );
124
+ assertEquals (asyncListResponseWithPaginationNoPrefix2 .getVectorsList ().size (), 2 );
125
+ ListenableFuture <ListResponse > futureResponseWithPaginationNoPrefix3 = asyncIndexConnection .list (
126
+ customNamespace ,
127
+ 2 ,
128
+ asyncListResponseWithPaginationNoPrefix2 .getPagination ().getNext ()
129
+ );
130
+ ListResponse asyncListResponseWithPaginationNoPrefix3 = Futures .getUnchecked (futureResponseWithPaginationNoPrefix3 );
131
+ assertEquals (asyncListResponseWithPaginationNoPrefix3 .getVectorsList ().size (), 0 );
132
+ assertEquals (asyncListResponseWithPaginationNoPrefix3 .getPagination ().getNext (), "" );
95
133
}
96
134
97
135
}
0 commit comments