1919import static io .opentelemetry .semconv .incubating .DbIncubatingAttributes .DB_SYSTEM ;
2020import static java .util .Arrays .asList ;
2121import static org .assertj .core .api .Assertions .assertThat ;
22- import static org .junit .jupiter .api .Assertions .assertEquals ;
2322import static org .junit .jupiter .api .Assertions .assertFalse ;
24- import static org .junit .jupiter .api .Assertions .assertNotNull ;
2523import static org .junit .jupiter .api .Assertions .assertNull ;
2624
2725import io .opentelemetry .api .common .AttributeKey ;
@@ -90,7 +88,8 @@ void testCurd() {
9088 .hasKind (CLIENT )
9189 .hasParent (trace .getSpan (1 ))
9290 .hasAttributesSatisfyingExactly (
93- equalTo (DB_SYSTEM , "hsqldb" ),
91+ equalTo (
92+ DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
9493 equalTo (maybeStable (DB_NAME ), "test" ),
9594 equalTo (
9695 DbIncubatingAttributes .DB_USER ,
@@ -122,7 +121,7 @@ void testCurd() {
122121 testing .runWithSpan ("parent" , () -> repo .save (customer ));
123122 Long savedId = customer .getId ();
124123
125- assertThat (customer .getId ()).isNull ();
124+ assertThat (customer .getId ()).isNotNull ();
126125 testing .waitAndAssertTraces (
127126 trace -> {
128127 List <Consumer <SpanDataAssert >> consumers =
@@ -149,14 +148,15 @@ void testCurd() {
149148 .hasKind (CLIENT )
150149 .hasParent (trace .getSpan (1 ))
151150 .hasAttributesSatisfyingExactly (
152- equalTo (DB_SYSTEM , "hsqldb" ),
151+ equalTo (
152+ DB_SYSTEM ,
153+ DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
153154 equalTo (maybeStable (DB_NAME ), "test" ),
154155 equalTo (
155156 DbIncubatingAttributes .DB_USER ,
156157 emitStableDatabaseSemconv () ? null : "sa" ),
157158 equalTo (
158- maybeStable (DB_STATEMENT ),
159- "call next value for Customer_SEQ" ),
159+ maybeStable (DB_STATEMENT ), "call next value for Customer_SEQ" ),
160160 equalTo (
161161 DbIncubatingAttributes .DB_CONNECTION_STRING ,
162162 emitStableDatabaseSemconv () ? null : "hsqldb:mem:" ),
@@ -177,7 +177,9 @@ void testCurd() {
177177 .hasKind (CLIENT )
178178 .hasParent (trace .getSpan (3 ))
179179 .hasAttributesSatisfyingExactly (
180- equalTo (DB_SYSTEM , "hsqldb" ),
180+ equalTo (
181+ DB_SYSTEM ,
182+ DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
181183 equalTo (maybeStable (DB_NAME ), "test" ),
182184 equalTo (
183185 DbIncubatingAttributes .DB_USER ,
@@ -191,9 +193,7 @@ void testCurd() {
191193 val .matches (
192194 "insert into Customer \\ (.*\\ ) values \\ (.*\\ )" )),
193195 equalTo (maybeStable (DB_OPERATION ), "INSERT" ),
194- equalTo (
195- maybeStable (DB_SQL_TABLE ),
196- "Customer" ))));
196+ equalTo (maybeStable (DB_SQL_TABLE ), "Customer" ))));
197197
198198 } else {
199199 consumers .addAll (
@@ -203,7 +203,9 @@ void testCurd() {
203203 .hasKind (CLIENT )
204204 .hasParent (trace .getSpan (1 ))
205205 .hasAttributesSatisfyingExactly (
206- equalTo (DB_SYSTEM , "hsqldb" ),
206+ equalTo (
207+ DB_SYSTEM ,
208+ DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
207209 equalTo (maybeStable (DB_NAME ), "test" ),
208210 equalTo (
209211 DbIncubatingAttributes .DB_USER ,
@@ -217,8 +219,7 @@ void testCurd() {
217219 val .matches (
218220 "insert into Customer \\ (.*\\ ) values \\ (.*\\ )" )),
219221 equalTo (maybeStable (DB_OPERATION ), "INSERT" ),
220- equalTo (
221- maybeStable (DB_SQL_TABLE ), "Customer" )),
222+ equalTo (maybeStable (DB_SQL_TABLE ), "Customer" )),
222223 span ->
223224 span .hasName ("Transaction.commit" )
224225 .hasKind (INTERNAL )
@@ -260,7 +261,8 @@ void testCurd() {
260261 span .hasName ("SELECT test.Customer" )
261262 .hasKind (CLIENT )
262263 .hasAttributesSatisfyingExactly (
263- equalTo (DB_SYSTEM , "hsqldb" ),
264+ equalTo (
265+ DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
264266 equalTo (maybeStable (DB_NAME ), "test" ),
265267 equalTo (
266268 DbIncubatingAttributes .DB_USER ,
@@ -290,7 +292,8 @@ void testCurd() {
290292 span .hasName ("UPDATE test.Customer" )
291293 .hasKind (CLIENT )
292294 .hasAttributesSatisfyingExactly (
293- equalTo (DB_SYSTEM , "hsqldb" ),
295+ equalTo (
296+ DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
294297 equalTo (maybeStable (DB_NAME ), "test" ),
295298 equalTo (
296299 DbIncubatingAttributes .DB_USER ,
@@ -304,8 +307,7 @@ void testCurd() {
304307 val .matches (
305308 "update Customer set firstName=\\ ?,(.*)lastName=\\ ? where id=\\ ?" )),
306309 equalTo (maybeStable (DB_OPERATION ), "UPDATE" ),
307- equalTo (
308- maybeStable (DB_SQL_TABLE ), "Customer" ))));
310+ equalTo (maybeStable (DB_SQL_TABLE ), "Customer" ))));
309311 testing .clearData ();
310312 Customer anonymousCustomer =
311313 testing .runWithSpan ("parent" , () -> repo .findByLastName ("Anonymous" ).get (0 ));
@@ -336,7 +338,8 @@ void testCurd() {
336338 .hasKind (CLIENT )
337339 .hasParent (trace .getSpan (1 ))
338340 .hasAttributesSatisfyingExactly (
339- equalTo (DB_SYSTEM , "hsqldb" ),
341+ equalTo (
342+ DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
340343 equalTo (maybeStable (DB_NAME ), "test" ),
341344 equalTo (
342345 DbIncubatingAttributes .DB_USER ,
@@ -350,8 +353,7 @@ void testCurd() {
350353 val .matches (
351354 "select ([^.]+)\\ .id([^,]*),([^.]+)\\ .firstName([^,]*),([^.]+)\\ .lastName (.*)from Customer (.*)(where ([^.]+)\\ .lastName( ?)=( ?)\\ ?|)" )),
352355 equalTo (maybeStable (DB_OPERATION ), "SELECT" ),
353- equalTo (
354- maybeStable (DB_SQL_TABLE ), "Customer" ))));
356+ equalTo (maybeStable (DB_SQL_TABLE ), "Customer" ))));
355357 testing .clearData ();
356358
357359 testing .runWithSpan ("parent" , () -> repo .delete (anonymousCustomer ));
@@ -386,7 +388,8 @@ void testCurd() {
386388 .hasKind (CLIENT )
387389 .hasParent (trace .getSpan (1 ))
388390 .hasAttributesSatisfyingExactly (
389- equalTo (DB_SYSTEM , "hsqldb" ),
391+ equalTo (
392+ DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
390393 equalTo (maybeStable (DB_NAME ), "test" ),
391394 equalTo (
392395 DbIncubatingAttributes .DB_USER ,
@@ -418,7 +421,8 @@ void testCurd() {
418421 .hasKind (CLIENT )
419422 .hasParent (trace .getSpan (1 ))
420423 .hasAttributesSatisfyingExactly (
421- equalTo (DB_SYSTEM , "hsqldb" ),
424+ equalTo (
425+ DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
422426 equalTo (maybeStable (DB_NAME ), "test" ),
423427 equalTo (
424428 DbIncubatingAttributes .DB_USER ,
@@ -457,17 +461,16 @@ void testCurd() {
457461 span .hasName ("DELETE test.Customer" )
458462 .hasKind (CLIENT )
459463 .hasAttributesSatisfyingExactly (
460- equalTo (DB_SYSTEM , "hsqldb" ),
464+ equalTo (
465+ DB_SYSTEM , DbIncubatingAttributes .DbSystemIncubatingValues .HSQLDB ),
461466 equalTo (maybeStable (DB_NAME ), "test" ),
462467 equalTo (
463468 DbIncubatingAttributes .DB_USER ,
464469 emitStableDatabaseSemconv () ? null : "sa" ),
465470 equalTo (
466471 DbIncubatingAttributes .DB_CONNECTION_STRING ,
467472 emitStableDatabaseSemconv () ? null : "hsqldb:mem:" ),
468- equalTo (
469- maybeStable (DB_STATEMENT ),
470- "delete from Customer where id=?" ),
473+ equalTo (maybeStable (DB_STATEMENT ), "delete from Customer where id=?" ),
471474 equalTo (maybeStable (DB_OPERATION ), "DELETE" ),
472475 equalTo (maybeStable (DB_SQL_TABLE ), "Customer" )));
473476 trace .hasSpansSatisfyingExactly (consumers );
0 commit comments