db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew McIntyre" <mcintyr...@gmail.com>
Subject Re: junit-oneclass target questions
Date Thu, 11 Jan 2007 21:31:41 GMT
On 1/11/07, Daniel John Debrunner <djd@apache.org> wrote:
> Q1) The junit-oneclass target has a classpath entry:
>        <classpath>
>          <pathelement path="${out.dir}"/>
>          <pathelement path="${junit}"/>
>        </classpath>
>     However if execute a target such as junit-jdbc4 target without
> CLASSPATH set I fail to execute the task. When I explictly set CLASSPATH
> to just contain the classes folder and junit.jar from tools/java I run
> the task successfully.
> So what is the above classpath entry doing?

Nothing. :-)

For the same reason that junit.jar doesn't actually get added to the
classpath, the contents of ${out.dir} are not being added either. [1]
I'm not sure that they should anyway. I think the targets should rely
on the setting of the classpath for the classes instead of trying to
set one themselves, since the user knows better than Ant whether they
want to run from the classes, jars, or at some point in the future,
however they were packaged in the distribution they downloaded.

> Q2) From a call to junit-oneclass can I set a system property for the
> forked JVM? E.g.
>      <antcall target="junit-oneclass">
>        <param name="derby.junit.jvm"
>               value="${jdk16}/bin/java"/>
>        <param name="derby.junit.testname"
> value="org.apache.derbyTesting.functionTests.tests.jdbcapi.AutoloadBooting"/>
>      </antcall>
> How could I set a system property that will be passed onto the JVM
> running the junit test?

We could put a placeholder <jvmarg> into the junit-oneclass <java>
task that is set to the value of a property. I believe that if the
property is set in an antcall <param>, the value of the property will
be reverted back to its previous unset state once that antcall is
done, so the property wouldn't affect other calls to junit-oneclass,
but I would want to test that to be certain.

[1] http://ant.apache.org/faq.html#delegating-classloaderhttp://ant.apache.org/faq.html#delegating-classloader

View raw message