@@ -126,7 +126,7 @@ public class PolarisRestCatalogIntegrationTest extends CatalogTests<RESTCatalog>
126126 private CatalogApi catalogApi ;
127127 private RESTCatalog restCatalog ;
128128 private String currentCatalogName ;
129- private TestInfo testInfo ;
129+ private String [] restCatalogConfig ;
130130
131131 private final String catalogBaseLocation =
132132 s3BucketBase + "/" + System .getenv ("USER" ) + "/path/to/data" ;
@@ -170,7 +170,6 @@ static void close() throws Exception {
170170
171171 @ BeforeEach
172172 public void before (TestInfo testInfo ) {
173- this .testInfo = testInfo ;
174173 String principalName = client .newEntityName ("snowman-rest" );
175174 String principalRoleName = client .newEntityName ("rest-admin" );
176175 principalCredentials = managementApi .createPrincipalWithRole (principalName , principalRoleName );
@@ -214,6 +213,13 @@ public void before(TestInfo testInfo) {
214213
215214 managementApi .createCatalog (principalRoleName , catalog );
216215
216+ restCatalogConfig =
217+ testInfo
218+ .getTestMethod ()
219+ .map (m -> m .getAnnotation (RestCatalogConfig .class ))
220+ .map (RestCatalogConfig ::value )
221+ .orElse (new String [0 ]);
222+
217223 restCatalog = initCatalog (currentCatalogName , ImmutableMap .of ());
218224 }
219225
@@ -236,21 +242,10 @@ protected RESTCatalog catalog() {
236242 */
237243 @ Override
238244 protected RESTCatalog initCatalog (String catalogName , Map <String , String > additionalProperties ) {
239- Optional <PolarisRestCatalogIntegrationTest .RestCatalogConfig > restCatalogConfig =
240- testInfo
241- .getTestMethod ()
242- .flatMap (
243- m ->
244- Optional .ofNullable (
245- m .getAnnotation (
246- PolarisRestCatalogIntegrationTest .RestCatalogConfig .class )));
247245 ImmutableMap .Builder <String , String > extraPropertiesBuilder = ImmutableMap .builder ();
248- restCatalogConfig .ifPresent (
249- config -> {
250- for (int i = 0 ; i < config .value ().length ; i += 2 ) {
251- extraPropertiesBuilder .put (config .value ()[i ], config .value ()[i + 1 ]);
252- }
253- });
246+ for (int i = 0 ; i < restCatalogConfig .length ; i += 2 ) {
247+ extraPropertiesBuilder .put (restCatalogConfig [i ], restCatalogConfig [i + 1 ]);
248+ }
254249 extraPropertiesBuilder .putAll (additionalProperties );
255250 return IcebergHelper .restCatalog (
256251 client ,
0 commit comments