nastra commented on code in PR #14465:
URL: https://github.com/apache/iceberg/pull/14465#discussion_r2560177520


##########
core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java:
##########
@@ -3066,6 +3074,113 @@ public void testCommitStateUnknownNotReconciled() {
         .satisfies(ex -> assertThat(((CommitStateUnknownException) 
ex).getSuppressed()).isEmpty());
   }
 
+  @Test
+  public void testCustomTableOperationsInjection() throws IOException {
+    AtomicBoolean customTableOps = new AtomicBoolean();
+    AtomicBoolean customTxnOps = new AtomicBoolean();
+    AtomicBoolean customViewOps = new AtomicBoolean();
+
+    // Custom RESTSessionCatalog that overrides table/view operations creation
+    class CustomRESTSessionCatalog extends RESTSessionCatalog {
+      CustomRESTSessionCatalog(
+          Function<Map<String, String>, RESTClient> clientBuilder,
+          BiFunction<SessionCatalog.SessionContext, Map<String, String>, 
FileIO> ioBuilder) {
+        super(clientBuilder, ioBuilder);
+      }
+
+      @Override
+      protected RESTTableOperations newTableOps(
+          RESTClient restClient,
+          String path,
+          Supplier<Map<String, String>> headers,
+          FileIO fileIO,
+          TableMetadata current,
+          Set<Endpoint> supportedEndpoints) {
+        customTableOps.set(true);
+        return super.newTableOps(restClient, path, headers, fileIO, current, 
supportedEndpoints);
+      }
+
+      @Override
+      protected RESTTableOperations newTableOpsForTransaction(
+          RESTClient restClient,
+          String path,
+          Supplier<Map<String, String>> headers,
+          FileIO fileIO,
+          RESTTableOperations.UpdateType updateType,
+          List<MetadataUpdate> createChanges,
+          TableMetadata current,
+          Set<Endpoint> supportedEndpoints) {
+        customTxnOps.set(true);
+        return super.newTableOpsForTransaction(
+            restClient,
+            path,
+            headers,
+            fileIO,
+            updateType,
+            createChanges,
+            current,
+            supportedEndpoints);
+      }
+
+      @Override
+      protected RESTViewOperations newViewOps(

Review Comment:
   this should probably be tested in `TestRESTViewCatalog` as not every 
subclass of `TestRESTCatalog` will have view support implemented.



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