Bundle loading during unit testing outside Eclipse
Bundle loading during unit testing outside Eclipse
- Subject: Bundle loading during unit testing outside Eclipse
- From: Paul Hoadley <email@hidden>
- Date: Mon, 19 Sep 2011 15:35:51 +0930
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'), 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?
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?
--
Paul.
http://logicsquad.net/
_______________________________________________
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