Re: Bundle loading during unit testing outside Eclipse
Re: Bundle loading during unit testing outside Eclipse
- Subject: Re: Bundle loading during unit testing outside Eclipse
- From: Chuck Hill <email@hidden>
- Date: Mon, 19 Sep 2011 10:19:20 -0700
Hi Paul,
On 2011-09-18, at 11:05 PM, Paul Hoadley wrote:
> Hello,
>
> I seem to bother the list with a variation on this problem every few months. I'm doing some unit testing during a Hudson build process using Henrique's WOUnit. I think what I've got is a bundle finding/loading problem that's masquerading as a problem with WOUnit's TemporaryEditingContext (that uses the JavaMemoryAdaptor.framework). At the highest level, the problem is this: I can get a TemporaryEditingContext to work just fine running unit tests in Eclipse, but outside Eclipse this method in TemporaryEditingContext throws an NPE:
>
> private void fixJavaMemoryDictionary() {
> NSBundle bundle = NSBundle.bundleForName("JavaMemoryAdaptor");
> bundle._infoDictionary().takeValueForKey(ERMemoryAdaptor.class.getName(), "EOAdaptorClassName");
> }
>
> That is, it can't find JavaMemoryAdaptor.framework when it needs it. I'm having this problem when running unit tests in both application and framework bundles of my own. JavaMemoryAdaptor.framework is on the .classpath (confirmed by running 'ant -v'),
The jar file in Resources/Java is on the classpath? That is what gets used to locate the bundle.
> and it's present in Root/Library/Frameworks of the Hudson workspace. Root/wolips.properties points wo.local.frameworks to that directory. I use WOPath to construct the testing classpath (for User, Local, System anyway). And yet when I add something like this to a test method:
>
> NSArray bundles = NSBundle.frameworkBundles();
> System.out.println(bundles.count());
> System.out.println(bundles);
>
> Inside Eclipse I get 29 bundles, including JavaMemoryAdaptor.framework, and outside Eclipse I get 9 bundles, just the core WO System bundles. Surely this is the source of the problem?
Yes. Do you have project bundles enabled in Eclipse?
> I've been bothering Henrique about this for a while, but I'm just not convinced it's WOUnit's problem. I think it's my Hudson build environment. I know I'm not giving a lot to go on here, but can anyone suggest where I even _start_ looking to clarify this further?
I doubt this is a WOUnit problem. For Hudson, are you wanting to use the source project as the bundle (project bundles enabled) or the built .woa or .framework directory as the bundle? If you can tell me how you have things setup, I should be able to help you figure out what needs to be done.
Chuck
--
Chuck Hill Senior Consultant / VP Development
Practical WebObjects - for developers who want to increase their overall knowledge of WebObjects or who are trying to solve specific problems.
http://www.global-village.net/products/practical_webobjects
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden