You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Christoffer Sjöquist <Ch...@tss.teleca.se> on 2005/09/30 15:48:41 UTC

Jcoverage and System.getProperties() problem.

We are building a project and using Maven junit and jcoverage plugins.
When we build first junit runs ok and all tests pass.
Then the second run for jcoverage starts and now all tests becomes errors.
The reason seems to be that the system dosent find our system property for
where we place settings files
(se below)
Is there a way to explicitly add this to jcoverage ? (or another workaround
?)

<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<offending
code>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
    public static String getCOSSHomePath() {

        if (cossHomePath == null) {
            Properties props = System.getProperties();
            if (props != null) {
                cossHomePath = (String) props.getProperty("COSS_HOME");
            }
        }

        return cossHomePath;
    }
<<<<<<<<<<<<<error shown
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Testcase:
testListSettingsEventHandlerOk(com.sonyericsson.r2r.coss.admin.event.test.Te
stEventHandlers):	Caused an ERROR
Could not configure datastore from file: null\CoSS.hbm.xml
org.hibernate.MappingException: Could not configure datastore from file:
null\CoSS.hbm.xml
	at org.hibernate.cfg.Configuration.addFile(Configuration.java:249)
	at <secret>.DBConfigTest.setToTestConfig(DBConfigTest.java:54)
	at
<secret>coss.admin.event.test.TestEventHandlers.setUp(TestEventHandlers.java
:41)
Caused by: java.io.FileNotFoundException: null\CoSS.hbm.xml (The system
cannot find the path specified)
	at java.io.FileInputStream.open(Native Method)
	at java.io.FileInputStream.<init>(FileInputStream.java:106)
	at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<<
All the error files have the same type of errors where the COSSHomePath is
null.

Tanx in advance
/
Christoffer S

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Jcoverage and System.getProperties() problem.

Posted by Carlos Sanchez <ca...@apache.org>.
Hi,

That's probably because you're running junit without forking the jvm
(all sysprops are there) and jcoverage runs in a new forked jvm (you
need to explicitly pass the sysprops). Take a look at the properties
of the test plugin, maven.junit.sysproperties,

On 9/30/05, Christoffer Sjöquist <Ch...@tss.teleca.se> wrote:
> We are building a project and using Maven junit and jcoverage plugins.
> When we build first junit runs ok and all tests pass.
> Then the second run for jcoverage starts and now all tests becomes errors.
> The reason seems to be that the system dosent find our system property for
> where we place settings files
> (se below)
> Is there a way to explicitly add this to jcoverage ? (or another workaround
> ?)
>
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<offending
> code>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
>     public static String getCOSSHomePath() {
>
>         if (cossHomePath == null) {
>             Properties props = System.getProperties();
>             if (props != null) {
>                 cossHomePath = (String) props.getProperty("COSS_HOME");
>             }
>         }
>
>         return cossHomePath;
>     }
> <<<<<<<<<<<<<error shown
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> Testcase:
> testListSettingsEventHandlerOk(com.sonyericsson.r2r.coss.admin.event.test.Te
> stEventHandlers):       Caused an ERROR
> Could not configure datastore from file: null\CoSS.hbm.xml
> org.hibernate.MappingException: Could not configure datastore from file:
> null\CoSS.hbm.xml
>         at org.hibernate.cfg.Configuration.addFile(Configuration.java:249)
>         at <secret>.DBConfigTest.setToTestConfig(DBConfigTest.java:54)
>         at
> <secret>coss.admin.event.test.TestEventHandlers.setUp(TestEventHandlers.java
> :41)
> Caused by: java.io.FileNotFoundException: null\CoSS.hbm.xml (The system
> cannot find the path specified)
>         at java.io.FileInputStream.open(Native Method)
>         at java.io.FileInputStream.<init>(FileInputStream.java:106)
>         at org.hibernate.cfg.Configuration.addFile(Configuration.java:245)
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> <<
> All the error files have the same type of errors where the COSSHomePath is
> null.
>
> Tanx in advance
> /
> Christoffer S
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org