diff options
author | adheli.tavares <adheli.tavares@est.tech> | 2024-11-04 10:17:03 +0000 |
---|---|---|
committer | Adheli Tavares <adheli.tavares@est.tech> | 2024-11-07 10:17:37 +0000 |
commit | cd9cbc8d353e24bfff76049e187bd5f2216bf71d (patch) | |
tree | 854465a7f91612f05f863bcaa1fc2e80bb538f8e /models-sim | |
parent | d8c2934b30d287011f95300bc5516f0df9dedfa9 (diff) |
Fix references and organize dependencies after splitting
policy-endpoints and message-bus
Issue-ID: POLICY-5131
Change-Id: I7542caaccc130bc6120cc105d31a1e1e951c8cff
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
Diffstat (limited to 'models-sim')
13 files changed, 35 insertions, 33 deletions
diff --git a/models-sim/policy-models-sim-pdp/pom.xml b/models-sim/policy-models-sim-pdp/pom.xml index ce4fd9216..c77a41fe5 100644 --- a/models-sim/policy-models-sim-pdp/pom.xml +++ b/models-sim/policy-models-sim-pdp/pom.xml @@ -49,6 +49,11 @@ </dependency> <dependency> <groupId>org.onap.policy.common</groupId> + <artifactId>message-bus</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> diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java index 31d5b4120..c00b22957 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/PdpSimulatorActivator.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2024 Nordix Foundation. * Modifications Copyright (C) 2019-2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,10 +25,10 @@ import java.util.List; import java.util.Random; import lombok.Getter; import lombok.Setter; -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.listeners.MessageTypeDispatcher; +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.utils.services.Registry; import org.onap.policy.common.utils.services.ServiceManager; import org.onap.policy.common.utils.services.ServiceManagerException; diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStateChangeListener.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStateChangeListener.java index ebe493a69..cb94f4e4d 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStateChangeListener.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStateChangeListener.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ package org.onap.policy.models.sim.pdp.comm; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.listeners.ScoListener; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.sim.pdp.handler.PdpStateChangeMessageHandler; diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java index 69b25dddd..b69e8a015 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpStatusPublisher.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019, 2023 Nordix Foundation. + * Copyright (C) 2019, 2023-2024 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -25,8 +25,8 @@ import java.util.List; import java.util.Timer; import java.util.TimerTask; import lombok.Getter; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.client.TopicSinkClient; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.sim.pdp.handler.PdpMessageHandler; import org.slf4j.Logger; diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpUpdateListener.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpUpdateListener.java index 52b1b11f0..e2bfe0c0a 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpUpdateListener.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/comm/PdpUpdateListener.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,8 +20,8 @@ package org.onap.policy.models.sim.pdp.comm; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.listeners.ScoListener; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.models.pdp.concepts.PdpUpdate; import org.onap.policy.models.sim.pdp.handler.PdpUpdateMessageHandler; diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java index 60f7c1461..548ac9537 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/handler/PdpUpdateMessageHandler.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019-2021 Nordix Foundation. + * Copyright (C) 2019-2021, 2024 Nordix Foundation. * Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -24,7 +24,7 @@ package org.onap.policy.models.sim.pdp.handler; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import org.onap.policy.common.endpoints.event.comm.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSink; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.pdp.concepts.PdpResponseDetails; import org.onap.policy.models.pdp.concepts.PdpStatus; diff --git a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java index 677d8a7d5..93c72a263 100644 --- a/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java +++ b/models-sim/policy-models-sim-pdp/src/main/java/org/onap/policy/models/sim/pdp/parameters/PdpSimulatorParameterGroup.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2019 Nordix Foundation. + * Copyright (C) 2019, 2024 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,11 +22,11 @@ package org.onap.policy.models.sim.pdp.parameters; import lombok.Getter; -import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.parameters.ParameterGroupImpl; import org.onap.policy.common.parameters.annotations.NotBlank; import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.common.parameters.annotations.Valid; +import org.onap.policy.common.parameters.topic.TopicParameterGroup; /** * Class to hold all parameters needed for pdp simulator component. diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpStateChangeListener.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpStateChangeListener.java index c0e933fb1..3b80a359c 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpStateChangeListener.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpStateChangeListener.java @@ -25,7 +25,6 @@ package org.onap.policy.models.sim.pdp.comm; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; @@ -35,7 +34,7 @@ import java.util.Map; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.pdp.concepts.PdpStateChange; import org.onap.policy.models.pdp.concepts.PdpStatus; @@ -125,8 +124,7 @@ class TestPdpStateChangeListener { String properties; try { - properties = new String(Files.readAllBytes(Paths.get("src\\test\\resources\\dummyProperties.json")), - StandardCharsets.UTF_8); + properties = Files.readString(Paths.get("src\\test\\resources\\dummyProperties.json")); propertiesMap.put("content", properties); } catch (final IOException e) { propertiesMap.put("content", ""); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpUpdateListener.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpUpdateListener.java index b63fd1546..fbe9a1b25 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpUpdateListener.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/comm/TestPdpUpdateListener.java @@ -25,7 +25,6 @@ package org.onap.policy.models.sim.pdp.comm; import static org.junit.jupiter.api.Assertions.assertEquals; import java.io.IOException; -import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Paths; import java.util.ArrayList; @@ -35,7 +34,7 @@ import java.util.Map; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; import org.onap.policy.common.utils.services.Registry; import org.onap.policy.models.pdp.concepts.PdpStatus; import org.onap.policy.models.pdp.concepts.PdpUpdate; @@ -109,7 +108,7 @@ class TestPdpUpdateListener { pdpUpdateMsg.setPdpGroup("pdpGroup"); pdpUpdateMsg.setPdpSubgroup("pdpSubgroup"); pdpUpdateMsg.setName(pdpStatus.getName()); - pdpUpdateMsg.setPdpHeartbeatIntervalMs(Long.valueOf(3000)); + pdpUpdateMsg.setPdpHeartbeatIntervalMs(3000L); final ToscaPolicy toscaPolicy = new ToscaPolicy(); toscaPolicy.setType("apexpolicytype"); toscaPolicy.setVersion("1.0"); @@ -117,8 +116,7 @@ class TestPdpUpdateListener { final Map<String, Object> propertiesMap = new LinkedHashMap<>(); String properties; try { - properties = new String(Files.readAllBytes(Paths.get("src\\test\\resources\\dummyProperties.json")), - StandardCharsets.UTF_8); + properties = Files.readString(Paths.get("src\\test\\resources\\dummyProperties.json")); propertiesMap.put("content", properties); } catch (final IOException e) { propertiesMap.put("content", ""); diff --git a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/CommonTestData.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/CommonTestData.java index a6b136b98..c460b3e58 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/CommonTestData.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/CommonTestData.java @@ -24,8 +24,8 @@ package org.onap.policy.models.sim.pdp.parameters; import java.util.List; import java.util.Map; import java.util.TreeMap; -import org.onap.policy.common.endpoints.parameters.TopicParameters; import org.onap.policy.common.parameters.ParameterGroup; +import org.onap.policy.common.parameters.topic.TopicParameters; 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-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterGroup.java b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterGroup.java index 2b5eed45f..9c992e13b 100644 --- a/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterGroup.java +++ b/models-sim/policy-models-sim-pdp/src/test/java/org/onap/policy/models/sim/pdp/parameters/TestPdpSimulatorParameterGroup.java @@ -25,12 +25,13 @@ package org.onap.policy.models.sim.pdp.parameters; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.util.Map; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.parameters.ValidationResult; +import org.onap.policy.common.parameters.topic.TopicParameterGroup; /** * Class to perform unit test of {@link PdpSimulatorParameterGroup}. @@ -70,7 +71,7 @@ class TestPdpSimulatorParameterGroup { .toObject(commonTestData.getPdpSimulatorParameterGroupMap(null), PdpSimulatorParameterGroup.class); final ValidationResult validationResult = pdpSimulatorParameters.validate(); assertFalse(validationResult.isValid()); - assertEquals(null, pdpSimulatorParameters.getName()); + assertNull(pdpSimulatorParameters.getName()); assertTrue(validationResult.getResult().contains("is null")); } diff --git a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/ClassRestServerParameters.java b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/ClassRestServerParameters.java index 404c7a7f9..b9f515013 100644 --- a/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/ClassRestServerParameters.java +++ b/models-sim/policy-models-simulators/src/main/java/org/onap/policy/models/simulators/ClassRestServerParameters.java @@ -4,6 +4,7 @@ * ================================================================================ * Copyright (C) 2020-2021 AT&T Intellectual Property. All rights reserved. * Modifications Copyright (C) 2021 Bell Canada. 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. @@ -22,9 +23,9 @@ package org.onap.policy.models.simulators; import lombok.Getter; -import org.onap.policy.common.endpoints.parameters.RestServerParameters; import org.onap.policy.common.parameters.annotations.ClassName; import org.onap.policy.common.parameters.annotations.NotNull; +import org.onap.policy.common.parameters.rest.RestServerParameters; @Getter public class ClassRestServerParameters extends RestServerParameters { diff --git a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java index 67cd7d800..ca95fd000 100644 --- a/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java +++ b/models-sim/policy-models-simulators/src/test/java/org/onap/policy/models/simulators/MainTest.java @@ -25,6 +25,7 @@ import static org.assertj.core.api.Assertions.assertThat; 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.assertInstanceOf; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; import static org.mockito.ArgumentMatchers.any; @@ -45,12 +46,12 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientConfigException; 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.internal.JettyJerseyServer; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.network.NetworkUtil; @@ -67,7 +68,7 @@ class MainTest { * Saves system properties. */ @BeforeAll - public static void setUpBeforeClass() throws IOException, InterruptedException { + public static void setUpBeforeClass() throws IOException { savedValues = new HashMap<>(); for (String prop : List.of(JettyJerseyServer.SYSTEM_KEYSTORE_PASSWORD_PROPERTY_NAME, @@ -233,9 +234,7 @@ class MainTest { RuntimeException ex = queue.poll(5, TimeUnit.SECONDS); assertNotNull(ex); - assertTrue(ex.getCause() instanceof IllegalStateException); + assertInstanceOf(IllegalStateException.class, ex.getCause()); assertThat(ex.getCause()).hasMessageStartingWith("interrupted while building"); } - - } |