• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Accessing a framework's resources in WOUnit tests
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing a framework's resources in WOUnit tests


  • Subject: Re: Accessing a framework's resources in WOUnit tests
  • From: Chuck Hill <email@hidden>
  • Date: Mon, 14 Jul 2014 23:26:26 +0000
  • Thread-topic: Accessing a framework's resources in WOUnit tests

If the jar files are the class path, then I don’t recall why the bundles would not be found.  You might have to take a peek inside of NSBundle.

Chuck

On 2014-07-14, 2:15 AM, "Musall Maik" wrote:

Hi Chuck,

the frameworks as such are in the class path, but the list doesn't include their jars specifically in addition to that. Accessing any class of these frameworks from plain Java code works fine though.

Maik


Am 11.07.2014 um 19:46 schrieb Chuck Hill <email@hidden>:

Hi Maik,

You mis-understood what I say.  It uses the current working directory to find the bundles, but that does not form the bundle path.  The paths that you have below look correct to me.  Are the jar files of your custom frameworks on the class path when the unit tests run?


Chuck


On 2014-07-11, 8:26 AM, "Musall Maik" wrote:

Hi Chuck,

how can I do something about that that?

I have a @BeforeClass init method in my abstract Unit test base class, doing this:

NSBundle bundle = NSBundle.mainBundle();
System.out.println( "Using NSBundle " + bundle.name() + " on path " + bundle.bundlePathURL() );
for( NSBundle fbundle : NSBundle.frameworkBundles() ) {
System.out.println( "Using Framework NSBundle " + fbundle.name() + " on path " + fbundle.bundlePathURL() );
}

which produces the following output:

Using NSBundle MyApp on path file:/Users/maik/src/git/Foo/MyApp/build/MyApp.woa
Using Framework NSBundle JavaEOAccess on path file:/System/Library/Frameworks/JavaEOAccess.framework
Using Framework NSBundle JavaEOControl on path file:/System/Library/Frameworks/JavaEOControl.framework
Using Framework NSBundle JavaFoundation on path file:/System/Library/Frameworks/JavaFoundation.framework
Using Framework NSBundle JavaJDBCAdaptor on path file:/System/Library/Frameworks/JavaJDBCAdaptor.framework
Using Framework NSBundle JavaWebObjects on path file:/System/Library/Frameworks/JavaWebObjects.framework
Using Framework NSBundle JavaXML on path file:/System/Library/Frameworks/JavaXML.framework
Using Framework NSBundle JavaEOProject on path file:/System/Library/Frameworks/JavaEOProject.framework
Using Framework NSBundle JavaWOJSPServlet on path file:/System/Library/Frameworks/JavaWOJSPServlet.framework

Maik


Am 10.07.2014 um 19:31 schrieb Chuck Hill <email@hidden>:

NSBundle uses the current working directory as a base to locate the bundles.  That is one thing to check.  For frameworks, I think this needs to be My.framework/Resources/Java

Chuck


On 2014-07-09, 11:49 PM, "Musall Maik" wrote:

Hi,

thanks for the suggestion. Turns out that none of my frameworks are loaded. NSBundle.frameworkBundles() contains only the basic Java… bundles, nothing else. Any idea?

Maik


Am 09.07.2014 um 22:40 schrieb Markus Stoll, junidas GmbH <email@hidden>:

Hi,
I use
NSBundle.bundleForClass(myclass.class).pathURLForResourcePath(_resource);
when I need things to work from unit tests, too
hope this helps, Markus
Am 09.07.2014 um 18:56 schrieb Musall Maik <email@hidden>:
Oh, sorry for not making that clear.
It's involved in that everything works for the running application, but not from within unit tests. The effect that the pathURLForResourceNamed() call returns null happens only in unit tests.
Maik
Am 09.07.2014 um 18:11 schrieb John Huss <email@hidden>:
Sorry, how is WOUnit involved?
On Wed, Jul 9, 2014 at 10:09 AM, Musall Maik <email@hidden> wrote:
Hi,
I have an application that uses a few custom frameworks. When I use
WOResourceManager resourceManager = WOApplication.application().resourceManager();
URL url = "" "foo.dat", null, null );
from within the main application, I get a proper URL to my resource file. But when I use
WOResourceManager resourceManager = WOApplication.application().resourceManager();
URL url = "" "bar.dat", "MyFramework", null );
with the second parameter (framework name) given, I only get back null. Regardless of whether
this is called from within the main application or from the framework's code itself.
Does anybody have a hint for me?
Thanks
Maik
_______________________________________________
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
_______________________________________________
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
--
Dr. Markus Stoll (Geschäftsführer)
email@hidden
junidas GmbH, Aixheimer Str. 12, 70619 Stuttgart
Tel. +49 (711) 4599799-11, Fax +49 (711) 4599799-10
Geschäftsführer: Dr. Markus Stoll, Matthias Zepf
Amtsgericht Stuttgart, HRB 21939




 _______________________________________________
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

References: 
 >Re: Accessing a framework's resources in WOUnit tests (From: John Huss <email@hidden>)
 >Re: Accessing a framework's resources in WOUnit tests (From: Musall Maik <email@hidden>)
 >Re: Accessing a framework's resources in WOUnit tests (From: Chuck Hill <email@hidden>)
 >Re: Accessing a framework's resources in WOUnit tests (From: Musall Maik <email@hidden>)
 >Re: Accessing a framework's resources in WOUnit tests (From: Chuck Hill <email@hidden>)
 >Re: Accessing a framework's resources in WOUnit tests (From: Musall Maik <email@hidden>)

  • Prev by Date: Re: Enums in D2W
  • Next by Date: Redirect from Spring MVC application to WebObjects application
  • Previous by thread: Re: Accessing a framework's resources in WOUnit tests
  • Next by thread: Enums in D2W
  • Index(es):
    • Date
    • Thread