[java-idp-integration-tests] 01/05: Dynamically determine latest version of plugin snapshot
Codeberg
noreply at shibboleth.net
Fri Nov 14 22:15:20 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/eca2287af8bd3b232d2aba95d716d038267087a6
commit eca2287af8bd3b232d2aba95d716d038267087a6
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Wed Nov 5 16:38:14 2025 -0600
Dynamically determine latest version of plugin snapshot
Remove unused method
---
.../shibboleth/idp/integration/tests/BaseTest.java | 75 +++++++---------------
.../plugins/JDBCStorageServicePluginTest.java | 5 +-
.../tests/util/PluginSnapshotSupport.java | 33 +++++++++-
3 files changed, 56 insertions(+), 57 deletions(-)
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 cd5317e..35267c2 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/BaseTest.java
@@ -3050,58 +3050,6 @@ public abstract class BaseTest {
logProcess(process, "Remove plugin :");
}
- /**
- * Install plugin already downloaded to src/test/plugins.
- *
- * @param plugin
- * the plugin id
- * @param file
- * the plugin distribution
- * @throws IOException
- * if an error occurs
- */
- public void installLocalPlugin(@Nonnull final String plugin, @Nonnull final String file) throws IOException {
-
- // Path to the project build directory.
- final Path buildPath = Paths.get(TEST_DISTRIBUTIONS_DIRECTORY);
- assert buildPath.toAbsolutePath().toFile().exists() : "Path to build directory not found";
-
- // Path to project directory
- final Path project = buildPath.toAbsolutePath().toFile().getParentFile().toPath();
- assert project.toAbsolutePath().toFile().exists() : "Path to project not found";
-
- // Path to src/test/plugins
- final Path pathToPlugins = project.resolve(Paths.get("src", "test", "plugins"));
- assert pathToPlugins.toAbsolutePath().toFile().exists() : "Path to test plugins not found";
-
- // Path to plugin
- final Path pathToPlugin = pathToPlugins.resolve(file);
- log.debug("Path to plugin '{}'", pathToPlugin.toAbsolutePath());
- assert pathToPlugins.toAbsolutePath().toFile().exists() : "Path to plugin not found";
-
- // Path to plugin truststore
- final Path pathToTruststore = pathToTruststores.resolve(plugin).resolve("truststore.asc");
- log.debug("Path to plugin truststore '{}'", pathToTruststore);
- assert pathToTruststore.toAbsolutePath().toFile().exists() : "Path to plugin truststore not found";
-
- final String truststore = pathToTruststore.toString();
-
- final String[] commands = new String[] { //
- pluginCLI, //
- "--noRebuild", //
- "--noPrompt", //
- "--input", pathToPlugin.toString(), //
- "--truststore ", truststore };
-
- final Process process = new ProcessBuilder() //
- .command(commands)
- .directory(idpHome)
- .redirectErrorStream(true)
- .start();
-
- logProcess(process, "Install local plugin :");
- }
-
/**
* Add module to Jetty.
*
@@ -3362,6 +3310,29 @@ public abstract class BaseTest {
installLocalPlugin(plugin, fileName, pathToTruststores.resolve("SHIBBOLETH_SNAPSHOT_PGP_KEYS"));
}
+ /**
+ * Install plugin snapshot.
+ *
+ * Downloads the Maven distribution artifact for the plugin.
+ *
+ * @param pluginId
+ * the plugin ID
+ * @param pluginArtifactId
+ * the artifactId of the plugin distribution Maven artifact
+ */
+ public void installPluginSnapshot(@Nonnull final String pluginId, @Nonnull final String pluginArtifactId) {
+ try {
+ final PluginSnapshotSupport snapshotSupport = new PluginSnapshotSupport() //
+ .setPluginId(pluginId) //
+ .setPluginArtifactId(pluginArtifactId);
+ installPluginSnapshot(pluginId, snapshotSupport.getLatestSnapshotVersion(), pluginArtifactId);
+ } catch (MalformedURLException e) {
+ throw new RuntimeException(e);
+ } catch (URISyntaxException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
/**
* Install plugin snapshot.
*
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/plugins/JDBCStorageServicePluginTest.java b/src/test/java/net/shibboleth/idp/integration/tests/plugins/JDBCStorageServicePluginTest.java
index 76708af..deff348 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/plugins/JDBCStorageServicePluginTest.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/plugins/JDBCStorageServicePluginTest.java
@@ -47,12 +47,9 @@ public class JDBCStorageServicePluginTest extends BasePluginTest {
final String pluginId = "net.shibboleth.plugin.storage.jdbc";
- // TODO this version is fragile - will need to be manually updated
- final String pluginSnapshotVersion = "2.0.2-SNAPSHOT";
-
final String pluginArtifactId = "java-plugin-jdbc-storage";
- installPluginSnapshot(pluginId, pluginSnapshotVersion, pluginArtifactId);
+ installPluginSnapshot(pluginId, pluginArtifactId);
assertPluginsAreInstalled(pluginId);
diff --git a/src/test/java/net/shibboleth/idp/integration/tests/util/PluginSnapshotSupport.java b/src/test/java/net/shibboleth/idp/integration/tests/util/PluginSnapshotSupport.java
index abfcae3..36e7f9e 100644
--- a/src/test/java/net/shibboleth/idp/integration/tests/util/PluginSnapshotSupport.java
+++ b/src/test/java/net/shibboleth/idp/integration/tests/util/PluginSnapshotSupport.java
@@ -118,12 +118,12 @@ public class PluginSnapshotSupport {
final Matcher matcher = pattern.matcher(line);
if (matcher.find()) {
fileName = matcher.group(1);
- log.debug("Latest snapshot is '{}' for '{}' '{}'", fileName, pluginArtifactId, pluginVersion);
}
}
} catch (IOException e) {
throw new RuntimeException(e);
}
+ log.debug("Latest snapshot filename is '{}' for '{}' '{}'", fileName, pluginArtifactId, pluginVersion);
return fileName;
} catch (MalformedURLException e) {
throw new RuntimeException(e);
@@ -131,4 +131,35 @@ public class PluginSnapshotSupport {
throw new RuntimeException(e1);
}
}
+
+ /**
+ * Get the version of the latest snapshot plugin distribution Maven artifact.
+ *
+ * @return the latest snapshot plugin version
+ *
+ * @throws RuntimeException
+ * if an error occurs
+ */
+ public String getLatestSnapshotVersion() throws MalformedURLException, URISyntaxException {
+ final String groupPath = pluginId.replace(".", "/");
+ final String str = String.join("/", snapshotRepositoryBaseURL, groupPath, pluginArtifactId) + "/";
+ final URL baseUrl = new URI(str).toURL();
+
+ final Pattern pattern = Pattern.compile("<a href=\"(.*?)/\">");
+ String snapshotVersion = null;
+ try (final BufferedReader br = new BufferedReader(new InputStreamReader(baseUrl.openStream()))) {
+ String line;
+ while ((line = br.readLine()) != null) {
+ // log.trace(line);
+ final Matcher matcher = pattern.matcher(line);
+ if (matcher.find()) {
+ snapshotVersion = matcher.group(1);
+ }
+ }
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ log.debug("Latest snapshot version is '{}' for '{}'", snapshotVersion, pluginArtifactId);
+ return snapshotVersion;
+ }
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list