There's nothing that I know of in the JDK to search a path consisting of
urls by patterns and certainly there is no help in the ClassLoader and
Package APIs for discovering classes.  I thought that you might be able to
hack on the funny RMI classloader, but since it sounds like it delegates to
another classloader, it too is probably insulated from the actual file
system where resources are located.

I think you are going to have to either:
1. Tell the JUnit runner explicity which test classes to execute, or
2. Provide the JUnit runner network access to the file systems, perhaps
through http, ftp, nfs, or samba, so it can resolve and search urls itself,
or
3. Copy all resource local to the JUnit runner, a la GUMP.

Personally, I like the first approach better because it allows you to have
multiple, disributed JUnit runners work in parallel.

Imagine an ant task the uses a fileset to find all of the **/*Test.class
files (ie the test classes) and uses a registry to find or ssh to launch
distributed JUnit runners with which to distribute those test classes.  The
ant task would also have to provide each JUnit runner with a suitable
classpath so that the JUnit runner would be able to access any other
resources it needs to execute the test.  Finally, the ant task collates the
results into a final report and mails it off.

didge

> -----Original Message-----
> From: Steve Loughran [mailto:[EMAIL PROTECTED]
> Sent: Thursday, May 20, 2004 9:04 AM
> To: Ant Developers List
> Subject: Re: enumerating all classes in a package
>
>
> didge wrote:
> > What JDK version(s) do you need to support?  Can you provide an
> example of
> > the classpath you have to search?  Who's 'funny RMI
> classloaders' are they?
> >
> > didge
>
> I'm trying to run junit remotely, so get something like a package name
> "org.example.tests" and want to search for a specified pattern
> "*Test\\.class" and get all classes that match it that the current
> classloader knows about. Maybe recursively.
>
> The funny RMI classloader was written by a colleague, which adds extra
> security to a normal one (resources are copied locally for signature
> verification & other tricks). The key is that it (and parents) can be
> configured with various urls to files, and the test runner has its code
> auto-deployed from the URLs as needed.
>
> >
> >
> >>-----Original Message-----
> >>From: Steve Loughran [mailto:[EMAIL PROTECTED]
> >>Sent: Thursday, May 20, 2004 3:37 AM
> >>To: Ant Developers List
> >>Subject: enumerating all classes in a package
> >>
> >>
> >>
> >>Anyone know how to enum all classes defined in a package? I want to
> >>search for *Test.class on a defined classpath, without having access to
> >>the JARs as files I can get at (i.e. they are remote stuff coming
> >>through funny RMI classloaders).
> >>
> >>
> >>-steve
> >>
> >>---------------------------------------------------------------------
> >>To unsubscribe, e-mail: [EMAIL PROTECTED]
> >>For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to