Package org.springframework.mock.web

Examples of org.springframework.mock.web.MockServletContext.addInitParameter()


  public void testInternalResourceViewResolverWithJstlAndContextParam() throws Exception {
    Locale locale = !Locale.GERMAN.equals(Locale.getDefault()) ? Locale.GERMAN : Locale.FRENCH;

    MockServletContext sc = new MockServletContext();
    sc.addInitParameter(Config.FMT_LOCALIZATION_CONTEXT, "org/springframework/web/context/WEB-INF/context-messages");
    StaticWebApplicationContext wac = new StaticWebApplicationContext();
    wac.setServletContext(sc);
    wac.addMessage("code1", locale, "messageX");
    wac.refresh();
    InternalResourceViewResolver vr = new InternalResourceViewResolver();
View Full Code Here


    }
   
    private static FilterConfig filterConfigWithContextParams(String inc, String exc)
    {
        MockServletContext context = new MockServletContext();
        context.addInitParameter(InitParameterNames.INCLUDE_PATH_PATTERN, inc);
        context.addInitParameter(InitParameterNames.EXCLUDE_PATH_PATTERN, exc);
        return new MockFilterConfig(context);
    }
}
View Full Code Here

   
    private static FilterConfig filterConfigWithContextParams(String inc, String exc)
    {
        MockServletContext context = new MockServletContext();
        context.addInitParameter(InitParameterNames.INCLUDE_PATH_PATTERN, inc);
        context.addInitParameter(InitParameterNames.EXCLUDE_PATH_PATTERN, exc);
        return new MockFilterConfig(context);
    }
}
View Full Code Here

  }

  @Test
  public void registerServletParamPropertySources_AbstractRefreshableWebApplicationContext() {
    MockServletContext servletContext = new MockServletContext();
    servletContext.addInitParameter("pCommon", "pCommonContextValue");
    servletContext.addInitParameter("pContext1", "pContext1Value");

    MockServletConfig servletConfig = new MockServletConfig(servletContext);
    servletConfig.addInitParameter("pCommon", "pCommonConfigValue");
    servletConfig.addInitParameter("pConfig1", "pConfig1Value");
View Full Code Here

  @Test
  public void registerServletParamPropertySources_AbstractRefreshableWebApplicationContext() {
    MockServletContext servletContext = new MockServletContext();
    servletContext.addInitParameter("pCommon", "pCommonContextValue");
    servletContext.addInitParameter("pContext1", "pContext1Value");

    MockServletConfig servletConfig = new MockServletConfig(servletContext);
    servletConfig.addInitParameter("pCommon", "pCommonConfigValue");
    servletConfig.addInitParameter("pConfig1", "pConfig1Value");
View Full Code Here

  }

  @Test
  public void registerServletParamPropertySources_GenericWebApplicationContext() {
    MockServletContext servletContext = new MockServletContext();
    servletContext.addInitParameter("pCommon", "pCommonContextValue");
    servletContext.addInitParameter("pContext1", "pContext1Value");

    GenericWebApplicationContext ctx = new GenericWebApplicationContext();
    ctx.setServletContext(servletContext);
    ctx.refresh();
View Full Code Here

  @Test
  public void registerServletParamPropertySources_GenericWebApplicationContext() {
    MockServletContext servletContext = new MockServletContext();
    servletContext.addInitParameter("pCommon", "pCommonContextValue");
    servletContext.addInitParameter("pContext1", "pContext1Value");

    GenericWebApplicationContext ctx = new GenericWebApplicationContext();
    ctx.setServletContext(servletContext);
    ctx.refresh();
View Full Code Here

  }

  @Test
  public void registerServletParamPropertySources_StaticWebApplicationContext() {
    MockServletContext servletContext = new MockServletContext();
    servletContext.addInitParameter("pCommon", "pCommonContextValue");
    servletContext.addInitParameter("pContext1", "pContext1Value");

    MockServletConfig servletConfig = new MockServletConfig(servletContext);
    servletConfig.addInitParameter("pCommon", "pCommonConfigValue");
    servletConfig.addInitParameter("pConfig1", "pConfig1Value");
View Full Code Here

  @Test
  public void registerServletParamPropertySources_StaticWebApplicationContext() {
    MockServletContext servletContext = new MockServletContext();
    servletContext.addInitParameter("pCommon", "pCommonContextValue");
    servletContext.addInitParameter("pContext1", "pContext1Value");

    MockServletConfig servletConfig = new MockServletConfig(servletContext);
    servletConfig.addInitParameter("pCommon", "pCommonConfigValue");
    servletConfig.addInitParameter("pConfig1", "pConfig1Value");
View Full Code Here

    @Test
    public void testAllowsRenewContextParam() throws Exception {
        final Saml11TicketValidationFilter f = new Saml11TicketValidationFilter();
        final MockServletContext context = new MockServletContext();
        context.addInitParameter("casServerUrlPrefix", "https://cas.example.com");
        context.addInitParameter("renew", "true");
        final TicketValidator validator = f.getTicketValidator(new MockFilterConfig(context));
        assertTrue(validator instanceof Saml11TicketValidator);
        assertTrue(((Saml11TicketValidator) validator).isRenew());
    }
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.