Hello,

According to the XWork feature description,
http://www.opensymphony.com/xwork/wikidocs/XWork%20Features.html, the
ActionInvocation represents the execution state of an action holding
the action instance and the interceptors.

I have been looking at
http://struts.apache.org/2.1.6/struts2-core/apidocs and examining an
implementation of the ActionInvocation interface:
DefaultActionInvocation and was wondering how does this class gets a
hold of the action instance and the interceptors? It has relevant
fields like action, interceptors and proxy with getters for the action
and the proxy. But it is not straightforward to me how the action
instance (and the interceptors) are injected to it.. I didn't see
setter methods for the action.

My motivation for this question comes also from wanting to unit test
an interceptor's intercept(ActionInvocation actionInvocation) method.
I will need to pass an ActionInvocation as a parameter, which then the
interceptor will use to extract the actual action instance from.
(Among other things, like the InvocationContext to get the session).

So I was also wondering how to provide a mock-type of an
ActionInvocation which will contain a mock action, a mock session etc.
I mean I understand how to create a mock action and a mock session map
with some parameters in it, but how do I bind those to a mock
ActionInvocation? Would I need perhaps to start with a mock
ActionProxy?

Thanks for your advice. This will help me design the test case and
also learn more about the struts2 mechanics.
Regards!

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

Reply via email to