Search in sources :

Example 26 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchAwsStorageAutoConfigurationTest method doesntProvidesAWSSignatureVersion4_whenStorageTypeElasticsearchAndHostsNotUrls.

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

Example 27 with AnnotationConfigApplicationContext

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

the class ZipkinElasticsearchAwsStorageAutoConfigurationTest method doesntProvideAWSSignatureVersion4_whenStorageTypeNotElasticsearch.

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

Example 28 with AnnotationConfigApplicationContext

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

the class ZipkinCassandraStorageAutoConfigurationTest method doesntProvidesStorageComponent_whenStorageTypeNotCassandra.

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

Example 29 with AnnotationConfigApplicationContext

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

the class ZipkinCassandraStorageAutoConfigurationTest method canOverridesProperty_contactPoints.

@Test
public void canOverridesProperty_contactPoints() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:cassandra", // note snake-case supported
    "zipkin.storage.cassandra.contact-points:host1,host2");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinCassandraStorageAutoConfiguration.class);
    context.refresh();
    assertThat(context.getBean(ZipkinCassandraStorageProperties.class).getContactPoints()).isEqualTo("host1,host2");
}
Also used : AnnotationConfigApplicationContext(org.springframework.context.annotation.AnnotationConfigApplicationContext) ZipkinCassandraStorageProperties(zipkin.autoconfigure.storage.cassandra.ZipkinCassandraStorageProperties) Test(org.junit.Test)

Example 30 with AnnotationConfigApplicationContext

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

the class ZipkinCassandraStorageAutoConfigurationTest method strictTraceId_defaultsToTrue.

@Test
public void strictTraceId_defaultsToTrue() {
    context = new AnnotationConfigApplicationContext();
    addEnvironment(context, "zipkin.storage.type:cassandra");
    context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinCassandraStorageAutoConfiguration.class);
    context.refresh();
    assertThat(context.getBean(CassandraStorage.class).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