summaryrefslogtreecommitdiffstats
path: root/validate/sample-yaml-generator/src
diff options
context:
space:
mode:
authorKanagaraj M <mkr1481@gmail.com>2019-09-30 06:19:30 +0200
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2019-09-30 06:45:54 +0200
commit08f6cbf5307459ac3e91fc2c98f9b76010b23d4a (patch)
treebbacf435b123328961858076e948d83c89b723f6 /validate/sample-yaml-generator/src
parent6e167e934b0d384a3c588cfc88c583bdddd1bfaa (diff)
Fix ovp lcm validation
Issue-ID: CLI-166 Change-Id: I0c8def49c6d3eb79d4686b40899ff165ae2461ce Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Diffstat (limited to 'validate/sample-yaml-generator/src')
-rw-r--r--validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java7
-rw-r--r--validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java2
2 files changed, 6 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 b2e2dc88..37c51401 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
@@ -28,15 +28,18 @@ public class SampleYamlGenerator {
static int nTab;
public static void generateSampleYaml(String cmdName, List<String> input, String output, String version,
- String targetPath, boolean debug) throws IOException {
+ String targetPath, boolean debug, String name) throws IOException {
PrintWriter writer = new PrintWriter(targetPath, "UTF-8");
writeKeyValuePair(writer, "open_cli_sample_version", "1.0");
writeKeyValuePair(writer, "name", cmdName);
writeKeyValuePair(writer, "version", version);
+ if (name == null) {
+ name = "sample1";
+ }
writeKey(writer, "samples");
- writeKey(writer, "sample1");
+ writeKey(writer, name);
writeKeyValuePair(writer, "name", cmdName);
writeKeyValuePair(writer, "input", input.stream().collect(Collectors.joining(" ")).trim());
diff --git a/validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java b/validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java
index fba93e62..cd395833 100644
--- a/validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java
+++ b/validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java
@@ -26,7 +26,7 @@ public class SampleYamlGeneratorTest {
@Test
public void testGenerateSampleYaml() throws IOException {
SampleYamlGenerator.generateSampleYaml("testcmd", Arrays.asList("-a", "argument"),
- "+--------+\n+val +\n+argument+", "test-version-1.0", "target/test.yaml", false);
+ "+--------+\n+val +\n+argument+", "test-version-1.0", "target/test.yaml", false, "sample1");
}
}