You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Christian Schulte (JIRA)" <ji...@codehaus.org> on 2006/03/08 15:40:23 UTC

[jira] Created: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Service providers are not available during unit testing when defined by dependencies
------------------------------------------------------------------------------------

         Key: MSUREFIRE-77
         URL: http://jira.codehaus.org/browse/MSUREFIRE-77
     Project: Maven 2.x Surefire Plugin
        Type: Bug

    Reporter: Christian Schulte


If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MSUREFIRE-77?page=all ]

Brett Porter updated MSUREFIRE-77:
----------------------------------

    Attachment: MSUREFIRE-77.tar.bz2

ok, reproducible. Here's a tarball that is easier to test with as its self contained

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>                 Key: MSUREFIRE-77
>                 URL: http://jira.codehaus.org/browse/MSUREFIRE-77
>             Project: Maven 2.x Surefire Plugin
>          Issue Type: Bug
>            Reporter: Christian Schulte
>         Attachments: jcharset-1.2.1.jar, MSUREFIRE-77.tar.bz2, MSUREFIRE77TestCase.java, pom.xml
>
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Reopened: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MSUREFIRE-77?page=all ]

Brett Porter reopened MSUREFIRE-77:
-----------------------------------

      Assignee:     (was: Brett Porter)
             
reopening per Stephen's comment. Stephen - please provide a test case, as I was unable to reproduce otherwise (it worked in mine when forking).

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>                 Key: MSUREFIRE-77
>                 URL: http://jira.codehaus.org/browse/MSUREFIRE-77
>             Project: Maven 2.x Surefire Plugin
>          Issue Type: Bug
>            Reporter: Christian Schulte
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Posted by "Stephen Cresswell (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MSUREFIRE-77?page=comments#action_75761 ] 
            
Stephen Cresswell commented on MSUREFIRE-77:
--------------------------------------------

typo - should have said

the default is "once" anyway.

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>                 Key: MSUREFIRE-77
>                 URL: http://jira.codehaus.org/browse/MSUREFIRE-77
>             Project: Maven 2.x Surefire Plugin
>          Issue Type: Bug
>            Reporter: Christian Schulte
>         Assigned To: Brett Porter
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Posted by "Matthew Wheaton (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MSUREFIRE-77?page=comments#action_63528 ] 

Matthew Wheaton commented on MSUREFIRE-77:
------------------------------------------

I've opened almost the identical issue.
http://jira.codehaus.org/browse/MSUREFIRE-91
This one is just about strike 3 for me and Maven2. ANT will be back in full swing if seemingly simple things like this cannot be fixed.

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>          Key: MSUREFIRE-77
>          URL: http://jira.codehaus.org/browse/MSUREFIRE-77
>      Project: Maven 2.x Surefire Plugin
>         Type: Bug

>     Reporter: Christian Schulte
>      Fix For: 2.2

>
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (SUREFIRE-162) Service providers are not available during unit testing when defined by dependencies

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter updated SUREFIRE-162:
----------------------------------

    Fix Version/s: 2.x

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-162
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-162
>             Project: Maven Surefire
>          Issue Type: Bug
>            Reporter: Christian Schulte
>             Fix For: 2.x
>
>         Attachments: jcharset-1.2.1.jar, MSUREFIRE-77.tar.bz2, MSUREFIRE77TestCase.java, pom.xml
>
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MSUREFIRE-77?page=all ]
     
Brett Porter closed MSUREFIRE-77:
---------------------------------

      Assign To: Brett Porter
     Resolution: Won't Fix
    Fix Version:     (was: 2.2)

You have to use forkMode = once or always. The default, running inside the current JVM, cannot work as charset providers are looked up from the system classloader (despite the fact the javadocs say they come from the context classloader, that simply isn't true - the ctx CL is correctly set and never used for this purpose).

Will document.

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>          Key: MSUREFIRE-77
>          URL: http://jira.codehaus.org/browse/MSUREFIRE-77
>      Project: Maven 2.x Surefire Plugin
>         Type: Bug

>     Reporter: Christian Schulte
>     Assignee: Brett Porter

>
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MSUREFIRE-77?page=all ]

Brett Porter updated MSUREFIRE-77:
----------------------------------

    Fix Version: 2.2

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>          Key: MSUREFIRE-77
>          URL: http://jira.codehaus.org/browse/MSUREFIRE-77
>      Project: Maven 2.x Surefire Plugin
>         Type: Bug

>     Reporter: Christian Schulte
>      Fix For: 2.2

>
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Moved: (SUREFIRE-162) Service providers are not available during unit testing when defined by dependencies

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter moved MSUREFIRE-77 to SUREFIRE-162:
------------------------------------------------

        Key: SUREFIRE-162  (was: MSUREFIRE-77)
    Project: Maven Surefire  (was: Maven 2.x Surefire Plugin)

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-162
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-162
>             Project: Maven Surefire
>          Issue Type: Bug
>            Reporter: Christian Schulte
>         Attachments: jcharset-1.2.1.jar, MSUREFIRE-77.tar.bz2, MSUREFIRE77TestCase.java, pom.xml
>
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (SUREFIRE-162) Service providers are not available during unit testing when defined by dependencies

Posted by "Dan Fabulich (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-162?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dan Fabulich closed SUREFIRE-162.
---------------------------------

       Resolution: Won't Fix
    Fix Version/s:     (was: 2.x)

This test passes just fine with useSystemClassLoader=true; integration test checked in 597756.  It would be nice if you didn't have to pass that parameter in (or if useSystemClassLoader were the default) but that would create a lot of other problems (particularly with plexus version conflicts).  That's SUREFIRE-334 and it probably won't get fixed any time soon.

Beware of SUREFIRE-389 which I just fixed; without that useSystemClassLoader=true may cause an IncompatibleClassChangeError.

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>                 Key: SUREFIRE-162
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-162
>             Project: Maven Surefire
>          Issue Type: Bug
>            Reporter: Christian Schulte
>         Attachments: jcharset-1.2.1.jar, MSUREFIRE-77.tar.bz2, MSUREFIRE77TestCase.java, pom.xml
>
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Posted by "Stephen Cresswell (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/MSUREFIRE-77?page=all ]

Stephen Cresswell updated MSUREFIRE-77:
---------------------------------------

    Attachment: jcharset-1.2.1.jar
                pom.xml
                MSUREFIRE77TestCase.java

I've attached a junit test case, my pom and jcharset.jar (the jar containing the GSM charsets). Running the test case in eclipse works fine, but from mvn -e test I get the following...

Running uk.co.henriettasms.MSUREFIRE77TestCase
java.io.UnsupportedEncodingException: GSM_0338
        at sun.io.Converters.getConverterClass(Unknown Source)
        at sun.io.Converters.newConverter(Unknown Source)
        at sun.io.ByteToCharConverter.getConverter(Unknown Source)
        at java.lang.StringCoding.decode(Unknown Source)
        at java.lang.String.<init>(Unknown Source)
        at java.lang.String.<init>(Unknown Source)
        at uk.co.henriettasms.MSUREFIRE77TestCase.testThatICanUseCharsets(MSUREFIRE77TestCase.java:12)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at junit.framework.TestCase.runTest(TestCase.java:164)
        at junit.framework.TestCase.runBare(TestCase.java:130)
        at junit.framework.TestResult$1.protect(TestResult.java:110)
        at junit.framework.TestResult.runProtected(TestResult.java:128)
        at junit.framework.TestResult.run(TestResult.java:113)
        at junit.framework.TestCase.run(TestCase.java:120)
        at junit.framework.TestSuite.runTest(TestSuite.java:228)
        at junit.framework.TestSuite.run(TestSuite.java:223)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:210)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:135
)
        at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:122)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:129)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:225)
        at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:747)

Workaround I'm using at the moment is to add jcharset to JRE/lib/ext. It's my first attempt using maven so apologies if I've missed something obvious.

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>                 Key: MSUREFIRE-77
>                 URL: http://jira.codehaus.org/browse/MSUREFIRE-77
>             Project: Maven 2.x Surefire Plugin
>          Issue Type: Bug
>            Reporter: Christian Schulte
>         Attachments: jcharset-1.2.1.jar, MSUREFIRE77TestCase.java, pom.xml
>
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (MSUREFIRE-77) Service providers are not available during unit testing when defined by dependencies

Posted by "Stephen Cresswell (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/MSUREFIRE-77?page=comments#action_75758 ] 
            
Stephen Cresswell commented on MSUREFIRE-77:
--------------------------------------------

Setting forkMode doesn't make any difference. According to the Maven 2 doco the default is false anyway.

http://maven.apache.org/plugins/maven-surefire-plugin/howto.html

> Service providers are not available during unit testing when defined by dependencies
> ------------------------------------------------------------------------------------
>
>                 Key: MSUREFIRE-77
>                 URL: http://jira.codehaus.org/browse/MSUREFIRE-77
>             Project: Maven 2.x Surefire Plugin
>          Issue Type: Bug
>            Reporter: Christian Schulte
>         Assigned To: Brett Porter
>
> If a dependency defines some service provider by e.g. a file like  META-INF/services/java.nio.charset.spi.CharsetProvider these providers are not available during unit testing. For this example an UnsupportedEncodingException would be thrown when using a charset defined in the file during unit testing. For Reference see: <http://java.sun.com/j2se/1.5.0/docs/guide/jar/jar.html#Service%20Provider> or <http://java.sun.com/j2se/1.5.0/docs/api/java/nio/charset/spi/CharsetProvider.html>.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira