[java-idp-integration-tests] 01/04: Add methods to compare IdP versions

Codeberg noreply at shibboleth.net
Fri Dec 5 16:52:48 UTC 2025


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

codeberg pushed a commit to branch main
in repository java-idp-integration-tests.

View the commit online:
https://codeberg.org/Shibboleth/java-idp-integration-tests/commit/be17638ef43b10b27311e914e5d7bcee8e09e3d9

commit be17638ef43b10b27311e914e5d7bcee8e09e3d9
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Tue Dec 2 18:53:44 2025 -0600

    Add methods to compare IdP versions
    
    Use built-in Java support for parsing versions.
    
    Support idp-to-be-tested.version system property when running tests from
    Eclipse.
---
 .../shibboleth/idp/integration/tests/BaseTest.java | 28 +++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)

diff --git a/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java b/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java
index 5f3b3b4..38d659f 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.UncheckedIOException;
 import java.lang.ProcessBuilder.Redirect;
+import java.lang.module.ModuleDescriptor.Version;
 import java.lang.reflect.Method;
 import java.net.InetAddress;
 import java.net.InetSocketAddress;
@@ -465,7 +466,8 @@ public abstract class BaseTest {
         Assert.assertTrue(buildPath.toAbsolutePath().toFile().exists(), "Path to build directory not found");
 
         // Get IdP version from system property populated by Surefire plugin
-        idpVersion = System.getProperty("idp.version");
+        // Prefer idp-to-be-tested.version to idp.version
+        idpVersion = System.getProperty("idp-to-be-tested.version", System.getProperty("idp.version"));
         log.debug("Testing IdP version '{}'", idpVersion);
 
         // Path to idp distribution.
@@ -3608,4 +3610,28 @@ public abstract class BaseTest {
         return true;
     }
 
+    /**
+     * Whether the IdP version being tested is after the given version.
+     *
+     * @param version
+     *            the version to compare
+     *
+     * @return true if the IdP version being tested is after the given version, false otherwise
+     */
+    public boolean isIdPVersionAfter(@Nonnull final String version) {
+        return (Version.parse(idpVersion).compareTo(Version.parse(version)) > 0) ? true : false;
+    }
+
+    /**
+     * Whether the IdP version being tested is before the given version.
+     *
+     * @param version
+     *            the version to compare
+     *
+     * @return true if the IdP version being tested is before the given version, false otherwise
+     */
+    public boolean isIdPVersionBefore(@Nonnull final String version) {
+        return (Version.parse(idpVersion).compareTo(Version.parse(version)) < 0) ? true : false;
+    }
+
 }

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


More information about the commits mailing list