aboutsummaryrefslogtreecommitdiffstats
path: root/validate/sample-yaml-generator
diff options
context:
space:
mode:
Diffstat (limited to 'validate/sample-yaml-generator')
-rw-r--r--validate/sample-yaml-generator/pom.xml14
-rw-r--r--validate/sample-yaml-generator/src/main/java/org/onap/cli/sample/yaml/SampleYamlGenerator.java8
-rw-r--r--validate/sample-yaml-generator/src/test/java/org/onap/cli/sample/yaml/SampleYamlGeneratorTest.java2
3 files changed, 17 insertions, 7 deletions
diff --git a/validate/sample-yaml-generator/pom.xml b/validate/sample-yaml-generator/pom.xml
index 400d72f1..c9503c5e 100644
--- a/validate/sample-yaml-generator/pom.xml
+++ b/validate/sample-yaml-generator/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.cli</groupId>
<artifactId>cli-validate</artifactId>
- <version>3.0.0</version>
+ <version>4.0.0-SNAPSHOT</version>
</parent>
<artifactId>cli-sample-yaml-generator</artifactId>
@@ -38,6 +38,18 @@
<version>4.11</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit</artifactId>
+ <version>1.19</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jmockit</groupId>
+ <artifactId>jmockit-coverage</artifactId>
+ <version>1.19</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
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 179eaa36..b2e2dc88 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
@@ -27,11 +27,9 @@ public class SampleYamlGenerator {
static int nTab;
- public static void generateSampleYaml(List<String> input, String output, String version,
+ public static void generateSampleYaml(String cmdName, List<String> input, String output, String version,
String targetPath, boolean debug) throws IOException {
- String cmdName = input.get(0);
-
PrintWriter writer = new PrintWriter(targetPath, "UTF-8");
writeKeyValuePair(writer, "open_cli_sample_version", "1.0");
writeKeyValuePair(writer, "name", cmdName);
@@ -41,7 +39,7 @@ public class SampleYamlGenerator {
writeKey(writer, "sample1");
writeKeyValuePair(writer, "name", cmdName);
- writeKeyValuePair(writer, "input", input.stream().skip(1).collect(Collectors.joining(" ")).trim());
+ writeKeyValuePair(writer, "input", input.stream().collect(Collectors.joining(" ")).trim());
writeKeyValuePair(writer, "moco", new File(targetPath).getName().replaceAll("-sample.yaml", "-moco.json"));
writeMultilineKeyValue(writer, "output", output.trim(), debug);
@@ -60,7 +58,7 @@ public class SampleYamlGenerator {
writer.write(" |\n");
nTab++;
String[] lines = value.split("\n");
- long skipLines = debug ? 11 : 0;
+ long skipLines = debug ? 0 : 0;
Arrays.stream(lines).skip(skipLines ).forEach(line -> writer.write(printTabs() + line + "\n")); // NOSONAR
}
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 98c0ce9d..fba93e62 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
@@ -25,7 +25,7 @@ public class SampleYamlGeneratorTest {
@Test
public void testGenerateSampleYaml() throws IOException {
- SampleYamlGenerator.generateSampleYaml(Arrays.asList("testcmd", "-a", "argument"),
+ SampleYamlGenerator.generateSampleYaml("testcmd", Arrays.asList("-a", "argument"),
"+--------+\n+val +\n+argument+", "test-version-1.0", "target/test.yaml", false);
}