db-jdo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marco หงุ่ยตระกูล-Schulze <Ma...@NightLabs.de>
Subject Re: No joy with ClassLoaders
Date Wed, 07 Apr 2010 20:39:02 GMT
On 04/04/2010 05:56 AM, Michelle Caisse wrote:
> Hi all,
>
> For JDO-557 (api tests for JDOHelper calls to
> PersistenceManagerFactory(Map, Map), I've been trying to to set up a
> ClassLoader that has both the test classes in it (so the proxy class
> returning a pmf can be found) and jdoconfig.xml. I have not found a
> way to programmatically, during the running of the test, add the path
> to jdoconfig.xml for the particular test to the classpath that
> contains the test classes (context ClassLoader?). Does anyone know any
> magic that can do this?
>
> -- Michelle

Hi Michelle,

even though I read http://issues.apache.org/jira/browse/JDO-557 I'm
still not sure, if I understand the scenario correctly, but maybe you
can nevertheless make use of this idea:

You could write your own class-loader, use this class-loader to load the
JDO implementation and the tests, run your test, throw away all the
stuff and continue with the next class-loader (and next test that
requires this separation). This, of course works only, if basically the
whole runtime (including JDO) is started up and shut down by the test
framework, but as I understand JDO-557, exactly this is the case there.

If the main class-loader (which would probably be the parent of your
special one) already contains classes you want to reload, you can either
filter these classes out or don't pass any parent at all to your
class-loaders (requiring everything to be reloaded).

Best regards, Marco :-)


Mime
View raw message