@@ -400,20 +400,7 @@ protected IcebergCatalog catalog() {
400400 @ Override
401401 protected IcebergCatalog initCatalog (
402402 String catalogName , Map <String , String > additionalProperties ) {
403- PolarisPassthroughResolutionView passthroughView =
404- new PolarisPassthroughResolutionView (
405- polarisContext , entityManager , securityContext , CATALOG_NAME );
406- TaskExecutor taskExecutor = Mockito .mock ();
407- IcebergCatalog icebergCatalog =
408- new IcebergCatalog (
409- entityManager ,
410- metaStoreManager ,
411- polarisContext ,
412- passthroughView ,
413- securityContext ,
414- taskExecutor ,
415- fileIOFactory ,
416- polarisEventListener );
403+ IcebergCatalog icebergCatalog = newIcebergCatalog (CATALOG_NAME );
417404 fileIO = new InMemoryFileIO ();
418405 icebergCatalog .setCatalogFileIo (fileIO );
419406 ImmutableMap .Builder <String , String > propertiesBuilder =
@@ -444,6 +431,32 @@ protected boolean supportsNotifications() {
444431 return true ;
445432 }
446433
434+ protected IcebergCatalog newIcebergCatalog (String catalogName ) {
435+ return newIcebergCatalog (catalogName , metaStoreManager );
436+ }
437+
438+ protected IcebergCatalog newIcebergCatalog (
439+ String catalogName , PolarisMetaStoreManager metaStoreManager ) {
440+ return newIcebergCatalog (catalogName , metaStoreManager , fileIOFactory );
441+ }
442+
443+ protected IcebergCatalog newIcebergCatalog (
444+ String catalogName , PolarisMetaStoreManager metaStoreManager , FileIOFactory fileIOFactory ) {
445+ PolarisPassthroughResolutionView passthroughView =
446+ new PolarisPassthroughResolutionView (
447+ polarisContext , entityManager , securityContext , catalogName );
448+ TaskExecutor taskExecutor = Mockito .mock (TaskExecutor .class );
449+ return new IcebergCatalog (
450+ entityManager ,
451+ metaStoreManager ,
452+ polarisContext ,
453+ passthroughView ,
454+ securityContext ,
455+ taskExecutor ,
456+ fileIOFactory ,
457+ polarisEventListener );
458+ }
459+
447460 @ Test
448461 public void testEmptyNamespace () {
449462 IcebergCatalog catalog = catalog ();
@@ -982,21 +995,9 @@ public void testValidateNotificationFailToCreateFileIO() {
982995 // filename.
983996 final String tableLocation = "s3://externally-owned-bucket/validate_table/" ;
984997 final String tableMetadataLocation = tableLocation + "metadata/" ;
985- PolarisPassthroughResolutionView passthroughView =
986- new PolarisPassthroughResolutionView (
987- polarisContext , entityManager , securityContext , catalog ().name ());
988998 FileIOFactory fileIOFactory =
989999 spy (new DefaultFileIOFactory (realmEntityManagerFactory , metaStoreManagerFactory ));
990- IcebergCatalog catalog =
991- new IcebergCatalog (
992- entityManager ,
993- metaStoreManager ,
994- polarisContext ,
995- passthroughView ,
996- securityContext ,
997- Mockito .mock (TaskExecutor .class ),
998- fileIOFactory ,
999- polarisEventListener );
1000+ IcebergCatalog catalog = newIcebergCatalog (catalog ().name (), metaStoreManager , fileIOFactory );
10001001 catalog .initialize (
10011002 CATALOG_NAME ,
10021003 ImmutableMap .of (
@@ -1314,20 +1315,7 @@ public void testUpdateNotificationCreateTableWithLocalFilePrefix() {
13141315 .build ()
13151316 .asCatalog ()));
13161317
1317- PolarisPassthroughResolutionView passthroughView =
1318- new PolarisPassthroughResolutionView (
1319- polarisContext , entityManager , securityContext , catalogWithoutStorage );
1320- TaskExecutor taskExecutor = Mockito .mock ();
1321- IcebergCatalog catalog =
1322- new IcebergCatalog (
1323- entityManager ,
1324- metaStoreManager ,
1325- polarisContext ,
1326- passthroughView ,
1327- securityContext ,
1328- taskExecutor ,
1329- fileIOFactory ,
1330- polarisEventListener );
1318+ IcebergCatalog catalog = newIcebergCatalog (catalogWithoutStorage );
13311319 catalog .initialize (
13321320 catalogWithoutStorage ,
13331321 ImmutableMap .of (
@@ -1378,21 +1366,7 @@ public void testUpdateNotificationCreateTableWithHttpPrefix() {
13781366 .build ()
13791367 .asCatalog ()));
13801368
1381- PolarisPassthroughResolutionView passthroughView =
1382- new PolarisPassthroughResolutionView (
1383- polarisContext , entityManager , securityContext , catalogName );
1384- TaskExecutor taskExecutor = Mockito .mock ();
1385- InMemoryFileIO localFileIO = new InMemoryFileIO ();
1386- IcebergCatalog catalog =
1387- new IcebergCatalog (
1388- entityManager ,
1389- metaStoreManager ,
1390- polarisContext ,
1391- passthroughView ,
1392- securityContext ,
1393- taskExecutor ,
1394- fileIOFactory ,
1395- polarisEventListener );
1369+ IcebergCatalog catalog = newIcebergCatalog (catalogName );
13961370 catalog .initialize (
13971371 catalogName ,
13981372 ImmutableMap .of (
@@ -1909,19 +1883,8 @@ public void testDropTableWithPurgeDisabled() {
19091883 polarisContext , noPurgeStorageConfigModel , storageLocation )
19101884 .build ()
19111885 .asCatalog ()));
1912- PolarisPassthroughResolutionView passthroughView =
1913- new PolarisPassthroughResolutionView (
1914- polarisContext , entityManager , securityContext , noPurgeCatalogName );
19151886 IcebergCatalog noPurgeCatalog =
1916- new IcebergCatalog (
1917- entityManager ,
1918- metaStoreManager ,
1919- polarisContext ,
1920- passthroughView ,
1921- securityContext ,
1922- Mockito .mock (),
1923- fileIOFactory ,
1924- polarisEventListener );
1887+ newIcebergCatalog (noPurgeCatalogName , metaStoreManager , fileIOFactory );
19251888 noPurgeCatalog .initialize (
19261889 noPurgeCatalogName ,
19271890 ImmutableMap .of (
@@ -2012,22 +1975,9 @@ static Stream<Arguments> testRetriableException() {
20121975
20131976 @ Test
20141977 public void testFileIOWrapper () {
2015- PolarisPassthroughResolutionView passthroughView =
2016- new PolarisPassthroughResolutionView (
2017- polarisContext , entityManager , securityContext , CATALOG_NAME );
2018-
20191978 MeasuredFileIOFactory measured =
20201979 new MeasuredFileIOFactory (realmEntityManagerFactory , metaStoreManagerFactory );
2021- IcebergCatalog catalog =
2022- new IcebergCatalog (
2023- entityManager ,
2024- metaStoreManager ,
2025- polarisContext ,
2026- passthroughView ,
2027- securityContext ,
2028- Mockito .mock (),
2029- measured ,
2030- polarisEventListener );
1980+ IcebergCatalog catalog = newIcebergCatalog (CATALOG_NAME , metaStoreManager , measured );
20311981 catalog .initialize (
20321982 CATALOG_NAME ,
20331983 ImmutableMap .of (
@@ -2116,19 +2066,7 @@ public void testConcurrencyConflictCreateTableUpdatedDuringFinalTransaction() {
21162066 // Use a spy so that non-transactional pre-requisites succeed normally, but we inject
21172067 // a concurrency failure at final commit.
21182068 PolarisMetaStoreManager spyMetaStore = spy (metaStoreManager );
2119- PolarisPassthroughResolutionView passthroughView =
2120- new PolarisPassthroughResolutionView (
2121- polarisContext , entityManager , securityContext , CATALOG_NAME );
2122- final IcebergCatalog catalog =
2123- new IcebergCatalog (
2124- entityManager ,
2125- spyMetaStore ,
2126- polarisContext ,
2127- passthroughView ,
2128- securityContext ,
2129- Mockito .mock (TaskExecutor .class ),
2130- fileIOFactory ,
2131- polarisEventListener );
2069+ final IcebergCatalog catalog = newIcebergCatalog (CATALOG_NAME , spyMetaStore );
21322070 catalog .initialize (
21332071 CATALOG_NAME ,
21342072 ImmutableMap .of (
@@ -2165,19 +2103,7 @@ public void testConcurrencyConflictUpdateTableDuringFinalTransaction() {
21652103 // Use a spy so that non-transactional pre-requisites succeed normally, but we inject
21662104 // a concurrency failure at final commit.
21672105 PolarisMetaStoreManager spyMetaStore = spy (metaStoreManager );
2168- PolarisPassthroughResolutionView passthroughView =
2169- new PolarisPassthroughResolutionView (
2170- polarisContext , entityManager , securityContext , CATALOG_NAME );
2171- final IcebergCatalog catalog =
2172- new IcebergCatalog (
2173- entityManager ,
2174- spyMetaStore ,
2175- polarisContext ,
2176- passthroughView ,
2177- securityContext ,
2178- Mockito .mock (TaskExecutor .class ),
2179- fileIOFactory ,
2180- polarisEventListener );
2106+ final IcebergCatalog catalog = newIcebergCatalog (CATALOG_NAME , spyMetaStore );
21812107 catalog .initialize (
21822108 CATALOG_NAME ,
21832109 ImmutableMap .of (
0 commit comments