Search in sources :

Example 6 with AnnotationConfigApplicationContext

use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.

the class ZipkinElasticsearchStorageAutoConfigurationTest method strictTraceId_defaultsToTrue.

@Test
public void strictTraceId_defaultsToTrue() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:elasticsearch");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchStorageAutoConfiguration.class);
    context.refresh();
    assertThat(es().strictTraceId).isTrue();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 7 with AnnotationConfigApplicationContext

use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.

the class ZipkinMySQLStorageAutoConfigurationTest method providesStorageComponent_whenStorageTypeMySQL.

@Test
public void providesStorageComponent_whenStorageTypeMySQL() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:mysql");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinMySQLStorageAutoConfiguration.class);
    context.refresh();
    assertThat(context.getBean(MySQLStorage.class)).isNotNull();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 8 with AnnotationConfigApplicationContext

use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.

the class ZipkinMySQLStorageAutoConfigurationTest method canOverridesProperty_username.

@Test
public void canOverridesProperty_username() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:mysql", "zipkin.storage.mysql.username:robot");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinMySQLStorageAutoConfiguration.class);
    context.refresh();
    assertThat(context.getBean(ZipkinMySQLStorageProperties.class).getUsername()).isEqualTo("robot");
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ZipkinMySQLStorageProperties(zipkin.autoconfigure.storage.mysql.ZipkinMySQLStorageProperties) Test(org.junit.Test)

Example 9 with AnnotationConfigApplicationContext

use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.

the class ZipkinMySQLStorageAutoConfigurationTest method strictTraceId_defaultsToTrue.

@Test
public void strictTraceId_defaultsToTrue() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:mysql");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinMySQLStorageAutoConfiguration.class);
    context.refresh();
    assertThat(context.getBean(MySQLStorage.class).strictTraceId).isTrue();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 10 with AnnotationConfigApplicationContext

use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.

the class ZipkinUiAutoConfigurationTest method createContextWithOverridenProperty.

private static AnnotationConfigApplicationContext createContextWithOverridenProperty(String pair) {
    AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
    addEnvironment(context, pair);
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinUiAutoConfiguration.class);
    context.refresh();
    return context;
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext)

Aggregations

AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)694 Test (org.junit.Test)513 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)42 Before (org.junit.Before)21 ApplicationContext (org.springframework.context.ApplicationContext)19 Filter (javax.servlet.Filter)15 OncePerRequestFilter (org.springframework.web.filter.OncePerRequestFilter)14 Map (java.util.Map)13 TestBean (org.springframework.tests.sample.beans.TestBean)13 PropertyPlaceholderAutoConfiguration (org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration)12 MockMvc (org.springframework.test.web.servlet.MockMvc)12 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)10 MockEnvironment (org.springframework.mock.env.MockEnvironment)10 MapPropertySource (org.springframework.core.env.MapPropertySource)9 HashMap (java.util.HashMap)8 ConcurrentMapCache (org.springframework.cache.concurrent.ConcurrentMapCache)7 MBeanExporter (org.springframework.jmx.export.MBeanExporter)7 ModelAndView (org.springframework.web.servlet.ModelAndView)7 Ignore (org.junit.Ignore)6 Method (java.lang.reflect.Method)5