Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletConfig


        assertTrue(super.applicationContext instanceof WebApplicationContext);
        if (super.applicationContext instanceof WebApplicationContext) {
            servletContext = ((WebApplicationContext) applicationContext).getServletContext();
            assertNotNull(servletContext);
            // enable DAO access : does activate Autowired by using AutowiringRemoteServiceServlet.init()
            servletConfig = new MockServletConfig(servletContext);
        }
        // prepare authentication service
        mockRequest = new MockHttpServletRequest(servletConfig.getServletContext());
        assertNotNull(mockRequest.getSession());
        authenticationService.setSession(mockRequest.getSession());
View Full Code Here


    {

        MockServletContext mockServletContext = new MockServletContext();
        mockServletContext.setContextPath( "direct-memory" );

        MockServletConfig mockServletConfig = new MockServletConfig( mockServletContext );

        directMemoryServlet.init( mockServletConfig );
    }
View Full Code Here

        super.setUp();

        servlet =
            (HttpServlet)Class.forName("org.apache.wink.server.internal.servlet.RestServlet")
                .newInstance();
        MockServletConfig servletConfig = new MockServletConfig(servletContext);
        servlet.init(servletConfig);
    }
View Full Code Here

        RequestProcessor requestProcessor = new RequestProcessor(configuration);

        MockServletContext servletContext = new MockServletContext();
        servletContext.setAttribute(requestProcessorAttribute, requestProcessor);

        MockServletConfig servletConfig = new MockServletConfig(servletContext);
        servletConfig.addInitParameter("javax.ws.rs.Application", getApplicationClassName());
        servletConfig.addInitParameter("requestProcessorAttribute", requestProcessorAttribute);

        String propertiesFile = getPropertiesFile();
        if (propertiesFile != null) {
            servletConfig.addInitParameter("propertiesLocation", propertiesFile);
        }

        assertNull(configuration.getServletContext());
        assertNull(configuration.getServletConfig());
View Full Code Here

   
    @Override
    public void setUp()
    {
        servletContext = new MockServletContext(new DefaultResourceLoader());
        servletConfig = new MockServletConfig(servletContext);
        ((MockServletConfig) servletConfig).addInitParameter("spring-configuration", "/test-spring-init-servlet-beans.xml");
       
        springInitServlet = new SpringInitServlet();
       
        try
View Full Code Here

  private final DispatcherServlet dispatcherServlet;

    public DispatcherServletChannelInitializer() throws ServletException {

      MockServletContext servletContext = new MockServletContext();
      MockServletConfig servletConfig = new MockServletConfig(servletContext);

      AnnotationConfigWebApplicationContext wac = new AnnotationConfigWebApplicationContext();
    wac.setServletContext(servletContext);
    wac.setServletConfig(servletConfig);
      wac.register(WebConfig.class);
View Full Code Here

    ServletContext servletContext = webAppContext.getServletContext();
    Assert.state(servletContext != null,"ServletContext not configured by concrete MockMvcBuilder");

    Filter[] filterArray = this.filters.toArray(new Filter[this.filters.size()]);
    MockServletConfig mockServletConfig = new MockServletConfig(servletContext);

    return super.createMockMvc(filterArray, mockServletConfig, webAppContext,
        this.defaultRequestBuilder, this.globalResultMatchers, this.globalResultHandlers);
  }
View Full Code Here

        super.setUp();

        try {
            servlet = new DispatcherServlet();
            servlet.setContextClass(MyContext.class);
            config = new MockServletConfig(new MockServletContext(), "simple");
            servlet.init(config);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
View Full Code Here

            new AbstractRepositoryServletTestCase.TestWebapplicationContext( applicationContext, mockServletContext );

        mockServletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                                         webApplicationContext );

        MockServletConfig mockServletConfig = new MockServletConfig()
        {
            @Override
            public ServletContext getServletContext()
            {
                return mockServletContext;
View Full Code Here

            new TestWebapplicationContext( applicationContext, mockServletContext );

        mockServletContext.setAttribute( WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE,
                                         webApplicationContext );

        MockServletConfig mockServletConfig = new MockServletConfig()
        {
            @Override
            public ServletContext getServletContext()
            {
                return mockServletContext;
View Full Code Here

TOP

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

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.