From f9f5f68caee795d97221071fb26ebe0f572bae0d Mon Sep 17 00:00:00 2001 From: vasraz Date: Sat, 19 Jun 2021 11:07:12 +0100 Subject: Remove usage of outdated library JMockit (catalog-model) Signed-off-by: Vasyl Razinkov Change-Id: I3888fb6f9a4c89aefc3dcb124529abd726c400d9 Issue-ID: SDC-3379 --- .../org/openecomp/sdc/be/model/GroupInstance.java | 54 +++++++++++----------- 1 file changed, 26 insertions(+), 28 deletions(-) (limited to 'catalog-model/src/main') diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java index 386febdf86..331b407328 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java @@ -40,7 +40,7 @@ public class GroupInstance extends GroupInstanceDataDefinition { super(); } - public GroupInstance(GroupInstanceDataDefinition r) { + public GroupInstance(final GroupInstanceDataDefinition r) { super(r); } @@ -50,12 +50,11 @@ public class GroupInstance extends GroupInstanceDataDefinition { * @return */ public List convertToGroupInstancesProperties() { - List groupInstancesProperties = null; - List propertiesList = super.getProperties(); - if (propertiesList != null && !propertiesList.isEmpty()) { - groupInstancesProperties = propertiesList.stream().map(GroupInstanceProperty::new).collect(Collectors.toList()); + final List propertiesList = super.getProperties(); + if (CollectionUtils.isNotEmpty(propertiesList)) { + return propertiesList.stream().map(GroupInstanceProperty::new).collect(Collectors.toList()); } - return groupInstancesProperties; + return null; } /** @@ -64,23 +63,22 @@ public class GroupInstance extends GroupInstanceDataDefinition { * * @param groupInstancesProperties */ - public void convertFromGroupInstancesProperties(List groupInstancesProperties) { + public void convertFromGroupInstancesProperties(final List groupInstancesProperties) { if (groupInstancesProperties != null && !groupInstancesProperties.isEmpty()) { - List propList = groupInstancesProperties.stream().map(PropertyDataDefinition::new).collect(Collectors.toList()); - super.setProperties(propList); + super.setProperties(groupInstancesProperties.stream().map(PropertyDataDefinition::new).collect(Collectors.toList())); } } private void removeArtifactsDuplicates() { - List artifacts = getArtifacts(); - Set artifactsSet = new HashSet<>(); + final List artifacts = getArtifacts(); + final Set artifactsSet = new HashSet<>(); if (artifacts != null && !artifacts.isEmpty()) { artifactsSet.addAll(artifacts); artifacts.clear(); artifacts.addAll(artifactsSet); } - List giArtifacts = getGroupInstanceArtifacts(); - Set giArtifactsSet = new HashSet<>(); + final List giArtifacts = getGroupInstanceArtifacts(); + final Set giArtifactsSet = new HashSet<>(); if (giArtifacts != null && !giArtifacts.isEmpty()) { giArtifactsSet.addAll(giArtifacts); giArtifacts.clear(); @@ -89,16 +87,16 @@ public class GroupInstance extends GroupInstanceDataDefinition { } private void clearArtifactsUuid() { - List artifactsUuid = getArtifactsUuid(); + final List artifactsUuid = getArtifactsUuid(); if (CollectionUtils.isNotEmpty(artifactsUuid)) { artifactsUuid.clear(); } else if (artifactsUuid == null) { setArtifactsUuid(new ArrayList<>()); } - List giartifactsUuid = this.getGroupInstanceArtifactsUuid(); - if (CollectionUtils.isNotEmpty(giartifactsUuid)) { - giartifactsUuid.clear(); - } else if (giartifactsUuid == null) { + final List groupInstanceArtifactsUuid = this.getGroupInstanceArtifactsUuid(); + if (CollectionUtils.isNotEmpty(groupInstanceArtifactsUuid)) { + groupInstanceArtifactsUuid.clear(); + } else if (groupInstanceArtifactsUuid == null) { setGroupInstanceArtifactsUuid(new ArrayList<>()); } } @@ -108,19 +106,19 @@ public class GroupInstance extends GroupInstanceDataDefinition { * * @param deploymentArtifacts */ - public void alignArtifactsUuid(Map deploymentArtifacts) { - List artifactIds = getArtifacts(); + public void alignArtifactsUuid(final Map deploymentArtifacts) { + final List artifactIds = getArtifacts(); log.debug("the artifacts Id's are: {}, and the deployment artifacts Id's are: {}", artifactIds, deploymentArtifacts); if (CollectionUtils.isNotEmpty(artifactIds) && deploymentArtifacts != null) { removeArtifactsDuplicates(); clearArtifactsUuid(); - List artifactUuids = getArtifactsUuid(); - List giArtifactUuids = getGroupInstanceArtifactsUuid(); - for (String artifactId : artifactIds) { - String label = artifactId.substring(artifactId.lastIndexOf('.') + 1); - ArtifactDefinition artifact = deploymentArtifacts.get(label); + final List artifactUuids = getArtifactsUuid(); + final List giArtifactUuids = getGroupInstanceArtifactsUuid(); + for (final String artifactId : artifactIds) { + final var label = artifactId.substring(artifactId.lastIndexOf('.') + 1); + final ArtifactDefinition artifact = deploymentArtifacts.get(label); log.debug("current artifact id: {}, current artifact definition: {}", artifactId, artifact); - ArtifactTypeEnum artifactType = ArtifactTypeEnum.parse(artifact.getArtifactType()); + final var artifactType = ArtifactTypeEnum.parse(artifact.getArtifactType()); if (artifactType != ArtifactTypeEnum.HEAT_ENV) { addArtifactsIdToCollection(artifactUuids, artifact); } else { @@ -130,8 +128,8 @@ public class GroupInstance extends GroupInstanceDataDefinition { } } - private void addArtifactsIdToCollection(List artifactUuids, ArtifactDefinition artifact) { - if (!artifactUuids.contains(artifact.getArtifactUUID()) && StringUtils.isNotEmpty(artifact.getArtifactUUID())) { + private void addArtifactsIdToCollection(final List artifactUuids, final ArtifactDefinition artifact) { + if (StringUtils.isNotEmpty(artifact.getArtifactUUID()) && !artifactUuids.contains(artifact.getArtifactUUID())) { artifactUuids.add(artifact.getArtifactUUID()); } } -- cgit 1.2.3-korg