25
25
import org .springframework .web .bind .annotation .RequestMapping ;
26
26
import org .springframework .web .bind .annotation .RestController ;
27
27
28
- import static org .assertj . core . api . BDDAssertions .then ;
28
+ import static org .springframework . cloud . sleuth . assertions . SleuthAssertions .then ;
29
29
import static org .springframework .test .web .servlet .request .MockMvcRequestBuilders .asyncDispatch ;
30
30
import static org .springframework .test .web .servlet .result .MockMvcResultMatchers .status ;
31
31
@@ -61,6 +61,7 @@ public void should_create_and_return_trace_in_HTTP_header() throws Exception {
61
61
MvcResult mvcResult = whenSentPingWithoutTracingData ();
62
62
63
63
then (tracingHeaderFrom (mvcResult )).isNotNull ();
64
+ then (TraceFilterIntegrationTests .span ).hasLoggedAnEvent (Span .SERVER_RECV ).hasLoggedAnEvent (Span .SERVER_SEND );
64
65
}
65
66
66
67
@ Test
@@ -71,7 +72,7 @@ public void should_ignore_sampling_the_span_if_uri_matches_management_properties
71
72
}
72
73
73
74
@ Test
74
- public void when_correlationId_is_sent_should_not_create_a_new_one_but_return_the_existing_one_instead ()
75
+ public void when_traceId_is_sent_should_not_create_a_new_one_but_return_the_existing_one_instead ()
75
76
throws Exception {
76
77
Long expectedTraceId = new Random ().nextLong ();
77
78
@@ -81,7 +82,7 @@ public void when_correlationId_is_sent_should_not_create_a_new_one_but_return_th
81
82
}
82
83
83
84
@ Test
84
- public void when_correlationId_is_sent_to_async_endpoint_span_is_joined ()
85
+ public void when_traceId_is_sent_to_async_endpoint_span_is_joined ()
85
86
throws Exception {
86
87
Long expectedTraceId = new Random ().nextLong ();
87
88
@@ -115,16 +116,16 @@ private MvcResult whenSentFutureWithTraceId(Long passedTraceId) throws Exception
115
116
return sendPingWithTraceId ("/future" , Span .TRACE_ID_NAME , passedTraceId );
116
117
}
117
118
118
- private MvcResult sendPingWithTraceId (String headerName , Long correlationId )
119
+ private MvcResult sendPingWithTraceId (String headerName , Long traceId )
119
120
throws Exception {
120
- return sendPingWithTraceId ("/ping" , headerName , correlationId );
121
+ return sendPingWithTraceId ("/ping" , headerName , traceId );
121
122
}
122
123
123
124
private MvcResult sendPingWithTraceId (String path , String headerName ,
124
- Long correlationId ) throws Exception {
125
+ Long traceId ) throws Exception {
125
126
return this .mockMvc
126
127
.perform (MockMvcRequestBuilders .get (path ).accept (MediaType .TEXT_PLAIN )
127
- .header (headerName , Span .idToHex (correlationId ))
128
+ .header (headerName , Span .idToHex (traceId ))
128
129
.header (Span .SPAN_ID_NAME , Span .idToHex (new Random ().nextLong ())))
129
130
.andReturn ();
130
131
}
0 commit comments