diff --git a/pom.xml b/pom.xml
index ed96f710c..d387355c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
org.jenkins-ci.plugins
plugin
- 3.2
+ 3.57
@@ -51,12 +51,13 @@
UTF-8
UTF-8
1.4
- 2.7
+ 2.230
1.6.2
- 7
+ 8
false
6.7
2.17
+ 1.7.26
com.coravy.hudson.plugins.github
github
- 1.27.0
+ 1.29.5
+
+
+ org.apache.commons
+ commons-lang3
+
+
org.jenkins-ci.plugins
matrix-project
- 1.11
+ 1.14
org.jenkins-ci.plugins
@@ -141,18 +147,30 @@
org.jenkins-ci.plugins
git
- 3.3.1
+ 4.2.2
org.jenkins-ci.plugins
job-dsl
- 1.63
+ 1.77
true
- junit
- junit
- 4.12
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.5.1
+ test
+
+
+ org.junit.platform
+ junit-platform-launcher
+ 1.5.1
+ test
+
+
+ org.junit.vintage
+ junit-vintage-engine
+ 5.5.1
test
@@ -182,7 +200,7 @@
org.jenkins-ci.plugins
token-macro
- 2.1
+ 2.12
true
@@ -194,7 +212,7 @@
org.jenkins-ci.plugins
credentials
- 2.1.14
+ 2.3.5
org.jenkins-ci.plugins
@@ -204,7 +222,7 @@
org.jenkins-ci.plugins
structs
- 1.9
+ 1.20
@@ -261,8 +279,8 @@
maven-compiler-plugin
3.5.1
-
- 1.7
+
+ 1.8
diff --git a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbGitHubAuth.java b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbGitHubAuth.java
index e116ebe6e..7c64efaf0 100644
--- a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbGitHubAuth.java
+++ b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbGitHubAuth.java
@@ -19,8 +19,8 @@
import hudson.util.ListBoxModel;
import hudson.util.Secret;
import jenkins.model.Jenkins;
-import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang.StringUtils;
+import org.bouncycastle.util.encoders.Hex;
import org.jenkinsci.plugins.plaincredentials.StringCredentials;
import org.kohsuke.github.GHAuthorization;
import org.kohsuke.github.GHCommitState;
@@ -146,7 +146,7 @@ public boolean checkSignature(String body, String signature) {
Mac mac = Mac.getInstance(algorithm);
mac.init(keySpec);
byte[] localSignatureBytes = mac.doFinal(body.getBytes("UTF-8"));
- String localSignature = Hex.encodeHexString(localSignatureBytes);
+ String localSignature = Hex.toHexString(localSignatureBytes);
if (!localSignature.equals(expected)) {
LOGGER.log(Level.SEVERE, "Local signature {0} does not match external signature {1}",
new Object[] {localSignature, expected});
diff --git a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java
index 1e1dba5dd..777a37006 100644
--- a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java
+++ b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbRepository.java
@@ -10,7 +10,6 @@
import hudson.model.listeners.SaveableListener;
import hudson.util.Secret;
import jenkins.model.Jenkins;
-import jenkins.util.SystemProperties;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.ghprb.extensions.GhprbCommentAppender;
import org.jenkinsci.plugins.ghprb.extensions.GhprbCommitStatusException;
@@ -53,8 +52,8 @@ public class GhprbRepository implements Saveable {
private static final transient EnumSet HOOK_EVENTS = EnumSet.of(GHEvent.ISSUE_COMMENT, GHEvent.PULL_REQUEST);
- private static final transient boolean INSECURE_WEBHOOKS = SystemProperties.getBoolean(
- GhprbRepository.class.getName() + ".webhook.insecure", false);
+ private static final transient boolean INSECURE_WEBHOOKS = Boolean.parseBoolean(
+ System.getProperty(GhprbRepository.class.getName() + ".webhook.insecure", "false"));
private final String reponame;
diff --git a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbTrigger.java b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbTrigger.java
index 5ba3e756f..7d26beaa8 100644
--- a/src/main/java/org/jenkinsci/plugins/ghprb/GhprbTrigger.java
+++ b/src/main/java/org/jenkinsci/plugins/ghprb/GhprbTrigger.java
@@ -24,7 +24,6 @@
import hudson.util.ListBoxModel.Option;
import jenkins.model.Jenkins;
import jenkins.model.ParameterizedJobMixIn;
-import jenkins.util.SystemProperties;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.ghprb.extensions.GhprbBuildStep;
@@ -78,7 +77,7 @@ public class GhprbTrigger extends GhprbTriggerBackwardsCompatible {
* an integer for number of threads. (default pool size: 5)
*/
private static final ExecutorService POOL = Executors.newFixedThreadPool(
- SystemProperties.getInteger(GhprbTrigger.class.getName() + ".poolSize", 5)
+ Integer.parseInt(System.getProperty(GhprbTrigger.class.getName() + ".poolSize", "5"))
);
/**
@@ -91,7 +90,7 @@ public class GhprbTrigger extends GhprbTriggerBackwardsCompatible {
* (default: false)
*/
private static final boolean DISABLE_REGISTER_ON_STARTUP =
- SystemProperties.getBoolean(GhprbTrigger.class.getName() + ".disableRegisterOnStartup", false);
+ Boolean.parseBoolean(System.getProperty(GhprbTrigger.class.getName() + ".disableRegisterOnStartup", "false"));
private final String adminlist;
@@ -331,7 +330,7 @@ public void start(Job, ?> project, boolean newInstance) {
new String[] {String.valueOf(DISABLE_REGISTER_ON_STARTUP)});
if (GhprbTrigger.getDscp().getManageWebhooks() && (newInstance || !DISABLE_REGISTER_ON_STARTUP)) {
final String[] params = {
- String.valueOf(SystemProperties.getInteger(GhprbTrigger.class.getName() + ".poolSize", 5))
+ String.valueOf(System.getProperty(GhprbTrigger.class.getName() + ".poolSize", "5"))
};
LOGGER.log(Level.FINEST, "Registering hook with GitHub. Thread pool size: {0}", params);
POOL.submit(new StartHookRunnable(this.repository));
diff --git a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbIT.java b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbIT.java
index 61a29846e..0201c1424 100644
--- a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbIT.java
+++ b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbIT.java
@@ -6,7 +6,6 @@
import hudson.model.ParameterValue;
import hudson.model.Run;
import net.sf.json.JSONObject;
-import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -20,7 +19,11 @@
import org.mockito.Mockito;
import org.mockito.runners.MockitoJUnitRunner;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
+import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -89,12 +92,17 @@ public void shouldBuildTriggersOnUpdatingNewCommitsPR() throws Exception {
@Test
public void shouldBuildTriggersOnUpdatingRetestMessagePR() throws Exception {
// GIVEN
- given(ghPullRequest.getCreatedAt()).willReturn(new DateTime().toDate());
+ given(ghPullRequest.getCreatedAt()).willReturn(Date.from(
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .toInstant()));
GhprbTestUtil.triggerRunAndWait(10, trigger, project);
assertThat(project.getBuilds().toArray().length).isEqualTo(1);
given(comment.getBody()).willReturn("retest this please");
- given(comment.getUpdatedAt()).willReturn(new DateTime().plusDays(1).toDate());
+ given(comment.getUpdatedAt()).willReturn(Date.from(
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .plus(1, ChronoUnit.DAYS)
+ .toInstant()));
given(comment.getUser()).willReturn(ghUser);
given(ghPullRequest.getComments()).willReturn(newArrayList(comment));
@@ -111,7 +119,10 @@ public void shouldNotBuildDisabledBuild() throws Exception {
given(commitPointer.getSha()).willReturn("sha");
given(comment.getBody()).willReturn("retest this please");
- given(comment.getUpdatedAt()).willReturn(new DateTime().plusDays(1).toDate());
+ given(comment.getUpdatedAt()).willReturn(Date.from(
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .plus(1, ChronoUnit.DAYS)
+ .toInstant()));
given(comment.getUser()).willReturn(ghUser);
given(ghPullRequest.getComments()).willReturn(newArrayList(comment));
given(ghPullRequest.getNumber()).willReturn(5);
diff --git a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbITBaseTestCase.java b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbITBaseTestCase.java
index 3e7ba8321..1774b7449 100644
--- a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbITBaseTestCase.java
+++ b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbITBaseTestCase.java
@@ -5,7 +5,6 @@
import hudson.model.Run;
import hudson.model.TaskListener;
import hudson.plugins.git.GitSCM;
-import org.joda.time.DateTime;
import org.kohsuke.github.GHCommitPointer;
import org.kohsuke.github.GHIssueState;
import org.kohsuke.github.GHPullRequest;
@@ -16,6 +15,9 @@
import org.mockito.Mock;
import org.mockito.Mockito;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
import java.util.Map;
import static com.google.common.collect.Lists.newArrayList;
@@ -78,7 +80,11 @@ protected void beforeTest(
given(ghRepository.getName()).willReturn("dropwizard");
- GhprbTestUtil.mockPR(ghPullRequest, commitPointer, new DateTime(), new DateTime().plusDays(1));
+ GhprbTestUtil.mockPR(ghPullRequest,
+ commitPointer,
+ ZonedDateTime.now(ZoneOffset.UTC),
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .plus(1, ChronoUnit.DAYS));
given(ghRepository.getPullRequests(eq(GHIssueState.OPEN)))
.willReturn(newArrayList(ghPullRequest))
diff --git a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRepositoryTest.java b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRepositoryTest.java
index 32653c7c3..4c056a22d 100644
--- a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRepositoryTest.java
+++ b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRepositoryTest.java
@@ -9,7 +9,6 @@
import org.apache.commons.codec.binary.Hex;
import org.fest.util.Collections;
import org.jenkinsci.plugins.ghprb.extensions.status.GhprbSimpleStatus;
-import org.joda.time.DateTime;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Rule;
@@ -38,6 +37,9 @@
import java.io.IOException;
import java.net.URL;
import java.net.URLEncoder;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -519,8 +521,14 @@ public void testCheckMethodWhenPrWasUpdatedWithNonKeyPhrase() throws Exception {
mockCommitList();
GhprbBuilds builds = mockBuilds();
- Date later = new DateTime().plusHours(3).toDate();
- Date tomorrow = new DateTime().plusDays(1).toDate();
+ Date later = Date.from(
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .plus(3, ChronoUnit.HOURS)
+ .toInstant());
+ Date tomorrow = Date.from(
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .plus(1, ChronoUnit.DAYS)
+ .toInstant());
given(ghRepository.getPullRequests(eq(GHIssueState.OPEN))).willReturn(ghPullRequests);
@@ -616,8 +624,13 @@ private List createListWithMockPR() throws IOException {
public void testCheckMethodWhenPrWasUpdatedWithRetestPhrase() throws Exception {
// GIVEN
List ghPullRequests = createListWithMockPR();
- Date now = new Date();
- Date tomorrow = new DateTime().plusDays(1).toDate();
+ Date now = Date.from(
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .toInstant());
+ Date tomorrow = Date.from(
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .plus(1, ChronoUnit.DAYS)
+ .toInstant());
mockHeadAndBase();
mockCommitList();
@@ -665,7 +678,7 @@ public void testCheckMethodWhenPrWasUpdatedWithRetestPhrase() throws Exception {
verifyNoMoreInteractions(ghRepository);
verify(ghPullRequest, times(2)).getTitle();
- verify(ghPullRequest, times(5)).getUser();
+ verify(ghPullRequest, times(6)).getUser();
verify(ghPullRequest, times(2)).getMergeable(); // Call to Github API
verify(ghPullRequest, times(9)).getHead();
verify(ghPullRequest, times(7)).getBase();
@@ -676,7 +689,7 @@ public void testCheckMethodWhenPrWasUpdatedWithRetestPhrase() throws Exception {
verify(ghPullRequest, times(2)).getLabels();
verify(ghPullRequest, times(1)).getId();
- verify(ghPullRequest, times(1)).getComments();
+ verify(ghPullRequest, times(2)).getComments();
verify(ghPullRequest, times(4)).listCommits();
verify(ghPullRequest, times(2)).getBody();
@@ -702,7 +715,7 @@ public void testCheckMethodWhenPrWasUpdatedWithRetestPhrase() throws Exception {
verify(ghUser, times(1)).getEmail(); // Call to Github API
verify(ghUser, times(2)).getLogin();
- verify(ghUser, times(2)).getName();
+ verify(ghUser, times(3)).getName();
verifyNoMoreInteractions(ghUser);
verify(builds, times(2)).build(any(GhprbPullRequest.class), any(GHUser.class), any(String.class));
diff --git a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRootActionTest.java b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRootActionTest.java
index d83c8a20b..c0d2a2a23 100644
--- a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRootActionTest.java
+++ b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbRootActionTest.java
@@ -3,7 +3,6 @@
import com.coravy.hudson.plugins.github.GithubProjectProperty;
import hudson.model.FreeStyleProject;
import hudson.plugins.git.GitSCM;
-import org.joda.time.DateTime;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -28,6 +27,9 @@
import java.io.Reader;
import java.io.StringReader;
import java.net.URLEncoder;
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.temporal.ChronoUnit;
import static com.google.common.collect.Lists.newArrayList;
import static org.fest.assertions.Assertions.assertThat;
@@ -79,7 +81,11 @@ public void setup() throws Exception {
given(commitPointer.getRef()).willReturn("ref");
given(ghRepository.getName()).willReturn("dropwizard");
- GhprbTestUtil.mockPR(ghPullRequest, commitPointer, new DateTime(), new DateTime().plusDays(1));
+ GhprbTestUtil.mockPR(ghPullRequest,
+ commitPointer,
+ ZonedDateTime.now(ZoneOffset.UTC),
+ ZonedDateTime.now(ZoneOffset.UTC)
+ .plus(1, ChronoUnit.DAYS));
given(ghRepository.getPullRequests(eq(OPEN))).willReturn(newArrayList(ghPullRequest)).willReturn(newArrayList(ghPullRequest));
diff --git a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbTestUtil.java b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbTestUtil.java
index 8f9960b4e..1e37c7f3f 100644
--- a/src/test/java/org/jenkinsci/plugins/ghprb/GhprbTestUtil.java
+++ b/src/test/java/org/jenkinsci/plugins/ghprb/GhprbTestUtil.java
@@ -20,7 +20,6 @@
import hudson.plugins.git.UserRemoteConfig;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
-import org.joda.time.DateTime;
import org.kohsuke.github.GHCommitPointer;
import org.kohsuke.github.GHPullRequest;
import org.kohsuke.github.GHRateLimit;
@@ -39,7 +38,9 @@
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.net.URL;
+import java.time.ZonedDateTime;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -253,7 +254,7 @@ public static void mockCommitList(GHPullRequest ghPullRequest) {
Mockito.when(itr.hasNext()).thenReturn(false);
}
- public static void mockPR(GHPullRequest prToMock, GHCommitPointer commitPointer, DateTime... updatedDate) throws Exception {
+ public static void mockPR(GHPullRequest prToMock, GHCommitPointer commitPointer, ZonedDateTime... updatedDate) throws Exception {
given(prToMock.getHead()).willReturn(commitPointer);
given(prToMock.getBase()).willReturn(commitPointer);
@@ -262,13 +263,13 @@ public static void mockPR(GHPullRequest prToMock, GHCommitPointer commitPointer,
if (updatedDate.length > 1) {
given(prToMock.getUpdatedAt())
- .willReturn(updatedDate[0].toDate())
- .willReturn(updatedDate[0].toDate())
- .willReturn(updatedDate[1].toDate())
- .willReturn(updatedDate[1].toDate())
- .willReturn(updatedDate[1].toDate());
+ .willReturn(Date.from(updatedDate[0].toInstant()))
+ .willReturn(Date.from(updatedDate[0].toInstant()))
+ .willReturn(Date.from(updatedDate[1].toInstant()))
+ .willReturn(Date.from(updatedDate[1].toInstant()))
+ .willReturn(Date.from(updatedDate[1].toInstant()));
} else {
- given(prToMock.getUpdatedAt()).willReturn(updatedDate[0].toDate());
+ given(prToMock.getUpdatedAt()).willReturn(Date.from(updatedDate[0].toInstant()));
}
}