db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Myrna van Lunteren <m.v.lunte...@gmail.com>
Subject Re: Test Harness useprocess=false question
Date Thu, 15 Dec 2005 20:22:28 GMT
John,

I found that indeed, using mainMethod.invoke(null,arguments) was required
and worked well. Thx.

I did modify a few tests classes to be public rather than have the default
package protection in addition, for the above approach did not get around
that limitation.
I did not investigate all tests in the derbynet(client)mats suites - which
includes jdbcapi, multi, jdbc20 and jdk14 suites, but most. I did not run
into any test that did an unfortunate System.exit in this bunch.

Still, even in those suites, there will still be a few tests that cannot run
ok with useprocess=false because they leave 'stuff' behind. I probably spend
most of the time working on this patch making individual tests run 'clean'.

I've been thinking a method to clean up databases actually would be really
nice. We could hang it in RunTest.execNoTestProcess(). That way we could run
more tests with useprocess=false, and speed up the test run. Recently a user
also asked for this functionality...see:

http://mail-archives.apache.org/mod_mbox/db-derby-user/200512.mbox/%3c82dc60e00512110508u68b10785ne6d7fb2b1612e476@mail.gmail.com%3e

and reply:
http://mail-archives.apache.org/mod_mbox/db-derby-user/200512.mbox/%3c439D513C.4020108@Sun.com%3e

I'm wondering if this wouldn't be a nice thing to have after all...? A
washwombat() method? I'm imagining it to be tricky though, 'd have to cycle
through metadata calls and loop to remove views and triggers etc before
tables... and ensuring no attempts at removing system stuff are
made... Anyone any thoughts on this?
Myrna


On 11/20/05, John Embretsen <John.Embretsen@sun.com> wrote:
>
> Friday, November 18, 2005, 8:31:28 PM, Myrna van Lunteren wrote:
>
> >> On 11/18/05, John Embretsen <John.Embretsen@sun.com> wrote:
>
> >> Are there other cases (other than the nist tests) where we should be
> >> able to run with useprocess set to false?
> >
> >
> > As I need to use useprocess for DERBY-413, I am cleaning up the tests
> > in derbynetclientmats (which includes jdbcapi, jdbc20 and jdk14 suites),
> but I'm not going beyond.
>
> OK, so are you running into InstantiationExceptions anywhere? I noticed
> that with useprocess=false, the main method of the test class is invoked
> through reflection. RunTest.java calls RunClass.java, which does this by
>
> mainMethod.invoke(testClass.newInstance(), arguments);
>
> Now, the call to newInstance() will fail if the test class does not
> include a (public) nullary constructor, or because of some other issue
> (see JavaDoc for java.lang.Class). A simple solution to this problem (I
> know that some java tests does not include such a constructor) would be
> to pass "null" instead of "testClass.newInstance()" to the invoke
> method, since the method called (main) is static anyway... ("If the
> underlying method is static, then the specified obj argument is ignored.
> It may be null.", from JavaDoc for java.lang.reflect.Method.invoke(...)).
>
> --
> John
>
>

Mime
View raw message