diff --git a/pom.xml b/pom.xml
index 856ac6a5fc5..612b16a2aaa 100755
--- a/pom.xml
+++ b/pom.xml
@@ -40,7 +40,6 @@
benchmarks
zipkin-storage
zipkin-collector
- zipkin-autoconfigure
zipkin-server
@@ -106,7 +105,6 @@
3.2.1
3.0.0-M3
3.0.0-M2
- 0.0.5
Zipkin (Parent)
diff --git a/zipkin-autoconfigure/README.md b/zipkin-autoconfigure/README.md
deleted file mode 100644
index 1d07f757ba8..00000000000
--- a/zipkin-autoconfigure/README.md
+++ /dev/null
@@ -1,4 +0,0 @@
-# zipkin-autoconfigure
-
-Modules in this directory are considered internal details to Zipkin's
-server and are unsupported unless integrated with our [server build](../zipkin-server).
diff --git a/zipkin-autoconfigure/collector-scribe/README.md b/zipkin-autoconfigure/collector-scribe/README.md
deleted file mode 100644
index 5cb0ba934a5..00000000000
--- a/zipkin-autoconfigure/collector-scribe/README.md
+++ /dev/null
@@ -1,75 +0,0 @@
-# Scribe Collector Auto-configure Module
-
-This module provides support for running the legacy Scribe collector as
-a component of Zipkin server. To activate this collector, reference the
-module jar when running the Zipkin server set the `SCRIBE_ENABLED=true`
-environment variable or property `zipkin.collector.scribe.enabled=true`.
-
-## Quick start
-
-JRE 8 is required to run Zipkin server.
-
-Fetch the latest released
-[executable jar for Zipkin server](https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-server&v=LATEST&c=exec)
-and
-[autoconfigure module jar for the scribe collector](https://search.maven.org/remote_content?g=io.zipkin.java&a=zipkin-autoconfigure-collector-scribe&v=LATEST&c=module).
-Run Zipkin server with the Scribe collector enabled.
-
-For example:
-
-```bash
-$ curl -sSL https://zipkin.io/quickstart.sh | bash -s
-$ curl -sSL https://zipkin.io/quickstart.sh | bash -s io.zipkin.java:zipkin-autoconfigure-collector-scribe:LATEST:module scribe.jar
-$ SCRIBE_ENABLED=true \
- java \
- -Dloader.path='scribe.jar,scribe.jar!/lib' \
- -Dspring.profiles.active=scribe \
- -cp zipkin.jar \
- org.springframework.boot.loader.PropertiesLauncher
-```
-
-After executing these steps, the Zipkin UI will be available
-[http://localhost:9411](http://localhost:9411) or port 9411 of the remote
-host the Zipkin server was started on. Scribe will be listening on port
-9410.
-
-The Zipkin server can be further configured as described in the
-[Zipkin server documentation](../../zipkin-server/README.md).
-
-## How this works
-
-The Zipkin server executable jar and the autoconfigure module jar for the
-scribe collector are required. The module jar contains the code for
-loading and configuring the scribe collector, and any dependencies that
-are not already packaged in the Zipkin server jar.
-
-Using PropertiesLauncher as the main class runs the Zipkin server
-executable jar the same as it would be if executed using `java -jar zipkin.jar`,
-except it provides the option to load resources from outside the
-executable jar into the classpath. Those external resources are specified
-using the `loader.path` system property. In this case, it is configured
-to load the scribe collector module jar (`zipkin-autoconfigure-collector-scribe-module.jar`)
-and the jar files contained in the `lib/` directory within that module
-jar (`zipkin-autoconfigure-collector-scribe-module.jar!/lib`).
-
-The `spring.profiles=scribe` system property causes configuration from
-[zipkin-server-scribe.yml](src/main/resources/zipkin-server-scribe.yml)
-to be loaded.
-
-For more information on how this works, see [Spring Boot's documentation on the executable jar
-format](https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html). The
-[section on PropertiesLauncher](https://docs.spring.io/spring-boot/docs/current/reference/html/executable-jar.html#executable-jar-property-launcher-features)
-has more detail on how the external module jar and the libraries it contains are loaded.
-
-## Configuration
-
-The following configuration points apply apply when `SCRIBE_ENABLED=true`
-environment variable or the property `zipkin.collector.scribe.enabled=true`.
-They can be configured by setting an environment variable or by setting
-a java system property using the `-Dproperty.name=value` command line
-argument.
-
-Environment Variable | Property |Description
---- | --- | --- | ---
-`COLLECTOR_PORT` | `zipkin.collector.scribe.port` | The port to listen for thrift RPC scribe requests. Defaults to 9410
-`SCRIBE_CATEGORY` | `zipkin.collector.scribe.category` | Category zipkin spans will be consumed from. Defaults to `zipkin`
diff --git a/zipkin-autoconfigure/collector-scribe/pom.xml b/zipkin-autoconfigure/collector-scribe/pom.xml
deleted file mode 100644
index 9fa49670346..00000000000
--- a/zipkin-autoconfigure/collector-scribe/pom.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.apache.zipkin
- zipkin-autoconfigure-parent
- 2.13.1-SNAPSHOT
-
-
- zipkin-autoconfigure-collector-scribe
- Auto Configuration: Scribe Collector
-
-
- ${project.basedir}/../..
-
-
-
-
- ${project.groupId}.zipkin2
- zipkin-collector-scribe
- ${project.version}
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
- ${spring-boot.version}
-
-
- zipkin
-
- module
-
-
- ${project.groupId}.zipkin2
- zipkin-collector-scribe
-
-
- com.linecorp.armeria
- armeria-thrift
-
-
- org.apache.thrift
- libthrift
-
-
-
-
-
- org.apache.zipkin.layout
- zipkin-layout-factory
- ${zipkin-layout-factory.version}
-
-
-
-
-
-
diff --git a/zipkin-autoconfigure/collector-scribe/src/main/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorProperties.java b/zipkin-autoconfigure/collector-scribe/src/main/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorProperties.java
deleted file mode 100644
index 55da8951bf5..00000000000
--- a/zipkin-autoconfigure/collector-scribe/src/main/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorProperties.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package zipkin2.autoconfigure.collector.scribe;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import zipkin2.collector.scribe.ScribeCollector;
-
-@ConfigurationProperties("zipkin.collector.scribe")
-class ZipkinScribeCollectorProperties {
- private String category = "zipkin";
- private int port = 9410;
-
- public String getCategory() {
- return category;
- }
-
- public void setCategory(String category) {
- this.category = category;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public ScribeCollector.Builder toBuilder() {
- return ScribeCollector.newBuilder().category(category).port(port);
- }
-}
diff --git a/zipkin-autoconfigure/collector-scribe/src/main/resources/META-INF/spring.factories b/zipkin-autoconfigure/collector-scribe/src/main/resources/META-INF/spring.factories
deleted file mode 100644
index ab8a234b978..00000000000
--- a/zipkin-autoconfigure/collector-scribe/src/main/resources/META-INF/spring.factories
+++ /dev/null
@@ -1,2 +0,0 @@
-org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
-zipkin2.autoconfigure.collector.scribe.ZipkinScribeCollectorAutoConfiguration
diff --git a/zipkin-autoconfigure/collector-scribe/src/main/resources/zipkin-server-scribe.yml b/zipkin-autoconfigure/collector-scribe/src/main/resources/zipkin-server-scribe.yml
deleted file mode 100644
index 0625ceab2cc..00000000000
--- a/zipkin-autoconfigure/collector-scribe/src/main/resources/zipkin-server-scribe.yml
+++ /dev/null
@@ -1,6 +0,0 @@
-zipkin:
- collector:
- scribe:
- enabled: ${SCRIBE_ENABLED:false}
- category: ${SCRIBE_CATEGORY:zipkin}
- port: ${COLLECTOR_PORT:9410}
diff --git a/zipkin-autoconfigure/collector-scribe/src/test/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfigurationTest.java b/zipkin-autoconfigure/collector-scribe/src/test/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfigurationTest.java
deleted file mode 100644
index c8994d2371d..00000000000
--- a/zipkin-autoconfigure/collector-scribe/src/test/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfigurationTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package zipkin2.autoconfigure.collector.scribe;
-
-import org.junit.After;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
-import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
-import org.springframework.boot.test.util.TestPropertyValues;
-import org.springframework.context.annotation.AnnotationConfigApplicationContext;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import zipkin2.collector.CollectorMetrics;
-import zipkin2.collector.CollectorSampler;
-import zipkin2.collector.scribe.ScribeCollector;
-import zipkin2.storage.InMemoryStorage;
-import zipkin2.storage.StorageComponent;
-
-import static org.assertj.core.api.Assertions.assertThat;
-
-public class ZipkinScribeCollectorAutoConfigurationTest {
-
- @Rule public ExpectedException thrown = ExpectedException.none();
-
- AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
-
- @After public void close() {
- context.close();
- }
-
- @Test public void doesntProvidesCollectorComponent_byDefault() {
- context.register(
- PropertyPlaceholderAutoConfiguration.class,
- ZipkinScribeCollectorAutoConfiguration.class,
- InMemoryConfiguration.class);
- context.refresh();
-
- thrown.expect(NoSuchBeanDefinitionException.class);
- context.getBean(ScribeCollector.class);
- }
-
- /** Note: this will flake if you happen to be running a server on port 9410! */
- @Test public void providesCollectorComponent_whenEnabled() {
- TestPropertyValues.of("zipkin.collector.scribe.enabled:true").applyTo(context);
- context.register(
- PropertyPlaceholderAutoConfiguration.class,
- ZipkinScribeCollectorAutoConfiguration.class,
- InMemoryConfiguration.class);
- context.refresh();
-
- assertThat(context.getBean(ScribeCollector.class)).isNotNull();
- }
-
- @Test public void canOverrideProperty_port() {
- TestPropertyValues.of(
- "zipkin.collector.scribe.enabled:true",
- "zipkin.collector.scribe.port:9999")
- .applyTo(context);
- context.register(
- PropertyPlaceholderAutoConfiguration.class,
- ZipkinScribeCollectorAutoConfiguration.class,
- InMemoryConfiguration.class);
- context.refresh();
-
- assertThat(context.getBean(ZipkinScribeCollectorProperties.class).getPort()).isEqualTo(9999);
- }
-
- @Configuration
- static class InMemoryConfiguration {
- @Bean CollectorSampler sampler() {
- return CollectorSampler.ALWAYS_SAMPLE;
- }
-
- @Bean CollectorMetrics metrics() {
- return CollectorMetrics.NOOP_METRICS;
- }
-
- @Bean StorageComponent storage() {
- return InMemoryStorage.newBuilder().build();
- }
- }
-}
diff --git a/zipkin-autoconfigure/pom.xml b/zipkin-autoconfigure/pom.xml
deleted file mode 100644
index 5cc38101a40..00000000000
--- a/zipkin-autoconfigure/pom.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.apache.zipkin
- zipkin-parent
- 2.13.1-SNAPSHOT
-
-
- zipkin-autoconfigure-parent
- Auto Configuration
- pom
-
-
- ${project.basedir}/..
- 1.8
- java18
-
-
-
- collector-scribe
-
-
-
-
- org.springframework.boot
- spring-boot-autoconfigure
- ${spring-boot.version}
-
-
- org.springframework.boot
- spring-boot-test
- ${spring-boot.version}
- test
-
-
-
-
-
-
- maven-remote-resources-plugin
-
- false
-
-
-
-
-
diff --git a/zipkin-server/README.md b/zipkin-server/README.md
index 5863d7b0851..ef02da2b7f5 100644
--- a/zipkin-server/README.md
+++ b/zipkin-server/README.md
@@ -293,8 +293,14 @@ Property | Environment Variable | Description
`zipkin.collector.http.enabled` | `HTTP_COLLECTOR_ENABLED` | `false` disables the HTTP collector. Defaults to `true`.
### Scribe (Legacy) Collector
-A collector supporting Scribe is available as an external module. See
-[zipkin-autoconfigure/collector-scribe](../zipkin-autoconfigure/collector-scribe/).
+A collector supporting Scribe is enabled when `SCRIBE_ENABLED=true`. New
+sites are discouraged from using this collector as Scribe is an archived
+technology.
+
+Environment Variable | Property | Description
+--- | --- | ---
+`COLLECTOR_PORT` | `zipkin.collector.scribe.port` | The port to listen for thrift RPC scribe requests. Defaults to 9410
+`SCRIBE_CATEGORY` | `zipkin.collector.scribe.category` | Category zipkin spans will be consumed from. Defaults to `zipkin`
### Kafka Collector
The Kafka collector is enabled when `KAFKA_BOOTSTRAP_SERVERS` is set to
diff --git a/zipkin-server/pom.xml b/zipkin-server/pom.xml
index a456ddda0e2..99bd0905060 100644
--- a/zipkin-server/pom.xml
+++ b/zipkin-server/pom.xml
@@ -243,6 +243,20 @@
true
+
+
+ ${project.groupId}.zipkin2
+ zipkin-collector-scribe
+ ${project.version}
+ true
+
+
+
+ javax.annotation
+ javax.annotation-api
+ provided
+
+
io.micrometer
diff --git a/zipkin-server/src/main/java/zipkin2/server/internal/InternalZipkinConfiguration.java b/zipkin-server/src/main/java/zipkin2/server/internal/InternalZipkinConfiguration.java
index e275ab92a1a..ae7e867fa9f 100644
--- a/zipkin-server/src/main/java/zipkin2/server/internal/InternalZipkinConfiguration.java
+++ b/zipkin-server/src/main/java/zipkin2/server/internal/InternalZipkinConfiguration.java
@@ -26,6 +26,7 @@
import zipkin2.server.internal.mysql.ZipkinMySQLStorageConfiguration;
import zipkin2.server.internal.prometheus.ZipkinPrometheusMetricsConfiguration;
import zipkin2.server.internal.rabbitmq.ZipkinRabbitMQCollectorConfiguration;
+import zipkin2.server.internal.scribe.ZipkinScribeCollectorConfiguration;
import zipkin2.server.internal.ui.ZipkinUiConfiguration;
@Configuration
@@ -36,6 +37,7 @@
ZipkinCassandra3StorageConfiguration.class,
ZipkinElasticsearchStorageAutoConfiguration.class,
ZipkinMySQLStorageConfiguration.class,
+ ZipkinScribeCollectorConfiguration.class,
TracingConfiguration.class,
ZipkinQueryApiV2.class,
ZipkinHttpCollector.class,
diff --git a/zipkin-autoconfigure/collector-scribe/src/main/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfiguration.java b/zipkin-server/src/main/java/zipkin2/server/internal/scribe/ZipkinScribeCollectorConfiguration.java
similarity index 75%
rename from zipkin-autoconfigure/collector-scribe/src/main/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfiguration.java
rename to zipkin-server/src/main/java/zipkin2/server/internal/scribe/ZipkinScribeCollectorConfiguration.java
index ca08af18221..53b1789e4fc 100644
--- a/zipkin-autoconfigure/collector-scribe/src/main/java/zipkin2/autoconfigure/collector/scribe/ZipkinScribeCollectorAutoConfiguration.java
+++ b/zipkin-server/src/main/java/zipkin2/server/internal/scribe/ZipkinScribeCollectorConfiguration.java
@@ -14,10 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package zipkin2.autoconfigure.collector.scribe;
+package zipkin2.server.internal.scribe;
+import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import zipkin2.collector.CollectorMetrics;
@@ -31,16 +31,22 @@
* asynchronously.
*/
@Configuration
-@EnableConfigurationProperties(ZipkinScribeCollectorProperties.class)
@ConditionalOnProperty(value = "zipkin.collector.scribe.enabled", havingValue = "true")
-class ZipkinScribeCollectorAutoConfiguration {
+public class ZipkinScribeCollectorConfiguration {
/** The init method will block until the scribe port is listening, or crash on port conflict */
@Bean(initMethod = "start")
ScribeCollector scribe(
- ZipkinScribeCollectorProperties scribe,
- CollectorSampler sampler,
- CollectorMetrics metrics,
- StorageComponent storage) {
- return scribe.toBuilder().sampler(sampler).metrics(metrics).storage(storage).build();
+ @Value("${zipkin.collector.scribe.category:zipkin}") String category,
+ @Value("${zipkin.collector.scribe.port:9410}") int port,
+ CollectorSampler sampler,
+ CollectorMetrics metrics,
+ StorageComponent storage) {
+ return ScribeCollector.newBuilder()
+ .category(category)
+ .port(port)
+ .sampler(sampler)
+ .metrics(metrics)
+ .storage(storage)
+ .build();
}
}
diff --git a/zipkin-server/src/main/resources/zipkin-server-shared.yml b/zipkin-server/src/main/resources/zipkin-server-shared.yml
index 009e3a0504c..8e88800339c 100644
--- a/zipkin-server/src/main/resources/zipkin-server-shared.yml
+++ b/zipkin-server/src/main/resources/zipkin-server-shared.yml
@@ -37,6 +37,10 @@ zipkin:
virtual-host: ${RABBIT_VIRTUAL_HOST:/}
useSsl: ${RABBIT_USE_SSL:false}
uri: ${RABBIT_URI:}
+ scribe:
+ enabled: ${SCRIBE_ENABLED:false}
+ category: ${SCRIBE_CATEGORY:zipkin}
+ port: ${COLLECTOR_PORT:9410}
query:
enabled: ${QUERY_ENABLED:true}
# 1 day in millis
diff --git a/zipkin-server/src/test/kotlin/zipkin2/collector/kafka/ZipkinKafkaCollectorPropertiesOverrideTest.kt b/zipkin-server/src/test/kotlin/zipkin2/collector/kafka/ZipkinKafkaCollectorPropertiesOverrideTest.kt
index 32d75b95b02..51298e3fa71 100644
--- a/zipkin-server/src/test/kotlin/zipkin2/collector/kafka/ZipkinKafkaCollectorPropertiesOverrideTest.kt
+++ b/zipkin-server/src/test/kotlin/zipkin2/collector/kafka/ZipkinKafkaCollectorPropertiesOverrideTest.kt
@@ -54,11 +54,8 @@ class ZipkinKafkaCollectorPropertiesOverrideTest(
): Array = arrayOf(propertySuffix, value, builderExtractor)
}
- var context = AnnotationConfigApplicationContext()
-
- @After fun close() {
- context.close()
- }
+ val context = AnnotationConfigApplicationContext()
+ @After fun closeContext() = context.close()
@Test fun propertyTransferredToCollectorBuilder() {
TestPropertyValues.of("zipkin.collector.kafka.$property:$value").applyTo(context)
diff --git a/zipkin-server/src/test/kotlin/zipkin2/collector/rabbitmq/ZipkinRabbitMQCollectorPropertiesOverrideTest.kt b/zipkin-server/src/test/kotlin/zipkin2/collector/rabbitmq/ZipkinRabbitMQCollectorPropertiesOverrideTest.kt
index bce32c2a6fc..1f0be42f635 100644
--- a/zipkin-server/src/test/kotlin/zipkin2/collector/rabbitmq/ZipkinRabbitMQCollectorPropertiesOverrideTest.kt
+++ b/zipkin-server/src/test/kotlin/zipkin2/collector/rabbitmq/ZipkinRabbitMQCollectorPropertiesOverrideTest.kt
@@ -65,11 +65,8 @@ class ZipkinRabbitMQPropertiesOverrideTest(
): Array = arrayOf(propertySuffix, value, builderExtractor)
}
- var context = AnnotationConfigApplicationContext()
-
- @After fun close() {
- context.close()
- }
+ val context = AnnotationConfigApplicationContext()
+ @After fun closeContext() = context.close()
@Test fun propertyTransferredToCollectorBuilder() {
TestPropertyValues.of("zipkin.collector.rabbitmq.$property:$value").applyTo(context)
diff --git a/zipkin-server/src/test/kotlin/zipkin2/collector/scribe/ZipkinScribeCollectorConfigurationTest.kt b/zipkin-server/src/test/kotlin/zipkin2/collector/scribe/ZipkinScribeCollectorConfigurationTest.kt
new file mode 100644
index 00000000000..f3d5d75e83b
--- /dev/null
+++ b/zipkin-server/src/test/kotlin/zipkin2/collector/scribe/ZipkinScribeCollectorConfigurationTest.kt
@@ -0,0 +1,66 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package zipkin2.collector.scribe
+
+import org.assertj.core.api.Assertions.assertThat
+import org.junit.After
+import org.junit.Test
+import org.springframework.beans.factory.NoSuchBeanDefinitionException
+import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration
+import org.springframework.boot.test.util.TestPropertyValues
+import org.springframework.context.annotation.AnnotationConfigApplicationContext
+import zipkin2.server.internal.InMemoryCollectorConfiguration
+import zipkin2.server.internal.scribe.ZipkinScribeCollectorConfiguration
+
+class ZipkinScribeCollectorConfigurationTest {
+ val context = AnnotationConfigApplicationContext()
+ @After fun closeContext() = context.close()
+
+ @Test(expected = NoSuchBeanDefinitionException::class)
+ fun doesntProvidesCollectorComponent_byDefault() {
+ refreshContext()
+
+ context.getBean(ScribeCollector::class.java)
+ }
+
+ /** Note: this will flake if you happen to be running a server on port 9410! */
+ @Test fun providesCollectorComponent_whenEnabled() {
+ TestPropertyValues.of("zipkin.collector.scribe.enabled:true").applyTo(context)
+ refreshContext()
+
+ assertThat(context.getBean(ScribeCollector::class.java)).isNotNull()
+ }
+
+ @Test fun canOverrideProperty_port() {
+ TestPropertyValues.of(
+ "zipkin.collector.scribe.enabled:true",
+ "zipkin.collector.scribe.port:9999")
+ .applyTo(context)
+ refreshContext()
+
+ assertThat(context.getBean(ScribeCollector::class.java).server.port)
+ .isEqualTo(9999)
+ }
+
+ fun refreshContext() {
+ context.register(
+ PropertyPlaceholderAutoConfiguration::class.java,
+ ZipkinScribeCollectorConfiguration::class.java,
+ InMemoryCollectorConfiguration::class.java)
+ context.refresh()
+ }
+}