Package com.opensymphony.xwork2

Examples of com.opensymphony.xwork2.ActionInvocation


    interceptor.setAllowRequestParameterSwitch(true);
   
   
    ActionSupport action = new ActionSupport();
   
    ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
    mockActionInvocation.invoke();
    EasyMock.expectLastCall().andReturn(Action.SUCCESS);
   
    Map paramsMap = new LinkedHashMap();
    Map sessionMap = new LinkedHashMap();
   
    List actionErrors = new ArrayList();
    List actionMessages = new ArrayList();
    Map fieldErrors = new LinkedHashMap();
   
    actionErrors.add("some action error 1");
    actionErrors.add("some action error 2");
    actionMessages.add("some action messages 1");
    actionMessages.add("some action messages 2");
    List field1Errors = new ArrayList();
    field1Errors.add("some field error 1");
    List field2Errors = new ArrayList();
    field2Errors.add("some field error 2");
    fieldErrors.put("field1", field1Errors);
    fieldErrors.put("field2", field2Errors);
   
    sessionMap.put(MessageStoreInterceptor.actionErrorsSessionKey, actionErrors);
    sessionMap.put(MessageStoreInterceptor.actionMessagesSessionKey, actionMessages);
    sessionMap.put(MessageStoreInterceptor.fieldErrorsSessionKey, fieldErrors);
   
   
    ActionContext actionContext = new ActionContext(new HashMap());
    actionContext.put(ActionContext.PARAMETERS, paramsMap);
    actionContext.put(ActionContext.SESSION, sessionMap);
   
    mockActionInvocation.getInvocationContext();
    EasyMock.expectLastCall().andReturn(actionContext);
    EasyMock.expectLastCall().anyTimes();
   
    mockActionInvocation.getAction();
    EasyMock.expectLastCall().andReturn(action);
   
    EasyMock.replay(mockActionInvocation);
   
    interceptor.init();
View Full Code Here


    paramMap.put("operationMode", new String[] { MessageStoreInterceptor.RETRIEVE_MODE });
   
    ActionContext actionContext = new ActionContext(new HashMap());
    actionContext.put(ActionContext.PARAMETERS, paramMap);
   
    ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
    mockActionInvocation.getInvocationContext();
    EasyMock.expectLastCall().andReturn(actionContext);
    EasyMock.expectLastCall().anyTimes();
   
    EasyMock.replay(mockActionInvocation);
   
View Full Code Here

    paramMap.put("operationMode", new String[] { MessageStoreInterceptor.STORE_MODE });
   
    ActionContext actionContext = new ActionContext(new HashMap());
    actionContext.put(ActionContext.PARAMETERS, paramMap);
   
    ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
    mockActionInvocation.getInvocationContext();
    EasyMock.expectLastCall().andReturn(actionContext);
    EasyMock.expectLastCall().anyTimes();
   
    EasyMock.replay(mockActionInvocation);
   
View Full Code Here

    Map paramMap = new LinkedHashMap();
   
    ActionContext actionContext = new ActionContext(new HashMap());
    actionContext.put(ActionContext.PARAMETERS, paramMap);
   
    ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
    mockActionInvocation.getInvocationContext();
    EasyMock.expectLastCall().andReturn(actionContext);
    EasyMock.expectLastCall().anyTimes();
   
    EasyMock.replay(mockActionInvocation);
   
View Full Code Here

        List<Cookie> fooCookies = Arrays.asList(one, two);
        assertEquals(fooCookies, requestContext.findCookiesForName("foo"));
    }

    public void testInitialCallInContext() throws Exception {
        final ActionInvocation invocation = createMock(ActionInvocation.class);
        final ActionContext actionContext = new ActionContext(new HashMap());
        expect(invocation.getInvocationContext()).andReturn(actionContext);

        final boolean[] called = new boolean[1];
        Callable<String> callable = new Callable<String>() {
            public String call() throws Exception {
                RequestContextImpl requestContext = RequestContextImpl.get();
View Full Code Here

        RenderRequest req = (RenderRequest)mockRequest.proxy();
        RenderResponse res = (RenderResponse)mockResponse.proxy();
        PortletRequestDispatcher rd = (PortletRequestDispatcher)mockRd.proxy();
        PortletConfig cfg = (PortletConfig)mockConfig.proxy();
        PortletContext ctx = (PortletContext)mockCtx.proxy();
        ActionInvocation inv = (ActionInvocation)mockInvocation.proxy();
       
        Constraint[] params = new Constraint[]{same(req), same(res)};
        mockRd.expects(once()).method("include").with(params);
        mockPrep.expects(once()).method("include").with(params);
        mockCtx.expects(once()).method("getRequestDispatcher").with(eq("/WEB-INF/pages/testPage.jsp")).will(returnValue(rd));
View Full Code Here

      public String getMyLocation() {
        return "ThisIsMyLocation";
      }
    });
   
    ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
    mockActionInvocation.getStack();
    EasyMock.expectLastCall().andReturn(stack);
    EasyMock.replay(mockActionInvocation);
   
    InternalStrutsResultSupport result = new InternalStrutsResultSupport();
    result.setParse(true);
View Full Code Here

      public String getMyLocation() {
        return "/myPage?param=value&param1=value1";
      }
    });
   
    ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
    mockActionInvocation.getStack();
    EasyMock.expectLastCall().andReturn(stack);
    EasyMock.replay(mockActionInvocation);
   
    InternalStrutsResultSupport result = new InternalStrutsResultSupport();
    result.setParse(true);
View Full Code Here

      public String getMyLocation() {
        return "myLocation.jsp";
      }
    });
   
    ActionInvocation mockActionInvocation = EasyMock.createNiceMock(ActionInvocation.class);
    EasyMock.replay(mockActionInvocation);
   
    InternalStrutsResultSupport result = new InternalStrutsResultSupport();
    result.setParse(false);
    result.setEncode(false); // don't really need this, as encode is only valid when parse is true.
View Full Code Here

     * @param action
     */
    private void evaluateExtraParamsServletRequest(String action, String namespace, boolean isAjax) {
        if (action == null) {
            // no action supplied? ok, then default to the current request (action or general URL)
            ActionInvocation ai = (ActionInvocation) getStack().getContext().get(ActionContext.ACTION_INVOCATION);
            if (ai != null) {
                action = ai.getProxy().getActionName();
                namespace = ai.getProxy().getNamespace();
            } else {
                // hmm, ok, we need to just assume the current URL cut down
                String uri = request.getRequestURI();
                action = uri.substring(uri.lastIndexOf('/'));
            }
View Full Code Here

TOP

Related Classes of com.opensymphony.xwork2.ActionInvocation

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.