There are varying levels of initialization you can perform. One of the
shorter ones is this:
@BeforeClass
public static void setUpBeforeClass() throws Exception {
ERXExtensions.initEOF(new String[0]);
}
You have to have the working directory set to
${working_dir_loc_WOLips:YOURPROJECT} for this to work.
John
On Tue, Feb 1, 2011 at 3:44 PM, Joe Kramer <[email protected]> wrote:
> Hi Everyone,
>
> I'm writing my first JUnit test for a WebObjects Application and I've hit a
> roadblock. I need access to some of the data in the database. When I just
> try to run the test I get an error: "java.lang.IllegalArgumentException: An
> object store for the entity "Account" could not be found. Verify that the
> entity is defined in an EOModel, and that the model is installed properly.
> To see what models are loaded, you can try printing the return value of
> EOModelGroup.defaultGroup() in your application."
>
> Seems I need to initialize my application, so I tried this advice on the
> wiki:
> http://wiki.objectstyle.org/confluence/display/WO/Testing-JUnit+and+TestNGto
> initialize the app, but then I get a NPE:
>
> java.lang.NullPointerException
> at
> er.extensions.foundation.ERXConfigurationManager.commandLineArgumentProperties(ERXConfigurationManager.java:170)
> at
> er.extensions.foundation.ERXConfigurationManager.applyConfiguration(ERXConfigurationManager.java:300)
> at
> er.extensions.foundation.ERXConfigurationManager.loadConfiguration(ERXConfigurationManager.java:289)
> at
> er.extensions.ERXExtensions.finishInitialization(ERXExtensions.java:261)
> at
> er.extensions.ERXFrameworkPrincipal$Observer.willFinishInitialization(ERXFrameworkPrincipal.java:97)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:597)
> at
> com.webobjects.foundation.NSSelector._safeInvokeMethod(NSSelector.java:122)
> at
> com.webobjects.foundation.NSNotificationCenter$_Entry.invokeMethod(NSNotificationCenter.java:588)
> at
> com.webobjects.foundation.NSNotificationCenter.postNotification(NSNotificationCenter.java:532)
> at
> er.extensions.appserver.ERXApplication.<init>(ERXApplication.java:1035)
> at com.example.Application.<init>(Application.java:21)
> at com.example.tests.YourOrdersTest.initWO(YourOrdersTest.java:51)
> <snip>
>
> and the console message: "It seems that your application class
> com.example.Application did not call
> er.extensions.appserver.ERXApplication.main(argv[], applicationClass)
> method. Please modify your Application.java as the followings so that
> er.extensions.foundation.ERXConfigurationManager can provide its rapid
> turnaround feature completely. "
>
> Any help setting up this test would be greatly appreciated.
>
> Thanks,
>
> Joe
>
>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list ([email protected])
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/webobjects-dev/johnthuss%40gmail.com
>
> This email sent to [email protected]
>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com
This email sent to [email protected]