Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletContext


        PrincipalAware mock = (PrincipalAware) control.getMock();

        MockActionInvocation mai = createActionInvocation(mock);
        mai.getInvocationContext().put(StrutsStatics.HTTP_REQUEST, req);
       
        MockServletContext ctx = new MockServletContext();
        mai.getInvocationContext().put(StrutsStatics.SERVLET_CONTEXT, ctx);

        mock.setPrincipalProxy(null); // we can do this because of ALWAYS_MATCHER
        control.setVoidCallable();
View Full Code Here


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

        MockActionInvocation mai = createActionInvocation(mock);

        MockServletContext ctx = new MockServletContext();
        mai.getInvocationContext().put(StrutsStatics.SERVLET_CONTEXT, ctx);

        mock.setServletContext((ServletContext) ctx);
        control.setVoidCallable();
View Full Code Here

        Dispatcher.setInstance(null);

        filterConfig = new MockFilterConfig();
        request = new MockHttpServletRequest();
        response = new MockHttpServletResponse();
        servletContext = new MockServletContext();

        _dispatcher1 = new InnerDispatcher(servletContext){
            @Override
            public String toString() {
                return "dispatcher1";
View Full Code Here

* @version $Date$ $Id$
*/
public class FilterDispatcherTest extends StrutsInternalTestCase {

    public void testIfActionMapperIsNullDontServiceAction() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockFilterConfig filterConfig = new MockFilterConfig(servletContext);
        MockHttpServletRequest req = new MockHttpServletRequest(servletContext);
        MockHttpServletResponse res = new MockHttpServletResponse();
        MockFilterChain chain = new MockFilterChain();
        final NoOpDispatcher _dispatcher = new NoOpDispatcher(servletContext);
View Full Code Here

        assertFalse(_dispatcher.serviceRequest);
    }
   
    public void testCharacterEncodingSetBeforeRequestWrappingAndActionService() throws Exception {
        MockServletContext servletContext = new MockServletContext();
        MockFilterConfig filterConfig = new MockFilterConfig(servletContext);
        MockHttpServletRequest req = new MockHttpServletRequest(servletContext);
        MockHttpServletResponse res = new MockHttpServletResponse();
        MockFilterChain chain = new MockFilterChain();
        final InnerDispatcher _dispatcher = new InnerDispatcher(servletContext);
View Full Code Here

    }
   
    public void testPrepareMultipartRequest() throws Exception {
        MockHttpServletRequest req = new MockHttpServletRequest();
        MockHttpServletResponse res = new MockHttpServletResponse();
        ServletContext ctx = new MockServletContext();

        req.setContentType("multipart/form-data");
        Dispatcher du = initDispatcher(Collections.<String, String>emptyMap());
        du.prepare(req, res);
        HttpServletRequest wrapped = du.wrapRequest(req, ctx);
View Full Code Here

   
    public void testConfigurationManager() {
      Dispatcher du;
      InternalConfigurationManager configurationManager = new InternalConfigurationManager();
      try {
        du = new Dispatcher(new MockServletContext(), new HashMap<String, String>());
        du.setConfigurationManager(configurationManager);
       
        du.init();
       
            Dispatcher.setInstance(du);
View Full Code Here

    }
   
    public void testObjectFactoryDestroy() throws Exception {

        final InnerDestroyableObjectFactory destroyedObjectFactory = new InnerDestroyableObjectFactory();
        Dispatcher du = new Dispatcher(new MockServletContext(), new HashMap<String, String>());
        ConfigurationManager cm = new ConfigurationManager();
        Mock mockConfiguration = new Mock(Configuration.class);
        cm.setConfiguration((Configuration)mockConfiguration.proxy());
       
        Mock mockContainer = new Mock(Container.class);
View Full Code Here

        mockConfiguration.expect("destroy");
       
        ConfigurationManager configurationManager = new ConfigurationManager();
        configurationManager.setConfiguration((Configuration) mockConfiguration.proxy());
       
        Dispatcher dispatcher = new Dispatcher(new MockServletContext(), new HashMap<String, String>());
        dispatcher.setConfigurationManager(configurationManager);
        dispatcher.cleanup();
       
        mockInterceptor.verify();
        mockContainer.verify();
View Full Code Here

        this.request.setRequestURI("http://sumeruri");
        this.context = ActionContext.getContext();
        this.context.put(StrutsStatics.HTTP_RESPONSE, this.response);
        this.context.put(StrutsStatics.HTTP_REQUEST, this.request);
        this.stack = context.getValueStack();
        this.servletContext = new MockServletContext();
        this.context.put(StrutsStatics.SERVLET_CONTEXT, this.servletContext);
        this.invocation = new MockActionInvocation();
        this.invocation.setInvocationContext(this.context);
        this.invocation.setStack(this.stack);
    }
View Full Code Here

TOP

Related Classes of org.springframework.mock.web.MockServletContext

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.