Search in sources :

Example 11 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method configuresPipeline.

@Test
public void configuresPipeline() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.hosts:http://host1:9200", "zipkin.storage.elasticsearch.pipeline:zipkin");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchOkHttpAutoConfiguration.class, ZipkinElasticsearchHttpStorageAutoConfiguration.class);
    context.refresh();
    assertThat(es().pipeline()).isEqualTo("zipkin");
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 12 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method dailyIndexFormat.

@Test
public void dailyIndexFormat() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.hosts:http://host1:9200");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchOkHttpAutoConfiguration.class, ZipkinElasticsearchHttpStorageAutoConfiguration.class);
    context.refresh();
    assertThat(es().indexNameFormatter().indexNameForTimestamp(0)).isEqualTo("zipkin-1970-01-01");
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 13 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method providesStorageComponent_whenStorageTypeElasticsearchAndHostsAreUrls.

@Test
public void providesStorageComponent_whenStorageTypeElasticsearchAndHostsAreUrls() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.hosts:http://host1:9200");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchOkHttpAutoConfiguration.class, ZipkinElasticsearchHttpStorageAutoConfiguration.class);
    context.refresh();
    assertThat(es()).isNotNull();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 14 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method usesInterceptorsQualifiedWith_zipkinElasticsearchHttp.

/** Ensures we can wire up network interceptors, such as for logging or authentication */
@Test
public void usesInterceptorsQualifiedWith_zipkinElasticsearchHttp() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.hosts:http://host1:9200");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchOkHttpAutoConfiguration.class, InterceptorConfiguration.class);
    context.refresh();
    assertThat(context.getBean(OkHttpClient.class).networkInterceptors()).containsOnlyOnce(InterceptorConfiguration.one, InterceptorConfiguration.two);
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) OkHttpClient(okhttp3.OkHttpClient) Test(org.junit.Test)

Example 15 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method strictTraceId_defaultsToTrue.

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

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