aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorash74268 <ashwin.shyam.sharma@att.com>2021-06-21 12:50:56 -0500
committerash74268 <ashwin.shyam.sharma@att.com>2021-06-21 16:56:39 -0500
commit0d2173bdd1f5e834076d511b08282e7d99e4125a (patch)
tree1011e5b372b76bb7d242af5be27949b828edf6c5
parent55581623ef047759764dd7aeafa9e1986e927585 (diff)
SDC Distribution Client to support proxy config
Issue-ID: SDC-3613 Signed-off-by: ash74268 <ashwin.shyam.sharma@att.com> Change-Id: I4d66618db7f486200ad887f5d3adabb3ba55dce5
-rw-r--r--README.md5
-rw-r--r--sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java64
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java118
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/http/HttpClientFactory.java112
-rw-r--r--sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java62
-rw-r--r--sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java62
6 files changed, 339 insertions, 84 deletions
diff --git a/README.md b/README.md
index 17c519c..8a22140 100644
--- a/README.md
+++ b/README.md
@@ -35,6 +35,11 @@ Configuration parameters:
- KeyStorePath : Return full path to Client's Key Store that contains either CA certificate or the ASDC's public key (e.g /etc/keystore/asdc-client.jks). file will be deployed with asdc-distribution jar
- KeyStorePassword : Return client's Key Store password.
- activateServerTLSAuth : Sets whether ASDC server TLS authentication is activated. If set to false, Key Store path and password are not needed to be set.
+- UseSystemProxy : If set to true, SDC Distribution Client will use system wide proxy configuration passed through JVM arguments.
+- HttpProxyHost : Optional config. If configured, SDC Distribution client will use this http proxy host with HTTP client.
+- HttpProxyPort : Mandatory if HttpProxyHost is configured. If configured, SDC Distribution client will use this https proxy port with HTTP client.
+- HttpsProxyHost : Optional config. If configured, SDC Distribution client will use this https proxy host with HTTPS client.
+- HttpsProxyPort : Mandatory if HttpsProxyHost is configured. If configured, SDC Distribution client will use this https proxy port with HTTPS client.
Example of configuration file implementing IConfiguration interface:
--------------------------------------------------------------------
diff --git a/sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java b/sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java
index 8a02801..ad18969 100644
--- a/sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java
+++ b/sdc-distribution-ci/src/main/java/org/onap/test/core/config/DistributionClientConfig.java
@@ -24,7 +24,6 @@ import org.onap.sdc.api.consumer.IConfiguration;
import java.util.ArrayList;
import java.util.List;
-
public class DistributionClientConfig implements IConfiguration {
public static final String DEFAULT_ASDC_ADDRESS = "localhost:30206";
@@ -57,6 +56,11 @@ public class DistributionClientConfig implements IConfiguration {
private boolean useHttpsWithDmaap;
private boolean useHttpsWithSDC;
private List<String> msgBusAddress;
+ private String httpProxyHost;
+ private int httpProxyPort;
+ private String httpsProxyHost;
+ private int httpsProxyPort;
+ private boolean useSystemProxy;
public DistributionClientConfig(IConfiguration other) {
this.asdcAddress = other.getAsdcAddress();
@@ -72,6 +76,11 @@ public class DistributionClientConfig implements IConfiguration {
this.keyStorePassword = other.getKeyStorePassword();
this.activateServerTLSAuth = other.activateServerTLSAuth();
this.isFilterInEmptyResources = other.isFilterInEmptyResources();
+ this.httpProxyHost = other.getHttpProxyHost();
+ this.httpProxyPort = other.getHttpProxyPort();
+ this.httpsProxyHost = other.getHttpsProxyHost();
+ this.httpsProxyPort = other.getHttpsProxyPort();
+ this.useSystemProxy = other.isUseSystemProxy();
}
public DistributionClientConfig() {
@@ -313,8 +322,10 @@ public class DistributionClientConfig implements IConfiguration {
@Override
public String toString() {
- return "TestConfiguration [asdcAddress=" + asdcAddress + ", user=" + user + ", password=" + password + ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout + ", relevantArtifactTypes=" + relevantArtifactTypes
- + ", consumerGroup=" + consumerGroup + ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + "]";
+ return "TestConfiguration [asdcAddress=" + asdcAddress + ", user=" + user + ", password=" + password
+ + ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout
+ + ", relevantArtifactTypes=" + relevantArtifactTypes + ", consumerGroup=" + consumerGroup
+ + ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + "]";
}
@Override
@@ -322,7 +333,6 @@ public class DistributionClientConfig implements IConfiguration {
return isFilterInEmptyResources;
}
-
public void setFilterInEmptyResources(boolean isFilterInEmptyResources) {
this.isFilterInEmptyResources = isFilterInEmptyResources;
}
@@ -332,7 +342,6 @@ public class DistributionClientConfig implements IConfiguration {
return this.useHttpsWithDmaap;
}
-
public Boolean isUseHttpsWithSDC() {
return this.useHttpsWithSDC;
}
@@ -340,4 +349,49 @@ public class DistributionClientConfig implements IConfiguration {
public void setUseHttpsWithSDC(Boolean useHttpsWithSDC) {
this.useHttpsWithSDC = useHttpsWithSDC;
}
+
+ public void setHttpProxyHost(String httpProxyHost) {
+ this.httpProxyHost = httpProxyHost;
+ }
+
+ public void setHttpProxyPort(int httpProxyPort) {
+ this.httpProxyPort = httpProxyPort;
+ }
+
+ public void setHttpsProxyHost(String httpsProxyHost) {
+ this.httpsProxyHost = httpsProxyHost;
+ }
+
+ public void setHttpsProxyPort(int httpsProxyPort) {
+ this.httpsProxyPort = httpsProxyPort;
+ }
+
+ public void setUseSystemProxy(boolean useSystemProxy) {
+ this.useSystemProxy = useSystemProxy;
+ }
+
+ @Override
+ public String getHttpProxyHost() {
+ return httpProxyHost;
+ }
+
+ @Override
+ public int getHttpProxyPort() {
+ return httpProxyPort;
+ }
+
+ @Override
+ public String getHttpsProxyHost() {
+ return httpsProxyHost;
+ }
+
+ @Override
+ public int getHttpsProxyPort() {
+ return httpsProxyPort;
+ }
+
+ @Override
+ public Boolean isUseSystemProxy() {
+ return useSystemProxy;
+ }
}
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java b/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java
index c7248eb..e3013e2 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/api/consumer/IConfiguration.java
@@ -21,19 +21,20 @@
package org.onap.sdc.api.consumer;
import java.util.List;
+
import org.onap.sdc.api.notification.INotificationData;
public interface IConfiguration {
/**
* SDC Distribution Engine address. Value can be either hostname (with or
- * without port), IP:port or FQDN (Fully Qualified Domain Name). * @return
- * SDC Distribution Engine address.
+ * without port), IP:port or FQDN (Fully Qualified Domain Name). * @return SDC
+ * Distribution Engine address.
*/
String getAsdcAddress();
/**
- * SDC Distribution Addresses from ONAP Component
- * Values need to be set from impl
+ * SDC Distribution Addresses from ONAP Component Values need to be set from
+ * impl
*/
List<String> getMsgBusAddress();
@@ -45,10 +46,9 @@ public interface IConfiguration {
String getUser();
/**
- * Return True if ssl is needed, false otherwise.
- * This param can be null, then default (HTTPS) behavior will be
- * applied. If set to false, distribution client will use HTTP when
- * connecting to SDC.
+ * Return True if ssl is needed, false otherwise. This param can be null, then
+ * default (HTTPS) behavior will be applied. If set to false, distribution
+ * client will use HTTP when connecting to SDC.
*
* @return
*/
@@ -72,8 +72,8 @@ public interface IConfiguration {
int getPollingInterval();
/**
- * Distribution Client Timeout in seconds waiting to UEB server response in
- * each fetch interval. Can Be reconfigured in runtime.
+ * Distribution Client Timeout in seconds waiting to UEB server response in each
+ * fetch interval. Can Be reconfigured in runtime.
*
* @return Distribution Client Timeout in seconds.
*/
@@ -81,16 +81,16 @@ public interface IConfiguration {
/**
* List of artifact types.<br>
- * If the service contains any of the artifacts in the list, the callback
- * will be activated. Can Be reconfigured in runtime.
+ * If the service contains any of the artifacts in the list, the callback will
+ * be activated. Can Be reconfigured in runtime.
*
* @return List of artifact types.
*/
List<String> getRelevantArtifactTypes();
/**
- * Returns the consumer group defined for this ECOMP component, if no
- * consumer group is defined return null.
+ * Returns the consumer group defined for this ECOMP component, if no consumer
+ * group is defined return null.
*
* @return Consumer group.
*/
@@ -112,9 +112,9 @@ public interface IConfiguration {
String getConsumerID();
/**
- * Return full path to Client's Key Store that contains either CA
- * certificate or the ASDC's public key (e.g /etc/keystore/asdc-client.jks)
- * file will be deployed with sdc-distribution jar.
+ * Return full path to Client's Key Store that contains either CA certificate or
+ * the ASDC's public key (e.g /etc/keystore/asdc-client.jks) file will be
+ * deployed with sdc-distribution jar.
*
* @return
*/
@@ -126,8 +126,8 @@ public interface IConfiguration {
String getKeyStorePassword();
/**
- * Sets whether SDC server TLS authentication is activated. If set to false,
- * Key Store path and password are not needed to be set.
+ * Sets whether SDC server TLS authentication is activated. If set to false, Key
+ * Store path and password are not needed to be set.
*
* @return
*/
@@ -136,31 +136,32 @@ public interface IConfiguration {
/**
* If set to true the method {@link INotificationData#getResources()} will
* return all found resources.<br>
- * That means that metadata of resources that do not contain relevant
- * artifacts types (artifacts that are defined in
- * {@link #getRelevantArtifactTypes()} will be returned.<br>
- * Setting the method to false will activate the legacy behavior, in which
- * empty resources are not part of the notification.<br>
+ * That means that metadata of resources that do not contain relevant artifacts
+ * types (artifacts that are defined in {@link #getRelevantArtifactTypes()} will
+ * be returned.<br>
+ * Setting the method to false will activate the legacy behavior, in which empty
+ * resources are not part of the notification.<br>
*
* @return
*/
boolean isFilterInEmptyResources();
/**
- * By default, Distribution Client will use HTTPS (TLS 1.2) when connecting
- * to DMAAP. This param can be null, then default (HTTPS) behavior will be
- * applied. If set to false, distribution client will use HTTP when
- * connecting to DMAAP.
+ * By default, Distribution Client will use HTTPS (TLS 1.2) when connecting to
+ * DMAAP. This param can be null, then default (HTTPS) behavior will be applied.
+ * If set to false, distribution client will use HTTP when connecting to DMAAP.
*
* @return
*/
Boolean isUseHttpsWithDmaap();
/**
- * By default, (false value) Distribution Client will trigger the regular registration
- * towards SDC (register component as consumer to the SDC-DISTR-NOTIF-TOPIC-[ENV] topic and register component as producer to the SDC-DISTR-STATUS-TOPIC-[ENV]).<br>
- * If set to true, distribution client trigger Register to SDC indicating
- * that this component request to be consumer and producer of the
+ * By default, (false value) Distribution Client will trigger the regular
+ * registration towards SDC (register component as consumer to the
+ * SDC-DISTR-NOTIF-TOPIC-[ENV] topic and register component as producer to the
+ * SDC-DISTR-STATUS-TOPIC-[ENV]).<br>
+ * If set to true, distribution client trigger Register to SDC indicating that
+ * this component request to be consumer and producer of the
* SDC-DISTR-STATUS-TOPIC-[ENV] topic.<br>
*
* @return
@@ -168,4 +169,57 @@ public interface IConfiguration {
default boolean isConsumeProduceStatusTopic() {
return false;
}
+
+ /**
+ * By default: false. If set to true, Distribution Client will use System wide
+ * available proxies from JVM arguments. If set to false, distribution client
+ * will use proxy parameters configured through properties file.
+ *
+ * @return
+ */
+ default Boolean isUseSystemProxy() {
+ return false;
+ }
+
+ /**
+ * Optional configuration parameter. If the httpProxyHost parameter is
+ * configured and {@link #isUseHttpsWithSDC()} is false then SDC Distribution
+ * Client will register the proxy configuration with the HttpClient instance
+ * using HTTP and route requests through the proxy.
+ *
+ * @return
+ */
+ String getHttpProxyHost();
+
+ /**
+ * Mandatory configuration parameter if httpProxyHost is configured. If the
+ * httpProxyHost and httpProxyPort parameters are configured and
+ * {@link #isUseHttpsWithSDC()} is false then SDC Distribution Client will
+ * register the proxy configuration with the HttpClient instance using HTTP and
+ * route requests through the proxy.
+ *
+ * @return
+ */
+ int getHttpProxyPort();
+
+ /**
+ * Optional configuration parameter. If the httpsProxyHost parameter is
+ * configured and {@link #isUseHttpsWithSDC()} is true then SDC Distribution
+ * Client will register the proxy configuration with the HttpClient instance
+ * using HTTPS and route requests through the proxy.
+ *
+ * @return
+ */
+ String getHttpsProxyHost();
+
+ /**
+ * Mandatory configuration parameter if httpsProxyHost is configured. If the
+ * httpsProxyHost and httpsProxyPort parameters are configured and
+ * {@link #isUseHttpsWithSDC()} is true then SDC Distribution Client will
+ * register the proxy configuration with the HttpClient instance using HTTPS and
+ * route requests through the proxy.
+ *
+ * @return
+ */
+ int getHttpsProxyPort();
}
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/http/HttpClientFactory.java b/sdc-distribution-client/src/main/java/org/onap/sdc/http/HttpClientFactory.java
index 47048b5..7a073a1 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/http/HttpClientFactory.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/http/HttpClientFactory.java
@@ -20,6 +20,21 @@
*/
package org.onap.sdc.http;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
@@ -31,27 +46,14 @@ import org.apache.http.ssl.SSLContextBuilder;
import org.onap.sdc.api.consumer.IConfiguration;
import org.onap.sdc.utils.Pair;
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-
public class HttpClientFactory {
- private static final int AUTHORIZATION_SCOPE_PLAIN_PORT = 80;
- private static final int AUTHORIZATION_SCOPE_PORT = 443;
- private static final KeyStore DEFAULT_INIT_KEY_STORE_VALUE = null;
- private static final String TLS = "TLSv1.2";
- static final String HTTP = "http://";
- static final String HTTPS = "https://";
- private final IConfiguration configuration;
+ private static final int AUTHORIZATION_SCOPE_PLAIN_PORT = 80;
+ private static final int AUTHORIZATION_SCOPE_PORT = 443;
+ private static final KeyStore DEFAULT_INIT_KEY_STORE_VALUE = null;
+ private static final String TLS = "TLSv1.2";
+ static final String HTTP = "http://";
+ static final String HTTPS = "https://";
+ private final IConfiguration configuration;
public HttpClientFactory(IConfiguration configuration) {
this.configuration = configuration;
@@ -69,30 +71,28 @@ public class HttpClientFactory {
}
private Pair<String, CloseableHttpClient> createHttpsClient(IConfiguration configuration) {
- return new Pair<>(
- HTTPS,
- initSSL(configuration.getUser(),
- configuration.getPassword(),
- configuration.getKeyStorePath(),
- configuration.getKeyStorePassword(),
- configuration.activateServerTLSAuth()
- )
- );
+ return new Pair<>(HTTPS,
+ initSSL(configuration.getUser(), configuration.getPassword(), configuration.getKeyStorePath(),
+ configuration.getKeyStorePassword(), configuration.activateServerTLSAuth()));
}
private Pair<String, CloseableHttpClient> createHttpClient(IConfiguration configuration) {
CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(new AuthScope("localhost", AUTHORIZATION_SCOPE_PLAIN_PORT), new UsernamePasswordCredentials(configuration.getUser(), configuration.getPassword()));
- return new Pair<>(HTTP, HttpClientBuilder.create().setDefaultCredentialsProvider(credsProvider).build());
+ credsProvider.setCredentials(new AuthScope("localhost", AUTHORIZATION_SCOPE_PLAIN_PORT),
+ new UsernamePasswordCredentials(configuration.getUser(), configuration.getPassword()));
+ return new Pair<>(HTTP, HttpClientBuilder.create().setDefaultCredentialsProvider(credsProvider)
+ .setProxy(getHttpProxyHost()).build());
}
- private CloseableHttpClient initSSL(String username, String password, String keyStorePath, String keyStorePass, boolean isSupportSSLVerification) {
+ private CloseableHttpClient initSSL(String username, String password, String keyStorePath, String keyStorePass,
+ boolean isSupportSSLVerification) {
try {
// SSLContextBuilder is not thread safe
CredentialsProvider credsProvider = new BasicCredentialsProvider();
- credsProvider.setCredentials(new AuthScope("localhost", AUTHORIZATION_SCOPE_PORT), new UsernamePasswordCredentials(username, password));
+ credsProvider.setCredentials(new AuthScope("localhost", AUTHORIZATION_SCOPE_PORT),
+ new UsernamePasswordCredentials(username, password));
SSLContext sslContext;
sslContext = SSLContext.getInstance(TLS);
TrustManagerFactory tmf = createTrustManagerFactory();
@@ -100,7 +100,8 @@ public class HttpClientFactory {
if (isSupportSSLVerification) {
if (keyStorePath != null && !keyStorePath.isEmpty()) {
- // Using null here initialises the TMF with the default trust store.
+ // Using null here initialises the TMF with the default
+ // trust store.
// Get hold of the default trust manager
X509TrustManager defaultTm = null;
@@ -144,7 +145,8 @@ public class HttpClientFactory {
try {
finalMyTm.checkServerTrusted(chain, authType);
} catch (CertificateException e) {
- // This will throw another CertificateException if this fails too.
+ // This will throw another CertificateException
+ // if this fails too.
finalDefaultTm.checkServerTrusted(chain, authType);
}
}
@@ -158,14 +160,13 @@ public class HttpClientFactory {
}
};
- tms = new TrustManager[]{customTm};
+ tms = new TrustManager[] { customTm };
}
sslContext.init(null, tms, null);
SSLContext.setDefault(sslContext);
-
} else {
SSLContextBuilder builder = new SSLContextBuilder();
@@ -176,11 +177,10 @@ public class HttpClientFactory {
}
HostnameVerifier hostnameVerifier = (hostname, session) -> hostname.equalsIgnoreCase(session.getPeerHost());
- SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[]{TLS}, null, hostnameVerifier);
- return HttpClientBuilder.create().
- setDefaultCredentialsProvider(credsProvider).
- setSSLSocketFactory(sslsf).
- build();
+ SSLConnectionSocketFactory sslsf = new SSLConnectionSocketFactory(sslContext, new String[] { TLS }, null,
+ hostnameVerifier);
+ return HttpClientBuilder.create().setDefaultCredentialsProvider(credsProvider).setProxy(getHttpsProxyHost())
+ .setSSLSocketFactory(sslsf).build();
} catch (Exception e) {
throw new HttpAsdcClientException("Failed to create https client", e);
}
@@ -192,11 +192,37 @@ public class HttpClientFactory {
return tmf;
}
- private KeyStore loadKeyStore(String keyStorePath, String keyStorePass) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
+ private KeyStore loadKeyStore(String keyStorePath, String keyStorePass)
+ throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException {
KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
try (FileInputStream keyStoreData = new FileInputStream(keyStorePath)) {
trustStore.load(keyStoreData, keyStorePass.toCharArray());
}
return trustStore;
}
+
+ private HttpHost getHttpProxyHost() {
+ HttpHost proxyHost = null;
+ if (configuration.isUseSystemProxy() && System.getProperty("http.proxyHost") != null
+ && System.getProperty("http.proxyPort") != null) {
+ proxyHost = new HttpHost(System.getProperty("http.proxyHost"),
+ Integer.valueOf(System.getProperty("http.proxyPort")));
+ } else if (configuration.getHttpProxyHost() != null && configuration.getHttpProxyPort() != 0) {
+ proxyHost = new HttpHost(configuration.getHttpProxyHost(), configuration.getHttpProxyPort());
+ }
+ return proxyHost;
+ }
+
+ private HttpHost getHttpsProxyHost() {
+ HttpHost proxyHost = null;
+ if (configuration.isUseSystemProxy() && System.getProperty("https.proxyHost") != null
+ && System.getProperty("https.proxyPort") != null) {
+ proxyHost = new HttpHost(System.getProperty("https.proxyHost"),
+ Integer.valueOf(System.getProperty("https.proxyPort")));
+ } else if (configuration.getHttpsProxyHost() != null && configuration.getHttpsProxyPort() != 0) {
+ proxyHost = new HttpHost(configuration.getHttpsProxyHost(), configuration.getHttpsProxyPort());
+ }
+ return proxyHost;
+ }
+
}
diff --git a/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java b/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java
index 1196d7a..2da9c4e 100644
--- a/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java
+++ b/sdc-distribution-client/src/main/java/org/onap/sdc/impl/Configuration.java
@@ -22,8 +22,8 @@ package org.onap.sdc.impl;
import java.util.List;
-import org.onap.sdc.utils.DistributionClientConstants;
import org.onap.sdc.api.consumer.IConfiguration;
+import org.onap.sdc.utils.DistributionClientConstants;
public class Configuration implements IConfiguration {
@@ -44,6 +44,11 @@ public class Configuration implements IConfiguration {
private Boolean useHttpsWithDmaap;
private Boolean useHttpsWithSDC;
private boolean consumeProduceStatusTopic;
+ private String httpProxyHost;
+ private int httpProxyPort;
+ private String httpsProxyHost;
+ private int httpsProxyPort;
+ private boolean useSystemProxy;
public Configuration(IConfiguration other) {
this.asdcAddress = other.getAsdcAddress();
@@ -63,6 +68,11 @@ public class Configuration implements IConfiguration {
this.filterInEmptyResources = other.isFilterInEmptyResources();
this.useHttpsWithDmaap = other.isUseHttpsWithDmaap();
this.consumeProduceStatusTopic = other.isConsumeProduceStatusTopic();
+ this.httpProxyHost = other.getHttpProxyHost();
+ this.httpProxyPort = other.getHttpProxyPort();
+ this.httpsProxyHost = other.getHttpsProxyHost();
+ this.httpsProxyPort = other.getHttpsProxyPort();
+ this.useSystemProxy = other.isUseSystemProxy();
}
@Override
@@ -130,6 +140,31 @@ public class Configuration implements IConfiguration {
return keyStorePassword;
}
+ @Override
+ public String getHttpProxyHost() {
+ return httpProxyHost;
+ }
+
+ @Override
+ public int getHttpProxyPort() {
+ return httpProxyPort;
+ }
+
+ @Override
+ public String getHttpsProxyHost() {
+ return httpsProxyHost;
+ }
+
+ @Override
+ public int getHttpsProxyPort() {
+ return httpsProxyPort;
+ }
+
+ @Override
+ public Boolean isUseSystemProxy() {
+ return useSystemProxy;
+ }
+
public void setComsumerID(String comsumerID) {
this.comsumerID = comsumerID;
}
@@ -178,6 +213,26 @@ public class Configuration implements IConfiguration {
this.activateServerTLSAuth = activateServerTLSAuth;
}
+ public void setHttpProxyHost(String httpProxyHost) {
+ this.httpProxyHost = httpProxyHost;
+ }
+
+ public void setHttpProxyPort(int httpProxyPort) {
+ this.httpProxyPort = httpProxyPort;
+ }
+
+ public void setHttpsProxyHost(String httpsProxyHost) {
+ this.httpsProxyHost = httpsProxyHost;
+ }
+
+ public void setHttpsProxyPort(int httpsProxyPort) {
+ this.httpsProxyPort = httpsProxyPort;
+ }
+
+ public void setUseSystemProxy(boolean useSystemProxy) {
+ this.useSystemProxy = useSystemProxy;
+ }
+
@Override
public boolean activateServerTLSAuth() {
return this.activateServerTLSAuth;
@@ -226,6 +281,11 @@ public class Configuration implements IConfiguration {
+ ", filterInEmptyResources=" + filterInEmptyResources
+ ", useHttpsWithDmaap=" + useHttpsWithDmaap
+ ", consumeProduceStatusTopic=" + consumeProduceStatusTopic
+ + ", useSystemProxy=" + useSystemProxy
+ + ", httpProxyHost=" + httpProxyHost
+ + ", httpProxyPort=" + httpProxyPort
+ + ", httpsProxyHost=" + httpsProxyHost
+ + ", httpsProxyPort=" + httpsProxyPort
+ "]";
//@formtter:on
}
diff --git a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java
index de74831..ca7abba 100644
--- a/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java
+++ b/sdc-distribution-client/src/test/java/org/onap/sdc/utils/TestConfiguration.java
@@ -43,6 +43,11 @@ public class TestConfiguration implements IConfiguration {
private boolean useHttpsWithDmaap;
private boolean useHttpsWithSDC;
private List<String> msgBusAddress;
+ private String httpProxyHost;
+ private int httpProxyPort;
+ private String httpsProxyHost;
+ private int httpsProxyPort;
+ private boolean useSystemProxy;
public TestConfiguration(IConfiguration other) {
this.asdcAddress = other.getAsdcAddress();
@@ -58,6 +63,11 @@ public class TestConfiguration implements IConfiguration {
this.keyStorePassword = other.getKeyStorePassword();
this.activateServerTLSAuth = other.activateServerTLSAuth();
this.isFilterInEmptyResources = other.isFilterInEmptyResources();
+ this.httpProxyHost = other.getHttpProxyHost();
+ this.httpProxyPort = other.getHttpProxyPort();
+ this.httpsProxyHost = other.getHttpsProxyHost();
+ this.httpsProxyPort = other.getHttpsProxyPort();
+ this.useSystemProxy = other.isUseSystemProxy();
}
public TestConfiguration() {
@@ -146,6 +156,31 @@ public class TestConfiguration implements IConfiguration {
return comsumerID;
}
+ @Override
+ public String getHttpProxyHost() {
+ return httpProxyHost;
+ }
+
+ @Override
+ public int getHttpProxyPort() {
+ return httpProxyPort;
+ }
+
+ @Override
+ public String getHttpsProxyHost() {
+ return httpsProxyHost;
+ }
+
+ @Override
+ public int getHttpsProxyPort() {
+ return httpsProxyPort;
+ }
+
+ @Override
+ public Boolean isUseSystemProxy() {
+ return useSystemProxy;
+ }
+
public void setComsumerID(String comsumerID) {
this.comsumerID = comsumerID;
}
@@ -190,6 +225,26 @@ public class TestConfiguration implements IConfiguration {
this.keyStorePassword = keyStorePassword;
}
+ public void setHttpProxyHost(String httpProxyHost) {
+ this.httpProxyHost = httpProxyHost;
+ }
+
+ public void setHttpProxyPort(int httpProxyPort) {
+ this.httpProxyPort = httpProxyPort;
+ }
+
+ public void setHttpsProxyHost(String httpsProxyHost) {
+ this.httpsProxyHost = httpsProxyHost;
+ }
+
+ public void setHttpsProxyPort(int httpsProxyPort) {
+ this.httpsProxyPort = httpsProxyPort;
+ }
+
+ public void setUseSystemProxy(boolean useSystemProxy) {
+ this.useSystemProxy = useSystemProxy;
+ }
+
@Override
public int hashCode() {
final int prime = 31;
@@ -280,8 +335,10 @@ public class TestConfiguration implements IConfiguration {
@Override
public String toString() {
- return "TestConfiguration [asdcAddress=" + asdcAddress + ", user=" + user + ", password=" + password + ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout + ", relevantArtifactTypes=" + relevantArtifactTypes
- + ", consumerGroup=" + consumerGroup + ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + "]";
+ return "TestConfiguration [asdcAddress=" + asdcAddress + ", user=" + user + ", password=" + password
+ + ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout
+ + ", relevantArtifactTypes=" + relevantArtifactTypes + ", consumerGroup=" + consumerGroup
+ + ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + "]";
}
@Override
@@ -289,7 +346,6 @@ public class TestConfiguration implements IConfiguration {
return isFilterInEmptyResources;
}
-
public void setFilterInEmptyResources(boolean isFilterInEmptyResources) {
this.isFilterInEmptyResources = isFilterInEmptyResources;
}