This is an automated email from the ASF dual-hosted git repository.
dimas pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new adaae4847 Fix deprecation warnings in
GcpCredentialsStorageIntegrationTest (#2544)
adaae4847 is described below
commit adaae4847145ef5bb1f291c1dfd2922077545afb
Author: Dmitri Bourlatchkov <[email protected]>
AuthorDate: Thu Sep 11 14:06:17 2025 -0400
Fix deprecation warnings in GcpCredentialsStorageIntegrationTest (#2544)
* Fix deprecation warnings in GcpCredentialsStorageIntegrationTest
Refactor the code to use an explicit InputStream
Cf. https://github.com/FasterXML/jackson-core/issues/803
---
.../gcp/GcpCredentialsStorageIntegrationTest.java | 26 +++++++++-------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git
a/polaris-core/src/test/java/org/apache/polaris/service/storage/gcp/GcpCredentialsStorageIntegrationTest.java
b/polaris-core/src/test/java/org/apache/polaris/service/storage/gcp/GcpCredentialsStorageIntegrationTest.java
index f1a7afc63..c4f026d86 100644
---
a/polaris-core/src/test/java/org/apache/polaris/service/storage/gcp/GcpCredentialsStorageIntegrationTest.java
+++
b/polaris-core/src/test/java/org/apache/polaris/service/storage/gcp/GcpCredentialsStorageIntegrationTest.java
@@ -37,6 +37,7 @@ import com.google.cloud.storage.Storage;
import com.google.cloud.storage.StorageException;
import com.google.cloud.storage.StorageOptions;
import java.io.IOException;
+import java.io.InputStream;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
@@ -177,6 +178,12 @@ class GcpCredentialsStorageIntegrationTest extends
BaseStorageIntegrationTest {
Optional.of(REFRESH_ENDPOINT));
}
+ private JsonNode readResource(ObjectMapper mapper, String name) throws
IOException {
+ try (InputStream in =
GcpCredentialsStorageIntegrationTest.class.getResourceAsStream(name)) {
+ return mapper.readTree(in);
+ }
+ }
+
@Test
public void testGenerateAccessBoundary() throws IOException {
CredentialAccessBoundary credentialAccessBoundary =
@@ -185,10 +192,7 @@ class GcpCredentialsStorageIntegrationTest extends
BaseStorageIntegrationTest {
assertThat(credentialAccessBoundary).isNotNull();
ObjectMapper mapper = new ObjectMapper();
JsonNode parsedRules = mapper.convertValue(credentialAccessBoundary,
JsonNode.class);
- JsonNode refRules =
- mapper.readTree(
- GcpCredentialsStorageIntegrationTest.class.getResource(
- "gcp-testGenerateAccessBoundary.json"));
+ JsonNode refRules = readResource(mapper,
"gcp-testGenerateAccessBoundary.json");
assertThat(parsedRules)
.usingRecursiveComparison(
RecursiveComparisonConfiguration.builder()
@@ -211,9 +215,7 @@ class GcpCredentialsStorageIntegrationTest extends
BaseStorageIntegrationTest {
ObjectMapper mapper = new ObjectMapper();
JsonNode parsedRules = mapper.convertValue(credentialAccessBoundary,
JsonNode.class);
JsonNode refRules =
- mapper.readTree(
- GcpCredentialsStorageIntegrationTest.class.getResource(
- "gcp-testGenerateAccessBoundaryWithMultipleBuckets.json"));
+ readResource(mapper,
"gcp-testGenerateAccessBoundaryWithMultipleBuckets.json");
assertThat(parsedRules)
.usingRecursiveComparison(
RecursiveComparisonConfiguration.builder()
@@ -232,10 +234,7 @@ class GcpCredentialsStorageIntegrationTest extends
BaseStorageIntegrationTest {
assertThat(credentialAccessBoundary).isNotNull();
ObjectMapper mapper = new ObjectMapper();
JsonNode parsedRules = mapper.convertValue(credentialAccessBoundary,
JsonNode.class);
- JsonNode refRules =
- mapper.readTree(
- GcpCredentialsStorageIntegrationTest.class.getResource(
- "gcp-testGenerateAccessBoundaryWithoutList.json"));
+ JsonNode refRules = readResource(mapper,
"gcp-testGenerateAccessBoundaryWithoutList.json");
assertThat(parsedRules)
.usingRecursiveComparison(
RecursiveComparisonConfiguration.builder()
@@ -254,10 +253,7 @@ class GcpCredentialsStorageIntegrationTest extends
BaseStorageIntegrationTest {
assertThat(credentialAccessBoundary).isNotNull();
ObjectMapper mapper = new ObjectMapper();
JsonNode parsedRules = mapper.convertValue(credentialAccessBoundary,
JsonNode.class);
- JsonNode refRules =
- mapper.readTree(
- GcpCredentialsStorageIntegrationTest.class.getResource(
- "gcp-testGenerateAccessBoundaryWithoutWrites.json"));
+ JsonNode refRules = readResource(mapper,
"gcp-testGenerateAccessBoundaryWithoutWrites.json");
assertThat(parsedRules)
.usingRecursiveComparison(
RecursiveComparisonConfiguration.builder()