Description
A post-processor is used to process an artifact in order to find interesting information (features and/or test results) in that artifact. Post-processors are commonly used to find information such as:
- compiler error/warning messages in command output
- build tool error/warning messages in command output
- test results in test report files
- custom field values
Extension Point
The post processor extension point is defined by the following properties.
| name |
description |
| name |
name of the post processor |
| class |
The specific class implementing the post-processor interface. |
| display-name |
Descriptive name for the post-processor to be used in the UI. |
| default-fragment |
Set to true if a default version of this post-processor should be available to built-in Pulse projects (only possible if the processor can work with no additional configuration). |
Example
Below is an example of how to define a post processor extension point.
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
<extension point="com.zutubi.pulse.core.postprocessors">
<post-processor name="unittestpp.pp" display-name="UnitTest++ XML report processor" default-fragment="true"
class="com.zutubi.pulse.core.UnitTestPlusPlusReportPostProcessor"
/>
</extension>
</plugin>
Code
All post processor implementations must implement the PostProcessor
interface.
public interface PostProcessor extends Reference
{
void process(File artifactFile, PostProcessorContext ppContext);
}
Rather than implementing this interface directly, we recommend extending one of the various support classes where possible. These classes simplify common cases and reduce coupling to implementation details.
Support Classes
There are a number of support classes in pulse™ that makes developing a new post processor plugin easier.
PostProcessorSupport
A default implementation of PostProcessor
which hides some implementation details and provides utility methods for common cases. This is still quite a low-level implementation, consider also more targeted base classes.
This implementation handles standard fail on error and warning capabilities, and hides the specifics of looking up the file to process and adding features. See the javadoc
for details.
TestReportPostProcessorSupport
A support base for post processors that find test results. Includes standard support for failing the build on a failed test, and for adding to a custom child suite. See the javadoc
for details.
XMLTestReportPostProcessorSupport
Helper base class for post processors that find test results in XML files. This class handles XML parsing, passing in a document for implementations to walk. XOM
is used for parsing as it has a convenient document API. See the javadoc
for details.
LineBasedPostProcessorSupport
A support base class for post processors that process text files line-by-line. Supports capturing of leading and trailing context lines and optional joining of overlapping features. See the javadoc
for details.
TextFilePostProcessorSupport
Support base class for post processors that read text files. Handles setup of a reader and IOExceptions. See the javadoc
for details.
Note that processors which deal with text files line-by-line may be better served by the extra features in LineBasedPostProcessorSupport
.
Sample
The following is a sample plugin project that contains simple post-processors that can be used as a starting point. The project includes an Ant build and README to get you started.
[^com.zutubi.pulse.core.postprocessors.sample.tar.gz]
Documentation
Further documentation can be find in the online javadoc
for the Pulse APIs.