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

@ -3312,22 +3312,31 @@ def xml_summary(parser, xml_parent, data):
Requires the Jenkins :jenkins-wiki:`Summary Display Plugin Requires the Jenkins :jenkins-wiki:`Summary Display Plugin
<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 :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 :language: yaml
""" """
summary = XML.SubElement(xml_parent, summary = XML.SubElement(
'hudson.plugins.summary__report.' xml_parent, 'hudson.plugins.summary__report.ACIPluginPublisher')
'ACIPluginPublisher') summary.set('plugin', 'summary_report')
XML.SubElement(summary, 'name').text = data['files']
XML.SubElement(summary, 'shownOnProjectPage').text = str( mapping = [
data.get('shown-on-project-page', 'false')) ('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): def robot(parser, xml_parent, data):

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

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

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