aboutsummaryrefslogtreecommitdiffstats
path: root/cps-ncmp-service/src/main/java/org/onap
diff options
context:
space:
mode:
authorJosephKeenan <joseph.keenan@est.tech>2021-12-14 12:25:21 +0000
committerJosephKeenan <joseph.keenan@est.tech>2021-12-15 10:17:40 +0000
commit905d361fb7dd5a433ebf4666d091fd9c8f521fa7 (patch)
tree2dd00f08b062ffecaa368b057c7af48591a7777e /cps-ncmp-service/src/main/java/org/onap
parentb7485757b6fd56c2b32cd90c5ad1d0b5bd7b3a6a (diff)
Adding unit tests and robuestness for DMI registration
-Added more scenarios for combinations of plugins -Made plugin registration more robust Issue-ID: CPS-736 Signed-off-by: JosephKeenan <joseph.keenan@est.tech> Change-Id: I7495eb802fec8708e7ea6b0a97a9d7fe4676c8c1
Diffstat (limited to 'cps-ncmp-service/src/main/java/org/onap')
-rw-r--r--cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java25
1 files changed, 13 insertions, 12 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java
index a604f34484..9faf7331e7 100644
--- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java
+++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/models/DmiPluginRegistration.java
@@ -53,8 +53,6 @@ public class DmiPluginRegistration {
private List<String> removedCmHandles;
- public static final String PLEASE_SUPPLY_CORRECT_PLUGIN_INFORMATION = "Please supply correct plugin information.";
-
/**
* Validates plugin service names.
*
@@ -67,19 +65,22 @@ public class DmiPluginRegistration {
String errorMessage = null;
- if (isNullEmptyOrBlank(combinedServiceName)
- && isNullEmptyOrBlank(dataServiceName)
- && isNullEmptyOrBlank(modelsServiceName)) {
- errorMessage = "No DMI plugin service names";
- }
-
- if (!isNullEmptyOrBlank(combinedServiceName)
- && (!isNullEmptyOrBlank(dataServiceName) || !isNullEmptyOrBlank(modelsServiceName))) {
- errorMessage = "Invalid combination of plugin service names";
+ if (isNullEmptyOrBlank(combinedServiceName)) {
+ if ((isNullEmptyOrBlank(dataServiceName) && isNullEmptyOrBlank(modelsServiceName))) {
+ errorMessage = "No DMI plugin service names";
+ } else {
+ if (isNullEmptyOrBlank(dataServiceName) || isNullEmptyOrBlank(modelsServiceName)) {
+ errorMessage = "Cannot register just a Data or Model plugin service name";
+ }
+ }
+ } else {
+ if (!isNullEmptyOrBlank(dataServiceName) || !isNullEmptyOrBlank(modelsServiceName)) {
+ errorMessage = "Cannot register combined plugin service name and other service names";
+ }
}
if (errorMessage != null) {
- throw new NcmpException(errorMessage, PLEASE_SUPPLY_CORRECT_PLUGIN_INFORMATION);
+ throw new NcmpException(errorMessage, "Please supply correct plugin information.");
}
}