Upgrades to JUnit5; fixes gh-1567
This commit is contained in:
@@ -291,26 +291,26 @@ case ${key} in
|
||||
-v|--version)
|
||||
VERSION="$2"
|
||||
shift # past argument
|
||||
;;
|
||||
|
||||
-d|--destination)
|
||||
DESTINATION="$2"
|
||||
shift # past argument
|
||||
;;
|
||||
|
||||
-b|--build)
|
||||
BUILD="yes"
|
||||
;;
|
||||
|
||||
-c|--clone)
|
||||
CLONE="yes"
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
print_usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Invalid option: [$1]"
|
||||
print_usage
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
shift # past argument or value
|
||||
done
|
||||
|
||||
9
pom.xml
9
pom.xml
@@ -223,16 +223,9 @@
|
||||
<version>3.0.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pl.pragmatists</groupId>
|
||||
<artifactId>JUnitParams</artifactId>
|
||||
<version>1.1.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.assertj</groupId>
|
||||
<artifactId>assertj-core</artifactId>
|
||||
<version>3.14.0</version>
|
||||
<artifactId>assertj-core-java8</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -324,11 +324,6 @@
|
||||
<artifactId>awaitility</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>pl.pragmatists</groupId>
|
||||
<artifactId>JUnitParams</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
|
||||
|
||||
@@ -23,8 +23,7 @@ import brave.handler.MutableSpan;
|
||||
import brave.propagation.TraceContext;
|
||||
import brave.sampler.Sampler;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.reporter.Reporter;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -34,14 +33,12 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.NONE;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = FinishedSpanHandlerTests.FinishedSpanHandlerAspectTestsConfig.class,
|
||||
webEnvironment = NONE)
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.annotation;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
|
||||
@@ -16,16 +16,13 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.annotation;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SleuthAnnotationAutoConfiguration.class,
|
||||
properties = "spring.sleuth.annotation.enabled=false")
|
||||
public class SleuthNewSpanParserAnnotationDisableTests {
|
||||
|
||||
@@ -17,16 +17,13 @@
|
||||
package org.springframework.cloud.sleuth.annotation;
|
||||
|
||||
import brave.Tracing;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SleuthAnnotationAutoConfiguration.class,
|
||||
properties = "spring.sleuth.enabled=false")
|
||||
public class SleuthNewSpanParserAnnotationNoSleuthTests {
|
||||
|
||||
@@ -29,9 +29,8 @@ import brave.propagation.TraceContext;
|
||||
import brave.sampler.Sampler;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.util.context.Context;
|
||||
@@ -44,14 +43,13 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.springframework.cloud.sleuth.annotation.SleuthSpanCreatorAspectFluxTests.TestBean.TEST_STRING1;
|
||||
import static org.springframework.cloud.sleuth.annotation.SleuthSpanCreatorAspectFluxTests.TestBean.TEST_STRING2;
|
||||
|
||||
@SpringBootTest(classes = SleuthSpanCreatorAspectFluxTests.TestConfiguration.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
||||
public class SleuthSpanCreatorAspectFluxTests {
|
||||
|
||||
@Autowired
|
||||
@@ -82,7 +80,7 @@ public class SleuthSpanCreatorAspectFluxTests {
|
||||
return id(tracer);
|
||||
}
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.reporter.clear();
|
||||
this.testBean.reset();
|
||||
|
||||
@@ -29,9 +29,8 @@ import brave.Span;
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Mono;
|
||||
import zipkin2.Annotation;
|
||||
import zipkin2.reporter.Reporter;
|
||||
@@ -43,7 +42,6 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.springframework.cloud.sleuth.annotation.SleuthSpanCreatorAspectMonoTests.TestBean.TEST_STRING;
|
||||
@@ -51,7 +49,6 @@ import static org.springframework.test.annotation.DirtiesContext.MethodMode.BEFO
|
||||
import static reactor.core.publisher.Mono.just;
|
||||
|
||||
@SpringBootTest(classes = SleuthSpanCreatorAspectMonoTests.TestConfiguration.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
@DirtiesContext(methodMode = BEFORE_METHOD)
|
||||
@NotThreadSafe
|
||||
public class SleuthSpanCreatorAspectMonoTests {
|
||||
@@ -75,7 +72,7 @@ public class SleuthSpanCreatorAspectMonoTests {
|
||||
return tracer.currentSpan().context().spanIdString();
|
||||
}
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -19,9 +19,8 @@ package org.springframework.cloud.sleuth.annotation;
|
||||
import java.util.List;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Span;
|
||||
import zipkin2.reporter.Reporter;
|
||||
|
||||
@@ -31,11 +30,9 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SleuthSpanCreatorAspectNegativeTests.TestConfiguration.class)
|
||||
public class SleuthSpanCreatorAspectNegativeTests {
|
||||
|
||||
@@ -48,7 +45,7 @@ public class SleuthSpanCreatorAspectNegativeTests {
|
||||
@Autowired
|
||||
ArrayListSpanReporter reporter;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -22,9 +22,8 @@ import java.util.stream.Collectors;
|
||||
import brave.Span;
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Annotation;
|
||||
import zipkin2.reporter.Reporter;
|
||||
|
||||
@@ -35,13 +34,12 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.springframework.test.annotation.DirtiesContext.MethodMode.BEFORE_METHOD;
|
||||
|
||||
@SpringBootTest(classes = SleuthSpanCreatorAspectTests.TestConfiguration.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
||||
@DirtiesContext(methodMode = BEFORE_METHOD)
|
||||
public class SleuthSpanCreatorAspectTests {
|
||||
|
||||
@@ -54,7 +52,7 @@ public class SleuthSpanCreatorAspectTests {
|
||||
@Autowired
|
||||
ArrayListSpanReporter reporter;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.annotation;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Span;
|
||||
import zipkin2.reporter.Reporter;
|
||||
|
||||
@@ -27,11 +26,9 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@SpringBootTest(
|
||||
classes = SleuthSpanCreatorCircularDependencyTests.TestConfiguration.class)
|
||||
@RunWith(SpringRunner.class)
|
||||
public class SleuthSpanCreatorCircularDependencyTests {
|
||||
|
||||
@Test
|
||||
|
||||
@@ -20,9 +20,8 @@ import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -30,13 +29,12 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
|
||||
@SpringBootTest(classes = SpanTagAnnotationHandlerTests.TestConfiguration.class)
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
|
||||
public class SpanTagAnnotationHandlerTests {
|
||||
|
||||
@Autowired
|
||||
@@ -47,7 +45,7 @@ public class SpanTagAnnotationHandlerTests {
|
||||
|
||||
SpanTagAnnotationHandler handler;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.handler = new SpanTagAnnotationHandler(this.beanFactory);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.annotation;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import brave.propagation.ExtraFieldCustomizer;
|
||||
import brave.propagation.Propagation;
|
||||
import brave.rpc.RpcTracingCustomizer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
|
||||
@@ -21,7 +21,7 @@ import brave.propagation.B3SinglePropagation;
|
||||
import brave.propagation.ExtraFieldPropagation;
|
||||
import brave.propagation.Propagation;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
@@ -22,7 +22,7 @@ import brave.propagation.Propagation;
|
||||
import io.micrometer.core.instrument.MeterRegistry;
|
||||
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.reporter.InMemoryReporterMetrics;
|
||||
import zipkin2.reporter.ReporterMetrics;
|
||||
import zipkin2.reporter.metrics.micrometer.MicrometerReporterMetrics;
|
||||
|
||||
@@ -22,35 +22,31 @@ import brave.Tracing;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = TraceAutoConfigurationWithDisabledSleuthTests.Config.class,
|
||||
properties = "spring.sleuth.enabled=false",
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@ActiveProfiles("disabled")
|
||||
@DirtiesContext
|
||||
@ExtendWith(OutputCaptureExtension.class)
|
||||
public class TraceAutoConfigurationWithDisabledSleuthTests {
|
||||
|
||||
private static final Log log = LogFactory
|
||||
.getLog(TraceAutoConfigurationWithDisabledSleuthTests.class);
|
||||
|
||||
@Rule
|
||||
public OutputCaptureRule capture = new OutputCaptureRule();
|
||||
|
||||
@Autowired(required = false)
|
||||
Tracing tracing;
|
||||
|
||||
@@ -60,10 +56,10 @@ public class TraceAutoConfigurationWithDisabledSleuthTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotContainAnyTracingInfoInTheLogs() {
|
||||
public void shouldNotContainAnyTracingInfoInTheLogs(CapturedOutput capture) {
|
||||
log.info("hello");
|
||||
|
||||
BDDAssertions.then(this.capture.toString()).doesNotContain("[foo");
|
||||
BDDAssertions.then(capture.toString()).doesNotContain("[foo");
|
||||
}
|
||||
|
||||
@EnableAutoConfiguration
|
||||
|
||||
@@ -31,8 +31,8 @@ import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import brave.sampler.Sampler;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanName;
|
||||
@@ -62,7 +62,7 @@ public class SpringCloudSleuthDocTests {
|
||||
|
||||
Tracer tracer = this.tracing.tracer();
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.async;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||
|
||||
|
||||
@@ -20,17 +20,14 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = AsyncDefaultAutoConfigurationTests.Config.class)
|
||||
public class AsyncDefaultAutoConfigurationTests {
|
||||
|
||||
|
||||
@@ -21,8 +21,7 @@ import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
|
||||
import brave.propagation.CurrentTraceContext;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -33,11 +32,9 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = AsyncDisabledTests.ConfigureThreadPoolTaskScheduler.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = "spring.sleuth.scheduled.enabled=false")
|
||||
|
||||
@@ -34,14 +34,14 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import brave.Tracing;
|
||||
import org.aopalliance.aop.Advice;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.aop.framework.AopConfigException;
|
||||
import org.springframework.aop.framework.ProxyFactoryBean;
|
||||
@@ -60,24 +60,24 @@ import static org.assertj.core.api.BDDAssertions.thenThrownBy;
|
||||
* @author Denys Ivano
|
||||
* @author Vladislav Fefelov
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class ExecutorBeanPostProcessorTests {
|
||||
|
||||
@Mock
|
||||
@Mock(lenient = true)
|
||||
BeanFactory beanFactory;
|
||||
|
||||
Tracing tracing = Tracing.newBuilder().build();
|
||||
|
||||
private SleuthAsyncProperties sleuthAsyncProperties;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.sleuthAsyncProperties = new SleuthAsyncProperties();
|
||||
Mockito.when(this.beanFactory.getBean(SleuthAsyncProperties.class))
|
||||
.thenReturn(this.sleuthAsyncProperties);
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void clear() {
|
||||
this.tracing.close();
|
||||
}
|
||||
|
||||
@@ -19,11 +19,11 @@ package org.springframework.cloud.sleuth.instrument.async;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.apache.commons.configuration.beanutils.BeanFactory;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
|
||||
|
||||
@@ -32,7 +32,7 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class LazyTraceAsyncCustomizerTest {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -20,7 +20,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.BDDMockito;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
||||
@@ -26,12 +26,12 @@ import java.util.concurrent.ThreadFactory;
|
||||
import brave.Tracing;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
@@ -40,7 +40,7 @@ import org.springframework.scheduling.Trigger;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.util.ErrorHandler;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class LazyTraceThreadPoolTaskSchedulerTests {
|
||||
|
||||
Tracing tracing = Tracing.newBuilder()
|
||||
@@ -48,7 +48,7 @@ public class LazyTraceThreadPoolTaskSchedulerTests {
|
||||
.addScopeDecorator(StrictScopeDecorator.create()).build())
|
||||
.build();
|
||||
|
||||
@Mock
|
||||
@Mock(lenient = true)
|
||||
BeanFactory beanFactory;
|
||||
|
||||
@Mock
|
||||
@@ -56,7 +56,7 @@ public class LazyTraceThreadPoolTaskSchedulerTests {
|
||||
|
||||
LazyTraceThreadPoolTaskScheduler executor;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.executor = new LazyTraceThreadPoolTaskScheduler(beanFactory(),
|
||||
this.delegate);
|
||||
|
||||
@@ -22,8 +22,8 @@ import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
@@ -44,7 +44,7 @@ public class TraceAsyncAspectTest {
|
||||
|
||||
ProceedingJoinPoint point = Mockito.mock(ProceedingJoinPoint.class);
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() throws NoSuchMethodException {
|
||||
MethodSignature signature = Mockito.mock(MethodSignature.class);
|
||||
BDDMockito.given(signature.getName()).willReturn("fooBar");
|
||||
|
||||
@@ -27,7 +27,7 @@ import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.core.task.AsyncListenableTaskExecutor;
|
||||
import org.springframework.core.task.SimpleAsyncTaskExecutor;
|
||||
|
||||
@@ -25,10 +25,10 @@ import brave.Tracer;
|
||||
import brave.Tracing;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanName;
|
||||
@@ -36,7 +36,7 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TraceCallableTests {
|
||||
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
@@ -50,7 +50,7 @@ public class TraceCallableTests {
|
||||
|
||||
Tracer tracer = this.tracing.tracer();
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void clean() {
|
||||
this.tracing.close();
|
||||
this.reporter.clear();
|
||||
|
||||
@@ -25,10 +25,10 @@ import brave.Tracer;
|
||||
import brave.Tracing;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
import org.springframework.cloud.sleuth.SpanName;
|
||||
@@ -36,7 +36,7 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TraceRunnableTests {
|
||||
|
||||
ExecutorService executor = Executors.newSingleThreadExecutor();
|
||||
@@ -50,7 +50,7 @@ public class TraceRunnableTests {
|
||||
|
||||
Tracer tracer = this.tracing.tracer();
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void clean() {
|
||||
this.tracing.close();
|
||||
this.reporter.clear();
|
||||
|
||||
@@ -35,15 +35,15 @@ import brave.Tracing;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentMatcher;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
@@ -53,12 +53,12 @@ import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import static java.util.stream.Collectors.toList;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TraceableExecutorServiceTests {
|
||||
|
||||
private static int TOTAL_THREADS = 10;
|
||||
|
||||
@Mock
|
||||
@Mock(lenient = true)
|
||||
BeanFactory beanFactory;
|
||||
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(3);
|
||||
@@ -76,7 +76,7 @@ public class TraceableExecutorServiceTests {
|
||||
|
||||
SpanVerifyingRunnable spanVerifyingRunnable = new SpanVerifyingRunnable();
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.traceManagerableExecutorService = new TraceableExecutorService(
|
||||
beanFactory(true), this.executorService);
|
||||
@@ -84,7 +84,7 @@ public class TraceableExecutorServiceTests {
|
||||
this.spanVerifyingRunnable.clear();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
this.traceManagerableExecutorService.shutdown();
|
||||
this.executorService.shutdown();
|
||||
|
||||
@@ -24,14 +24,14 @@ import java.util.function.Predicate;
|
||||
import brave.Tracing;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.ArgumentMatcher;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.cloud.sleuth.DefaultSpanNamer;
|
||||
@@ -45,7 +45,7 @@ import static org.mockito.Mockito.never;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TraceableScheduledExecutorServiceTest {
|
||||
|
||||
Tracing tracing = Tracing.newBuilder()
|
||||
@@ -53,7 +53,7 @@ public class TraceableScheduledExecutorServiceTest {
|
||||
.addScopeDecorator(StrictScopeDecorator.create()).build())
|
||||
.build();
|
||||
|
||||
@Mock
|
||||
@Mock(lenient = true)
|
||||
BeanFactory beanFactory;
|
||||
|
||||
@Mock
|
||||
@@ -62,7 +62,7 @@ public class TraceableScheduledExecutorServiceTest {
|
||||
@InjectMocks
|
||||
TraceableScheduledExecutorService traceableScheduledExecutorService;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
beanFactory();
|
||||
}
|
||||
|
||||
@@ -23,9 +23,8 @@ import brave.Span;
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -35,11 +34,9 @@ import org.springframework.cloud.client.circuitbreaker.CircuitBreakerFactory;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = CircuitBreakerIntegrationTests.Config.class)
|
||||
public class CircuitBreakerIntegrationTests {
|
||||
|
||||
@@ -52,7 +49,7 @@ public class CircuitBreakerIntegrationTests {
|
||||
@Autowired
|
||||
CircuitBreakerFactory factory;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import brave.sampler.Sampler;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cloud.circuitbreaker.resilience4j.Resilience4JCircuitBreakerFactory;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
@@ -45,7 +45,7 @@ public class CircuitBreakerTests {
|
||||
|
||||
Tracer tracer = this.tracing.tracer();
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.sleuth.instrument.messaging;
|
||||
import java.util.Collections;
|
||||
|
||||
import brave.propagation.Propagation;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.messaging.support.MessageHeaderAccessor;
|
||||
import org.springframework.messaging.support.NativeMessageHeaderAccessor;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.cloud.sleuth.instrument.messaging;
|
||||
|
||||
import brave.propagation.Propagation;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
||||
@@ -22,8 +22,7 @@ import brave.sampler.Matchers;
|
||||
import brave.sampler.RateLimitingSampler;
|
||||
import brave.sampler.Sampler;
|
||||
import brave.sampler.SamplerFunction;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -31,12 +30,10 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static brave.messaging.MessagingRequestMatchers.channelNameEquals;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = TraceMessagingAutoConfigurationIntegrationTests.Config.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
public class TraceMessagingAutoConfigurationIntegrationTests {
|
||||
|
||||
@@ -25,8 +25,8 @@ import java.util.Map;
|
||||
import brave.Tracing;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Span;
|
||||
|
||||
import org.springframework.amqp.support.AmqpHeaders;
|
||||
@@ -424,7 +424,7 @@ public class TracingChannelInterceptorTest {
|
||||
return new ExecutorSideOnly();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void close() {
|
||||
assertThat(Tracing.current().currentTraceContext().get()).isNull();
|
||||
Tracing.current().close();
|
||||
|
||||
@@ -25,9 +25,8 @@ import brave.Span;
|
||||
import brave.Tracer;
|
||||
import brave.propagation.ExtraFieldPropagation;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -43,7 +42,6 @@ import org.springframework.http.HttpMethod;
|
||||
import org.springframework.http.RequestEntity;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
@@ -53,7 +51,6 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.awaitility.Awaitility.await;
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@TestPropertySource(
|
||||
properties = { "spring.application.name=multiplehopsintegrationtests" })
|
||||
@SpringBootTest(classes = MultipleHopsIntegrationTests.Config.class,
|
||||
@@ -76,7 +73,7 @@ public class MultipleHopsIntegrationTests {
|
||||
@Autowired
|
||||
DemoApplication application;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -30,9 +30,8 @@ import brave.sampler.Sampler;
|
||||
import io.opentracing.Scope;
|
||||
import io.opentracing.propagation.Format;
|
||||
import io.opentracing.propagation.TextMapAdapter;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Annotation;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -41,7 +40,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.data.MapEntry.entry;
|
||||
@@ -56,7 +54,6 @@ import static org.springframework.boot.test.context.SpringBootTest.WebEnvironmen
|
||||
*
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = NONE,
|
||||
properties = "spring.sleuth.baggage-keys=country-code,user-id")
|
||||
public class BraveTracerTest {
|
||||
@@ -271,7 +268,7 @@ public class BraveTracerTest {
|
||||
assertThat(this.spans.getSpans().get(0).tags()).isEmpty();
|
||||
}
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void clear() {
|
||||
this.spans.clear();
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.cloud.sleuth.instrument.quartz;
|
||||
|
||||
import brave.Tracer;
|
||||
import brave.Tracing;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.quartz.ListenerManager;
|
||||
import org.quartz.Scheduler;
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ import brave.Tracing;
|
||||
import brave.propagation.Propagation.Setter;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobExecutionContext;
|
||||
@@ -76,7 +76,7 @@ public class TracingJobListenerTest {
|
||||
|
||||
private Queue<Span> spans = new ArrayDeque<>();
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() throws Exception {
|
||||
tracing = Tracing.newBuilder().spanReporter(spans::add)
|
||||
.currentTraceContext(ThreadLocalCurrentTraceContext.newBuilder()
|
||||
@@ -101,7 +101,7 @@ public class TracingJobListenerTest {
|
||||
scheduler.start();
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() throws Exception {
|
||||
scheduler.shutdown(true);
|
||||
}
|
||||
|
||||
@@ -22,8 +22,7 @@ import brave.sampler.Matcher;
|
||||
import brave.sampler.RateLimitingSampler;
|
||||
import brave.sampler.Sampler;
|
||||
import brave.sampler.SamplerFunction;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -31,14 +30,12 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static brave.rpc.RpcRequestMatchers.methodEquals;
|
||||
import static brave.rpc.RpcRequestMatchers.serviceEquals;
|
||||
import static brave.sampler.Matchers.and;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = TraceRpcAutoConfigurationIntegrationTests.Config.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
public class TraceRpcAutoConfigurationIntegrationTests {
|
||||
|
||||
@@ -20,7 +20,7 @@ import brave.rpc.RpcRequest;
|
||||
import brave.rpc.RpcTracing;
|
||||
import brave.sampler.SamplerFunction;
|
||||
import brave.sampler.SamplerFunctions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
@@ -18,16 +18,16 @@ package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import brave.http.HttpRequest;
|
||||
import brave.sampler.SamplerFunction;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class CompositeHttpSamplerTests {
|
||||
|
||||
@Mock
|
||||
@@ -41,7 +41,7 @@ public class CompositeHttpSamplerTests {
|
||||
|
||||
SamplerFunction<HttpRequest> sampler;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
this.sampler = new CompositeHttpSampler(this.left, this.right);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,9 @@ package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -32,14 +31,12 @@ import org.springframework.cloud.sleuth.DisableSecurity;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = IgnoreAutoConfiguredSkipPatternsIntegrationTests.Config.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
properties = { "management.endpoints.web.exposure.include:*",
|
||||
@@ -56,8 +53,8 @@ public class IgnoreAutoConfiguredSkipPatternsIntegrationTests {
|
||||
@LocalServerPort
|
||||
int port;
|
||||
|
||||
@Before
|
||||
@After
|
||||
@BeforeEach
|
||||
@AfterEach
|
||||
public void clearSpans() {
|
||||
this.accumulator.clear();
|
||||
}
|
||||
|
||||
@@ -18,10 +18,9 @@ package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -32,14 +31,12 @@ import org.springframework.cloud.sleuth.DisableSecurity;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = SkipEndPointsIntegrationTestsWithContextPathWithBasePath.Config.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
@@ -56,8 +53,8 @@ public class SkipEndPointsIntegrationTestsWithContextPathWithBasePath {
|
||||
@LocalServerPort
|
||||
int port;
|
||||
|
||||
@Before
|
||||
@After
|
||||
@BeforeEach
|
||||
@AfterEach
|
||||
public void clearSpans() {
|
||||
this.accumulator.clear();
|
||||
}
|
||||
|
||||
@@ -18,10 +18,9 @@ package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -32,14 +31,12 @@ import org.springframework.cloud.sleuth.DisableSecurity;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath.Config.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
@@ -57,8 +54,8 @@ public class SkipEndPointsIntegrationTestsWithContextPathWithoutBasePath {
|
||||
@Autowired
|
||||
private Tracer tracer;
|
||||
|
||||
@Before
|
||||
@After
|
||||
@BeforeEach
|
||||
@AfterEach
|
||||
public void clearSpans() {
|
||||
this.spanReporter.clear();
|
||||
}
|
||||
|
||||
@@ -18,10 +18,9 @@ package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -32,14 +31,12 @@ import org.springframework.cloud.sleuth.DisableSecurity;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath.Config.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
@@ -55,8 +52,8 @@ public class SkipEndPointsIntegrationTestsWithoutContextPathWithBasePath {
|
||||
@Autowired
|
||||
private Tracer tracer;
|
||||
|
||||
@Before
|
||||
@After
|
||||
@BeforeEach
|
||||
@AfterEach
|
||||
public void clearSpans() {
|
||||
this.spanReporter.clear();
|
||||
}
|
||||
|
||||
@@ -18,10 +18,9 @@ package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -32,14 +31,12 @@ import org.springframework.cloud.sleuth.DisableSecurity;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath.Config.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
|
||||
@@ -56,8 +53,8 @@ public class SkipEndPointsIntegrationTestsWithoutContextPathWithoutBasePath {
|
||||
@Autowired
|
||||
private Tracer tracer;
|
||||
|
||||
@Before
|
||||
@After
|
||||
@BeforeEach
|
||||
@AfterEach
|
||||
public void clearSpans() {
|
||||
this.spanReporter.clear();
|
||||
}
|
||||
|
||||
@@ -19,18 +19,18 @@ package org.springframework.cloud.sleuth.instrument.web;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import brave.http.HttpRequest;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class SkipPatternHttpServerSamplerTests {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Optional;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.web.WebEndpointAutoConfiguration;
|
||||
|
||||
@@ -31,9 +31,9 @@ import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import brave.sampler.Sampler;
|
||||
import brave.servlet.TracingFilter;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.cloud.sleuth.util.SpanUtil;
|
||||
@@ -84,7 +84,7 @@ public class TraceFilterTests {
|
||||
|
||||
MockFilterChain filterChain;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void init() {
|
||||
this.request = builder().buildRequest(new MockServletContext());
|
||||
this.response = new MockHttpServletResponse();
|
||||
@@ -97,7 +97,7 @@ public class TraceFilterTests {
|
||||
"MockMvc");
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void cleanup() {
|
||||
Tracing.current().close();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import brave.http.HttpRequestParser;
|
||||
import brave.http.HttpResponseParser;
|
||||
import brave.http.HttpTracing;
|
||||
import brave.sampler.SamplerFunction;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.assertj.AssertableApplicationContext;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
||||
@@ -30,9 +30,9 @@ import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import brave.sampler.Sampler;
|
||||
import brave.spring.web.TracingClientHttpRequestInterceptor;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.cloud.sleuth.util.SpanUtil;
|
||||
@@ -72,7 +72,7 @@ public class TraceRestTemplateInterceptorTests {
|
||||
private RestTemplate template = new RestTemplate(
|
||||
new MockMvcClientHttpRequestFactory(this.mockMvc));
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
setInterceptors(HttpTracing.create(this.tracing));
|
||||
}
|
||||
@@ -82,7 +82,7 @@ public class TraceRestTemplateInterceptorTests {
|
||||
TracingClientHttpRequestInterceptor.create(httpTracing)));
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void clean() {
|
||||
Tracing.current().close();
|
||||
}
|
||||
|
||||
@@ -16,18 +16,15 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.instrument.web;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = { TraceWebClientDisabledTests.Config.class }, properties = {
|
||||
"spring.sleuth.web.enabled=true", "spring.sleuth.web.client.enabled=false" })
|
||||
public class TraceWebClientDisabledTests {
|
||||
|
||||
@@ -18,8 +18,7 @@ package org.springframework.cloud.sleuth.instrument.web.client;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -28,13 +27,11 @@ import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SpringBootTest(classes = GH846Tests.App.class, webEnvironment = WebEnvironment.NONE)
|
||||
@RunWith(SpringRunner.class)
|
||||
public class GH846Tests {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -28,9 +28,8 @@ import brave.sampler.Sampler;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -55,7 +54,6 @@ import org.springframework.scheduling.annotation.AsyncConfigurerSupport;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.AsyncRestTemplate;
|
||||
@@ -65,7 +63,6 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = { MultipleAsyncRestTemplateTests.Config.class,
|
||||
MultipleAsyncRestTemplateTests.CustomExecutorConfig.class,
|
||||
@@ -92,7 +89,7 @@ public class MultipleAsyncRestTemplateTests {
|
||||
@LocalServerPort
|
||||
int port;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.wrappedExecutor = this.executor.getAsyncExecutor();
|
||||
}
|
||||
|
||||
@@ -27,9 +27,8 @@ import brave.propagation.Propagation;
|
||||
import brave.propagation.TraceContext;
|
||||
import brave.sampler.Sampler;
|
||||
import io.netty.handler.codec.http.HttpResponseStatus;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import reactor.core.publisher.Mono;
|
||||
import reactor.netty.DisposableServer;
|
||||
@@ -45,7 +44,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@@ -62,7 +60,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
*/
|
||||
@SpringBootTest(classes = ReactorNettyHttpClientSpringBootTests.TestConfiguration.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.NONE)
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ReactorNettyHttpClientSpringBootTests {
|
||||
|
||||
DisposableServer disposableServer;
|
||||
@@ -79,7 +76,7 @@ public class ReactorNettyHttpClientSpringBootTests {
|
||||
TraceContext context = TraceContext.newBuilder().traceId(1).spanId(1).sampled(true)
|
||||
.build();
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void tearDown() {
|
||||
if (disposableServer != null) {
|
||||
disposableServer.disposeNow();
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.cloud.sleuth.instrument.web.client;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.BDDMockito;
|
||||
|
||||
import org.springframework.cloud.sleuth.instrument.web.client.TraceExchangeFilterFunction.ClientResponseWrapper;
|
||||
|
||||
@@ -24,7 +24,7 @@ import brave.http.HttpTracing;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cloud.gateway.filter.headers.HttpHeadersFilter;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
|
||||
@@ -21,7 +21,7 @@ import brave.http.HttpTracing;
|
||||
import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cloud.gateway.filter.headers.HttpHeadersFilter;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
|
||||
@@ -31,10 +31,9 @@ import okhttp3.mockwebserver.MockResponse;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
import okhttp3.mockwebserver.SocketPolicy;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
@@ -49,9 +48,18 @@ import static org.assertj.core.api.Assertions.fail;
|
||||
*/
|
||||
public class TraceRestTemplateInterceptorIntegrationTests {
|
||||
|
||||
@Rule
|
||||
public final MockWebServer mockWebServer = new MockWebServer();
|
||||
|
||||
@BeforeEach
|
||||
void before() throws IOException {
|
||||
mockWebServer.start();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void after() throws IOException {
|
||||
mockWebServer.close();
|
||||
}
|
||||
|
||||
ArrayListSpanReporter reporter = new ArrayListSpanReporter();
|
||||
|
||||
Tracing tracing = Tracing.newBuilder()
|
||||
@@ -63,14 +71,14 @@ public class TraceRestTemplateInterceptorIntegrationTests {
|
||||
|
||||
private RestTemplate template = new RestTemplate(clientHttpRequestFactory());
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.template.setInterceptors(Arrays
|
||||
.<ClientHttpRequestInterceptor>asList(TracingClientHttpRequestInterceptor
|
||||
.create(HttpTracing.create(this.tracing))));
|
||||
}
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void clean() {
|
||||
Tracing.current().close();
|
||||
}
|
||||
|
||||
@@ -24,8 +24,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import brave.spring.web.TracingClientHttpRequestInterceptor;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
@@ -39,7 +38,6 @@ import org.springframework.http.HttpRequest;
|
||||
import org.springframework.http.client.ClientHttpRequestExecution;
|
||||
import org.springframework.http.client.ClientHttpRequestInterceptor;
|
||||
import org.springframework.http.client.ClientHttpResponse;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
@@ -47,7 +45,6 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = TraceWebClientAutoConfigurationTests.Config.class)
|
||||
public class TraceWebClientAutoConfigurationTests {
|
||||
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
package org.springframework.cloud.sleuth.instrument.web.client;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.web.reactive.function.client.WebClient;
|
||||
@@ -28,7 +28,7 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TraceWebClientBeanPostProcessorTest {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -26,9 +26,8 @@ import brave.Span;
|
||||
import brave.Tracer;
|
||||
import brave.sampler.Sampler;
|
||||
import org.assertj.core.api.Assertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
import zipkin2.reporter.Reporter;
|
||||
|
||||
@@ -50,7 +49,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@@ -58,7 +56,6 @@ import org.springframework.web.client.RestTemplate;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
import static org.springframework.boot.test.context.SpringBootTest.WebEnvironment.RANDOM_PORT;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(classes = { WebClientDiscoveryExceptionTests.TestConfiguration.class },
|
||||
webEnvironment = RANDOM_PORT)
|
||||
@TestPropertySource(properties = { "spring.application.name=exceptionservice" })
|
||||
@@ -78,7 +75,7 @@ public class WebClientDiscoveryExceptionTests {
|
||||
@Autowired
|
||||
ArrayListSpanReporter reporter;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void close() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -18,25 +18,21 @@ package org.springframework.cloud.sleuth.instrument.web.client.exception;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import brave.Span;
|
||||
import brave.Tracer;
|
||||
import brave.Tracing;
|
||||
import brave.sampler.Sampler;
|
||||
import junitparams.JUnitParamsRunner;
|
||||
import junitparams.Parameters;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
|
||||
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
|
||||
import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
|
||||
@@ -48,8 +44,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.test.context.junit4.rules.SpringClassRule;
|
||||
import org.springframework.test.context.junit4.rules.SpringMethodRule;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@@ -57,24 +51,14 @@ import org.springframework.web.client.RestTemplate;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(JUnitParamsRunner.class)
|
||||
@SpringBootTest(classes = { WebClientExceptionTests.TestConfiguration.class },
|
||||
properties = { "ribbon.ConnectTimeout=30000",
|
||||
"spring.application.name=exceptionservice" },
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
public class WebClientExceptionTests {
|
||||
|
||||
@ClassRule
|
||||
public static final SpringClassRule SCR = new SpringClassRule();
|
||||
|
||||
private static final Log log = LogFactory.getLog(WebClientExceptionTests.class);
|
||||
|
||||
@Rule
|
||||
public final SpringMethodRule springMethodRule = new SpringMethodRule();
|
||||
|
||||
@Rule
|
||||
public final OutputCaptureRule capture = new OutputCaptureRule();
|
||||
|
||||
@Autowired
|
||||
TestFeignInterfaceWithException testFeignInterfaceWithException;
|
||||
|
||||
@@ -88,14 +72,14 @@ public class WebClientExceptionTests {
|
||||
@Autowired
|
||||
ArrayListSpanReporter reporter;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void open() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
// issue #198
|
||||
@Test
|
||||
@Parameters
|
||||
@ParameterizedTest
|
||||
@MethodSource("parametersForShouldCloseSpanUponException")
|
||||
public void shouldCloseSpanUponException(ResponseEntityProvider provider)
|
||||
throws IOException {
|
||||
Span span = this.tracer.tracer().nextSpan().name("new trace").start();
|
||||
@@ -117,12 +101,12 @@ public class WebClientExceptionTests {
|
||||
then(this.reporter.getSpans().get(0).tags()).containsKey("error");
|
||||
}
|
||||
|
||||
Object[] parametersForShouldCloseSpanUponException() {
|
||||
return new Object[] {
|
||||
static Stream<Object> parametersForShouldCloseSpanUponException() {
|
||||
return Stream.of(
|
||||
(ResponseEntityProvider) (tests) -> tests.testFeignInterfaceWithException
|
||||
.shouldFailToConnect(),
|
||||
(ResponseEntityProvider) (tests) -> tests.template
|
||||
.getForEntity("https://exceptionservice/", Map.class) };
|
||||
.getForEntity("https://exceptionservice/", Map.class));
|
||||
}
|
||||
|
||||
@FeignClient("exceptionservice")
|
||||
|
||||
@@ -33,14 +33,13 @@ import feign.RequestLine;
|
||||
import feign.RequestTemplate;
|
||||
import feign.Response;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
import zipkin2.Span;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
@@ -52,13 +51,22 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class FeignRetriesTests {
|
||||
|
||||
@Rule
|
||||
public final MockWebServer server = new MockWebServer();
|
||||
|
||||
@Mock
|
||||
@BeforeEach
|
||||
void before() throws IOException {
|
||||
this.server.start();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void after() throws IOException {
|
||||
this.server.close();
|
||||
}
|
||||
|
||||
@Mock(lenient = true)
|
||||
BeanFactory beanFactory;
|
||||
|
||||
ArrayListSpanReporter reporter = new ArrayListSpanReporter();
|
||||
@@ -70,8 +78,8 @@ public class FeignRetriesTests {
|
||||
|
||||
HttpTracing httpTracing = HttpTracing.newBuilder(this.tracing).build();
|
||||
|
||||
@Before
|
||||
@After
|
||||
@BeforeEach
|
||||
@AfterEach
|
||||
public void setup() {
|
||||
BDDMockito.given(this.beanFactory.getBean(HttpTracing.class))
|
||||
.willReturn(this.httpTracing);
|
||||
|
||||
@@ -24,11 +24,11 @@ import brave.propagation.StrictScopeDecorator;
|
||||
import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import feign.Client;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
|
||||
@@ -39,7 +39,7 @@ import static org.mockito.Mockito.verify;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TraceFeignAspectTests {
|
||||
|
||||
@Mock
|
||||
@@ -60,7 +60,7 @@ public class TraceFeignAspectTests {
|
||||
|
||||
TraceFeignAspect traceFeignAspect;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.traceFeignAspect = new TraceFeignAspect(this.beanFactory) {
|
||||
@Override
|
||||
|
||||
@@ -30,19 +30,19 @@ import brave.propagation.ThreadLocalCurrentTraceContext;
|
||||
import feign.Client;
|
||||
import feign.Request;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.BDDMockito;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TracingFeignClientTests {
|
||||
|
||||
Request request = Request.create("GET", "https://foo", new HashMap<>(), null, null);
|
||||
@@ -65,7 +65,7 @@ public class TracingFeignClientTests {
|
||||
|
||||
Client traceFeignClient;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setup() {
|
||||
this.traceFeignClient = TracingFeignClient.create(this.httpTracing, this.client);
|
||||
}
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
package org.springframework.cloud.sleuth.instrument.web.client.feign;
|
||||
|
||||
import feign.Client;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
import org.mockito.InjectMocks;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
import org.mockito.junit.jupiter.MockitoExtension;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
@@ -36,7 +36,7 @@ import static org.mockito.Mockito.when;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
@ExtendWith(MockitoExtension.class)
|
||||
public class TracingFeignObjectWrapperTests {
|
||||
|
||||
@Mock
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
@@ -34,8 +35,6 @@ import brave.Tracing;
|
||||
import brave.propagation.SamplingFlags;
|
||||
import brave.propagation.TraceContextOrSamplingFlags;
|
||||
import brave.sampler.Sampler;
|
||||
import junitparams.JUnitParamsRunner;
|
||||
import junitparams.Parameters;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.http.HttpResponse;
|
||||
@@ -46,12 +45,11 @@ import org.apache.http.impl.client.HttpClientBuilder;
|
||||
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
|
||||
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.params.ParameterizedTest;
|
||||
import org.junit.jupiter.params.provider.MethodSource;
|
||||
import org.reactivestreams.Subscription;
|
||||
import reactor.core.publisher.BaseSubscriber;
|
||||
import zipkin2.Annotation;
|
||||
@@ -83,8 +81,6 @@ import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.rules.SpringClassRule;
|
||||
import org.springframework.test.context.junit4.rules.SpringMethodRule;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@@ -97,7 +93,6 @@ import org.springframework.web.reactive.function.client.WebClient;
|
||||
import static org.assertj.core.api.Assertions.fail;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(JUnitParamsRunner.class)
|
||||
@SpringBootTest(classes = WebClientTests.TestConfiguration.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
|
||||
@TestPropertySource(properties = { "spring.application.name=fooservice",
|
||||
@@ -105,8 +100,6 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
@DirtiesContext
|
||||
public class WebClientTests {
|
||||
|
||||
@ClassRule
|
||||
public static final SpringClassRule SCR = new SpringClassRule();
|
||||
static final String TRACE_ID_NAME = "X-B3-TraceId";
|
||||
static final String SPAN_ID_NAME = "X-B3-SpanId";
|
||||
static final String SAMPLED_NAME = "X-B3-Sampled";
|
||||
@@ -114,9 +107,6 @@ public class WebClientTests {
|
||||
|
||||
private static final Log log = LogFactory.getLog(WebClientTests.class);
|
||||
|
||||
@Rule
|
||||
public final SpringMethodRule springMethodRule = new SpringMethodRule();
|
||||
|
||||
@Autowired
|
||||
TestFeignInterface testFeignInterface;
|
||||
|
||||
@@ -157,16 +147,16 @@ public class WebClientTests {
|
||||
@Autowired
|
||||
MyRestTemplateCustomizer customizer;
|
||||
|
||||
@After
|
||||
@Before
|
||||
@AfterEach
|
||||
@BeforeEach
|
||||
public void close() {
|
||||
this.reporter.clear();
|
||||
this.testErrorController.clear();
|
||||
this.fooController.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters
|
||||
@ParameterizedTest
|
||||
@MethodSource("parametersForShouldCreateANewSpanWithClientSideTagsWhenNoPreviousTracingWasPresent")
|
||||
@SuppressWarnings("unchecked")
|
||||
public void shouldCreateANewSpanWithClientSideTagsWhenNoPreviousTracingWasPresent(
|
||||
ResponseEntityProvider provider) {
|
||||
@@ -191,8 +181,8 @@ public class WebClientTests {
|
||||
then(this.tracer.currentSpan()).isNull();
|
||||
}
|
||||
|
||||
Object[] parametersForShouldCreateANewSpanWithClientSideTagsWhenNoPreviousTracingWasPresent() {
|
||||
return new Object[] {
|
||||
static Stream parametersForShouldCreateANewSpanWithClientSideTagsWhenNoPreviousTracingWasPresent() {
|
||||
return Stream.of(
|
||||
(ResponseEntityProvider) (tests) -> tests.testFeignInterface.getNoTrace(),
|
||||
(ResponseEntityProvider) (tests) -> tests.testFeignInterface.getNoTrace(),
|
||||
(ResponseEntityProvider) (tests) -> tests.testFeignInterface.getNoTrace(),
|
||||
@@ -216,11 +206,11 @@ public class WebClientTests {
|
||||
(ResponseEntityProvider) (tests) -> tests.template
|
||||
.getForEntity("http://fooservice/notrace", String.class),
|
||||
(ResponseEntityProvider) (tests) -> tests.template
|
||||
.getForEntity("http://fooservice/notrace", String.class) };
|
||||
.getForEntity("http://fooservice/notrace", String.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters
|
||||
@ParameterizedTest
|
||||
@MethodSource("parametersForShouldPropagateNotSamplingHeader")
|
||||
@SuppressWarnings("unchecked")
|
||||
public void shouldPropagateNotSamplingHeader(ResponseEntityProvider provider) {
|
||||
Span span = this.tracer
|
||||
@@ -241,15 +231,15 @@ public class WebClientTests {
|
||||
then(this.tracer.currentSpan()).isNull();
|
||||
}
|
||||
|
||||
Object[] parametersForShouldPropagateNotSamplingHeader() throws Exception {
|
||||
return new Object[] {
|
||||
static Stream parametersForShouldPropagateNotSamplingHeader() throws Exception {
|
||||
return Stream.of(
|
||||
(ResponseEntityProvider) (tests) -> tests.testFeignInterface.headers(),
|
||||
(ResponseEntityProvider) (tests) -> tests.template
|
||||
.getForEntity("http://fooservice/", Map.class) };
|
||||
.getForEntity("http://fooservice/", Map.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters
|
||||
@ParameterizedTest
|
||||
@MethodSource("parametersForShouldAttachTraceIdWhenCallingAnotherService")
|
||||
@SuppressWarnings("unchecked")
|
||||
public void shouldAttachTraceIdWhenCallingAnotherService(
|
||||
ResponseEntityProvider provider) {
|
||||
@@ -394,15 +384,15 @@ public class WebClientTests {
|
||||
then(this.reporter.getSpans()).isNotEmpty();
|
||||
}
|
||||
|
||||
Object[] parametersForShouldAttachTraceIdWhenCallingAnotherService() {
|
||||
return new Object[] {
|
||||
static Stream parametersForShouldAttachTraceIdWhenCallingAnotherService() {
|
||||
return Stream.of(
|
||||
(ResponseEntityProvider) (tests) -> tests.testFeignInterface.headers(),
|
||||
(ResponseEntityProvider) (tests) -> tests.template
|
||||
.getForEntity("http://fooservice/traceid", String.class) };
|
||||
.getForEntity("http://fooservice/traceid", String.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Parameters
|
||||
@ParameterizedTest
|
||||
@MethodSource("parametersForShouldAttachTraceIdWhenUsingFeignClientWithoutResponseBody")
|
||||
public void shouldAttachTraceIdWhenUsingFeignClientWithoutResponseBody(
|
||||
ResponseEntityProvider provider) {
|
||||
Span span = this.tracer.nextSpan().name("foo").start();
|
||||
@@ -418,12 +408,12 @@ public class WebClientTests {
|
||||
then(this.reporter.getSpans()).isNotEmpty();
|
||||
}
|
||||
|
||||
Object[] parametersForShouldAttachTraceIdWhenUsingFeignClientWithoutResponseBody() {
|
||||
return new Object[] {
|
||||
static Stream parametersForShouldAttachTraceIdWhenUsingFeignClientWithoutResponseBody() {
|
||||
return Stream.of(
|
||||
(ResponseEntityProvider) (tests) -> tests.testFeignInterface
|
||||
.noResponseBody(),
|
||||
(ResponseEntityProvider) (tests) -> tests.template
|
||||
.getForEntity("http://fooservice/noresponse", String.class) };
|
||||
.getForEntity("http://fooservice/noresponse", String.class));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.cloud.sleuth.internal;
|
||||
|
||||
import brave.propagation.CurrentTraceContext;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
|
||||
|
||||
@@ -20,24 +20,21 @@ import brave.Span;
|
||||
import brave.Tracer;
|
||||
import brave.propagation.CurrentTraceContext.Scope;
|
||||
import brave.propagation.ExtraFieldPropagation;
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.MDC;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringBootConfiguration;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = {
|
||||
"spring.sleuth.baggage-keys=my-baggage",
|
||||
"spring.sleuth.propagation-keys=my-propagation",
|
||||
@@ -55,8 +52,8 @@ public class Slf4JSpanLoggerTest {
|
||||
|
||||
Span span;
|
||||
|
||||
@Before
|
||||
@After
|
||||
@BeforeEach
|
||||
@AfterEach
|
||||
public void setup() {
|
||||
MDC.clear();
|
||||
this.span = this.tracer.nextSpan().name("span").start();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.propagation;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurations;
|
||||
import org.springframework.boot.test.context.runner.ApplicationContextRunner;
|
||||
|
||||
@@ -24,9 +24,8 @@ import brave.Tracer;
|
||||
import brave.propagation.ExtraFieldPropagation;
|
||||
import brave.propagation.TraceContext;
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -34,14 +33,12 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.cloud.sleuth.util.ArrayListSpanReporter;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/**
|
||||
* @author Taras Danylchuk
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, properties = {
|
||||
"spring.sleuth.baggage-keys=my-baggage",
|
||||
"spring.sleuth.propagation-keys=my-propagation,others-propagation",
|
||||
@@ -65,7 +62,7 @@ public class TagPropagationFinishedSpanHandlerTest {
|
||||
|
||||
private ScopedSpan span;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void setUp() {
|
||||
this.arrayListSpanReporter.clear();
|
||||
this.span = this.tracer.startScopedSpan("my-scoped-span");
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.sleuth.sampler;
|
||||
import java.util.Random;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.cloud.sleuth.sampler;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package org.springframework.cloud.sleuth.util;
|
||||
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SpanNameUtilTests {
|
||||
|
||||
|
||||
@@ -19,35 +19,32 @@ package sample;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.assertj.core.api.BDDAssertions;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.extension.ExtendWith;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.system.OutputCaptureRule;
|
||||
import org.springframework.boot.test.system.CapturedOutput;
|
||||
import org.springframework.boot.test.system.OutputCaptureExtension;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SampleFeignApplication.class)
|
||||
@TestPropertySource(properties = "sample.zipkin.enabled=false")
|
||||
@ExtendWith(OutputCaptureExtension.class)
|
||||
public class SampleFeignApplicationTests {
|
||||
|
||||
private static final Log log = LogFactory.getLog(SampleFeignApplicationTests.class);
|
||||
|
||||
@Rule
|
||||
public OutputCaptureRule outputCapture = new OutputCaptureRule();
|
||||
|
||||
@Test
|
||||
public void contextLoads() {
|
||||
}
|
||||
|
||||
// https://github.com/spring-cloud/spring-cloud-sleuth/issues/1396
|
||||
@Test
|
||||
public void should_not_pass_dash_as_default_service_name() {
|
||||
public void should_not_pass_dash_as_default_service_name(
|
||||
CapturedOutput outputCapture) {
|
||||
log.info("HELLO");
|
||||
|
||||
BDDAssertions.then(this.outputCapture.toString()).doesNotContain("INFO [-,,,]");
|
||||
BDDAssertions.then(outputCapture.toString()).doesNotContain("INFO [-,,,]");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,9 +23,8 @@ import java.util.stream.Collectors;
|
||||
|
||||
import brave.sampler.Sampler;
|
||||
import integration.MessagingApplicationTests.IntegrationSpanCollectorConfig;
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import sample.SampleMessagingApplication;
|
||||
import tools.AbstractIntegrationTest;
|
||||
import tools.SpanUtil;
|
||||
@@ -38,12 +37,10 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = { IntegrationSpanCollectorConfig.class,
|
||||
SampleMessagingApplication.class },
|
||||
@@ -59,7 +56,7 @@ public class MessagingApplicationTests extends AbstractIntegrationTest {
|
||||
@Autowired
|
||||
IntegrationTestZipkinSpanReporter integrationTestSpanCollector;
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void cleanup() {
|
||||
this.integrationTestSpanCollector.hashedSpans.clear();
|
||||
}
|
||||
|
||||
@@ -16,14 +16,11 @@
|
||||
|
||||
package sample;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SampleMessagingApplication.class)
|
||||
@TestPropertySource(properties = "sample.zipkin.enabled=false")
|
||||
public class SampleMessagingApplicationTests {
|
||||
|
||||
@@ -752,7 +752,6 @@ SockJS = (function () {
|
||||
on_unload[ref]();
|
||||
delete on_unload[ref];
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
var unload_triggered = function () {
|
||||
@@ -821,7 +820,6 @@ SockJS = (function () {
|
||||
}
|
||||
} catch (x) {
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
iframe.src = iframe_url;
|
||||
@@ -881,7 +879,6 @@ SockJS = (function () {
|
||||
}
|
||||
} catch (x) {
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
doc.open();
|
||||
@@ -928,14 +925,12 @@ SockJS = (function () {
|
||||
that.xhr = new XMLHttpRequest();
|
||||
} catch (x) {
|
||||
}
|
||||
;
|
||||
|
||||
if (!that.xhr) {
|
||||
try {
|
||||
that.xhr = new _window.ActiveXObject('Microsoft.XMLHTTP');
|
||||
} catch (x) {
|
||||
}
|
||||
;
|
||||
}
|
||||
if (_window.ActiveXObject || _window.XDomainRequest) {
|
||||
// IE8 caches even POSTs
|
||||
@@ -955,7 +950,6 @@ SockJS = (function () {
|
||||
that._cleanup();
|
||||
return;
|
||||
}
|
||||
;
|
||||
|
||||
if (!opts || !opts.no_credentials) {
|
||||
// Mozilla docs says https://developer.mozilla.org/en/XMLHttpRequest :
|
||||
@@ -980,7 +974,6 @@ SockJS = (function () {
|
||||
var text = x.responseText;
|
||||
} catch (x) {
|
||||
}
|
||||
;
|
||||
// IE returns 1223 for 204: https://bugs.jquery.com/ticket/1450
|
||||
if (status === 1223) status = 204;
|
||||
|
||||
@@ -1017,7 +1010,6 @@ SockJS = (function () {
|
||||
that.xhr.abort();
|
||||
} catch (x) {
|
||||
}
|
||||
;
|
||||
}
|
||||
that.unload_ref = that.xhr = null;
|
||||
};
|
||||
@@ -1099,7 +1091,6 @@ SockJS = (function () {
|
||||
that.xdr.abort();
|
||||
} catch (x) {
|
||||
}
|
||||
;
|
||||
}
|
||||
that.unload_ref = that.xdr = null;
|
||||
};
|
||||
@@ -2241,7 +2232,6 @@ SockJS = (function () {
|
||||
// IE 7
|
||||
return new InfoReceiverFake();
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -16,15 +16,12 @@
|
||||
|
||||
package sample;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SampleWebsocketApplication.class)
|
||||
@WebAppConfiguration
|
||||
@TestPropertySource(properties = "sample.zipkin.enabled=false")
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package integration;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -29,10 +30,9 @@ import integration.ZipkinTests.WaitUntilZipkinIsUpConfig;
|
||||
import okhttp3.mockwebserver.MockResponse;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
import okhttp3.mockwebserver.RecordedRequest;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import sample.SampleZipkinApplication;
|
||||
import tools.AbstractIntegrationTest;
|
||||
import tools.SpanUtil;
|
||||
@@ -47,21 +47,23 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = { WaitUntilZipkinIsUpConfig.class, SampleZipkinApplication.class },
|
||||
webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT)
|
||||
@TestPropertySource(properties = { "sample.zipkin.enabled=true" })
|
||||
public class ZipkinTests extends AbstractIntegrationTest {
|
||||
|
||||
@ClassRule
|
||||
public static final MockWebServer zipkin = new MockWebServer();
|
||||
|
||||
@AfterAll
|
||||
static void clean() throws IOException {
|
||||
zipkin.close();
|
||||
}
|
||||
|
||||
private static final String APP_NAME = "testsleuthzipkin";
|
||||
|
||||
@Autowired
|
||||
@@ -72,8 +74,9 @@ public class ZipkinTests extends AbstractIntegrationTest {
|
||||
|
||||
private String sampleAppUrl = "http://localhost:" + this.port;
|
||||
|
||||
@BeforeClass
|
||||
public static void setup() {
|
||||
@BeforeAll
|
||||
public static void setup() throws IOException {
|
||||
zipkin.start();
|
||||
// enqueues a request for async reporter health check
|
||||
zipkin.enqueue(new MockResponse());
|
||||
}
|
||||
|
||||
@@ -16,15 +16,12 @@
|
||||
|
||||
package sample;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SampleZipkinApplication.class)
|
||||
@WebAppConfiguration
|
||||
@TestPropertySource(properties = "sample.zipkin.enabled=false")
|
||||
|
||||
@@ -16,13 +16,10 @@
|
||||
|
||||
package sample;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = SampleSleuthApplication.class)
|
||||
public class SampleSleuthApplicationTests {
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.net.URI;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.mockito.Mockito;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.zipkin2;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import brave.Span;
|
||||
@@ -27,10 +28,9 @@ import brave.sampler.Sampler;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
import okhttp3.mockwebserver.RecordedRequest;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.After;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Call;
|
||||
import zipkin2.codec.Encoding;
|
||||
import zipkin2.reporter.AsyncReporter;
|
||||
@@ -60,17 +60,23 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
*/
|
||||
public class ZipkinAutoConfigurationTests {
|
||||
|
||||
@Rule
|
||||
public ExpectedException thrown = ExpectedException.none();
|
||||
|
||||
@Rule
|
||||
public MockWebServer server = new MockWebServer();
|
||||
|
||||
@BeforeEach
|
||||
void setup() throws IOException {
|
||||
server.start();
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
void clean() throws IOException {
|
||||
server.close();
|
||||
}
|
||||
|
||||
MockEnvironment environment = new MockEnvironment();
|
||||
|
||||
AnnotationConfigApplicationContext context;
|
||||
|
||||
@After
|
||||
@AfterEach
|
||||
public void close() {
|
||||
if (this.context != null) {
|
||||
this.context.close();
|
||||
|
||||
@@ -25,9 +25,9 @@ import brave.Tracing;
|
||||
import brave.sampler.Sampler;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.ClassRule;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.AfterAll;
|
||||
import org.junit.jupiter.api.BeforeAll;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
@@ -37,11 +37,9 @@ import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
|
||||
import org.springframework.cloud.client.loadbalancer.LoadBalancerRequest;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = ZipkinDiscoveryClientTests.Config.class, properties = {
|
||||
"spring.zipkin.baseUrl=https://zipkin/", "spring.zipkin.sender.type=web" // override
|
||||
// default
|
||||
@@ -55,9 +53,18 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
})
|
||||
public class ZipkinDiscoveryClientTests {
|
||||
|
||||
@ClassRule
|
||||
public static MockWebServer ZIPKIN_RULE = new MockWebServer();
|
||||
|
||||
@BeforeAll
|
||||
static void setup() throws IOException {
|
||||
ZIPKIN_RULE.start();
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
static void clean() throws IOException {
|
||||
ZIPKIN_RULE.close();
|
||||
}
|
||||
|
||||
@Autowired
|
||||
Tracing tracing;
|
||||
|
||||
|
||||
@@ -16,15 +16,12 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.zipkin2;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(classes = ZipkinWithDisabledSleuthTests.Config.class)
|
||||
@TestPropertySource(properties = "spring.sleuth.enabled=false")
|
||||
public class ZipkinWithDisabledSleuthTests {
|
||||
|
||||
@@ -16,13 +16,14 @@
|
||||
|
||||
package org.springframework.cloud.sleuth.zipkin2.sender;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import okhttp3.mockwebserver.MockResponse;
|
||||
import okhttp3.mockwebserver.MockWebServer;
|
||||
import okhttp3.mockwebserver.RecordedRequest;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Call;
|
||||
import zipkin2.Endpoint;
|
||||
import zipkin2.Span;
|
||||
@@ -46,9 +47,13 @@ public class RestTemplateSenderTest {
|
||||
.timestamp(1472470996250000L).duration(100000L).putTag("http.method", "GET")
|
||||
.putTag("http.path", "/backend").build();
|
||||
|
||||
@Rule
|
||||
public MockWebServer server = new MockWebServer();
|
||||
|
||||
@AfterEach
|
||||
void clean() throws IOException {
|
||||
server.close();
|
||||
}
|
||||
|
||||
String endpoint = this.server.url("/api/v2/spans").toString();
|
||||
|
||||
RestTemplateSender sender = new RestTemplateSender(new RestTemplate(), this.endpoint,
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.sleuth.zipkin2.sender;
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
|
||||
@@ -25,9 +25,8 @@ import brave.Tracer;
|
||||
import brave.Tracing;
|
||||
import brave.sampler.Sampler;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
@@ -37,12 +36,10 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static java.util.concurrent.TimeUnit.SECONDS;
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(
|
||||
classes = { TraceAsyncIntegrationTests.TraceAsyncITestConfiguration.class })
|
||||
public class TraceAsyncIntegrationTests {
|
||||
@@ -56,7 +53,7 @@ public class TraceAsyncIntegrationTests {
|
||||
@Autowired
|
||||
ArrayListSpanReporter reporter;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void cleanup() {
|
||||
this.classPerformingAsyncLogic.clear();
|
||||
this.reporter.clear();
|
||||
|
||||
@@ -19,7 +19,7 @@ package org.springframework.cloud.sleuth.instrument.async.issues.issue1212;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.springframework.aop.interceptor.AsyncExecutionAspectSupport;
|
||||
|
||||
@@ -31,8 +31,7 @@ import brave.sampler.Sampler;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.awaitility.Awaitility;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -50,7 +49,6 @@ import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
@@ -60,7 +58,6 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = { AppConfig.class, Application.class },
|
||||
webEnvironment = WebEnvironment.RANDOM_PORT,
|
||||
properties = { "ribbon.eureka.enabled=false", "feign.hystrix.enabled=false" })
|
||||
|
||||
@@ -19,8 +19,7 @@ package org.springframework.cloud.sleuth.instrument.async.issues.issue546;
|
||||
import brave.Tracing;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -29,7 +28,6 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.core.env.Environment;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -42,7 +40,6 @@ import static org.assertj.core.api.BDDAssertions.then;
|
||||
/**
|
||||
* @author Marcin Grzejszczak
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Issue546TestsApp.class,
|
||||
properties = { "ribbon.eureka.enabled=false", "feign.hystrix.enabled=false",
|
||||
"server.port=0" },
|
||||
|
||||
@@ -27,9 +27,8 @@ import feign.Client;
|
||||
import feign.Request;
|
||||
import feign.RequestTemplate;
|
||||
import feign.Response;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Span;
|
||||
import zipkin2.reporter.Reporter;
|
||||
|
||||
@@ -45,13 +44,11 @@ import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.annotation.DirtiesContext.ClassMode;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Application.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "feign.hystrix.enabled=false" })
|
||||
@@ -70,7 +67,7 @@ public class ManuallyCreatedLoadBalancerFeignClientTests {
|
||||
@Autowired
|
||||
Tracing tracer;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void open() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
@@ -31,9 +31,8 @@ import feign.Response;
|
||||
import feign.Target.HardCodedTarget;
|
||||
import feign.codec.Decoder;
|
||||
import feign.codec.Encoder;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import zipkin2.Span;
|
||||
import zipkin2.reporter.Reporter;
|
||||
|
||||
@@ -48,13 +47,11 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.annotation.DirtiesContext.ClassMode;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import static org.assertj.core.api.BDDAssertions.then;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = Application.class,
|
||||
webEnvironment = SpringBootTest.WebEnvironment.NONE,
|
||||
properties = { "feign.hystrix.enabled=false" })
|
||||
@@ -76,7 +73,7 @@ public class ManuallyCreatedDelegateLoadBalancerFeignClientTests {
|
||||
@Autowired
|
||||
Tracing tracer;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void open() {
|
||||
this.reporter.clear();
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user