dimas-b commented on code in PR #701:
URL: https://github.com/apache/polaris/pull/701#discussion_r1911762262
##########
polaris-core/src/main/java/org/apache/polaris/core/storage/PolarisCredentialProperty.java:
##########
@@ -41,7 +41,12 @@ public enum PolarisCredentialProperty {
"the azure storage account host",
"the azure account name + endpoint that will append to the
ADLS_SAS_TOKEN_PREFIX"),
EXPIRATION_TIME(
- Long.class, "expiration-time", "the expiration time for the access
token, in milliseconds");
+ Long.class, "expiration-time", "the expiration time for the access
token, in milliseconds"),
+ ADDITIONAL_STORAGE_CONFIG(
+ String.class,
+ "additional-storage-config",
+ "the additional storage config for the cloud storage"),
Review Comment:
This looks like a fairly generic property... why does it need to be part of
"credential" properties?
##########
polaris-core/src/test/java/org/apache/polaris/core/storage/cache/StorageCredentialCacheEntryTest.java:
##########
@@ -0,0 +1,119 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.polaris.core.storage.cache;
+
+import static org.apache.polaris.core.storage.PolarisCredentialVendor.*;
+
+import java.util.EnumMap;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.apache.iceberg.aws.s3.S3FileIOProperties;
+import org.apache.iceberg.azure.AzureProperties;
+import org.apache.iceberg.gcp.GCPProperties;
+import org.apache.polaris.core.persistence.*;
+import org.apache.polaris.core.storage.PolarisCredentialProperty;
+import org.assertj.core.api.Assertions;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
+
+public class StorageCredentialCacheEntryTest {
+
+ public StorageCredentialCacheEntryTest() {}
+
+ @Test
+ public void testBadResult() {
+ ScopedCredentialsResult badResult =
+ new ScopedCredentialsResult(
+ BaseResult.ReturnStatus.SUBSCOPE_CREDS_ERROR, "extra_error_info");
+ StorageCredentialCacheEntry cacheEntry = new
StorageCredentialCacheEntry(badResult);
+ Assertions.assertThatThrownBy(() -> cacheEntry.convertToMapOfString())
+ .isInstanceOf(NullPointerException.class)
+ .hasMessageContaining("because \"this.credsMap\" is null");
+ }
+
+ @ParameterizedTest
+ @MethodSource("testConvertToMapOfStringParams")
+ public void testConvertToMapOfString(
+ Map<PolarisCredentialProperty, String> original, Map<String, String>
expected) {
+ EnumMap<PolarisCredentialProperty, String> props =
+ new EnumMap<>(PolarisCredentialProperty.class);
+ props.putAll(original);
+
+ ScopedCredentialsResult goodResult = new ScopedCredentialsResult(props);
+ StorageCredentialCacheEntry cacheEntry = new
StorageCredentialCacheEntry(goodResult);
+ Map<String, String> properties = cacheEntry.convertToMapOfString();
+ Assertions.assertThat(properties).isEqualTo(expected);
+ System.out.println(properties);
Review Comment:
Please avoid `System.out` in tests :)
--
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]