Skip to content
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
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ jobs:
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: adopt
java-version: 21
distribution: temurin

- run: mvn --batch-mode verify
8 changes: 4 additions & 4 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: adopt
java-version: 21
distribution: temurin

- name: Generate code coverage
run: mvn --batch-mode test
Expand Down
10 changes: 5 additions & 5 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.7</version>
<relativePath />
</parent>

Expand All @@ -27,8 +27,8 @@
<revision>5.0.1</revision>
<changelist>-SNAPSHOT</changelist>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.414</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.1</jenkins.version>

<gitHubRepo>jenkinsci/office-365-connector-plugin</gitHubRepo>

Expand All @@ -44,7 +44,7 @@
https://repo.jenkins-ci.org/artifactory/public/io/jenkins/tools/bom/
https://www.jenkins.io/doc/developer/plugin-development/dependency-management/#jenkins-plugin-bom
-->
<version>2982.vdce2153031a_0</version>
<version>3893.v213a_42768d35</version>
<scope>import</scope>
<type>pom</type>
</dependency>
Expand Down Expand Up @@ -97,7 +97,7 @@
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.7</version>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/jenkins/plugins/office365connector/Webhook.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,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;

public class Webhook extends AbstractDescribableImpl<Webhook> {

Expand Down Expand Up @@ -258,7 +258,7 @@ public void setGlobalName(String name) {
}

@Override
public boolean configure(StaplerRequest req, JSONObject formData) {
public boolean configure(StaplerRequest2 req, JSONObject formData) {
req.bindJSON(this, formData);
save();
return true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.jenkinsci.Symbol;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;

@Extension
@Symbol("office365ConnectorWebhooks")
Expand Down Expand Up @@ -56,7 +56,7 @@ public String getDisplayName() {
}

@Override
public WebhookJobProperty newInstance(StaplerRequest req, JSONObject formData) {
public WebhookJobProperty newInstance(StaplerRequest2 req, JSONObject formData) {

List<Webhook> webhooks = new ArrayList<>();
if (formData != null && !formData.isNullObject()) {
Expand All @@ -75,7 +75,7 @@ public WebhookJobProperty newInstance(StaplerRequest req, JSONObject formData) {
}

@Override
public boolean configure(StaplerRequest req, JSONObject formData) {
public boolean configure(StaplerRequest2 req, JSONObject formData) {
save();
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.mockito.MockedStatic;

/**
Expand Down Expand Up @@ -102,7 +102,7 @@ public void getUrl_ReturnsUrl() {
public void configure_ReturnsTrue() {

// given
StaplerRequest staplerRequest = mock(StaplerRequest.class);
StaplerRequest2 staplerRequest = mock(StaplerRequest2.class);
when(staplerRequest.bindJSON(any(), any())).thenReturn("");

// when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerRequest2;
import org.mockito.ArgumentMatchers;
import org.mockito.MockedStatic;

Expand Down Expand Up @@ -119,7 +119,7 @@ public void newInstance_OnNullObject_ReturnsJobProperty() {
WebhookJobPropertyDescriptor descriptor = new WebhookJobPropertyDescriptor();

// when
WebhookJobProperty property = descriptor.newInstance(null, null);
WebhookJobProperty property = descriptor.newInstance((StaplerRequest2) null, null);

// then
assertThat(property).isNotNull();
Expand All @@ -134,7 +134,7 @@ public void newInstance_OnNullForm_ReturnsJobProperty() {
JSONObject jsonObject = new JSONObject(true);

// when
WebhookJobProperty property = descriptor.newInstance(null, jsonObject);
WebhookJobProperty property = descriptor.newInstance((StaplerRequest2) null, jsonObject);

// then
assertThat(property).isNotNull();
Expand All @@ -149,7 +149,7 @@ public void newInstance_OnEmptyForm_ReturnsJobProperty() {
JSONObject jsonObject = new JSONObject();

// when
WebhookJobProperty property = descriptor.newInstance(null, jsonObject);
WebhookJobProperty property = descriptor.newInstance((StaplerRequest2) null, jsonObject);

// then
assertThat(property).isNotNull();
Expand All @@ -165,7 +165,7 @@ public void newInstance_OnEmptyWebhook_ReturnsJobProperty() {
jsonObject.put(KEY, Collections.emptyList());

// when
WebhookJobProperty property = descriptor.newInstance(null, jsonObject);
WebhookJobProperty property = descriptor.newInstance((StaplerRequest2) null, jsonObject);

// then
assertThat(property).isNotNull();
Expand All @@ -188,7 +188,7 @@ public void newInstance_OnSingleWebhook_ReturnsJobProperty() {

jsonObject.putAll(map, config);

StaplerRequest request = mock(StaplerRequest.class);
StaplerRequest2 request = mock(StaplerRequest2.class);
when(request.bindJSON(ArgumentMatchers.any(), (JSONObject) ArgumentMatchers.eq(jsonObject.get(KEY)))).thenReturn(webhook);

// when
Expand Down Expand Up @@ -216,7 +216,7 @@ public void newInstance_OnArrayWebhook_ReturnsJobProperty() {

jsonObject.putAll(map, config);

StaplerRequest request = mock(StaplerRequest.class);
StaplerRequest2 request = mock(StaplerRequest2.class);
when(request.bindJSONToList(ArgumentMatchers.any(), ArgumentMatchers.eq(jsonObject.get(KEY)))).thenReturn(webhooks);

// when
Expand All @@ -236,7 +236,7 @@ public void configure_ReturnsTrue() {
WebhookJobPropertyDescriptor descriptor = new WebhookJobPropertyDescriptor();

// when
boolean isConfigured = descriptor.configure(null, null);
boolean isConfigured = descriptor.configure((StaplerRequest2) null, null);

// then
// very naive, worth to improve
Expand Down