aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pom.xml2
-rw-r--r--sdc-distribution-ci/pom.xml2
-rw-r--r--sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java5
-rw-r--r--sdc-distribution-client/pom.xml2
-rw-r--r--sdc-distribution-client/src/main/java/org/openecomp/sdc/api/consumer/IConfiguration.java8
-rw-r--r--sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/Configuration.java33
-rw-r--r--sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/DistributionClientImpl.java18
-rw-r--r--sdc-distribution-client/src/test/java/org/openecomp/sdc/utils/TestConfiguration.java6
8 files changed, 58 insertions, 18 deletions
diff --git a/pom.xml b/pom.xml
index 0e7019a..24f4e87 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>1.1.31-SNAPSHOT</version>
+ <version>1.1.32-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
diff --git a/sdc-distribution-ci/pom.xml b/sdc-distribution-ci/pom.xml
index 74c4b9a..e4c2152 100644
--- a/sdc-distribution-ci/pom.xml
+++ b/sdc-distribution-ci/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>1.1.31-SNAPSHOT</version>
+ <version>1.1.32-SNAPSHOT</version>
</parent>
<artifactId>sdc-distribution-ci</artifactId>
diff --git a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java
index 115bfab..60bb7d4 100644
--- a/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java
+++ b/sdc-distribution-ci/src/main/java/org/openecomp/test/SimpleConfiguration.java
@@ -184,4 +184,9 @@ public class SimpleConfiguration implements IConfiguration{
return false;
}
+ @Override
+ public Boolean isUseHttpsWithDmaap() {
+ return true;
+ }
+
}
diff --git a/sdc-distribution-client/pom.xml b/sdc-distribution-client/pom.xml
index 958e9a6..39dbbfc 100644
--- a/sdc-distribution-client/pom.xml
+++ b/sdc-distribution-client/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.openecomp.sdc.sdc-distribution-client</groupId>
<artifactId>sdc-main-distribution-client</artifactId>
- <version>1.1.31-SNAPSHOT</version>
+ <version>1.1.32-SNAPSHOT</version>
</parent>
<artifactId>sdc-distribution-client</artifactId>
diff --git a/sdc-distribution-client/src/main/java/org/openecomp/sdc/api/consumer/IConfiguration.java b/sdc-distribution-client/src/main/java/org/openecomp/sdc/api/consumer/IConfiguration.java
index 77f09e6..19f94df 100644
--- a/sdc-distribution-client/src/main/java/org/openecomp/sdc/api/consumer/IConfiguration.java
+++ b/sdc-distribution-client/src/main/java/org/openecomp/sdc/api/consumer/IConfiguration.java
@@ -108,6 +108,14 @@ public interface IConfiguration {
* @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.
+ * @return
+ */
+ Boolean isUseHttpsWithDmaap();
}
diff --git a/sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/Configuration.java b/sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/Configuration.java
index fde5c57..dff8a3b 100644
--- a/sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/Configuration.java
+++ b/sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/Configuration.java
@@ -41,6 +41,7 @@ public class Configuration implements IConfiguration{
private String keyStorePassword;
private boolean activateServerTLSAuth;
private boolean filterInEmptyResources;
+ private Boolean useHttpsWithDmaap;
public Configuration(IConfiguration other) {
this.asdcAddress = other.getAsdcAddress();
@@ -56,6 +57,7 @@ public class Configuration implements IConfiguration{
this.keyStorePassword = other.getKeyStorePassword();
this.activateServerTLSAuth = other.activateServerTLSAuth();
this.filterInEmptyResources = other.isFilterInEmptyResources();
+ this.useHttpsWithDmaap = other.isUseHttpsWithDmaap();
}
@Override
@@ -161,17 +163,7 @@ public class Configuration implements IConfiguration{
this.keyStorePassword = keyStorePassword;
}
- @Override
- public String toString() {
- return "Configuration [asdcAddress=" + asdcAddress + ", user=" + user
- + ", password=" + password + ", pollingInterval="
- + pollingInterval + ", pollingTimeout=" + pollingTimeout
- + ", relevantArtifactTypes=" + relevantArtifactTypes
- + ", consumerGroup=" + consumerGroup + ", environmentName="
- + environmentName + ", comsumerID=" + comsumerID + "]";
- }
-
-
+
public void setactivateServerTLSAuth(boolean activateServerTLSAuth) {
this.activateServerTLSAuth = activateServerTLSAuth;
}
@@ -186,4 +178,23 @@ public class Configuration implements IConfiguration{
return this.filterInEmptyResources;
}
+ @Override
+ public Boolean isUseHttpsWithDmaap() {
+ return this.useHttpsWithDmaap;
+ }
+
+ public void setUseHttpsWithDmaap(boolean useHttpsWithDmaap){
+ this.useHttpsWithDmaap = useHttpsWithDmaap;
+ }
+
+ @Override
+ public String toString() {
+ return "Configuration [asdcAddress=" + asdcAddress + ", user=" + user + ", password=" + password
+ + ", pollingInterval=" + pollingInterval + ", pollingTimeout=" + pollingTimeout
+ + ", relevantArtifactTypes=" + relevantArtifactTypes + ", consumerGroup=" + consumerGroup
+ + ", environmentName=" + environmentName + ", comsumerID=" + comsumerID + ", keyStorePath="
+ + keyStorePath + ", keyStorePassword=" + keyStorePassword + ", activateServerTLSAuth="
+ + activateServerTLSAuth + ", filterInEmptyResources=" + filterInEmptyResources + ", useHttpsWithDmaap="
+ + useHttpsWithDmaap + "]";
+ }
}
diff --git a/sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/DistributionClientImpl.java b/sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/DistributionClientImpl.java
index d051458..1543256 100644
--- a/sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/DistributionClientImpl.java
+++ b/sdc-distribution-client/src/main/java/org/openecomp/sdc/impl/DistributionClientImpl.java
@@ -54,9 +54,10 @@ import com.att.nsa.apiClient.credentials.ApiCredential;
import com.att.nsa.apiClient.http.HttpException;
import com.att.nsa.cambria.client.CambriaBatchingPublisher;
import com.att.nsa.cambria.client.CambriaClient.CambriaApiException;
-import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder;
+import com.att.nsa.cambria.client.CambriaClientBuilders.AbstractAuthenticatedManagerBuilder;
import com.att.nsa.cambria.client.CambriaClientBuilders.ConsumerBuilder;
import com.att.nsa.cambria.client.CambriaClientBuilders.IdentityManagerBuilder;
+import com.att.nsa.cambria.client.CambriaClientBuilders.PublisherBuilder;
import com.att.nsa.cambria.client.CambriaConsumer;
import com.att.nsa.cambria.client.CambriaIdentityManager;
import com.att.nsa.cambria.client.CambriaPublisher.message;
@@ -146,7 +147,7 @@ public class DistributionClientImpl implements IDistributionClient {
}
if (errorWrapper.isEmpty()) {
try {
- cambriaConsumer = new ConsumerBuilder().authenticatedBy(credential.getApiKey(), credential.getApiSecret()).knownAs(configuration.getConsumerGroup(), configuration.getConsumerID()).onTopic(notificationTopic).usingHttps().usingHosts(brokerServers)
+ cambriaConsumer = new ConsumerBuilder().authenticatedBy(credential.getApiKey(), credential.getApiSecret()).knownAs(configuration.getConsumerGroup(), configuration.getConsumerID()).onTopic(notificationTopic).usingHttps(configuration.isUseHttpsWithDmaap()).usingHosts(brokerServers)
.withSocketTimeout(configuration.getPollingTimeout() * 1000).build();
} catch (MalformedURLException | GeneralSecurityException e) {
handleCambriaInitFailure(errorWrapper, e);
@@ -393,7 +394,7 @@ public class DistributionClientImpl implements IDistributionClient {
private Either<CambriaBatchingPublisher, IDistributionClientResult> getCambriaPublisher() {
CambriaBatchingPublisher cambriaPublisher = null;
try {
- cambriaPublisher = new PublisherBuilder().onTopic(statusTopic).usingHttps().usingHosts(brokerServers).build();
+ cambriaPublisher = new PublisherBuilder().onTopic(statusTopic).usingHttps(configuration.isUseHttpsWithDmaap()).usingHosts(brokerServers).build();
cambriaPublisher.setApiCredentials(credential.getApiKey(), credential.getApiSecret());
} catch (MalformedURLException | GeneralSecurityException e) {
Wrapper<IDistributionClientResult> errorWrapper = new Wrapper<>();
@@ -477,6 +478,11 @@ public class DistributionClientImpl implements IDistributionClient {
if (conf.getConsumerGroup() == null) {
generateConsumerGroup();
}
+
+ //Default use HTTPS with DMAAP
+ if (conf.isUseHttpsWithDmaap() == null){
+ configuration.setUseHttpsWithDmaap(true);
+ }
}
if (result != DistributionActionResultEnum.SUCCESS) {
@@ -582,7 +588,11 @@ public class DistributionClientImpl implements IDistributionClient {
private synchronized void initCambriaClient(Wrapper<IDistributionClientResult> errorWrapper) {
if (cambriaIdentityManager == null) {
try {
- cambriaIdentityManager = new IdentityManagerBuilder().usingHttps().usingHosts(brokerServers).build();
+ AbstractAuthenticatedManagerBuilder<CambriaIdentityManager> managerBuilder = new IdentityManagerBuilder().usingHosts(brokerServers);
+ if (configuration.isUseHttpsWithDmaap()){
+ managerBuilder = managerBuilder.usingHttps();
+ }
+ cambriaIdentityManager = managerBuilder.build();
} catch (MalformedURLException | GeneralSecurityException e) {
handleCambriaInitFailure(errorWrapper, e);
}
diff --git a/sdc-distribution-client/src/test/java/org/openecomp/sdc/utils/TestConfiguration.java b/sdc-distribution-client/src/test/java/org/openecomp/sdc/utils/TestConfiguration.java
index d6b17e1..727f9a6 100644
--- a/sdc-distribution-client/src/test/java/org/openecomp/sdc/utils/TestConfiguration.java
+++ b/sdc-distribution-client/src/test/java/org/openecomp/sdc/utils/TestConfiguration.java
@@ -42,6 +42,7 @@ public class TestConfiguration implements IConfiguration {
private String keyStorePassword;
private boolean activateServerTLSAuth;
private boolean isFilterInEmptyResources;
+ private boolean useHttpsWithDmaap;
public TestConfiguration(IConfiguration other) {
this.asdcAddress = other.getAsdcAddress();
@@ -282,4 +283,9 @@ public class TestConfiguration implements IConfiguration {
public void setFilterInEmptyResources(boolean isFilterInEmptyResources) {
this.isFilterInEmptyResources = isFilterInEmptyResources;
}
+
+ @Override
+ public Boolean isUseHttpsWithDmaap() {
+ return this.useHttpsWithDmaap;
+ }
}