From 6043f67e7396e662f7814beca9760fdaf5058d6e Mon Sep 17 00:00:00 2001 From: "k.kedron" Date: Mon, 8 Jul 2019 14:10:53 +0200 Subject: Improved the CsarGenerator unit tests. Improved the CsarGeneratoryTest. Checkstyle for CsarGenerator and fixed typos. Issue-ID: SDC-2327 Signed-off-by: Krystian Kedron Change-Id: I8159dd47540ee3f5ed8b46f99c494c0cb24ed1d6 --- .../sdc/asdctool/impl/internal/tool/CsarGenerator.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'asdctool/src/main/java/org') diff --git a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java index 4af684b30d..78f0ecbc88 100644 --- a/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java +++ b/asdctool/src/main/java/org/openecomp/sdc/asdctool/impl/internal/tool/CsarGenerator.java @@ -84,14 +84,14 @@ public class CsarGenerator extends CommonInternalTool { props.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); props.put(GraphPropertyEnum.COMPONENT_TYPE, ComponentTypeEnum.SERVICE.name()); - List byCriterria = janusGraphDao + List byCriteria = janusGraphDao .getByCriteria(VertexTypeEnum.TOPOLOGY_TEMPLATE, props).either(l -> l, r -> null); - if (byCriterria != null && !byCriterria.isEmpty()) { - if (byCriterria.size() > 1) { + if (byCriteria != null && !byCriteria.isEmpty()) { + if (byCriteria.size() > 1) { ConsoleWriter.dataLine("Warning ! More that 1 certified service with uuid", uuid); // TBD } else { - GraphVertex metadataV = byCriterria.get(0); + GraphVertex metadataV = byCriteria.get(0); printComponentInfo(metadataV.getMetadataProperties()); ConsoleWriter.dataLine("\nGenerate CSAR (yes/no)?"); @@ -102,7 +102,7 @@ public class CsarGenerator extends CommonInternalTool { } } } else { - ConsoleWriter.dataLine("No certified service with UUID", uuid); + ConsoleWriter.dataLine("No certified service with UUID ", uuid); } if (status == JanusGraphOperationStatus.OK) { janusGraphDao.commit(); @@ -131,14 +131,14 @@ public class CsarGenerator extends CommonInternalTool { } } else { - ConsoleWriter.dataLine("Failed to fetch certified service with UUID", uuid); + ConsoleWriter.dataLine("Failed to fetch certified service with UUID ", uuid); } return status; } private JanusGraphOperationStatus generateArtifact(Component component, ArtifactTypeEnum artifactType, Supplier supplier){ JanusGraphOperationStatus status = JanusGraphOperationStatus.GENERAL_ERROR; - ArtifactDefinition csarArtifact = null; + ArtifactDefinition csarArtifact; Optional op = component.getToscaArtifacts().values().stream().filter(p -> p.getArtifactType().equals(artifactType.getType())).findAny(); if (op.isPresent()) { csarArtifact = op.get(); @@ -162,7 +162,7 @@ public class CsarGenerator extends CommonInternalTool { ConsoleWriter.dataLine("create artifact failed ", csarArtifact.getArtifactLabel()); return JanusGraphOperationStatus.GENERAL_ERROR; } - ConsoleWriter.dataLine("createartifact success ", csarArtifact.getArtifactLabel()); + ConsoleWriter.dataLine("create artifact success ", csarArtifact.getArtifactLabel()); csarArtifact.setPayload(payload); byte[] decodedPayload = csarArtifact.getPayloadData(); -- cgit 1.2.3-korg