diff options
Diffstat (limited to 'mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java')
-rw-r--r-- | mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java | 122 |
1 files changed, 93 insertions, 29 deletions
diff --git a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java index d10d3ff..a0cf04a 100644 --- a/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java +++ b/mod/bpgenerator/onap/src/test/java/org/onap/blueprintgenerator/test/BlueprintJarComparatorTest.java @@ -21,7 +21,6 @@ * */ - package org.onap.blueprintgenerator.test; import org.apache.commons.io.FileUtils; @@ -37,15 +36,11 @@ import java.io.File; import java.io.IOException; import java.nio.file.Paths; - /** * @author : Ravi Mantena - * @date 10/16/2020 - * Application: ONAP - Blueprint Generator - * ONAP Bueprint Jar Comparision with Previos version to make sure Bps are not broken with new changes + * @date 10/16/2020 Application: ONAP - Blueprint Generator ONAP Bueprint Jar Comparision with + * Blueprint Comparator using preious and new Jar files to make sure the new code doesnt break previous changes. */ - - @Ignore @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class BlueprintJarComparatorTest extends BlueprintGeneratorTests { @@ -55,15 +50,19 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests { private String previousVersion = "0_1"; private String latestVersion = "1_0"; private String latestJarPath = Paths.get("target").toAbsolutePath().toString() + "\\"; - private String previousJarPath = Paths.get("src", "test", "resources", "archives").toAbsolutePath().toString() + "\\"; - private String inputPath = Paths.get("src", "test", "resources", "componentspecs").toAbsolutePath().toString() + "\\"; - private String inputPolicyPath = Paths.get("src", "test", "resources", "policyjson").toAbsolutePath().toString() + "\\"; - private String outputPath = Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString() + "\\"; + private String previousJarPath = + Paths.get("src", "test", "resources", "archives").toAbsolutePath().toString() + "\\"; + private String inputPath = + Paths.get("src", "test", "resources", "componentspecs").toAbsolutePath().toString() + "\\"; + private String inputPolicyPath = + Paths.get("src", "test", "resources", "policyjson").toAbsolutePath().toString() + "\\"; + private String outputPath = + Paths.get("src", "test", "resources", "outputfiles").toAbsolutePath().toString() + "\\"; private String previousJar = "onap-blueprint-generator-" + previousJarVersion + ".jar"; private String latestJar = "onap-blueprint-generator-" + latestJarVersion + ".jar"; @Test - @Order(value=1) + @Order(value = 1) public void filesCleanup() throws IOException { FileUtils.deleteDirectory(new File(outputPath)); } @@ -74,19 +73,54 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests { String outputFileName = "dcae-ves-collector-dmaap-"; String inputImportsFileName = testImports; - String previousJarCommand = "java -jar " + previousJarPath + previousJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath + - " -n " + outputFileName + previousVersion + " -t " + inputPath + inputImportsFileName + " -d"; + String previousJarCommand = + "java -jar " + + previousJarPath + + previousJar + + " app ONAP -i " + + inputPath + + inputFileName + + " -p " + + outputPath + + " -n " + + outputFileName + + previousVersion + + " -t " + + inputPath + + inputImportsFileName + + " -d"; Runtime.getRuntime().exec(previousJarCommand); - String latestJarCommand = "java -jar " + latestJarPath + latestJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath + - " -n " + outputFileName + latestVersion + " -t " + inputPath + inputImportsFileName + " -d"; + String latestJarCommand = + "java -jar " + + latestJarPath + + latestJar + + " app ONAP -i " + + inputPath + + inputFileName + + " -p " + + outputPath + + " -n " + + outputFileName + + latestVersion + + " -t " + + inputPath + + inputImportsFileName + + " -d"; Runtime.getRuntime().exec(latestJarCommand); Thread.sleep(8000); - Assert.assertEquals("The BluePrint files (" + outputFileName + ") for " + inputFileName + " with -m option don't match!", - FileUtils.readFileToString(new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"), - FileUtils.readFileToString(new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8")); + Assert.assertEquals( + "The BluePrint files (" + + outputFileName + + ") for " + + inputFileName + + " with -m option don't match!", + FileUtils.readFileToString( + new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"), + FileUtils.readFileToString( + new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8")); } @Test @@ -95,21 +129,51 @@ public class BlueprintJarComparatorTest extends BlueprintGeneratorTests { String outputFileName = "dcae-ves-collector-"; String inputImportsFileName = testImports; - String previousJarCommand = "java -jar " + previousJarPath + previousJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath + - " -n " + outputFileName + previousVersion + " -t " + inputPath + inputImportsFileName ; + String previousJarCommand = + "java -jar " + + previousJarPath + + previousJar + + " app ONAP -i " + + inputPath + + inputFileName + + " -p " + + outputPath + + " -n " + + outputFileName + + previousVersion + + " -t " + + inputPath + + inputImportsFileName; Runtime.getRuntime().exec(previousJarCommand); - String latestJarCommand = "java -jar " + latestJarPath + latestJar + " app ONAP -i " + inputPath + inputFileName + " -p " + outputPath + - " -n " + outputFileName + latestVersion + " -t " + inputPath + inputImportsFileName ; + String latestJarCommand = + "java -jar " + + latestJarPath + + latestJar + + " app ONAP -i " + + inputPath + + inputFileName + + " -p " + + outputPath + + " -n " + + outputFileName + + latestVersion + + " -t " + + inputPath + + inputImportsFileName; Runtime.getRuntime().exec(latestJarCommand); Thread.sleep(8000); - Assert.assertEquals("The BluePrint files (" + outputFileName + ") for " + inputFileName + " with -m option dont match!", - FileUtils.readFileToString(new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"), - FileUtils.readFileToString(new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8")); + Assert.assertEquals( + "The BluePrint files (" + + outputFileName + + ") for " + + inputFileName + + " with -m option dont match!", + FileUtils.readFileToString( + new File(outputPath + outputFileName + previousVersion + ".yaml"), "utf-8"), + FileUtils.readFileToString( + new File(outputPath + outputFileName + latestVersion + ".yaml"), "utf-8")); } - - } - |