aboutsummaryrefslogtreecommitdiffstats
path: root/sdnr/wt/data-provider/provider/src/main/java/org
diff options
context:
space:
mode:
authorRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-08-18 14:43:18 +0530
committerRavi Pendurty <ravi.pendurty@highstreet-technologies.com>2021-08-18 14:43:35 +0530
commita81a05e53871903d43aab71221b8ef2479dc3d58 (patch)
treed22f43b0bd8b1ad9ecaca126caa2c6b1f9c5f3b0 /sdnr/wt/data-provider/provider/src/main/java/org
parent1c4ad2b1a689d309d456a6ada894d1e8b1971b3c (diff)
Improve code-coverage for data-provider
Improve code-coverage for data-provider Issue-ID: CCSDK-3424 Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com> Change-Id: I5a50707c8fcec6c816fe645693b665d33743559c Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/data-provider/provider/src/main/java/org')
-rw-r--r--sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java
index 41e94e3f6..ea3296acb 100644
--- a/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java
+++ b/sdnr/wt/data-provider/provider/src/main/java/org/onap/ccsdk/features/sdnr/wt/dataprovider/database/elasticsearch/data/entity/HtDatabaseEventsService.java
@@ -80,6 +80,8 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
private static final NetconfTimeStamp NETCONFTIME_CONVERTER = NetconfTimeStampImpl.getConverter();
+ private static final int ROOT_TREE_LEVEL = 0;
+
private HtDatabaseClient client;
private EsDataObjectReaderWriter2<EventlogEntity> eventRWEventLogDevicemanager;
private EsDataObjectReaderWriter2<InventoryEntity> eventRWEquipment;
@@ -306,20 +308,21 @@ public class HtDatabaseEventsService implements ArchiveCleanProvider, DataProvid
.setTreeLevel(Uint32.valueOf(0));;
for (Inventory item : list) {
repairedItem = new InventoryBuilder(item);
- // check missing tree-level
+ // check for bad node-id
if (!nodeId.equals(item.getNodeId())) {
failures.add(String.format("missing node-id for equipment(uuid=%s)", item.getUuid()));
repairedItem.setNodeId(nodeId);
failCounter++;
}
+ // check missing tree-level
if (item.getTreeLevel() == null) {
failures.add(String.format("missing tree-level for equipment(uuid=%s)", item.getUuid()));
- repairedItem.setTreeLevel(Uint32.valueOf(1));
+ repairedItem.setTreeLevel(Uint32.valueOf(ROOT_TREE_LEVEL));
failCounter++;
} else {
treeLevel = item.getTreeLevel().longValue();
- if (treeLevel > 0) {
+ if (treeLevel > ROOT_TREE_LEVEL) {
// check non root elem and missing parent
if (item.getParentUuid() == null) {
failures.add(String.format("Non root level element (uuid=%s) has to have a parent element",