summaryrefslogtreecommitdiffstats
path: root/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@bell.ca>2021-04-21 15:01:30 +0100
committera.sreekumar <ajith.sreekumar@bell.ca>2021-04-21 16:48:18 +0100
commitbd21c78ed6953de4e8f9fd43311fd22bee7a5472 (patch)
treeddc8524aae1bfe573863bab5e42c6e7504d70b98 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src
parenta80ff846c0cce0224fd3b5d0ecbe34abfd1f1a6b (diff)
Changes to support Kafka over SSL in APEX
The Kafka plugin in APEX-PDP already has a field "kafkaProperties" that can take in any properties required for the Kafka client. This is apt to store the SSL related properties as they could change based on the server implementation. To make the communication possible, the only change required in APEX is to allow a property to have an empty value. For e.g., to disable the server host name verification, ssl.endpoint.identification.algorithm must to be explicitly set to an empty string on the client. Change-Id: If3adaeaf11e5fbbd2aff582b5d4ba7824017ea8a Issue-ID: POLICY-3194 Signed-off-by: a.sreekumar <ajith.sreekumar@bell.ca>
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src')
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java6
-rw-r--r--plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParametersTest.java13
2 files changed, 17 insertions, 2 deletions
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
index b37455d6e..eb1f15c93 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/main/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParameters.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -281,9 +282,10 @@ public class KafkaCarrierTechnologyParameters extends CarrierTechnologyParameter
ENTRY + i + " invalid, key is null or blank");
}
- if (StringUtils.isBlank(kafkaProperties[i][1])) {
+ // the value of a property has to be specified as empty in some cases, but should never be null.
+ if (null == kafkaProperties[i][1]) {
result.setResult(KAFKA_PROPERTIES, ValidationStatus.INVALID,
- ENTRY + i + " invalid, value is null or blank");
+ ENTRY + i + " invalid, value is null");
}
}
}
diff --git a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParametersTest.java b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParametersTest.java
index 9287f52ae..14f13bc97 100644
--- a/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParametersTest.java
+++ b/plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src/test/java/org/onap/policy/apex/plugins/event/carrier/kafka/KafkaCarrierTechnologyParametersTest.java
@@ -2,6 +2,7 @@
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Samsung. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
+ * Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -275,6 +276,18 @@ public class KafkaCarrierTechnologyParametersTest {
kafkaCarrierTechnologyParameters.setKafkaProperties(kafkaProperties2);
assertFalse(kafkaCarrierTechnologyParameters.validate().isValid());
+
+ // @formatter:off
+ String[][] kafkaPropertiesWithEmptyValue = {
+ {
+ "Property1", ""
+ }
+ };
+ // @formatter:on
+
+ kafkaCarrierTechnologyParameters.setKafkaProperties(kafkaPropertiesWithEmptyValue);
+ assertTrue(kafkaCarrierTechnologyParameters.validate().isValid());
+
kafkaCarrierTechnologyParameters.setKafkaProperties(origKafkaProperties);
assertTrue(kafkaCarrierTechnologyParameters.validate().isValid());