diff options
author | Ram Krishna Verma <ram_krishna.verma@bell.ca> | 2021-04-22 14:13:17 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2021-04-22 14:13:17 +0000 |
commit | cb09008c4d252dbc9a62f3a1d0b463a74380aa77 (patch) | |
tree | 69261ec06f77c50eb396df959f166a56b35b5e49 /plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src | |
parent | 6597f67120e0e3376a5e083802c8efe55202e1e7 (diff) | |
parent | bd21c78ed6953de4e8f9fd43311fd22bee7a5472 (diff) |
Merge "Changes to support Kafka over SSL in APEX"
Diffstat (limited to 'plugins/plugins-event/plugins-event-carrier/plugins-event-carrier-kafka/src')
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()); |