@@ -50,6 +50,7 @@ public class LogEntryTest {
50
50
ImmutableMap .of ("key1" , "value1" , "key2" , "value2" );
51
51
private static final Operation OPERATION = Operation .of ("id" , "producer" );
52
52
private static final String TRACE = "trace" ;
53
+ private static final String SPAN_ID = "spanId" ;
53
54
private static final SourceLocation SOURCE_LOCATION = new SourceLocation .Builder ()
54
55
.setFile ("file" )
55
56
.setLine (42L )
@@ -71,6 +72,7 @@ public class LogEntryTest {
71
72
.setLabels (LABELS )
72
73
.setOperation (OPERATION )
73
74
.setTrace (TRACE )
75
+ .setSpanId (SPAN_ID )
74
76
.setSourceLocation (SOURCE_LOCATION )
75
77
.build ();
76
78
private static final LogEntry JSON_ENTRY = LogEntry .newBuilder (JSON_PAYLOAD )
@@ -84,6 +86,7 @@ public class LogEntryTest {
84
86
.setLabels (LABELS )
85
87
.setOperation (OPERATION )
86
88
.setTrace (TRACE )
89
+ .setSpanId (SPAN_ID )
87
90
.setSourceLocation (SOURCE_LOCATION )
88
91
.build ();
89
92
private static final LogEntry PROTO_ENTRY = LogEntry .newBuilder (PROTO_PAYLOAD )
@@ -97,6 +100,7 @@ public class LogEntryTest {
97
100
.setLabels (LABELS )
98
101
.setOperation (OPERATION )
99
102
.setTrace (TRACE )
103
+ .setSpanId (SPAN_ID )
100
104
.setSourceLocation (SOURCE_LOCATION )
101
105
.build ();
102
106
@@ -114,6 +118,7 @@ public void testOf() {
114
118
assertNull (logEntry .getHttpRequest ());
115
119
assertNull (logEntry .getOperation ());
116
120
assertNull (logEntry .getTrace ());
121
+ assertNull (logEntry .getSpanId ());
117
122
assertNull (logEntry .getSourceLocation ());
118
123
logEntry = LogEntry .of (LOG_NAME , RESOURCE , STRING_PAYLOAD );
119
124
assertEquals (STRING_PAYLOAD , logEntry .getPayload ());
@@ -128,6 +133,7 @@ public void testOf() {
128
133
assertNull (logEntry .getHttpRequest ());
129
134
assertNull (logEntry .getOperation ());
130
135
assertNull (logEntry .getTrace ());
136
+ assertNull (logEntry .getSpanId ());
131
137
assertNull (logEntry .getSourceLocation ());
132
138
}
133
139
@@ -143,6 +149,7 @@ public void testBuilder() {
143
149
assertEquals (LABELS , STRING_ENTRY .getLabels ());
144
150
assertEquals (OPERATION , STRING_ENTRY .getOperation ());
145
151
assertEquals (TRACE , STRING_ENTRY .getTrace ());
152
+ assertEquals (SPAN_ID , STRING_ENTRY .getSpanId ());
146
153
assertEquals (SOURCE_LOCATION , STRING_ENTRY .getSourceLocation ());
147
154
assertEquals (STRING_PAYLOAD , STRING_ENTRY .getPayload ());
148
155
assertEquals (LOG_NAME , JSON_ENTRY .getLogName ());
@@ -155,6 +162,7 @@ public void testBuilder() {
155
162
assertEquals (LABELS , JSON_ENTRY .getLabels ());
156
163
assertEquals (OPERATION , JSON_ENTRY .getOperation ());
157
164
assertEquals (TRACE , JSON_ENTRY .getTrace ());
165
+ assertEquals (SPAN_ID , JSON_ENTRY .getSpanId ());
158
166
assertEquals (SOURCE_LOCATION , JSON_ENTRY .getSourceLocation ());
159
167
assertEquals (JSON_PAYLOAD , JSON_ENTRY .getPayload ());
160
168
assertEquals (LOG_NAME , PROTO_ENTRY .getLogName ());
@@ -167,6 +175,7 @@ public void testBuilder() {
167
175
assertEquals (LABELS , PROTO_ENTRY .getLabels ());
168
176
assertEquals (OPERATION , PROTO_ENTRY .getOperation ());
169
177
assertEquals (TRACE , PROTO_ENTRY .getTrace ());
178
+ assertEquals (SPAN_ID , PROTO_ENTRY .getSpanId ());
170
179
assertEquals (SOURCE_LOCATION , PROTO_ENTRY .getSourceLocation ());
171
180
assertEquals (PROTO_PAYLOAD , PROTO_ENTRY .getPayload ());
172
181
LogEntry logEntry = LogEntry .newBuilder (STRING_PAYLOAD )
@@ -182,6 +191,7 @@ public void testBuilder() {
182
191
.addLabel ("key2" , "value2" )
183
192
.setOperation (OPERATION )
184
193
.setTrace (TRACE )
194
+ .setSpanId (SPAN_ID )
185
195
.setSourceLocation (SOURCE_LOCATION )
186
196
.build ();
187
197
assertEquals (LOG_NAME , logEntry .getLogName ());
@@ -194,6 +204,7 @@ public void testBuilder() {
194
204
assertEquals (LABELS , logEntry .getLabels ());
195
205
assertEquals (OPERATION , logEntry .getOperation ());
196
206
assertEquals (TRACE , logEntry .getTrace ());
207
+ assertEquals (SPAN_ID , logEntry .getSpanId ());
197
208
assertEquals (SOURCE_LOCATION , logEntry .getSourceLocation ());
198
209
assertEquals (StringPayload .of ("otherPayload" ), logEntry .getPayload ());
199
210
}
@@ -219,6 +230,7 @@ public void testToBuilder() {
219
230
.addLabel ("key" , "value" )
220
231
.setOperation (Operation .of ("otherId" , "otherProducer" ))
221
232
.setTrace ("otherTrace" )
233
+ .setSpanId ("otherSpanId" )
222
234
.setSourceLocation (new SourceLocation .Builder ().setFile ("hey.java" ).build ())
223
235
.build ();
224
236
assertEquals ("otherLogName" , logEntry .getLogName ());
@@ -231,6 +243,7 @@ public void testToBuilder() {
231
243
assertEquals (ImmutableMap .of ("key" , "value" ), logEntry .getLabels ());
232
244
assertEquals (Operation .of ("otherId" , "otherProducer" ), logEntry .getOperation ());
233
245
assertEquals ("otherTrace" , logEntry .getTrace ());
246
+ assertEquals ("otherSpanId" , logEntry .getSpanId ());
234
247
assertEquals (new SourceLocation .Builder ().setFile ("hey.java" ).build (),
235
248
logEntry .getSourceLocation ());
236
249
assertEquals (StringPayload .of ("otherPayload" ), logEntry .getPayload ());
@@ -246,6 +259,7 @@ public void testToBuilder() {
246
259
.setLabels (LABELS )
247
260
.setOperation (OPERATION )
248
261
.setTrace (TRACE )
262
+ .setSpanId (SPAN_ID )
249
263
.setSourceLocation (SOURCE_LOCATION )
250
264
.build ();
251
265
compareLogEntry (STRING_ENTRY , logEntry );
@@ -274,6 +288,7 @@ private void compareLogEntry(LogEntry expected, LogEntry value) {
274
288
assertEquals (expected .getLabels (), value .getLabels ());
275
289
assertEquals (expected .getOperation (), value .getOperation ());
276
290
assertEquals (expected .getTrace (), value .getTrace ());
291
+ assertEquals (expected .getSpanId (), value .getSpanId ());
277
292
assertEquals (expected .getSourceLocation (), value .getSourceLocation ());
278
293
assertEquals (expected .getPayload (), value .getPayload ());
279
294
assertEquals (expected .hashCode (), value .hashCode ());
0 commit comments