Package org.springframework.boot.context.embedded

Examples of org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext


        AbstractDeviceDelegatingViewResolver.class);
  }

  @Test
  public void deviceDelegatingThymeleafViewResolverEnabled() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:true");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        ThymeleafAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
View Full Code Here


        .getOrder() - 1);
  }

  @Test(expected = NoSuchBeanDefinitionException.class)
  public void deviceDelegatingThymeleafViewResolverDisabled() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:false");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        ThymeleafAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
View Full Code Here

        AbstractDeviceDelegatingViewResolver.class);
  }

  @Test
  public void defaultPropertyValues() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:true");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
        PropertyPlaceholderAutoConfiguration.class,
View Full Code Here

    assertEquals("", tabletSuffix);
  }

  @Test
  public void overrideNormalPrefix() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:true",
        "spring.mobile.devicedelegatingviewresolver.normalPrefix:normal/");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
View Full Code Here

    assertEquals("normal/", normalPrefix);
  }

  @Test
  public void overrideMobilePrefix() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:true",
        "spring.mobile.devicedelegatingviewresolver.mobilePrefix:mob/");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
View Full Code Here

    assertEquals("mob/", mobilePrefix);
  }

  @Test
  public void overrideTabletPrefix() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:true",
        "spring.mobile.devicedelegatingviewresolver.tabletPrefix:tab/");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
View Full Code Here

    assertEquals("tab/", tabletPrefix);
  }

  @Test
  public void overrideNormalSuffix() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:true",
        "spring.mobile.devicedelegatingviewresolver.normalSuffix:.nor");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
View Full Code Here

    assertEquals(".nor", normalSuffix);
  }

  @Test
  public void overrideMobileSuffix() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:true",
        "spring.mobile.devicedelegatingviewresolver.mobileSuffix:.mob");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
View Full Code Here

    assertEquals(".mob", mobileSuffix);
  }

  @Test
  public void overrideTabletSuffix() throws Exception {
    this.context = new AnnotationConfigEmbeddedWebApplicationContext();
    EnvironmentTestUtils.addEnvironment(this.context,
        "spring.mobile.devicedelegatingviewresolver.enabled:true",
        "spring.mobile.devicedelegatingviewresolver.tabletSuffix:.tab");
    this.context.register(Config.class, WebMvcAutoConfiguration.class,
        HttpMessageConvertersAutoConfiguration.class,
View Full Code Here

*/
public class TomcatPublicMetricsTests {

  @Test
  public void tomcatMetrics() throws Exception {
    AnnotationConfigEmbeddedWebApplicationContext context = new AnnotationConfigEmbeddedWebApplicationContext(
        Config.class);
    try {
      TomcatPublicMetrics tomcatMetrics = context
          .getBean(TomcatPublicMetrics.class);
      Iterator<Metric<?>> metrics = tomcatMetrics.metrics().iterator();
      assertThat(metrics.next().getName(), equalTo("httpsessions.max"));
      assertThat(metrics.next().getName(), equalTo("httpsessions.active"));
      assertThat(metrics.hasNext(), equalTo(false));
    }
    finally {
      context.close();
    }
  }
View Full Code Here

TOP

Related Classes of org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext

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.