[java-identity-provider] branch main updated: Reimplement test using EmbeddedJetty test class.
Codeberg
noreply at shibboleth.net
Tue Dec 16 16:13:19 UTC 2025
This is an automated email from the git hooks/post-receive script.
codeberg pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
https://codeberg.org/Shibboleth/java-identity-provider/commit/a6caefa71740e3d16bcc4f0c4496a301190ad111
The following commit(s) were added to refs/heads/main by this push:
new a6caefa71 Reimplement test using EmbeddedJetty test class.
a6caefa71 is described below
commit a6caefa71740e3d16bcc4f0c4496a301190ad111
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Tue Dec 16 09:10:00 2025 -0700
Reimplement test using EmbeddedJetty test class.
---
.../net/shibboleth/idp/module/IdPModuleTest.java | 33 +++++++++++++++++-----
1 file changed, 26 insertions(+), 7 deletions(-)
diff --git a/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java b/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
index 7c689ad1c..bd774792b 100644
--- a/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
+++ b/idp-admin-api/src/test/java/net/shibboleth/idp/module/IdPModuleTest.java
@@ -19,7 +19,9 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.net.SocketException;
import java.net.URISyntaxException;
+import java.net.UnknownHostException;
import java.nio.file.AccessDeniedException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.FileVisitResult;
@@ -46,20 +48,22 @@ import org.opensaml.security.trust.impl.ExplicitKeyTrustEngine;
import org.opensaml.security.x509.BasicX509Credential;
import org.opensaml.security.x509.X509Credential;
import org.opensaml.security.x509.X509Support;
+import org.springframework.core.io.ClassPathResource;
import org.testng.Assert;
+import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import com.google.common.io.ByteStreams;
-
import net.shibboleth.idp.Version;
import net.shibboleth.profile.module.Module;
import net.shibboleth.profile.module.ModuleContext;
import net.shibboleth.profile.module.ModuleContext.OperationType;
import net.shibboleth.profile.module.ModuleException;
import net.shibboleth.shared.httpclient.HttpClientBuilder;
-import net.shibboleth.shared.testing.RepositorySupport;
+import net.shibboleth.shared.spring.resource.ResourceHelper;
+import net.shibboleth.shared.testing.EmbeddedJetty;
/**
* Unit tests exercising module code.
@@ -75,6 +79,22 @@ public class IdPModuleTest {
private Path testHome;
private IdPModule testModule;
private ModuleContext context;
+ private EmbeddedJetty jetty;
+
+ @BeforeClass
+ public void startJetty() throws UnknownHostException, SocketException {
+ jetty = new EmbeddedJetty();
+ jetty.startServer(new EmbeddedJetty.ResourceHandler(200,
+ ResourceHelper.of(new ClassPathResource("net/shibboleth/idp/module/test.vm"))));
+ }
+
+ @AfterClass
+ public void stopJetty() {
+ if (jetty != null) {
+ jetty.stopServer();
+ jetty = null;
+ }
+ }
@BeforeMethod
public void setUp() throws Exception {
@@ -178,8 +198,7 @@ public class IdPModuleTest {
Assert.assertEquals(resource.getDestination(), Path.of("conf/test.xml"));
resource = resources.next();
- Assert.assertEquals(resource.getSource(),
- RepositorySupport.buildHTTPSResourceURL("java-identity-provider", "idp-admin-api/src/test/resources/net/shibboleth/idp/module/test.vm"));
+ Assert.assertEquals(resource.getSource(), "https://localhost:8443/test.vm");
Assert.assertEquals(resource.getDestination(), Path.of("views/test.vm"));
// Test with no ranges.
@@ -310,8 +329,8 @@ public class IdPModuleTest {
@Nonnull private static TrustEngine<? super X509Credential> buildExplicitKeyTrustEngine()
throws URISyntaxException, CertificateException, IOException {
- try (final InputStream certStream = IdPModuleTest.class.getResourceAsStream("/net/shibboleth/idp/module/repo-entity.crt")) {
- final X509Certificate entityCert = X509Support.decodeCertificate(ByteStreams.toByteArray(certStream));
+ try (final InputStream certStream = EmbeddedJetty.getServerCertficateResource().getInputStream()) {
+ final X509Certificate entityCert = X509Support.decodeCertificate(certStream.readAllBytes());
assert entityCert != null;
final X509Credential entityCredential = new BasicX509Credential(entityCert);
return new ExplicitKeyTrustEngine(new StaticCredentialResolver(entityCredential));
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list