diff options
Diffstat (limited to 'asdctool/src/main')
-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 |
2 files changed, 22 insertions, 31 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; |