support ueb/dmaap https related configuration 35/57935/1
authorJorge Hernandez <jh1730@att.com>
Sun, 29 Jul 2018 03:00:06 +0000 (22:00 -0500)
committerJorge Hernandez <jh1730@att.com>
Sun, 29 Jul 2018 03:03:04 +0000 (22:03 -0500)
Change-Id: Ide2e3524cbbf0a8caf36ad48c003b7500482ad4a
Issue-ID: POLICY-941
Signed-off-by: Jorge Hernandez <jh1730@att.com>
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineDmaapTopicSink.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/InlineUebTopicSink.java
policy-endpoints/src/main/java/org/onap/policy/common/endpoints/event/comm/bus/internal/impl/CambriaPublisherWrapper.java

index 2ad8bb3..c630a16 100644 (file)
@@ -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,
index 24cf607..34dd4e7 100644 (file)
@@ -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);
     }
 
index ab5868a..7902d4b 100644 (file)
@@ -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<String> 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<String> 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);
+            }
         }