Search in sources :

Example 46 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 47 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)

Example 48 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method doesntProvideStorageComponent_whenStorageTypeElasticsearchAndHostsNotUrls.

@Test
public void doesntProvideStorageComponent_whenStorageTypeElasticsearchAndHostsNotUrls() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:elasticsearch");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchOkHttpAutoConfiguration.class, ZipkinElasticsearchHttpStorageAutoConfiguration.class);
    context.refresh();
    thrown.expect(NoSuchBeanDefinitionException.class);
    es();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Example 49 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method canOverridesProperty_hostsWithList.

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

Example 50 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method doesntProvideStorageComponent_whenStorageTypeNotElasticsearch.

@Test
public void doesntProvideStorageComponent_whenStorageTypeNotElasticsearch() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:cassandra");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchHttpStorageAutoConfiguration.class);
    context.refresh();
    thrown.expect(NoSuchBeanDefinitionException.class);
    es();
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) Test(org.junit.Test)

Aggregations

AnnotationConfigApplicationContext (org.springframework.context.annotation.AnnotationConfigApplicationContext)800 Test (org.junit.Test)528 DSLContext (org.jooq.DSLContext)53 ConfigurableApplicationContext (org.springframework.context.ConfigurableApplicationContext)42 ApplicationContext (org.springframework.context.ApplicationContext)25 Before (org.junit.Before)23 DIConfiguration (com.khartec.waltz.service.DIConfiguration)15 Filter (javax.servlet.Filter)15 Map (java.util.Map)14 OncePerRequestFilter (org.springframework.web.filter.OncePerRequestFilter)14 TestBean (org.springframework.tests.sample.beans.TestBean)13 PropertyPlaceholderAutoConfiguration (org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration)12 MockMvc (org.springframework.test.web.servlet.MockMvc)12 EntityKind (com.khartec.waltz.model.EntityKind)11 List (java.util.List)10 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)10 MockEnvironment (org.springframework.mock.env.MockEnvironment)10 EntityReference (com.khartec.waltz.model.EntityReference)9 MapPropertySource (org.springframework.core.env.MapPropertySource)9 IOException (java.io.IOException)8