Re: [Wicket-user] WicketTester Sessions (1.3.0-incubating-beta1)
Yes, I raised JIRA bug WICKET-574. -- View this message in context: http://www.nabble.com/WicketTester---Sessions-%281.3.0-incubating-beta1%29-tf3759412.html#a10659833 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester Sessions (1.3.0-incubating-beta1)
Did a JIRA bug get created for this? I'm having the same issue and want to document in my code the JIRA issue number. If a bug hasn't been created then I'd be happy to create it myself. Thanks Craig severian wrote: I've been having trouble using sessions with WicketTester, even after looking over the old messages on this list. I've been trying to implement something like the example in Gurumurthy's Pro Wicket book, where a Login page places a User object in the session, and other pages subsequently have access to the cached User object. When trying to unit test one of the subsequent pages in isolation (i.e. without first going through the Login page), I figured I just had to place a User object in the test instance of my session class, like this: -- WicketTester tester = new WicketTester(myApp, myPath); MySession mySession = (MySession) tester.getWicketSession(); mySession.setCurrentUser(getCurrentUser()); tester.startPage(MyPage.class); -- Unfortunately, this didn't work. The WicketTester constructor correctly creates an instance of MySession, but never binds it to the session store. Consequently, the later call to tester.startPage() creates a new instance of MySession, which obviously contains no User object, causing my tests to fail. As a workaround, I forced the bind() call myself, after the WicketTester constructor: -- WicketTester tester = new WicketTester(myApp, myPath); tester.getApplication().getSessionStore().bind(tester.getWicketRequest(), tester.getWicketSession()); MySession mySession = (MySession) tester.getWicketSession(); mySession.setCurrentUser(getCurrentUser()); tester.startPage(MyPage.class); -- This allows my tests to succeed. However, I'm suspicious that either I'm missing something subtle, or there's a bug in the wicket test framework. For example, should MockWebApplication.createRequestCycle() force a bind after setting up its session via: this.wicketSession = (WebSession) Session.findOrCreate(); It seems to me that it should, but I'm a Wicket newbie... -- View this message in context: http://www.nabble.com/WicketTester---Sessions-%281.3.0-incubating-beta1%29-tf3759412.html#a10656736 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] WicketTester Sessions (1.3.0-incubating-beta1)
please fire a jira bug -igor On 5/15/07, severian [EMAIL PROTECTED] wrote: I've been having trouble using sessions with WicketTester, even after looking over the old messages on this list. I've been trying to implement something like the example in Gurumurthy's Pro Wicket book, where a Login page places a User object in the session, and other pages subsequently have access to the cached User object. When trying to unit test one of the subsequent pages in isolation (i.e. without first going through the Login page), I figured I just had to place a User object in the test instance of my session class, like this: -- WicketTester tester = new WicketTester(myApp, myPath); MySession mySession = (MySession) tester.getWicketSession(); mySession.setCurrentUser(getCurrentUser()); tester.startPage(MyPage.class); -- Unfortunately, this didn't work. The WicketTester constructor correctly creates an instance of MySession, but never binds it to the session store. Consequently, the later call to tester.startPage() creates a new instance of MySession, which obviously contains no User object, causing my tests to fail. As a workaround, I forced the bind() call myself, after the WicketTester constructor: -- WicketTester tester = new WicketTester(myApp, myPath); tester.getApplication().getSessionStore().bind(tester.getWicketRequest(), tester.getWicketSession()); MySession mySession = (MySession) tester.getWicketSession(); mySession.setCurrentUser(getCurrentUser()); tester.startPage(MyPage.class); -- This allows my tests to succeed. However, I'm suspicious that either I'm missing something subtle, or there's a bug in the wicket test framework. For example, should MockWebApplication.createRequestCycle() force a bind after setting up its session via: this.wicketSession = (WebSession) Session.findOrCreate(); It seems to me that it should, but I'm a Wicket newbie... -- View this message in context: http://www.nabble.com/WicketTester---Sessions-%281.3.0-incubating-beta1%29-tf3759412.html#a10625617 Sent from the Wicket - User mailing list archive at Nabble.com. - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user