On Today at 4:32pm, DC=>Dimitrios Christodoulakis <[email protected]> wrote:
DC> Thanks Haroon for the handy advice. That seems to do the trick as far
DC> as the session object is concerned. The test passes now.
DC>
Glad it worked out.
DC>
DC> Would it be easy for someone to extend your code to include actions
DC> that implement the -aware interfaces? If I wanted to take a shot at
DC> that, is there a particular point you would suggest I start with?
DC>
Did you add that code in your Test class? I was actually suggesting that
you modify the code inside BaseStrutsTestCase. So, I would recommend
adding a private static HashMap variable called sessionMap in
BaseStrutsTestCase. And then in the createAction method, issue the
statement:
proxy.getInvocation().getInvocationContext().setSession(sessionMap);
Hope that helps.
The only other fringe case that I have dealth with in our code, is when we
have actions that implement Preparable and are used with a
ParamsPrepareParams interceptor. I created a method to allow action
parameters to be set.
/**
* Sets the action parameters
* @param parameters Parameters to set
*/
protected void setActionParameters(Map<String, String>
parameters) {
proxy.getInvocation().getInvocationContext().
setParameters(parameters);
}
Then inside my Action Test class, I can issue:
proxy.setActionParameters(...);
before:
proxy.execute();
Cheers,
--
Haroon Rafique
<[email protected]>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]