Skip to content

Commit

Permalink
[JENKINS-73172] Apply non deprecated API suggestions
Browse files Browse the repository at this point in the history
Co-authored-by: Jérôme Pochat <[email protected]>
  • Loading branch information
Dohbedoh and jeromepochat authored Oct 16, 2024
1 parent 220550d commit 5480035
Showing 1 changed file with 42 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,9 @@ public void given__cloud_branch_rev_userkey__when__build__then__scmBuilt() throw
createGitHubSCMSourceForTest(false, null);
BranchSCMHead head = new BranchSCMHead("test-branch");
SCMRevisionImpl revision = new SCMRevisionImpl(head, "cafebabedeadbeefcafebabedeadbeefcafebabe");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(revision));
Expand Down Expand Up @@ -406,8 +407,9 @@ public void given__cloud_branch_rev_userkey_sshtrait_anon__when__build__then__sc
createGitHubSCMSourceForTest(false, null);
BranchSCMHead head = new BranchSCMHead("test-branch");
SCMRevisionImpl revision = new SCMRevisionImpl(head, "cafebabedeadbeefcafebabedeadbeefcafebabe");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(revision));
Expand Down Expand Up @@ -595,8 +597,9 @@ public void given__cloud_branch_rev_userkey_sshtrait_userkey__when__build__then_
createGitHubSCMSourceForTest(false, null);
BranchSCMHead head = new BranchSCMHead("test-branch");
SCMRevisionImpl revision = new SCMRevisionImpl(head, "cafebabedeadbeefcafebabedeadbeefcafebabe");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(revision));
Expand Down Expand Up @@ -741,8 +744,9 @@ public void given__cloud_branch_norev_userpass__when__build__then__scmBuilt() th
public void given__cloud_branch_norev_userkey__when__build__then__scmBuilt() throws Exception {
createGitHubSCMSourceForTest(false, null);
BranchSCMHead head = new BranchSCMHead("test-branch");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(nullValue()));
Expand Down Expand Up @@ -903,8 +907,9 @@ public void given__server_branch_rev_userkey__when__build__then__scmBuilt() thro
BranchSCMHead head = new BranchSCMHead("test-branch");
AbstractGitSCMSource.SCMRevisionImpl revision =
new AbstractGitSCMSource.SCMRevisionImpl(head, "cafebabedeadbeefcafebabedeadbeefcafebabe");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(revision));
Expand Down Expand Up @@ -1044,8 +1049,9 @@ public void given__server_branch_norev_userpass__when__build__then__scmBuilt() t
public void given__server_branch_norev_userkey__when__build__then__scmBuilt() throws Exception {
createGitHubSCMSourceForTest(true, "https://github.test/tester/test-repo.git");
BranchSCMHead head = new BranchSCMHead("test-branch");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(nullValue()));
Expand Down Expand Up @@ -1230,8 +1236,9 @@ public void given__cloud_pullHead_rev_userkey__when__build__then__scmBuilt() thr
PullRequestSCMRevision revision = new PullRequestSCMRevision(
head, "deadbeefcafebabedeadbeefcafebabedeadbeef", "cafebabedeadbeefcafebabedeadbeefcafebabe");
createGitHubSCMSourceForTest(false, null);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(revision));
Expand Down Expand Up @@ -1395,8 +1402,9 @@ public void given__cloud_pullHead_norev_userkey__when__build__then__scmBuilt() t
new BranchSCMHead("test-branch"),
new SCMHeadOrigin.Fork("qa/qa-repo"),
ChangeRequestCheckoutStrategy.HEAD);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(nullValue()));
Expand Down Expand Up @@ -1581,8 +1589,9 @@ public void given__server_pullHead_rev_userkey__when__build__then__scmBuilt() th
ChangeRequestCheckoutStrategy.HEAD);
PullRequestSCMRevision revision = new PullRequestSCMRevision(
head, "deadbeefcafebabedeadbeefcafebabedeadbeef", "cafebabedeadbeefcafebabedeadbeefcafebabe");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(revision));
Expand Down Expand Up @@ -1746,8 +1755,9 @@ public void given__server_pullHead_norev_userkey__when__build__then__scmBuilt()
new BranchSCMHead("test-branch"),
new SCMHeadOrigin.Fork("qa/qa-repo"),
ChangeRequestCheckoutStrategy.HEAD);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(nullValue()));
Expand Down Expand Up @@ -1962,8 +1972,9 @@ public void given__cloud_pullMerge_rev_userkey__when__build__then__scmBuilt() th
ChangeRequestCheckoutStrategy.MERGE);
PullRequestSCMRevision revision = new PullRequestSCMRevision(
head, "deadbeefcafebabedeadbeefcafebabedeadbeef", "cafebabedeadbeefcafebabedeadbeefcafebabe");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(revision));
Expand Down Expand Up @@ -2166,8 +2177,9 @@ public void given__cloud_pullMerge_norev_userkey__when__build__then__scmBuilt()
new BranchSCMHead("test-branch"),
new SCMHeadOrigin.Fork("qa/qa-repo"),
ChangeRequestCheckoutStrategy.MERGE);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(nullValue()));
Expand Down Expand Up @@ -2394,8 +2406,9 @@ public void given__server_pullMerge_rev_userkey__when__build__then__scmBuilt() t
ChangeRequestCheckoutStrategy.MERGE);
PullRequestSCMRevision revision = new PullRequestSCMRevision(
head, "deadbeefcafebabedeadbeefcafebabedeadbeef", "cafebabedeadbeefcafebabedeadbeefcafebabe");
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, revision)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(revision));
Expand Down Expand Up @@ -2600,8 +2613,9 @@ public void given__server_pullMerge_norev_userkey__when__build__then__scmBuilt()
new BranchSCMHead("test-branch"),
new SCMHeadOrigin.Fork("qa/qa-repo"),
ChangeRequestCheckoutStrategy.MERGE);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null);
instance.withCredentials("user-key", GitHubSCMBuilder.SSH);
GitHubSCMBuilder instance = new GitHubSCMBuilder(source, head, null)
.withCredentials("user-key")
.withResolver(GitHubSCMBuilder.SSH);
assertThat(instance.credentialsId(), is("user-key"));
assertThat(instance.head(), is(head));
assertThat(instance.revision(), is(nullValue()));
Expand Down

0 comments on commit 5480035

Please sign in to comment.