diff options
Diffstat (limited to 'models-interactions/model-actors')
48 files changed, 463 insertions, 303 deletions
diff --git a/models-interactions/model-actors/actor.a1p/pom.xml b/models-interactions/model-actors/actor.a1p/pom.xml index 347366184..e7cee3afa 100644 --- a/models-interactions/model-actors/actor.a1p/pom.xml +++ b/models-interactions/model-actors/actor.a1p/pom.xml @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation. + Modifications Copyright (C) 2019-2020, 2023-2024 Nordix Foundation. Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -69,7 +69,7 @@ </dependency> <dependency> <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> + <artifactId>message-bus</artifactId> <version>${policy.common.version}</version> <scope>provided</scope> </dependency> diff --git a/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/BasicA1pOperation.java b/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/BasicA1pOperation.java index 6a254a4f1..691674917 100644 --- a/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/BasicA1pOperation.java +++ b/models-interactions/model-actors/actor.a1p/src/test/java/org/onap/policy/controlloop/actor/a1p/BasicA1pOperation.java @@ -30,8 +30,8 @@ import static org.mockito.Mockito.verify; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.function.BiConsumer; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; diff --git a/models-interactions/model-actors/actor.aai/pom.xml b/models-interactions/model-actors/actor.aai/pom.xml index ead914514..0f3d4b551 100644 --- a/models-interactions/model-actors/actor.aai/pom.xml +++ b/models-interactions/model-actors/actor.aai/pom.xml @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation. + Modifications Copyright (C) 2019-2020, 2023-2024 Nordix Foundation. Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -37,36 +37,76 @@ <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actorServiceProvider</artifactId> <version>${project.version}</version> - <scope>provided</scope> </dependency> <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> <artifactId>aai</artifactId> <version>${project.version}</version> - <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>events</artifactId> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actor.test</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.onap.policy.models.policy-models-interactions</groupId> + <artifactId>simulators</artifactId> <version>${project.version}</version> - <scope>provided</scope> + <scope>test</scope> </dependency> <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>policy-endpoints</artifactId> <version>${policy.common.version}</version> - <scope>provided</scope> + <exclusions> + <exclusion> + <groupId>io.opentelemetry</groupId> + <artifactId>opentelemetry-context</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.kafka</groupId> + <artifactId>kafka-clients</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> - <artifactId>actor.test</artifactId> - <version>${project.version}</version> + <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>common-parameters</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>utils</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>utils-test</artifactId> + <version>${policy.common.version}</version> <scope>test</scope> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions</groupId> - <artifactId>simulators</artifactId> - <version>${project.version}</version> + <groupId>jakarta.ws.rs</groupId> + <artifactId>jakarta.ws.rs-api</artifactId> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-junit-jupiter</artifactId> <scope>test</scope> </dependency> </dependencies> diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java index 0f9e2a1c4..1d9fdf1b7 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiCustomQueryOperation.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -31,8 +31,8 @@ import java.util.Map; import java.util.Map.Entry; import java.util.concurrent.CompletableFuture; import org.onap.policy.aai.AaiCqResponse; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; @@ -83,7 +83,7 @@ public class AaiCustomQueryOperation extends HttpOperation<String> { WebTarget web = getClient().getWebTarget().path(path); str.append(path); - web = addQuery(web, str, "?", "format", "resource"); + web = addQuery(web, str); Builder webldr = web.request(); for (Entry<String, Object> header : headers.entrySet()) { @@ -100,13 +100,13 @@ public class AaiCustomQueryOperation extends HttpOperation<String> { return handleResponse(outcome, url, callback -> webldr.async().put(entity, callback)); } - private WebTarget addQuery(WebTarget web, StringBuilder str, String separator, String name, String value) { - str.append(separator); - str.append(name); + private WebTarget addQuery(WebTarget web, StringBuilder str) { + str.append("?"); + str.append("format"); str.append('='); - str.append(value); + str.append("resource"); - return web.queryParam(name, value); + return web.queryParam("format", "resource"); } /** diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java index 519b1428f..fe3b9806d 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetPnfOperation.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -28,8 +28,8 @@ import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.concurrent.CompletableFuture; import org.onap.policy.aai.AaiConstants; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; diff --git a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java index b51004f50..d1a0449e9 100644 --- a/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java +++ b/models-interactions/model-actors/actor.aai/src/main/java/org/onap/policy/controlloop/actor/aai/AaiGetTenantOperation.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -26,8 +26,8 @@ import jakarta.ws.rs.client.WebTarget; import java.util.Map; import java.util.concurrent.CompletableFuture; import org.onap.policy.aai.AaiConstants; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; diff --git a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java index 0b03704e6..b05080bed 100644 --- a/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java +++ b/models-interactions/model-actors/actor.aai/src/test/java/org/onap/policy/controlloop/actor/aai/BasicAaiOperation.java @@ -24,9 +24,9 @@ package org.onap.policy.controlloop.actor.aai; import static org.junit.jupiter.api.Assertions.assertEquals; import java.util.Map; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.simulators.Util; diff --git a/models-interactions/model-actors/actor.appc/pom.xml b/models-interactions/model-actors/actor.appc/pom.xml index 1bf8fe13f..f993e7228 100644 --- a/models-interactions/model-actors/actor.appc/pom.xml +++ b/models-interactions/model-actors/actor.appc/pom.xml @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019, 2023 Nordix Foundation. + Modifications Copyright (C) 2019, 2023-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. @@ -69,7 +69,7 @@ </dependency> <dependency> <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> + <artifactId>message-bus</artifactId> <version>${policy.common.version}</version> <scope>provided</scope> </dependency> diff --git a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java index 45d64db34..6a893122f 100644 --- a/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java +++ b/models-interactions/model-actors/actor.appc/src/test/java/org/onap/policy/controlloop/actor/appc/BasicAppcOperation.java @@ -36,8 +36,8 @@ import org.onap.policy.appc.Request; import org.onap.policy.appc.Response; import org.onap.policy.appc.ResponseCode; import org.onap.policy.appc.ResponseStatus; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.common.utils.coder.StandardCoderInstantAsMillis; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation; diff --git a/models-interactions/model-actors/actor.appclcm/pom.xml b/models-interactions/model-actors/actor.appclcm/pom.xml index 05e7ab9a9..ad8b55110 100644 --- a/models-interactions/model-actors/actor.appclcm/pom.xml +++ b/models-interactions/model-actors/actor.appclcm/pom.xml @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2017-2018, 2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019, 2023 Nordix Foundation. + Modifications Copyright (C) 2019, 2023-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. @@ -68,7 +68,7 @@ </dependency> <dependency> <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> + <artifactId>message-bus</artifactId> <version>${policy.common.version}</version> <scope>provided</scope> </dependency> diff --git a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java index 53677c766..02feae122 100644 --- a/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java +++ b/models-interactions/model-actors/actor.appclcm/src/test/java/org/onap/policy/controlloop/actor/appclcm/AppcLcmOperationTest.java @@ -48,8 +48,8 @@ import org.onap.policy.appclcm.AppcLcmCommonHeader; import org.onap.policy.appclcm.AppcLcmMessageWrapper; import org.onap.policy.appclcm.AppcLcmOutput; import org.onap.policy.appclcm.AppcLcmResponseStatus; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; diff --git a/models-interactions/model-actors/actor.cds/pom.xml b/models-interactions/model-actors/actor.cds/pom.xml index 1c87e72fd..86b487ddd 100644 --- a/models-interactions/model-actors/actor.cds/pom.xml +++ b/models-interactions/model-actors/actor.cds/pom.xml @@ -2,7 +2,7 @@ ============LICENSE_START======================================================= Copyright (C) 2019 Bell Canada. All rights reserved. Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2023 Nordix Foundation. + Modifications Copyright (C) 2023-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. @@ -41,39 +41,64 @@ <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> - <artifactId>actor.aai</artifactId> + <groupId>org.onap.policy.models.policy-models-interactions</groupId> + <artifactId>simulators</artifactId> <version>${project.version}</version> - <scope>provided</scope> + <scope>test</scope> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>events</artifactId> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actor.test</artifactId> <version>${project.version}</version> - <scope>provided</scope> + <scope>test</scope> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions</groupId> - <artifactId>simulators</artifactId> - <version>${project.version}</version> - <scope>test</scope> + <groupId>org.onap.policy.common</groupId> + <artifactId>common-parameters</artifactId> + <version>${policy.common.version}</version> </dependency> <dependency> <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> + <artifactId>utils</artifactId> <version>${policy.common.version}</version> - <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>aai</artifactId> - <version>${project.version}</version> - <scope>provided</scope> + <groupId>org.onap.policy.common</groupId> + <artifactId>utils-test</artifactId> + <version>${policy.common.version}</version> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> - <artifactId>actor.test</artifactId> - <version>${project.version}</version> + <groupId>org.onap.ccsdk.cds.blueprintsprocessor.modules</groupId> + <artifactId>blueprint-proto</artifactId> + </dependency> + <dependency> + <groupId>org.onap.aai.schema-service</groupId> + <artifactId>aai-schema</artifactId> + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </dependency> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java</artifactId> + </dependency> + <dependency> + <groupId>com.google.protobuf</groupId> + <artifactId>protobuf-java-util</artifactId> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-junit-jupiter</artifactId> <scope>test</scope> </dependency> </dependencies> diff --git a/models-interactions/model-actors/actor.sdnc/pom.xml b/models-interactions/model-actors/actor.sdnc/pom.xml index 02100a84a..c8c53918b 100644 --- a/models-interactions/model-actors/actor.sdnc/pom.xml +++ b/models-interactions/model-actors/actor.sdnc/pom.xml @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Huawei Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation. + Modifications Copyright (C) 2019-2020, 2023-2024 Nordix Foundation. Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -64,6 +64,12 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> diff --git a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java index 20e8cd160..b6991c15f 100644 --- a/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/main/java/org/onap/policy/controlloop/actor/sdnc/SdncOperation.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -27,8 +27,8 @@ import jakarta.ws.rs.core.Response; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; diff --git a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java index 5dee02fcb..797bc4bba 100644 --- a/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java +++ b/models-interactions/model-actors/actor.sdnc/src/test/java/org/onap/policy/controlloop/actor/sdnc/BasicSdncOperation.java @@ -23,6 +23,7 @@ package org.onap.policy.controlloop.actor.sdnc; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; @@ -30,11 +31,10 @@ import static org.mockito.Mockito.verify; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; import org.mockito.Mockito; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; @@ -126,7 +126,7 @@ abstract class BasicSdncOperation extends BasicHttpOperation { outcome = future2.get(); assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof SdncResponse); + assertInstanceOf(SdncResponse.class, outcome.getResponse()); assertNotNull(outcome.getSubRequestId()); diff --git a/models-interactions/model-actors/actor.sdnr/pom.xml b/models-interactions/model-actors/actor.sdnr/pom.xml index e06d7a699..12225cc8b 100644 --- a/models-interactions/model-actors/actor.sdnr/pom.xml +++ b/models-interactions/model-actors/actor.sdnr/pom.xml @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019-2020, 2023 Nordix Foundation. + Modifications Copyright (C) 2019-2020, 2023-2024 Nordix Foundation. Modifications Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); @@ -63,7 +63,12 @@ </dependency> <dependency> <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> + <artifactId>capabilities</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</artifactId> <version>${policy.common.version}</version> <scope>provided</scope> </dependency> diff --git a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java index bd67f7fec..d04bcc85e 100644 --- a/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java +++ b/models-interactions/model-actors/actor.sdnr/src/test/java/org/onap/policy/controlloop/actor/sdnr/BasicSdnrOperation.java @@ -29,10 +29,9 @@ import static org.mockito.Mockito.verify; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; -import java.util.concurrent.TimeoutException; import java.util.function.BiConsumer; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.controlloop.actor.test.BasicBidirectionalTopicOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -123,15 +122,14 @@ abstract class BasicSdnrOperation extends BasicBidirectionalTopicOperation<PciMe * * @param listener listener to which to provide the response * @param code response code - * @param description response description */ - protected void provideResponse(BiConsumer<String, StandardCoderObject> listener, int code, String description) { - PciResponse response = new PciResponse(); + protected void provideResponse(BiConsumer<String, StandardCoderObject> listener, int code) { + PciResponse pciResponse = new PciResponse(); Status status = new Status(); - response.setStatus(status); + pciResponse.setStatus(status); status.setCode(code); - provideResponse(listener, Util.translate("", response, String.class)); + provideResponse(listener, Util.translate("", pciResponse, String.class)); } } diff --git a/models-interactions/model-actors/actor.so/pom.xml b/models-interactions/model-actors/actor.so/pom.xml index d95b456a0..31984cde5 100644 --- a/models-interactions/model-actors/actor.so/pom.xml +++ b/models-interactions/model-actors/actor.so/pom.xml @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2017-2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2019, 2023 Nordix Foundation. + Modifications Copyright (C) 2019, 2023-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. @@ -68,6 +68,12 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java index 8b56dee73..0744786c1 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyCll.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2022 CTC, Inc. and others. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -26,8 +26,8 @@ import jakarta.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import org.onap.policy.common.endpoints.event.comm.Topic; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil; +import org.onap.policy.common.message.bus.event.Topic; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java index ff315a9a4..01fd5329c 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/ModifyNssi.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2020 Wipro Limited. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -27,8 +27,8 @@ import jakarta.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import org.onap.policy.common.endpoints.event.comm.Topic; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil; +import org.onap.policy.common.message.bus.event.Topic; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java index a51be00ad..65b95cb2e 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleCreate.java @@ -4,7 +4,7 @@ * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2020 Wipro Limited. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -30,8 +30,8 @@ import java.util.Map; import java.util.concurrent.CompletableFuture; import org.apache.commons.lang3.tuple.Pair; import org.onap.aai.domain.yang.ModelVer; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; diff --git a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java index 4ef0a7ba9..0fa785554 100644 --- a/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java +++ b/models-interactions/model-actors/actor.so/src/main/java/org/onap/policy/controlloop/actor/so/VfModuleDelete.java @@ -39,9 +39,9 @@ import java.util.Map.Entry; import java.util.concurrent.CompletableFuture; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.Pair; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.http.client.HttpClient; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationProperties; import org.onap.policy.controlloop.actorserviceprovider.parameters.ControlLoopOperationParams; @@ -102,7 +102,7 @@ public class VfModuleDelete extends SoOperation { // @formatter:off return handleResponse(outcome, url, - callback -> delete(url, headers, MediaType.APPLICATION_JSON, strRequest, callback)); + callback -> delete(url, headers, strRequest, callback)); // @formatter:on } @@ -111,21 +111,20 @@ public class VfModuleDelete extends SoOperation { * HttpClient, as the JerseyClient does not support it. This will add the content-type * and authorization headers, so they should not be included within "headers". * - * @param uri URI suffix, to be appended to the URI prefix - * @param headers headers to be included - * @param contentType content type of the request - * @param request request to be posted + * @param uri URI suffix, to be appended to the URI prefix + * @param headers headers to be included + * @param request request to be posted * @param callback response callbacks * @return a future to await the response. Note: it's untested whether canceling this * future will actually cancel the underlying HTTP request */ - protected CompletableFuture<Response> delete(String uri, Map<String, Object> headers, String contentType, - String request, InvocationCallback<Response> callback) { + protected CompletableFuture<Response> delete(String uri, Map<String, Object> headers, + String request, InvocationCallback<Response> callback) { final String url = getClient().getBaseUrl() + uri; var builder = HttpRequest.newBuilder(URI.create(url)); - builder = builder.header("Content-type", contentType); + builder = builder.header("Content-type", MediaType.APPLICATION_JSON); builder = addAuthHeader(builder); for (Entry<String, Object> header : headers.entrySet()) { diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java index 286ed3ce4..b74e1bd9f 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/BasicSoOperation.java @@ -29,9 +29,9 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; import org.mockito.Mock; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.TargetType; import org.onap.policy.controlloop.actorserviceprovider.Util; @@ -167,9 +167,9 @@ abstract class BasicSoOperation extends BasicHttpOperation { payload.put(SoOperation.REQ_PARAM_NM, Util.translate("", reqParams, String.class)); // config parameters - List<Map<String, String>> config = new LinkedList<>(); - config.add(Collections.emptyMap()); - payload.put(SoOperation.CONFIG_PARAM_NM, Util.translate("", config, String.class)); + List<Map<String, String>> configLinkedList = new LinkedList<>(); + configLinkedList.add(Collections.emptyMap()); + payload.put(SoOperation.CONFIG_PARAM_NM, Util.translate("", configLinkedList, String.class)); return payload; } diff --git a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java index 208db3f57..16df58264 100644 --- a/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java +++ b/models-interactions/model-actors/actor.so/src/test/java/org/onap/policy/controlloop/actor/so/VfModuleDeleteTest.java @@ -248,7 +248,7 @@ class VfModuleDeleteTest extends BasicSoOperation { String reqText = oper.prettyPrint(req); final CompletableFuture<Response> delFuture = - oper.delete("my-uri", headers, MediaType.APPLICATION_JSON, reqText, callback); + oper.delete("my-uri", headers, reqText, callback); ArgumentCaptor<HttpRequest> reqCaptor = ArgumentCaptor.forClass(HttpRequest.class); verify(javaClient).sendAsync(reqCaptor.capture(), any()); @@ -290,7 +290,7 @@ class VfModuleDeleteTest extends BasicSoOperation { String reqText = oper.prettyPrint(req); CompletableFuture<Response> delFuture = - oper.delete("/my-uri", Map.of(), MediaType.APPLICATION_JSON, reqText, callback); + oper.delete("/my-uri", Map.of(), reqText, callback); assertTrue(delFuture.isCompletedExceptionally()); diff --git a/models-interactions/model-actors/actor.test/pom.xml b/models-interactions/model-actors/actor.test/pom.xml index 1cfe6a1ae..56a22a091 100644 --- a/models-interactions/model-actors/actor.test/pom.xml +++ b/models-interactions/model-actors/actor.test/pom.xml @@ -2,7 +2,7 @@ <!-- ============LICENSE_START======================================================= Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2023 Nordix Foundation. + Modifications Copyright (C) 2023-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. @@ -34,25 +34,34 @@ <dependencies> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>aai</artifactId> + <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> + <artifactId>actorServiceProvider</artifactId> <version>${project.version}</version> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>events</artifactId> - <version>${project.version}</version> + <groupId>org.onap.policy.common</groupId> + <artifactId>common-parameters</artifactId> + <version>${policy.common.version}</version> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> - <artifactId>actorServiceProvider</artifactId> - <version>${project.version}</version> + <groupId>org.onap.policy.common</groupId> + <artifactId>policy-endpoints</artifactId> + <version>${policy.common.version}</version> + <exclusions> + <exclusion> + <groupId>io.opentelemetry</groupId> + <artifactId>opentelemetry-context</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.kafka</groupId> + <artifactId>kafka-clients</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> <groupId>org.onap.policy.common</groupId> - <artifactId>policy-endpoints</artifactId> + <artifactId>message-bus</artifactId> <version>${policy.common.version}</version> - <scope>provided</scope> </dependency> <dependency> <groupId>org.onap.policy.models.policy-models-interactions</groupId> @@ -65,6 +74,14 @@ <version>${policy.common.version}</version> </dependency> <dependency> + <groupId>jakarta.ws.rs</groupId> + <artifactId>jakarta.ws.rs-api</artifactId> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </dependency> + <dependency> <groupId>org.mockito</groupId> <artifactId>mockito-core</artifactId> <scope>compile</scope> diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java index cce4da420..d4457e0cd 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicActor.java @@ -28,14 +28,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.FileNotFoundException; import java.util.Map; import lombok.Getter; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientConfigException; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; -import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.common.parameters.BeanValidator; import org.onap.policy.common.parameters.annotations.NotNull; +import org.onap.policy.common.parameters.topic.BusTopicParams; +import org.onap.policy.common.parameters.topic.TopicParameterGroup; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardYamlCoder; diff --git a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java index 3f339d011..420cce847 100644 --- a/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java +++ b/models-interactions/model-actors/actor.test/src/main/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperation.java @@ -32,13 +32,13 @@ import lombok.NoArgsConstructor; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; -import org.onap.policy.common.endpoints.event.comm.client.BidirectionalTopicClientException; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; -import org.onap.policy.common.endpoints.parameters.TopicParameters; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; +import org.onap.policy.common.message.bus.event.client.BidirectionalTopicClientException; +import org.onap.policy.common.parameters.topic.TopicParameters; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicConfig; diff --git a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java index 0d04e5894..bfdc245a4 100644 --- a/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actor.test/src/test/java/org/onap/policy/controlloop/actor/test/BasicBidirectionalTopicOperationTest.java @@ -39,8 +39,8 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.simulators.TopicServer; diff --git a/models-interactions/model-actors/actor.vfc/pom.xml b/models-interactions/model-actors/actor.vfc/pom.xml index eec1af96c..e5397123e 100644 --- a/models-interactions/model-actors/actor.vfc/pom.xml +++ b/models-interactions/model-actors/actor.vfc/pom.xml @@ -74,6 +74,12 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> diff --git a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java index 945acabd6..c8fe20b83 100644 --- a/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java +++ b/models-interactions/model-actors/actor.vfc/src/test/java/org/onap/policy/controlloop/actor/vfc/BasicVfcOperation.java @@ -24,9 +24,9 @@ package org.onap.policy.controlloop.actor.vfc; import static org.mockito.Mockito.lenient; import org.mockito.Mock; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.parameters.HttpPollingConfig; import org.onap.policy.simulators.Util; diff --git a/models-interactions/model-actors/actor.xacml/pom.xml b/models-interactions/model-actors/actor.xacml/pom.xml index cedbd958e..ff257c0ad 100644 --- a/models-interactions/model-actors/actor.xacml/pom.xml +++ b/models-interactions/model-actors/actor.xacml/pom.xml @@ -4,7 +4,7 @@ ONAP ================================================================================ Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2023 Nordix Foundation. + Modifications Copyright (C) 2023-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. @@ -59,6 +59,12 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> + </dependency> + <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-actors</groupId> <artifactId>actor.test</artifactId> <version>${project.version}</version> diff --git a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java index a490def86..f43d892cb 100644 --- a/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java +++ b/models-interactions/model-actors/actor.xacml/src/main/java/org/onap/policy/controlloop/actor/xacml/DecisionOperation.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -26,8 +26,8 @@ import jakarta.ws.rs.core.MediaType; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.controlloop.actorserviceprovider.CallbackManager; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.impl.HttpOperation; diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperationTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperationTest.java index 3dba20162..1ac60d22a 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperationTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/ConfigureOperationTest.java @@ -37,9 +37,9 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; @@ -47,7 +47,7 @@ import org.onap.policy.models.decisions.concepts.DecisionRequest; import org.onap.policy.models.decisions.concepts.DecisionResponse; @ExtendWith(MockitoExtension.class) - class ConfigureOperationTest extends BasicHttpOperation { +class ConfigureOperationTest extends BasicHttpOperation { @Mock private Consumer<OperationOutcome> started; @@ -61,17 +61,17 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; * Starts the simulator. */ @BeforeAll - static void setUpBeforeClass() throws Exception { + static void setUpBeforeClass() throws Exception { org.onap.policy.simulators.Util.buildXacmlSim(); BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("policy/pdpx/v1/") - .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) - .build(); + .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) + .build(); HttpClientFactoryInstance.getClientFactory().build(clientParams); } @AfterAll - static void tearDownAfterClass() { + static void tearDownAfterClass() { HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); } @@ -80,7 +80,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; * Sets up. */ @BeforeEach - void setUp() { + void setUp() { super.setUpBasic(); operConfig = mock(DecisionConfig.class); @@ -102,7 +102,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; } @Test - void testConstructor() { + void testConstructor() { assertEquals(DEFAULT_ACTOR, oper.getActorName()); assertEquals(DEFAULT_OPERATION, oper.getName()); } @@ -111,13 +111,13 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; * Tests "success" case with simulator. */ @Test - void testSuccess() throws Exception { + void testSuccess() throws Exception { DecisionParams opParams = - DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("configure").build(); + DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("configure").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().payload(Map.of("policy-id", "test-policy")).retry(0).timeoutSec(5) - .executor(blockingExecutor).build(); + .executor(blockingExecutor).build(); oper = new ConfigureOperation(params, config); outcome = oper.start().get(); @@ -133,13 +133,13 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; * Tests "failure" case with simulator. */ @Test - void testFailure() throws Exception { + void testFailure() throws Exception { DecisionParams opParams = - DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("configure").build(); + DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("configure").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().payload(Map.of("policy-id", "nonexistent")).retry(0).timeoutSec(5) - .executor(blockingExecutor).build(); + .executor(blockingExecutor).build(); oper = new ConfigureOperation(params, config); outcome = oper.start().get(); diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java index fa81836f3..bba06c840 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/DecisionOperationTest.java @@ -46,9 +46,9 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; @@ -60,7 +60,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; import org.onap.policy.simulators.XacmlSimulatorJaxRs; @ExtendWith(MockitoExtension.class) - class DecisionOperationTest extends BasicHttpOperation { +class DecisionOperationTest extends BasicHttpOperation { private static final List<String> PROPERTY_NAMES = List.of("prop-A", "prop-B"); @Mock @@ -75,17 +75,17 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Starts the simulator. */ @BeforeAll - static void setUpBeforeClass() throws Exception { + static void setUpBeforeClass() throws Exception { org.onap.policy.simulators.Util.buildXacmlSim(); BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("policy/pdpx/v1/") - .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) - .build(); + .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) + .build(); HttpClientFactoryInstance.getClientFactory().build(clientParams); } @AfterAll - static void tearDownAfterClass() { + static void tearDownAfterClass() { HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); } @@ -94,7 +94,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Sets up. */ @BeforeEach - void setUp() { + void setUp() { super.setUpBasic(); guardConfig = mock(DecisionConfig.class); @@ -119,12 +119,12 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Tests with simulator. */ @Test - void testSimulator() throws Exception { + void testSimulator() throws Exception { DecisionParams opParams = DecisionParams.builder().clientName(MY_CLIENT).path("decision").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor) - .payload(Map.of("clname", XacmlSimulatorJaxRs.DENY_CLNAME)).build(); + .payload(Map.of("clname", XacmlSimulatorJaxRs.DENY_CLNAME)).build(); oper = new MyOper(params, config); outcome = oper.start().get(); @@ -133,18 +133,18 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; } @Test - void testConstructor() { + void testConstructor() { assertEquals(DEFAULT_ACTOR, oper.getActorName()); assertEquals(DEFAULT_OPERATION, oper.getName()); } @Test - void testGetPropertyNames() { + void testGetPropertyNames() { assertThat(oper.getPropertyNames()).isEqualTo(PROPERTY_NAMES); } @Test - void testStartOperationAsync() throws Exception { + void testStartOperationAsync() throws Exception { CompletableFuture<OperationOutcome> future2 = oper.start(); executor.runAll(100); assertFalse(future2.isDone()); @@ -171,7 +171,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Tests startOperationAsync() when the guard is disabled. */ @Test - void testStartOperationAsyncDisabled() throws Exception { + void testStartOperationAsyncDisabled() throws Exception { // indicate that it's disabled when(guardConfig.isDisabled()).thenReturn(true); diff --git a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java index f8b53e8f8..f08c3b884 100644 --- a/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java +++ b/models-interactions/model-actors/actor.xacml/src/test/java/org/onap/policy/controlloop/actor/xacml/GuardOperationTest.java @@ -40,9 +40,9 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.actor.test.BasicHttpOperation; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; @@ -52,7 +52,7 @@ import org.onap.policy.models.decisions.concepts.DecisionResponse; import org.onap.policy.simulators.XacmlSimulatorJaxRs; @ExtendWith(MockitoExtension.class) - class GuardOperationTest extends BasicHttpOperation { +class GuardOperationTest extends BasicHttpOperation { @Mock private Consumer<OperationOutcome> started; @@ -66,17 +66,17 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Starts the simulator. */ @BeforeAll - static void setUpBeforeClass() throws Exception { + static void setUpBeforeClass() throws Exception { org.onap.policy.simulators.Util.buildXacmlSim(); BusTopicParams clientParams = BusTopicParams.builder().clientName(MY_CLIENT).basePath("policy/pdpx/v1/") - .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) - .build(); + .hostname("localhost").managed(true).port(org.onap.policy.simulators.Util.XACMLSIM_SERVER_PORT) + .build(); HttpClientFactoryInstance.getClientFactory().build(clientParams); } @AfterAll - static void tearDownAfterClass() { + static void tearDownAfterClass() { HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); } @@ -85,7 +85,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Sets up. */ @BeforeEach - void setUp() { + void setUp() { super.setUpBasic(); guardConfig = mock(DecisionConfig.class); @@ -110,9 +110,9 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Tests "success" case with simulator. */ @Test - void testSuccess() throws Exception { + void testSuccess() throws Exception { DecisionParams opParams = - DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("guard").build(); + DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("guard").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor).build(); @@ -127,13 +127,13 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; * Tests "failure" case with simulator. */ @Test - void testFailure() throws Exception { + void testFailure() throws Exception { DecisionParams opParams = - DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("guard").build(); + DecisionParams.builder().clientName(MY_CLIENT).path("decision").action("guard").build(); config = new DecisionConfig(blockingExecutor, opParams, HttpClientFactoryInstance.getClientFactory()); params = params.toBuilder().retry(0).timeoutSec(5).executor(blockingExecutor) - .payload(Map.of("clname", XacmlSimulatorJaxRs.DENY_CLNAME)).build(); + .payload(Map.of("clname", XacmlSimulatorJaxRs.DENY_CLNAME)).build(); oper = new GuardOperation(params, config); outcome = oper.start().get(); @@ -142,18 +142,18 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; } @Test - void testConstructor() { + void testConstructor() { assertEquals(DEFAULT_ACTOR, oper.getActorName()); assertEquals(DEFAULT_OPERATION, oper.getName()); } @Test - void testGetPropertyNames() { + void testGetPropertyNames() { assertThat(oper.getPropertyNames()).isEmpty(); } @Test - void testMakeRequest() throws CoderException { + void testMakeRequest() throws CoderException { oper.generateSubRequestId(2); verifyPayload("makeReqStd.json", makePayload()); @@ -182,7 +182,7 @@ import org.onap.policy.simulators.XacmlSimulatorJaxRs; } @Test - void testPostProcessResponse() { + void testPostProcessResponse() { DecisionResponse response = new DecisionResponse(); // null status diff --git a/models-interactions/model-actors/actorServiceProvider/pom.xml b/models-interactions/model-actors/actorServiceProvider/pom.xml index 68042f2f4..f139178a0 100644 --- a/models-interactions/model-actors/actorServiceProvider/pom.xml +++ b/models-interactions/model-actors/actorServiceProvider/pom.xml @@ -34,26 +34,78 @@ <dependencies> <dependency> <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>aai</artifactId> + <artifactId>events</artifactId> <version>${project.version}</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId> - <artifactId>events</artifactId> - <version>${project.version}</version> + <groupId>org.onap.policy.common</groupId> + <artifactId>capabilities</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>common-parameters</artifactId> + <version>${policy.common.version}</version> <scope>provided</scope> </dependency> <dependency> <groupId>org.onap.policy.common</groupId> + <artifactId>gson</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>utils</artifactId> + <version>${policy.common.version}</version> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> <artifactId>policy-endpoints</artifactId> <version>${policy.common.version}</version> <scope>provided</scope> + <exclusions> + <exclusion> + <groupId>io.opentelemetry</groupId> + <artifactId>opentelemetry-context</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.kafka</groupId> + <artifactId>kafka-clients</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</artifactId> + <version>${policy.common.version}</version> + <scope>provided</scope> </dependency> <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>utils-test</artifactId> <version>${policy.common.version}</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-core</artifactId> + </dependency> + <dependency> + <groupId>jakarta.ws.rs</groupId> + <artifactId>jakarta.ws.rs-api</artifactId> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> </dependency> <dependency> <groupId>org.mockito</groupId> diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActor.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActor.java index 564bbc346..689622d60 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActor.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActor.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 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. @@ -24,7 +25,7 @@ import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.function.Function; import org.apache.commons.lang3.tuple.Pair; -import org.onap.policy.common.endpoints.event.comm.client.BidirectionalTopicClientException; +import org.onap.policy.common.message.bus.event.client.BidirectionalTopicClientException; import org.onap.policy.controlloop.actorserviceprovider.Util; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicActorParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicParams; diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java index 8f2199f05..7b87e2534 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperation.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 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. @@ -24,7 +25,7 @@ import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.function.BiConsumer; import lombok.Getter; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java index 1e11bce4c..90dfdb91b 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperation.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2023 Nordix Foundation. + * Modifications Copyright (C) 2023-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. @@ -31,10 +31,10 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import java.util.function.Function; import lombok.Getter; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.http.client.HttpClient; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java index c19ad6c31..90ac49cb4 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartial.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020-2022 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. @@ -42,9 +43,9 @@ import java.util.function.UnaryOperator; import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/BidirectionalTopicHandler.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/BidirectionalTopicHandler.java index 30ee1e2d0..6ee9059e0 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/BidirectionalTopicHandler.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/BidirectionalTopicHandler.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 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. @@ -21,8 +22,8 @@ package org.onap.policy.controlloop.actorserviceprovider.topic; import java.util.List; -import org.onap.policy.common.endpoints.event.comm.client.BidirectionalTopicClient; -import org.onap.policy.common.endpoints.event.comm.client.BidirectionalTopicClientException; +import org.onap.policy.common.message.bus.event.client.BidirectionalTopicClient; +import org.onap.policy.common.message.bus.event.client.BidirectionalTopicClientException; /** * Handler for a bidirectional topic, supporting both publishing and forwarding of diff --git a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/TopicListenerImpl.java b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/TopicListenerImpl.java index 93beab1cb..95b0ab7ed 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/TopicListenerImpl.java +++ b/models-interactions/model-actors/actorServiceProvider/src/main/java/org/onap/policy/controlloop/actorserviceprovider/topic/TopicListenerImpl.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2020 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. @@ -24,8 +25,8 @@ import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.event.comm.TopicListener; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.TopicListener; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.coder.StandardCoderObject; @@ -33,7 +34,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * A topic listener. When a message arrives on a topic, it is forwarded to listeners based + * A topic listener. When a message arrives at a topic, it is forwarded to listeners based * on the content of fields found within the message. However, depending on the message * type, the relevant fields might be found in different places within the message's * object hierarchy. For each different list of keys, this class maintains a diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java index 7e4543eca..8f0b42baf 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicActorTest.java @@ -42,8 +42,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.client.BidirectionalTopicClientException; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.client.BidirectionalTopicClientException; import org.onap.policy.controlloop.actorserviceprovider.Util; import org.onap.policy.controlloop.actorserviceprovider.parameters.BidirectionalTopicActorParams; import org.onap.policy.controlloop.actorserviceprovider.parameters.ParameterValidationRuntimeException; diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java index 67283f5d4..bb2d7f9a0 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/BidirectionalTopicOperationTest.java @@ -35,7 +35,6 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.concurrent.CompletableFuture; @@ -51,7 +50,7 @@ import org.mockito.Captor; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -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.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -142,7 +141,7 @@ class BidirectionalTopicOperationTest { CompletableFuture<OperationOutcome> future = oper.startOperationAsync(1, outcome); assertFalse(future.isDone()); - verify(forwarder).register(eq(Arrays.asList(REQ_ID)), listenerCaptor.capture()); + verify(forwarder).register(eq(List.of(REQ_ID)), listenerCaptor.capture()); verify(forwarder, never()).unregister(any(), any()); @@ -167,7 +166,7 @@ class BidirectionalTopicOperationTest { assertEquals(OperationResult.SUCCESS, outcome.getResult()); assertEquals(response, outcome.getResponse()); - verify(forwarder).unregister(Arrays.asList(REQ_ID), listenerCaptor.getValue()); + verify(forwarder).unregister(List.of(REQ_ID), listenerCaptor.getValue()); } /** @@ -186,7 +185,7 @@ class BidirectionalTopicOperationTest { CompletableFuture<OperationOutcome> future = oper.startOperationAsync(1, outcome); assertFalse(future.isDone()); - verify(forwarder).register(eq(Arrays.asList(REQ_ID)), listenerCaptor.capture()); + verify(forwarder).register(eq(List.of(REQ_ID)), listenerCaptor.capture()); verify(forwarder, never()).unregister(any(), any()); @@ -195,7 +194,7 @@ class BidirectionalTopicOperationTest { assertTrue(executor.runAll(MAX_REQUESTS)); assertTrue(future.isCompletedExceptionally()); - verify(forwarder).unregister(Arrays.asList(REQ_ID), listenerCaptor.getValue()); + verify(forwarder).unregister(List.of(REQ_ID), listenerCaptor.getValue()); } /** @@ -208,10 +207,10 @@ class BidirectionalTopicOperationTest { assertThatIllegalStateException().isThrownBy(() -> oper.startOperationAsync(1, outcome)); - verify(forwarder).register(eq(Arrays.asList(REQ_ID)), listenerCaptor.capture()); + verify(forwarder).register(eq(List.of(REQ_ID)), listenerCaptor.capture()); // must still unregister - verify(forwarder).unregister(Arrays.asList(REQ_ID), listenerCaptor.getValue()); + verify(forwarder).unregister(List.of(REQ_ID), listenerCaptor.getValue()); } @Test @@ -360,7 +359,7 @@ class BidirectionalTopicOperationTest { } - private class MyStringOperation extends BidirectionalTopicOperation<String, String> { + private static class MyStringOperation extends BidirectionalTopicOperation<String, String> { MyStringOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config) { super(params, config, String.class, Collections.emptyList()); @@ -373,7 +372,7 @@ class BidirectionalTopicOperationTest { @Override protected List<String> getExpectedKeyValues(int attempt, String request) { - return Arrays.asList(REQ_ID); + return List.of(REQ_ID); } @Override @@ -383,7 +382,7 @@ class BidirectionalTopicOperationTest { } - private class MyScoOperation extends BidirectionalTopicOperation<MyRequest, StandardCoderObject> { + private static class MyScoOperation extends BidirectionalTopicOperation<MyRequest, StandardCoderObject> { MyScoOperation(ControlLoopOperationParams params, BidirectionalTopicConfig config) { super(params, config, StandardCoderObject.class, Collections.emptyList()); } @@ -395,7 +394,7 @@ class BidirectionalTopicOperationTest { @Override protected List<String> getExpectedKeyValues(int attempt, MyRequest request) { - return Arrays.asList(REQ_ID); + return List.of(REQ_ID); } @Override @@ -417,7 +416,7 @@ class BidirectionalTopicOperationTest { @Override protected List<String> getExpectedKeyValues(int attempt, MyRequest request) { - return Arrays.asList(REQ_ID); + return List.of(REQ_ID); } @Override diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java index 8e1a8783a..c64903d5e 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/HttpOperationTest.java @@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -68,18 +69,17 @@ import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams.TopicParamsBuilder; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactory; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; import org.onap.policy.common.gson.GsonMessageBodyHandler; -import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.parameters.topic.BusTopicParams; +import org.onap.policy.common.parameters.topic.BusTopicParams.TopicParamsBuilder; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.controlloop.actorserviceprovider.OperationOutcome; import org.onap.policy.controlloop.actorserviceprovider.OperationResult; @@ -122,8 +122,8 @@ class HttpOperationTest { @Mock private Executor executor; - private ControlLoopOperationParams params; - private OperationOutcome outcome; + private ControlLoopOperationParams operationParams; + private OperationOutcome operationOutcome; private AtomicReference<InvocationCallback<Response>> callback; private Future<Response> future; private HttpConfig config; @@ -133,7 +133,7 @@ class HttpOperationTest { * Starts the simulator. */ @BeforeAll - void setUpBeforeClass() throws Exception { + void setUpBeforeClass() throws Exception { // allocate a port int port = NetworkUtil.allocPort(); @@ -141,7 +141,7 @@ class HttpOperationTest { * Start the simulator. Must use "Properties" to configure it, otherwise the * server will use the wrong serialization provider. */ - Properties svrprops = getServerProperties("my-server", port); + Properties svrprops = getServerProperties(port); HttpServletServerFactoryInstance.getServerFactory().build(svrprops).forEach(HttpServletServer::start); if (!NetworkUtil.isTcpPortOpen("localhost", port, 100, 100)) { @@ -157,14 +157,14 @@ class HttpOperationTest { HttpClientFactoryInstance.getClientFactory().build(builder.clientName(HTTP_CLIENT).port(port).build()); HttpClientFactoryInstance.getClientFactory() - .build(builder.clientName(HTTP_NO_SERVER).port(NetworkUtil.allocPort()).build()); + .build(builder.clientName(HTTP_NO_SERVER).port(NetworkUtil.allocPort()).build()); } /** * Destroys the Http factories and stops the appender. */ @AfterAll - static void tearDownAfterClass() { + static void tearDownAfterClass() { HttpClientFactoryInstance.getClientFactory().destroy(); HttpServletServerFactoryInstance.getServerFactory().destroy(); } @@ -174,7 +174,7 @@ class HttpOperationTest { * the REST server. */ @BeforeEach - void setUp() { + void setUp() { rejectRequest = false; nget = 0; npost = 0; @@ -184,41 +184,42 @@ class HttpOperationTest { Mockito.lenient().when(response.readEntity(String.class)).thenReturn(TEXT); Mockito.lenient().when(response.getStatus()).thenReturn(200); - params = ControlLoopOperationParams.builder().actor(ACTOR).operation(OPERATION).requestId(REQ_ID).build(); + operationParams = ControlLoopOperationParams.builder().actor(ACTOR) + .operation(OPERATION).requestId(REQ_ID).build(); - outcome = params.makeOutcome(); + operationOutcome = operationParams.makeOutcome(); callback = new AtomicReference<>(); future = new CompletableFuture<>(); Mockito.lenient().when(clientFactory.get(any())).thenReturn(client); - initConfig(HTTP_CLIENT); + initConfig(); oper = new MyGetOperation<>(String.class); } @Test - void testHttpOperator() { + void testHttpOperator() { assertEquals(ACTOR, oper.getActorName()); assertEquals(OPERATION, oper.getName()); assertEquals(ACTOR + "." + OPERATION, oper.getFullName()); } @Test - void testMakeHeaders() { + void testMakeHeaders() { assertEquals(Collections.emptyMap(), oper.makeHeaders()); } @Test - void testGetPath() { + void testGetPath() { assertEquals(PATH, oper.getPath()); } @Test - void testMakeUrl() { + void testMakeUrl() { // use a real client - initRealConfig(HTTP_CLIENT); + initRealConfig(); oper = new MyGetOperation<>(String.class); @@ -226,7 +227,7 @@ class HttpOperationTest { } @Test - void testDoConfigureMapOfStringObject_testGetClient_testGetPath_testGetTimeoutMs() { + void testDoConfigureMapOfStringObject_testGetClient_testGetPath_testGetTimeoutMs() { // use value from operator assertEquals(1000L, oper.getTimeoutMs(null)); @@ -240,8 +241,8 @@ class HttpOperationTest { * Tests handleResponse() when it completes. */ @Test - void testHandleResponseComplete() throws Exception { - CompletableFuture<OperationOutcome> future2 = oper.handleResponse(outcome, PATH, cb -> { + void testHandleResponseComplete() throws Exception { + CompletableFuture<OperationOutcome> future2 = oper.handleResponse(operationOutcome, PATH, cb -> { callback.set(cb); return future; }); @@ -250,18 +251,18 @@ class HttpOperationTest { assertNotNull(callback.get()); callback.get().completed(response); - assertSame(outcome, future2.get(5, TimeUnit.SECONDS)); - assertSame(TEXT, outcome.getResponse()); + assertSame(operationOutcome, future2.get(5, TimeUnit.SECONDS)); + assertSame(TEXT, operationOutcome.getResponse()); - assertEquals(OperationResult.SUCCESS, outcome.getResult()); + assertEquals(OperationResult.SUCCESS, operationOutcome.getResult()); } /** * Tests handleResponse() when it fails. */ @Test - void testHandleResponseFailed() { - CompletableFuture<OperationOutcome> future2 = oper.handleResponse(outcome, PATH, cb -> { + void testHandleResponseFailed() { + CompletableFuture<OperationOutcome> future2 = oper.handleResponse(operationOutcome, PATH, cb -> { callback.set(cb); return future; }); @@ -282,11 +283,11 @@ class HttpOperationTest { */ @Test void testProcessResponseSuccessString() throws Exception { - CompletableFuture<OperationOutcome> result = oper.processResponse(outcome, PATH, response); + CompletableFuture<OperationOutcome> result = oper.processResponse(operationOutcome, PATH, response); assertTrue(result.isDone()); - assertSame(outcome, result.get()); - assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertSame(TEXT, outcome.getResponse()); + assertSame(operationOutcome, result.get()); + assertEquals(OperationResult.SUCCESS, operationOutcome.getResult()); + assertSame(TEXT, operationOutcome.getResponse()); } /** @@ -295,11 +296,11 @@ class HttpOperationTest { @Test void testProcessResponseFailure() throws Exception { when(response.getStatus()).thenReturn(555); - CompletableFuture<OperationOutcome> result = oper.processResponse(outcome, PATH, response); + CompletableFuture<OperationOutcome> result = oper.processResponse(operationOutcome, PATH, response); assertTrue(result.isDone()); - assertSame(outcome, result.get()); - assertEquals(OperationResult.FAILURE, outcome.getResult()); - assertSame(TEXT, outcome.getResponse()); + assertSame(operationOutcome, result.get()); + assertEquals(OperationResult.FAILURE, operationOutcome.getResult()); + assertSame(TEXT, operationOutcome.getResponse()); } /** @@ -311,11 +312,11 @@ class HttpOperationTest { MyGetOperation<Integer> oper2 = new MyGetOperation<>(Integer.class); - CompletableFuture<OperationOutcome> result = oper2.processResponse(outcome, PATH, response); + CompletableFuture<OperationOutcome> result = oper2.processResponse(operationOutcome, PATH, response); assertTrue(result.isDone()); - assertSame(outcome, result.get()); - assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertEquals(Integer.valueOf(10), outcome.getResponse()); + assertSame(operationOutcome, result.get()); + assertEquals(OperationResult.SUCCESS, operationOutcome.getResult()); + assertEquals(Integer.valueOf(10), operationOutcome.getResponse()); } /** @@ -325,12 +326,12 @@ class HttpOperationTest { void testProcessResponseDecodeExcept() { MyGetOperation<Integer> oper2 = new MyGetOperation<>(Integer.class); - assertThatIllegalArgumentException().isThrownBy(() -> oper2.processResponse(outcome, PATH, response)); + assertThatIllegalArgumentException().isThrownBy(() -> oper2.processResponse(operationOutcome, PATH, response)); } @Test void testPostProcessResponse() { - assertThatCode(() -> oper.postProcessResponse(outcome, PATH, null, null)).doesNotThrowAnyException(); + assertThatCode(() -> oper.postProcessResponse(operationOutcome, PATH, null, null)).doesNotThrowAnyException(); } @Test @@ -348,7 +349,7 @@ class HttpOperationTest { @Test void testGet() throws Exception { // use a real client - initRealConfig(HTTP_CLIENT); + initRealConfig(); MyGetOperation<MyResponse> oper2 = new MyGetOperation<>(MyResponse.class); @@ -356,7 +357,7 @@ class HttpOperationTest { assertNotNull(outcome); assertEquals(1, nget); assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof MyResponse); + assertInstanceOf(MyResponse.class, outcome.getResponse()); } /** @@ -365,7 +366,7 @@ class HttpOperationTest { @Test void testDelete() throws Exception { // use a real client - initRealConfig(HTTP_CLIENT); + initRealConfig(); MyDeleteOperation oper2 = new MyDeleteOperation(); @@ -373,7 +374,7 @@ class HttpOperationTest { assertNotNull(outcome); assertEquals(1, ndelete); assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof String); + assertInstanceOf(String.class, outcome.getResponse()); } /** @@ -382,14 +383,14 @@ class HttpOperationTest { @Test void testPost() throws Exception { // use a real client - initRealConfig(HTTP_CLIENT); + initRealConfig(); MyPostOperation oper2 = new MyPostOperation(); OperationOutcome outcome = runOperation(oper2); assertNotNull(outcome); assertEquals(1, npost); assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof MyResponse); + assertInstanceOf(MyResponse.class, outcome.getResponse()); } /** @@ -398,7 +399,7 @@ class HttpOperationTest { @Test void testPut() throws Exception { // use a real client - initRealConfig(HTTP_CLIENT); + initRealConfig(); MyPutOperation oper2 = new MyPutOperation(); @@ -406,7 +407,7 @@ class HttpOperationTest { assertNotNull(outcome); assertEquals(1, nput); assertEquals(OperationResult.SUCCESS, outcome.getResult()); - assertTrue(outcome.getResponse() instanceof MyResponse); + assertInstanceOf(MyResponse.class, outcome.getResponse()); } @Test @@ -417,15 +418,14 @@ class HttpOperationTest { /** * Gets server properties. * - * @param name server name * @param port server port * @return server properties */ - private static Properties getServerProperties(String name, int port) { + private static Properties getServerProperties(int port) { final Properties props = new Properties(); - props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, name); + props.setProperty(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES, "my-server"); - final String svcpfx = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + name; + final String svcpfx = PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + "my-server"; props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX, Server.class.getName()); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_HOST_SUFFIX, "localhost"); @@ -434,51 +434,45 @@ class HttpOperationTest { props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SWAGGER_SUFFIX, "false"); props.setProperty(svcpfx + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, - GsonMessageBodyHandler.class.getName()); + GsonMessageBodyHandler.class.getName()); return props; } /** * Initializes the configuration. - * - * @param clientName name of the client which it should use */ - private void initConfig(String clientName) { - initConfig(clientName, clientFactory); + private void initConfig() { + initConfig(clientFactory); } /** * Initializes the configuration with a real client. - * - * @param clientName name of the client which it should use */ - private void initConfig(String clientName, HttpClientFactory factory) { - HttpParams params = HttpParams.builder().clientName(clientName).path(PATH).timeoutSec(1).build(); + private void initConfig(HttpClientFactory factory) { + HttpParams params = HttpParams.builder().clientName(HttpOperationTest.HTTP_CLIENT) + .path(PATH).timeoutSec(1).build(); config = new HttpConfig(executor, params, factory); } /** * Initializes the configuration with a real client. - * - * @param clientName name of the client which it should use */ - private void initRealConfig(String clientName) { - initConfig(clientName, HttpClientFactoryInstance.getClientFactory()); + private void initRealConfig() { + initConfig(HttpClientFactoryInstance.getClientFactory()); } /** * Runs the operation. * * @param operator operator on which to start the operation - * @return the outcome of the operation, or {@code null} if it does not complete in - * time + * @return the outcome of the operation, or {@code null} if it does not complete in time */ private <T> OperationOutcome runOperation(HttpOperation<T> operator) - throws InterruptedException, ExecutionException, TimeoutException { + throws InterruptedException, ExecutionException, TimeoutException { - CompletableFuture<OperationOutcome> future = operator.start(); + CompletableFuture<OperationOutcome> completableFuture = operator.start(); - return future.get(5, TimeUnit.SECONDS); + return completableFuture.get(5, TimeUnit.SECONDS); } @Getter @@ -495,7 +489,8 @@ class HttpOperationTest { private class MyGetOperation<T> extends HttpOperation<T> { MyGetOperation(Class<T> responseClass) { - super(HttpOperationTest.this.params, HttpOperationTest.this.config, responseClass, Collections.emptyList()); + super(HttpOperationTest.this.operationParams, HttpOperationTest.this.config, + responseClass, Collections.emptyList()); } @Override @@ -509,15 +504,15 @@ class HttpOperationTest { // @formatter:off return handleResponse(outcome, url, - callback -> getClient().get(callback, getPath(), headers)); + invocationCallback -> getClient().get(invocationCallback, getPath(), headers)); // @formatter:on } } private class MyPostOperation extends HttpOperation<MyResponse> { MyPostOperation() { - super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class, - Collections.emptyList()); + super(HttpOperationTest.this.operationParams, HttpOperationTest.this.config, MyResponse.class, + Collections.emptyList()); } @Override @@ -537,15 +532,15 @@ class HttpOperationTest { // @formatter:off return handleResponse(outcome, url, - callback -> getClient().post(callback, getPath(), entity, headers)); + invocationCallback -> getClient().post(invocationCallback, getPath(), entity, headers)); // @formatter:on } } private class MyPutOperation extends HttpOperation<MyResponse> { MyPutOperation() { - super(HttpOperationTest.this.params, HttpOperationTest.this.config, MyResponse.class, - Collections.emptyList()); + super(HttpOperationTest.this.operationParams, HttpOperationTest.this.config, MyResponse.class, + Collections.emptyList()); } @Override @@ -565,14 +560,15 @@ class HttpOperationTest { // @formatter:off return handleResponse(outcome, url, - callback -> getClient().put(callback, getPath(), entity, headers)); + invocationCallback -> getClient().put(invocationCallback, getPath(), entity, headers)); // @formatter:on } } private class MyDeleteOperation extends HttpOperation<String> { MyDeleteOperation() { - super(HttpOperationTest.this.params, HttpOperationTest.this.config, String.class, Collections.emptyList()); + super(HttpOperationTest.this.operationParams, HttpOperationTest.this.config, + String.class, Collections.emptyList()); } @Override @@ -586,7 +582,7 @@ class HttpOperationTest { // @formatter:off return handleResponse(outcome, url, - callback -> getClient().delete(callback, getPath(), headers)); + invocationCallback -> getClient().delete(invocationCallback, getPath(), headers)); // @formatter:on } } diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java index d2ca7dbc6..04300c4d9 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/impl/OperationPartialTest.java @@ -60,8 +60,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.utils.NetLoggerUtil.EventType; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.utils.NetLoggerUtil.EventType; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; @@ -1063,9 +1063,7 @@ class OperationPartialTest { * @param expectedCallbacks number of callbacks expected * @param expectedOperations number of operation invocations expected * @param expectedResult expected outcome - * @param manipulator function to modify the future returned by - * {@link OperationPartial#start(ControlLoopOperationParams)} before the tasks - * in the executor are run + * @param manipulator function to modify the future returned before the tasks in the executor are run */ private void verifyRun(String testName, int expectedCallbacks, int expectedOperations, OperationResult expectedResult, Consumer<CompletableFuture<OperationOutcome>> manipulator) { diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/BidirectionalTopicHandlerTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/BidirectionalTopicHandlerTest.java index 862e6c49d..dcf190bbb 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/BidirectionalTopicHandlerTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/BidirectionalTopicHandlerTest.java @@ -31,17 +31,18 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.Arrays; +import java.util.List; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; -import org.onap.policy.common.endpoints.event.comm.client.BidirectionalTopicClientException; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.TopicEndpoint; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; +import org.onap.policy.common.message.bus.event.client.BidirectionalTopicClientException; @TestInstance(TestInstance.Lifecycle.PER_CLASS) @ExtendWith(MockitoExtension.class) @@ -69,8 +70,8 @@ class BidirectionalTopicHandlerTest { */ @BeforeEach void setUp() throws BidirectionalTopicClientException { - when(mgr.getTopicSinks(MY_SINK)).thenReturn(Arrays.asList(publisher)); - when(mgr.getTopicSources(Arrays.asList(MY_SOURCE))).thenReturn(Arrays.asList(subscriber)); + when(mgr.getTopicSinks(MY_SINK)).thenReturn(List.of(publisher)); + when(mgr.getTopicSources(List.of(MY_SOURCE))).thenReturn(List.of(subscriber)); when(publisher.getTopicCommInfrastructure()).thenReturn(CommInfrastructure.NOOP); diff --git a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/TopicListenerImplTest.java b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/TopicListenerImplTest.java index 3044a1e44..8ca49db84 100644 --- a/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/TopicListenerImplTest.java +++ b/models-interactions/model-actors/actorServiceProvider/src/test/java/org/onap/policy/controlloop/actorserviceprovider/topic/TopicListenerImplTest.java @@ -30,6 +30,7 @@ import static org.mockito.Mockito.never; import static org.mockito.Mockito.verify; import java.util.Arrays; +import java.util.List; import java.util.Map; import java.util.function.BiConsumer; import org.junit.jupiter.api.BeforeEach; @@ -38,7 +39,7 @@ import org.junit.jupiter.api.TestInstance; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mock; import org.mockito.junit.jupiter.MockitoExtension; -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.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.coder.StandardCoderObject; @@ -86,8 +87,8 @@ class TopicListenerImplTest { assertNotNull(forwarder2); assertNotSame(forwarder1, forwarder2); - forwarder1.register(Arrays.asList(VALUEA_REQID), listener1); - forwarder1.register(Arrays.asList(VALUEB_REQID), listener1b); + forwarder1.register(List.of(VALUEA_REQID), listener1); + forwarder1.register(List.of(VALUEB_REQID), listener1b); forwarder2.register(Arrays.asList(VALUEA_REQID, VALUEA_SUBREQID), listener2); } |