Skip to content

Commit e8392fb

Browse files
committed
Change restCatalogConfig to Map
1 parent b4556e8 commit e8392fb

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisRestCatalogIntegrationTest.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public class PolarisRestCatalogIntegrationTest extends CatalogTests<RESTCatalog>
126126
private CatalogApi catalogApi;
127127
private RESTCatalog restCatalog;
128128
private String currentCatalogName;
129-
private String[] restCatalogConfig;
129+
private Map<String, String> restCatalogConfig;
130130

131131
private final String catalogBaseLocation =
132132
s3BucketBase + "/" + System.getenv("USER") + "/path/to/data";
@@ -218,7 +218,19 @@ public void before(TestInfo testInfo) {
218218
.getTestMethod()
219219
.map(m -> m.getAnnotation(RestCatalogConfig.class))
220220
.map(RestCatalogConfig::value)
221-
.orElse(new String[0]);
221+
.map(
222+
values -> {
223+
if (values.length % 2 != 0) {
224+
throw new IllegalArgumentException(
225+
String.format("Missing value for config '%s'", values[values.length - 1]));
226+
}
227+
Map<String, String> config = new HashMap<>();
228+
for (int i = 0; i < values.length; i += 2) {
229+
config.put(values[i], values[i + 1]);
230+
}
231+
return config;
232+
})
233+
.orElse(ImmutableMap.of());
222234

223235
restCatalog = initCatalog(currentCatalogName, ImmutableMap.of());
224236
}
@@ -243,9 +255,7 @@ protected RESTCatalog catalog() {
243255
@Override
244256
protected RESTCatalog initCatalog(String catalogName, Map<String, String> additionalProperties) {
245257
ImmutableMap.Builder<String, String> extraPropertiesBuilder = ImmutableMap.builder();
246-
for (int i = 0; i < restCatalogConfig.length; i += 2) {
247-
extraPropertiesBuilder.put(restCatalogConfig[i], restCatalogConfig[i + 1]);
248-
}
258+
extraPropertiesBuilder.putAll(restCatalogConfig);
249259
extraPropertiesBuilder.putAll(additionalProperties);
250260
return IcebergHelper.restCatalog(
251261
client,

0 commit comments

Comments
 (0)