Package org.apache.struts2.mock
Class MockActionProxy
java.lang.Object
org.apache.struts2.mock.MockActionProxy
- All Implemented Interfaces:
ActionProxy
Mock for an
ActionProxy
.- Author:
- Patrick Lightbody (plightbo at gmail dot com)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionexecute()
Execute this ActionProxy.Gets the Action instance for this Proxy.Gets the alias name this ActionProxy is mapped to.Gets the ActionConfig this ActionProxy is built from.boolean
Gets the status of whether the ActionProxy is set to execute the Result after the Action is executed.Gets the method name to execute, or null if no method has been specified (meaningexecute
will be invoked).Gets the namespace the ActionConfig for this ActionProxy is mapped to.boolean
boolean
Gets status of the method value's initialization.void
prepare()
void
void
setActionName
(String actionName) void
setConfig
(ActionConfig config) void
setExecuteResult
(boolean executeResult) Sets whether this ActionProxy should also execute the Result after executing the Action.void
setInvocation
(ActionInvocation invocation) void
void
setMethodSpecified
(boolean methodSpecified) void
setNamespace
(String namespace) void
setReturnedResult
(String returnedResult)
-
Constructor Details
-
MockActionProxy
public MockActionProxy()
-
-
Method Details
-
prepare
- Throws:
Exception
-
execute
Description copied from interface:ActionProxy
Execute this ActionProxy. This will set the ActionContext from the ActionInvocation into the ActionContext ThreadLocal before invoking the ActionInvocation, then set the old ActionContext back into the ThreadLocal.- Specified by:
execute
in interfaceActionProxy
- Returns:
- the result code returned from executing the ActionInvocation
- Throws:
Exception
- can be thrown.- See Also:
-
setReturnedResult
-
isExecutedCalled
public boolean isExecutedCalled() -
getAction
Description copied from interface:ActionProxy
Gets the Action instance for this Proxy.- Specified by:
getAction
in interfaceActionProxy
- Returns:
- the Action instance
-
setAction
-
getActionName
Description copied from interface:ActionProxy
Gets the alias name this ActionProxy is mapped to.- Specified by:
getActionName
in interfaceActionProxy
- Returns:
- the alias name
-
setActionName
-
getConfig
Description copied from interface:ActionProxy
Gets the ActionConfig this ActionProxy is built from.- Specified by:
getConfig
in interfaceActionProxy
- Returns:
- the ActionConfig
-
setConfig
-
getExecuteResult
public boolean getExecuteResult()Description copied from interface:ActionProxy
Gets the status of whether the ActionProxy is set to execute the Result after the Action is executed.- Specified by:
getExecuteResult
in interfaceActionProxy
- Returns:
- the status
-
setExecuteResult
public void setExecuteResult(boolean executeResult) Description copied from interface:ActionProxy
Sets whether this ActionProxy should also execute the Result after executing the Action.- Specified by:
setExecuteResult
in interfaceActionProxy
- Parameters:
executeResult
- true to also execute the Result.
-
getInvocation
- Specified by:
getInvocation
in interfaceActionProxy
-
setInvocation
-
getNamespace
Description copied from interface:ActionProxy
Gets the namespace the ActionConfig for this ActionProxy is mapped to.- Specified by:
getNamespace
in interfaceActionProxy
- Returns:
- the namespace
-
setNamespace
-
getMethod
Description copied from interface:ActionProxy
Gets the method name to execute, or null if no method has been specified (meaningexecute
will be invoked).- Specified by:
getMethod
in interfaceActionProxy
- Returns:
- the method to execute
-
setMethod
-
isMethodSpecified
public boolean isMethodSpecified()Description copied from interface:ActionProxy
Gets status of the method value's initialization.- Specified by:
isMethodSpecified
in interfaceActionProxy
- Returns:
- true if the method returned by getMethod() is not a default initializer value.
-
setMethodSpecified
public void setMethodSpecified(boolean methodSpecified)
-