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 #141

Merged
merged 1 commit into from
Feb 1, 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 @@ -51,8 +51,8 @@
<revision>0.10.1</revision>
<changelist>-SNAPSHOT</changelist>
<!-- Baseline Jenkins version you use to build and test the plugin. Users must have this version or newer to run. -->
<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>
<spotless.check.skip>false</spotless.check.skip>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.DataBoundSetter;
import org.kohsuke.stapler.QueryParameter;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.kohsuke.stapler.export.Exported;

public class GitParameterDefinition extends ParameterDefinition implements Comparable<GitParameterDefinition> {
Expand Down Expand Up @@ -117,7 +117,7 @@ public GitParameterDefinition(
}

@Override
public ParameterValue createValue(StaplerRequest request) {
public ParameterValue createValue(StaplerRequest2 request) {
String value[] = request.getParameterValues(getName());
if (value == null || value.length == 0 || isBlank(value[0])) {
if (isTrue(requiredParameter)) {
Expand All @@ -130,7 +130,7 @@ public ParameterValue createValue(StaplerRequest request) {
}

@Override
public ParameterValue createValue(StaplerRequest request, JSONObject jO) {
public ParameterValue createValue(StaplerRequest2 request, JSONObject jO) {
Object value = jO.get("value");
StringBuilder strValue = new StringBuilder();
if (value instanceof String) {
Expand Down Expand Up @@ -713,7 +713,7 @@ private FormValidation validationRegularExpression(String value, String errorMes
}

@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
public boolean configure(StaplerRequest2 req, JSONObject json) throws FormException {
showNeedToCloneInformation = json.getBoolean("showNeedToCloneInformation");
save();
return super.configure(req, json);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package net.uaznia.lukanus.hudson.plugins.gitparameter.model;

import jakarta.servlet.ServletException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import jenkins.security.stapler.StaplerAccessibleType;
import org.apache.commons.lang.StringUtils;
import org.kohsuke.stapler.HttpResponse;
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.export.Flavor;
Expand Down Expand Up @@ -75,12 +75,12 @@ public void addError(String error) {
errors.add(error);
}

public void writeTo(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void writeTo(StaplerRequest2 req, StaplerResponse2 rsp) throws IOException, ServletException {
rsp.serveExposedBean(req, this, Flavor.JSON);
}

@Override
public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node)
public void generateResponse(StaplerRequest2 req, StaplerResponse2 rsp, Object node)
throws IOException, ServletException {
writeTo(req, rsp);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import java.util.regex.Matcher;
import net.sf.json.JSONObject;
import org.junit.Test;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* This test don't use jenkis rule
Expand All @@ -24,7 +24,7 @@ public class BasicTests {
* Test of createValue method, of class GitParameterDefinition.
*/
@Test
public void testCreateValue_StaplerRequest() {
public void testCreateValue_StaplerRequest2() {
GitParameterDefinition instance = new GitParameterDefinition(
NAME,
PT_REVISION,
Expand All @@ -38,7 +38,7 @@ public void testCreateValue_StaplerRequest() {
null,
false);

StaplerRequest request = mock(StaplerRequest.class);
StaplerRequest2 request = mock(StaplerRequest2.class);
ParameterValue result = instance.createValue(request);

assertEquals(result, new GitParameterValue(NAME, DEFAULT_VALUE));
Expand All @@ -59,7 +59,7 @@ public void matchesWithGithubPullRequestRefs() {
}

@Test
public void testCreateValue_StaplerRequest_ValueInRequest() {
public void testCreateValue_StaplerRequest2_ValueInRequest() {
GitParameterDefinition instance = new GitParameterDefinition(
NAME,
PT_REVISION,
Expand All @@ -73,7 +73,7 @@ public void testCreateValue_StaplerRequest_ValueInRequest() {
null,
false);

StaplerRequest request = mock(StaplerRequest.class);
StaplerRequest2 request = mock(StaplerRequest2.class);
when(request.getParameterValues(instance.getName())).thenReturn(new String[] {"master"});
ParameterValue result = instance.createValue(request);

Expand Down Expand Up @@ -156,9 +156,9 @@ public void testConstructorInitializesTagToGivenValueWhenNotNullOrWhitespace() {
* Test of createValue method, of class GitParameterDefinition.
*/
@Test
public void testCreateValue_StaplerRequest_JSONObject() {
public void testCreateValue_StaplerRequest2_JSONObject() {
System.out.println("createValue");
StaplerRequest request = mock(StaplerRequest.class);
StaplerRequest2 request = mock(StaplerRequest2.class);

Map<String, String> jsonR = new HashMap<>();
jsonR.put("value", "Git_param_value");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.MockFolder;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

/**
* @author lukanus
Expand Down Expand Up @@ -608,7 +608,7 @@ public void testRequiredParameterStaplerFail() {
null,
false);
def.setRequiredParameter(true);
StaplerRequest request = mock(StaplerRequest.class);
StaplerRequest2 request = mock(StaplerRequest2.class);
String[] result = new String[] {""};
when(request.getParameterValues("testName")).thenReturn(result);
def.createValue(request);
Expand All @@ -629,7 +629,7 @@ public void testRequiredParameterStaplerPass() {
null,
false);
def.setRequiredParameter(true);
StaplerRequest request = mock(StaplerRequest.class);
StaplerRequest2 request = mock(StaplerRequest2.class);
String[] result = new String[] {"master"};
when(request.getParameterValues("testName")).thenReturn(result);
def.createValue(request);
Expand All @@ -652,7 +652,7 @@ public void testRequiredParameterJSONFail() {
def.setRequiredParameter(true);
JSONObject o = new JSONObject();
o.put("value", "");
def.createValue(null, o);
def.createValue((StaplerRequest2) null, o);
}

@Test
Expand All @@ -673,7 +673,7 @@ public void testRequiredParameterJSONPass() {
JSONObject o = new JSONObject();
o.put("value", "master");
o.put("name", "testName");
def.createValue(null, o);
def.createValue((StaplerRequest2) null, o);
}

@Test
Expand Down
Loading