From 9f140e6123cc99f943d3545df04346a2f2382aec Mon Sep 17 00:00:00 2001 From: Kanagaraj Manickam k00365106 Date: Fri, 27 Oct 2017 10:04:03 +0530 Subject: Remove white-spaces in sample generation CLI-57 Change-Id: I4796efbd020a8342f8abf69a156919c9ca095c2e Signed-off-by: Kanagaraj Manickam k00365106 --- .../java/org/onap/cli/sample/yaml/SampleYamlGenerator.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'validate/sample-yaml-generator/src/main') diff --git a/validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java b/validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java index 9a59cdf6..df4c3f6e 100644 --- a/validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java +++ b/validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java @@ -41,9 +41,9 @@ public class SampleYamlGenerator { writeKey(writer, "sample1"); writeKeyValuePair(writer, "name", cmdName); - writeKeyValuePair(writer, "input", input.stream().skip(1).collect(Collectors.joining(" "))); + writeKeyValuePair(writer, "input", input.stream().skip(1).collect(Collectors.joining(" ")).trim()); writeKeyValuePair(writer, "moco", new File(targetPath).getName().replaceAll("-sample.yaml", "-moco.json")); - writeMultilineKeyValue(writer, "ouput", ouput, debug); + writeMultilineKeyValue(writer, "ouput", ouput.trim(), debug); writeEndKey(); writeEndKey(); @@ -53,7 +53,11 @@ public class SampleYamlGenerator { } private static void writeMultilineKeyValue(PrintWriter writer, String key, String value, boolean debug) { - writer.write(printTabs() + key + ": |\n"); + writer.write(printTabs() + key + ":"); + if (value.isEmpty()) { + return; + } + writer.write("|\n"); nTab++; String[] lines = value.split("\n"); long skipLines = debug ? 12 : 0; -- cgit 1.2.3-korg