Skip to content

Commit 5d75d1f

Browse files
Added kotlin tests
1 parent 8fd1533 commit 5d75d1f

File tree

3 files changed

+221
-0
lines changed

3 files changed

+221
-0
lines changed

tests/otel/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<module>spring-cloud-sleuth-instrumentation-gateway-tests</module>
4848
<module>spring-cloud-sleuth-instrumentation-jdbc-tests</module>
4949
<module>spring-cloud-sleuth-instrumentation-kafka-tests</module>
50+
<module>spring-cloud-sleuth-instrumentation-kotlin-tests</module>
5051
<module>spring-cloud-sleuth-instrumentation-messaging-tests</module>
5152
<module>spring-cloud-sleuth-instrumentation-mvc-tests</module>
5253
<module>spring-cloud-sleuth-instrumentation-quartz-tests</module>
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Copyright 2013-2021 the original author or authors.
4+
~
5+
~ Licensed under the Apache License, Version 2.0 (the "License");
6+
~ you may not use this file except in compliance with the License.
7+
~ You may obtain a copy of the License at
8+
~
9+
~ https://www.apache.org/licenses/LICENSE-2.0
10+
~
11+
~ Unless required by applicable law or agreed to in writing, software
12+
~ distributed under the License is distributed on an "AS IS" BASIS,
13+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
~ See the License for the specific language governing permissions and
15+
~ limitations under the License.
16+
~
17+
~
18+
-->
19+
20+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xmlns="http://maven.apache.org/POM/4.0.0"
22+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
23+
<modelVersion>4.0.0</modelVersion>
24+
25+
<artifactId>spring-cloud-sleuth-instrumentation-otel-tests</artifactId>
26+
<packaging>jar</packaging>
27+
<name>Spring Cloud Sleuth OTel Kotlin Instrumentation Tests</name>
28+
<description>Spring Cloud Sleuth OTel Kotlin Instrumentation Tests</description>
29+
30+
<parent>
31+
<groupId>org.springframework.cloud</groupId>
32+
<artifactId>spring-cloud-sleuth-otel-tests</artifactId>
33+
<version>1.1.0-SNAPSHOT</version>
34+
<relativePath>..</relativePath>
35+
</parent>
36+
37+
<properties>
38+
<sonar.skip>true</sonar.skip>
39+
<kotlin.version>1.5.10</kotlin.version>
40+
</properties>
41+
42+
<build>
43+
<plugins>
44+
<plugin>
45+
<!--skip deploy -->
46+
<artifactId>maven-deploy-plugin</artifactId>
47+
<configuration>
48+
<skip>true</skip>
49+
</configuration>
50+
</plugin>
51+
52+
<plugin>
53+
<groupId>org.codehaus.mojo</groupId>
54+
<artifactId>build-helper-maven-plugin</artifactId>
55+
<version>${build-helper-maven-plugin.version}</version>
56+
<executions>
57+
<execution>
58+
<id>add-source</id>
59+
<phase>generate-sources</phase>
60+
<goals>
61+
<goal>add-source</goal>
62+
</goals>
63+
<configuration>
64+
<sources>
65+
<source>src/main/kotlin</source>
66+
</sources>
67+
</configuration>
68+
</execution>
69+
<execution>
70+
<id>add-test-source</id>
71+
<phase>generate-test-sources</phase>
72+
<goals>
73+
<goal>add-test-source</goal>
74+
</goals>
75+
<configuration>
76+
<sources>
77+
<source>src/test/kotlin</source>
78+
</sources>
79+
</configuration>
80+
</execution>
81+
</executions>
82+
</plugin>
83+
<plugin>
84+
<groupId>org.jetbrains.kotlin</groupId>
85+
<artifactId>kotlin-maven-plugin</artifactId>
86+
<version>${kotlin.version}</version>
87+
<executions>
88+
<execution>
89+
<id>compile</id>
90+
<phase>compile</phase>
91+
<goals>
92+
<goal>compile</goal>
93+
</goals>
94+
</execution>
95+
<execution>
96+
<id>test-compile</id>
97+
<phase>test-compile</phase>
98+
<goals>
99+
<goal>test-compile</goal>
100+
</goals>
101+
</execution>
102+
</executions>
103+
<configuration>
104+
<args>
105+
<arg>-Xjsr305=strict</arg>
106+
</args>
107+
<compilerPlugins>
108+
<plugin>spring</plugin>
109+
</compilerPlugins>
110+
</configuration>
111+
<dependencies>
112+
<dependency>
113+
<groupId>org.jetbrains.kotlin</groupId>
114+
<artifactId>kotlin-maven-allopen</artifactId>
115+
<version>${kotlin.version}</version>
116+
</dependency>
117+
</dependencies>
118+
</plugin>
119+
</plugins>
120+
</build>
121+
122+
<dependencies>
123+
<dependency>
124+
<groupId>org.springframework.cloud</groupId>
125+
<artifactId>spring-cloud-sleuth-tests-otel-common</artifactId>
126+
</dependency>
127+
<dependency>
128+
<groupId>org.springframework.boot</groupId>
129+
<artifactId>spring-boot-starter-webflux</artifactId>
130+
</dependency>
131+
<dependency>
132+
<groupId>org.springframework.cloud</groupId>
133+
<artifactId>spring-cloud-starter-sleuth</artifactId>
134+
<exclusions>
135+
<exclusion>
136+
<groupId>org.springframework.cloud</groupId>
137+
<artifactId>spring-cloud-sleuth-brave</artifactId>
138+
</exclusion>
139+
</exclusions>
140+
</dependency>
141+
<dependency>
142+
<groupId>org.springframework.cloud</groupId>
143+
<artifactId>spring-cloud-sleuth-otel-autoconfigure</artifactId>
144+
</dependency>
145+
<dependency>
146+
<groupId>org.springframework.boot</groupId>
147+
<artifactId>spring-boot-starter-test</artifactId>
148+
</dependency>
149+
<dependency>
150+
<groupId>org.awaitility</groupId>
151+
<artifactId>awaitility</artifactId>
152+
</dependency>
153+
154+
<dependency>
155+
<groupId>io.projectreactor.kotlin</groupId>
156+
<artifactId>reactor-kotlin-extensions</artifactId>
157+
<optional>true</optional>
158+
</dependency>
159+
<dependency>
160+
<groupId>org.jetbrains.kotlin</groupId>
161+
<artifactId>kotlin-reflect</artifactId>
162+
<optional>true</optional>
163+
</dependency>
164+
<dependency>
165+
<groupId>org.jetbrains.kotlin</groupId>
166+
<artifactId>kotlin-stdlib-jdk8</artifactId>
167+
<optional>true</optional>
168+
</dependency>
169+
<dependency>
170+
<groupId>org.jetbrains.kotlinx</groupId>
171+
<artifactId>kotlinx-coroutines-reactor</artifactId>
172+
<optional>true</optional>
173+
</dependency>
174+
175+
</dependencies>
176+
177+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright 2013-2021 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.cloud.sleuth.brave.kotlin
18+
19+
import io.opentelemetry.sdk.trace.samplers.Sampler
20+
import org.springframework.boot.test.context.SpringBootTest
21+
import org.springframework.cloud.sleuth.otel.OtelTestSpanHandler
22+
import org.springframework.cloud.sleuth.otel.bridge.ArrayListSpanProcessor
23+
import org.springframework.context.annotation.Bean
24+
import org.springframework.context.annotation.Configuration
25+
import org.springframework.test.context.ContextConfiguration
26+
27+
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
28+
@ContextConfiguration
29+
class SleuthCoroutinesApplicationTests : org.springframework.cloud.sleuth.kotlin.SleuthCoroutinesApplicationTests() {
30+
31+
@Configuration(proxyBeanMethods = false)
32+
internal class Config {
33+
@Bean
34+
fun testSpanHandlerSupplier(): OtelTestSpanHandler {
35+
return OtelTestSpanHandler(ArrayListSpanProcessor())
36+
}
37+
38+
@Bean
39+
fun alwaysSampler(): Sampler {
40+
return Sampler.alwaysOn()
41+
}
42+
}
43+
}

0 commit comments

Comments
 (0)