summaryrefslogtreecommitdiffstats
path: root/sdnr/wt/mountpoint-registrar/provider
diff options
context:
space:
mode:
Diffstat (limited to 'sdnr/wt/mountpoint-registrar/provider')
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java295
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java28
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java32
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java6
-rw-r--r--sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java6
5 files changed, 222 insertions, 145 deletions
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java
index 3503aed8c..f8ee7a48f 100644
--- a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/DMaaPVESMsgConsumerMain.java
@@ -28,147 +28,158 @@ import org.slf4j.LoggerFactory;
public class DMaaPVESMsgConsumerMain implements Runnable {
- private static final Logger LOG = LoggerFactory.getLogger(DMaaPVESMsgConsumerMain.class);
- private static final String _PNFREG_CLASS =
- "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer";
- private static final String _FAULT_CLASS =
- "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer";
- private static final String _PNFREG_DOMAIN = "pnfRegistration";
- private static final String _FAULT_DOMAIN = "fault";
-
- boolean threadsRunning = false;
- List<DMaaPVESMsgConsumer> consumers = new LinkedList<>();
- private PNFRegistrationConfig pnfRegistrationConfig;
- private FaultConfig faultConfig;
- private GeneralConfig generalConfig;
-
- public DMaaPVESMsgConsumerMain(Map<String, Configuration> configMap, GeneralConfig generalConfig) {
- this.generalConfig = generalConfig;
- configMap.forEach((k, v) -> initialize(k, v));
- }
-
- public void initialize(String domain, Configuration domainConfig) {
- LOG.debug("In initialize method : Domain = {} and domainConfig = {}", domain, domainConfig);
- String consumerClass = null;
- Properties consumerProperties = new Properties();
- if (domain.equalsIgnoreCase(_PNFREG_DOMAIN)) {
- this.pnfRegistrationConfig = (PNFRegistrationConfig) domainConfig;
-
- consumerClass = _PNFREG_CLASS;
- LOG.debug("Consumer class = {}",consumerClass);
-
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TRANSPORTTYPE,
- pnfRegistrationConfig.getTransportType());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_HOST_PORT,
- pnfRegistrationConfig.getHostPort());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CONTENTTYPE,
- pnfRegistrationConfig.getContenttype());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_GROUP,
- pnfRegistrationConfig.getConsumerGroup());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_ID,
- pnfRegistrationConfig.getConsumerId());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TOPIC, pnfRegistrationConfig.getTopic());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TIMEOUT,
- pnfRegistrationConfig.getTimeout());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_LIMIT, pnfRegistrationConfig.getLimit());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_FETCHPAUSE,
- pnfRegistrationConfig.getFetchPause());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_PROTOCOL,
- pnfRegistrationConfig.getProtocol());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_USERNAME,
- pnfRegistrationConfig.getUsername());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_PASSWORD,
- pnfRegistrationConfig.getPassword());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT,
- pnfRegistrationConfig.getClientReadTimeout());
- consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
- pnfRegistrationConfig.getClientConnectTimeout());
- threadsRunning = createConsumer(_PNFREG_DOMAIN, consumerProperties);
- } else if (domain.equalsIgnoreCase(_FAULT_DOMAIN)) {
- this.faultConfig = (FaultConfig) domainConfig;
- consumerClass = _FAULT_CLASS;
- LOG.debug("Consumer class = {}", consumerClass);
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TRANSPORTTYPE, faultConfig.getTransportType());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_HOST_PORT, faultConfig.getHostPort());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CONTENTTYPE, faultConfig.getContenttype());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_GROUP, faultConfig.getConsumerGroup());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_ID, faultConfig.getConsumerId());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TOPIC, faultConfig.getTopic());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TIMEOUT, faultConfig.getTimeout());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_LIMIT, faultConfig.getLimit());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_FETCHPAUSE, faultConfig.getFetchPause());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_PROTOCOL, faultConfig.getProtocol());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_USERNAME, faultConfig.getUsername());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_PASSWORD, faultConfig.getPassword());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT,
- faultConfig.getClientReadTimeout());
- consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
- faultConfig.getClientConnectTimeout());
- threadsRunning = createConsumer(_FAULT_DOMAIN, consumerProperties);
- }
- }
-
- private boolean updateThreadState(List<DMaaPVESMsgConsumer> consumers) {
- boolean threadsRunning = false;
- for (DMaaPVESMsgConsumer consumer : consumers) {
- if (consumer.isRunning()) {
- threadsRunning = true;
- }
- }
- return threadsRunning;
- }
-
- public boolean createConsumer(String consumerType, Properties properties) {
- DMaaPVESMsgConsumerImpl consumer = null;
-
- if (consumerType.equalsIgnoreCase(_PNFREG_DOMAIN))
- consumer = new DMaaPPNFRegVESMsgConsumer(generalConfig);
- else if (consumerType.equalsIgnoreCase(_FAULT_DOMAIN))
- consumer = new DMaaPFaultVESMsgConsumer(generalConfig);
-
- handleConsumer(consumer, properties, consumers);
- return !consumers.isEmpty();
- }
-
- private boolean handleConsumer(DMaaPVESMsgConsumer consumer, Properties properties,
- List<DMaaPVESMsgConsumer> consumers) {
- if (consumer != null) {
- consumer.init(properties);
-
- if (consumer.isReady()) {
- Thread consumerThread = new Thread(consumer);
- consumerThread.start();
- consumers.add(consumer);
-
- LOG.info("Started consumer thread ({} : {})", consumer.getClass().getSimpleName(), properties);
- return true;
- } else {
- LOG.debug("Consumer {} is not ready", consumer.getClass().getSimpleName());
- }
- }
- return false;
- }
-
- @Override
- public void run() {
- while (threadsRunning) {
- threadsRunning = updateThreadState(consumers);
- if (!threadsRunning) {
- break;
- }
-
- try {
- Thread.sleep(10000);
- } catch (InterruptedException e) {
- LOG.error(e.getLocalizedMessage(), e);
- }
- }
-
- LOG.info("No listener threads running - exiting");
- }
-
- public List<DMaaPVESMsgConsumer> getConsumers() {
- return consumers;
- }
+ private static final Logger LOG = LoggerFactory.getLogger(DMaaPVESMsgConsumerMain.class);
+ private static final String _PNFREG_CLASS = "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPPNFRegVESMsgConsumer";
+ private static final String _FAULT_CLASS = "org.onap.ccsdk.features.sdnr.wt.mountpointregistrar.impl.DMaaPFaultVESMsgConsumer";
+ private static final String _PNFREG_DOMAIN = "pnfRegistration";
+ private static final String _FAULT_DOMAIN = "fault";
+
+ boolean threadsRunning = false;
+ List<DMaaPVESMsgConsumer> consumers = new LinkedList<>();
+ private PNFRegistrationConfig pnfRegistrationConfig;
+ private FaultConfig faultConfig;
+ private GeneralConfig generalConfig;
+
+ public DMaaPVESMsgConsumerMain(Map<String, Configuration> configMap, GeneralConfig generalConfig) {
+ this.generalConfig = generalConfig;
+ configMap.forEach((k, v) -> initialize(k, v));
+ }
+
+ public void initialize(String domain, Configuration domainConfig) {
+ LOG.debug("In initialize method : Domain = {} and domainConfig = {}", domain, domainConfig);
+ String consumerClass = null;
+ Properties consumerProperties = new Properties();
+ if (domain.equalsIgnoreCase(_PNFREG_DOMAIN)) {
+ this.pnfRegistrationConfig = (PNFRegistrationConfig) domainConfig;
+
+ consumerClass = _PNFREG_CLASS;
+ LOG.debug("Consumer class = {}", consumerClass);
+
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TRANSPORTTYPE,
+ pnfRegistrationConfig.getTransportType());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_HOST_PORT,
+ pnfRegistrationConfig.getHostPort());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CONTENTTYPE,
+ pnfRegistrationConfig.getContenttype());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_GROUP,
+ pnfRegistrationConfig.getConsumerGroup());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_ID,
+ pnfRegistrationConfig.getConsumerId());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TOPIC, pnfRegistrationConfig.getTopic());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_TIMEOUT,
+ pnfRegistrationConfig.getTimeout());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_LIMIT, pnfRegistrationConfig.getLimit());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_FETCHPAUSE,
+ pnfRegistrationConfig.getFetchPause());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_PROTOCOL,
+ pnfRegistrationConfig.getProtocol());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_USERNAME,
+ pnfRegistrationConfig.getUsername());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_PASSWORD,
+ pnfRegistrationConfig.getPassword());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT,
+ pnfRegistrationConfig.getClientReadTimeout());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
+ pnfRegistrationConfig.getClientConnectTimeout());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_URI,
+ pnfRegistrationConfig.getHTTPProxyURI());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER,
+ pnfRegistrationConfig.getHTTPProxyUsername());
+ consumerProperties.put(PNFRegistrationConfig.PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD,
+ pnfRegistrationConfig.getHTTPProxyPassword());
+
+ threadsRunning = createConsumer(_PNFREG_DOMAIN, consumerProperties);
+ } else if (domain.equalsIgnoreCase(_FAULT_DOMAIN)) {
+ this.faultConfig = (FaultConfig) domainConfig;
+ consumerClass = _FAULT_CLASS;
+ LOG.debug("Consumer class = {}", consumerClass);
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TRANSPORTTYPE, faultConfig.getTransportType());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_HOST_PORT, faultConfig.getHostPort());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CONTENTTYPE, faultConfig.getContenttype());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_GROUP, faultConfig.getConsumerGroup());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_ID, faultConfig.getConsumerId());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TOPIC, faultConfig.getTopic());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_TIMEOUT, faultConfig.getTimeout());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_LIMIT, faultConfig.getLimit());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_FETCHPAUSE, faultConfig.getFetchPause());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_PROTOCOL, faultConfig.getProtocol());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_USERNAME, faultConfig.getUsername());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_PASSWORD, faultConfig.getPassword());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT,
+ faultConfig.getClientReadTimeout());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
+ faultConfig.getClientConnectTimeout());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_URI,
+ faultConfig.getHTTPProxyURI());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER,
+ faultConfig.getHTTPProxyUsername());
+ consumerProperties.put(FaultConfig.PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD,
+ faultConfig.getHTTPProxyPassword());
+ threadsRunning = createConsumer(_FAULT_DOMAIN, consumerProperties);
+ }
+ }
+
+ private boolean updateThreadState(List<DMaaPVESMsgConsumer> consumers) {
+ boolean threadsRunning = false;
+ for (DMaaPVESMsgConsumer consumer : consumers) {
+ if (consumer.isRunning()) {
+ threadsRunning = true;
+ }
+ }
+ return threadsRunning;
+ }
+
+ public boolean createConsumer(String consumerType, Properties properties) {
+ DMaaPVESMsgConsumerImpl consumer = null;
+
+ if (consumerType.equalsIgnoreCase(_PNFREG_DOMAIN))
+ consumer = new DMaaPPNFRegVESMsgConsumer(generalConfig);
+ else if (consumerType.equalsIgnoreCase(_FAULT_DOMAIN))
+ consumer = new DMaaPFaultVESMsgConsumer(generalConfig);
+
+ handleConsumer(consumer, properties, consumers);
+ return !consumers.isEmpty();
+ }
+
+ private boolean handleConsumer(DMaaPVESMsgConsumer consumer, Properties properties,
+ List<DMaaPVESMsgConsumer> consumers) {
+ if (consumer != null) {
+ consumer.init(properties);
+
+ if (consumer.isReady()) {
+ Thread consumerThread = new Thread(consumer);
+ consumerThread.start();
+ consumers.add(consumer);
+
+ LOG.info("Started consumer thread ({} : {})", consumer.getClass().getSimpleName(), properties);
+ return true;
+ } else {
+ LOG.debug("Consumer {} is not ready", consumer.getClass().getSimpleName());
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void run() {
+ while (threadsRunning) {
+ threadsRunning = updateThreadState(consumers);
+ if (!threadsRunning) {
+ break;
+ }
+
+ try {
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ LOG.error(e.getLocalizedMessage(), e);
+ }
+ }
+
+ LOG.info("No listener threads running - exiting");
+ }
+
+ public List<DMaaPVESMsgConsumer> getConsumers() {
+ return consumers;
+ }
}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java
index dfdb1c00b..ddf5c5403 100644
--- a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/FaultConfig.java
@@ -65,6 +65,15 @@ public class FaultConfig implements Configuration {
public static final String PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT = "jersey.config.client.connectTimeout";
private static final String DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT = "25000";
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER = "jersey.config.client.proxy.username";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER = "${HTTP_PROXY_USERNAME}";
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD = "jersey.config.client.proxy.password";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD = "${HTTP_PROXY_PASSWORD}";
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_URI = "jersey.config.client.proxy.uri";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_URI = "${HTTP_PROXY_URI}";
+
private final ConfigurationFileRepresentation configuration;
public FaultConfig(ConfigurationFileRepresentation configuration) {
@@ -108,6 +117,12 @@ public class FaultConfig implements Configuration {
DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT);
configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER,
+ DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD,
+ DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_URI,
+ DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_URI);
}
@@ -167,5 +182,16 @@ public class FaultConfig implements Configuration {
return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT);
}
-
+ public String getHTTPProxyURI() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_URI);
+ }
+
+ public String getHTTPProxyUsername() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER);
+ }
+
+ public String getHTTPProxyPassword() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD);
+ }
+
}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java
index 636df4104..2a934b79f 100644
--- a/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java
+++ b/sdnr/wt/mountpoint-registrar/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/impl/PNFRegistrationConfig.java
@@ -62,10 +62,19 @@ public class PNFRegistrationConfig implements Configuration {
public static final String PROPERTY_KEY_CONSUMER_CLIENT_READTIMEOUT = "jersey.config.client.readTimeout";
private static final String DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT = "25000";
-
+
public static final String PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT = "jersey.config.client.connectTimeout";
private static final String DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT = "25000";
-
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER = "jersey.config.client.proxy.username";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER = "${HTTP_PROXY_USERNAME}";
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD = "jersey.config.client.proxy.password";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD = "${HTTP_PROXY_PASSWORD}";
+
+ public static final String PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_URI = "jersey.config.client.proxy.uri";
+ private static final String DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_URI = "${HTTP_PROXY_URI}";
+
private final ConfigurationFileRepresentation configuration;
public PNFRegistrationConfig(ConfigurationFileRepresentation configuration) {
@@ -109,6 +118,12 @@ public class PNFRegistrationConfig implements Configuration {
DEFAULT_VALUE_CONSUMER_CLIENT_READTIMEOUT);
configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT,
DEFAULT_VALUE_CONSUMER_CLIENT_CONNECTTIMEOUT);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER,
+ DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD,
+ DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD);
+ configuration.setPropertyIfNotAvailable(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_URI,
+ DEFAULT_VALUE_CONSUMER_CLIENT_HTTPPROXY_URI);
}
public String getHostPort() {
@@ -166,4 +181,17 @@ public class PNFRegistrationConfig implements Configuration {
public String getClientConnectTimeout() {
return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_CONNECTTIMEOUT);
}
+
+ public String getHTTPProxyURI() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_URI);
+ }
+
+ public String getHTTPProxyUsername() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_USER);
+ }
+
+ public String getHTTPProxyPassword() {
+ return configuration.getProperty(SECTION_MARKER, PROPERTY_KEY_CONSUMER_CLIENT_HTTPPROXY_AUTH_PASSWORD);
+ }
+
}
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java
index 87a70d795..d3f4a13d6 100644
--- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/PNFRegistrationConfigTest.java
@@ -46,6 +46,9 @@ public class PNFRegistrationConfigTest {
+ "fetchPause=5000\n"
+ "jersey.config.client.readTimeout=25000\n"
+ "jersey.config.client.connectTimeout=25000\n"
+ + "jersey.config.client.proxy.uri=http://http-proxy\n"
+ + "jersey.config.client.proxy.username=proxy-user\n"
+ + "jersey.config.client.proxy.password=proxy-password\n"
+ "";
// @formatter:on
private ConfigurationFileRepresentation cfg;
@@ -72,6 +75,9 @@ public class PNFRegistrationConfigTest {
assertEquals("password", pnfCfg.getPassword());
assertEquals("25000", pnfCfg.getClientReadTimeout());
assertEquals("25000", pnfCfg.getClientConnectTimeout());
+ assertEquals("http://http-proxy", pnfCfg.getHTTPProxyURI());
+ assertEquals("proxy-user", pnfCfg.getHTTPProxyUsername());
+ assertEquals("proxy-password", pnfCfg.getHTTPProxyPassword());
} catch (IOException e) {
e.printStackTrace();
diff --git a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java
index f44bebcee..422d24935 100644
--- a/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java
+++ b/sdnr/wt/mountpoint-registrar/provider/src/test/java/org/onap/ccsdk/features/sdnr/wt/mountpointregistrar/test/TestFaultConfig.java
@@ -46,6 +46,9 @@ public class TestFaultConfig {
+ "fetchPause=5000\n"
+ "jersey.config.client.readTimeout=25000\n"
+ "jersey.config.client.connectTimeout=25000\n"
+ + "jersey.config.client.proxy.uri=http://http-proxy\n"
+ + "jersey.config.client.proxy.username=proxy-user\n"
+ + "jersey.config.client.proxy.password=proxy-password\n"
+ "\n"
+ "";
// @formatter:on
@@ -73,6 +76,9 @@ public class TestFaultConfig {
assertEquals("password", faultCfg.getPassword());
assertEquals("25000", faultCfg.getClientReadTimeout());
assertEquals("25000", faultCfg.getClientConnectTimeout());
+ assertEquals("http://http-proxy", faultCfg.getHTTPProxyURI());
+ assertEquals("proxy-user", faultCfg.getHTTPProxyUsername());
+ assertEquals("proxy-password", faultCfg.getHTTPProxyPassword());
} catch (IOException e) {
e.printStackTrace();