diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-06-19 11:39:50 +0200 |
---|---|---|
committer | Ofir Sonsino <ofir.sonsino@intl.att.com> | 2020-06-21 07:06:24 +0000 |
commit | 5dd7bf3451168c1701b6c35b29d0db70c218595a (patch) | |
tree | caae825d95c8b199576143541c6ceeb8660778d1 /asdctool | |
parent | 055589ac3ebc9791c63ef0e09072c7129f6a0b82 (diff) |
Fix sonar issues
Fix sonar/checkstyle issues in sdc code
Issue-ID: SDC-3116
Change-Id: I87802cc9edb378bdbe456c3ca4f10d8c6ebe9425
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'asdctool')
-rw-r--r-- | asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java | 3 | ||||
-rw-r--r-- | asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/module/json/ModuleJsonTask.java (renamed from asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java) | 50 | ||||
-rw-r--r-- | asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java | 2 | ||||
-rw-r--r-- | asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/module/json/ModuleJsonTaskTest.java (renamed from asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java) | 2 |
4 files changed, 24 insertions, 33 deletions
diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java index 7afb4ed001..b13009fecc 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfiguration.java @@ -34,8 +34,7 @@ import org.openecomp.sdc.asdctool.impl.validator.tasks.VfValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidationUtils; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask; -import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask; -import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager; +import org.openecomp.sdc.asdctool.impl.validator.tasks.module.json.ModuleJsonTask; import org.openecomp.sdc.asdctool.migration.config.mocks.DistributionEngineMock; import org.openecomp.sdc.be.components.distribution.engine.IDistributionEngine; import org.openecomp.sdc.be.components.distribution.engine.ServiceDistributionArtifactsBuilder; diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/module/json/ModuleJsonTask.java index af4c6dfd55..58c2ef031b 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTask.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/validator/tasks/module/json/ModuleJsonTask.java @@ -18,9 +18,16 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson; +package org.openecomp.sdc.asdctool.impl.validator.tasks.module.json; import fj.data.Either; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.stream.Collectors; import org.openecomp.sdc.asdctool.impl.validator.report.Report; import org.openecomp.sdc.asdctool.impl.validator.tasks.ServiceValidationTask; import org.openecomp.sdc.asdctool.impl.validator.utils.ReportManager; @@ -38,14 +45,6 @@ import org.openecomp.sdc.be.model.jsonjanusgraph.operations.TopologyTemplateOper import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus; import org.springframework.beans.factory.annotation.Autowired; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.Optional; -import java.util.stream.Collectors; - public class ModuleJsonTask extends ServiceValidationTask { private TopologyTemplateOperation topologyTemplateOperation; @@ -68,7 +67,7 @@ public class ModuleJsonTask extends ServiceValidationTask { paramView.setIgnoreGroups(false); paramView.setIgnoreComponentInstances(false); Either<ToscaElement, StorageOperationStatus> toscaElementEither = topologyTemplateOperation - .getToscaElement(vertex.getUniqueId(), paramView); + .getToscaElement(vertex.getUniqueId(), paramView); if (toscaElementEither.isRight()) { return new VertexResult(false); } @@ -77,39 +76,32 @@ public class ModuleJsonTask extends ServiceValidationTask { Map<String, MapArtifactDataDefinition> instDeploymentArtifacts = element.getInstDeploymentArtifacts(); for (Map.Entry<String, MapGroupsDataDefinition> pair : Optional.ofNullable(instGroups) - .orElse(Collections.emptyMap()).entrySet()) { + .orElse(Collections.emptyMap()).entrySet()) { MapGroupsDataDefinition groups = pair.getValue(); if (groups != null && !groups.getMapToscaDataDefinition().isEmpty()) { return new VertexResult( - findCoordinateModuleJson(report, pair, instDeploymentArtifacts, vertex, outputFilePath)); + findCoordinateModuleJson(report, pair, instDeploymentArtifacts, vertex, outputFilePath)); } - return new VertexResult(true); } return new VertexResult(true); } - private boolean findCoordinateModuleJson( - Report report, - Map.Entry<String, MapGroupsDataDefinition> pair, - Map<String, MapArtifactDataDefinition> instDeploymentArtifacts, - GraphVertex vertex, String outputFilePath - ) { + private boolean findCoordinateModuleJson(Report report, Map.Entry<String, MapGroupsDataDefinition> pair, + Map<String, MapArtifactDataDefinition> instDeploymentArtifacts, + GraphVertex vertex, String outputFilePath) { String groupKey = pair.getKey(); String[] split = groupKey.split("\\."); String instanceName = split[split.length - 1]; MapArtifactDataDefinition deploymentsArtifacts = instDeploymentArtifacts.get(groupKey); if (deploymentsArtifacts != null && !deploymentsArtifacts.getMapToscaDataDefinition().isEmpty()) { List<ArtifactDataDefinition> moduleJsonArtifacts = deploymentsArtifacts.getMapToscaDataDefinition().values() - .stream().filter(artifact -> { - String artifactName = artifact.getArtifactName(); - if (artifactName.startsWith(instanceName) && artifactName.endsWith("modules.json")) { - return true; - } - return false; - }).collect(Collectors.toList()); - if (moduleJsonArtifacts.size() > 0) { - String status = - "Instance " + instanceName + " has a corresponding modules.json file: " + moduleJsonArtifacts.get(0) + .stream().filter(artifact -> { + String artifactName = artifact.getArtifactName(); + return (artifactName.startsWith(instanceName) && artifactName.endsWith("modules.json")); + }).collect(Collectors.toList()); + if (!moduleJsonArtifacts.isEmpty()) { + String status = "Instance " + instanceName + " has a corresponding modules.json file: " + + moduleJsonArtifacts.get(0) .getArtifactName(); ReportManager.writeReportLineToFile(status, outputFilePath); return true; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java index 31f6424e28..deadf3250d 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/config/ValidationToolConfigurationTest.java @@ -31,7 +31,7 @@ import org.openecomp.sdc.asdctool.impl.validator.executers.VfValidatorExecuter; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ArtifactValidationUtils; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.ServiceArtifactValidationTask; import org.openecomp.sdc.asdctool.impl.validator.tasks.artifacts.VfArtifactValidationTask; -import org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson.ModuleJsonTask; +import org.openecomp.sdc.asdctool.impl.validator.tasks.module.json.ModuleJsonTask; import org.openecomp.sdc.be.dao.JanusGraphClientStrategy; import org.openecomp.sdc.be.dao.cassandra.ArtifactCassandraDao; import org.openecomp.sdc.be.dao.cassandra.CassandraClient; diff --git a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/module/json/ModuleJsonTaskTest.java index 4ea31386e4..f6e0722aaa 100644 --- a/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/moduleJson/ModuleJsonTaskTest.java +++ b/asdctool/src/test/java/org/openecomp/sdc/asdctool/impl/validator/tasks/module/json/ModuleJsonTaskTest.java @@ -18,7 +18,7 @@ * ============LICENSE_END========================================================= */ -package org.openecomp.sdc.asdctool.impl.validator.tasks.moduleJson; +package org.openecomp.sdc.asdctool.impl.validator.tasks.module.json; import fj.data.Either; import org.junit.Test; |