aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src/main/java/org/sonarqube/ws/client/MockWsResponse.java
diff options
context:
space:
mode:
authorMatteo Mara <matteo.mara@sonarsource.com>2022-07-05 15:52:26 +0200
committersonartech <sonartech@sonarsource.com>2022-07-06 20:03:56 +0000
commit6354fe3096b07caf9eb017ab7b4e0565f6d303fc (patch)
tree593d31be7e2902f186e85d6d0a588288162a73fe /sonar-ws/src/main/java/org/sonarqube/ws/client/MockWsResponse.java
parent6a401f73236a70f702b64646d8bdec7c5a90e15d (diff)
downloadsonarqube-6354fe3096b07caf9eb017ab7b4e0565f6d303fc.tar.gz
sonarqube-6354fe3096b07caf9eb017ab7b4e0565f6d303fc.zip
SONAR-16567 add an analysis warning when using a token expiring in less than 7 days.
Diffstat (limited to 'sonar-ws/src/main/java/org/sonarqube/ws/client/MockWsResponse.java')
-rw-r--r--sonar-ws/src/main/java/org/sonarqube/ws/client/MockWsResponse.java6
1 files changed, 6 insertions, 0 deletions
diff --git a/sonar-ws/src/main/java/org/sonarqube/ws/client/MockWsResponse.java b/sonar-ws/src/main/java/org/sonarqube/ws/client/MockWsResponse.java
index 70c889f0501..2e799b1806d 100644
--- a/sonar-ws/src/main/java/org/sonarqube/ws/client/MockWsResponse.java
+++ b/sonar-ws/src/main/java/org/sonarqube/ws/client/MockWsResponse.java
@@ -35,6 +35,7 @@ import static java.util.Objects.requireNonNull;
public class MockWsResponse extends BaseResponse {
private static final String CONTENT_TYPE_HEADER = "Content-Type";
+ private static final String SQ_TOKEN_EXPIRATION_HEADER = "sq-authentication-token-expiration";
private int code = HttpURLConnection.HTTP_OK;
private String requestUrl;
@@ -66,6 +67,11 @@ public class MockWsResponse extends BaseResponse {
return this;
}
+ public MockWsResponse setExpirationDate(String expirationDate) {
+ headers.put(SQ_TOKEN_EXPIRATION_HEADER, expirationDate);
+ return this;
+ }
+
public MockWsResponse setRequestUrl(String requestUrl) {
this.requestUrl = requestUrl;
return this;