use of com.opensymphony.xwork2.mock.MockActionProxy in project struts by apache.
the class JSONActionRedirectResultTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
this.response = new MockHttpServletResponse();
this.request = new MockHttpServletRequest();
this.context = ActionContext.getContext();
this.context.put(StrutsStatics.HTTP_RESPONSE, this.response);
this.context.put(StrutsStatics.HTTP_REQUEST, this.request);
this.stack = context.getValueStack();
this.servletContext = new MockServletContext();
this.context.put(StrutsStatics.SERVLET_CONTEXT, this.servletContext);
this.invocation = new MockActionInvocation();
this.invocation.setInvocationContext(this.context);
this.invocation.setStack(this.stack);
MockActionProxy mockActionProxy = new MockActionProxy();
mockActionProxy.setConfig(new ActionConfig.Builder(null, null, null).build());
this.invocation.setProxy(mockActionProxy);
}
use of com.opensymphony.xwork2.mock.MockActionProxy in project struts by apache.
the class JSONValidationInterceptorTest method setUp.
protected void setUp() throws Exception {
super.setUp();
ActionConfig config = new ActionConfig.Builder("", "name", "").build();
this.action = new TestAction();
this.interceptor = new JSONValidationInterceptor();
this.validationInterceptor = new AnnotationValidationInterceptor();
container.inject(validationInterceptor);
this.request = new StrutsMockHttpServletRequest();
stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
this.response = new StrutsMockHttpServletResponse();
response.setWriter(writer);
ActionContext context = ActionContext.getContext();
context.put(StrutsStatics.HTTP_REQUEST, request);
context.put(StrutsStatics.HTTP_RESPONSE, response);
StrutsMockServletContext servletContext = new StrutsMockServletContext();
context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
invocation = new MockActionInvocation();
ActionContext.getContext().withActionInvocation(invocation);
invocation.setAction(action);
invocation.setInvocationContext(context);
MockActionProxy proxy = new MockActionProxy();
proxy.setMethod("execute");
proxy.setAction(action);
proxy.setConfig(config);
invocation.setProxy(proxy);
}
Aggregations