Package com.opensymphony.xwork2.mock

Examples of com.opensymphony.xwork2.mock.MockActionInvocation


        this.context.put(StrutsStatics.HTTP_RESPONSE, this.response);
        this.context.put(StrutsStatics.HTTP_REQUEST, this.request);
        this.stack = (ValueStack) context.getValueStack();
        this.servletContext = new StrutsMockServletContext();
        this.context.put(StrutsStatics.SERVLET_CONTEXT, this.servletContext);
        this.invocation = new MockActionInvocation();
        this.invocation.setInvocationContext(this.context);
    }
View Full Code Here


    }

    public void testNoMultipartRequest() throws Exception {
        MyFileupAction action = new MyFileupAction();

        MockActionInvocation mai = new MockActionInvocation();
        mai.setAction(action);
        mai.setResultCode("NoMultipart");
        mai.setInvocationContext(ActionContext.getContext());

        // if no multipart request it will bypass and execute it
        assertEquals("NoMultipart", interceptor.intercept(mai));
    }
View Full Code Here

        req.setCharacterEncoding("text/html");
        req.setContentType("text/xml"); // not a multipart contentype
        req.addHeader("Content-type", "multipart/form-data");

        MyFileupAction action = new MyFileupAction();
        MockActionInvocation mai = new MockActionInvocation();
        mai.setAction(action);
        mai.setResultCode("success");
        mai.setInvocationContext(ActionContext.getContext());

        Map param = new HashMap();
        ActionContext.getContext().setParameters(param);
        ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest((HttpServletRequest) req, 2000));
View Full Code Here

        req.setCharacterEncoding("text/html");
        req.setContentType("multipart/form-data; boundary=---1234");
        req.setContent(null); // there is no content

        MyFileupAction action = new MyFileupAction();
        MockActionInvocation mai = new MockActionInvocation();
        mai.setAction(action);
        mai.setResultCode("success");
        mai.setInvocationContext(ActionContext.getContext());

        Map param = new HashMap();
        ActionContext.getContext().setParameters(param);
        ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest((HttpServletRequest) req, 2000));
View Full Code Here

            "-----1234--\r\n");
        req.setContent(content.getBytes("US-ASCII"));

        MyFileupAction action = new MyFileupAction();

        MockActionInvocation mai = new MockActionInvocation();
        mai.setAction(action);
        mai.setResultCode("success");
        mai.setInvocationContext(ActionContext.getContext());
        Map param = new HashMap();
        ActionContext.getContext().setParameters(param);
        ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest((HttpServletRequest) req, 2000));

        interceptor.intercept(mai);
View Full Code Here

        MockControl control = MockControl.createControl(ServletRequestAware.class);
        ServletRequestAware mock = (ServletRequestAware) control.getMock();

        MockHttpServletRequest req = new MockHttpServletRequest();

        MockActionInvocation mai = createActionInvocation(mock);
        mai.getInvocationContext().put(StrutsStatics.HTTP_REQUEST, req);

        mock.setServletRequest((HttpServletRequest) req);
        control.setVoidCallable();

        control.replay();
View Full Code Here

        MockControl control = MockControl.createControl(ServletResponseAware.class);
        ServletResponseAware mock = (ServletResponseAware) control.getMock();

        MockHttpServletResponse res = new MockHttpServletResponse();

        MockActionInvocation mai = createActionInvocation(mock);
        mai.getInvocationContext().put(StrutsStatics.HTTP_RESPONSE, res);

        mock.setServletResponse((HttpServletResponse) res);
        control.setVoidCallable();

        control.replay();
View Full Code Here

    public void testParameterAware() throws Exception {
        MockControl control = MockControl.createControl(ParameterAware.class);
        ParameterAware mock = (ParameterAware) control.getMock();

        MockActionInvocation mai = createActionInvocation(mock);

        Map param = new HashMap();
        mai.getInvocationContext().setParameters(param);

        mock.setParameters(param);
        control.setVoidCallable();

        control.replay();
View Full Code Here

    public void testSessionAware() throws Exception {
        MockControl control = MockControl.createControl(SessionAware.class);
        SessionAware mock = (SessionAware) control.getMock();

        MockActionInvocation mai = createActionInvocation(mock);

        Map session = new HashMap();
        mai.getInvocationContext().setSession(session);

        mock.setSession(session);
        control.setVoidCallable();

        control.replay();
View Full Code Here

    public void testApplicationAware() throws Exception {
        MockControl control = MockControl.createControl(ApplicationAware.class);
        ApplicationAware mock = (ApplicationAware) control.getMock();

        MockActionInvocation mai = createActionInvocation(mock);

        Map app = new HashMap();
        mai.getInvocationContext().setApplication(app);

        mock.setApplication(app);
        control.setVoidCallable();

        control.replay();
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.mock.MockActionInvocation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.