Skip to content

Commit

Permalink
#637: Refactoring report renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejj0 authored and slawekjaranowski committed Oct 8, 2022
1 parent 97c6333 commit b9d24c0
Show file tree
Hide file tree
Showing 44 changed files with 2,220 additions and 1,737 deletions.
6 changes: 4 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -417,14 +417,16 @@
</reportSets>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-report</report>
<report>plugin-updates-report</report>
<report>property-updates-report</report>
<report>parent-updates-report</report>
</reports>
</reportSet>
</reportSets>
Expand Down
22 changes: 12 additions & 10 deletions src/it/it-abstract-versions-report-001/verify.groovy
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
dependencyUpdatesReport = new File( basedir, "target/site/dependency-updates-report.html" )

assert dependencyUpdatesReport.exists( )
dependencyUpdatesReport = new File( basedir, "target/site/dependency-updates-report.html" ).text
.replaceAll( '<[^>]+>', ' ' )
.replaceAll( '&[^;]+;', ' ' )
.replaceAll( '\\s+', ' ' )

// some basic (=not comprehensive) checks on the contents of the dependency report
assert dependencyUpdatesReport.text =~ /\b1\.1\.0-2\b/ // current version of the dependency
assert dependencyUpdatesReport.text =~ /\b3\.0\b/ // latest major available version

pluginUpdatesReport = new File( basedir, "target/site/plugin-updates-report.html" )
assert dependencyUpdatesReport =~ /\b1\.1\.0-2\b/ // current version of the dependency
assert dependencyUpdatesReport =~ /\b3\.0\b/ // latest major available version

assert pluginUpdatesReport.exists( )
pluginUpdatesReport = new File( basedir, "target/site/plugin-updates-report.html" ).text
.replaceAll( '<[^>]+>', ' ' )
.replaceAll( '&[^;]+;', ' ' )
.replaceAll( '\\s+', ' ' )

// some basic (=not comprehensive) checks on the contents of the plugin report
assert pluginUpdatesReport.text =~ /\b1\.0\b/ // current version of the plugin
assert pluginUpdatesReport.text =~ /\b3\.1\b/ // latest major available version
assert pluginUpdatesReport =~ /\b1\.0\b/ // current version of the plugin
assert pluginUpdatesReport =~ /\b3\.1\b/ // latest major available version
2 changes: 1 addition & 1 deletion src/it/it-parent-updates-report-001/invoker.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
invoker.goals=site
invoker.goals = site
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
* under the License.
*/

import javax.inject.Inject;

import java.io.File;
import java.util.List;
import java.util.Locale;
Expand Down Expand Up @@ -49,15 +47,17 @@
import org.codehaus.mojo.versions.api.DefaultVersionsHelper;
import org.codehaus.mojo.versions.api.VersionsHelper;
import org.codehaus.mojo.versions.model.RuleSet;
import org.codehaus.mojo.versions.reporting.ReportRendererFactory;
import org.codehaus.plexus.i18n.I18N;

/**
* Base class for all versions reports.
*
* @param <T> modelled report object
* @author Stephen Connolly
* @since 1.0-alpha-3
*/
public abstract class AbstractVersionsReport
public abstract class AbstractVersionsReport<T>
extends AbstractMavenReport
{
/**
Expand Down Expand Up @@ -99,7 +99,7 @@ public abstract class AbstractVersionsReport
/**
* @since 1.0-alpha-3
*/
private WagonManager wagonManager;
private final WagonManager wagonManager;

/**
* @since 1.0-alpha-3
Expand Down Expand Up @@ -188,17 +188,25 @@ public abstract class AbstractVersionsReport
@Parameter( property = "maven.version.ignore" )
protected Set<String> ignoredVersions;

/**
* Renderer factory
*
* @since 2.13.0
*/
protected ReportRendererFactory rendererFactory;

// --------------------- GETTER / SETTER METHODS ---------------------

@Inject
protected AbstractVersionsReport( I18N i18n, RepositorySystem repositorySystem, ArtifactResolver artifactResolver,
ArtifactMetadataSource artifactMetadataSource, WagonManager wagonManager )
ArtifactMetadataSource artifactMetadataSource, WagonManager wagonManager,
ReportRendererFactory rendererFactory )
{
this.i18n = i18n;
this.repositorySystem = repositorySystem;
this.artifactResolver = artifactResolver;
this.artifactMetadataSource = artifactMetadataSource;
this.wagonManager = wagonManager;
this.rendererFactory = rendererFactory;
}

public VersionsHelper getHelper()
Expand Down
Loading

0 comments on commit b9d24c0

Please sign in to comment.