You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Rick Hillegas <Ri...@Sun.COM> on 2006/02/07 22:51:57 UTC

system properties in Derby unit tests

I would like to set a system property for a Derby unit test run  under 
the RunTest framework. Would appreciate advice on how to do this. The 
instructions in trunk/java/testing/README.htm say that I can crank up 
RunTest with -DtestSpecialProps and that is useful for a hand-run test. 
However, I don't know how to force a test to always have a certain 
System property when run inside derbyall. The *_app.properties files are 
nice too but they don't set system properties.

Just so that I'm not too mysterious here: I'm trying to set the system 
property "jdbc.drivers" to force autoloading of drivers under jdk1.4. I 
need this property to be set when the VM cranks up--setting it later on 
does me no good.

Help!

Thanks,
-Rick

Re: system properties in Derby unit tests

Posted by Rick Hillegas <Ri...@Sun.COM>.
Thanks, Kathey!

Kathey Marsden wrote:

>Rick Hillegas wrote:
>
>  
>
>>I would like to set a system property for a Derby unit test run  under
>>the RunTest framework. Would appreciate advice on how to do this. The
>>instructions in trunk/java/testing/README.htm say that I can crank up
>>RunTest with -DtestSpecialProps and that is useful for a hand-run
>>test. However, I don't know how to force a test to always have a
>>certain System property when run inside derbyall. The *_app.properties
>>files are nice too but they don't set system properties.
>>    
>>
>
>I don't really understand the difference between testSpecialProps and
>jvmflags but setting jvmflags in the <test>_app.properties file like
>lang/largeCodeGen does works ok as long as the test is not run with
>useprocess false.
>
>Kathey
>
>
>  
>


Re: system properties in Derby unit tests

Posted by Rick Hillegas <Ri...@Sun.COM>.
Thanks Myrna and Kathey,

Here's my mileage: the -D flag is needed. So, the following works for me:

jvmflags=-Djdbc.drivers=org.apache.derby.jdbc.EmbeddedDriver:org.apache.derby.jdbc.ClientDriver

Regards,
-Rick

Myrna van Lunteren wrote:

> I *think* the jvmflags is specifically intended to be passing on 
> properties without the -D flag. I remember being disappointed in the 
> harness mangling it if it has/needs a -D.
>  
> You may also have a look at testJavaFlags. The encryption suites use 
> this, I'm not entirely sure it works with RunTest, but worth a try. In 
> that one, the harness adds a -D, I think.
>  
> Myrna
>
>  
> On 2/7/06, *Kathey Marsden* <kmarsdenderby@sbcglobal.net 
> <ma...@sbcglobal.net>> wrote:
>
>     Rick Hillegas wrote:
>
>     > I would like to set a system property for a Derby unit test
>     run  under
>     > the RunTest framework. Would appreciate advice on how to do
>     this. The
>     > instructions in trunk/java/testing/README.htm say that I can
>     crank up
>     > RunTest with -DtestSpecialProps and that is useful for a hand-run
>     > test. However, I don't know how to force a test to always have a
>     > certain System property when run inside derbyall. The
>     *_app.properties
>     > files are nice too but they don't set system properties.
>
>     I don't really understand the difference between testSpecialProps and
>     jvmflags but setting jvmflags in the <test>_app.properties file like
>     lang/largeCodeGen does works ok as long as the test is not run with
>     useprocess false.
>
>     Kathey
>
>
>


Re: system properties in Derby unit tests

Posted by Myrna van Lunteren <m....@gmail.com>.
I *think* the jvmflags is specifically intended to be passing on properties
without the -D flag. I remember being disappointed in the harness mangling
it if it has/needs a -D.

You may also have a look at testJavaFlags. The encryption suites use this,
I'm not entirely sure it works with RunTest, but worth a try. In that one,
the harness adds a -D, I think.

Myrna


On 2/7/06, Kathey Marsden <km...@sbcglobal.net> wrote:
>
> Rick Hillegas wrote:
>
> > I would like to set a system property for a Derby unit test run  under
> > the RunTest framework. Would appreciate advice on how to do this. The
> > instructions in trunk/java/testing/README.htm say that I can crank up
> > RunTest with -DtestSpecialProps and that is useful for a hand-run
> > test. However, I don't know how to force a test to always have a
> > certain System property when run inside derbyall. The *_app.properties
> > files are nice too but they don't set system properties.
>
> I don't really understand the difference between testSpecialProps and
> jvmflags but setting jvmflags in the <test>_app.properties file like
> lang/largeCodeGen does works ok as long as the test is not run with
> useprocess false.
>
> Kathey
>
>
>

Re: system properties in Derby unit tests

Posted by Kathey Marsden <km...@sbcglobal.net>.
Rick Hillegas wrote:

> I would like to set a system property for a Derby unit test run  under
> the RunTest framework. Would appreciate advice on how to do this. The
> instructions in trunk/java/testing/README.htm say that I can crank up
> RunTest with -DtestSpecialProps and that is useful for a hand-run
> test. However, I don't know how to force a test to always have a
> certain System property when run inside derbyall. The *_app.properties
> files are nice too but they don't set system properties.

I don't really understand the difference between testSpecialProps and
jvmflags but setting jvmflags in the <test>_app.properties file like
lang/largeCodeGen does works ok as long as the test is not run with
useprocess false.

Kathey