Skip to content

Commit

Permalink
Merge pull request #277 from bzzitsme/backward-compatibility-fix
Browse files Browse the repository at this point in the history
Bump version of google-oauth-plugin and fix the tests
  • Loading branch information
jtnord committed Dec 18, 2023
2 parents 57873b8 + cb891b8 commit 355d598
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 29 deletions.
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
<artifactId>j2objc-annotations</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>oauth-credentials</artifactId>
<version>0.646.v02b_66dc03d2e</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down Expand Up @@ -235,7 +240,7 @@
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>google-oauth-plugin</artifactId>
<!-- TODO: Remove this version when it is integrated in Jenkins BOM -->
<version>1.318.vb_39c5db_e3041</version>
<version>1.328.v6ea_0fb_df5f7b_</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.services.storage.Storage;
import com.google.jenkins.plugins.credentials.oauth.AbstractGoogleRobotCredentialsDescriptor;
import com.google.jenkins.plugins.credentials.oauth.GoogleOAuth2ScopeRequirement;
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials;
import com.google.jenkins.plugins.util.MockExecutor;
Expand Down Expand Up @@ -51,9 +50,6 @@ public class ClassicUploadStepTest {

private GoogleCredential credential;

@Mock
private AbstractGoogleRobotCredentialsDescriptor descriptor;

private final MockExecutor executor = new MockExecutor();

private NotFoundException notFoundException = new NotFoundException();
Expand All @@ -62,11 +58,8 @@ public class ClassicUploadStepTest {
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);

when(descriptor.getDisplayName()).thenReturn("Credentials Name");

when(credentials.getId()).thenReturn(CREDENTIALS_ID);
when(credentials.getProjectId()).thenReturn(PROJECT_ID);
when(credentials.getDescriptor()).thenReturn(descriptor);

if (jenkins.jenkins != null) {
SystemCredentialsProvider.getInstance().getCredentials().add(credentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
import com.google.api.services.storage.Storage;
import com.google.api.services.storage.model.Objects;
import com.google.api.services.storage.model.StorageObject;
import com.google.jenkins.plugins.credentials.oauth.AbstractGoogleRobotCredentialsDescriptor;
import com.google.jenkins.plugins.credentials.oauth.GoogleOAuth2ScopeRequirement;
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials;
import com.google.jenkins.plugins.util.MockExecutor;
Expand Down Expand Up @@ -67,18 +66,12 @@ public class DownloadStepTest {

private final MockExecutor executor = new MockExecutor();

@Mock
private AbstractGoogleRobotCredentialsDescriptor descriptor;

@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);

when(descriptor.getDisplayName()).thenReturn("Credentials Name");

when(credentials.getId()).thenReturn(CREDENTIALS_ID);
when(credentials.getProjectId()).thenReturn(PROJECT_ID);
when(credentials.getDescriptor()).thenReturn(descriptor);

if (jenkins.jenkins != null) {
SystemCredentialsProvider.getInstance().getCredentials().add(credentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.services.storage.Storage;
import com.google.jenkins.plugins.credentials.oauth.AbstractGoogleRobotCredentialsDescriptor;
import com.google.jenkins.plugins.credentials.oauth.GoogleOAuth2ScopeRequirement;
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials;
import com.google.jenkins.plugins.util.MockExecutor;
Expand All @@ -46,9 +45,6 @@ public class ExpiringBucketLifecycleManagerStepTest {

private GoogleCredential credential;

@Mock
private AbstractGoogleRobotCredentialsDescriptor descriptor;

private final MockExecutor executor = new MockExecutor();
private NotFoundException notFoundException = new NotFoundException();
private static final String PROJECT_ID = "foo.com:project-build";
Expand All @@ -61,11 +57,8 @@ public class ExpiringBucketLifecycleManagerStepTest {
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);

when(descriptor.getDisplayName()).thenReturn("Credentials Name");

when(credentials.getId()).thenReturn(CREDENTIALS_ID);
when(credentials.getProjectId()).thenReturn(PROJECT_ID);
when(credentials.getDescriptor()).thenReturn(descriptor);

if (jenkins.jenkins != null) {
SystemCredentialsProvider.getInstance().getCredentials().add(credentials);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import com.cloudbees.plugins.credentials.SystemCredentialsProvider;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.services.storage.Storage;
import com.google.jenkins.plugins.credentials.oauth.AbstractGoogleRobotCredentialsDescriptor;
import com.google.jenkins.plugins.credentials.oauth.GoogleOAuth2ScopeRequirement;
import com.google.jenkins.plugins.credentials.oauth.GoogleRobotCredentials;
import com.google.jenkins.plugins.util.MockExecutor;
Expand All @@ -47,9 +46,6 @@ public class StdoutUploadStepTest {

private GoogleCredential credential;

@Mock
private AbstractGoogleRobotCredentialsDescriptor descriptor;

private final MockExecutor executor = new MockExecutor();
private NotFoundException notFoundException = new NotFoundException();
private static final String PROJECT_ID = "foo.com:project-build";
Expand All @@ -62,11 +58,8 @@ public class StdoutUploadStepTest {
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);

when(descriptor.getDisplayName()).thenReturn("Credentials Name");

when(credentials.getId()).thenReturn(CREDENTIALS_ID);
when(credentials.getProjectId()).thenReturn(PROJECT_ID);
when(credentials.getDescriptor()).thenReturn(descriptor);

if (jenkins.jenkins != null) {
SystemCredentialsProvider.getInstance().getCredentials().add(credentials);
Expand Down

0 comments on commit 355d598

Please sign in to comment.