From 240ac3d9cd8107250574dd0f7221ae2f1afa3bd7 Mon Sep 17 00:00:00 2001 From: ToineSiebelink Date: Tue, 23 May 2023 09:30:37 +0100 Subject: Move integration test (DataService) - Moved all Data Intergation Test - Added/improved some module Moudle Servcie test too - Removed some unused (impossible) code-paths in prod code - Replaced null's with meaningful strings (in edge case scenarios) - Replaced @Shared with static (shorter) in some test Issue-ID: CPS-1687 Signed-off-by: ToineSiebelink Change-Id: Ib4b1ec1706ace7e3f5ac03d85177a6f7d4f6b8d0 --- .../java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java | 3 +-- .../java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'cps-ri/src/main/java/org/onap') diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java index fdb01485a..02f723029 100644 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsDataPersistenceServiceImpl.java @@ -692,8 +692,7 @@ public class CpsDataPersistenceServiceImpl implements CpsDataPersistenceService private String mergeLeaves(final Map updateLeaves, final String currentLeavesAsString) { Map currentLeavesAsMap = new HashMap<>(); if (currentLeavesAsString != null) { - currentLeavesAsMap = currentLeavesAsString.isEmpty() - ? new HashMap<>() : jsonObjectMapper.convertJsonString(currentLeavesAsString, Map.class); + currentLeavesAsMap = jsonObjectMapper.convertJsonString(currentLeavesAsString, Map.class); currentLeavesAsMap.putAll(updateLeaves); } diff --git a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java index e149a1f14..136512077 100755 --- a/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java +++ b/cps-ri/src/main/java/org/onap/cps/spi/impl/CpsModulePersistenceServiceImpl.java @@ -340,15 +340,15 @@ public class CpsModulePersistenceServiceImpl implements CpsModulePersistenceServ if (optionalFileName.isPresent()) { return optionalFileName.get(); } - return null; + return "no filename"; } private String getDuplicatedChecksumFromException(final ConstraintViolationException exception) { final Matcher matcher = CHECKSUM_EXCEPTION_PATTERN.matcher(exception.getSQLException().getMessage()); - if (matcher.find() && matcher.groupCount() == 1) { + if (matcher.find()) { return matcher.group(1); } - return null; + return "no checksum found"; } private static ModuleReference toModuleReference( -- cgit 1.2.3-korg