[java-shib-attribute] branch main updated: Avoid deprecated TestNG APIs
Ian Young
ian at iay.org.uk
Fri Aug 11 15:36:14 UTC 2023
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch main
in repository java-shib-attribute.
View the commit online:
http://git.shibboleth.net/view/?p=java-shib-attribute.git;a=commit;h=4ce3e28643d5c8cc5365941510e1fbfc4834a0f4
The following commit(s) were added to refs/heads/main by this push:
new 4ce3e2864 Avoid deprecated TestNG APIs
4ce3e2864 is described below
commit 4ce3e28643d5c8cc5365941510e1fbfc4834a0f4
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Fri Aug 11 16:35:39 2023 +0100
Avoid deprecated TestNG APIs
---
.../dc/storage/impl/StorageServiceDataConnectorTest.java | 7 +++++--
.../storage/impl/StorageServiceDataConnectorParserTest.java | 12 +++++++++---
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/storage/impl/StorageServiceDataConnectorTest.java b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/storage/impl/StorageServiceDataConnectorTest.java
index f31346ccf..7dbd6ed5a 100644
--- a/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/storage/impl/StorageServiceDataConnectorTest.java
+++ b/shib-attribute-resolver-impl/src/test/java/net/shibboleth/idp/attribute/resolver/dc/storage/impl/StorageServiceDataConnectorTest.java
@@ -17,6 +17,7 @@ package net.shibboleth.idp.attribute.resolver.dc.storage.impl;
import static org.testng.Assert.*;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.time.Duration;
import java.util.Map;
@@ -27,7 +28,6 @@ import org.springframework.core.io.ClassPathResource;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import org.testng.reporters.Files;
import net.shibboleth.idp.attribute.IdPAttribute;
import net.shibboleth.idp.attribute.StringAttributeValue;
@@ -182,7 +182,10 @@ public class StorageServiceDataConnectorTest {
connector.setMappingStrategy(mapper);
connector.initialize();
- final String testJson = Files.streamToString(getClass().getResourceAsStream(SCRIPT_PATH + "test.json"));
+ final String testJson;
+ try (var stream = getClass().getResourceAsStream(SCRIPT_PATH + "test.json")) {
+ testJson = new String(stream.readAllBytes(), StandardCharsets.UTF_8);
+ }
assert testJson!=null;
storage.create("foo", "bar", testJson, null);
diff --git a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/storage/impl/StorageServiceDataConnectorParserTest.java b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/storage/impl/StorageServiceDataConnectorParserTest.java
index cf1123ef5..e300f8f53 100644
--- a/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/storage/impl/StorageServiceDataConnectorParserTest.java
+++ b/shib-attribute-resolver-spring/src/test/java/net/shibboleth/idp/attribute/resolver/spring/dc/storage/impl/StorageServiceDataConnectorParserTest.java
@@ -19,6 +19,7 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -34,7 +35,6 @@ import org.springframework.core.io.ResourceLoader;
import org.springframework.mock.env.MockPropertySource;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
-import org.testng.reporters.Files;
import com.google.common.cache.Cache;
@@ -105,7 +105,10 @@ public class StorageServiceDataConnectorParserTest {
getDataConnector(propSource,
"net/shibboleth/idp/attribute/resolver/spring/dc/storage/storage-attribute-resolver-v2.xml");
assertNotNull(connector);
- final String streamAsString = Files.streamToString(getClass().getResourceAsStream(SCRIPT_PATH + "test.json"));
+ final String streamAsString;
+ try (var stream = getClass().getResourceAsStream(SCRIPT_PATH + "test.json")) {
+ streamAsString = new String(stream.readAllBytes(), StandardCharsets.UTF_8);
+ }
assert streamAsString!=null;
pendingTeardownContext.getBean(StorageService.class).create("foo", "bar", streamAsString, null);
@@ -181,7 +184,10 @@ public class StorageServiceDataConnectorParserTest {
"net/shibboleth/idp/attribute/resolver/spring/dc/storage/storage-attribute-resolver-spring-context.xml");
assertNotNull(connector);
- final String streamAsString = Files.streamToString(getClass().getResourceAsStream(SCRIPT_PATH + "test.json"));
+ final String streamAsString;
+ try (var stream = getClass().getResourceAsStream(SCRIPT_PATH + "test.json")) {
+ streamAsString = new String(stream.readAllBytes(), StandardCharsets.UTF_8);
+ }
assert streamAsString!=null;
pendingTeardownContext.getBean(StorageService.class).create("foo", "bar", streamAsString, null);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list