diff options
author | Benjamin, Max (mb388a) <mb388a@att.com> | 2021-01-23 16:07:59 -0500 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2021-02-01 17:43:52 -0500 |
commit | b8b0464aa8a05a345115264084b08229f35c8413 (patch) | |
tree | c65cbaaa063c0809f629a4c3f7c3edf23dc95f2f | |
parent | f1235657951f714a394f1cfc7aef08af05620be4 (diff) |
set connection timeout as well as read timeout
set connection timeout as well as read timeout
correct dependency version in openstack pom
limit timeout test to a single retry
add connection timeout property for A&AI client
Issue-ID: SO-3491
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I576c143822ba45fc79648fd0a1edb6ccd3aff8b2
9 files changed, 66 insertions, 5 deletions
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java index cd32cc208a..79d5824de7 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/AaiClientPropertiesImpl.java @@ -34,6 +34,7 @@ public class AaiClientPropertiesImpl implements AAIProperties { private String auth; private String key; private Long readTimeout; + private Long connectionTimeout; private boolean enableCaching; private Long cacheMaxAge; private static final String SYSTEM_NAME = "MSO"; @@ -43,7 +44,8 @@ public class AaiClientPropertiesImpl implements AAIProperties { aaiEndpoint = context.getEnvironment().getProperty("aai.endpoint"); this.auth = context.getEnvironment().getProperty("aai.auth"); this.key = context.getEnvironment().getProperty("mso.msoKey"); - this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, new Long(60000)); + this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, 60000L); + this.connectionTimeout = context.getEnvironment().getProperty("aai.connectionTimeout", Long.class, 60000L); this.enableCaching = context.getEnvironment().getProperty("aai.caching.enabled", Boolean.class, false); this.cacheMaxAge = context.getEnvironment().getProperty("aai.caching.maxAge", Long.class, 60000L); } @@ -79,6 +81,11 @@ public class AaiClientPropertiesImpl implements AAIProperties { } @Override + public Long getConnectionTimeout() { + return this.connectionTimeout; + } + + @Override public boolean isCachingEnabled() { return this.enableCaching; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java index ace0ff1f57..46bdfe0b93 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java @@ -34,6 +34,7 @@ public class AaiClientPropertiesImpl implements AAIProperties { private String auth; private String key; private Long readTimeout; + private Long connectionTimeout; private boolean enableCaching; private Long cacheMaxAge; private static final String SYSTEM_NAME = "MSO"; @@ -43,7 +44,8 @@ public class AaiClientPropertiesImpl implements AAIProperties { aaiEndpoint = context.getEnvironment().getProperty("mso.aai.endpoint"); this.auth = context.getEnvironment().getProperty("aai.auth"); this.key = context.getEnvironment().getProperty("mso.msoKey"); - this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, new Long(60000)); + this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, 60000L); + this.connectionTimeout = context.getEnvironment().getProperty("aai.connectionTimeout", Long.class, 60000L); this.enableCaching = context.getEnvironment().getProperty("aai.caching.enabled", Boolean.class, false); this.cacheMaxAge = context.getEnvironment().getProperty("aai.caching.maxAge", Long.class, 60000L); } @@ -81,6 +83,11 @@ public class AaiClientPropertiesImpl implements AAIProperties { } @Override + public Long getConnectionTimeout() { + return this.connectionTimeout; + } + + @Override public boolean isCachingEnabled() { return this.enableCaching; } diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java index 98a14fc0e5..b6227aae16 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/restproperties/AAIPropertiesImpl.java @@ -35,6 +35,7 @@ public class AAIPropertiesImpl implements AAIProperties { public static final String AAI_AUTH = "aai.auth"; public static final String AAI_ENDPOINT = "aai.endpoint"; public static final String AAI_READ_TIMEOUT = "aai.readTimeout"; + public static final String AAI_CONNECTION_TIMEOUT = "aai.connectionTimeout"; public static final String AAI_ENABLE_CACHING = "aai.caching.enable"; public static final String AAI_CACHE_MAX_AGE = "aai.caching.maxAge"; @@ -71,6 +72,11 @@ public class AAIPropertiesImpl implements AAIProperties { } @Override + public Long getConnectionTimeout() { + return Long.valueOf(reader.getVariable(AAI_CONNECTION_TIMEOUT, "60000")); + } + + @Override public boolean isCachingEnabled() { return Boolean.parseBoolean(reader.getVariable(AAI_ENABLE_CACHING, "false")); } 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())); diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java index 1492baf1cd..e330d2116c 100644 --- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java +++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/AaiClientPropertiesImpl.java @@ -34,6 +34,7 @@ public class AaiClientPropertiesImpl implements AAIProperties { private String auth; private String key; private Long readTimeout; + private Long connectionTimeout; private boolean enableCaching; private Long cacheMaxAge; @@ -43,7 +44,8 @@ public class AaiClientPropertiesImpl implements AAIProperties { aaiEndpoint = context.getEnvironment().getProperty("mso.aai.endpoint"); this.auth = context.getEnvironment().getProperty("aai.auth"); this.key = context.getEnvironment().getProperty("mso.msoKey"); - this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, new Long(60000)); + this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, 60000L); + this.connectionTimeout = context.getEnvironment().getProperty("aai.connectionTimeout", Long.class, 60000L); this.enableCaching = context.getEnvironment().getProperty("aai.caching.enabled", Boolean.class, false); this.cacheMaxAge = context.getEnvironment().getProperty("aai.caching.maxAge", Long.class, 60000L); } @@ -79,6 +81,11 @@ public class AaiClientPropertiesImpl implements AAIProperties { } @Override + public Long getConnectionTimeout() { + return this.connectionTimeout; + } + + @Override public boolean isCachingEnabled() { return this.enableCaching; } @@ -1030,6 +1030,17 @@ </exclusions> </dependency> <dependency> + <groupId>org.apache.cxf</groupId> + <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId> + <version>${cxf.version}</version> + <exclusions> + <exclusion> + <groupId>org.jboss.spec.javax.rmi</groupId> + <artifactId>jboss-rmi-api_1.0_spec</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> <groupId>org.onap.aaf.authz</groupId> <artifactId>aaf-cadi-client</artifactId> <version>${aaf.version}</version> diff --git a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiPropertiesImpl.java b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiPropertiesImpl.java index 0aa14c711f..25a43a86d0 100644 --- a/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiPropertiesImpl.java +++ b/so-etsi-nfvo/so-etsi-nfvo-ns-lcm/so-etsi-nfvo-ns-lcm-bpmn-flows/src/main/java/org/onap/so/etsi/nfvo/ns/lcm/bpmn/flows/extclients/aai/AaiPropertiesImpl.java @@ -35,6 +35,7 @@ public class AaiPropertiesImpl implements AAIProperties { private final String encryptionKey; private final String aaiVersion; private final Long readTimeout; + private final Long connectionTimeout; private final boolean enableCaching; private final Long cacheMaxAge; @@ -44,7 +45,8 @@ public class AaiPropertiesImpl implements AAIProperties { this.encryptedBasicAuth = context.getEnvironment().getProperty("aai.auth"); this.encryptionKey = context.getEnvironment().getProperty("mso.key"); this.aaiVersion = context.getEnvironment().getProperty("aai.version"); - this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, new Long(60000)); + this.readTimeout = context.getEnvironment().getProperty("aai.readTimeout", Long.class, 60000L); + this.connectionTimeout = context.getEnvironment().getProperty("aai.connectionTimeout", Long.class, 60000L); this.enableCaching = context.getEnvironment().getProperty("aai.caching.enabled", Boolean.class, false); this.cacheMaxAge = context.getEnvironment().getProperty("aai.caching.maxAge", Long.class, 60000L); } @@ -86,6 +88,11 @@ public class AaiPropertiesImpl implements AAIProperties { } @Override + public Long getConnectionTimeout() { + return this.connectionTimeout; + } + + @Override public boolean isCachingEnabled() { return this.enableCaching; } |