Re: WicketTester fails with a custom WebRequestCodingStrategy

2010-04-26 Thread Nikita Tovstoles
could you please post the value of Location (302) header?

On Sat, Apr 24, 2010 at 8:41 PM, Kent Tong k...@cpttm.org.mo wrote:

 Hi Martin,

 You may take a look at http://wicketpagetest.sourceforge.net/ which will
 work
 for your case.




 -
 To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
 For additional commands, e-mail: users-h...@wicket.apache.org




Re: WicketTester fails with a custom WebRequestCodingStrategy

2010-04-24 Thread Martin Grotzke
Hi,

no feedback so far. It would be really nice if s.o. familiar with
WicketTester could a look at this.

Thanx  cheers,
Martin


On Thu, 2010-04-22 at 21:21 +0200, Martin Grotzke wrote:
 Hi,
 
 I have an issue with a simple app working fine when run in the app
 server, but where the test (using WicketTester) that simulates the
 performed behaviour fails.
 
 Here are the details:
 
 I have a custom RequestCycleProcessor with a custom
 WebRequestCodingStrategy that mounts a page (for e.g. a shopping cart
 item) to a url like
   /myapp/myitem-id42.html
 and knows according to the url pattern (s.th. + -id + id +
 .html) that the item details page is to be resolved.
 
 This item details page also contains a stateless form with a button that
 adds the item to the shopping basket.
 
 This works fine when it's run within the app: I can submit the form, the
 item is added to the basket and I'm shown the details page again.
 (the urls requested are shown at the end of the email [2])
 
 Unfortunately, when I test this behaviour using WicketTester this fails,
 as it cannot create the item details page when the form is submitted.
 
 This is my test (it can also be found at github [1]):
 
 private WicketTester _tester;
 
 @BeforeMethod
 public void setUp() {
 _tester = new WicketTester( new WicketApplication() );
 }
 
 @Test
 public void testSubmitChoice() {
 _tester.startPage( DetailsPage.class, DetailsPage.pageParametersFor( 
 WicketApplication.MAKES_DB.get( 0 ) ) );
 _tester.assertRenderedPage( DetailsPage.class );
 final FormTester formTester = _tester.newFormTester( form, false );
 formTester.submit( submit ); // -- this fails
 _tester.assertRenderedPage( DetailsPage.class );
 }
 
 The test fails with an assertion on valid, provided page params in the
 items detail page:
 
 ...
 Caused by: java.lang.NullPointerException: No valid make provided!
 (params: :submit = marked)
 at 
 de.javakaffee.misc.wicket.ccs.DetailsPage.init(DetailsPage.java:58)
 
 (remember that this does not happen when run in the app server!)
 
 
 The complete example project can be found at github:
 http://github.com/magro/misc/tree/master/wicket-tester-custom-coding-strategy/
 the short link to the relevant classes (is actually a long link :-)):
 http://github.com/magro/misc/tree/master/wicket-tester-custom-coding-strategy/src/main/java/de/javakaffee/misc/wicket/ccs
 
 
 Can anyone help with this? Is this an issue of the request cycle
 processor / coding strategy (in combination with WicketTester), or is
 this an issue of WicketTester?
 
 Thanx in advance,
 cheers,
 Martin
 
 
 [1] 
 http://github.com/magro/misc/blob/master/wicket-tester-custom-coding-strategy/src/test/java/de/javakaffee/misc/wicket/ccs/TestDetailsPage.java
 [2] -- urls requested:
 
 1) GET item details page:
   - GET http://localhost:8080/Cadillac-i1.html
 - 200 OK
 2) Submit form, add item to basket
   - POST 
 http://localhost:8080/Cadillac-i1.html?wicket:interface=:0:form::IFormSubmitListener::
 - 302 Found (Location ...)
   - GET http://localhost:8080/Cadillac-i1.html
 
 



signature.asc
Description: This is a digitally signed message part


Re: WicketTester fails with a custom WebRequestCodingStrategy

2010-04-24 Thread Kent Tong
Hi Martin,

You may take a look at http://wicketpagetest.sourceforge.net/ which will work
for your case.




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org