You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Gerry Lowe (JIRA)" <ji...@apache.org> on 2007/05/16 10:35:16 UTC

[jira] Created: (WICKET-574) WicketTester does not bind created Session to SessionStore

WicketTester does not bind created Session to SessionStore
----------------------------------------------------------

                 Key: WICKET-574
                 URL: https://issues.apache.org/jira/browse/WICKET-574
             Project: Wicket
          Issue Type: Bug
          Components: wicket
    Affects Versions: 1.3.0-beta1
            Reporter: Gerry Lowe
            Priority: Minor


The WicketTester constructor, via a call to MockWebApplication.createRequestCycle(), creates a new session but fails to bind it:
        this.wicketSession = (WebSession) Session.findOrCreate();
This means that the session subsequently gets over-written by a new one created in a later call to WicketTester.startPage().  This causes problems for any unit tests which want to set up session data after instantiating a WicketTester, but before calling WicketTester.startPage().

The MockWebApplication.createRequestCycle() should probably bind the session immediately after creating it:
        this.wicketSession = (WebSession) Session.findOrCreate();
        getApplication().getSessionStore().bind(getWicketRequest(), wicketSession);

Then subsequent calls to startPage() will use this session rather than create a new one.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-574) WicketTester does not bind created Session to SessionStore

Posted by "Johan Compagner (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496300 ] 

Johan Compagner commented on WICKET-574:
----------------------------------------

hmm we see to do that in:

	public void setupRequestAndResponse()
	{
		servletRequest.initialize();
		servletResponse.initialize();
		servletRequest.setParameters(parametersForNextRequest);
		parametersForNextRequest.clear();
		this.wicketRequest = this.application.newWebRequest(servletRequest);
		this.wicketResponse = this.application.newWebResponse(servletResponse);
		createRequestCycle();
		this.application.getSessionStore().bind(wicketRequest, wicketSession);
		wicketResponse.setAjax(wicketRequest.isAjax());
	}

so are you calling createRequestCycle before you do setupRequestAndResponse() ?

> WicketTester does not bind created Session to SessionStore
> ----------------------------------------------------------
>
>                 Key: WICKET-574
>                 URL: https://issues.apache.org/jira/browse/WICKET-574
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Gerry Lowe
>            Priority: Minor
>
> The WicketTester constructor, via a call to MockWebApplication.createRequestCycle(), creates a new session but fails to bind it:
>         this.wicketSession = (WebSession) Session.findOrCreate();
> This means that the session subsequently gets over-written by a new one created in a later call to WicketTester.startPage().  This causes problems for any unit tests which want to set up session data after instantiating a WicketTester, but before calling WicketTester.startPage().
> The MockWebApplication.createRequestCycle() should probably bind the session immediately after creating it:
>         this.wicketSession = (WebSession) Session.findOrCreate();
>         getApplication().getSessionStore().bind(getWicketRequest(), wicketSession);
> Then subsequent calls to startPage() will use this session rather than create a new one.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (WICKET-574) WicketTester does not bind created Session to SessionStore

Posted by "Gerry Lowe (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/WICKET-574?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12496307 ] 

Gerry Lowe commented on WICKET-574:
-----------------------------------

I don't make an explicit call to createRequestCycle(), but I think the WicketTester constructor makes the call (either directly or indirectly).

This is useful functionality (that the WicketTester constructor sets up a session), as otherwise it's not obvious how a unit test can initialise a session (i.e. store objects) before calling startPage().

> WicketTester does not bind created Session to SessionStore
> ----------------------------------------------------------
>
>                 Key: WICKET-574
>                 URL: https://issues.apache.org/jira/browse/WICKET-574
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Gerry Lowe
>            Priority: Minor
>
> The WicketTester constructor, via a call to MockWebApplication.createRequestCycle(), creates a new session but fails to bind it:
>         this.wicketSession = (WebSession) Session.findOrCreate();
> This means that the session subsequently gets over-written by a new one created in a later call to WicketTester.startPage().  This causes problems for any unit tests which want to set up session data after instantiating a WicketTester, but before calling WicketTester.startPage().
> The MockWebApplication.createRequestCycle() should probably bind the session immediately after creating it:
>         this.wicketSession = (WebSession) Session.findOrCreate();
>         getApplication().getSessionStore().bind(getWicketRequest(), wicketSession);
> Then subsequent calls to startPage() will use this session rather than create a new one.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (WICKET-574) WicketTester does not bind created Session to SessionStore

Posted by "Alastair Maw (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/WICKET-574?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alastair Maw updated WICKET-574:
--------------------------------

    Fix Version/s: 1.3.0-rc1

> WicketTester does not bind created Session to SessionStore
> ----------------------------------------------------------
>
>                 Key: WICKET-574
>                 URL: https://issues.apache.org/jira/browse/WICKET-574
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket
>    Affects Versions: 1.3.0-beta1
>            Reporter: Gerry Lowe
>            Priority: Minor
>             Fix For: 1.3.0-rc1
>
>
> The WicketTester constructor, via a call to MockWebApplication.createRequestCycle(), creates a new session but fails to bind it:
>         this.wicketSession = (WebSession) Session.findOrCreate();
> This means that the session subsequently gets over-written by a new one created in a later call to WicketTester.startPage().  This causes problems for any unit tests which want to set up session data after instantiating a WicketTester, but before calling WicketTester.startPage().
> The MockWebApplication.createRequestCycle() should probably bind the session immediately after creating it:
>         this.wicketSession = (WebSession) Session.findOrCreate();
>         getApplication().getSessionStore().bind(getWicketRequest(), wicketSession);
> Then subsequent calls to startPage() will use this session rather than create a new one.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.