On Aug 25, 2004, at 5:42 PM, Mike Kienenberger wrote:
> Unfortunately, I couldn't figure out any way to set up such an
> intercept if
> an application directly calls DataContext.createDataContext(), but
> that's
> not applicable in my current situation.
>
> Perhaps some future version of Cayenne should provide a way to specify
> a
> DataContextFactory.
Well, DataContext.createDataContext() is just a quick and dirty way to
get DataContext. I guess I am in favor of consistently using
DataContext provided by the environment. Thread-bound DataContext being
the most generic use of such approach, and will work with unit tests as
well.
As for emulating a commit (but not select) failure, I guess your
solution should work quiet well. Cayenne itself uses a bunch of mockup
stack objects to emulate different stack behavior. These classes are
pretty new and are located under org.objectstyle.cayenne.unit.util
package in tests. They are probably not usable for application unit
testing directly, but may be used as examples for creating custom
mockup stack.
Andrus
This archive was generated by hypermail 2.0.0 : Wed Aug 25 2004 - 20:40:39 EDT