summaryrefslogtreecommitdiffstats
path: root/prh-dmaap-client
diff options
context:
space:
mode:
Diffstat (limited to 'prh-dmaap-client')
-rw-r--r--prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java30
-rw-r--r--prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java57
-rw-r--r--prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java43
3 files changed, 90 insertions, 40 deletions
diff --git a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java
index b21cc6ea..8691111d 100644
--- a/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java
+++ b/prh-dmaap-client/src/main/java/org/onap/dcaegen2/services/prh/config/DmaapCustomConfig.java
@@ -49,6 +49,24 @@ public interface DmaapCustomConfig extends Serializable {
@Value.Parameter
String dmaapContentType();
+ @Value.Parameter
+ String keyFile();
+
+ @Value.Parameter
+ String trustStore();
+
+ @Value.Parameter
+ String trustStorePassword();
+
+ @Value.Parameter
+ String keyStore();
+
+ @Value.Parameter
+ String keyStorePassword();
+
+ @Value.Parameter
+ Boolean enableDmaapCertAuth();
+
interface Builder<T extends DmaapCustomConfig, B extends Builder<T, B>> {
B dmaapHostName(String dmaapHostName);
@@ -65,6 +83,18 @@ public interface DmaapCustomConfig extends Serializable {
B dmaapContentType(String dmaapContentType);
+ B keyFile(String keyFile);
+
+ B trustStore(String trustStore);
+
+ B trustStorePassword(String trustStorePass);
+
+ B keyStore(String keyStore);
+
+ B keyStorePassword(String keyStorePass);
+
+ B enableDmaapCertAuth(Boolean enableDmaapCertAuth);
+
T build();
}
}
diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java
index 2239d110..01d470a0 100644
--- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java
+++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapConsumerConfigurationTest.java
@@ -20,7 +20,8 @@
package org.onap.dcaegen2.services.prh.service.config;
-import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.junit.jupiter.api.Test;
import org.onap.dcaegen2.services.prh.config.DmaapConsumerConfiguration;
import org.onap.dcaegen2.services.prh.config.ImmutableDmaapConsumerConfiguration;
@@ -43,33 +44,41 @@ class DmaapConsumerConfigurationTest {
String consumerGroup = "other";
Integer timeoutMs = 1000;
Integer messageLimit = 1000;
+ String keyFile = "keyFile";
+ String trustStore = "trustStore";
+ String trustStorePass = "trustPass";
+ String keyStore = "keyStore";
+ String keyStorePass = "keyPass";
+ Boolean enableDmaapCertAuth = true;
// When
configuration = new ImmutableDmaapConsumerConfiguration.Builder()
- .consumerId(consumerId)
- .dmaapHostName(dmaapHostName)
- .dmaapPortNumber(dmaapPortNumber)
- .dmaapTopicName(dmaapTopicName)
- .dmaapProtocol(dmaapProtocol)
- .dmaapUserName(dmaapUserName)
- .dmaapUserPassword(dmaapUserPassword)
- .dmaapContentType(dmaapContentType)
- .consumerGroup(consumerGroup)
- .timeoutMs(timeoutMs)
- .messageLimit(messageLimit)
- .build();
+ .consumerId(consumerId)
+ .dmaapHostName(dmaapHostName)
+ .dmaapPortNumber(dmaapPortNumber)
+ .dmaapTopicName(dmaapTopicName)
+ .dmaapProtocol(dmaapProtocol)
+ .dmaapUserName(dmaapUserName)
+ .dmaapUserPassword(dmaapUserPassword)
+ .dmaapContentType(dmaapContentType)
+ .consumerGroup(consumerGroup)
+ .timeoutMs(timeoutMs)
+ .messageLimit(messageLimit)
+ .keyFile(keyFile)
+ .trustStore(trustStore)
+ .trustStorePassword(trustStorePass)
+ .keyStore(keyStore)
+ .keyStorePassword(keyStorePass)
+ .enableDmaapCertAuth(enableDmaapCertAuth)
+ .build();
// Then
- Assertions.assertNotNull(configuration);
- Assertions.assertEquals(consumerId, configuration.consumerId());
- Assertions.assertEquals(dmaapHostName, configuration.dmaapHostName());
- Assertions.assertEquals(dmaapPortNumber, configuration.dmaapPortNumber());
- Assertions.assertEquals(dmaapTopicName, configuration.dmaapTopicName());
- Assertions.assertEquals(dmaapProtocol, configuration.dmaapProtocol());
- Assertions.assertEquals(dmaapUserName, configuration.dmaapUserName());
- Assertions.assertEquals(dmaapUserPassword, configuration.dmaapUserPassword());
- Assertions.assertEquals(consumerGroup, configuration.consumerGroup());
- Assertions.assertEquals(timeoutMs, configuration.timeoutMs());
- Assertions.assertEquals(messageLimit, configuration.messageLimit());
+ assertEquals("DmaapConsumerConfiguration{"
+ + "consumerId=1, consumerGroup=other, timeoutMs=1000, messageLimit=1000, dmaapHostName=localhost, "
+ + "dmaapPortNumber=2222, dmaapTopicName=temp, dmaapProtocol=http, dmaapUserName=admin, "
+ + "dmaapUserPassword=admin, dmaapContentType=application/json, keyFile=keyFile, "
+ + "trustStore=trustStore, trustStorePassword=trustPass, keyStore=keyStore, "
+ + "keyStorePassword=keyPass, enableDmaapCertAuth=true}", configuration.toString());
+
}
}
diff --git a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java
index f4a8f107..d6471381 100644
--- a/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java
+++ b/prh-dmaap-client/src/test/java/org/onap/dcaegen2/services/prh/service/config/DmaapPublisherConfigurationTest.java
@@ -20,7 +20,8 @@
package org.onap.dcaegen2.services.prh.service.config;
-import org.junit.jupiter.api.Assertions;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
import org.junit.jupiter.api.Test;
import org.onap.dcaegen2.services.prh.config.DmaapPublisherConfiguration;
import org.onap.dcaegen2.services.prh.config.ImmutableDmaapPublisherConfiguration;
@@ -40,25 +41,35 @@ class DmaapPublisherConfigurationTest {
String dmaapUserName = "admin";
String dmaapUserPassword = "admin";
String dmaapContentType = "application/json";
+ String keyFile = "keyFile";
+ String trustStore = "trustStore";
+ String trustStorePass = "trustPass";
+ String keyStore = "keyStore";
+ String keyStorePass = "keyPass";
+ Boolean enableDmaapCertAuth = true;
// When
configuration = new ImmutableDmaapPublisherConfiguration.Builder()
- .dmaapHostName(dmaapHostName)
- .dmaapPortNumber(dmaapPortNumber)
- .dmaapTopicName(dmaapTopicName)
- .dmaapProtocol(dmaapProtocol)
- .dmaapUserName(dmaapUserName)
- .dmaapUserPassword(dmaapUserPassword)
- .dmaapContentType(dmaapContentType)
- .build();
+ .dmaapHostName(dmaapHostName)
+ .dmaapPortNumber(dmaapPortNumber)
+ .dmaapTopicName(dmaapTopicName)
+ .dmaapProtocol(dmaapProtocol)
+ .dmaapUserName(dmaapUserName)
+ .dmaapUserPassword(dmaapUserPassword)
+ .dmaapContentType(dmaapContentType)
+ .keyFile(keyFile)
+ .trustStore(trustStore)
+ .trustStorePassword(trustStorePass)
+ .keyStore(keyStore)
+ .keyStorePassword(keyStorePass)
+ .enableDmaapCertAuth(enableDmaapCertAuth)
+ .build();
// Then
- Assertions.assertNotNull(configuration);
- Assertions.assertEquals(dmaapHostName, configuration.dmaapHostName());
- Assertions.assertEquals(dmaapPortNumber, configuration.dmaapPortNumber());
- Assertions.assertEquals(dmaapTopicName, configuration.dmaapTopicName());
- Assertions.assertEquals(dmaapProtocol, configuration.dmaapProtocol());
- Assertions.assertEquals(dmaapUserName, configuration.dmaapUserName());
- Assertions.assertEquals(dmaapUserPassword, configuration.dmaapUserPassword());
+ assertEquals("DmaapPublisherConfiguration{dmaapHostName=localhost, dmaapPortNumber=2222, "
+ + "dmaapTopicName=temp, dmaapProtocol=http, dmaapUserName=admin, dmaapUserPassword=admin, "
+ + "dmaapContentType=application/json, keyFile=keyFile, trustStore=trustStore, "
+ + "trustStorePassword=trustPass, keyStore=keyStore, keyStorePassword=keyPass, "
+ + "enableDmaapCertAuth=true}", configuration.toString());
}
}