Update Summary Display plugin to use convert xml

- Rename test files to be more descriptive
- Add plugin="summary_report" attribute for consistency
- Fix docs for 'files' option to be required

Change-Id: If0f04dfcc5ae9cdc8c15ec9728b72e9156ea9d7f
Signed-off-by: Kien Ha <kienha9922@gmail.com>
This commit is contained in:
Kien Ha 2016-08-10 22:41:11 -04:00
parent 80aa526616
commit f88a79aa8e
5 changed files with 22 additions and 13 deletions

View File

@ -3312,22 +3312,31 @@ def xml_summary(parser, xml_parent, data):
Requires the Jenkins :jenkins-wiki:`Summary Display Plugin
<Summary+Display+Plugin>`.
:arg str files: Files to parse (default '')
:arg str files: Files to parse (required)
:arg bool shown-on-project-page: Display summary on project page
(default 'false')
(default false)
Example:
Minimal Example:
.. literalinclude:: /../../tests/publishers/fixtures/xml-summary001.yaml
.. literalinclude::
/../../tests/publishers/fixtures/xml-summary-minimal.yaml
:language: yaml
Full Example:
.. literalinclude:: /../../tests/publishers/fixtures/xml-summary-full.yaml
:language: yaml
"""
summary = XML.SubElement(xml_parent,
'hudson.plugins.summary__report.'
'ACIPluginPublisher')
XML.SubElement(summary, 'name').text = data['files']
XML.SubElement(summary, 'shownOnProjectPage').text = str(
data.get('shown-on-project-page', 'false'))
summary = XML.SubElement(
xml_parent, 'hudson.plugins.summary__report.ACIPluginPublisher')
summary.set('plugin', 'summary_report')
mapping = [
('files', 'name', None),
('shown-on-project-page', 'shownOnProjectPage', False),
]
helpers.convert_mapping_to_xml(summary, data, mapping, fail_required=True)
def robot(parser, xml_parent, data):

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.summary__report.ACIPluginPublisher>
<hudson.plugins.summary__report.ACIPluginPublisher plugin="summary_report">
<name>*_summary_report.xml</name>
<shownOnProjectPage>true</shownOnProjectPage>
</hudson.plugins.summary__report.ACIPluginPublisher>

View File

@ -1,4 +1,4 @@
publishers:
- xml-summary:
files: '*_summary_report.xml'
shown-on-project-page: 'true'
shown-on-project-page: true

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<project>
<publishers>
<hudson.plugins.summary__report.ACIPluginPublisher>
<hudson.plugins.summary__report.ACIPluginPublisher plugin="summary_report">
<name>*_summary_report.xml</name>
<shownOnProjectPage>false</shownOnProjectPage>
</hudson.plugins.summary__report.ACIPluginPublisher>