Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockFilterConfig


    wac.refresh();
    wac.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    CommonsMultipartResolver resolver = new CommonsMultipartResolver(wac.getServletContext());
    assertTrue(resolver.getFileItemFactory().getRepository().getAbsolutePath().endsWith("mytemp"));

    MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
    filterConfig.addInitParameter("class", "notWritable");
    filterConfig.addInitParameter("unknownParam", "someValue");
    final MultipartFilter filter = new MultipartFilter();
    filter.init(filterConfig);

    final List files = new ArrayList();
    final FilterChain filterChain = new FilterChain() {
View Full Code Here


    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    MockFilter targetFilter = (MockFilter) wac.getBean("targetFilter");

    MockFilterConfig proxyConfig = new MockFilterConfig(sc);
    proxyConfig.addInitParameter("targetBeanName", "targetFilter");
    DelegatingFilterProxy filterProxy = new DelegatingFilterProxy();
    filterProxy.init(proxyConfig);

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();
View Full Code Here

    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    MockFilter targetFilter = (MockFilter) wac.getBean("targetFilter");

    MockFilterConfig proxyConfig = new MockFilterConfig(sc, "targetFilter");
    DelegatingFilterProxy filterProxy = new DelegatingFilterProxy();
    filterProxy.init(proxyConfig);

    MockHttpServletRequest request = new MockHttpServletRequest();
    MockHttpServletResponse response = new MockHttpServletResponse();
View Full Code Here

  }

  public void testDelegatingFilterProxyWithLazyContextStartup() throws ServletException, IOException {
    ServletContext sc = new MockServletContext();

    MockFilterConfig proxyConfig = new MockFilterConfig(sc);
    proxyConfig.addInitParameter("targetBeanName", "targetFilter");
    DelegatingFilterProxy filterProxy = new DelegatingFilterProxy();
    filterProxy.init(proxyConfig);

    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
View Full Code Here

    wac.getServletContext().setAttribute(WebUtils.TEMP_DIR_CONTEXT_ATTRIBUTE, new File("mytemp"));
    wac.getServletContext().setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    CommonsMultipartResolver resolver = new CommonsMultipartResolver(wac.getServletContext());
    assertTrue(resolver.getFileItemFactory().getRepository().getAbsolutePath().endsWith("mytemp"));

    MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
    filterConfig.addInitParameter("multipartResolverBeanName", "myMultipartResolver");

    final List files = new ArrayList();
    FilterChain filterChain = new FilterChain() {
      public void doFilter(ServletRequest originalRequest, ServletResponse response) {
        if (originalRequest instanceof MultipartHttpServletRequest) {
View Full Code Here

    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);

    MockFilter targetFilter = (MockFilter) wac.getBean("targetFilter");

    MockFilterConfig proxyConfig = new MockFilterConfig(sc);
    proxyConfig.addInitParameter("targetBeanName", "targetFilter");
    proxyConfig.addInitParameter("targetFilterLifecycle", "true");
    DelegatingFilterProxy filterProxy = new DelegatingFilterProxy();
    filterProxy.init(proxyConfig);
    assertEquals(proxyConfig, targetFilter.filterConfig);

    MockHttpServletRequest request = new MockHttpServletRequest();
View Full Code Here

        }
      }
    };

    DummyFilterChain fc = new DummyFilterChain();
    MockFilterConfig mfc = new MockFilterConfig(new MockServletContext(), "foo");

    RequestContextFilter rbf = new RequestContextFilter();
    rbf.init(mfc);

    try {
View Full Code Here

    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    MockHttpServletRequest request = new MockHttpServletRequest(sc);
    MockHttpServletResponse response = new MockHttpServletResponse();

    MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
    MockFilterConfig filterConfig2 = new MockFilterConfig(wac.getServletContext(), "filter2");
    filterConfig2.addInitParameter("sessionFactoryBeanName", "mySessionFactory");
    filterConfig2.addInitParameter("flushMode", "AUTO");

    final OpenSessionInViewFilter filter = new OpenSessionInViewFilter();
    filter.init(filterConfig);
    final OpenSessionInViewFilter filter2 = new OpenSessionInViewFilter();
    filter2.init(filterConfig2);
View Full Code Here

    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    MockHttpServletRequest request = new MockHttpServletRequest(sc);
    MockHttpServletResponse response = new MockHttpServletResponse();

    MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
    MockFilterConfig filterConfig2 = new MockFilterConfig(wac.getServletContext(), "filter2");
    filterConfig2.addInitParameter("sessionFactoryBeanName", "mySessionFactory");

    OpenSessionInViewInterceptor rawInterceptor = new OpenSessionInViewInterceptor();
    rawInterceptor.setSessionFactory(sf);
    HandlerInterceptor interceptor = new WebRequestHandlerInterceptorAdapter(rawInterceptor);
View Full Code Here

    wac.refresh();
    sc.setAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE, wac);
    MockHttpServletRequest request = new MockHttpServletRequest(sc);
    MockHttpServletResponse response = new MockHttpServletResponse();

    MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
    MockFilterConfig filterConfig2 = new MockFilterConfig(wac.getServletContext(), "filter2");
    filterConfig.addInitParameter("singleSession", "false");
    filterConfig2.addInitParameter("singleSession", "false");
    filterConfig2.addInitParameter("sessionFactoryBeanName", "mySessionFactory");

    final OpenSessionInViewFilter filter = new OpenSessionInViewFilter();
    filter.init(filterConfig);
    final OpenSessionInViewFilter filter2 = new OpenSessionInViewFilter();
    filter2.init(filterConfig2);
View Full Code Here

TOP

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

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.