From 2c1e8399ca108fcdd089e8c1fa27014750bf4f56 Mon Sep 17 00:00:00 2001 From: Emilio Escobar Date: Mon, 1 Feb 2021 09:21:22 +0100 Subject: [PATCH] [JENKINS-64746] public API hudson.model.UpdateCenter.HudsonUpgradeJob constructor signature change (#5216) Co-authored-by: Jesse Glick --- .../main/java/hudson/model/UpdateCenter.java | 35 +++++++++++++++++++ .../java/jenkins/install/InstallUtilTest.java | 4 ++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/core/src/main/java/hudson/model/UpdateCenter.java b/core/src/main/java/hudson/model/UpdateCenter.java index a296ae91575c..95b125cd7118 100644 --- a/core/src/main/java/hudson/model/UpdateCenter.java +++ b/core/src/main/java/hudson/model/UpdateCenter.java @@ -2111,6 +2111,14 @@ public InstallationJob(Plugin plugin, UpdateSite site, Authentication auth) { this(plugin,site,auth,false); } + /** + * @deprecated use {@link InstallationJob(Plugin, UpdateSite, Authentication, boolean)} + */ + @Deprecated + public InstallationJob(Plugin plugin, UpdateSite site, org.acegisecurity.Authentication auth, boolean dynamicLoad) { + this(plugin, site, auth.toSpring(), dynamicLoad); + } + public InstallationJob(Plugin plugin, UpdateSite site, Authentication auth, boolean dynamicLoad) { super(site, auth); this.plugin = plugin; @@ -2326,6 +2334,15 @@ public final class PluginDowngradeJob extends DownloadJob { private final PluginManager pm = Jenkins.get().getPluginManager(); + /** + * @deprecated use {@link PluginDowngradeJob(Plugin, UpdateSite, Authentication)} + */ + @Deprecated + public PluginDowngradeJob(Plugin plugin, UpdateSite site, org.acegisecurity.Authentication auth) { + this(plugin, site, auth.toSpring()); + } + + public PluginDowngradeJob(Plugin plugin, UpdateSite site, Authentication auth) { super(site, auth); this.plugin = plugin; @@ -2410,6 +2427,15 @@ public String toString() { * Represents the state of the upgrade activity of Jenkins core. */ public final class HudsonUpgradeJob extends DownloadJob { + + /** + * @deprecated use {@link HudsonUpgradeJob(UpdateSite site, Authentication auth)} + */ + @Deprecated + public HudsonUpgradeJob(UpdateSite site, org.acegisecurity.Authentication auth) { + super(site, auth.toSpring()); + } + public HudsonUpgradeJob(UpdateSite site, Authentication auth) { super(site, auth); } @@ -2444,6 +2470,15 @@ protected void replace(File dst, File src) throws IOException { } public final class HudsonDowngradeJob extends DownloadJob { + + /** + * @deprecated use {@link HudsonDowngradeJob(UpdateSite site, Authentication auth)} + */ + @Deprecated + public HudsonDowngradeJob(UpdateSite site, org.acegisecurity.Authentication auth) { + super(site, auth.toSpring()); + } + public HudsonDowngradeJob(UpdateSite site, Authentication auth) { super(site, auth); } diff --git a/test/src/test/java/jenkins/install/InstallUtilTest.java b/test/src/test/java/jenkins/install/InstallUtilTest.java index 3ae960abb3d7..25e4fdb363ce 100644 --- a/test/src/test/java/jenkins/install/InstallUtilTest.java +++ b/test/src/test/java/jenkins/install/InstallUtilTest.java @@ -30,6 +30,7 @@ import java.util.Map; import java.util.UUID; +import hudson.security.ACL; import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -52,6 +53,7 @@ import jenkins.model.Jenkins; import net.sf.json.JSONArray; import net.sf.json.JSONObject; +import org.springframework.security.core.Authentication; /** * Test @@ -180,7 +182,7 @@ else if("Installing".equals(statusType)) { json.put("dependencies", new JSONArray()); Plugin p = new Plugin(getId(), json); - InstallationJob job = new InstallationJob(p, null, null, false); + InstallationJob job = new InstallationJob(p, null, (Authentication) null, false); job.status = status; job.setCorrelationId(UUID.randomUUID()); // this indicates the plugin was 'directly selected' updates.add(job);