[java-idp-integration-tests] 02/03: Add private base URL and use it for status check when server starts
Tom Zeller
tzeller at dragonacea.biz
Tue Jul 16 22:39:04 UTC 2024
This is an automated email from the git hooks/post-receive script.
tzeller pushed a commit to branch main
in repository java-idp-integration-tests.
View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=bc4673fd252c137776c88d0fafd6dc0f53926c14
commit bc4673fd252c137776c88d0fafd6dc0f53926c14
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Tue Jul 16 17:34:58 2024 -0500
Add private base URL and use it for status check when server starts
---
.../idp/integration/tests/BaseIntegrationTest.java | 49 +++++++++++++++++++++-
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
index 1e59d78..8bdfd31 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseIntegrationTest.java
@@ -298,6 +298,12 @@ public abstract class BaseIntegrationTest {
/** Whether to use the secure base URL by default. Defaults to true. */
@Nonnull protected boolean useSecureBaseURL = true;
+ /** Non-secure private web server base URL. Defaults to http://localhost:8080. */
+ @NonnullAfterInit protected String privateBaseURL;
+
+ /** Secure private web server base URL. Defaults to https://localhost:8443. */
+ @NonnullAfterInit protected String privateSecureBaseURL;
+
/** Client IP range to allow access from. Defaults to "127.0.0.1/32". */
@Nonnull protected Set<String> clientIPRanges = new LinkedHashSet<String>(Arrays.asList("127.0.0.1/32"));
@@ -834,6 +840,22 @@ public abstract class BaseIntegrationTest {
secureUrlBuilder.setPort(securePort);
secureBaseURL = secureUrlBuilder.buildURL();
log.debug("URL '{}' is the secure base URL which clients should connect to.", secureBaseURL);
+
+ // Private non secure URL
+ final URLBuilder privateUrlBuilder = new URLBuilder();
+ privateUrlBuilder.setScheme("http");
+ privateUrlBuilder.setHost(privateAddress);
+ privateUrlBuilder.setPort(port);
+ privateBaseURL = privateUrlBuilder.buildURL();
+ log.debug("URL '{}' is the private base URL.", privateBaseURL);
+
+ // Private secure URL
+ final URLBuilder privateSecureUrlBuilder = new URLBuilder();
+ privateSecureUrlBuilder.setScheme("https");
+ privateSecureUrlBuilder.setHost(privateSecureAddress);
+ privateSecureUrlBuilder.setPort(securePort);
+ privateSecureBaseURL = privateSecureUrlBuilder.buildURL();
+ log.debug("URL '{}' is the private secure base URL.", privateSecureBaseURL);
}
/**
@@ -1131,7 +1153,7 @@ public abstract class BaseIntegrationTest {
server.setServletContainerBasePath(pathToJettyBase);
server.setServletContainerHomePath(pathToJettyHome);
server.setAdditionalCommands(serverCommands);
- server.setStatusPageURL(getBaseURL() + StatusTest.statusPath);
+ server.setStatusPageURL(getPrivateBaseURL() + StatusTest.statusPath);
server.setShutdownPort(shutdownPort);
server.initialize();
if (jettyVersion.startsWith("10") || isWindows()) {
@@ -1152,7 +1174,7 @@ public abstract class BaseIntegrationTest {
server.setServletContainerBasePath(pathToTomcatBase);
server.setServletContainerHomePath(pathToTomcatHome);
server.setAdditionalCommands(serverCommands);
- server.setStatusPageURL(getBaseURL() + StatusTest.statusPath);
+ server.setStatusPageURL(getPrivateBaseURL() + StatusTest.statusPath);
server.setShutdownPort(shutdownPort);
server.initialize();
server.start();
@@ -1901,6 +1923,29 @@ public abstract class BaseIntegrationTest {
return getBaseURL(useSecureBaseURL);
}
+ /**
+ * Get the private web server base URL. For example, "http://localhost:8080" or "https://localhost:8443" if secure.
+ *
+ * @param secure whether the URL should be secure
+ * @return the web server base URL
+ */
+ @NonnullAfterInit
+ public String getPrivateBaseURL(boolean secure) {
+ return (secure == false) ? privateBaseURL : privateSecureBaseURL;
+ }
+
+ /**
+ * Get the private web server base URL. For example, "http://localhost:8080" or "https://localhost:8443" if secure.
+ *
+ * Whether the URL returned is secure or not is determined by {@link #useSecureBaseURL}.
+ *
+ * @return the web server base URL
+ */
+ @NonnullAfterInit
+ public String getPrivateBaseURL() {
+ return getPrivateBaseURL(useSecureBaseURL);
+ }
+
/**
* Get the web server base URL. For example, "http://localhost:8080" or "https://localhost:8443" if secure.
*
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list