Skip to content

Commit

Permalink
Migrate from EE 8 to EE 9 (#449)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Jan 27, 2025
1 parent c6475e4 commit b9f54d3
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.88</version>
<version>5.6</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -33,8 +33,8 @@
<revision>5.2.1</revision>
<changelist>-SNAPSHOT</changelist>
<gitHubRepo>jenkinsci/priority-sorter-plugin</gitHubRepo>
<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>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.threshold>Low</spotbugs.threshold>
<spotless.check.skip>false</spotless.check.skip>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import hudson.security.ACL;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;
import jakarta.servlet.ServletException;
import java.io.IOException;
import java.util.Collection;
import java.util.Collections;
Expand All @@ -50,7 +51,6 @@
import java.util.logging.Logger;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.servlet.ServletException;
import jenkins.advancedqueue.jobinclusion.JobInclusionStrategy;
import jenkins.advancedqueue.priority.PriorityStrategy;
import jenkins.model.GlobalConfiguration;
Expand All @@ -62,8 +62,8 @@
import org.jenkins.ui.icon.IconSpec;
import org.jenkinsci.plugins.workflow.support.steps.ExecutorStepExecution;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;

/**
* @author Magnus Sandberg
Expand Down Expand Up @@ -165,7 +165,7 @@ public ListBoxModel getPriorities() {
return items;
}

public void doPriorityConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void doPriorityConfigSubmit(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
jobGroups = new LinkedList<JobGroup>();
id2jobGroup = new HashMap<Integer, JobGroup>();
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
import jenkins.advancedqueue.priority.PriorityStrategy;
import net.sf.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* @author Magnus Sandberg
Expand All @@ -55,7 +55,7 @@ public class PriorityJobProperty extends JobProperty<Job<?, ?>> {
public final int priority;

@Override
public JobProperty<?> reconfigure(StaplerRequest req, JSONObject form) throws FormException {
public JobProperty<?> reconfigure(StaplerRequest2 req, JSONObject form) throws FormException {
return super.reconfigure(req, form);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

import edu.umd.cs.findbugs.annotations.CheckForNull;
import hudson.util.ListBoxModel;
import jakarta.servlet.ServletException;
import java.io.IOException;
import javax.servlet.ServletException;
import jenkins.advancedqueue.PrioritySorterConfiguration;
import jenkins.advancedqueue.sorter.SorterStrategy;
import jenkins.advancedqueue.sorter.SorterStrategyDescriptor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.Test;
import org.junit.rules.TestName;
import org.jvnet.hudson.test.JenkinsRule;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

public class PriorityJobPropertyTest {

Expand Down Expand Up @@ -59,7 +59,7 @@ public void priorityJobProperty_returnsCorrectUseJobPriority() {

@Test
public void priorityJobProperty_reconfigureNullOnEmpty() throws Descriptor.FormException {
StaplerRequest req = mock(StaplerRequest.class);
StaplerRequest2 req = mock(StaplerRequest2.class);
assertNull(property.reconfigure(req, new JSONObject()));
}

Expand Down
10 changes: 5 additions & 5 deletions src/test/java/jenkins/advancedqueue/test/SubmitTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
import static org.mockito.Mockito.when;

import com.google.common.base.Charsets;
import jakarta.servlet.ServletException;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;
import javax.servlet.ServletException;
import jenkins.advancedqueue.JobGroup;
import jenkins.advancedqueue.PriorityConfiguration;
import jenkins.advancedqueue.jobinclusion.strategy.ViewBasedJobInclusionStrategy;
Expand All @@ -20,8 +20,8 @@
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.recipes.LocalData;
import org.kohsuke.stapler.MockStaplerRequest;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.StaplerResponse2;

public class SubmitTest {

Expand All @@ -33,8 +33,8 @@ public class SubmitTest {
public void shouldGeneratePriorityConfigurationUsingDataBoundConstructor() throws IOException, ServletException {
PriorityConfiguration priorityConfiguration =
(PriorityConfiguration) j.jenkins.getDescriptor(PriorityConfiguration.class);
StaplerResponse staplerResponse = mock(StaplerResponse.class);
StaplerRequest staplerRequest = new MockStaplerRequest.MockStaplerRequestBuilder(
StaplerResponse2 staplerResponse = mock(StaplerResponse2.class);
StaplerRequest2 staplerRequest = new MockStaplerRequest.MockStaplerRequestBuilder(
j, "advanced-build-queue/priorityConfigSubmit")
.build();

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/org/kohsuke/stapler/MockStaplerRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
import static org.mockito.Mockito.mock;

import edu.umd.cs.findbugs.annotations.NonNull;
import jakarta.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.jvnet.hudson.test.JenkinsRule;

public class MockStaplerRequest {
Expand Down Expand Up @@ -63,14 +63,14 @@ public MockStaplerRequestBuilder withAncestor(AncestorImpl ancestor) {
return this;
}

public StaplerRequest build() throws AssertionError {
public StaplerRequest2 build() throws AssertionError {
HttpServletRequest rawRequest = mock(HttpServletRequest.class);
return new RequestImpl(stapler != null ? stapler : getStapler(), rawRequest, ancestors, tokens);
}

private Stapler getStapler() {
final Stapler stapler = new Stapler();
stapler.setWebApp(new WebApp(r.jenkins.servletContext));
stapler.setWebApp(new WebApp(r.jenkins.getServletContext()));
return stapler;
}
}
Expand Down

0 comments on commit b9f54d3

Please sign in to comment.