Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate from EE 8 to EE 9 #743

Merged
merged 1 commit into from
Jan 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.5</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -55,8 +55,8 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.452</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

@Extension
public class LockableResourcesManager extends GlobalConfiguration {
Expand Down Expand Up @@ -1046,7 +1046,7 @@ public void changeQueueOrder(final String queueId, final int newPosition) throws

// ---------------------------------------------------------------------------
@Override
public boolean configure(StaplerRequest req, JSONObject json) {
public boolean configure(StaplerRequest2 req, JSONObject json) {
synchronized (this.syncResources) {
final List<LockableResource> oldDeclaredResources = new ArrayList<>(getDeclaredResources());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.kohsuke.stapler.AncestorInPath;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.interceptor.RequirePOST;

public class RequiredResourcesProperty extends JobProperty<Job<?, ?>> {
Expand Down Expand Up @@ -161,7 +161,7 @@ public boolean isApplicable(Class<? extends Job> jobType) {
}

@Override
public RequiredResourcesProperty newInstance(StaplerRequest req, JSONObject formData) throws FormException {
public RequiredResourcesProperty newInstance(StaplerRequest2 req, JSONObject formData) throws FormException {
if (formData.containsKey("required-lockable-resources")) {
return (RequiredResourcesProperty)
super.newInstance(req, formData.getJSONObject("required-lockable-resources"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import hudson.security.Permission;
import hudson.security.PermissionGroup;
import hudson.security.PermissionScope;
import jakarta.servlet.ServletException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
Expand All @@ -27,7 +28,6 @@
import java.util.List;
import java.util.Set;
import java.util.logging.Logger;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import org.jenkins.plugins.lockableresources.LockableResource;
import org.jenkins.plugins.lockableresources.LockableResourcesManager;
Expand All @@ -37,8 +37,8 @@
import org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SecureGroovyScript;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.kohsuke.stapler.export.Exported;
import org.kohsuke.stapler.export.ExportedBean;
import org.kohsuke.stapler.interceptor.RequirePOST;
Expand Down Expand Up @@ -516,7 +516,7 @@ public LockableResourcesStruct getOldestQueue() {

// ---------------------------------------------------------------------------
@RequirePOST
public void doUnlock(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void doUnlock(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
Jenkins.get().checkPermission(UNLOCK);

List<LockableResource> resources = this.getResourcesFromRequest(req, rsp);
Expand All @@ -531,7 +531,7 @@ public void doUnlock(StaplerRequest req, StaplerResponse rsp) throws IOException

// ---------------------------------------------------------------------------
@RequirePOST
public void doReserve(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void doReserve(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
Jenkins.get().checkPermission(RESERVE);

List<LockableResource> resources = this.getResourcesFromRequest(req, rsp);
Expand All @@ -553,7 +553,7 @@ public void doReserve(StaplerRequest req, StaplerResponse rsp) throws IOExceptio

// ---------------------------------------------------------------------------
@RequirePOST
public void doSteal(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void doSteal(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
Jenkins.get().checkPermission(STEAL);

List<LockableResource> resources = this.getResourcesFromRequest(req, rsp);
Expand All @@ -571,7 +571,7 @@ public void doSteal(StaplerRequest req, StaplerResponse rsp) throws IOException,

// ---------------------------------------------------------------------------
@RequirePOST
public void doReassign(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void doReassign(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
Jenkins.get().checkPermission(STEAL);

String userName = getUserName();
Expand Down Expand Up @@ -603,7 +603,7 @@ public void doReassign(StaplerRequest req, StaplerResponse rsp) throws IOExcepti

// ---------------------------------------------------------------------------
@RequirePOST
public void doUnreserve(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void doUnreserve(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
Jenkins.get().checkPermission(RESERVE);

List<LockableResource> resources = this.getResourcesFromRequest(req, rsp);
Expand All @@ -626,7 +626,7 @@ public void doUnreserve(StaplerRequest req, StaplerResponse rsp) throws IOExcept

// ---------------------------------------------------------------------------
@RequirePOST
public void doReset(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void doReset(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
Jenkins.get().checkPermission(UNLOCK);
// Should this also be permitted by "STEAL"?..

Expand All @@ -642,7 +642,7 @@ public void doReset(StaplerRequest req, StaplerResponse rsp) throws IOException,

// ---------------------------------------------------------------------------
@RequirePOST
public void doSaveNote(final StaplerRequest req, final StaplerResponse rsp) throws IOException, ServletException {
public void doSaveNote(final StaplerRequest2 req, final StaplerResponse2 rsp) throws IOException, ServletException {
Jenkins.get().checkPermission(RESERVE);

String resourceName = req.getParameter("resource");
Expand All @@ -669,7 +669,7 @@ public void doSaveNote(final StaplerRequest req, final StaplerResponse rsp) thro
/** Change queue order (item position) */
@Restricted(NoExternalUse.class) // used by jelly
@RequirePOST
public void doChangeQueueOrder(final StaplerRequest req, final StaplerResponse rsp)
public void doChangeQueueOrder(final StaplerRequest2 req, final StaplerResponse2 rsp)
throws IOException, ServletException {
Jenkins.get().checkPermission(QUEUE);

Expand Down Expand Up @@ -697,7 +697,7 @@ public void doChangeQueueOrder(final StaplerRequest req, final StaplerResponse r
}

// ---------------------------------------------------------------------------
private List<LockableResource> getResourcesFromRequest(final StaplerRequest req, final StaplerResponse rsp)
private List<LockableResource> getResourcesFromRequest(final StaplerRequest2 req, final StaplerResponse2 rsp)
throws IOException, ServletException {
// todo, when you try to improve the API to use multiple resources (a list instead of single
// one)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import net.sf.json.JSONObject;
import org.jenkins.plugins.lockableresources.actions.LockableResourcesRootAction;
import org.jvnet.hudson.test.JenkinsRule;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;

Expand All @@ -32,10 +32,10 @@ public final class TestHelpers {
private static final int MAX_WAIT = 5000;

@Mock
private StaplerRequest req;
private StaplerRequest2 req;

@Mock
private StaplerResponse rsp;
private StaplerResponse2 rsp;

private AutoCloseable mocks;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
import hudson.model.Item;
import hudson.model.User;
import hudson.security.AccessDeniedException3;
import jakarta.servlet.ServletException;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletException;
import jenkins.model.Jenkins;
import org.jenkins.plugins.lockableresources.LockStepTestBase;
import org.jenkins.plugins.lockableresources.LockableResource;
Expand All @@ -29,8 +29,8 @@
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.MockAuthorizationStrategy;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.security.access.AccessDeniedException;
Expand All @@ -42,10 +42,10 @@ public class LockableResourcesRootActionTest extends LockStepTestBase {
public JenkinsRule j = new JenkinsRule();

@Mock
private StaplerRequest req;
private StaplerRequest2 req;

@Mock
private StaplerResponse rsp;
private StaplerResponse2 rsp;

private AutoCloseable mocks;

Expand Down
Loading