From 1cff5c15fd5ced90d26525c8a7acc86d9789121a Mon Sep 17 00:00:00 2001 From: Chad Wilson Date: Thu, 2 May 2024 13:48:09 +0800 Subject: [PATCH] Upgrade dependencies to latest versions --- pom.xml | 123 +++++++++++------- release.sh | 2 +- .../gocd/github/GitHubPRBuildPlugin.java | 28 ++-- .../gocd/github/provider/github/GHUtils.java | 3 - .../provider/github/GitHubProvider.java | 10 +- .../github/model/PullRequestStatus.java | 10 +- .../provider/github/model/PullRequests.java | 69 ---------- .../provider/gitlab/GitLabProvider.java | 14 +- .../github/provider/gitlab/GitLabUtils.java | 2 +- .../gocd/github/util/BranchFilter.java | 4 - .../gocd/github/util/JSONUtils.java | 5 +- src/main/resources/gerrit/plugin.xml | 2 +- src/main/resources/git/plugin.xml | 2 +- src/main/resources/github/plugin.xml | 2 +- src/main/resources/gitlab/plugin.xml | 2 +- src/main/resources/stash/plugin.xml | 2 +- .../gocd/github/GitHubPRBuildPluginTest.java | 8 +- .../provider/gitlab/GitLabUtilsTest.java | 1 - 18 files changed, 118 insertions(+), 171 deletions(-) delete mode 100644 src/main/java/in/ashwanthkumar/gocd/github/provider/github/model/PullRequests.java diff --git a/pom.xml b/pom.xml index 845fe38..3caa653 100644 --- a/pom.xml +++ b/pom.xml @@ -9,89 +9,105 @@ UTF-8 - 14.4.0 + 18.10.0 ${project.basedir} + + + + + org.apache.commons + commons-exec + 1.4.0 + + + + com.fasterxml.jackson + jackson-bom + 2.16.1 + import + pom + + + + commons-codec + commons-codec + 1.17.0 + + + + cd.go.plugin go-plugin-api - ${go.version} + 23.5.0 provided + + commons-io + commons-io + 2.16.1 + + + org.apache.commons + commons-lang3 + 3.14.0 + in.ashwanthkumar git-cmd - 1.4 + 2.0 + + + + org.eclipse.jgit + org.eclipse.jgit + + com.google.code.gson gson - 2.3.1 + 2.10.1 in.ashwanthkumar my-java-utils - 0.0.6 + 0.1.0 org.kohsuke github-api - 1.128 + 1.321 + provided org.gitlab4j gitlab4j-api - 4.15.6 - - - com.fasterxml.jackson.core - jackson-core - 2.9.3 - - - com.fasterxml.jackson.core - jackson-databind - 2.9.10.7 - - - com.fasterxml.jackson.core - jackson-annotations - 2.9.3 + 5.5.0 + provided - org.mockito mockito-core - 1.8.5 + 5.11.0 test - - - org.hamcrest - hamcrest-core - - junit junit - 4.13.1 + 4.13.2 test org.hamcrest - hamcrest-all - 1.3 + hamcrest + 2.2 test - - - commons-lang - commons-lang - 2.6 - @@ -99,28 +115,41 @@ sonatype https://oss.sonatype.org/content/repositories/releases/ + + maven_central + Maven Central + https://repo.maven.apache.org/maven2/ + github.pr - - true - github-pr-poller src/main/resources/github + + + org.kohsuke + github-api + 1.321 + + gitlab.pr - - true - gitlab-pr-poller src/main/resources/gitlab + + + org.gitlab4j + gitlab4j-api + 5.5.0 + + git.fb @@ -146,7 +175,7 @@ - ${plugin.name}-${version} + ${plugin.name}-${project.version} src/main/resources/views @@ -176,7 +205,7 @@ - ${go.version} + ${go.compat.version} diff --git a/release.sh b/release.sh index daca4d7..83c26d3 100755 --- a/release.sh +++ b/release.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e -x rm -rf dist/ diff --git a/src/main/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPlugin.java b/src/main/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPlugin.java index ae8a826..9fabc1b 100644 --- a/src/main/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPlugin.java +++ b/src/main/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPlugin.java @@ -11,8 +11,6 @@ import com.tw.go.plugin.model.GitConfig; import com.tw.go.plugin.model.ModifiedFile; import com.tw.go.plugin.model.Revision; -import com.tw.go.plugin.util.ListUtil; -import com.tw.go.plugin.util.StringUtil; import in.ashwanthkumar.gocd.github.provider.Provider; import in.ashwanthkumar.gocd.github.settings.scm.PluginConfigurationView; import in.ashwanthkumar.gocd.github.util.BranchFilter; @@ -22,7 +20,7 @@ import in.ashwanthkumar.utils.collections.Lists; import in.ashwanthkumar.utils.func.Function; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang3.StringUtils; import java.io.IOException; import java.lang.reflect.Constructor; @@ -34,7 +32,7 @@ @Extension public class GitHubPRBuildPlugin implements GoPlugin { - private static Logger LOGGER = Logger.getLoggerFor(GitHubPRBuildPlugin.class); + private static final Logger LOGGER = Logger.getLoggerFor(GitHubPRBuildPlugin.class); public static final String EXTENSION_NAME = "scm"; private static final List goSupportedVersions = asList("1.0"); @@ -174,7 +172,7 @@ private GoPluginApiResponse getPluginConfiguration(PluginConfigurationView view) } private GoPluginApiResponse handleSCMValidation(GoPluginApiRequest goPluginApiRequest) { - Map requestBodyMap = (Map) fromJSON(goPluginApiRequest.requestBody()); + Map requestBodyMap = fromJSON(goPluginApiRequest.requestBody()); final Map configuration = keyValuePairs(requestBodyMap, "scm-configuration"); final GitConfig gitConfig = getGitConfig(configuration); @@ -189,7 +187,7 @@ public void validate(Map fieldValidation) { } private GoPluginApiResponse handleSCMCheckConnection(GoPluginApiRequest goPluginApiRequest) { - Map requestBodyMap = (Map) fromJSON(goPluginApiRequest.requestBody()); + Map requestBodyMap = fromJSON(goPluginApiRequest.requestBody()); Map configuration = keyValuePairs(requestBodyMap, "scm-configuration"); GitConfig gitConfig = getGitConfig(configuration); @@ -207,7 +205,7 @@ private GoPluginApiResponse handleSCMCheckConnection(GoPluginApiRequest goPlugin } GoPluginApiResponse handleGetLatestRevision(GoPluginApiRequest goPluginApiRequest) { - Map requestBodyMap = (Map) fromJSON(goPluginApiRequest.requestBody()); + Map requestBodyMap = fromJSON(goPluginApiRequest.requestBody()); Map configuration = keyValuePairs(requestBodyMap, "scm-configuration"); GitConfig gitConfig = getGitConfig(configuration); String flyweightFolder = (String) requestBodyMap.get("flyweight-folder"); @@ -249,12 +247,12 @@ private String removeUsernameAndPassword(String message, GitConfig gitConfig) { } GoPluginApiResponse handleLatestRevisionSince(GoPluginApiRequest goPluginApiRequest) { - Map requestBodyMap = (Map) fromJSON(goPluginApiRequest.requestBody()); + Map requestBodyMap = fromJSON(goPluginApiRequest.requestBody(), Map.class); Map configuration = keyValuePairs(requestBodyMap, "scm-configuration"); final GitConfig gitConfig = getGitConfig(configuration); Map scmData = (Map) requestBodyMap.get("scm-data"); - Map oldBranchToRevisionMap = (Map) fromJSON(scmData.get(BRANCH_TO_REVISION_MAP)); - Map lastKnownBranchToRevisionMap = (Map) fromJSON(scmData.get(BRANCH_TO_REVISION_MAP)); + Map oldBranchToRevisionMap = fromJSON(scmData.get(BRANCH_TO_REVISION_MAP)); + Map lastKnownBranchToRevisionMap = fromJSON(scmData.get(BRANCH_TO_REVISION_MAP)); String flyweightFolder = (String) requestBodyMap.get("flyweight-folder"); LOGGER.debug(String.format("Fetching latest for: %s", gitConfig.getUrl())); @@ -352,7 +350,7 @@ public Map apply(Revision revision) { private Map getRevisionMapForSHA(GitConfig gitConfig, String branch, Revision revision) { // patch for building merge commits - if (revision.isMergeCommit() && ListUtil.isEmpty(revision.getModifiedFiles())) { + if (revision.isMergeCommit() && (revision.getModifiedFiles() == null || revision.getModifiedFiles().isEmpty())) { revision.setModifiedFiles(Lists.of(new ModifiedFile("/dev/null", "deleted"))); } @@ -364,7 +362,7 @@ private boolean branchHasNewChange(String previousSHA, String latestSHA) { } private GoPluginApiResponse handleCheckout(GoPluginApiRequest goPluginApiRequest) { - Map requestBodyMap = (Map) fromJSON(goPluginApiRequest.requestBody()); + Map requestBodyMap = fromJSON(goPluginApiRequest.requestBody()); Map configuration = keyValuePairs(requestBodyMap, "scm-configuration"); GitConfig gitConfig = getGitConfig(configuration); String destinationFolder = (String) requestBodyMap.get("destination-folder"); @@ -416,7 +414,7 @@ Map getRevisionMap(GitConfig gitConfig, String branch, Revision response.put("timestamp", new SimpleDateFormat(DATE_PATTERN).format(revision.getTimestamp())); response.put("revisionComment", revision.getComment()); List modifiedFilesMapList = new ArrayList(); - if (!ListUtil.isEmpty(revision.getModifiedFiles())) { + if (revision.getModifiedFiles() != null && !revision.getModifiedFiles().isEmpty()) { for (ModifiedFile modifiedFile : revision.getModifiedFiles()) { Map modifiedFileMap = new HashMap(); modifiedFileMap.put("fileName", modifiedFile.getFileName()); @@ -443,7 +441,7 @@ private Map keyValuePairs(Map requestBodyMap, St } public void validateUrl(GitConfig gitConfig, Map fieldMap) { - if (StringUtil.isEmpty(gitConfig.getUrl())) { + if (StringUtils.isEmpty(gitConfig.getUrl())) { fieldMap.put("key", "url"); fieldMap.put("message", "URL is a required field"); } else if (!provider.isValidURL(gitConfig.getUrl())) { @@ -453,7 +451,7 @@ public void validateUrl(GitConfig gitConfig, Map fieldMap) { } public void checkConnection(GitConfig gitConfig, Map response, List messages) { - if (StringUtil.isEmpty(gitConfig.getUrl())) { + if (StringUtils.isEmpty(gitConfig.getUrl())) { response.put("status", "failure"); messages.add("URL is empty"); } else if (!provider.isValidURL(gitConfig.getUrl())) { diff --git a/src/main/java/in/ashwanthkumar/gocd/github/provider/github/GHUtils.java b/src/main/java/in/ashwanthkumar/gocd/github/provider/github/GHUtils.java index d49333d..790a6cd 100644 --- a/src/main/java/in/ashwanthkumar/gocd/github/provider/github/GHUtils.java +++ b/src/main/java/in/ashwanthkumar/gocd/github/provider/github/GHUtils.java @@ -1,9 +1,6 @@ package in.ashwanthkumar.gocd.github.provider.github; import org.apache.commons.io.IOUtils; -import org.eclipse.jgit.lib.Ref; -import org.kohsuke.github.GitHub; -import org.kohsuke.github.GitHubBuilder; import java.io.File; import java.io.FileInputStream; diff --git a/src/main/java/in/ashwanthkumar/gocd/github/provider/github/GitHubProvider.java b/src/main/java/in/ashwanthkumar/gocd/github/provider/github/GitHubProvider.java index deb8d01..d679501 100644 --- a/src/main/java/in/ashwanthkumar/gocd/github/provider/github/GitHubProvider.java +++ b/src/main/java/in/ashwanthkumar/gocd/github/provider/github/GitHubProvider.java @@ -1,8 +1,8 @@ package in.ashwanthkumar.gocd.github.provider.github; import com.thoughtworks.go.plugin.api.GoPluginIdentifier; +import com.thoughtworks.go.plugin.api.logging.Logger; import com.tw.go.plugin.model.GitConfig; -import com.tw.go.plugin.util.StringUtil; import in.ashwanthkumar.gocd.github.provider.Provider; import in.ashwanthkumar.gocd.github.provider.github.model.PullRequestStatus; import in.ashwanthkumar.gocd.github.settings.general.DefaultGeneralPluginConfigurationView; @@ -15,8 +15,6 @@ import org.kohsuke.github.GHPullRequest; import org.kohsuke.github.GHUser; import org.kohsuke.github.GitHub; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.Arrays; @@ -24,7 +22,7 @@ import java.util.Properties; public class GitHubProvider implements Provider { - private static final Logger LOG = LoggerFactory.getLogger(GitHubProvider.class); + private static final Logger LOG = Logger.getLoggerFor(GitHubProvider.class); // public static final String PR_FETCH_REFSPEC = "+refs/pull/*/merge:refs/gh-merge/remotes/origin/*"; // public static final String PR_MERGE_PREFIX = "refs/gh-merge/remotes/origin/"; public static final String REF_SPEC = "+refs/pull/*/head:refs/remotes/origin/pull-request/*"; @@ -45,10 +43,10 @@ public String getName() { public void addConfigData(GitConfig gitConfig) { try { Properties props = GHUtils.readPropertyFile(); - if (StringUtil.isEmpty(gitConfig.getUsername())) { + if (StringUtils.isEmpty(gitConfig.getUsername())) { gitConfig.setUsername(props.getProperty("login")); } - if (StringUtil.isEmpty(gitConfig.getPassword())) { + if (StringUtils.isEmpty(gitConfig.getPassword())) { gitConfig.setPassword(props.getProperty("password")); } } catch (IOException e) { diff --git a/src/main/java/in/ashwanthkumar/gocd/github/provider/github/model/PullRequestStatus.java b/src/main/java/in/ashwanthkumar/gocd/github/provider/github/model/PullRequestStatus.java index 7b24c36..a3acef8 100644 --- a/src/main/java/in/ashwanthkumar/gocd/github/provider/github/model/PullRequestStatus.java +++ b/src/main/java/in/ashwanthkumar/gocd/github/provider/github/model/PullRequestStatus.java @@ -3,7 +3,7 @@ import in.ashwanthkumar.gocd.github.provider.github.GitHubProvider; public class PullRequestStatus { - private int id; + private long id; private String mergeRef; // We use this while computing the revisions private String lastHead; @@ -17,7 +17,7 @@ public class PullRequestStatus { private String description; private String title; - public PullRequestStatus(int id, String lastHead, String mergedSHA, String prBranch, String toBranch, String url, + public PullRequestStatus(long id, String lastHead, String mergedSHA, String prBranch, String toBranch, String url, String author, String authorEmail, String description, String title) { this.id = id; this.mergeRef = String.format("%s%d", GitHubProvider.REF_PATTERN, getId()); @@ -32,7 +32,7 @@ public PullRequestStatus(int id, String lastHead, String mergedSHA, String prBra this.title = title; } - public PullRequestStatus(int id, String mergeRefPattern, String lastHead, String mergedSHA, String prBranch, + public PullRequestStatus(long id, String mergeRefPattern, String lastHead, String mergedSHA, String prBranch, String toBranch, String url, String author, String authorEmail, String description, String title) { this.id = id; this.mergeRef = String.format("%s%d", mergeRefPattern, getId()); @@ -50,7 +50,7 @@ public PullRequestStatus(int id, String mergeRefPattern, String lastHead, String private PullRequestStatus() { } - public int getId() { + public long getId() { return id; } @@ -160,7 +160,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - int result = id; + int result = (int)id; result = 31 * result + (mergeRef != null ? mergeRef.hashCode() : 0); result = 31 * result + (lastHead != null ? lastHead.hashCode() : 0); result = 31 * result + (mergeSHA != null ? mergeSHA.hashCode() : 0); diff --git a/src/main/java/in/ashwanthkumar/gocd/github/provider/github/model/PullRequests.java b/src/main/java/in/ashwanthkumar/gocd/github/provider/github/model/PullRequests.java deleted file mode 100644 index e9316aa..0000000 --- a/src/main/java/in/ashwanthkumar/gocd/github/provider/github/model/PullRequests.java +++ /dev/null @@ -1,69 +0,0 @@ -package in.ashwanthkumar.gocd.github.provider.github.model; - -import in.ashwanthkumar.utils.func.Function; -import in.ashwanthkumar.utils.lang.option.Option; -import in.ashwanthkumar.utils.lang.tuple.Tuple2; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import static in.ashwanthkumar.utils.collections.Iterables.toMap; -import static in.ashwanthkumar.utils.collections.Lists.map; -import static in.ashwanthkumar.utils.lang.option.Option.option; -import static in.ashwanthkumar.utils.lang.tuple.Tuple2.tuple2; - -public class PullRequests { - private Map pullRequestStatuses; - - public Iterable getPullRequestStatuses() { - return pullRequestStatuses.values(); - } - - public PullRequests setPullRequestStatuses(List pullRequestStatuses) { - this.pullRequestStatuses = toMap(map(pullRequestStatuses, new Function>() { - @Override - public Tuple2 apply(PullRequestStatus input) { - return tuple2(input.getId(), input); - } - })); - return this; - } - - public Iterable concat(Collection left, Collection right) { - if (left == null) return right; - else if (right == null) return left; - else { - ArrayList concat = new ArrayList(); - concat.addAll(left); - concat.addAll(right); - return concat; - } - } - - @Override - public String toString() { - return pullRequestStatuses.toString(); - } - - public Option findById(final int prId) { - return option(pullRequestStatuses.get(prId)); - } - - public boolean hasId(final int prId) { - return pullRequestStatuses.containsKey(prId); - } - - public boolean hasNotId(final int prId) { - return !hasId(prId); - } - - public boolean hasChanged(int pullRequestId, String newMergedSHA) { - return hasId(pullRequestId) && !pullRequestStatuses.get(pullRequestId).getMergeSHA().equals(newMergedSHA); - } - - public PullRequestStatus get(int prId) { - return pullRequestStatuses.get(prId); - } -} diff --git a/src/main/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabProvider.java b/src/main/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabProvider.java index 75a0d6a..5efce66 100644 --- a/src/main/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabProvider.java +++ b/src/main/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabProvider.java @@ -1,8 +1,8 @@ package in.ashwanthkumar.gocd.github.provider.gitlab; import com.thoughtworks.go.plugin.api.GoPluginIdentifier; +import com.thoughtworks.go.plugin.api.logging.Logger; import com.tw.go.plugin.model.GitConfig; -import com.tw.go.plugin.util.StringUtil; import in.ashwanthkumar.gocd.github.provider.Provider; import in.ashwanthkumar.gocd.github.provider.github.model.PullRequestStatus; import in.ashwanthkumar.gocd.github.settings.general.DefaultGeneralPluginConfigurationView; @@ -16,15 +16,13 @@ import org.gitlab4j.api.GitLabApiException; import org.gitlab4j.api.models.Author; import org.gitlab4j.api.models.MergeRequest; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.Arrays; import java.util.Map; import java.util.Properties; public class GitLabProvider implements Provider { - private static final Logger LOG = LoggerFactory.getLogger(GitLabProvider.class); + private static final Logger LOG = Logger.getLoggerFor(GitLabProvider.class); public static final String REF_SPEC = "+refs/merge-requests/*/head:refs/remotes/origin/merge-requests/*"; public static final String REF_PATTERN = "refs/remotes/origin/merge-requests/"; private static String LOGIN = "login"; @@ -44,10 +42,10 @@ public String getName() { public void addConfigData(GitConfig gitConfig) { try { Properties props = GitLabUtils.readPropertyFile(); - if (StringUtil.isEmpty(gitConfig.getUsername())) { + if (StringUtils.isEmpty(gitConfig.getUsername())) { gitConfig.setUsername(props.getProperty(LOGIN)); } - if (StringUtil.isEmpty(gitConfig.getPassword())) { + if (StringUtils.isEmpty(gitConfig.getPassword())) { gitConfig.setPassword(props.getProperty(ACCESS_TOKEN)); } } catch (Exception e) { @@ -125,7 +123,7 @@ private PullRequestStatus getPullRequestStatus(GitConfig gitConfig, String prId, return null; } - private MergeRequest pullRequestFrom(GitConfig gitConfig, int currentPullRequestID) throws GitLabApiException { + private MergeRequest pullRequestFrom(GitConfig gitConfig, long currentPullRequestID) throws GitLabApiException { return loginWith(gitConfig) .getMergeRequestApi() .getMergeRequest(GitLabUtils.getProjectPathFromUrl(gitConfig.getEffectiveUrl()), currentPullRequestID); @@ -135,7 +133,7 @@ private Function transformMergeRequestToPullReq return new Function() { @Override public PullRequestStatus apply(MergeRequest input) { - int prID = input.getId(); + Long prID = input.getId(); Author user = input.getAuthor(); return new PullRequestStatus(prID, GitLabProvider.REF_PATTERN, input.getSha(), mergedSHA, input.getSourceBranch(), input.getTargetBranch(), input.getWebUrl(), user.getName(), diff --git a/src/main/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabUtils.java b/src/main/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabUtils.java index a655396..ea740cd 100644 --- a/src/main/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabUtils.java +++ b/src/main/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabUtils.java @@ -1,7 +1,7 @@ package in.ashwanthkumar.gocd.github.provider.gitlab; +import in.ashwanthkumar.utils.lang.StringUtils; import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.StringUtils; import java.io.File; import java.io.FileInputStream; diff --git a/src/main/java/in/ashwanthkumar/gocd/github/util/BranchFilter.java b/src/main/java/in/ashwanthkumar/gocd/github/util/BranchFilter.java index 516dd1f..c5f7212 100644 --- a/src/main/java/in/ashwanthkumar/gocd/github/util/BranchFilter.java +++ b/src/main/java/in/ashwanthkumar/gocd/github/util/BranchFilter.java @@ -1,11 +1,7 @@ package in.ashwanthkumar.gocd.github.util; -import com.thoughtworks.go.plugin.api.logging.Logger; - public class BranchFilter { - private static Logger LOGGER = Logger.getLoggerFor(BranchFilter.class); - public static final String NO_BRANCHES = ""; private final BranchMatcher blacklistedBranches; private final BranchMatcher whitelistedBrandches; diff --git a/src/main/java/in/ashwanthkumar/gocd/github/util/JSONUtils.java b/src/main/java/in/ashwanthkumar/gocd/github/util/JSONUtils.java index c9cae44..c2f4628 100644 --- a/src/main/java/in/ashwanthkumar/gocd/github/util/JSONUtils.java +++ b/src/main/java/in/ashwanthkumar/gocd/github/util/JSONUtils.java @@ -1,10 +1,11 @@ package in.ashwanthkumar.gocd.github.util; import com.google.gson.GsonBuilder; +import com.google.gson.reflect.TypeToken; public class JSONUtils { - public static Object fromJSON(String json) { - return new GsonBuilder().create().fromJson(json, Object.class); + public static T fromJSON(String json) { + return new GsonBuilder().create().fromJson(json, new TypeToken() {}.getType()); } public static T fromJSON(String json, Class type) { diff --git a/src/main/resources/gerrit/plugin.xml b/src/main/resources/gerrit/plugin.xml index 124ae96..ec3eafd 100644 --- a/src/main/resources/gerrit/plugin.xml +++ b/src/main/resources/gerrit/plugin.xml @@ -2,7 +2,7 @@ Gerrit Change Set plugin - ${version} + ${project.version} 15.1.0 Provides ability to do change set builds for Gerrit repository diff --git a/src/main/resources/git/plugin.xml b/src/main/resources/git/plugin.xml index adc85e3..254276c 100644 --- a/src/main/resources/git/plugin.xml +++ b/src/main/resources/git/plugin.xml @@ -2,7 +2,7 @@ Git Feature Branch plugin - ${version} + ${project.version} 15.1.0 Provides ability to do feature branch builds for Git repository diff --git a/src/main/resources/github/plugin.xml b/src/main/resources/github/plugin.xml index 6901e12..fca3716 100644 --- a/src/main/resources/github/plugin.xml +++ b/src/main/resources/github/plugin.xml @@ -2,7 +2,7 @@ Github Pull Requests Builder - ${version} + ${project.version} 15.1.0 Plugin that polls a GitHub repository for pull requests and triggers a build for each of them diff --git a/src/main/resources/gitlab/plugin.xml b/src/main/resources/gitlab/plugin.xml index 0d4e359..38eb609 100644 --- a/src/main/resources/gitlab/plugin.xml +++ b/src/main/resources/gitlab/plugin.xml @@ -2,7 +2,7 @@ Gitlab Pull Requests Builder - ${version} + ${project.version} 19.8.0 Plugin that polls a Gitlab repository for merge requests and triggers a build for each of them diff --git a/src/main/resources/stash/plugin.xml b/src/main/resources/stash/plugin.xml index 2641a44..1c1c487 100644 --- a/src/main/resources/stash/plugin.xml +++ b/src/main/resources/stash/plugin.xml @@ -2,7 +2,7 @@ Stash Pull Requests Builder - ${version} + ${project.version} 15.1.0 Plugin that polls a Stash repository for pull requests and triggers a build for each of them diff --git a/src/test/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPluginTest.java b/src/test/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPluginTest.java index a0fd0b4..8bf79c3 100644 --- a/src/test/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPluginTest.java +++ b/src/test/java/in/ashwanthkumar/gocd/github/GitHubPRBuildPluginTest.java @@ -233,7 +233,7 @@ public void shouldBuildWhitelistedBranch() { GoPluginApiResponse response = pluginSpy.handleLatestRevisionSince(request); - Map> responseBody = (Map>)JSONUtils.fromJSON(response.responseBody()); + Map> responseBody = JSONUtils.fromJSON(response.responseBody()); assertThat(responseBody.get("scm-data").get("BRANCH_TO_REVISION_MAP"), is("{\"test-1\":\"abcdef01234567891\"}")); assertThat(response.responseCode(), is(200)); } @@ -255,7 +255,7 @@ public void shouldNotBuildBlacklistedBranch() { GoPluginApiResponse response = pluginSpy.handleLatestRevisionSince(request); - Map> responseBody = (Map>)JSONUtils.fromJSON(response.responseBody()); + Map> responseBody = JSONUtils.fromJSON(response.responseBody()); assertThat(responseBody.get("scm-data").get("BRANCH_TO_REVISION_MAP"), is("null")); assertThat(response.responseCode(), is(200)); } @@ -277,7 +277,7 @@ public void shouldBuildBlacklistedBranchIfBlacklistingNotEnabled() { GoPluginApiResponse response = pluginSpy.handleLatestRevisionSince(request); - Map> responseBody = (Map>)JSONUtils.fromJSON(response.responseBody()); + Map> responseBody = JSONUtils.fromJSON(response.responseBody()); assertThat(responseBody.get("scm-data").get("BRANCH_TO_REVISION_MAP"), is("{\"master\":\"abcdef01234567891\"}")); assertThat(response.responseCode(), is(200)); } @@ -306,7 +306,7 @@ private GoPluginApiRequest mockRequest() { private void mockGitHelperToReturnBranch(GitFactory gitFactory, final String branch) { GitHelper helper = mock(GitHelper.class); - when(gitFactory.create(any(GitConfig.class), any(File.class))).thenReturn(helper); + when(gitFactory.create(any(), any())).thenReturn(helper); when(helper.getBranchToRevisionMap(anyString())).thenReturn(new HashMap() {{ put(branch, "abcdef01234567891"); }}); diff --git a/src/test/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabUtilsTest.java b/src/test/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabUtilsTest.java index 0f93072..38dda88 100644 --- a/src/test/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabUtilsTest.java +++ b/src/test/java/in/ashwanthkumar/gocd/github/provider/gitlab/GitLabUtilsTest.java @@ -3,7 +3,6 @@ import org.junit.Test; import static in.ashwanthkumar.gocd.github.provider.gitlab.GitLabUtils.*; -import static in.ashwanthkumar.gocd.github.provider.gitlab.GitLabUtils.getProjectPathFromUrl; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat;