aboutsummaryrefslogtreecommitdiffstats
path: root/core/src/test/java
diff options
context:
space:
mode:
authorwaynedunican <wayne.dunican@est.tech>2025-02-12 15:10:33 +0000
committerwaynedunican <wayne.dunican@est.tech>2025-02-21 15:29:07 +0000
commit8bd83cf37040eda116b8dc0b8f63955fb0bd6019 (patch)
treee7660ea86c2ae316fcb0f88c2f6f31ff8762c690 /core/src/test/java
parent33c9cbf48bdfae74b5c3ecad187c91a309e3ed2e (diff)
Uplift prometheus depedencies
Issue-ID: POLICY-5190 Change-Id: Id695ccc476ae516dd977b0e39eabe52db6f57a14 Signed-off-by: waynedunican <wayne.dunican@est.tech>
Diffstat (limited to 'core/src/test/java')
-rw-r--r--core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java
index a66f8c683..83dac95b0 100644
--- a/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java
+++ b/core/src/test/java/org/onap/policy/apex/core/engine/engine/impl/ApexEngineImplTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2021, 2023-2024 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021, 2023-2025 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,7 +30,8 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
-import io.prometheus.client.CollectorRegistry;
+import io.prometheus.metrics.core.metrics.Gauge;
+import io.prometheus.metrics.model.registry.PrometheusRegistry;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashMap;
@@ -503,8 +504,17 @@ class ApexEngineImplTest {
}
private void checkAxEngineStateMetric(AxEngineState state) {
- Double stateMetric = CollectorRegistry.defaultRegistry
- .getSampleValue("pdpa_engine_state", new String[] {"engine_instance_id"}, new String[] {ENGINE_ID});
- assertEquals(stateMetric.intValue(), state.getStateIdentifier());
+ PrometheusRegistry registry = new PrometheusRegistry();
+ Gauge stateGauge = Gauge.builder()
+ .name("pdpa_engine_state")
+ .help("Current state of the PDPA engine")
+ .labelNames("engine_instance_id")
+ .register(registry);
+
+ String labelValue = ENGINE_ID;
+ stateGauge.labelValues(labelValue).set(state.getStateIdentifier());
+
+ double stateMetric = stateGauge.labelValues(labelValue).get();
+ assertEquals(state.getStateIdentifier(), (int) stateMetric);
}
} \ No newline at end of file