Skip to content

Commit

Permalink
Merge pull request #287 from basil/refresh
Browse files Browse the repository at this point in the history
Upgrade plugin parent POM, SpotBugs, Hamcrest, and Mockito; fix Javadoc
  • Loading branch information
KostyaSha authored Aug 7, 2022
2 parents 6acf1a0 + 7b8a3e6 commit 6789505
Show file tree
Hide file tree
Showing 42 changed files with 101 additions and 136 deletions.
38 changes: 1 addition & 37 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.40</version>
<version>4.45</version>
<relativePath />
</parent>

Expand Down Expand Up @@ -52,15 +52,7 @@
<gitHubRepo>jenkinsci/github-plugin</gitHubRepo>
<jenkins.version>2.346.1</jenkins.version>
<release.skipTests>false</release.skipTests>
<maven.javadoc.skip>true</maven.javadoc.skip>
<findbugs-maven-plugin.version>3.0.4</findbugs-maven-plugin.version>
<hamcrest.version>2.2</hamcrest.version>
<concurrency>1</concurrency>
<workflow.version>1.14.2</workflow.version>
<tagNameFormat>v@{project.version}</tagNameFormat>
<spotbugs.threshold>Low</spotbugs.threshold>
<spotbugs.effort>Max</spotbugs.effort>
<spotbugs.failOnError>false</spotbugs.failOnError>
</properties>

<repositories>
Expand Down Expand Up @@ -146,37 +138,9 @@
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>
<!-- This is needed in order to force junit4 and JTH tests to use newer hamcrest version -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-library</artifactId>
<version>${hamcrest.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>1.10.19</version>
<scope>test</scope>
</dependency>

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/com/cloudbees/jenkins/GitHubPushTrigger.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.Extension;
import hudson.Util;
import hudson.XmlFile;
Expand Down Expand Up @@ -270,6 +271,10 @@ public String getLog() throws IOException {
*
* @since 1.350
*/
@SuppressFBWarnings(
value = "RV_RETURN_VALUE_IGNORED",
justification =
"method signature does not permit plumbing through the return value")
public void writeLogTo(XMLOutput out) throws IOException {
new AnnotatedLargeText<GitHubWebHookPollingAction>(getLogFileForJob(job), Charsets.UTF_8, true, this)
.writeHtmlTo(0, out.asWriter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* Add the Github Logo/Icon to the sidebar.
*
* @author Stefan Saasen <[email protected]>
* @author <a href="mailto:[email protected]">Stefan Saasen</a>
*/
public final class GithubLinkAction implements Action {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
* <p>
* It's based on the TracLinkAnnotator.
* <p>
*
* @author Stefan Saasen <[email protected]>
* @todo Change the annotator to use GithubUrl instead of the String url.
* TODO Change the annotator to use GithubUrl instead of the String url.
* Knowledge about the github url structure should be encapsulated in
* GithubUrl.
*
* @author <a href="mailto:[email protected]">Stefan Saasen</a>
*/
@Extension
public class GithubLinkAnnotator extends ChangeLogAnnotator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* - URL to the GitHub project
* - Build status context name
*
* @author Stefan Saasen <[email protected]>
* @author <a href="mailto:[email protected]">Stefan Saasen</a>
*/
public final class GithubProjectProperty extends JobProperty<Job<?, ?>> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.apache.commons.lang.StringUtils;

/**
* @author Stefan Saasen <[email protected]>
* @author <a href="mailto:[email protected]">Stefan Saasen</a>
*/
public final class GithubUrl {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

/**
* Administrative monitor to track problems of registering/removing hooks for GH.
* Holds non-savable map of repo->message and persisted list of ignored projects.
* Holds non-savable map of repo-&gt;message and persisted list of ignored projects.
* Anyone can register new problem with {@link #registerProblem(GitHubRepositoryName, Throwable)} and check
* repo for problems with {@link #isProblemWith(GitHubRepositoryName)}
*
Expand Down Expand Up @@ -64,7 +64,7 @@ public GitHubHookRegisterProblemMonitor() {
}

/**
* @return Immutable copy of map with repo->problem message content
* @return Immutable copy of map with repo-&gt;problem message content
*/
public Map<GitHubRepositoryName, String> getProblems() {
return ImmutableMap.copyOf(problems);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ public int getClientCacheSize() {
}

/**
* @param clientCacheSize capacity of cache for GitHub client in MB, set to <= 0 to turn off this feature
* @param clientCacheSize capacity of cache for GitHub client in MB, set to &lt;= 0 to turn off this feature
*/
@DataBoundSetter
public void setClientCacheSize(int clientCacheSize) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* Stores common methods for {@link BuildData} handling.
*
* @author Oleg Nenashev <[email protected]>
* @author <a href="mailto:[email protected]">Oleg Nenashev</a>
* @since 1.10
*/
public final class BuildDataHelper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public Object invoke(StaplerRequest req, StaplerResponse rsp, Object instance, O
}

/**
* Duplicates {@link @org.kohsuke.stapler.interceptor.RequirePOST} precheck.
* Duplicates {@link org.kohsuke.stapler.interceptor.RequirePOST} precheck.
* As of it can't guarantee order of multiply interceptor calls,
* it should implement all features of required interceptors in one class
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@
import org.jenkinsci.plugins.github.test.GHMockRule;
import org.jenkinsci.plugins.github.test.GHMockRule.FixedGHRepoNameTestContributor;
import org.jenkinsci.plugins.github.test.InjectJenkinsMembersRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExternalResource;
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;
import org.jvnet.hudson.test.Issue;
import org.jvnet.hudson.test.JenkinsRule;
import org.jvnet.hudson.test.TestBuilder;
import org.jvnet.hudson.test.TestExtension;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import javax.inject.Inject;

Expand All @@ -43,7 +43,7 @@
/**
* Tests for {@link GitHubCommitNotifier}.
*
* @author Oleg Nenashev <[email protected]>
* @author <a href="mailto:[email protected]">Oleg Nenashev</a>
*/
@RunWith(MockitoJUnitRunner.class)
public class GitHubCommitNotifierTest {
Expand Down Expand Up @@ -72,15 +72,12 @@ public class GitHubCommitNotifierTest {
.stubStatuses();


@Rule
public ExternalResource prep = new ExternalResource() {
@Override
protected void before() throws Throwable {
@Before
public void before() throws Throwable {
when(data.getLastBuiltRevision()).thenReturn(rev);
data.lastBuild = new hudson.plugins.git.util.Build(rev, rev, 0, Result.SUCCESS);
when(rev.getSha1()).thenReturn(ObjectId.fromString(SOME_SHA));
}
};
}

@Test
@Issue("JENKINS-23641")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
import org.jenkinsci.plugins.github.test.GHMockRule;
import org.jenkinsci.plugins.github.test.GHMockRule.FixedGHRepoNameTestContributor;
import org.jenkinsci.plugins.github.test.InjectJenkinsMembersRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExternalResource;
import org.junit.rules.RuleChain;
import org.junit.runner.RunWith;
import org.jvnet.hudson.test.Issue;
Expand All @@ -28,7 +28,7 @@
import org.jvnet.hudson.test.TestExtension;
import org.jvnet.hudson.test.recipes.LocalData;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import javax.inject.Inject;
import java.util.List;
Expand All @@ -42,7 +42,7 @@
/**
* Tests for {@link GitHubSetCommitStatusBuilder}.
*
* @author Oleg Nenashev <[email protected]>
* @author <a href="mailto:[email protected]">Oleg Nenashev</a>
*/
@RunWith(MockitoJUnitRunner.class)
public class GitHubSetCommitStatusBuilderTest {
Expand Down Expand Up @@ -72,15 +72,12 @@ public class GitHubSetCommitStatusBuilderTest {
.stubRepo()
.stubStatuses();

@Rule
public ExternalResource prep = new ExternalResource() {
@Override
protected void before() throws Throwable {
@Before
public void before() throws Throwable {
when(data.getLastBuiltRevision()).thenReturn(rev);
data.lastBuild = new hudson.plugins.git.util.Build(rev, rev, 0, Result.SUCCESS);
when(rev.getSha1()).thenReturn(ObjectId.fromString(SOME_SHA));
}
};
}

@Test
@Issue("JENKINS-23641")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import static junit.framework.Assert.assertFalse;
import static junit.framework.TestCase.assertTrue;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/com/cloudbees/jenkins/GitHubWebHookTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.everyItem;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;

/**
* @author lanwen (Merkushev Kirill)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.is;

/**
* Test Class for {@link GitHubPushTrigger}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import static org.jenkinsci.plugins.github.test.GitHubRepoNameMatchers.withHost;
import static org.jenkinsci.plugins.github.test.GitHubRepoNameMatchers.withRepoName;
import static org.jenkinsci.plugins.github.test.GitHubRepoNameMatchers.withUserName;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;

/**
* Unit tests of {@link GitHubRepositoryName}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.empty;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;

import java.io.IOException;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
import org.jenkinsci.plugins.workflow.structs.DescribableHelper;
import org.junit.Ignore;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import org.junit.Rule;
import org.jvnet.hudson.test.JenkinsRule;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.coravy.hudson.plugins.github;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;

import org.junit.After;
import org.junit.Before;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import org.junit.runner.RunWith;
import org.kohsuke.stapler.StaplerRequest;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.kohsuke.github.GHRepository;
import org.kohsuke.github.GitHub;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import javax.inject.Inject;
import java.io.IOException;
Expand All @@ -39,7 +39,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.when;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import java.lang.reflect.InvocationTargetException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.junit.runner.RunWith;
import org.mockito.Answers;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import org.mockito.junit.MockitoJUnitRunner;

import java.util.Collections;

Expand All @@ -20,7 +20,7 @@
import static java.util.Arrays.asList;
import static org.hamcrest.Matchers.is;
import static org.jenkinsci.plugins.github.common.CombineErrorHandler.errorHandling;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyNoMoreInteractions;
Expand Down
Loading

0 comments on commit 6789505

Please sign in to comment.