From 5b4e07234654a4c12e28fea63d96b8a7ee053fcb Mon Sep 17 00:00:00 2001 From: ToineSiebelink Date: Thu, 13 Jul 2023 17:55:32 +0100 Subject: Improved code coverage for NetworkCmProxyDataServiceImpl - Production code had catch block that is no longer needed - Cleaned up some test somewhat (close to the new tests) Issue-ID: CPS-475 Signed-off-by: ToineSiebelink Change-Id: Iaa409e752a496bf088a58ccd422fe3d850442b59 --- .../api/impl/NetworkCmProxyDataServiceImpl.java | 29 ++++++++-------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'cps-ncmp-service/src/main') diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java index 6c1a1b464a..ea2f72fef7 100755 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/impl/NetworkCmProxyDataServiceImpl.java @@ -295,26 +295,17 @@ public class NetworkCmProxyDataServiceImpl implements NetworkCmProxyDataService */ public List parseAndCreateCmHandlesInDmiRegistrationAndSyncModules( final DmiPluginRegistration dmiPluginRegistration) { - List cmHandleRegistrationResponses = new ArrayList<>(); final Map cmHandleStatePerCmHandle = new HashMap<>(); - try { - dmiPluginRegistration.getCreatedCmHandles() - .forEach(cmHandle -> { - final YangModelCmHandle yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle( - dmiPluginRegistration.getDmiPlugin(), - dmiPluginRegistration.getDmiDataPlugin(), - dmiPluginRegistration.getDmiModelPlugin(), - cmHandle); - cmHandleStatePerCmHandle.put(yangModelCmHandle, CmHandleState.ADVISED); - }); - cmHandleRegistrationResponses = registerNewCmHandles(cmHandleStatePerCmHandle); - } catch (final DataValidationException dataValidationException) { - cmHandleRegistrationResponses.add(CmHandleRegistrationResponse.createFailureResponse(dmiPluginRegistration - .getCreatedCmHandles().stream() - .map(NcmpServiceCmHandle::getCmHandleId).findFirst().orElse(null), - RegistrationError.CM_HANDLE_INVALID_ID)); - } - return cmHandleRegistrationResponses; + dmiPluginRegistration.getCreatedCmHandles() + .forEach(cmHandle -> { + final YangModelCmHandle yangModelCmHandle = YangModelCmHandle.toYangModelCmHandle( + dmiPluginRegistration.getDmiPlugin(), + dmiPluginRegistration.getDmiDataPlugin(), + dmiPluginRegistration.getDmiModelPlugin(), + cmHandle); + cmHandleStatePerCmHandle.put(yangModelCmHandle, CmHandleState.ADVISED); + }); + return registerNewCmHandles(cmHandleStatePerCmHandle); } protected List parseAndRemoveCmHandlesInDmiRegistration( -- cgit 1.2.3-korg