Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletContext$MimeTypeResolver


    public void publishedEventIsReceivedbyListener() {
        HttpSessionEventPublisher publisher = new HttpSessionEventPublisher();

        StaticWebApplicationContext context = new StaticWebApplicationContext();

        MockServletContext servletContext = new MockServletContext();
        servletContext.setAttribute(StaticWebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, context);

        context.setServletContext(servletContext);
        context.registerSingleton("listener", MockApplicationListener.class, null);
        context.refresh();
View Full Code Here


    // SEC-2599
    @Test(expected=IllegalStateException.class)
    public void sessionCreatedNullApplicationContext() {
        HttpSessionEventPublisher publisher = new HttpSessionEventPublisher();
        MockServletContext servletContext = new MockServletContext();
        MockHttpSession session = new MockHttpSession(servletContext);
        HttpSessionEvent event = new HttpSessionEvent(session);

        publisher.sessionCreated(event);
    }
View Full Code Here

    // SEC-2599
    @Test(expected=IllegalStateException.class)
    public void sessionDestroyedNullApplicationContext() {
        HttpSessionEventPublisher publisher = new HttpSessionEventPublisher();
        MockServletContext servletContext = new MockServletContext();
        MockHttpSession session = new MockHttpSession(servletContext);
        HttpSessionEvent event = new HttpSessionEvent(session);

        publisher.sessionDestroyed(event);
    }
View Full Code Here

        // no exception
    }

    @Test
    public void maxSessionsSameSessionId() {
        MockHttpSession session = new MockHttpSession(new MockServletContext(), sessionInformation.getSessionId());
        request.setSession(session);
        when(sessionRegistry.getAllSessions(any(), anyBoolean())).thenReturn(Collections.<SessionInformation>singletonList(sessionInformation));
        strategy.setMaximumSessions(1);
        strategy.setExceptionIfMaximumExceeded(true);
View Full Code Here

    private MockHttpServletRequest request;
    private MockHttpServletResponse response;

    @Before
    public void setUp() {
        MockServletContext servletContext = new MockServletContext();
        this.request = new MockHttpServletRequest(servletContext);
        this.response = new MockHttpServletResponse();
        MockPageContext pageContext = new MockPageContext(servletContext, this.request, this.response);
        this.tag = new MockTag();
        this.tag.setPageContext(pageContext);
View Full Code Here

    private MessageDispatcherServlet servlet;

    @Before
    public void setUp() throws Exception {
        config = new MockServletConfig(new MockServletContext(), "spring-ws");
        servlet = new MessageDispatcherServlet();
    }
View Full Code Here

  /**
   *
   */
  @Test
  public void testGetResources() {
    final MockServletContext servletContext = new MockServletContext(
        "src/test/resources", new FileSystemResourceLoader());
    String[] includes = new String[] { "**/css/**", "private/a.css",
        "external/*/a.css" };
    final String[] excludes = new String[] { "**/css/b.css" };
    Set<String> resources = new ResourceScanner(servletContext, includes,
View Full Code Here

    private ServletContextListener listener = null;
    private ContextLoaderListener springListener = null;

    protected void setUp() throws Exception {
        super.setUp();
        sc = new MockServletContext("");

        // initialize Spring
        sc.addInitParameter(ContextLoader.CONFIG_LOCATION_PARAM,
                "classpath:/applicationContext-dao.xml, " +
                "classpath:/applicationContext-service.xml, " +
View Full Code Here

 
  private WebObjectSource createWebObjectSource()
  {
    MockHttpServletRequest request=new MockHttpServletRequest();
    MockHttpServletResponse response=new MockHttpServletResponse();
    MockServletContext application=new MockServletContext();
   
    WebObjectSource os=new DefaultWebObjectSource(request, response, application);
   
    return os;
  }
View Full Code Here

 
  private WebObjectSource createWebObjectSource()
  {
    MockHttpServletRequest request=new MockHttpServletRequest();
    MockHttpServletResponse response=new MockHttpServletResponse();
    MockServletContext application=new MockServletContext();
   
    WebObjectSource os=new DefaultWebObjectSource(request, response, application, new WebGenericConverter());
   
    return os;
  }
View Full Code Here

TOP

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

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.