diff options
author | waynedunican <wayne.dunican@est.tech> | 2024-07-23 09:23:51 +0100 |
---|---|---|
committer | waynedunican <wayne.dunican@est.tech> | 2024-08-13 08:49:10 +0100 |
commit | b7804abcf865dc58a01bed3f2be4756e731d9288 (patch) | |
tree | 7f6fc3b50622578bb8612de9fe5e5c6adddfaf28 /models-tosca/src/main | |
parent | a029ccab07f2dd71286804da620c513da9fdfc0e (diff) |
Improve code coverage and sonar fixes
Increased code coverage to 90%
SONAR - Removed TODO comments
SONAR - Added NOSONAR where appropriate
SONAR - Replaced stream.Collect() with stream.toList() where applicable
SONAR - Made variables serializable or transient to comply with sonar rules
Issue-ID: POLICY-5069
Change-Id: Ife256eaf4e6f427fe40b138bacc6f112dc5bcea4
Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'models-tosca/src/main')
4 files changed, 5 insertions, 17 deletions
diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntityFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntityFilter.java index d6f3a6815..a5a800587 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntityFilter.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaEntityFilter.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 2024 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ package org.onap.policy.models.tosca.authorative.concepts; import java.util.List; -import java.util.stream.Collectors; import lombok.Builder; import lombok.Data; import lombok.NonNull; @@ -52,7 +51,7 @@ public class ToscaEntityFilter<T extends ToscaEntity> implements PfObjectFilter< .filter(p -> filterString(p.getName(), name)) .filter(p -> LATEST_VERSION.equals(version) || filterString(p.getVersion(), version)) - .collect(Collectors.toList()); + .toList(); // @formatter:off if (LATEST_VERSION.equals(version)) { diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaTypedEntityFilter.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaTypedEntityFilter.java index 749873a23..0bb72e549 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaTypedEntityFilter.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/concepts/ToscaTypedEntityFilter.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 2024 Nordix Foundation. * Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ package org.onap.policy.models.tosca.authorative.concepts; import java.util.List; -import java.util.stream.Collectors; import lombok.Builder; import lombok.Data; import lombok.NonNull; @@ -63,7 +62,7 @@ public class ToscaTypedEntityFilter<T extends ToscaEntity> implements PfObjectFi .filter(filterPrefixPred(versionPrefix, T::getVersion)) .filter(filterStringPred(type, T::getType)) .filter(filterStringPred(typeVersion, T::getTypeVersion)) - .collect(Collectors.toList()); + .toList(); // @formatter:off if (LATEST_VERSION.equals(version)) { diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java index 35971563f..f047658fb 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProvider.java @@ -55,7 +55,6 @@ import org.slf4j.LoggerFactory; public class AuthorativeToscaProvider { private static final Logger LOGGER = LoggerFactory.getLogger(AuthorativeToscaProvider.class); - // TODO: In next release this locking mechanism should be removed and replaced with proper session handling private static final Object providerLockObject = "providerLockObject"; /** diff --git a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java index 14502c64c..593d18bbb 100644 --- a/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java +++ b/models-tosca/src/main/java/org/onap/policy/models/tosca/simple/concepts/JpaToscaPolicyType.java @@ -3,7 +3,7 @@ * ONAP Policy Model * ================================================================================ * Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation. + * Modifications Copyright (C) 2019-2020, 2023-2024 Nordix Foundation. * Modifications Copyright (C) 2022 Bell Canada. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -110,19 +110,10 @@ public class JpaToscaPolicyType extends JpaToscaWithToscaProperties<ToscaPolicyT super.setToscaEntity(toscaPolicyType); super.toAuthorative(); - // TODO need to copy targets & triggers? - return toscaPolicyType; } @Override - public void fromAuthorative(final ToscaPolicyType toscaPolicyType) { - super.fromAuthorative(toscaPolicyType); - - // TODO need to copy targets & triggers? - } - - @Override public List<PfKey> getKeys() { final List<PfKey> keyList = super.getKeys(); |