Skip to content

Commit 68790d3

Browse files
author
Rob Langley
committed
Plots - add tests for XML filetypes
1 parent 81b8982 commit 68790d3

File tree

1 file changed

+83
-0
lines changed

1 file changed

+83
-0
lines changed

job-dsl-core/src/test/groovy/javaposse/jobdsl/dsl/helpers/publisher/PublisherContextSpec.groovy

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3202,6 +3202,89 @@ class PublisherContextSpec extends Specification {
32023202
chart << ['area', 'bar', 'bar3d', 'line', 'line3d', 'stackedArea', 'stackedbar', 'stackedbar3d', 'waterfall']
32033203
}
32043204

3205+
def 'call plotPlugin with a xml series'() {
3206+
when:
3207+
context.plotBuildData {
3208+
plot('my group', 'some.csv') {
3209+
xmlFile('data.prop')
3210+
}
3211+
}
3212+
3213+
then:
3214+
with(context.publisherNodes[0]) {
3215+
name() == 'hudson.plugins.plot.PlotPublisher'
3216+
children().size() == 1
3217+
with(plots.'hudson.plugins.plot.Plot'[0]) {
3218+
children().size() == 12
3219+
title[0].value().empty
3220+
yaxis[0].value().empty
3221+
group[0].value() == 'my group'
3222+
numBuilds[0].value().empty
3223+
csvFileName[0].value() == 'some.csv'
3224+
csvLastModification[0].value() == 0
3225+
style[0].value() == 'line'
3226+
useDescr[0].value() == false
3227+
keepRecords[0].value() == false
3228+
exclZero[0].value() == false
3229+
logarithmic[0].value() == false
3230+
with(series[0].'hudson.plugins.plot.XMLSeries'[0]) {
3231+
children().size() == 6
3232+
file[0].value() == 'data.prop'
3233+
label[0].value() == ''
3234+
fileType[0].value() == 'xml'
3235+
nodeTypeString[0].value() == 'NODESET'
3236+
url[0].value() == ''
3237+
xpathString[0].value() == ''
3238+
}
3239+
}
3240+
}
3241+
_ * jobManagement.requireMinimumPluginVersion('plot', '1.9')
3242+
}
3243+
3244+
def 'call plotPlugin with full xml series'() {
3245+
when:
3246+
context.plotBuildData {
3247+
plot('my group', 'some.csv') {
3248+
xmlFile('data.prop') {
3249+
label('some label')
3250+
nodeType('NODE')
3251+
url('http://somewhere')
3252+
xpath('an xpath string')
3253+
}
3254+
}
3255+
}
3256+
3257+
then:
3258+
with(context.publisherNodes[0]) {
3259+
name() == 'hudson.plugins.plot.PlotPublisher'
3260+
children().size() == 1
3261+
with(plots.'hudson.plugins.plot.Plot'[0]) {
3262+
children().size() == 12
3263+
title[0].value().empty
3264+
yaxis[0].value().empty
3265+
group[0].value() == 'my group'
3266+
numBuilds[0].value().empty
3267+
csvFileName[0].value() == 'some.csv'
3268+
csvLastModification[0].value() == 0
3269+
style[0].value() == 'line'
3270+
useDescr[0].value() == false
3271+
keepRecords[0].value() == false
3272+
exclZero[0].value() == false
3273+
logarithmic[0].value() == false
3274+
with(series[0].'hudson.plugins.plot.XMLSeries'[0]) {
3275+
children().size() == 6
3276+
file[0].value() == 'data.prop'
3277+
label[0].value() == 'some label'
3278+
fileType[0].value() == 'xml'
3279+
nodeTypeString[0].value() == 'NODE'
3280+
url[0].value() == 'http://somewhere'
3281+
xpathString[0].value() == 'an xpath string'
3282+
}
3283+
}
3284+
}
3285+
_ * jobManagement.requireMinimumPluginVersion('plot', '1.9')
3286+
}
3287+
32053288
def 'call plotPlugin without group'() {
32063289
when:
32073290
context.plotBuildData {

0 commit comments

Comments
 (0)