Examples of ActionInvocation


Examples of com.opensymphony.xwork2.ActionInvocation

    controlActionProxy.setReturnValue("noSuchMethod");
   
   
    // ActionInvocation
    MockControl controlActionInvocation = MockControl.createControl(ActionInvocation.class);
    ActionInvocation mockActionInvocation = (ActionInvocation) controlActionInvocation.getMock();
    mockActionInvocation.getAction();
    controlActionInvocation.setReturnValue(action);
    mockActionInvocation.getProxy();
    controlActionInvocation.setReturnValue(mockActionProxy);
   
    controlActionProxy.replay();
    controlActionInvocation.replay();
   
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

    controlActionProxy.setReturnValue("save");
   
   
    // ActionInvocation
    MockControl controlActionInvocation = MockControl.createControl(ActionInvocation.class);
    ActionInvocation mockActionInvocation = (ActionInvocation) controlActionInvocation.getMock();
    mockActionInvocation.getAction();
    controlActionInvocation.setReturnValue(action);
    mockActionInvocation.getProxy();
    controlActionInvocation.setReturnValue(mockActionProxy);
   
    controlActionProxy.replay();
    controlActionInvocation.replay();
   
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

    if (urlComponent.getScheme() != null) {
      scheme = urlComponent.getScheme();
    }

         String result;
         ActionInvocation ai = (ActionInvocation) ActionContext.getContext().get(ActionContext.ACTION_INVOCATION);
          if (urlComponent.getValue() == null && urlComponent.getAction() != null) {
                  result = urlComponent.determineActionURL(urlComponent.getAction(), urlComponent.getNamespace(), urlComponent.getMethod(), urlComponent.getHttpServletRequest(), urlComponent.getHttpServletResponse(), urlComponent.getParameters(), scheme, urlComponent.isIncludeContext(), urlComponent.isEncode(), urlComponent.isForceAddSchemeHostAndPort(), urlComponent.isEscapeAmp());
          } else if (urlComponent.getValue() == null && urlComponent.getAction() == null && ai != null) {
                  // both are null, we will default to the current action

                  final String action = ai.getProxy().getActionName();
                  final String namespace = ai.getProxy().getNamespace();
                  final String method = urlComponent.getMethod() != null || !ai.getProxy().isMethodSpecified() ? urlComponent.getMethod() : ai.getProxy().getMethod();
                  result = urlComponent.determineActionURL(action, namespace, method, urlComponent.getHttpServletRequest(), urlComponent.getHttpServletResponse(), urlComponent.getParameters(), scheme, urlComponent.isIncludeContext(), urlComponent.isEncode(), urlComponent.isForceAddSchemeHostAndPort(), urlComponent.isEscapeAmp());
          } else {
                  String _value = urlComponent.getValue();

                  // We don't include the request parameters cause they would have been
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

    if(formComponent.action != null) {
      action = formComponent.findString(formComponent.action);
    } else {
      // no action supplied? ok, then default to the current request
      // (action or general URL)
      ActionInvocation ai = (ActionInvocation) formComponent.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 = formComponent.request.getRequestURI();
        action = uri.substring(uri.lastIndexOf('/'));
      }
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

        });

        // ActionContext is destroyed during rebuilding configuration
        ActionContext.getContext().setLocale(locale);

        ActionInvocation invocation = new DefaultActionInvocation(ActionContext.getContext().getContextMap(), true);
        container.inject(invocation);
        invocation.init(actionProxyFactory.createActionProxy("", "annotation", null, ActionContext.getContext().getContextMap()));

        AnnotationActionValidatorManager manager = new AnnotationActionValidatorManager();
        container.inject(manager);

        ValidatorFactory vf = container.getInstance(ValidatorFactory.class);
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

public class CookieProviderInterceptorTest extends XWorkTestCase {

    public void testPreResultListenerAddition() throws Exception {
        // given
        ActionInvocation invocation = EasyMock.createNiceMock(ActionInvocation.class);
        CookieProviderInterceptor interceptor = new CookieProviderInterceptor();

        invocation.addPreResultListener(interceptor);

        EasyMock.replay(invocation);

        // when
        interceptor.intercept(invocation);
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

        ActionContext actionContext = new ActionContext(new HashMap());
        actionContext.put(ActionContext.PARAMETERS, paramMap);
        actionContext.put(ActionContext.SESSION, sessionMap);

        // Mock (ActionInvocation)
        ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
        mockActionInvocation.getInvocationContext();
        EasyMock.expectLastCall().andReturn(actionContext);
        EasyMock.expectLastCall().anyTimes();

        mockActionInvocation.invoke();
        EasyMock.expectLastCall().andReturn(Action.SUCCESS);

        mockActionInvocation.getAction();
        EasyMock.expectLastCall().andReturn(action);
       
        mockActionInvocation.getResult();
        EasyMock.expectLastCall().andReturn(new ServletActionRedirectResult());

        EasyMock.replay(mockActionInvocation);

        interceptor.init();
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

        ActionContext actionContext = new ActionContext(new HashMap());
        actionContext.put(ActionContext.PARAMETERS, paramMap);

        // Mock (ActionInvocation)
        ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
        mockActionInvocation.getInvocationContext();
        EasyMock.expectLastCall().andReturn(actionContext);
        EasyMock.expectLastCall().anyTimes();

        mockActionInvocation.invoke();
        EasyMock.expectLastCall().andReturn(Action.SUCCESS);

        mockActionInvocation.getAction();
        EasyMock.expectLastCall().andReturn(action);

        mockActionInvocation.getResult();
        EasyMock.expectLastCall().andReturn(new ServletActionRedirectResult());

        EasyMock.replay(mockActionInvocation);

        interceptor.init();
View Full Code Here

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.expectLastCall().anyTimes();
       
        mockActionInvocation.getResult();
        EasyMock.expectLastCall().andReturn(new ServletActionRedirectResult());

        EasyMock.replay(mockActionInvocation);

        interceptor.init();
View Full Code Here

Examples of com.opensymphony.xwork2.ActionInvocation

        ActionContext actionContext = new ActionContext(new HashMap());
        actionContext.put(ActionContext.PARAMETERS, paramMap);
        actionContext.put(ActionContext.SESSION, sessionMap);

        // Mock (ActionInvocation)
        ActionInvocation mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
        mockActionInvocation.getInvocationContext();
        EasyMock.expectLastCall().andReturn(actionContext);
        EasyMock.expectLastCall().anyTimes();

        mockActionInvocation.invoke();
        EasyMock.expectLastCall().andReturn(Action.SUCCESS);

        mockActionInvocation.getAction();
        EasyMock.expectLastCall().andReturn(action);
        EasyMock.expectLastCall().anyTimes();

        mockActionInvocation.getResult();
        EasyMock.expectLastCall().andReturn(new ServletActionRedirectResult());
       
        EasyMock.replay(mockActionInvocation);

        interceptor.init();
        interceptor.intercept(mockActionInvocation);
        interceptor.destroy();

        assertEquals(3, sessionMap.size());
        assertTrue(sessionMap.containsKey(MessageStoreInterceptor.actionErrorsSessionKey));
        assertTrue(sessionMap.containsKey(MessageStoreInterceptor.actionMessagesSessionKey));
        assertTrue(sessionMap.containsKey(MessageStoreInterceptor.fieldErrorsSessionKey));

        List actionErrors = (List) sessionMap.get(MessageStoreInterceptor.actionErrorsSessionKey);
        List actionMessages = (List) sessionMap.get(MessageStoreInterceptor.actionMessagesSessionKey);
        Map fieldErrors = (Map) sessionMap.get(MessageStoreInterceptor.fieldErrorsSessionKey);

        assertEquals(2, actionErrors.size());
        assertEquals(2, actionMessages.size());
        assertEquals(2, fieldErrors.size());

        assertTrue(actionErrors.contains("some action error 1"));
        assertTrue(actionErrors.contains("some action error 2"));
        assertTrue(actionMessages.contains("some action message 1"));
        assertTrue(actionMessages.contains("some action message 2"));
        assertTrue(fieldErrors.containsKey("field1"));
        assertTrue(fieldErrors.containsKey("field2"));
        assertEquals(((List)fieldErrors.get("field1")).size(), 1);
        assertEquals(((List)fieldErrors.get("field2")).size(), 1);
        assertEquals(((List)fieldErrors.get("field1")).get(0), "some field error 1");
        assertEquals(((List)fieldErrors.get("field2")).get(0), "some field error 2");

        EasyMock.verify(mockActionInvocation);
       
        action = new ActionSupport();

        mockActionInvocation = EasyMock.createControl().createMock(ActionInvocation.class);
        mockActionInvocation.invoke();
        EasyMock.expectLastCall().andReturn(Action.SUCCESS);

        sessionMap.put(MessageStoreInterceptor.actionErrorsSessionKey, actionErrors);
        sessionMap.put(MessageStoreInterceptor.actionMessagesSessionKey, actionMessages);
        sessionMap.put(MessageStoreInterceptor.fieldErrorsSessionKey, fieldErrors);


        actionContext = new ActionContext(new HashMap());
        actionContext.put(ActionContext.PARAMETERS, paramMap);
        actionContext.put(ActionContext.SESSION, sessionMap);

        mockActionInvocation.getInvocationContext();
        EasyMock.expectLastCall().andReturn(actionContext);
        EasyMock.expectLastCall().anyTimes();

        mockActionInvocation.getAction();
        EasyMock.expectLastCall().andReturn(action);
        EasyMock.expectLastCall().anyTimes();
       
        mockActionInvocation.getResult();
        EasyMock.expectLastCall().andReturn(new ServletActionRedirectResult());

        EasyMock.replay(mockActionInvocation);

        interceptor.init();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.