From 3db195c6267ee834007b961ca7ab4ba96377200f Mon Sep 17 00:00:00 2001 From: Jorge Hernandez Date: Sat, 28 Jul 2018 22:00:06 -0500 Subject: support ueb/dmaap https related configuration Change-Id: Ide2e3524cbbf0a8caf36ad48c003b7500482ad4a Issue-ID: POLICY-941 Signed-off-by: Jorge Hernandez --- .../event/comm/bus/internal/InlineDmaapTopicSink.java | 2 +- .../endpoints/event/comm/bus/internal/InlineUebTopicSink.java | 3 ++- .../event/comm/bus/internal/impl/CambriaPublisherWrapper.java | 11 ++++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'policy-endpoints/src/main/java/org') diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java index 2ad8bb34..c630a165 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java @@ -104,7 +104,7 @@ public class InlineDmaapTopicSink extends InlineBusTopicSink implements DmaapTop public void init() { if (allNullOrEmpty(this.environment, this.aftEnvironment, this.latitude, this.longitude, this.partner)) { this.publisher = new CambriaPublisherWrapper(this.servers, this.topic, this.apiKey, this.apiSecret, - this.userName, this.password, this.useHttps); + this.userName, this.password, this.useHttps, this.allowSelfSignedCerts); } else { this.publisher = new DmaapDmePublisherWrapper(this.servers, this.topic, this.userName, this.password, this.environment, this.aftEnvironment, this.partner, this.latitude, this.longitude, diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java index 24cf6073..34dd4e74 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java @@ -64,7 +64,8 @@ public class InlineUebTopicSink extends InlineBusTopicSink implements UebTopicSi public void init() { this.publisher = - new CambriaPublisherWrapper(this.servers, this.topic, this.apiKey, this.apiSecret, this.useHttps); + new CambriaPublisherWrapper(this.servers, this.topic, this.apiKey, this.apiSecret, + null, null, this.useHttps, this.allowSelfSignedCerts); logger.info("{}: UEB SINK created", this); } diff --git a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/impl/CambriaPublisherWrapper.java b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/impl/CambriaPublisherWrapper.java index ab5868ab..7902d4be 100644 --- a/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/impl/CambriaPublisherWrapper.java +++ b/policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/impl/CambriaPublisherWrapper.java @@ -20,6 +20,7 @@ package org.onap.policy.common.endpoints.event.comm.bus.internal.impl; +import com.att.nsa.apiClient.http.HttpClient.ConnectionType; import com.att.nsa.cambria.client.CambriaBatchingPublisher; import com.att.nsa.cambria.client.CambriaClientBuilders; import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder; @@ -48,11 +49,11 @@ public class CambriaPublisherWrapper implements BusPublisher { public CambriaPublisherWrapper(List servers, String topic, String apiKey, String apiSecret, boolean useHttps) { - this(servers, topic, apiKey, apiSecret, null, null, useHttps); + this(servers, topic, apiKey, apiSecret, null, null, useHttps, false); } public CambriaPublisherWrapper(List servers, String topic, String apiKey, String apiSecret, String username, - String password, boolean useHttps) { + String password, boolean useHttps, boolean selfSignedCerts) { PublisherBuilder builder = new CambriaClientBuilders.PublisherBuilder(); @@ -62,7 +63,11 @@ public class CambriaPublisherWrapper implements BusPublisher { builder.withSocketTimeout(30000); if (useHttps) { - builder.usingHttps(); + if (selfSignedCerts) { + builder.withConnectionType(ConnectionType.HTTPS_NO_VALIDATION); + } else { + builder.withConnectionType(ConnectionType.HTTPS); + } } -- cgit 1.2.3-korg