summaryrefslogtreecommitdiffstats
path: root/common/src
diff options
context:
space:
mode:
Diffstat (limited to 'common/src')
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java3
-rw-r--r--common/src/main/java/org/onap/so/client/RestProperties.java9
-rw-r--r--common/src/test/java/org/onap/so/client/RestClientTest.java6
3 files changed, 17 insertions, 1 deletions
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index be0a0f3f9e..f201c7c906 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -193,7 +193,8 @@ public abstract class RestClient {
if (props.isCachingEnabled()) {
enableCaching(builder);
}
- return builder.readTimeout(props.getReadTimeout(), TimeUnit.MILLISECONDS);
+ return builder.connectTimeout(props.getConnectionTimeout(), TimeUnit.MILLISECONDS)
+ .readTimeout(props.getReadTimeout(), TimeUnit.MILLISECONDS);
}
protected ClientBuilder enableCaching(ClientBuilder builder) {
diff --git a/common/src/main/java/org/onap/so/client/RestProperties.java b/common/src/main/java/org/onap/so/client/RestProperties.java
index a7a0ef614c..79e006bf9a 100644
--- a/common/src/main/java/org/onap/so/client/RestProperties.java
+++ b/common/src/main/java/org/onap/so/client/RestProperties.java
@@ -50,6 +50,15 @@ public interface RestProperties {
return Long.valueOf(60000);
}
+ /**
+ * Time in milliseconds
+ *
+ * @return
+ */
+ public default Long getConnectionTimeout() {
+ return Long.valueOf(60000);
+ }
+
public default boolean isCachingEnabled() {
return false;
}
diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java
index d40576b69f..57abf8784f 100644
--- a/common/src/test/java/org/onap/so/client/RestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/RestClientTest.java
@@ -101,6 +101,12 @@ public class RestClientTest {
RestProperties props = new RestProperties() {
+
+ @Override
+ public Integer getRetries() {
+ return Integer.valueOf(0);
+ }
+
@Override
public URL getEndpoint() throws MalformedURLException {
return new URL(String.format("http://localhost:%s", wireMockRule.port()));