summaryrefslogtreecommitdiffstats
path: root/catalog-be/src
diff options
context:
space:
mode:
authorChris André <chris.andre@yoppworks.com>2020-04-21 11:21:32 -0400
committerOfir Sonsino <ofir.sonsino@intl.att.com>2020-04-22 11:00:55 +0000
commit60c01004daf199820825f9bf345a3ed8a96f8933 (patch)
tree8a5af53fc67742bdfa093fe73bd5dfde5c857e47 /catalog-be/src
parent8a5065a44e64cd9eabbb2c16d262eb88be3d0c43 (diff)
Add null test to DistributionMonitoringBusinessLogic
- Added test in `handleAuditingDaoResponse` for null value related to `resAuditingGenericEvent` Issue-ID: SDC-2909 Signed-off-by: Chris Andre <chris.andre@yoppworks.com> Change-Id: I422629cdbd4f05e10609cd78b7328c4e9f45538b
Diffstat (limited to 'catalog-be/src')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java15
1 files changed, 12 insertions, 3 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java
index 087685292b..66cab35cd2 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DistributionMonitoringBusinessLogic.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -21,6 +21,7 @@
package org.openecomp.sdc.be.components.impl;
import fj.data.Either;
+import java.util.Optional;
import org.apache.http.HttpStatus;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.cassandra.AuditCassandraDao;
@@ -152,9 +153,17 @@ public class DistributionMonitoringBusinessLogic extends BaseBusinessLogic {
}
resAuditingGenericEvent = auditingGenericEvent;
+ }
+
+ if (resAuditingGenericEvent != null) {
+ Map<String, Object> fields = resAuditingGenericEvent.getFields();
+ if (fields != null) {
+ Optional.ofNullable(
+ fields.get(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName()))
+ .ifPresent(timestamp -> distributionStatusOfServiceInfo.setTimestamp((String) timestamp));
+ }
}
- distributionStatusOfServiceInfo.setTimestamp((String) resAuditingGenericEvent.getFields().get(AuditingFieldsKey.AUDIT_TIMESTAMP.getDisplayName()));
if (!isResult) {
if (dReguestStatus.equals(String.valueOf(HttpStatus.SC_OK))) {