diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 47eec467..bc4a7105 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -5,8 +5,8 @@ okhttp = "4.11.0" lombok = "1.18.30" jaxb = "2.3.8" junit = "4.13.2" -groovy = "3.0.15" -spock = "2.1-groovy-3.0" +groovy = "4.0.22" +spock = "2.3-groovy-4.0" axion = "1.15.5" nexusPublish = "1.3.0" shadow = "7.1.2" @@ -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" } 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 @@ + 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; } 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 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)