File tree 2 files changed +25
-17
lines changed
instrumentation/hibernate/hibernate-reactive-1.0/javaagent
src/hibernateReactive1Test/java/io/opentelemetry/javaagent/instrumentation/hibernate/reactive/v1_0
2 files changed +25
-17
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ testing {
38
38
implementation(" org.hibernate.reactive:hibernate-reactive-core:1.0.0.Final" )
39
39
implementation(" io.vertx:vertx-pg-client:4.1.5" )
40
40
}
41
+ compileOnly(" io.vertx:vertx-codegen:4.1.5" )
41
42
}
42
43
}
43
44
Original file line number Diff line number Diff line change 18
18
import io .opentelemetry .api .trace .SpanKind ;
19
19
import io .opentelemetry .instrumentation .testing .junit .AgentInstrumentationExtension ;
20
20
import io .opentelemetry .instrumentation .testing .junit .InstrumentationExtension ;
21
+ import io .vertx .core .Vertx ;
21
22
import java .time .Duration ;
23
+ import java .util .concurrent .CountDownLatch ;
22
24
import java .util .concurrent .TimeUnit ;
23
25
import javax .persistence .EntityManagerFactory ;
24
26
import javax .persistence .Persistence ;
@@ -117,23 +119,28 @@ void testMutiny() {
117
119
118
120
@ Test
119
121
void testStage () throws Exception {
120
- testing
121
- .runWithSpan (
122
- "parent" ,
123
- () ->
124
- stageSessionFactory
125
- .withSession (
126
- session -> {
127
- if (!Span .current ().getSpanContext ().isValid ()) {
128
- throw new IllegalStateException ("missing parent span" );
129
- }
130
-
131
- return session
132
- .find (Value .class , 1L )
133
- .thenAccept (value -> testing .runWithSpan ("callback" , () -> {}));
134
- })
135
- .toCompletableFuture ())
136
- .get (30 , TimeUnit .SECONDS );
122
+ CountDownLatch latch = new CountDownLatch (1 );
123
+ testing .runWithSpan (
124
+ "parent" ,
125
+ () ->
126
+ Vertx .vertx ()
127
+ .getOrCreateContext ()
128
+ .runOnContext (
129
+ event ->
130
+ stageSessionFactory
131
+ .withSession (
132
+ session -> {
133
+ if (!Span .current ().getSpanContext ().isValid ()) {
134
+ throw new IllegalStateException ("missing parent span" );
135
+ }
136
+
137
+ return session
138
+ .find (Value .class , 1L )
139
+ .thenAccept (
140
+ value -> testing .runWithSpan ("callback" , () -> {}));
141
+ })
142
+ .thenAccept (unused -> latch .countDown ())));
143
+ latch .await (30 , TimeUnit .SECONDS );
137
144
138
145
assertTrace ();
139
146
}
You can’t perform that action at this time.
0 commit comments