From 7e75fc9854ce7e1bf34785b60dd15c16bd302882 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 18 Oct 2023 17:47:46 +0000 Subject: [PATCH 1/6] fix(deps): update dependency org.spockframework:spock-core to v2.3-groovy-4.0 --- gradle/libs.versions.toml | 2 +- gradle/verification-metadata.xml | 35 ++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 47eec467..1d44b01f 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -6,7 +6,7 @@ lombok = "1.18.30" jaxb = "2.3.8" junit = "4.13.2" groovy = "3.0.15" -spock = "2.1-groovy-3.0" +spock = "2.3-groovy-4.0" axion = "1.15.5" nexusPublish = "1.3.0" shadow = "7.1.2" diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 40e56e35..b2e6d347 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -12,6 +12,7 @@ + @@ -67,7 +68,10 @@ - + + + + @@ -78,6 +82,7 @@ + @@ -114,13 +119,17 @@ - + + + + + @@ -2269,6 +2278,11 @@ + + + + + @@ -2311,6 +2325,14 @@ + + + + + + + + @@ -2327,6 +2349,14 @@ + + + + + + + + @@ -4732,6 +4762,7 @@ + From 27859e4ebd80b823987cf91becdc3bbcdea90ee5 Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Fri, 30 Aug 2024 10:02:03 -0700 Subject: [PATCH 2/6] update groovy to 4.0.22 --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 1d44b01f..69065c6b 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,7 +5,7 @@ okhttp = "4.11.0" lombok = "1.18.30" jaxb = "2.3.8" junit = "4.13.2" -groovy = "3.0.15" +groovy = "4.0.22" spock = "2.3-groovy-4.0" axion = "1.15.5" nexusPublish = "1.3.0" From 6e32998903748011e32a2d9b088243768fa7459f Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Fri, 30 Aug 2024 14:52:33 -0700 Subject: [PATCH 3/6] groovy 4 package name change --- gradle/libs.versions.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 69065c6b..bc4a7105 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -38,7 +38,7 @@ okhttpMockwebserver = { module = "com.squareup.okhttp3:mockwebserver", version.r jaxb = { module = "com.sun.xml.bind:jaxb-impl", version.ref = "jaxb" } junit = { module = "junit:junit", version.ref = "junit" } -groovy = { module = "org.codehaus.groovy:groovy-all", version.ref = "groovy" } +groovy = { module = "org.apache.groovy:groovy-all", version.ref = "groovy" } spock = { module = "org.spockframework:spock-core", version.ref = "spock" } jacksonDatabind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jacksonDatabind" } From 5a8ab60b626896111e3d308f2cc894d65457262d Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Mon, 9 Sep 2024 13:39:24 -0700 Subject: [PATCH 4/6] fix conflict with boolean/string getter groovy 4 seems to select isProject using .project notation, then coerces the boolean to string 'true' --- .../main/java/org/rundeck/client/tool/commands/Executions.java | 2 +- .../org/rundeck/client/tool/options/ProjectNameOptions.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/Executions.java b/rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/Executions.java index 22eab927..fd1d57e2 100644 --- a/rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/Executions.java +++ b/rd-cli-tool/src/main/java/org/rundeck/client/tool/commands/Executions.java @@ -735,7 +735,7 @@ public void metrics(@CommandLine.Mixin MetricsCmd options) throws IOException, I MetricsResponse result; // Case project wire. - if (options.isProject()) { + if (options.hasProject()) { // Get response. result = apiCall(api -> api.executionMetrics( options.getProject(), diff --git a/rd-cli-tool/src/main/java/org/rundeck/client/tool/options/ProjectNameOptions.java b/rd-cli-tool/src/main/java/org/rundeck/client/tool/options/ProjectNameOptions.java index 4bee5a3d..5e2c7eb0 100644 --- a/rd-cli-tool/src/main/java/org/rundeck/client/tool/options/ProjectNameOptions.java +++ b/rd-cli-tool/src/main/java/org/rundeck/client/tool/options/ProjectNameOptions.java @@ -34,7 +34,7 @@ public class ProjectNameOptions implements ProjectInput { ) private String project; - public boolean isProject() { + public boolean hasProject() { return project != null; } From 1e81c432775e2814b53214bd613dbd5f34c4d573 Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Mon, 9 Sep 2024 13:40:13 -0700 Subject: [PATCH 5/6] fix compile error in groovy 4 --- .../rundeck/client/tool/commands/ExecutionsSpec.groovy | 2 +- .../org/rundeck/client/tool/commands/JobsSpec.groovy | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/ExecutionsSpec.groovy b/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/ExecutionsSpec.groovy index a523631b..fca1ad90 100644 --- a/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/ExecutionsSpec.groovy +++ b/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/ExecutionsSpec.groovy @@ -417,7 +417,7 @@ class ExecutionsSpec extends Specification { (doesapi?1:0) * api.deleteAllJobExecutions('jobid') >> Calls.response( new BulkExecutionDeleteResponse( allsuccessful:allsuccess, - failures: allsuccess?[]:[new BulkExecutionDeleteResponse.DeleteFailure(id:'jobid',message:'amessage')] + failures: allsuccess ? [] : [new BulkExecutionDeleteResponse.DeleteFailure(id: 'jobid', message: 'amessage')] ) ) diff --git a/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/JobsSpec.groovy b/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/JobsSpec.groovy index cae81019..6bd9d600 100644 --- a/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/JobsSpec.groovy +++ b/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/JobsSpec.groovy @@ -246,7 +246,7 @@ class JobsSpec extends Specification { then: 1 * api.listJobs('ProjectName', job, null,null,null) >> Calls.response([new JobItem(id: 'fakeid')]) - 1 * api.deleteJobsBulk({ it.ids == ['fakeid'] }) >> Calls.response(new DeleteJobsResult(allsuccessful: allsuccess, failed: allsuccess?[]:[new DeleteJob(id:'fakeid')])) + 1 * api.deleteJobsBulk({ it.ids == ['fakeid'] }) >> Calls.response(new DeleteJobsResult(allsuccessful: allsuccess, failed: allsuccess ? [] : [new DeleteJob(id: 'fakeid')])) 0 * api._(*_) result == exit @@ -597,7 +597,7 @@ class JobsSpec extends Specification { then: 1 * api.bulkEnableJobs(_) >> Calls.response(new BulkToggleJobExecutionResponse( allsuccessful: issuccess, - failed: issuccess?[]:[new BulkToggleJobExecutionResponse.Result()] + failed: issuccess ? [] : [new BulkToggleJobExecutionResponse.Result()] )) 0 * api._(*_) result == exit @@ -625,7 +625,7 @@ class JobsSpec extends Specification { then: 1 * api.bulkDisableJobs(_) >> Calls.response(new BulkToggleJobExecutionResponse( allsuccessful: issuccess, - failed: issuccess?[]:[new BulkToggleJobExecutionResponse.Result()] + failed: issuccess ? [] : [new BulkToggleJobExecutionResponse.Result()] )) 0 * api._(*_) result == exit @@ -653,7 +653,7 @@ class JobsSpec extends Specification { then: 1 * api.bulkEnableJobSchedule(_) >> Calls.response(new BulkToggleJobScheduleResponse( allsuccessful: issuccess, - failed: issuccess?[]:[new BulkToggleJobScheduleResponse.Result()] + failed: issuccess ? [] : [new BulkToggleJobScheduleResponse.Result()] )) 0 * api._(*_) result == exit @@ -681,7 +681,7 @@ class JobsSpec extends Specification { then: 1 * api.bulkDisableJobSchedule(_) >> Calls.response(new BulkToggleJobScheduleResponse( allsuccessful: issuccess, - failed: issuccess?[]:[new BulkToggleJobScheduleResponse.Result()] + failed: issuccess ? [] : [new BulkToggleJobScheduleResponse.Result()] )) 0 * api._(*_) result == exit From 41a0ed727ce032b8948892f2b4351859b7bff67c Mon Sep 17 00:00:00 2001 From: Greg Schueler Date: Mon, 9 Sep 2024 13:40:50 -0700 Subject: [PATCH 6/6] fix mocking failure for non-interface type --- .../client/tool/commands/KeysSpec.groovy | 54 ++++++++----------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/KeysSpec.groovy b/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/KeysSpec.groovy index ff76a801..593e0fa0 100644 --- a/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/KeysSpec.groovy +++ b/rd-cli-tool/src/test/groovy/org/rundeck/client/tool/commands/KeysSpec.groovy @@ -35,12 +35,10 @@ class KeysSpec extends Specification { File testfile = File.createTempFile('KeysSpec', '.test') testfile.text = input - def opts = Mock(Keys.Upload) { - getPath() >> new Keys.Path('keys/test1') - getType() >> KeyStorageItem.KeyFileType.password - getFile() >> testfile - isFile() >> true - } + def opts = new Keys.Upload() + opts.path = new Keys.Path('keys/test1') + opts.type = KeyStorageItem.KeyFileType.password + opts.file = testfile when: def body = Keys.prepareKeyUpload(opts) @@ -64,14 +62,12 @@ class KeysSpec extends Specification { File testfile = File.createTempFile('KeysSpec', '.test') testfile.setText(input, charset) - def opts = Mock(Keys.Upload) { - getPath() >> new Keys.Path('keys/test1') - getType() >> KeyStorageItem.KeyFileType.password - getFile() >> testfile - isFile() >> true - getCharset() >> charset - isCharset() >> true - } + def opts = new Keys.Upload() + opts.path = new Keys.Path('keys/test1') + opts.type = KeyStorageItem.KeyFileType.password + opts.file = testfile + opts.charset = charset + when: def body = Keys.prepareKeyUpload(opts) @@ -93,12 +89,10 @@ class KeysSpec extends Specification { File testfile = File.createTempFile('KeysSpec', '.test') testfile.text = input - def opts = Mock(Keys.Upload) { - getPath() >> new Keys.Path('keys/test1') - getType() >> KeyStorageItem.KeyFileType.password - getFile() >> testfile - isFile() >> true - } + def opts = new Keys.Upload() + opts.path = new Keys.Path('keys/test1') + opts.type = KeyStorageItem.KeyFileType.password + opts.file = testfile when: def body = Keys.prepareKeyUpload(opts) @@ -117,12 +111,10 @@ class KeysSpec extends Specification { def "create password require file or prompt"() { given: - def opts = Mock(Keys.Upload) { - getPath() >> new Keys.Path('keys/test1') - getType() >> type - isFile() >> false - isPrompt() >> false - } + def opts = new Keys.Upload() + opts.path = new Keys.Path('keys/test1') + opts.type = type + opts.prompt = prompt when: def body = Keys.prepareKeyUpload(opts) @@ -139,12 +131,10 @@ class KeysSpec extends Specification { def "create #type require file"() { given: - def opts = Mock(Keys.Upload) { - getPath() >> new Keys.Path('keys/test1') - getType() >> type - isFile() >> false - isPrompt() >> prompt - } + def opts = new Keys.Upload() + opts.path = new Keys.Path('keys/test1') + opts.type = type + opts.prompt = prompt when: def body = Keys.prepareKeyUpload(opts)