Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 8 additions & 38 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>4.64</version>
<version>5.10</version>
<relativePath />
</parent>
<groupId>io.jenkins.plugins</groupId>
Expand All @@ -13,8 +13,8 @@
<packaging>hpi</packaging>
<properties>
<!-- https://www.jenkins.io/doc/developer/plugin-development/choosing-jenkins-baseline/ -->
<jenkins.baseline>2.361</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.4</jenkins.version>
<jenkins.baseline>2.479</jenkins.baseline>
<jenkins.version>${jenkins.baseline}.3</jenkins.version>
</properties>
<name>Tuleap API Plugin</name>
<description>Provides a client for the Tuleap API</description>
Expand Down Expand Up @@ -47,15 +47,10 @@
<dependency>
<groupId>io.jenkins.tools.bom</groupId>
<artifactId>bom-${jenkins.baseline}.x</artifactId>
<version>2102.v854b_fec19c92</version>
<version>4583.v0a_f4df179fa_b_</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
<artifactId>kotlin-stdlib-common</artifactId>
<version>1.8.21</version>
</dependency>
<dependency>
<groupId>org.checkerframework</groupId>
<artifactId>checker-qual</artifactId>
Expand Down Expand Up @@ -87,18 +82,16 @@
<artifactId>credentials</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>4.11.0</version>
<groupId>io.jenkins.plugins</groupId>
<artifactId>okhttp-api</artifactId>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.20.0</version>
<groupId>io.jenkins.plugins</groupId>
<artifactId>commons-lang3-api</artifactId>
</dependency>
<dependency>
<groupId>com.auth0</groupId>
Expand All @@ -123,23 +116,10 @@
<version>1.15</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest</artifactId>
<version>2.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>5.20.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<repositories>
Expand All @@ -154,16 +134,6 @@
<url>https://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jenkins-ci.tools</groupId>
<artifactId>maven-hpi-plugin</artifactId>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>jacoco</id>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package io.jenkins.plugins.tuleap_api.client;

import io.jenkins.plugins.tuleap_api.client.exceptions.git.TreeNotFoundException;

public interface GitTreeContent {

enum ContentType {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.inject.Inject;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.util.Secret;
import io.jenkins.plugins.tuleap_api.client.*;
import io.jenkins.plugins.tuleap_api.client.authentication.AccessToken;
Expand Down Expand Up @@ -65,7 +64,6 @@ public Boolean checkAccessKeyIsValid(Secret secret) {
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<AccessKeyScope> getAccessKeyScopes(Secret secret) {
Request request = new Request.Builder()
.url(tuleapConfiguration.getApiBaseUrl() + this.ACCESS_KEY_API + this.ACCESS_KEY_SELF_ID)
Expand All @@ -89,7 +87,6 @@ public List<AccessKeyScope> getAccessKeyScopes(Secret secret) {
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public User getUserForAccessKey(Secret secret) {
Request request = new Request.Builder()
.url(tuleapConfiguration.getApiBaseUrl() + this.USER_API + this.USER_SELF_ID)
Expand All @@ -115,7 +112,6 @@ public User getUserForAccessKey(Secret secret) {
*/
@Deprecated
@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<UserGroup> getUserMembershipName(AccessToken accessToken) {
LOGGER.info("You are using a deprecated method. Please upgrade your Tuleap and use getUserMembership() instead. ");

Expand Down Expand Up @@ -147,15 +143,12 @@ public List<UserGroup> getUserMembershipName(AccessToken accessToken) {
}

List<UserGroup> memberships = new ArrayList<>();
userMembershipIds.forEach(groupId -> {
memberships.add(this.getUserGroup(groupId, accessToken));
});
userMembershipIds.forEach(groupId -> memberships.add(this.getUserGroup(groupId, accessToken)));

return memberships;
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<UserGroup> getUserMembership(AccessToken accessToken) {
HttpUrl urlUserMembership = Objects.requireNonNull(HttpUrl.parse(this.tuleapConfiguration.getApiBaseUrl() + this.USER_API + this.USER_SELF_ID + this.USER_MEMBERSHIP))
.newBuilder()
Expand Down Expand Up @@ -191,7 +184,6 @@ public List<UserGroup> getUserMembership(AccessToken accessToken) {
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public UserGroup getUserGroup(String groupId, AccessToken accessToken) {
Request request = new Request.Builder()
.url(this.tuleapConfiguration.getApiBaseUrl() + this.USER_GROUPS_API + "/" + groupId)
Expand All @@ -213,7 +205,6 @@ public UserGroup getUserGroup(String groupId, AccessToken accessToken) {
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public Project getProjectByShortname(String shortname, AccessToken token) throws ProjectNotFoundException {
final HttpUrl url = Objects.requireNonNull(HttpUrl.parse(this.tuleapConfiguration.getApiBaseUrl() + this.PROJECT_API))
.newBuilder()
Expand All @@ -234,7 +225,8 @@ public Project getProjectByShortname(String shortname, AccessToken token) throws

final List<ProjectEntity> projects = this.objectMapper.readValue(
Objects.requireNonNull(response.body()).string(),
new TypeReference<List<ProjectEntity>>() {}
new TypeReference<>() {
}
);

return projects
Expand All @@ -247,7 +239,6 @@ public Project getProjectByShortname(String shortname, AccessToken token) throws
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public Project getProjectById(String projectId, TuleapAccessToken token) {
final Request request = new Request.Builder()
.url(this.tuleapConfiguration.getApiBaseUrl() + this.PROJECT_API + "/" + projectId)
Expand All @@ -270,7 +261,6 @@ public Project getProjectById(String projectId, TuleapAccessToken token) {
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<UserGroup> getProjectUserGroups(Integer projectId, AccessToken token) {
final Request request = new Request.Builder()
.url(this.tuleapConfiguration.getApiBaseUrl() + this.PROJECT_API + "/" + projectId + this.PROJECT_GROUPS)
Expand All @@ -294,7 +284,6 @@ public List<UserGroup> getProjectUserGroups(Integer projectId, AccessToken token
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<GitRepository> getGitRepositories(Integer projectId, TuleapAccessToken token) {
int offset = 0;
int totalSize;
Expand Down Expand Up @@ -336,7 +325,6 @@ public List<GitRepository> getGitRepositories(Integer projectId, TuleapAccessTok
return allRepositories;
}
@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<Project> getUserProjects(TuleapAccessToken token) {
int offset = 0;
int totalSize;
Expand Down Expand Up @@ -449,7 +437,6 @@ public void sendBuildStatus(String repositoryId, String commitReference, TuleapB
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public GitCommit getCommit(String repositoryId, String commitReference, TuleapAccessToken token) {
Request request = new Request.Builder()
.url(this.tuleapConfiguration.getApiBaseUrl() + this.GIT_API + "/" + repositoryId + this.COMMITS + "/" + commitReference)
Expand All @@ -471,7 +458,6 @@ public GitCommit getCommit(String repositoryId, String commitReference, TuleapAc
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<GitTreeContent> getTree(String repositoryId, String commitReference, String path, TuleapAccessToken token) throws TreeNotFoundException {
HttpUrl urlGetTree = Objects.requireNonNull(HttpUrl.parse(this.tuleapConfiguration.getApiBaseUrl() + this.GIT_API + "/" + repositoryId + this.TREE))
.newBuilder()
Expand Down Expand Up @@ -505,7 +491,6 @@ public List<GitTreeContent> getTree(String repositoryId, String commitReference,
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE")
public GitFileContent getFileContent(String repositoryId, String commitReference, String path, TuleapAccessToken token) throws FileContentNotFoundException {
HttpUrl urlGetFile = Objects.requireNonNull(HttpUrl.parse(this.tuleapConfiguration.getApiBaseUrl() + this.GIT_API + "/" + repositoryId + this.FILES))
.newBuilder()
Expand Down Expand Up @@ -538,7 +523,6 @@ public GitFileContent getFileContent(String repositoryId, String commitReference
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<GitPullRequest> getPullRequests(String repositoryId, TuleapAccessToken token) {
int offset = 0;

Expand Down Expand Up @@ -583,7 +567,6 @@ public List<GitPullRequest> getPullRequests(String repositoryId, TuleapAccessTok
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public List<GitBranch> getBranches(String repositoryId, TuleapAccessToken token) {
int offset = 0;
int totalSize;
Expand Down Expand Up @@ -628,7 +611,6 @@ public List<GitBranch> getBranches(String repositoryId, TuleapAccessToken token)
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public PullRequest getPullRequest(String pullRequestId, TuleapAccessToken token) {
Request request = new Request.Builder()
.url(this.tuleapConfiguration.getApiBaseUrl() + this.PULL_REQUEST_API + "/" + pullRequestId)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.auth0.jwk.UrlJwkProvider;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.inject.Inject;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import hudson.util.Secret;
import io.jenkins.plugins.tuleap_api.client.authentication.*;
import io.jenkins.plugins.tuleap_api.client.internals.entities.authentication.AccessTokenEntity;
Expand All @@ -23,7 +22,6 @@

import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
Expand Down Expand Up @@ -64,7 +62,6 @@ public TuleapAuthenticationApiAuthenticationClient(
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public AccessToken getAccessToken(
String codeVerifier,
String authorizationCode,
Expand Down Expand Up @@ -97,7 +94,6 @@ public AccessToken getAccessToken(
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public AccessToken refreshToken(AccessToken accessToken, String clientId, Secret clientSecret) {
RequestBody requestBody = new FormBody.Builder()
.add("grant_type", "refresh_token")
Expand Down Expand Up @@ -147,7 +143,6 @@ public List<Jwk> getSigningKeys() {
}

@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public UserInfo getUserInfo(AccessToken accessToken) {
Request req = new Request.Builder()
.url(this.tuleapConfiguration.getDomainUrl() + OpenIDClientApi.USER_INFO_API)
Expand All @@ -171,7 +166,6 @@ public UserInfo getUserInfo(AccessToken accessToken) {


@Override
@SuppressFBWarnings("NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE") // see https://github.com/spotbugs/spotbugs/issues/651
public String getProviderIssuer() {
Request req = new Request.Builder()
.url(this.tuleapConfiguration.getDomainUrl() + OpenIDClientApi.DISCOVERY_API)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.fasterxml.jackson.annotation.JsonProperty;
import io.jenkins.plugins.tuleap_api.client.GitHead;
import io.jenkins.plugins.tuleap_api.client.GitPullRequest;
import io.jenkins.plugins.tuleap_api.client.GitRepositoryReference;
import io.jenkins.plugins.tuleap_api.client.PullRequest;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void validateHeader(Response response) throws InvalidHeaderException {
throw new InvalidHeaderException("There is no content type");
}

if (!contentType.toLowerCase().equals(CONTENT_TYPE_HEADER_VALUE.toLowerCase())) {
if (!contentType.equalsIgnoreCase(CONTENT_TYPE_HEADER_VALUE)) {
throw new InvalidHeaderException("Bad content type value");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package io.jenkins.plugins.tuleap_api.deprecated_client.impl;

import edu.umd.cs.findbugs.annotations.NonNull;
import okhttp3.*;
import io.jenkins.plugins.tuleap_credentials.TuleapAccessToken;
import org.jetbrains.annotations.NotNull;

import java.io.IOException;

Expand All @@ -14,7 +14,7 @@ class AccessKeyInterceptor implements Interceptor {
this.token = token;
}

@NotNull
@NonNull
@Override
public Response intercept(Chain chain) throws IOException {
Request req = chain.request();
Expand Down
Loading
Loading