aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-ws/src/test/java/org/sonarqube/ws/client
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2024-04-12 18:52:43 +0200
committersonartech <sonartech@sonarsource.com>2024-04-15 20:02:44 +0000
commitbc04c220c0c81f240149e2ee6c5af7fff6fb6f54 (patch)
tree88ee6a45049231894463ba7df877264e1cf2ec2a /sonar-ws/src/test/java/org/sonarqube/ws/client
parent94d11b4e7035ba66617247ebe027943eb37f914d (diff)
downloadsonarqube-bc04c220c0c81f240149e2ee6c5af7fff6fb6f54.tar.gz
sonarqube-bc04c220c0c81f240149e2ee6c5af7fff6fb6f54.zip
SONAR-22039 Support new timeout properties
Diffstat (limited to 'sonar-ws/src/test/java/org/sonarqube/ws/client')
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java4
-rw-r--r--sonar-ws/src/test/java/org/sonarqube/ws/client/OkHttpClientBuilderTest.java7
2 files changed, 10 insertions, 1 deletions
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java
index bbc9c0e127d..981d0eb145d 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/HttpConnectorTest.java
@@ -107,7 +107,7 @@ public class HttpConnectorTest {
server.enqueue(new MockResponse().setResponseCode(200).addHeader("Content-Encoding", "gzip")
.setBody(gzip("potentially a body with 100 GB of data normally encoded in gzip")));
- //by default we dont accept gzip
+ // by default we dont accept gzip
underTest = HttpConnector.newBuilder().url(serverUrl).build();
GetRequest request = new GetRequest("rest/api/1.0/repos");
@@ -319,10 +319,12 @@ public class HttpConnectorTest {
.url(serverUrl)
.readTimeoutMilliseconds(42)
.connectTimeoutMilliseconds(74)
+ .responseTimeoutMilliseconds(53)
.build();
assertThat(underTest.okHttpClient().readTimeoutMillis()).isEqualTo(42);
assertThat(underTest.okHttpClient().connectTimeoutMillis()).isEqualTo(74);
+ assertThat(underTest.okHttpClient().callTimeoutMillis()).isEqualTo(53);
}
@Test
diff --git a/sonar-ws/src/test/java/org/sonarqube/ws/client/OkHttpClientBuilderTest.java b/sonar-ws/src/test/java/org/sonarqube/ws/client/OkHttpClientBuilderTest.java
index 7881f554f92..4daae827e66 100644
--- a/sonar-ws/src/test/java/org/sonarqube/ws/client/OkHttpClientBuilderTest.java
+++ b/sonar-ws/src/test/java/org/sonarqube/ws/client/OkHttpClientBuilderTest.java
@@ -83,4 +83,11 @@ public class OkHttpClientBuilderTest {
.isInstanceOf(IllegalArgumentException.class)
.hasMessage("Read timeout must be positive. Got -10");
}
+
+ @Test
+ public void build_throws_IAE_if_response_timeout_is_negative() {
+ assertThatThrownBy(() -> underTest.setResponseTimeoutMs(-10))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("Response timeout must be positive. Got -10");
+ }
}