Polish "Remove support for URLConnectionSender"
See gh-44500
This commit is contained in:
parent
336fdff9df
commit
ea87b9114d
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2024 the original author or authors.
|
||||
* Copyright 2012-2025 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
@ -73,7 +73,7 @@ class ZipkinAutoConfigurationTests {
|
|||
@Test
|
||||
void shouldWorkWithoutSenders() {
|
||||
this.contextRunner
|
||||
.withClassLoader(new FilteredClassLoader("zipkin2.reporter.urlconnection", "org.springframework.web.client",
|
||||
.withClassLoader(new FilteredClassLoader("org.springframework.web.client",
|
||||
"org.springframework.web.reactive.function.client"))
|
||||
.run((context) -> assertThat(context).hasNotFailed());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import java.net.http.HttpClient;
|
|||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.reporter.BytesMessageSender;
|
||||
import zipkin2.reporter.HttpEndpointSupplier;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinConfigurations.HttpClientSenderConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.tracing.zipkin.ZipkinConfigurations.SenderConfiguration;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
|
|
@ -38,11 +39,10 @@ import static org.mockito.Mockito.mock;
|
|||
* @author Moritz Halbritter
|
||||
* @author Wick Dynex
|
||||
*/
|
||||
@SuppressWarnings({ "deprecation", "removal" })
|
||||
class ZipkinConfigurationsSenderConfigurationTests {
|
||||
|
||||
private final ApplicationContextRunner contextRunner = new ApplicationContextRunner()
|
||||
.withConfiguration(AutoConfigurations.of(DefaultEncodingConfiguration.class, SenderConfiguration.class));
|
||||
.withConfiguration(AutoConfigurations.of(DefaultEncodingConfiguration.class, SenderConfiguration.class));
|
||||
|
||||
@Test
|
||||
void shouldSupplyDefaultHttpClientSenderBean() {
|
||||
|
|
@ -55,10 +55,8 @@ class ZipkinConfigurationsSenderConfigurationTests {
|
|||
@Test
|
||||
void shouldNotProvideHttpClientSenderIfHttpClientIsNotAvailable() {
|
||||
this.contextRunner.withUserConfiguration(HttpClientSenderConfiguration.class)
|
||||
.withClassLoader(new FilteredClassLoader(HttpClient.class))
|
||||
.run((context) -> {
|
||||
assertThat(context).doesNotHaveBean(ZipkinHttpClientSender.class);
|
||||
});
|
||||
.withClassLoader(new FilteredClassLoader(HttpClient.class))
|
||||
.run((context) -> assertThat(context).doesNotHaveBean(ZipkinHttpClientSender.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -72,15 +70,15 @@ class ZipkinConfigurationsSenderConfigurationTests {
|
|||
@Test
|
||||
void shouldUseCustomHttpEndpointSupplierFactory() {
|
||||
this.contextRunner.withUserConfiguration(CustomHttpEndpointSupplierFactoryConfiguration.class)
|
||||
.run((context) -> {
|
||||
ZipkinHttpClientSender httpClientSender = context.getBean(ZipkinHttpClientSender.class);
|
||||
assertThat(httpClientSender).extracting("endpointSupplier")
|
||||
.isInstanceOf(CustomHttpEndpointSupplier.class);
|
||||
});
|
||||
.run((context) -> {
|
||||
ZipkinHttpClientSender httpClientSender = context.getBean(ZipkinHttpClientSender.class);
|
||||
assertThat(httpClientSender).extracting("endpointSupplier")
|
||||
.isInstanceOf(CustomHttpEndpointSupplier.class);
|
||||
});
|
||||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
private static final class CustomConfiguration {
|
||||
static class CustomConfiguration {
|
||||
|
||||
@Bean
|
||||
BytesMessageSender customSender() {
|
||||
|
|
@ -90,7 +88,7 @@ class ZipkinConfigurationsSenderConfigurationTests {
|
|||
}
|
||||
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
private static final class CustomHttpEndpointSupplierFactoryConfiguration {
|
||||
static class CustomHttpEndpointSupplierFactoryConfiguration {
|
||||
|
||||
@Bean
|
||||
HttpEndpointSupplier.Factory httpEndpointSupplier() {
|
||||
|
|
@ -99,7 +97,7 @@ class ZipkinConfigurationsSenderConfigurationTests {
|
|||
|
||||
}
|
||||
|
||||
private static final class CustomHttpEndpointSupplierFactory implements HttpEndpointSupplier.Factory {
|
||||
static class CustomHttpEndpointSupplierFactory implements HttpEndpointSupplier.Factory {
|
||||
|
||||
@Override
|
||||
public HttpEndpointSupplier create(String endpoint) {
|
||||
|
|
@ -108,7 +106,13 @@ class ZipkinConfigurationsSenderConfigurationTests {
|
|||
|
||||
}
|
||||
|
||||
private record CustomHttpEndpointSupplier(String endpoint) implements HttpEndpointSupplier {
|
||||
static class CustomHttpEndpointSupplier implements HttpEndpointSupplier {
|
||||
|
||||
private final String endpoint;
|
||||
|
||||
CustomHttpEndpointSupplier(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String get() {
|
||||
|
|
@ -118,6 +122,7 @@ class ZipkinConfigurationsSenderConfigurationTests {
|
|||
@Override
|
||||
public void close() {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue