From 7a663317f756bebce6b16877266d2f7e14368116 Mon Sep 17 00:00:00 2001 From: Evan Farrell Date: Mon, 17 Jun 2019 14:48:20 -0400 Subject: [PATCH] Added test and extra if to fix #4959 --- .../domain/rundeck/ScheduledExecution.groovy | 2 +- .../src/test/groovy/JobsXMLCodecTests.groovy | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletion(-) diff --git a/rundeckapp/grails-app/domain/rundeck/ScheduledExecution.groovy b/rundeckapp/grails-app/domain/rundeck/ScheduledExecution.groovy index 555cbe0be73..b6bf7e7ffe2 100644 --- a/rundeckapp/grails-app/domain/rundeck/ScheduledExecution.groovy +++ b/rundeckapp/grails-app/domain/rundeck/ScheduledExecution.groovy @@ -464,7 +464,7 @@ class ScheduledExecution extends ExecutionContext { se.year = '*' } if(data.schedule.dayofmonth && data.schedule.dayofmonth instanceof Map - && null !=data.schedule.dayofmonth.day){ + && null !=data.schedule.dayofmonth.day && '?' != data.schedule.dayofmonth.day){ se.dayOfMonth = data.schedule.dayofmonth.day se.dayOfWeek = '?' }else if(data.schedule.weekday && data.schedule.weekday instanceof Map diff --git a/rundeckapp/src/test/groovy/JobsXMLCodecTests.groovy b/rundeckapp/src/test/groovy/JobsXMLCodecTests.groovy index 0eee409ce95..9767c9ae8b8 100644 --- a/rundeckapp/src/test/groovy/JobsXMLCodecTests.groovy +++ b/rundeckapp/src/test/groovy/JobsXMLCodecTests.groovy @@ -1871,6 +1871,52 @@ void testDecodeBasic__no_group(){ assertEquals("*",jobs[0].year) } + /** + * Test weekday + */ + void testDecodeScheduledWeekday(){ + def jobs = JobsXMLCodec.decode(""" + + 5 + wait1 + a simple desc + INFO + some/group + + test1 + + + + test + + 1 + false + + + + + +""") + assertNotNull jobs + assertEquals "incorrect size", 1, jobs.size() + + assertEquals "incorrect scheduled", "true", jobs[0].scheduled.toString() + assertNull "incorrect scheduled", jobs[0].crontabString + assertEquals("*/4",jobs[0].hour) + assertEquals("21",jobs[0].minute) + assertEquals("0",jobs[0].seconds) + assertEquals("2-4",jobs[0].dayOfWeek) + assertEquals("?",jobs[0].dayOfMonth) + assertEquals("*/6",jobs[0].month) + assertEquals("*",jobs[0].year) + + }