On Thu, 17 Jul 2008, David Hendrix wrote:
> we're using a custom WebRequestCycle in our application to handle our
> Hibernate session. In onBeginRequest() the session is opened and closes
> in onEndRequest(). This works just fine when using Tomcat but fails with
> WicketTester.

That's interesting, I've toyed with the idea of using 
WicketTester for integration tests going all the way to the
db, precisely to be able to reproduce lazy-init and such 
issues, but never actually did that. I've always used 
WicketTester just for whitebox unit testing and then 
sometimes Selenium for the end-to-end testing.

> A quickstart showing the failure is hard to cough up since it would
> involve an oracle database (I didn't had the time to check any other
> databases), but here's an excerpt from the logfile:

You can use H2 or Hsqldb, or just do something else in 
onBeginRequest and onEndRequest to reproduce the problem.

You can also do Thread.dumpStack() in onBeginRequest 
and onEndRequest to see from where their calls come from.

> Why is onEndRequest() called that early and why is onBeginRequest()
> called twice?
> Is there any way around this except checking and possibly reattaching
> every proxy just for testing since it works just fine in 'real life'?

It sounds like a WicketTester bug, though your usage of 
WicketTester is pretty novel. Please add a bug report to
Jira

  https://issues.apache.org/jira/secure/CreateIssue!default.jspa

, and if you can do a quickstart or get more
information, even better.

An easier workaround might be using a normal WebRequestCycle
or a custom version of your own to skip Hibernate session
there, and do it in the test lifecycle methods instead.

Best wishes,
Timo

-- 
Timo Rantalaiho           
Reaktor Innovations Oy    <URL: http://www.ri.fi/ >

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to