• 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: JUnit for testing EOs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: JUnit for testing EOs


  • Subject: Re: JUnit for testing EOs
  • From: Chuck Hill <email@hidden>
  • Date: Wed, 28 Nov 2007 10:48:10 -0800


On Nov 27, 2007, at 9:40 PM, Paul Hoadley wrote:

On 28/11/2007, at 1:33 PM, Chuck Hill wrote:

I don't think you should _need_ to do this as long as the bundles are correctly formed and on the classpath as they would be at app runtime.

Presumably I'm failing at either or both of these. :-)

I do recall, years ago, having trouble figuring out how to get this to happen automatically. It was classpath related.



I don't have this in my tests and I am using EOF. What I do have is the usual prototype switching and connection dictionary changing code.

I don't have anything like that. This is all I've done, adapted from Sam's code, and it's in '@Before public void before()':


		try {
			EOModel model = new EOModel(new File("Resources/Auth.eomodeld")
					.toURI().toURL());
			EOModelGroup.defaultGroup().addModel(model);
		} catch (MalformedURLException e) {
			throw new RuntimeException("Couldn't load EOModel", e);
		}


Interestingly (to me, anyway), I use prototypes in the Auth model, yet I don't need to add my Prototypes model in the manner above.

That probably means that it is already loaded. I am guessing that the bundle that Auth.eomodeld is in is not on the classpath properly (e.g. it is loading the project version instead).



You may need to do something like this to jump start things:

NSBundle.allBundles();
EOModelGroup.defaultGroup();

I commented out the addModel() code above, and tried this, but I was still "unabled" to find an EOClassDescription. :-) This all seems a bit harder than it should be, but I've got my trivial test case running now, so I'm happy to press on.


Thanks to all who replied.


If you are up to it, can you try this and post the output?

Comment out the add model code above and add these logs in the @Before method:

NSLog.out.appendln("Main bundle " + NSBundle.mainBundle());
NSLog.out.appendln("frameworkBundles " + NSBundle.frameworkBundles ().valueForKey("name"));
NSLog.out.appendln("frameworkBundle paths " + NSBundle.frameworkBundles());
NSLog.out.appendln("Loaded models " +EOModelGroup.defaultGroup ().modelNames());



Chuck

--

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


  • Follow-Ups:
    • Re: JUnit for testing EOs
      • From: Paul Hoadley <email@hidden>
References: 
 >JUnit for testing EOs (From: Paul Hoadley <email@hidden>)
 >Re: JUnit for testing EOs (From: Chuck Hill <email@hidden>)
 >Re: JUnit for testing EOs (From: Paul Hoadley <email@hidden>)
 >Re: JUnit for testing EOs (From: Chuck Hill <email@hidden>)
 >Re: JUnit for testing EOs (From: Paul Hoadley <email@hidden>)
 >Re: JUnit for testing EOs (From: Sam Barnum <email@hidden>)
 >Re: JUnit for testing EOs (From: Chuck Hill <email@hidden>)
 >Re: JUnit for testing EOs (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Object with globalID could not be found in the database, when it is there ??
  • Next by Date: Re: Object with globalID could not be found in the database, when it is there ??
  • Previous by thread: Re: JUnit for testing EOs
  • Next by thread: Re: JUnit for testing EOs
  • Index(es):
    • Date
    • Thread