Skip to content

Commit

Permalink
Add test for mojohaus#46
Browse files Browse the repository at this point in the history
where processDependencyManagement = true
  • Loading branch information
cs01lg authored Feb 10, 2017
1 parent d98545d commit bb8bb21
Show file tree
Hide file tree
Showing 2 changed files with 126 additions and 0 deletions.
93 changes: 93 additions & 0 deletions src/it/it-dependency-updates-report-004/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>localhost</groupId>
<artifactId>it-dependency-updates-report-001</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>dependency-updates-report</name>
<url>http://localhost/</url>

<properties>
<processDependencyManagement>true</processDependencyManagement>
</properties>

<dependencyManagement>
<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>dummy-api</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>dummy-api</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>localhost</groupId>
<artifactId>dummy-maven-plugin</artifactId>
<version>1.0</version>
<dependencies>
<dependency>
<groupId>localhost</groupId>
<artifactId>dummy-api</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.3</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>@sitePluginVersion@</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>

<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.1</version>
<reportSets>
<reportSet/>
</reportSets>
</plugin>
<plugin>
<groupId>@project.groupId@</groupId>
<artifactId>@project.artifactId@</artifactId>
<version>@project.version@</version>
<reportSets>
<reportSet>
<reports>
<report>dependency-updates-report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>
33 changes: 33 additions & 0 deletions src/it/it-dependency-updates-report-004/verify.bsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import java.io.*;
import org.codehaus.plexus.util.FileUtils;

try
{
File file = new File( basedir, "target/site/dependency-updates-report.html" );
String buf = FileUtils.fileRead( file, "UTF-8" );

String result = buf.toString()
.replaceAll( "<[^>]+>", " " )
.replaceAll( "&[^;]+;", " " )
.replaceAll( "\\s+", " " );

if ( result.indexOf( "localhost dummy-api 1.1 compile jar 1.1.0-2 1.1.1 1.2 2.0" ) < 0 )
{
System.out.println( "Did not pick up updated in dependencies section" );
System.out.println( "Result = \"" + result +"\"" );
return false;
}
if ( !result.contains("localhost dummy-api 2.0 jar 2.1 3.0"))
{
System.out.println( "Did not pick up updated in dependencies management section" );
System.out.println( "Result = \"" + result +"\"" );
return false;
}
}
catch( Throwable t )
{
t.printStackTrace();
return false;
}

return true;

0 comments on commit bb8bb21

Please sign in to comment.