diff options
author | tangpeng <tang.peng5@zte.com.cn> | 2019-03-30 07:58:02 +0000 |
---|---|---|
committer | tangpeng <tang.peng5@zte.com.cn> | 2019-03-30 07:58:02 +0000 |
commit | 3f438510b3aae2372b33d4d976cd10482a07492a (patch) | |
tree | 9fa778a3985723598148182b69010b74a4c4d199 /engine-d/src/main/java/org/onap | |
parent | 7ca609c6fecdb3e6996f12572aedde702bf375c9 (diff) |
HTTP/S Modifications
Change-Id: Icabaf996d23297d0d5f16601645665a128616105
Issue-ID: HOLMES-203
Signed-off-by: tangpeng <tang.peng5@zte.com.cn>
Diffstat (limited to 'engine-d/src/main/java/org/onap')
-rw-r--r-- | engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java | 2 | ||||
-rw-r--r-- | engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java | 24 |
2 files changed, 14 insertions, 12 deletions
diff --git a/engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java b/engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java index 160fc38..245647d 100644 --- a/engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java +++ b/engine-d/src/main/java/org/onap/holmes/dsa/dmaappolling/Subscriber.java @@ -87,7 +87,7 @@ public class Subscriber { CloseableHttpClient closeableHttpClient = null; HttpGet httpGet = new HttpGet(url + "/" + consumerGroup + "/" + consumer + "?timeout=" + period); try { - closeableHttpClient = HttpsUtils.getHttpClient(timeout); + closeableHttpClient = HttpsUtils.getConditionalHttpsClient(timeout); HttpResponse httpResponse = HttpsUtils .get(httpGet, new HashMap<>(), closeableHttpClient); response = HttpsUtils.extractResponseEntity(httpResponse); diff --git a/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java b/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java index c045050..9417242 100644 --- a/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java +++ b/engine-d/src/main/java/org/onap/holmes/engine/EngineDActiveApp.java @@ -16,19 +16,11 @@ package org.onap.holmes.engine; import io.dropwizard.setup.Environment; - -import java.util.EnumSet; -import java.util.HashSet; -import java.util.Set; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import javax.servlet.DispatcherType; - import lombok.extern.slf4j.Slf4j; import org.onap.holmes.common.config.MicroServiceConfig; import org.onap.holmes.common.dropwizard.ioc.bundle.IOCApplication; import org.onap.holmes.common.exception.CorrelationException; +import org.onap.holmes.common.utils.HttpsUtils; import org.onap.holmes.common.utils.MSBRegisterUtil; import org.onap.holmes.common.utils.transactionid.TransactionIdFilter; import org.onap.holmes.engine.dcae.DcaeConfigurationPolling; @@ -36,6 +28,14 @@ import org.onap.holmes.engine.resources.EngineResources; import org.onap.msb.sdk.discovery.entity.MicroServiceInfo; import org.onap.msb.sdk.discovery.entity.Node; +import javax.servlet.DispatcherType; +import java.util.EnumSet; +import java.util.HashSet; +import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + @Slf4j public class EngineDActiveApp extends IOCApplication<EngineDAppConfig> { @@ -66,6 +66,8 @@ public class EngineDActiveApp extends IOCApplication<EngineDAppConfig> { } private MicroServiceInfo createMicroServiceInfo() { + String msbAddrTemplate = (HttpsUtils.isHttpsEnabled() ? "https" : "http") + + "://%s:%s/api/holmes-engine-mgmt/v1/healthcheck"; String[] serviceAddrInfo = MicroServiceConfig.getMicroServiceIpAndPort(); MicroServiceInfo msinfo = new MicroServiceInfo(); msinfo.setServiceName("holmes-engine-mgmt"); @@ -73,13 +75,13 @@ public class EngineDActiveApp extends IOCApplication<EngineDAppConfig> { msinfo.setUrl("/api/holmes-engine-mgmt/v1"); msinfo.setProtocol("REST"); msinfo.setVisualRange("0|1"); - msinfo.setEnable_ssl(true); + msinfo.setEnable_ssl(HttpsUtils.isHttpsEnabled()); Set<Node> nodes = new HashSet<>(); Node node = new Node(); node.setIp(serviceAddrInfo[0]); node.setPort("9102"); node.setCheckType("HTTP"); - node.setCheckUrl(String.format("https://%s:%s/api/holmes-engine-mgmt/v1/healthcheck", serviceAddrInfo[0], "9102")); + node.setCheckUrl(String.format(msbAddrTemplate, serviceAddrInfo[0], "9102")); node.setCheckTimeOut("60s"); node.setCheckInterval("60s"); nodes.add(node); |