aboutsummaryrefslogtreecommitdiffstats
path: root/mso-catalog-db/src/main/java/org
diff options
context:
space:
mode:
authorMcblain, Thomas <tom.mcblain@att.com>2019-06-06 15:59:20 -0400
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2019-06-06 15:59:30 -0400
commit37b23b4d859eda7fab5af1366f9688d882b8427a (patch)
tree017c0445971aaf9662e4cea1f16d213e77c71698 /mso-catalog-db/src/main/java/org
parentc4b90365d5c117bc6fd64af421a1468539a8aec3 (diff)
Handle when model cust uuid is null from sdnc
Modify wording on null uuid exception and test for it Expand null handling to vfmc and cvnfc find in lists Modify to chain the filter of nulls then to match. Change to ExpectedException in junit; filter nulls. Handle better when model cust. uuid is null from sdnc Change-Id: I1f1edffa1db84509bd649803660a55510868b6eb Issue-ID: SO-1989 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'mso-catalog-db/src/main/java/org')
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index f502c34e20..2bfa2856d2 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -823,9 +823,14 @@ public class CatalogDbClient {
public VnfResourceCustomization findVnfResourceCustomizationInList(String vnfCustomizationUUID,
List<VnfResourceCustomization> vnfResourceCusts) {
- List<VnfResourceCustomization> filtered = vnfResourceCusts.stream()
- .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID()))
- .collect(Collectors.toList());
+ if (vnfCustomizationUUID == null) {
+ throw new EntityNotFoundException(
+ "a NULL UUID was provided in query to search for VnfResourceCustomization");
+ }
+ List<VnfResourceCustomization> filtered =
+ vnfResourceCusts.stream().filter(v -> v.getModelCustomizationUUID() != null)
+ .filter(vnfCustRes -> vnfCustomizationUUID.equals(vnfCustRes.getModelCustomizationUUID()))
+ .collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {
return filtered.get(0);
} else
@@ -833,9 +838,12 @@ public class CatalogDbClient {
"Unable to find VnfResourceCustomization ModelCustomizationUUID:" + vnfCustomizationUUID);
}
- private VfModuleCustomization findVfModuleCustomizationInList(String vfModuleCustomizationUUID,
+ protected VfModuleCustomization findVfModuleCustomizationInList(String vfModuleCustomizationUUID,
List<VfModuleCustomization> vfModuleList) {
- List<VfModuleCustomization> filtered = vfModuleList.stream()
+ if (vfModuleCustomizationUUID == null) {
+ throw new EntityNotFoundException("a NULL UUID was provided in query to search for VfModuleCustomization");
+ }
+ List<VfModuleCustomization> filtered = vfModuleList.stream().filter(v -> v.getModelCustomizationUUID() != null)
.filter(vfModuleCust -> vfModuleCustomizationUUID.equals(vfModuleCust.getModelCustomizationUUID()))
.collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {
@@ -845,9 +853,13 @@ public class CatalogDbClient {
"Unable to find VfModuleCustomization ModelCustomizationUUID:" + vfModuleCustomizationUUID);
}
- private CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid,
+ protected CvnfcCustomization findCvnfcCustomizationInAList(String cvnfcCustomizationUuid,
List<CvnfcCustomization> cvnfcCustomList) {
- List<CvnfcCustomization> filtered = cvnfcCustomList.stream()
+ if (cvnfcCustomizationUuid == null) {
+ throw new EntityNotFoundException(
+ "a NULL UUID was provided in query to search for CvnfcCustomization" + cvnfcCustomizationUuid);
+ }
+ List<CvnfcCustomization> filtered = cvnfcCustomList.stream().filter(c -> c.getModelCustomizationUUID() != null)
.filter(cvnfc -> cvnfcCustomizationUuid.equals(cvnfc.getModelCustomizationUUID()))
.collect(Collectors.toList());
if (filtered != null && !filtered.isEmpty() && filtered.size() == 1) {