aboutsummaryrefslogtreecommitdiffstats
path: root/validate
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-27 10:04:03 +0530
committerKanagaraj Manickam <kanagaraj.manickam@huawei.com>2017-10-27 04:51:50 +0000
commit9f140e6123cc99f943d3545df04346a2f2382aec (patch)
treea4d2c79a39dcf97d54434215724714b51a9225ba /validate
parent01ff254b5e1cb9c322f536bb98b5ec6517d73029 (diff)
Remove white-spaces in sample generation
CLI-57 Change-Id: I4796efbd020a8342f8abf69a156919c9ca095c2e Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'validate')
-rw-r--r--validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java10
1 files changed, 7 insertions, 3 deletions
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;