aboutsummaryrefslogtreecommitdiffstats
path: root/validate
diff options
context:
space:
mode:
Diffstat (limited to 'validate')
-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");
}
}