summaryrefslogtreecommitdiffstats
path: root/validate/sample-yaml-generator/src
diff options
context:
space:
mode:
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-26 19:36:45 +0530
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>2017-10-26 19:56:43 +0530
commitef7de3edf23a0c6fba6e6fb3e175798adc532d78 (patch)
tree56ec5aae3b083acc147c9137ab2733caddef6bc8 /validate/sample-yaml-generator/src
parentb0d8aa12fe8f88059f7fcce741913194d72d0d69 (diff)
Fix the sample file name align with schema
CLI-55 Change-Id: I84533921d6a2bbfd818e0c68b723d6f131a21b2c 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, 5 insertions, 4 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 5c308154..eb1c411b 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
@@ -16,6 +16,7 @@
package org.onap.cli.sample.yaml;
+import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;
@@ -27,11 +28,11 @@ public class SampleYamlGenerator {
static int nTab;
public static void generateSampleYaml(List<String> input, String ouput, String version,
- String targetFolder, boolean debug) throws IOException {
+ String targetPath, boolean debug) throws IOException {
String cmdName = input.get(0);
- PrintWriter writer = new PrintWriter(targetFolder + "/" + cmdName + "-sample.yaml", "UTF-8");
+ PrintWriter writer = new PrintWriter(targetPath, "UTF-8");
writeKeyValuePair(writer, "onap_cli_sample_version", "1.0");
writeKeyValuePair(writer, "name", cmdName);
writeKeyValuePair(writer, "version", version);
@@ -41,7 +42,7 @@ public class SampleYamlGenerator {
writeKeyValuePair(writer, "name", cmdName);
writeKeyValuePair(writer, "input", input.stream().skip(1).collect(Collectors.joining(" ")));
- writeKeyValuePair(writer, "moco", cmdName + "-sample-yaml.yaml");
+ writeKeyValuePair(writer, "moco", new File(targetPath).getName().replaceAll("-sample.yaml", "-moco.json"));
writeMultilineKeyValue(writer, "ouput", ouput, debug);
writeEndKey();
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 c98cb71b..98c0ce9d 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(Arrays.asList("testcmd", "-a", "argument"),
- "+--------+\n+val +\n+argument+", "test-version-1.0", "target", false);
+ "+--------+\n+val +\n+argument+", "test-version-1.0", "target/test.yaml", false);
}
}