This repository has been archived by the owner on Apr 6, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[JENKINS-4912] Created new action base class for maven aggregation.
- Loading branch information
Showing
1 changed file
with
78 additions
and
0 deletions.
There are no files selected for viewing
78 changes: 78 additions & 0 deletions
78
src/main/java/hudson/plugins/dry/DryMavenResultAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
package hudson.plugins.dry; | ||
|
||
import hudson.maven.MavenAggregatedReport; | ||
import hudson.maven.MavenBuild; | ||
import hudson.maven.MavenModule; | ||
import hudson.maven.MavenModuleSet; | ||
import hudson.maven.MavenModuleSetBuild; | ||
import hudson.model.Action; | ||
import hudson.plugins.analysis.core.HealthDescriptor; | ||
import hudson.plugins.analysis.core.MavenResultAction; | ||
import hudson.plugins.analysis.core.ParserResult; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* A {@link DryResultAction} for native Maven jobs. This action | ||
* additionally provides result aggregation for sub-modules and for the main | ||
* project. | ||
* | ||
* @author Ulli Hafner | ||
*/ | ||
public class DryMavenResultAction extends MavenResultAction<DryResult> { | ||
/** | ||
* Creates a new instance of {@link DryMavenResultAction}. This instance | ||
* will have no result set in the beginning. The result will be set | ||
* successively after each of the modules are build. | ||
* | ||
* @param owner | ||
* the associated build of this action | ||
* @param healthDescriptor | ||
* health descriptor to use | ||
* @param defaultEncoding | ||
* the default encoding to be used when reading and parsing files | ||
*/ | ||
public DryMavenResultAction(final MavenModuleSetBuild owner, final HealthDescriptor healthDescriptor, | ||
final String defaultEncoding) { | ||
super(new DryResultAction(owner, healthDescriptor), defaultEncoding); | ||
} | ||
|
||
/** | ||
* Creates a new instance of {@link DryMavenResultAction}. | ||
* | ||
* @param owner | ||
* the associated build of this action | ||
* @param healthDescriptor | ||
* health descriptor to use | ||
* @param defaultEncoding | ||
* the default encoding to be used when reading and parsing files | ||
* @param result | ||
* the result in this build | ||
*/ | ||
public DryMavenResultAction(final MavenBuild owner, final HealthDescriptor healthDescriptor, | ||
final String defaultEncoding, final DryResult result) { | ||
super(new DryResultAction(owner, healthDescriptor, result), defaultEncoding); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
public MavenAggregatedReport createAggregatedAction(final MavenModuleSetBuild build, final Map<MavenModule, List<MavenBuild>> moduleBuilds) { | ||
return new DryMavenResultAction(build, getHealthDescriptor(), getDisplayName()); | ||
} | ||
|
||
/** {@inheritDoc} */ | ||
public Action getProjectAction(final MavenModuleSet moduleSet) { | ||
return new DryProjectAction(moduleSet); | ||
} | ||
|
||
@Override | ||
public Class<? extends MavenResultAction<DryResult>> getIndividualActionType() { | ||
return DryMavenResultAction.class; | ||
} | ||
|
||
@Override | ||
protected DryResult createResult(final DryResult existingResult, final ParserResult aggregatedAnnotations) { | ||
return new DryResult(getOwner(), existingResult.getDefaultEncoding(), aggregatedAnnotations); | ||
} | ||
} | ||
|