>
> Handling the session directly sounds very un-wickety.
> Normally you should keep state in your components. They are
> all(?) stateful in Wicket.
>

I suppose I should elaborate a little bit:) I've got the following session class

public final class UserSession extends WebSession{
        private String username;
        
        public UserSession(final WebApplication 
application){super(application);}
        ...}

And I've got a WelcomePage class as such:

public class WelcomePage extends SecureBasePage{
        private String username;
        
        public WelcomePage(){
                super();
                setUsername((getUserSession()).getUsername());
                add(new Label("username", new PropertyModel(this,"username")));
        }

        public String getUsername() {return username;}

        public void setUsername(String username) {this.username = username;}
}
and SecureBasePage is :

public class SecureBasePage extends WebPage {
        
        public SecureBasePage(){
                super();
                verifyAccess();
        }
        
        public void verifyAccess(){
                if(!(isUserLoggedIn())){
                        throw new 
RestartResponseAtInterceptPageException(Index.class);
                }
        }
        
        protected boolean isUserLoggedIn(){
                return (getUserSession()).isUserLoggedIn();
        }
}


So now I want to unit test rendering of WelcomePage. However I need to
have a UserSession object with the username set up. I have no idea how
to this via WicketTester.

Is there any way to this?

cheers

srdjan

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to