[BUGFIX] Add missing "strExclusionSet" element when using "exclusionValues"

Otherwise a NullPointerException is thrown.

Co-Authored By: Dong Ma <winterma.dong@gmail.com>

Change-Id: I19435bc4af8265ad03754643b84d06189d6c5493
Story: 2000334
This commit is contained in:
mostwanted 2015-10-19 15:30:23 +02:00 committed by Dong Ma
parent 46bc9ecab5
commit dff8339156
3 changed files with 59 additions and 0 deletions

View File

@ -3420,6 +3420,9 @@ def plot(parser, xml_parent, data):
.. literalinclude:: /../../tests/publishers/fixtures/plot004.yaml
:language: yaml
.. literalinclude:: /../../tests/publishers/fixtures/plot005.yaml
:language: yaml
"""
top = XML.SubElement(xml_parent, 'hudson.plugins.plot.PlotPublisher')
plots = XML.SubElement(top, 'plots')
@ -3462,6 +3465,12 @@ def plot(parser, xml_parent, data):
inclusion_dict.get(inclusion_flag)
XML.SubElement(subserie, 'exclusionValues').text = \
serie.get('exclude', '')
if serie.get('exclude', ''):
exclude_strings = serie.get('exclude', '').split(',')
exclusionset = XML.SubElement(subserie, 'strExclusionSet')
for exclude_string in exclude_strings:
XML.SubElement(exclusionset, 'string').text = \
exclude_string
XML.SubElement(subserie, 'url').text = serie.get('url', '')
XML.SubElement(subserie, 'displayTableFlag').text = \
str(plot.get('display-table', False)).lower()

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.plot.PlotPublisher>
<plots>
<hudson.plugins.plot.Plot>
<title>Sample graph</title>
<yaxis/>
<csvFileName>persisted.csv</csvFileName>
<series>
<hudson.plugins.plot.CSVSeries>
<file>data.csv</file>
<inclusionFlag>INCLUDE_BY_STRING</inclusionFlag>
<exclusionValues>Column 1,Column 2,Column 3</exclusionValues>
<strExclusionSet>
<string>Column 1</string>
<string>Column 2</string>
<string>Column 3</string>
</strExclusionSet>
<url/>
<displayTableFlag>false</displayTableFlag>
<fileType>csv</fileType>
</hudson.plugins.plot.CSVSeries>
</series>
<group>bench</group>
<useDescr>false</useDescr>
<exclZero>false</exclZero>
<logarithmic>false</logarithmic>
<keepRecords>false</keepRecords>
<numBuilds/>
<style>line</style>
</hudson.plugins.plot.Plot>
</plots>
</hudson.plugins.plot.PlotPublisher>
</publishers>
</project>

View File

@ -0,0 +1,14 @@
publishers:
- plot:
- title: 'Sample graph'
yaxis: ''
csv-file-name: 'persisted.csv'
group: 'bench'
numbuilds: '1'
style: 'line'
use-description: false
series:
- file: 'data.csv'
format: 'csv'
inclusion-flag: 'include-by-string'
exclude: 'Column 1,Column 2,Column 3'