diff --git a/brave/pom.xml b/brave/pom.xml index 99c8ec76..556f3a1a 100644 --- a/brave/pom.xml +++ b/brave/pom.xml @@ -50,12 +50,6 @@ io.zipkin.brave brave ${brave.version} - - - * - * - - provided diff --git a/pom.xml b/pom.xml index 6a35414c..1a19a685 100755 --- a/pom.xml +++ b/pom.xml @@ -56,7 +56,7 @@ 2.27.1 - 6.0.2 + 6.0.3 2.23.1 4.12.0 diff --git a/spring-beans/pom.xml b/spring-beans/pom.xml index 5b2e4982..d48926f7 100644 --- a/spring-beans/pom.xml +++ b/spring-beans/pom.xml @@ -22,6 +22,14 @@ zipkin2.reporter.beans ${project.basedir}/.. + + + 5.3.34 + + 2.5.6 + 1.2.17 @@ -93,18 +101,12 @@ io.zipkin.brave brave ${brave.version} - - - * - * - - provided org.springframework spring-beans - 2.5.6 + ${spring.version} provided @@ -117,6 +119,46 @@ + + + + + maven-invoker-plugin + + + de.qaware.maven + go-offline-maven-plugin + + + package + + resolve-dependencies + + + + + + + + log4j + log4j + ${log4j12.version} + MAIN + jar + + + org.springframework + spring-beans + ${spring-floor.version} + MAIN + jar + + + + + + + release diff --git a/spring-beans/src/it/spring_context/README.md b/spring-beans/src/it/spring_context/README.md new file mode 100644 index 00000000..ce0d1ba6 --- /dev/null +++ b/spring-beans/src/it/spring_context/README.md @@ -0,0 +1,2 @@ +# spring_context +This tests that the zipkin2.reporter.beans can be using with Java Config. diff --git a/spring-beans/src/it/spring_context/pom.xml b/spring-beans/src/it/spring_context/pom.xml new file mode 100644 index 00000000..d032fb90 --- /dev/null +++ b/spring-beans/src/it/spring_context/pom.xml @@ -0,0 +1,132 @@ + + + + 4.0.0 + + @project.groupId@ + spring_context + @project.version@ + spring_context + + + UTF-8 + UTF-8 + + 1.8 + 1.8 + 8 + + + + + @project.groupId@ + zipkin-reporter-spring-beans + @project.version@ + test + + + + io.zipkin.brave + brave + @brave.version@ + test + + + + @project.groupId@ + zipkin-reporter-brave + @project.version@ + test + + + + @project.groupId@ + zipkin-sender-okhttp3 + @project.version@ + test + + + + org.junit.jupiter + junit-jupiter + @junit-jupiter.version@ + test + + + + org.assertj + assertj-core + @assertj.version@ + test + + + + io.zipkin.zipkin2 + zipkin-junit5 + @zipkin.version@ + test + + + + org.springframework + spring-context + @spring.version@ + + + + + org.apache.logging.log4j + log4j-core + @log4j.version@ + test + + + org.apache.logging.log4j + log4j-jcl + @log4j.version@ + test + + + + + + + @project.basedir@/src/test/resources + + + + + maven-compiler-plugin + @maven-compiler-plugin.version@ + + + **/IT*.java + + + + + + maven-surefire-plugin + @maven-surefire-plugin.version@ + + true + + **/IT*.java + + + false + + false + + + + + diff --git a/spring-beans/src/it/spring_context/src/test/java/zipkin2/reporter/beans/context/ITAsyncZipkinSpanHandlerFactoryBean.java b/spring-beans/src/it/spring_context/src/test/java/zipkin2/reporter/beans/context/ITAsyncZipkinSpanHandlerFactoryBean.java new file mode 100755 index 00000000..d60302ef --- /dev/null +++ b/spring-beans/src/it/spring_context/src/test/java/zipkin2/reporter/beans/context/ITAsyncZipkinSpanHandlerFactoryBean.java @@ -0,0 +1,66 @@ +/* + * Copyright The OpenZipkin Authors + * SPDX-License-Identifier: Apache-2.0 + */ +package zipkin2.reporter.beans.context; + +import brave.handler.MutableSpan; +import brave.handler.SpanHandler; +import brave.propagation.TraceContext; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import zipkin2.junit5.ZipkinExtension; +import zipkin2.reporter.BytesMessageSender; +import zipkin2.reporter.beans.AsyncZipkinSpanHandlerFactoryBean; +import zipkin2.reporter.beans.OkHttpSenderFactoryBean; +import zipkin2.reporter.brave.AsyncZipkinSpanHandler; + +import static org.assertj.core.api.Assertions.assertThat; + +class ITAsyncZipkinSpanHandlerFactoryBean { + @RegisterExtension public static ZipkinExtension zipkin = new ZipkinExtension(); + + final AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); + + @AfterEach void close() { + context.close(); + } + + @Configuration static class TestConfiguration { + @Bean public OkHttpSenderFactoryBean sender() { + OkHttpSenderFactoryBean okHttpSenderFactoryBean = new OkHttpSenderFactoryBean(); + okHttpSenderFactoryBean.setEndpoint(zipkin.httpUrl() + "/api/v2/spans"); + return okHttpSenderFactoryBean; + } + + @Bean public AsyncZipkinSpanHandlerFactoryBean spanHandler(BytesMessageSender sender) { + AsyncZipkinSpanHandlerFactoryBean asyncReporterFactoryBean = + new AsyncZipkinSpanHandlerFactoryBean(); + asyncReporterFactoryBean.setSender(sender); + asyncReporterFactoryBean.setMessageTimeout(0); // don't spawn a thread + return asyncReporterFactoryBean; + } + } + + @Test void providesAsyncZipkinSpanHandler() { + context.register(TestConfiguration.class); + context.refresh(); + + // Make sure the spring context was built correctly + SpanHandler spanHandler = context.getBean(SpanHandler.class); + assertThat(spanHandler).isInstanceOf(AsyncZipkinSpanHandler.class); + + // Create and handle a span + TraceContext context = TraceContext.newBuilder().traceId(1).spanId(2).sampled(true).build(); + MutableSpan span = new MutableSpan(context, null); + spanHandler.end(context, span, SpanHandler.Cause.FINISHED); + + // Prove the integrated setup works. + ((AsyncZipkinSpanHandler) spanHandler).flush(); + assertThat(zipkin.getTraces()).hasSize(1); + } +} diff --git a/spring-beans/src/it/spring_floor/README.md b/spring-beans/src/it/spring_floor/README.md new file mode 100644 index 00000000..45a279f3 --- /dev/null +++ b/spring-beans/src/it/spring_floor/README.md @@ -0,0 +1,2 @@ +# spring_floor +This tests that the zipkin2.reporter.beans package does not rely on Spring 3+ APIs. diff --git a/spring-beans/src/it/spring_floor/pom.xml b/spring-beans/src/it/spring_floor/pom.xml new file mode 100644 index 00000000..38913aae --- /dev/null +++ b/spring-beans/src/it/spring_floor/pom.xml @@ -0,0 +1,148 @@ + + + + 4.0.0 + + @project.groupId@ + spring_floor + @project.version@ + spring_floor + + + UTF-8 + UTF-8 + + 1.8 + 1.8 + + + + + ${project.groupId} + zipkin-reporter-spring-beans + ${project.version} + + + + ${project.groupId} + zipkin-reporter + ${project.version} + + + io.zipkin.zipkin2 + zipkin + + + + + io.zipkin.zipkin2 + zipkin + @zipkin.version@ + true + + + ${project.groupId} + zipkin-sender-libthrift + provided + ${project.version} + + + ${project.groupId} + zipkin-sender-okhttp3 + provided + ${project.version} + + + ${project.groupId} + zipkin-sender-urlconnection + provided + ${project.version} + + + ${project.groupId} + zipkin-sender-kafka + provided + ${project.version} + + + ${project.groupId} + zipkin-sender-amqp-client + provided + ${project.version} + + + ${project.groupId} + zipkin-sender-activemq-client + provided + ${project.version} + + + ${project.groupId} + zipkin-reporter-brave + provided + ${project.version} + + + io.zipkin.brave + brave + @brave.version@ + provided + + + + org.springframework + spring-beans + @spring-floor.version@ + provided + + + + org.junit.jupiter + junit-jupiter + @junit-jupiter.version@ + test + + + + org.assertj + assertj-core + @assertj.version@ + test + + + + org.mockito + mockito-junit-jupiter + @mockito.version@ + test + + + + log4j + log4j + @log4j12.version@ + test + + + + + @project.build.testSourceDirectory@ + + + maven-surefire-plugin + @maven-surefire-plugin.version@ + + + true + + + + + diff --git a/spring-beans/src/it/spring_floor/src/test/resources/log4j.properties b/spring-beans/src/it/spring_floor/src/test/resources/log4j.properties new file mode 100644 index 00000000..3cd6c51d --- /dev/null +++ b/spring-beans/src/it/spring_floor/src/test/resources/log4j.properties @@ -0,0 +1,10 @@ +# +# Copyright The OpenZipkin Authors +# SPDX-License-Identifier: Apache-2.0 +# + +log4j.rootLogger=WARN, console +log4j.appender.console=org.apache.log4j.ConsoleAppender +log4j.appender.console.layout=org.apache.log4j.PatternLayout +log4j.appender.console.layout.ConversionPattern=[%d{dd MMM yyyy HH:mm:ss,SSS}] - %m%n +