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();
}
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");
}
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();
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.
the class ZipkinElasticsearchHttpStorageAutoConfigurationTest method dailyIndexFormat_overridingPrefix.
@Test
public void dailyIndexFormat_overridingPrefix() {
context = new AnnotationConfigApplicationContext();
addEnvironment(context, "zipkin.storage.type:elasticsearch", "zipkin.storage.elasticsearch.hosts:http://host1:9200", "zipkin.storage.elasticsearch.index:zipkin_prod");
context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchOkHttpAutoConfiguration.class, ZipkinElasticsearchHttpStorageAutoConfiguration.class);
context.refresh();
assertThat(es().indexNameFormatter().indexNameForTimestamp(0)).isEqualTo("zipkin_prod-1970-01-01");
}
use of org.springframework.context.annotation.AnnotationConfigApplicationContext in project zipkin by openzipkin.
the class ZipkinElasticsearchStorageAutoConfigurationTest method doesntProvidesStorageComponent_whenStorageTypeNotElasticsearch.
@Test
public void doesntProvidesStorageComponent_whenStorageTypeNotElasticsearch() {
context = new AnnotationConfigApplicationContext();
addEnvironment(context, "zipkin.storage.type:cassandra");
context.register(PropertyPlaceholderAutoConfiguration.class, ZipkinElasticsearchStorageAutoConfiguration.class);
context.refresh();
thrown.expect(NoSuchBeanDefinitionException.class);
es();
}
Aggregations