Package com.opensymphony.xwork2.mock

Examples of com.opensymphony.xwork2.mock.MockActionInvocation


 
  @Override
    protected void setUp() throws Exception {
      super.setUp();
    ValueStack stack = ActionContext.getContext().getValueStack();
    MockActionInvocation invocation = new MockActionInvocation();
    invocation.setStack(stack);
    ActionContext.getContext().setValueStack(stack);
    ActionContext.getContext().setActionInvocation(invocation);
   
    String[] conversionErrorValue = new String[] { "some value" };
    Map<String, Object> conversionErrors = ActionContext.getContext().getConversionErrors();
View Full Code Here


        context.put(StrutsStatics.HTTP_RESPONSE, response);

        StrutsMockServletContext servletContext = new StrutsMockServletContext();

        context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
        invocation = new MockActionInvocation();
        ActionContext.getContext().setActionInvocation(invocation);
        invocation.setAction(action);
        invocation.setInvocationContext(context);
        MockActionProxy proxy = new MockActionProxy();
        proxy.setMethod("execute");
View Full Code Here

        Action action = new Action() {
            public String execute() throws Exception {
                return SUCCESS;
            }
        };
        mai = new MockActionInvocation();
        ((MockActionInvocation) mai).setAction(action);
        ((MockActionInvocation) mai).setInvocationContext(ac);
    }
View Full Code Here

    public void testCreateSession() throws Exception {
        Mock httpServletRequestMock = new Mock(HttpServletRequest.class);

        ClearSessionInterceptor interceptor = new ClearSessionInterceptor();
        MockActionInvocation invocation = new MockActionInvocation();
        ActionContext context = new ActionContext(new HashMap());
        Map session = new HashMap();
        session.put("Test1", "Test1");
        session.put("Test2", "Test2");
        session.put("Test3", "Test3");
        context.setSession(session);
        invocation.setInvocationContext(context);
        interceptor.intercept(invocation);
       
        assertEquals(0, session.size());
    }
View Full Code Here

    protected void setUp() throws Exception {
      super.setUp();
      param = new HashMap<String, Object>();
     
      interceptor = new CheckboxInterceptor();
      ai = new MockActionInvocation();
      ai.setInvocationContext(ActionContext.getContext());
      ActionContext.getContext().setParameters(param);
    }
View Full Code Here

        HttpServletRequest request = (HttpServletRequest) httpServletRequestMock.proxy();

        ServletActionContext.setRequest(request);

        CreateSessionInterceptor interceptor = new CreateSessionInterceptor();
        interceptor.intercept(new MockActionInvocation());

        httpServletRequestMock.verify();
    }
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(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<String, Object> param = new HashMap<String, Object>();
        ActionContext.getContext().setParameters(param);
        ActionContext.getContext().put(ServletActionContext.HTTP_REQUEST, createMultipartRequest(req, 2000));

        interceptor.intercept(mai);
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.