diff options
author | 2024-11-04 13:48:17 +0000 | |
---|---|---|
committer | 2024-11-11 10:04:13 +0000 | |
commit | 0c9ac72c3099a4b35834940da122c9708afb56e3 (patch) | |
tree | a247621a164120fb06862515b1e63c7812f35f26 /controlloop/common/feature-controlloop-trans | |
parent | 16f3bbb1eea5106d6ad40f119d4ac606f031f9d8 (diff) |
Fix references and organize dependencies in policy-drools after
splitting policy-endpoints and message-bus in policy-common
Issue-ID: POLICY-5131
Change-Id: Ia10b2e1860c5300fcf4953d105901f920af88576
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'controlloop/common/feature-controlloop-trans')
4 files changed, 26 insertions, 19 deletions
diff --git a/controlloop/common/feature-controlloop-trans/pom.xml b/controlloop/common/feature-controlloop-trans/pom.xml index fb72730fa..9fe73dcff 100644 --- a/controlloop/common/feature-controlloop-trans/pom.xml +++ b/controlloop/common/feature-controlloop-trans/pom.xml @@ -3,7 +3,7 @@ ONAP ================================================================================ Copyright (C) 2018-2021 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019,2023 Nordix Foundation. + Modifications Copyright (C) 2019, 2023-2024 Nordix Foundation. Modifications Copyright (C) 2020 Bell Canada. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -149,5 +149,10 @@ <artifactId>guava</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.awaitility</groupId> + <artifactId>awaitility</artifactId> + <scope>test</scope> + </dependency> </dependencies> </project> diff --git a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java index 26627eb1c..f3235ba43 100644 --- a/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java +++ b/controlloop/common/feature-controlloop-trans/src/main/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeature.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,7 +21,7 @@ package org.onap.policy.drools.apps.controlloop.feature.trans; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; import org.onap.policy.controlloop.VirtualControlLoopNotification; import org.onap.policy.drools.features.PolicyControllerFeatureApi; import org.onap.policy.drools.system.PolicyController; diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java index 164cdb733..a165f35f8 100644 --- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java +++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/apps/controlloop/feature/trans/ControlLoopMetricsFeatureTest.java @@ -36,7 +36,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.controlloop.ControlLoopNotificationType; import org.onap.policy.controlloop.VirtualControlLoopNotification; diff --git a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java index ac73f93dc..19d09e0ca 100644 --- a/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java +++ b/controlloop/common/feature-controlloop-trans/src/test/java/org/onap/policy/drools/server/restful/RestTransactionTrackerTest.java @@ -33,11 +33,11 @@ import java.util.List; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.Topic; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.message.bus.event.Topic; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.controlloop.VirtualControlLoopNotification; @@ -96,14 +96,14 @@ class RestTransactionTrackerTest { equals(get("cacheSize", Response.Status.OK.getStatusCode()), Integer.class, 3); equals(get("timeout", Response.Status.OK.getStatusCode()), Integer.class, 2); - put("cacheSize/10", "", Response.Status.OK.getStatusCode()); - put("timeout/20", "", Response.Status.OK.getStatusCode()); + put("cacheSize/10", Response.Status.OK.getStatusCode()); + put("timeout/20", Response.Status.OK.getStatusCode()); equals(get("cacheSize", Response.Status.OK.getStatusCode()), Integer.class, 10); equals(get("timeout", Response.Status.OK.getStatusCode()), Integer.class, 20); - put("cacheSize/3", "", Response.Status.OK.getStatusCode()); - put("timeout/2", "", Response.Status.OK.getStatusCode()); + put("cacheSize/3", Response.Status.OK.getStatusCode()); + put("timeout/2", Response.Status.OK.getStatusCode()); equals(get("cacheSize", Response.Status.OK.getStatusCode()), Integer.class, 3); equals(get("timeout", Response.Status.OK.getStatusCode()), Integer.class, 2); @@ -127,30 +127,31 @@ class RestTransactionTrackerTest { assertFalse(HttpClient.getBody(get("/inprogress", Response.Status.OK.getStatusCode()), List.class).isEmpty()); - notNull(get("/inprogress/664be3d2-6c12-4f4b-a3e7-c349acced200", Response.Status.OK.getStatusCode()), - String.class); + notNull(get("/inprogress/664be3d2-6c12-4f4b-a3e7-c349acced200", Response.Status.OK.getStatusCode()) + ); } private Response get(String contextPath, int statusCode) { var response = client.get(contextPath); - return checkResponse(statusCode, response); + checkResponse(statusCode, response); + return response; } - private Response put(String contextPath, String body, int statusCode) { - var response = client.put(contextPath, Entity.json(body), Collections.emptyMap()); - return checkResponse(statusCode, response); + private void put(String contextPath, int statusCode) { + var response = client.put(contextPath, Entity.json(""), Collections.emptyMap()); + checkResponse(statusCode, response); + response.close(); } private <T, Y> void equals(Response response, Class<T> clazz, Y expected) { assertEquals(expected, HttpClient.getBody(response, clazz)); } - private <T> void notNull(Response response, Class<T> clazz) { - assertNotNull(HttpClient.getBody(response, clazz)); + private <T> void notNull(Response response) { + assertNotNull(HttpClient.getBody(response, (Class<T>) String.class)); } - private Response checkResponse(int statusCode, Response response) { + private void checkResponse(int statusCode, Response response) { assertEquals(statusCode, response.getStatus()); - return response; } }
\ No newline at end of file |