diff options
4 files changed, 11 insertions, 14 deletions
diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/DataSyncWatchdog.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/DataSyncWatchdog.java index 45f6367841..c3973236f0 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/DataSyncWatchdog.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/impl/inventory/sync/DataSyncWatchdog.java @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2022-2023 Nordix Foundation + * Copyright (C) 2022-2024 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,21 +60,22 @@ public class DataSyncWatchdog { moduleOperationsUtils.getUnsynchronizedReadyCmHandles().forEach(unSynchronizedReadyCmHandle -> { final String cmHandleId = unSynchronizedReadyCmHandle.getId(); if (hasPushedIntoSemaphoreMap(cmHandleId)) { - log.debug("Executing data sync on {}", cmHandleId); + log.info("Executing data sync on {}", cmHandleId); final CompositeState compositeState = inventoryPersistence .getCmHandleState(cmHandleId); final String resourceData = moduleOperationsUtils.getResourceData(cmHandleId); if (resourceData == null) { - log.debug("Error retrieving resource data for Cm-Handle: {}", cmHandleId); + log.error("Error retrieving resource data for Cm-Handle: {}", cmHandleId); } else { cpsDataService.saveData(NFP_OPERATIONAL_DATASTORE_DATASPACE_NAME, cmHandleId, resourceData, OffsetDateTime.now()); setSyncStateToSynchronized().accept(compositeState); inventoryPersistence.saveCmHandleState(cmHandleId, compositeState); updateDataSyncSemaphoreMap(cmHandleId); + log.info("Data sync finished for {}", cmHandleId); } } else { - log.debug("{} already processed by another instance", cmHandleId); + log.info("{} already processed by another instance", cmHandleId); } }); log.debug("No Cm-Handles currently found in READY State and Operational Sync State is UNSYNCHRONIZED"); diff --git a/cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java b/cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java index 5cadd29368..597164598a 100644 --- a/cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java +++ b/cps-service/src/main/java/org/onap/cps/utils/YangParserHelper.java @@ -120,13 +120,9 @@ public class YangParserHelper { try (jsonParserStream) { jsonParserStream.parse(jsonReader); - } catch (final IOException | JsonSyntaxException exception) { + } catch (final IOException | JsonSyntaxException | IllegalStateException | IllegalArgumentException exception) { throw new DataValidationException( - "Failed to parse json data: " + jsonData, exception.getMessage(), exception); - } catch (final IllegalStateException | IllegalArgumentException exception) { - throw new DataValidationException( - "Failed to parse json data. Unsupported xpath or json data:" + jsonData, exception - .getMessage(), exception); + "Data Validation Failed", "Failed to parse json data. " + exception.getMessage(), exception); } return dataContainerNodeBuilder.build(); } @@ -168,7 +164,7 @@ public class YangParserHelper { } catch (final XMLStreamException | URISyntaxException | IOException | SAXException | NullPointerException | ParserConfigurationException | TransformerException exception) { throw new DataValidationException( - "Failed to parse xml data: " + xmlData, exception.getMessage(), exception); + "Data Validation Failed", "Failed to parse xml data: " + exception.getMessage(), exception); } final DataContainerChild dataContainerChild = (DataContainerChild) getFirstChildXmlRoot(normalizedNodeResult.getResult()); diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy index 2e38d797d9..0d3c5aa834 100644 --- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsDataServiceImplSpec.groovy @@ -132,8 +132,8 @@ class CpsDataServiceImplSpec extends Specification { where: 'given parameters' scenario | invalidData | contentType || expectedMessage 'no data nodes' | '{}' | ContentType.JSON || 'No data nodes' - 'invalid json' | '{invalid json' | ContentType.JSON || 'Failed to parse json data' - 'invalid xml' | '<invalid xml' | ContentType.XML || 'Failed to parse xml data' + 'invalid json' | '{invalid json' | ContentType.JSON || 'Data Validation Failed' + 'invalid xml' | '<invalid xml' | ContentType.XML || 'Data Validation Failed' } def 'Saving list element data fragment under Root node.'() { diff --git a/csit/tests/cps-data-sync/cps-data-sync.robot b/csit/tests/cps-data-sync/cps-data-sync.robot index c0ee4da67b..2de03b0739 100644 --- a/csit/tests/cps-data-sync/cps-data-sync.robot +++ b/csit/tests/cps-data-sync/cps-data-sync.robot @@ -54,7 +54,7 @@ Operational state goes to UNSYNCHRONIZED when data sync (flag) is enabled Operational state goes to SYNCHRONIZED after sometime when data sync (flag) is enabled ${uri}= Set Variable ${ncmpBasePath}/v1/ch/ietfYang-PNFDemo/state ${headers}= Create Dictionary Authorization=${auth} - Wait Until Keyword Succeeds 10sec 100ms Is CM Handle State SYNCHRONIZED ${uri} ${headers} + Wait Until Keyword Succeeds 40sec 100ms Is CM Handle State SYNCHRONIZED ${uri} ${headers} *** Keywords *** Is CM Handle READY |