maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (SUREFIRE-1445) Properties from configuration POM are not passed to Provider on JDK 9
Date Thu, 30 Nov 2017 20:37:00 GMT

    [ https://issues.apache.org/jira/browse/SUREFIRE-1445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16273370#comment-16273370
] 

ASF GitHub Bot commented on SUREFIRE-1445:
------------------------------------------

Github user Tibor17 commented on a diff in the pull request:

    https://github.com/apache/maven-surefire/pull/171#discussion_r154193802
  
    --- Diff: maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/SurefirePropertiesTest.java
---
    @@ -70,9 +70,35 @@ public void testConstructWithOther()
             src.setProperty( "b", "2" );
             SurefireProperties orderedProperties = new SurefireProperties( src );
             // Cannot make assumptions about insertion order
    -        assertEquals( 2, orderedProperties.size() );
    -
    +        int expectedCount = 0;
    +        // keys() uses the items property, more reliable to test than size(),
    +        // which is based on the Properties class
    +        // see https://issues.apache.org/jira/browse/SUREFIRE-1445
    +        Enumeration<Object> keys = orderedProperties.keys();
    +        while ( keys.hasMoreElements() ) {
    +            keys.nextElement();
    +            expectedCount++;
    +        }
    +        assertEquals( 2, expectedCount );
    --- End diff --
    
    We missed one method I mentioned before. Can you add an assert that method `getStringKeySet()`
returns same elements like it is in `keys()`. Maybe this will help:
    `java.util.Collections#list(Enumeration): List`
    We can do it in both tests.


> Properties from configuration POM are not passed to Provider on JDK 9
> ---------------------------------------------------------------------
>
>                 Key: SUREFIRE-1445
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1445
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Failsafe Plugin, Maven Surefire Plugin
>    Affects Versions: 2.19.1, 2.20, 2.20.1
>         Environment: JDK 9
>            Reporter: Marc Philipp
>            Assignee: Tibor Digana
>            Priority: Blocker
>             Fix For: 2.21.0.Jigsaw
>
>
> Given the POM below, the {{JUnitPlatformProvider}} can read {{"excludeTags"}} = {{"slow"}}
from {{ProviderParameters.getProviderProperties()}} when it runs on JDK 8 but not on JDK 9.
> The reason is that the constructor of {{SurefireProperties}} relies on an implementation
detail of the class it extends, namely that {{putAll()}} will call {{put()}} for each entry.
However, while {{Properties}} does that on JDK 8, it doesn't on JDK 9.
> Here's a link to the line in {{SurefireProperties}}:
> https://github.com/apache/maven-surefire/blob/master/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/SurefireProperties.java#L62
> {code:xml}
> <?xml version="1.0" encoding="UTF-8"?>
> <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>junit5</groupId>
>     <artifactId>tagging</artifactId>
>     <version>1.0-SNAPSHOT</version>
>     <build>
>         <plugins>
>             <plugin>
>                 <artifactId>maven-surefire-plugin</artifactId>
>                 <version>2.19.1</version>
>                 <configuration>
>                     <properties>
>                         <excludeTags>slow</excludeTags>
>                     </properties>
>                 </configuration>
>                 <dependencies>
>                     <dependency>
>                         <groupId>org.junit.platform</groupId>
>                         <artifactId>junit-platform-surefire-provider</artifactId>
>                         <version>1.0.2</version>
>                     </dependency>
>                     <dependency>
>                         <groupId>org.junit.jupiter</groupId>
>                         <artifactId>junit-jupiter-engine</artifactId>
>                         <version>5.0.2</version>
>                     </dependency>
>                 </dependencies>
>             </plugin>
>         </plugins>
>     </build>
>     <dependencies>
>         <dependency>
>             <groupId>org.junit.jupiter</groupId>
>             <artifactId>junit-jupiter-api</artifactId>
>             <version>5.0.2</version>
>             <scope>test</scope>
>         </dependency>
>     </dependencies>
> </project>
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message