[java-opensaml] branch main updated: Remediate out RepositorySupport from test.

Codeberg noreply at shibboleth.net
Wed Jul 8 19:35:11 UTC 2026


This is an automated email from the git hooks/post-receive script.

codeberg pushed a commit to branch main
in repository java-opensaml.

View the commit online:
https://codeberg.org/Shibboleth/java-opensaml/commit/a2d960d4037083025b2e1f7f049c3aba8632d1f1

The following commit(s) were added to refs/heads/main by this push:
     new a2d960d40 Remediate out RepositorySupport from test.
a2d960d40 is described below

commit a2d960d4037083025b2e1f7f049c3aba8632d1f1
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Wed Jul 8 15:35:02 2026 -0400

    Remediate out RepositorySupport from test.
---
 .../SecurityEnhancedHTTPResourceTest.java          | 37 +++++++++++++++++-----
 1 file changed, 29 insertions(+), 8 deletions(-)

diff --git a/opensaml-security-api/src/test/java/org/opensaml/security/httpclient/SecurityEnhancedHTTPResourceTest.java b/opensaml-security-api/src/test/java/org/opensaml/security/httpclient/SecurityEnhancedHTTPResourceTest.java
index 461a880f2..956637dec 100644
--- a/opensaml-security-api/src/test/java/org/opensaml/security/httpclient/SecurityEnhancedHTTPResourceTest.java
+++ b/opensaml-security-api/src/test/java/org/opensaml/security/httpclient/SecurityEnhancedHTTPResourceTest.java
@@ -15,6 +15,8 @@
 package org.opensaml.security.httpclient;
 
 import java.io.IOException;
+import java.net.SocketException;
+import java.net.UnknownHostException;
 
 import javax.net.ssl.HostnameVerifier;
 import javax.net.ssl.SSLSession;
@@ -23,12 +25,14 @@ import net.shibboleth.shared.collection.CollectionSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.httpclient.HttpClientBuilder;
 import net.shibboleth.shared.spring.httpclient.resource.HTTPResource;
-import net.shibboleth.shared.testing.RepositorySupport;
+import net.shibboleth.shared.spring.resource.ResourceHelper;
+import net.shibboleth.shared.testing.EmbeddedJetty;
 import net.shibboleth.shared.testing.ResourceTestHelper;
 
 import org.apache.hc.client5.http.classic.HttpClient;
 import org.springframework.core.io.ClassPathResource;
 import org.testng.Assert;
+import org.testng.annotations.AfterClass;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
@@ -39,20 +43,37 @@ import org.testng.annotations.Test;
 @SuppressWarnings("javadoc")
 public class SecurityEnhancedHTTPResourceTest {
 
-    private final String path = "data/org/opensaml/security/httpclient/document.xml";
-    private final String pathPrefix = "opensaml-security-api/src/test/resources/";
-    private final String existsHttps = RepositorySupport.buildHTTPSResourceURL("java-opensaml", pathPrefix+ path);
-    private final String existsHttp = RepositorySupport.buildHTTPResourceURL("java-opensaml", pathPrefix+ path, false);
+    private static final String DATA_PATH = "data/org/opensaml/security/httpclient/document.xml";
+    private final String existsHttps = "https://localhost:8443/document.xml";
+    private final String existsHttp = "http://localhost:8080/document.xml";
 
+    private EmbeddedJetty jetty;
     private HttpClient client;
     private HttpClientSecurityParameters params;
     private HttpClientSecurityContextHandler handler;
 
-    @BeforeClass public void setupClient() throws Exception {
+    @BeforeClass
+    public void startJetty() throws UnknownHostException, SocketException {
+        jetty = new EmbeddedJetty();
+        jetty.startServer(new EmbeddedJetty.ResourceHandler(200,
+                ResourceHelper.of(new ClassPathResource(DATA_PATH))));
+    }
+    
+    @AfterClass
+    public void stopJetty() {
+        if (jetty != null) {
+            jetty.stopServer();
+            jetty = null;
+        }
+    }    
+    
+    @BeforeClass
+    public void setupClient() throws Exception {
         client = (new HttpClientBuilder()).buildClient();
     }
     
-    @BeforeMethod public void setUp() throws ComponentInitializationException {
+    @BeforeMethod
+    public void setUp() throws ComponentInitializationException {
         params = new HttpClientSecurityParameters();
         handler = new HttpClientSecurityContextHandler();
         handler.setHttpClientSecurityParameters(params);
@@ -63,7 +84,7 @@ public class SecurityEnhancedHTTPResourceTest {
         final HTTPResource existsResource = new HTTPResource(client, existsHttp);
         existsResource.setHttpClientContextHandler(handler);
         
-        Assert.assertTrue(ResourceTestHelper.compare(existsResource, new ClassPathResource(path)));
+        Assert.assertTrue(ResourceTestHelper.compare(existsResource, new ClassPathResource(DATA_PATH)));
     }
 
     @Test public void testHostnameRejected() throws IOException, ComponentInitializationException {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list