Skip to content

Commit

Permalink
[SUREFIRE-2012] Use maven-shared-utils instead of surefire-shared-uti…
Browse files Browse the repository at this point in the history
…ls in Report Parser. Removed commons-lang in Report Plugin.
  • Loading branch information
Tibor17 committed Feb 14, 2022
1 parent e8ac9b6 commit 6253914
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 70 deletions.
4 changes: 0 additions & 4 deletions maven-surefire-report-plugin/pom.xml
Expand Up @@ -71,10 +71,6 @@
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
Expand Down
121 changes: 61 additions & 60 deletions surefire-report-parser/pom.xml
Expand Up @@ -18,69 +18,70 @@
~ under the License.
-->

<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>
<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>

<parent>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>3.0.0-M6-SNAPSHOT</version>
</parent>
<parent>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire</artifactId>
<version>3.0.0-M6-SNAPSHOT</version>
</parent>

<artifactId>surefire-report-parser</artifactId>
<artifactId>surefire-report-parser</artifactId>

<name>Surefire Report Parser</name>
<description>Parses report output files from surefire.</description>
<name>Surefire Report Parser</name>
<description>Parses report output files from surefire.</description>

<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-logger-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shared-utils</artifactId>
<version>${surefire-shared-utils.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>jacoco-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
<configuration>
<propertyName>jacoco.agent</propertyName>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<dependency>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shadefire</artifactId>
<version>3.0.0-M4</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 -->
</dependency>
</dependencies>
<configuration>
<argLine>${jvm.args.tests} ${jacoco.agent}</argLine>
<includes>
<include>**/JUnit4SuiteTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
<artifactId>surefire-logger-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>jacoco-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
<configuration>
<propertyName>jacoco.agent</propertyName>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-shadefire</artifactId>
<version>3.0.0-M4
</version> <!-- ${shadedVersion}, but resolved due to https://issues.apache.org/jira/browse/MRELEASE-799 -->
</dependency>
</dependencies>
<configuration>
<argLine>${jvm.args.tests} ${jacoco.agent}</argLine>
<includes>
<include>**/JUnit4SuiteTest.java</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</project>
Expand Up @@ -19,7 +19,7 @@
* under the License.
*/

import static org.apache.maven.surefire.shared.utils.StringUtils.isNotBlank;
import static org.apache.maven.shared.utils.StringUtils.isNotBlank;

/**
*
Expand Down
Expand Up @@ -33,10 +33,10 @@

import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
import org.apache.maven.reporting.MavenReportException;
import org.apache.maven.surefire.shared.utils.io.DirectoryScanner;
import org.apache.maven.shared.utils.io.DirectoryScanner;
import org.xml.sax.SAXException;

import static org.apache.maven.surefire.shared.utils.StringUtils.split;
import static org.apache.maven.shared.utils.StringUtils.split;

/**
*
Expand Down
Expand Up @@ -35,14 +35,14 @@
import javax.xml.parsers.SAXParserFactory;

import org.apache.maven.plugin.surefire.log.api.ConsoleLogger;
import org.apache.maven.surefire.shared.utils.StringUtils;
import org.xml.sax.Attributes;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;

import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.Locale.ENGLISH;
import static org.apache.maven.shared.utils.StringUtils.isBlank;

/**
*
Expand Down Expand Up @@ -138,7 +138,7 @@ public void startElement( String uri, String localName, String qName, Attributes

final String name = attributes.getValue( "name" );
final String group = attributes.getValue( "group" );
defaultSuite.setFullClassName( StringUtils.isBlank( group )
defaultSuite.setFullClassName( isBlank( group )
? /*name is full class name*/ name
: /*group is package name*/ group + "." + name );

Expand Down Expand Up @@ -171,7 +171,7 @@ public void startElement( String uri, String localName, String qName, Attributes
}

String timeAsString = attributes.getValue( "time" );
Number time = StringUtils.isBlank( timeAsString ) ? 0 : numberFormat.parse( timeAsString );
Number time = isBlank( timeAsString ) ? 0 : numberFormat.parse( timeAsString );

testCase.setFullClassName( currentSuite.getFullClassName() )
.setClassName( currentSuite.getName() )
Expand Down

0 comments on commit 6253914

Please sign in to comment.