Hi everybody,

My problem is I have to test a Page that should prevent lost updates via 
optimistic lock checking.

I resolved the problem using JPA optimistic lock and if I use two different 
browsers then the Page works in the desired way.

The problem comes in the test phase: to emulate two concurrent sessions I would 
instantiate two pages accessing to the same object (record) on the database 
this way having two sessions that I will call A and B.
Then on the session A I update and save (everything is expected to be correct), 
then on session B I update and save (an exception is expected to be thrown).

My approach might be

final WicketTester.DummyWebApplication testWebApplication1 = new 
WicketTester.DummyWebApplication() ...
final WicketTester.DummyWebApplication testWebApplication2 = new 
WicketTester.DummyWebApplication() ...

...

tester1 = new MyAppWicketTester(testWebApplication);
tester2 = new MyAppWicketTester(testWebApplication);

tester1.startPage(new ITestPageSource() ...
tester2.startPage(new ITestPageSource() ...

but as soon as run the complete set of test anything "blow up".

Do you have any suggestion?
Thanks
Daniele Cremonini

Reply via email to