|
19 | 19 | import com.ibm.mq.headers.pcf.PCFMessage; |
20 | 20 | import com.ibm.mq.headers.pcf.PCFMessageAgent; |
21 | 21 | import io.opentelemetry.api.common.AttributeKey; |
| 22 | +import io.opentelemetry.api.common.Attributes; |
22 | 23 | import io.opentelemetry.api.metrics.Meter; |
23 | 24 | import io.opentelemetry.ibm.mq.config.QueueManager; |
24 | 25 | import io.opentelemetry.ibm.mq.opentelemetry.ConfigWrapper; |
|
32 | 33 | import java.net.URISyntaxException; |
33 | 34 | import java.net.URL; |
34 | 35 | import java.nio.file.Paths; |
| 36 | +import java.util.Collection; |
35 | 37 | import java.util.HashMap; |
36 | 38 | import java.util.HashSet; |
37 | 39 | import java.util.List; |
@@ -300,17 +302,16 @@ void test_bad_connection() throws Exception { |
300 | 302 | assertThat(data).isNotEmpty(); |
301 | 303 | assertThat(data).hasSize(2); |
302 | 304 |
|
303 | | - SumData<LongPointData> connectionErrors = null; |
| 305 | + Attributes attrs = null; |
304 | 306 | for (MetricData metricData : data) { |
305 | 307 | if ("ibm.mq.connection.errors".equals(metricData.getName())) { |
306 | | - connectionErrors = (SumData<LongPointData>) metricData.getData(); |
| 308 | + attrs = metricData.getData().getPoints().stream().iterator().next().getAttributes(); |
307 | 309 | } |
308 | 310 | } |
309 | 311 |
|
310 | | - assertThat(connectionErrors).isNotNull(); |
| 312 | + assertThat(attrs).isNotNull(); |
311 | 313 |
|
312 | | - LongPointData metricPoint = connectionErrors.getPoints().iterator().next(); |
313 | | - String value = metricPoint.getAttributes().get(AttributeKey.stringKey("error.code")); |
| 314 | + String value = attrs.get(AttributeKey.stringKey("error.code")); |
314 | 315 |
|
315 | 316 | assertThat(value).isEqualTo("2538"); |
316 | 317 | } |
|
0 commit comments