Search in sources :

Example 11 with OgnlUtil

use of com.opensymphony.xwork2.ognl.OgnlUtil in project struts by apache.

the class RestActionInvocationTest method testInvoke.

/**
 * Test the global execution
 * @throws Exception
 */
public void testInvoke() throws Exception {
    // Default index method return 'success'
    ((MockActionProxy) restActionInvocation.getProxy()).setMethod("index");
    // Define result 'success'
    ResultConfig resultConfig = new ResultConfig.Builder("success", "org.apache.struts2.result.HttpHeaderResult").addParam("status", "123").build();
    ActionConfig actionConfig = new ActionConfig.Builder("org.apache.rest", "RestAction", "org.apache.rest.RestAction").addResultConfig(resultConfig).build();
    ((MockActionProxy) restActionInvocation.getProxy()).setConfig(actionConfig);
    request.setMethod("GET");
    restActionInvocation.setOgnlUtil(new OgnlUtil());
    restActionInvocation.invoke();
    assertEquals(123, response.getStatus());
}
Also used : ActionConfig(com.opensymphony.xwork2.config.entities.ActionConfig) ResultConfig(com.opensymphony.xwork2.config.entities.ResultConfig) OgnlUtil(com.opensymphony.xwork2.ognl.OgnlUtil) MockActionProxy(com.opensymphony.xwork2.mock.MockActionProxy)

Aggregations

OgnlUtil (com.opensymphony.xwork2.ognl.OgnlUtil)9 MockActionProxy (com.opensymphony.xwork2.mock.MockActionProxy)8 ConfigurationException (com.opensymphony.xwork2.config.ConfigurationException)3 ContainerBuilder (com.opensymphony.xwork2.inject.ContainerBuilder)2 StubConfigurationProvider (com.opensymphony.xwork2.test.StubConfigurationProvider)2 LocatableProperties (com.opensymphony.xwork2.util.location.LocatableProperties)2 ActionContext (com.opensymphony.xwork2.ActionContext)1 ActionConfig (com.opensymphony.xwork2.config.entities.ActionConfig)1 InterceptorMapping (com.opensymphony.xwork2.config.entities.InterceptorMapping)1 ResultConfig (com.opensymphony.xwork2.config.entities.ResultConfig)1 PreResultListener (com.opensymphony.xwork2.interceptor.PreResultListener)1 MockInterceptor (com.opensymphony.xwork2.mock.MockInterceptor)1 ArrayList (java.util.ArrayList)1 Callable (java.util.concurrent.Callable)1 Semaphore (java.util.concurrent.Semaphore)1 HttpServletRequest (javax.servlet.http.HttpServletRequest)1 OgnlException (ognl.OgnlException)1 ServletActionContext (org.apache.struts2.ServletActionContext)1 EvaluationException (org.apache.tiles.evaluator.EvaluationException)1