From de9194ec53720489d3cccd2a2097a5206ea00ada Mon Sep 17 00:00:00 2001 From: psmf22 <117990501+psmf22@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:35:47 +0100 Subject: [PATCH 1/2] chore: moved versionhandlingtest to functional tests --- .gitignore | 1 + .../versionHandling/VersionHandlingTest.java | 28 ------------- .../cli/ftest/tool/ToolFoDUploaderSpec.groovy | 41 ++++++++++++++++++- 3 files changed, 41 insertions(+), 29 deletions(-) delete mode 100644 fcli-core/fcli-tool/src/test/java/com/fortify/cli/tool/versionHandling/VersionHandlingTest.java diff --git a/.gitignore b/.gitignore index e6d472f6e5..9c632cbd29 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ fcli.log /ReportTemplateDefAnswerTemplate.y*ml* /*.rptdesign *.log +fcli-core/fcli-tool/src/main/resources/com/fortify/cli/tool/config/tool-definitions.yaml.zip diff --git a/fcli-core/fcli-tool/src/test/java/com/fortify/cli/tool/versionHandling/VersionHandlingTest.java b/fcli-core/fcli-tool/src/test/java/com/fortify/cli/tool/versionHandling/VersionHandlingTest.java deleted file mode 100644 index d5a45c11fd..0000000000 --- a/fcli-core/fcli-tool/src/test/java/com/fortify/cli/tool/versionHandling/VersionHandlingTest.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.fortify.cli.tool.versionHandling; - -import org.junit.jupiter.api.Test; - -import com.fortify.cli.tool._common.helper.ToolHelper; - -import org.junit.jupiter.api.Assertions; - - -public class VersionHandlingTest { - String toolName = "fod-uploader"; - - @Test - public void testVersionHandling() throws Exception { - - var downloadDescriptor = ToolHelper.getToolDownloadDescriptor(toolName);; - var d = downloadDescriptor.getVersion("5"); - //var d2 = downloadDescriptor.getVersion("20."); - var d3 = downloadDescriptor.getVersion("5.0"); - var d4 = downloadDescriptor.getVersion("5.0.0"); - - Assertions.assertEquals(d.getVersion(), "5.4.0"); - //Assertions.assertEquals(d2.getVersion(), "20.2.4"); - Assertions.assertEquals(d3.getVersion(), "5.0.1"); - Assertions.assertEquals(d4.getVersion(), "5.0.0"); - } -} - diff --git a/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/tool/ToolFoDUploaderSpec.groovy b/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/tool/ToolFoDUploaderSpec.groovy index 78227c3231..5b59a0d68c 100644 --- a/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/tool/ToolFoDUploaderSpec.groovy +++ b/fcli-other/fcli-functional-test/src/ftest/groovy/com/fortify/cli/ftest/tool/ToolFoDUploaderSpec.groovy @@ -28,7 +28,7 @@ import spock.lang.Stepwise @Prefix("tool.fod-uploader") @Stepwise class ToolFoDUploaderSpec extends FcliBaseSpec { - def "install"() { + def "installLatest"() { def args = "tool fod-uploader install -y -v=latest" when: def result = Fcli.run(args) @@ -66,4 +66,43 @@ class ToolFoDUploaderSpec extends FcliBaseSpec { } } + def "installV5"() { + def args = "tool fod-uploader install -y -v=5" + when: + def result = Fcli.run(args) + then: + verifyAll(result.stdout) { + size()>0 + it[0].replace(' ', '').equals("NameVersionDefaultInstalledInstalldirBindirAction") + it[1].replace(" ", "").contains("5.4.0") + it[1].contains("INSTALLED") + } + } + + def "installV50"() { + def args = "tool fod-uploader install -y -v=5.0" + when: + def result = Fcli.run(args) + then: + verifyAll(result.stdout) { + size()>0 + it[0].replace(' ', '').equals("NameVersionDefaultInstalledInstalldirBindirAction") + it[1].replace(" ", "").contains("5.0.1") + it[1].contains("INSTALLED") + } + } + + def "installV500"() { + def args = "tool fod-uploader install -y -v=5.0.0" + when: + def result = Fcli.run(args) + then: + verifyAll(result.stdout) { + size()>0 + it[0].replace(' ', '').equals("NameVersionDefaultInstalledInstalldirBindirAction") + it[1].replace(" ", "").contains("5.0.0") + it[1].contains("INSTALLED") + } + } + } From 9b9827d568706fa6f2b9e2a5b7679af898febb20 Mon Sep 17 00:00:00 2001 From: psmf22 <117990501+psmf22@users.noreply.github.com> Date: Tue, 16 Jan 2024 10:54:33 +0100 Subject: [PATCH 2/2] chore: Update .gitignore --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9c632cbd29..42bab027ab 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,9 @@ build/ # We want to include everything in our functional test resources !**/ftest/resources/runtime/**/* +# automatically downloaded during gradle build +fcli-core/fcli-tool/src/main/resources/com/fortify/cli/tool/config/tool-definitions.yaml.zip + ### STS ### .apt_generated .classpath @@ -60,4 +63,3 @@ fcli.log /ReportTemplateDefAnswerTemplate.y*ml* /*.rptdesign *.log -fcli-core/fcli-tool/src/main/resources/com/fortify/cli/tool/config/tool-definitions.yaml.zip