Package com.opensymphony.xwork2.mock

Examples of com.opensymphony.xwork2.mock.MockActionInvocation


      throws Exception {
   
    URL url = new URL(stack, new PortletServletRequest(request, null),
        new PortletServletResponse(response));

    MockActionInvocation ai = new MockActionInvocation();
    MockActionProxy ap = new MockActionProxy();
    ap.setActionName("testAction");
    ap.setNamespace("/current_namespace");
    ai.setProxy(ap);
    ai.setStack(stack);
    ai.setAction(new Object());
    ctx.setActionInvocation(ai);

    StringWriter renderOutput = new StringWriter();
    renderer.renderUrl(renderOutput, url);
View Full Code Here


      throws Exception {

    Form form = new Form(stack, new PortletServletRequest(request, null),
        new PortletServletResponse(response));

    MockActionInvocation ai = new MockActionInvocation();
    MockActionProxy ap = new MockActionProxy();
    ap.setActionName("testAction");
    ap.setNamespace("/current_namespace");
    ai.setProxy(ap);
    ai.setStack(stack);
    ai.setAction(new Object());
    ctx.setActionInvocation(ai);

    renderer.renderFormUrl(form);

    String action = actionUrl
View Full Code Here

  public void testShouldEvaluateActionAsOGNLExpression() throws Exception {
   
    TestObject obj = new TestObject();
    obj.someProperty = "EvaluatedProperty";
    stack.push(obj);
    MockActionInvocation ai = new MockActionInvocation();
    MockActionProxy ap = new MockActionProxy();
    ap.setActionName("testAction");
    ap.setNamespace("");
    ai.setProxy(ap);
    ai.setStack(stack);
    ctx.setActionInvocation(ai);
   
    URL url = new URL(stack, new PortletServletRequest(request, null),
        new PortletServletResponse(response));
    url.setAction("%{someProperty}");
View Full Code Here

  public void testShouldEvaluateAnchorAsOGNLExpression() throws Exception {
   
    TestObject obj = new TestObject();
    obj.someProperty = "EvaluatedProperty";
    stack.push(obj);
    MockActionInvocation ai = new MockActionInvocation();
    MockActionProxy ap = new MockActionProxy();
    ap.setActionName("testAction");
    ap.setNamespace("");
    ai.setProxy(ap);
    ai.setStack(stack);
    ctx.setActionInvocation(ai);
   
    URL url = new URL(stack, new PortletServletRequest(request, null),
        new PortletServletResponse(response));
    url.setAnchor("%{someProperty}");
View Full Code Here

        context.put(StrutsStatics.HTTP_RESPONSE, response);

        StrutsMockServletContext servletContext = new StrutsMockServletContext();

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

        requestMock.matchAndReturn("getContextPath", "/context");

        ActionContext ac = new ActionContext(Ognl.createDefaultContext(null));
        ac.put(ServletActionContext.HTTP_REQUEST, requestMock.proxy());
        ac.put(ServletActionContext.HTTP_RESPONSE, responseMock.proxy());
        MockActionInvocation ai = new MockActionInvocation();
        ai.setInvocationContext(ac);
        this.ai = ai;
        ai.setStack(ActionContext.getContext().getValueStack());
    }
View Full Code Here

        context.put(StrutsStatics.SERVLET_CONTEXT, servletContext);
        ServletActionContext.setServletContext(servletContext);
        ServletActionContext.setRequest(request);
        ServletActionContext.setResponse(response);
        servletContext.setAttribute(FreemarkerManager.CONFIG_SERVLET_CONTEXT_KEY, null);
        invocation = new MockActionInvocation();
        invocation.setStack(stack);
        invocation.setInvocationContext(context);
        servletContext.setRealPath(new File(FreeMarkerResultTest.class.getResource(
          "someFreeMarkerFile.ftl").toURI()).toURL().getFile());
    }
View Full Code Here

                .addResultConfigs(results).build();

        ActionContext ac = new ActionContext(Ognl.createDefaultContext(null));
        ac.put(ServletActionContext.HTTP_REQUEST, requestMock.proxy());
        ac.put(ServletActionContext.HTTP_RESPONSE, responseMock.proxy());
        MockActionInvocation ai = new MockActionInvocation();
        ai.setInvocationContext(ac);
        ai.setResultCode("myResult");
        ActionProxy mockActionProxy = EasyMock.createNiceMock(ActionProxy.class);
        ai.setProxy(mockActionProxy);
        EasyMock.expect(mockActionProxy.getConfig()).andReturn(actionConfig).anyTimes();
        EasyMock.replay(mockActionProxy);
        this.ai = ai;
        ai.setStack(ActionContext.getContext().getValueStack());
    }
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

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.