geyanggang commented on code in PR #13481:
URL: https://github.com/apache/gravitino/pull/13481#discussion_r4090706987
##########
core/src/test/java/org/apache/gravitino/catalog/CatalogTestUtils.java:
##########
@@ -65,5 +66,34 @@ public static void mockDoWithCatalog(CatalogManager
catalogManager, BaseCatalog<
})
.when(catalogManager)
.doWithCatalog(Mockito.any(), Mockito.any());
+
+ // TableNormalizeDispatcher resolves the physical table name through
+ // doWithCatalogWrapper(...).doWithTableOps(tableCatalog ->
+ // tableCatalog.resolveTableName(ident)).
+ // Stub the wrapper so that path runs with the default identity
resolveTableName, matching every
+ // catalog that does not override the hook, instead of returning null.
+ try {
+ CatalogManager.CatalogWrapper wrapper =
Mockito.mock(CatalogManager.CatalogWrapper.class);
+ TableCatalog identityTableOps = Mockito.mock(TableCatalog.class);
+ Mockito.when(identityTableOps.resolveTableName(Mockito.any()))
+ .thenAnswer(invocation -> invocation.getArgument(0));
+ Mockito.doAnswer(
+ invocation -> {
+ ThrowableFunction<TableCatalog, Object> fn =
invocation.getArgument(0);
+ return fn.apply(identityTableOps);
+ })
+ .when(wrapper)
+ .doWithTableOps(Mockito.any());
+ Mockito.doAnswer(
+ invocation -> {
+ ThrowableFunction<CatalogManager.CatalogWrapper, Object> fn =
+ invocation.getArgument(1);
+ return fn.apply(wrapper);
+ })
+ .when(catalogManager)
+ .doWithCatalogWrapper(Mockito.any(), Mockito.any());
Review Comment:
Reverted CatalogTestUtils to its original state (byte-identical to main).
The new design resolves via doWithCatalog, which the existing helper already
covers, so no shared global stub is needed; the resolution-specific setup lives
only where it's used.
--
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]