rahil-c commented on code in PR #9782:
URL: https://github.com/apache/iceberg/pull/9782#discussion_r1566713074


##########
core/src/main/java/org/apache/iceberg/rest/RESTSessionCatalog.java:
##########
@@ -278,14 +286,26 @@ public void setConf(Object newConf) {
   @Override
   public List<TableIdentifier> listTables(SessionContext context, Namespace 
ns) {
     checkNamespaceIsValid(ns);
+    Map<String, String> queryParams = Maps.newHashMap();
+    List<TableIdentifier> tables = Lists.newArrayList();
+    String pageToken = "";
+    if (restPageSize != null) {
+      queryParams.put("pageToken", pageToken);
+      queryParams.put("pageSize", restPageSize);
+    }
+    do {
+      ListTablesResponse response =
+          client.get(
+              paths.tables(ns),
+              queryParams,
+              ListTablesResponse.class,
+              headers(context),
+              ErrorHandlers.namespaceErrorHandler());
+      pageToken = response.nextPageToken();

Review Comment:
   @nastra I was wondering if I get your thoughts on this issue I have been 
seeing with the tests that leverage `Mockito.verify`. For demo purposes I added 
a test called `testCatalogWithPagaintionTokenIssue` which is basically similar 
to the test you mentioned above but i haved added this snippet, hitting the 
list namespaces endpoint
   ```
   Mockito.verify(adapter)
               .execute(
                       eq(HTTPMethod.GET),
                       eq("v1/namespaces"),
                       any(),
                       any(),
                       eq(ListNamespacesResponse.class),
                       eq(catalogHeaders),
                       any());
   ```
   
   This test however always fail for the following exception
   ```
   Wanted but not invoked:
   rESTCatalogAdapter.execute(
       GET,
       "v1/namespaces",
       <any>,
       <any>,
       class org.apache.iceberg.rest.responses.ListNamespacesResponse,
       {"Authorization" = "Bearer 
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyLCJleHAiOjE5OTk5OTk5OTk5fQ._3k92KJi2NTyTG6V1s2mzJ__GiQtL36DnzsZSkBdYPw"},
       <any>
   );
   -> at 
org.apache.iceberg.rest.RESTCatalogAdapter.execute(RESTCatalogAdapter.java:517)
   
   However, there were exactly 4 interactions with this mock:
   ```
   
   When i setup a debugger, for some reason when it goes into the 
`RestCatalogAdapater.execute` it does not recognize any params of the function 
and then errors out. Any thoughts on how to get past this?
   ```
   public <T extends RESTResponse> T execute(
         HTTPMethod method,
         String path,
         Map<String, String> queryParams,
         Object body,
         Class<T> responseType,
         Map<String, String> headers,
         Consumer<ErrorResponse> errorHandler) {
       ErrorResponse.Builder errorBuilder = ErrorResponse.builder();
   
   ```



-- 
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: issues-unsubscr...@iceberg.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to