DslScriptLoader to test Automatically generated DSL

563 views
Skip to first unread message

sam...@puppet.com

unread,
Aug 4, 2016, 6:25:58 PM8/4/16
to job-dsl-plugin
I am using gradle to test that groovy scripts are valid and building.

One of my scripts contains an element representing an 'Automatically Generated DSL' as per https://github.com/jenkinsci/job-dsl-plugin/wiki/Automatically-Generated-DSL that works on a real jenkins but not in the tests. Is that possible?

The groovy script simply has a listview with a column from a plugin called next-execution and the autogenerated dsl is simply
nextExecutionColumn()

as in:
listView("All") {
jobs {
regex(".*abc.*")
}
columns {
configureProject()
buildButton()
name()
lastSuccess()
lastFailure()
nextExecutionColumn()
status()
weather()
}
}


I have added in the gradle file
testPlugins 'org.jenkins-ci.plugins:next-executions:1.0.11'
so that the plugin is loaded on the test jenkins

It fails to test it with
Caused by: javaposse.jobdsl.dsl.DslScriptException: (script, line 139) No signature of method: javaposse.jobdsl.dsl.views.ColumnsContext.nextExecutionColumn() is applicable for argument types: () values: []
	at javaposse.jobdsl.dsl.DslScriptLoader.runScriptEngine(DslScriptLoader.groovy:135)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader_closure1(DslScriptLoader.groovy:78)
	at groovy.lang.Closure.call(Closure.java:414)
	at groovy.lang.Closure.call(Closure.java:430)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScriptsWithClassLoader(DslScriptLoader.groovy:68)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScripts(DslScriptLoader.groovy:44)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScript(DslScriptLoader.groovy:58)
	at com.puppet.JobScriptsSpec.test script #file.name(JobScriptSpec.groovy:35)
Caused by: groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.dsl.views.ColumnsContext.nextExecutionColumn() is applicable for argument types: () values: []

Daniel Spilker

unread,
Aug 8, 2016, 7:51:55 PM8/8/16
to job-dsl...@googlegroups.com
See the wiki for testing Automatically Generated DSL:
https://github.com/jenkinsci/job-dsl-plugin/wiki/Testing-DSL-Scripts

Daniel

--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.
To post to this group, send email to job-dsl-plugin@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/c2d1e328-64db-40c1-98a5-707988aadc39%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Samuel Beaulieu

unread,
Aug 9, 2016, 4:55:36 AM8/9/16
to job-dsl...@googlegroups.com
If anyone sees this issue my mistake was to use a 'MemoryJobManagement' instead of a 'JenkinsJobManagement'. I suppose the former does process the autogenerated DSL coming from plugins like the next-execution plugin.


To post to this group, send email to job-dsl...@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "job-dsl-plugin" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/job-dsl-plugin/95v84Z-Pyu0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to job-dsl-plugin+unsubscribe@googlegroups.com.

To post to this group, send email to job-dsl-plugin@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages