@@ -158,14 +158,19 @@ public void testTraceQueryByTraceId() throws BanyanDBException, ExecutionExcepti
158
158
TraceQueryResponse response = client .query (query );
159
159
Assert .assertNotNull ("Query response should not be null" , response );
160
160
Assert .assertFalse ("Should have at least one result" , response .isEmpty ());
161
- Assert .assertEquals ("Should have exactly one span " , 1 , response .size ());
161
+ Assert .assertEquals ("Should have exactly one trace " , 1 , response .size ());
162
162
163
- // Verify we can access span data
164
- Assert .assertNotNull ("Spans list should not be null" , response .getSpans ());
165
- Assert .assertEquals ("Should have one span in list" , 1 , response .getSpans ().size ());
163
+ // Verify we can access trace data
164
+ Assert .assertNotNull ("Traces list should not be null" , response .getTraces ());
165
+ Assert .assertEquals ("Should have one trace in list" , 1 , response .getTraces ().size ());
166
166
167
- // Get the first span and verify its contents
168
- org .apache .skywalking .banyandb .trace .v1 .BanyandbTrace .Span span = response .getSpans ().get (0 );
167
+ // Get the first trace and verify its contents
168
+ org .apache .skywalking .banyandb .trace .v1 .BanyandbTrace .Trace trace = response .getTraces ().get (0 );
169
+ Assert .assertNotNull ("Trace should not be null" , trace );
170
+ Assert .assertEquals ("Trace should have exactly one span" , 1 , trace .getSpansCount ());
171
+
172
+ // Get the span from the trace and verify its contents
173
+ org .apache .skywalking .banyandb .trace .v1 .BanyandbTrace .Span span = trace .getSpans (0 );
169
174
Assert .assertNotNull ("Span should not be null" , span );
170
175
171
176
// Verify span data (binary content) - this is the main content returned
@@ -228,15 +233,21 @@ public void testTraceQueryOrderByStartTime() throws BanyanDBException, Execution
228
233
TraceQueryResponse response = client .query (query );
229
234
Assert .assertNotNull ("Query response should not be null" , response );
230
235
Assert .assertFalse ("Should have at least one result" , response .isEmpty ());
231
- Assert .assertTrue ("Should have exactly 2 spans" , response .size () == 2 );
236
+ Assert .assertTrue ("Should have exactly 2 traces" , response .size () == 2 );
237
+
238
+ // Verify we can access trace data
239
+ Assert .assertNotNull ("Traces list should not be null" , response .getTraces ());
240
+ Assert .assertTrue ("Should have exactly 2 traces in list" , response .getTraces ().size () == 2 );
241
+
242
+ // Get spans from each trace and verify that span content matches expected data
243
+ org .apache .skywalking .banyandb .trace .v1 .BanyandbTrace .Trace firstTrace = response .getTraces ().get (0 );
244
+ org .apache .skywalking .banyandb .trace .v1 .BanyandbTrace .Trace secondTrace = response .getTraces ().get (1 );
232
245
233
- // Verify we can access span data
234
- Assert .assertNotNull ("Spans list should not be null" , response .getSpans ());
235
- Assert .assertTrue ("Should have exactly 2 spans in list" , response .getSpans ().size () == 2 );
246
+ Assert .assertEquals ("First trace should have exactly one span" , 1 , firstTrace .getSpansCount ());
247
+ Assert .assertEquals ("Second trace should have exactly one span" , 1 , secondTrace .getSpansCount ());
236
248
237
- // Verify that span content matches expected data
238
- String firstSpanContent = new String (response .getSpans ().get (0 ).getSpan ().toByteArray ());
239
- String secondSpanContent = new String (response .getSpans ().get (1 ).getSpan ().toByteArray ());
249
+ String firstSpanContent = new String (firstTrace .getSpans (0 ).getSpan ().toByteArray ());
250
+ String secondSpanContent = new String (secondTrace .getSpans (0 ).getSpan ().toByteArray ());
240
251
241
252
// Since we're ordering by start_time DESC, span-data-2 should come before span-data-1
242
253
// (baseTime+60 > baseTime)
0 commit comments