From d7dc826ca0bdc7840ef2aebf3214a7f10ab9bc84 Mon Sep 17 00:00:00 2001 From: "adheli.tavares" Date: Mon, 4 Nov 2024 13:41:34 +0000 Subject: Fix references and organize dependencies in policy-drools after splitting policy-endpoints and message-bus in policy-common Issue-ID: POLICY-5131 Change-Id: I0696fa2d692c794f332491bc15c106baff84a603 Signed-off-by: adheli.tavares --- .../drools/healthcheck/RestHealthCheckTest.java | 2 +- .../policy/drools/legacy/config/LegacyConfig.java | 8 +- .../legacy/config/LegacyConfigFeatureTest.java | 2 +- .../drools/legacy/config/LegacyConfigTest.java | 4 +- .../server/restful/RestLegacyConfigTest.java | 2 +- .../onap/policy/drools/lifecycle/LifecycleFsm.java | 10 +-- .../PolicyTypeNativeDroolsController.java | 6 +- .../drools/lifecycle/LifecycleFsmUpdateTest.java | 11 +-- .../LifecycleStateActivePoliciesTest.java | 9 ++- .../lifecycle/LifecycleStateRunningTest.java | 2 +- .../PolicyTypeNativeDroolsControllerTest.java | 13 ++-- .../server/restful/RestLifecycleManagerTest.java | 13 ++-- .../onap/policy/drools/pooling/PoolingFeature.java | 8 +- .../policy/drools/pooling/PoolingManagerImpl.java | 9 +-- .../policy/drools/pooling/TopicMessageManager.java | 10 +-- .../policy/drools/pooling/EndToEndFeatureTest.java | 50 +++++++------ .../onap/policy/drools/pooling/FeatureTest.java | 10 +-- .../policy/drools/pooling/PoolingFeatureTest.java | 6 +- .../drools/pooling/PoolingManagerImplTest.java | 4 +- .../drools/pooling/TopicMessageManagerTest.java | 6 +- policy-management/pom.xml | 12 ++- .../policy/drools/controller/DroolsController.java | 8 +- .../drools/controller/DroolsControllerFactory.java | 5 +- .../controller/IndexedDroolsControllerFactory.java | 87 ++++++++++++---------- .../controller/internal/MavenDroolsController.java | 2 +- .../controller/internal/NullDroolsController.java | 3 +- .../features/DroolsControllerFeatureApi.java | 3 +- .../features/PolicyControllerFeatureApi.java | 8 +- .../drools/features/PolicyEngineFeatureApi.java | 2 +- .../policy/drools/server/restful/RestManager.java | 10 +-- .../java/org/onap/policy/drools/system/Main.java | 2 +- .../policy/drools/system/PolicyController.java | 12 +-- .../onap/policy/drools/system/PolicyEngine.java | 12 +-- .../drools/system/PolicyEngineConstants.java | 9 ++- .../policy/drools/system/PolicyEngineManager.java | 12 +-- .../internal/AggregatedPolicyController.java | 12 +-- .../internal/MavenDroolsController2Test.java | 2 +- .../features/DroolsControllerFeatureApiTest.java | 2 +- .../features/PolicyControllerFeatureApiTest.java | 2 +- .../features/PolicyEngineFeatureApiTest.java | 2 +- .../protocol/coders/EventProtocolCoderTest.java | 8 +- .../protocol/coders/ProtocolCoderToolsetTest.java | 13 ++-- .../drools/server/restful/RestManagerTest.java | 4 +- .../server/restful/test/RestManagerTest.java | 51 +++++++------ .../policy/drools/system/GsonMgmtTestBuilder.java | 6 +- .../drools/system/PolicyEngineManagerTest.java | 8 +- .../policy/drools/system/PolicyEngineTest.java | 9 ++- .../internal/AggregatedPolicyControllerTest.java | 8 +- 48 files changed, 270 insertions(+), 229 deletions(-) diff --git a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java index 63825fa8..4e75d315 100644 --- a/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java +++ b/feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java @@ -30,7 +30,6 @@ import jakarta.ws.rs.core.Response; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; 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; @@ -38,6 +37,7 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.http.server.YamlJacksonHandler; import org.onap.policy.common.gson.JacksonHandler; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.common.utils.logging.LoggerUtils; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.drools.system.PolicyController; diff --git a/feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java b/feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java index 7ca4632c..6f28226a 100644 --- a/feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java +++ b/feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java @@ -25,10 +25,10 @@ import java.util.List; import java.util.Properties; import lombok.Getter; import org.onap.policy.common.capabilities.Startable; -import org.onap.policy.common.endpoints.event.comm.Topic; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.TopicListener; -import org.onap.policy.common.endpoints.event.comm.TopicSource; +import org.onap.policy.common.message.bus.event.Topic; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.TopicListener; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.onap.policy.drools.system.PolicyEngineConstants; import org.slf4j.Logger; diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java index c8371895..85d152fa 100644 --- a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java +++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java @@ -28,7 +28,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue; 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.bus.NoopTopicFactories; +import org.onap.policy.common.message.bus.event.noop.NoopTopicFactories; import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.onap.policy.drools.system.PolicyEngineConstants; diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java index 09e03b3e..69d5bf2c 100644 --- a/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java +++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java @@ -30,8 +30,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue; 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; -import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicFactories; +import org.onap.policy.common.message.bus.event.Topic; +import org.onap.policy.common.message.bus.event.noop.NoopTopicFactories; import org.onap.policy.drools.persistence.SystemPersistenceConstants; class LegacyConfigTest { diff --git a/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java b/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java index 5180c486..9183403d 100644 --- a/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java +++ b/feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java @@ -27,13 +27,13 @@ import java.util.Properties; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.http.server.YamlJacksonHandler; import org.onap.policy.common.gson.JacksonHandler; +import org.onap.policy.common.parameters.topic.BusTopicParams; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.drools.legacy.config.LegacyConfigFeature; import org.onap.policy.drools.persistence.SystemPersistenceConstants; diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java index 7237eb91..6e334901 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java @@ -42,14 +42,14 @@ import lombok.NonNull; import lombok.Setter; import org.apache.commons.lang3.StringUtils; import org.onap.policy.common.capabilities.Startable; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.TopicSinkClient; import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher; import org.onap.policy.common.endpoints.listeners.ScoListener; import org.onap.policy.common.gson.annotation.GsonJsonIgnore; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +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.TopicSinkClient; import org.onap.policy.common.utils.coder.StandardCoderObject; import org.onap.policy.common.utils.resources.PrometheusUtils; import org.onap.policy.drools.persistence.SystemPersistenceConstants; diff --git a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java index 6e248e8d..8526b984 100644 --- a/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java +++ b/feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java @@ -28,10 +28,10 @@ import java.util.Properties; import java.util.stream.Collectors; import lombok.AllArgsConstructor; import lombok.Getter; -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.gson.annotation.GsonJsonIgnore; +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.coder.CoderException; import org.onap.policy.drools.domain.models.controller.ControllerCustomSerialization; import org.onap.policy.drools.domain.models.controller.ControllerEvent; diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java index c24c61cf..0a9dd41f 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java @@ -25,6 +25,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SOURCE_TOPICS; import com.google.common.base.Strings; import java.io.IOException; @@ -41,9 +43,8 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicFactories; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.noop.NoopTopicFactories; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.logging.LoggerUtils; @@ -139,8 +140,8 @@ public class LifecycleFsmUpdateTest { // @formatter:on Properties noopTopicProperties = new Properties(); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS, TestConstants.DCAE_TOPIC); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, TestConstants.APPC_CL_TOPIC); + noopTopicProperties.put(PROPERTY_NOOP_SOURCE_TOPICS, TestConstants.DCAE_TOPIC); + noopTopicProperties.put(PROPERTY_NOOP_SINK_TOPICS, TestConstants.APPC_CL_TOPIC); TopicEndpointManager.getManager().addTopics(noopTopicProperties); savedFsm = LifecycleFeature.getFsm(); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java index 2ed368d4..81904b3b 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java @@ -28,6 +28,8 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SOURCE_TOPICS; import java.io.IOException; import java.util.List; @@ -36,8 +38,7 @@ import java.util.Properties; import java.util.Set; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.drools.server.restful.TestConstants; @@ -128,8 +129,8 @@ class LifecycleStateActivePoliciesTest extends LifecycleStateRunningTest { // add topics Properties noopTopicProperties = new Properties(); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS, TestConstants.DCAE_TOPIC); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, TestConstants.APPC_CL_TOPIC); + noopTopicProperties.put(PROPERTY_NOOP_SOURCE_TOPICS, TestConstants.DCAE_TOPIC); + noopTopicProperties.put(PROPERTY_NOOP_SINK_TOPICS, TestConstants.APPC_CL_TOPIC); TopicEndpointManager.getManager().addTopics(noopTopicProperties); assertTrue(fsm.update(update)); diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java index c9d12165..a0ad4c3c 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java @@ -29,7 +29,7 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; -import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicFactories; +import org.onap.policy.common.message.bus.event.noop.NoopTopicFactories; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.logging.LoggerUtils; diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java index 29272a01..fe5a3b21 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java @@ -27,13 +27,14 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertSame; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SOURCE_TOPICS; import java.io.IOException; import java.util.Properties; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.drools.domain.models.controller.ControllerPolicy; import org.onap.policy.drools.server.restful.TestConstants; @@ -81,8 +82,8 @@ class PolicyTypeNativeDroolsControllerTest extends LifecycleStateRunningTest { () -> PolicyControllerConstants.getFactory().get(controllerPolicy.getName())); Properties noopTopicProperties = new Properties(); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS, TestConstants.DCAE_TOPIC); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, TestConstants.APPC_CL_TOPIC); + noopTopicProperties.put(PROPERTY_NOOP_SOURCE_TOPICS, TestConstants.DCAE_TOPIC); + noopTopicProperties.put(PROPERTY_NOOP_SINK_TOPICS, TestConstants.APPC_CL_TOPIC); TopicEndpointManager.getManager().addTopics(noopTopicProperties); assertTrue(controller.deploy(policy)); @@ -95,11 +96,11 @@ class PolicyTypeNativeDroolsControllerTest extends LifecycleStateRunningTest { Properties noopTopicProperties = new Properties(); String noopSources = String.join(",", TestConstants.DCAE_TOPIC, TestConstants.APPC_CL_TOPIC, TestConstants.APPC_LCM_WRITE_TOPIC, TestConstants.SDNR_CL_RSP_TOPIC); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS, noopSources); + noopTopicProperties.put(PROPERTY_NOOP_SOURCE_TOPICS, noopSources); String noopSinks = String.join(",", TestConstants.APPC_CL_TOPIC, TestConstants.APPC_LCM_READ_TOPIC, TestConstants.POLICY_CL_MGT_TOPIC, TestConstants.DCAE_CL_RSP_TOPIC); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, noopSinks); + noopTopicProperties.put(PROPERTY_NOOP_SINK_TOPICS, noopSinks); TopicEndpointManager.getManager().addTopics(noopTopicProperties); ToscaPolicy nativeControllerPolicy = diff --git a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java index 8aa3f43b..86d58dd1 100644 --- a/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java +++ b/feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java @@ -24,6 +24,8 @@ import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SOURCE_TOPICS; import jakarta.ws.rs.client.Entity; import jakarta.ws.rs.core.Response; @@ -38,16 +40,15 @@ import org.apache.commons.lang3.StringUtils; 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.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.bus.NoopTopicFactories; -import org.onap.policy.common.endpoints.event.comm.bus.internal.BusTopicParams; import org.onap.policy.common.endpoints.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInstance; import org.onap.policy.common.endpoints.http.server.YamlJacksonHandler; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.gson.JacksonHandler; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.noop.NoopTopicFactories; +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.common.utils.logging.LoggerUtils; @@ -140,10 +141,10 @@ public class RestLifecycleManagerTest { controllerSupport.installArtifact(); Properties noopTopicProperties = new Properties(); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS, + noopTopicProperties.put(PROPERTY_NOOP_SOURCE_TOPICS, String.join(",", TestConstants.DCAE_TOPIC, TestConstants.APPC_CL_TOPIC, TestConstants.APPC_LCM_WRITE_TOPIC, TestConstants.SDNR_CL_RSP_TOPIC)); - noopTopicProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, + noopTopicProperties.put(PROPERTY_NOOP_SINK_TOPICS, String.join(",", TestConstants.APPC_CL_TOPIC, TestConstants.APPC_LCM_READ_TOPIC, TestConstants.POLICY_CL_MGT_TOPIC, TestConstants.SDNR_CL_TOPIC, TestConstants.DCAE_CL_RSP_TOPIC)); TopicEndpointManager.getManager().addTopics(noopTopicProperties); diff --git a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java index a1368d8c..25579170 100644 --- a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java +++ b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java @@ -28,10 +28,10 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.CountDownLatch; import lombok.AccessLevel; import lombok.Getter; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.message.bus.event.Topic.CommInfrastructure; +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.properties.SpecProperties; import org.onap.policy.common.utils.properties.exception.PropertyException; import org.onap.policy.drools.controller.DroolsController; diff --git a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java index fec6ba81..e613787b 100644 --- a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java +++ b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java @@ -28,8 +28,8 @@ import java.util.concurrent.ScheduledFuture; import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import lombok.Getter; -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.drools.controller.DroolsController; import org.onap.policy.drools.pooling.message.BucketAssignments; import org.onap.policy.drools.pooling.message.Leader; @@ -419,8 +419,7 @@ public class PoolingManagerImpl implements PoolingManager, TopicListener { * @param topic2 topic * @param event event, as an object * @param eventHashCode event's hash code - * @return {@code true} if the event was handled, {@code false} if the invoker should - * handle it + * @return {@code true} if the event was handled, {@code false} if the invoker should handle it */ private boolean handleExternal(String topic2, Object event, int eventHashCode) { if (assignments == null) { @@ -436,7 +435,7 @@ public class PoolingManagerImpl implements PoolingManager, TopicListener { } /** - * Handles a {@link Forward} event, possibly forwarding it again. + * Handles a forward event, possibly forwarding it again. * * @param topic2 topic * @param event event, as an object diff --git a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/TopicMessageManager.java b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/TopicMessageManager.java index 4c9b3f34..b2986e65 100644 --- a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/TopicMessageManager.java +++ b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/TopicMessageManager.java @@ -23,11 +23,11 @@ package org.onap.policy.drools.pooling; import java.util.List; import lombok.Getter; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.TopicListener; -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.TopicEndpoint; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.TopicListener; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java index 1ad5d513..b487762a 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java @@ -27,6 +27,13 @@ import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_KAFKA_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_KAFKA_SOURCE_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_MANAGED_SUFFIX; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_TOPIC_SOURCE_FETCH_LIMIT_SUFFIX; import static org.onap.policy.drools.pooling.PoolingProperties.PREFIX; import com.google.gson.Gson; @@ -50,12 +57,11 @@ import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.TopicListener; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.TopicListener; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.system.PolicyController; import org.onap.policy.drools.system.PolicyEngine; @@ -237,14 +243,14 @@ public class EndToEndFeatureTest { private static Properties makeSinkProperties(String topic) { Properties props = new Properties(); - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS, topic); + props.setProperty(PROPERTY_KAFKA_SINK_TOPICS, topic); - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX, SERVER); - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX, "0"); - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false"); + props.setProperty(PROPERTY_KAFKA_SINK_TOPICS + "." + topic + + PROPERTY_TOPIC_SERVERS_SUFFIX, SERVER); + props.setProperty(PROPERTY_KAFKA_SINK_TOPICS + "." + topic + + PROPERTY_TOPIC_SINK_PARTITION_KEY_SUFFIX, "0"); + props.setProperty(PROPERTY_KAFKA_SINK_TOPICS + "." + topic + + PROPERTY_MANAGED_SUFFIX, "false"); return props; } @@ -252,19 +258,19 @@ public class EndToEndFeatureTest { private static Properties makeSourceProperties(String topic) { Properties props = new Properties(); - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS, topic); + props.setProperty(PROPERTY_KAFKA_SOURCE_TOPICS, topic); - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX, SERVER); - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_FETCH_LIMIT_SUFFIX, FETCH_LIMIT); - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false"); + props.setProperty(PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic + + PROPERTY_TOPIC_SERVERS_SUFFIX, SERVER); + props.setProperty(PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic + + PROPERTY_TOPIC_SOURCE_FETCH_LIMIT_SUFFIX, FETCH_LIMIT); + props.setProperty(PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic + + PROPERTY_MANAGED_SUFFIX, "false"); if (EXTERNAL_TOPIC.equals(topic)) { // consumer group is a constant - props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX, EXTERNAL_GROUP); + props.setProperty(PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic + + PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX, EXTERNAL_GROUP); // consumer instance is generated by the BusConsumer code } diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java index f1b48b3e..f4e74375 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java @@ -53,11 +53,11 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.invocation.InvocationOnMock; import org.mockito.stubbing.Answer; -import org.onap.policy.common.endpoints.event.comm.Topic; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.event.comm.TopicListener; -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.Topic; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.TopicListener; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.system.PolicyController; import org.onap.policy.drools.system.PolicyEngine; diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java index 1eb9e361..f288767d 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java @@ -43,9 +43,9 @@ import java.util.concurrent.CountDownLatch; import org.apache.commons.lang3.tuple.Pair; 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.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.system.PolicyController; import org.onap.policy.drools.system.PolicyEngine; diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java index 98300683..65b52eb6 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java @@ -47,8 +47,8 @@ import java.util.concurrent.TimeUnit; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; -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.drools.controller.DroolsController; import org.onap.policy.drools.pooling.message.BucketAssignments; import org.onap.policy.drools.pooling.message.Heartbeat; diff --git a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java index 74098487..82fe3a8f 100644 --- a/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java +++ b/feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java @@ -40,9 +40,9 @@ import java.util.List; import java.util.concurrent.CountDownLatch; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.TopicListener; -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.TopicListener; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; class TopicMessageManagerTest { diff --git a/policy-management/pom.xml b/policy-management/pom.xml index c2a3b376..05cabea0 100644 --- a/policy-management/pom.xml +++ b/policy-management/pom.xml @@ -178,9 +178,9 @@ Properties=java.util.Properties, ProtocolCoderToolset=org.onap.policy.drools.protocol.coders.ProtocolCoderToolset, Response=jakarta.ws.rs.core.Response, - TopicEndpoint=org.onap.policy.common.endpoints.event.comm.TopicEndpoint, - TopicSink=org.onap.policy.common.endpoints.event.comm.TopicSink, - TopicSource=org.onap.policy.common.endpoints.event.comm.TopicSource, + TopicEndpoint=org.onap.policy.common.message.bus.event.TopicEndpoint, + TopicSink=org.onap.policy.common.message.bus.event.TopicSink, + TopicSource=org.onap.policy.common.message.bus.event.TopicSource, ToscaPolicy=org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy @@ -212,7 +212,11 @@ policy-domains ${project.version} - + + org.onap.policy.common + message-bus + ${policy.common.version} + org.onap.policy.common policy-endpoints diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java index 27a3289a..2afce999 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2019, 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,7 +26,7 @@ import java.util.Map; import lombok.NonNull; import org.onap.policy.common.capabilities.Lockable; import org.onap.policy.common.capabilities.Startable; -import org.onap.policy.common.endpoints.event.comm.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSink; import org.onap.policy.drools.core.PolicyContainer; import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration; @@ -104,9 +104,9 @@ public interface DroolsController extends Startable, Lockable { * @return true if successful, false if a failure has occurred. * @throws IllegalArgumentException when invalid or insufficient properties are provided * @throws IllegalStateException when the engine is in a state where this operation is not - * permitted (ie. locked or stopped). + * permitted (i.e. locked or stopped). * @throws UnsupportedOperationException when the engine cannot deliver due to the functionality - * missing (ie. communication infrastructure not supported. + * missing (i.e. communication infrastructure not supported). */ boolean deliver(TopicSink sink, Object event); diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java index a355f6f7..a3939c4d 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-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. @@ -22,8 +23,8 @@ package org.onap.policy.drools.controller; import java.util.List; import java.util.Properties; -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.drools.protocol.coders.TopicCoderFilterConfiguration; /** diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java b/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java index a6459d67..5829d493 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java @@ -21,6 +21,14 @@ package org.onap.policy.drools.controller; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_KAFKA_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_KAFKA_SOURCE_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SOURCE_TOPICS; +import static org.onap.policy.drools.system.PolicyEngineConstants.PROPERTY_TOPIC_EVENTS_CUSTOM_MODEL_CODER_GSON_SUFFIX; +import static org.onap.policy.drools.system.PolicyEngineConstants.PROPERTY_TOPIC_EVENTS_FILTER_SUFFIX; +import static org.onap.policy.drools.system.PolicyEngineConstants.PROPERTY_TOPIC_EVENTS_SUFFIX; + import com.google.re2j.Pattern; import java.util.ArrayList; import java.util.HashMap; @@ -29,11 +37,10 @@ import java.util.Map; import java.util.Properties; import lombok.NonNull; import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.endpoints.event.comm.Topic; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +import org.onap.policy.common.message.bus.event.Topic; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +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.FeatureApiUtils; import org.onap.policy.drools.controller.internal.MavenDroolsController; import org.onap.policy.drools.controller.internal.NullDroolsController; @@ -82,7 +89,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { @Override public DroolsController build(Properties properties, List eventSources, - List eventSinks) throws LinkageError { + List eventSinks) throws LinkageError { String groupId = properties.getProperty(DroolsPropertyConstants.RULES_GROUPID); if (StringUtils.isBlank(groupId)) { @@ -103,13 +110,13 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { List topics2EncodedClasses2Filters = codersAndFilters(properties, eventSinks); return this.build(properties, groupId, artifactId, version, - topics2DecodedClasses2Filters, topics2EncodedClasses2Filters); + topics2DecodedClasses2Filters, topics2EncodedClasses2Filters); } @Override public DroolsController build(Properties properties, String newGroupId, String newArtifactId, String newVersion, - List decoderConfigurations, - List encoderConfigurations) throws LinkageError { + List decoderConfigurations, + List encoderConfigurations) throws LinkageError { if (StringUtils.isBlank(newGroupId)) { throw new IllegalArgumentException("Missing maven group-id coordinate"); @@ -147,7 +154,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { */ controllerCopy.updateToVersion(newGroupId, newArtifactId, newVersion, decoderConfigurations, - encoderConfigurations); + encoderConfigurations); return controllerCopy; } @@ -155,11 +162,11 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { /* new drools controller */ DroolsController controller = applyBeforeInstance(properties, newGroupId, newArtifactId, newVersion, - decoderConfigurations, encoderConfigurations); + decoderConfigurations, encoderConfigurations); if (controller == null) { controller = new MavenDroolsController(newGroupId, newArtifactId, newVersion, decoderConfigurations, - encoderConfigurations); + encoderConfigurations); } synchronized (this) { @@ -171,31 +178,32 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { FeatureApiUtils.apply(getProviders(), feature -> feature.afterInstance(controllerFinal, properties), (feature, ex) -> logger.error("feature {} ({}) afterInstance() of drools controller {}:{}:{} failed", - feature.getName(), feature.getSequenceNumber(), - newGroupId, newArtifactId, newVersion, ex)); + feature.getName(), feature.getSequenceNumber(), + newGroupId, newArtifactId, newVersion, ex)); return controller; } private DroolsController applyBeforeInstance(Properties properties, String newGroupId, String newArtifactId, - String newVersion, List decoderConfigurations, - List encoderConfigurations) { + String newVersion, + List decoderConfigurations, + List encoderConfigurations) { DroolsController controller = null; - for (DroolsControllerFeatureApi feature: getProviders()) { + for (DroolsControllerFeatureApi feature : getProviders()) { try { controller = feature.beforeInstance(properties, - newGroupId, newArtifactId, newVersion, - decoderConfigurations, encoderConfigurations); + newGroupId, newArtifactId, newVersion, + decoderConfigurations, encoderConfigurations); if (controller != null) { logger.info("feature {} ({}) beforeInstance() has intercepted drools controller {}:{}:{}", - feature.getName(), feature.getSequenceNumber(), - newGroupId, newArtifactId, newVersion); + feature.getName(), feature.getSequenceNumber(), + newGroupId, newArtifactId, newVersion); break; } } catch (RuntimeException r) { logger.error("feature {} ({}) beforeInstance() of drools controller {}:{}:{} failed", - feature.getName(), feature.getSequenceNumber(), - newGroupId, newArtifactId, newVersion, r); + feature.getName(), feature.getSequenceNumber(), + newGroupId, newArtifactId, newVersion, r); } } return controller; @@ -208,14 +216,13 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { /** * find out decoder classes and filters. * - * @param properties properties with information about decoders + * @param properties properties with information about decoders * @param topicEntities topic sources - * @return list of topics, each with associated decoder classes, each with a list of associated - * filters + * @return list of topics, each with associated decoder classes, each with a list of associated filters * @throws IllegalArgumentException invalid input data */ protected List codersAndFilters(Properties properties, - List topicEntities) { + List topicEntities) { List topics2DecodedClasses2Filters = new ArrayList<>(); @@ -239,7 +246,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { // 3. second the list of classes associated with each topic String eventClasses = properties - .getProperty(propertyTopicEntityPrefix + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX); + .getProperty(propertyTopicEntityPrefix + PROPERTY_TOPIC_EVENTS_SUFFIX); if (StringUtils.isBlank(eventClasses)) { logger.warn("There are no event classes for topic {}", firstTopic); @@ -247,10 +254,10 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { } List classes2Filters = - getFilterExpressions(properties, propertyTopicEntityPrefix, eventClasses); + getFilterExpressions(properties, propertyTopicEntityPrefix, eventClasses); topics2DecodedClasses2Filters - .add(new TopicCoderFilterConfiguration(firstTopic, classes2Filters, customGsonCoder)); + .add(new TopicCoderFilterConfiguration(firstTopic, classes2Filters, customGsonCoder)); } return topics2DecodedClasses2Filters; @@ -261,15 +268,15 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { var commInfra = topic.getTopicCommInfrastructure(); if (commInfra == CommInfrastructure.NOOP) { if (isSource) { - return PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS + "."; + return PROPERTY_NOOP_SOURCE_TOPICS + "."; } else { - return PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS + "."; + return PROPERTY_NOOP_SINK_TOPICS + "."; } } else if (commInfra == CommInfrastructure.KAFKA) { if (isSource) { - return PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS + "."; + return PROPERTY_KAFKA_SOURCE_TOPICS + "."; } else { - return PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "."; + return PROPERTY_KAFKA_SINK_TOPICS + "."; } } else { throw new IllegalArgumentException("Invalid Communication Infrastructure: " + commInfra); @@ -278,7 +285,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { private CustomGsonCoder getCustomCoder(Properties properties, String propertyPrefix) { String customGson = properties.getProperty(propertyPrefix - + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_CUSTOM_MODEL_CODER_GSON_SUFFIX); + + PROPERTY_TOPIC_EVENTS_CUSTOM_MODEL_CODER_GSON_SUFFIX); CustomGsonCoder customGsonCoder = null; if (StringUtils.isNotBlank(customGson)) { @@ -286,14 +293,14 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { customGsonCoder = new CustomGsonCoder(customGson); } catch (IllegalArgumentException e) { logger.warn("{}: cannot create custom-gson-coder {} because of {}", this, customGson, - e.getMessage(), e); + e.getMessage(), e); } } return customGsonCoder; } private List getFilterExpressions(Properties properties, String propertyPrefix, - @NonNull String eventClasses) { + @NonNull String eventClasses) { List classes2Filters = new ArrayList<>(); for (String theClass : COMMA_SPACE_PAT.split(eventClasses)) { @@ -301,9 +308,9 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { // 4. for each coder class, get the filter expression String filter = properties - .getProperty(propertyPrefix - + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX - + "." + theClass + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_FILTER_SUFFIX); + .getProperty(propertyPrefix + + PROPERTY_TOPIC_EVENTS_SUFFIX + + "." + theClass + PROPERTY_TOPIC_EVENTS_FILTER_SUFFIX); var class2Filters = new PotentialCoderFilter(theClass, new JsonProtocolFilter(filter)); classes2Filters.add(class2Filters); diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java index aa701dfd..82d18774 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java @@ -38,9 +38,9 @@ import org.kie.api.definition.rule.Query; import org.kie.api.runtime.KieSession; import org.kie.api.runtime.rule.FactHandle; import org.kie.api.runtime.rule.QueryResultsRow; -import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.gson.annotation.GsonJsonIgnore; import org.onap.policy.common.gson.annotation.GsonJsonProperty; +import org.onap.policy.common.message.bus.event.TopicSink; import org.onap.policy.common.utils.services.FeatureApiUtils; import org.onap.policy.common.utils.services.OrderedServiceImpl; import org.onap.policy.drools.controller.DroolsController; diff --git a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java index 5ac1d6da..97302479 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-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. @@ -27,7 +28,7 @@ import java.util.List; import java.util.Map; import lombok.NonNull; import lombok.ToString; -import org.onap.policy.common.endpoints.event.comm.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSink; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.controller.DroolsControllerConstants; import org.onap.policy.drools.core.PolicyContainer; diff --git a/policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java b/policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java index bb11bb64..d7ca045f 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java +++ b/policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2018-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. @@ -22,7 +23,7 @@ package org.onap.policy.drools.features; import java.util.List; import java.util.Properties; -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.OrderedService; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.protocol.coders.TopicCoderFilterConfiguration; diff --git a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java index 15b48a5c..2036eec8 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java +++ b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java @@ -22,7 +22,7 @@ package org.onap.policy.drools.features; import java.util.Properties; -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.OrderedService; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; import org.onap.policy.drools.system.PolicyController; @@ -169,7 +169,7 @@ public interface PolicyControllerFeatureApi extends OrderedService { * * @return true if this feature intercepts and takes ownership * of the operation preventing the invocation of - * lower priority features. False, otherwise.. + * lower priority features. False, otherwise. */ default boolean afterLock(PolicyController controller) { return false; @@ -202,7 +202,7 @@ public interface PolicyControllerFeatureApi extends OrderedService { * * @return true if this feature intercepts and takes ownership * of the operation preventing the invocation of - * lower priority features. False, otherwise.. + * lower priority features. False, otherwise. */ default boolean beforeShutdown(PolicyController controller) { return false; @@ -224,7 +224,7 @@ public interface PolicyControllerFeatureApi extends OrderedService { * * @return true if this feature intercepts and takes ownership * of the operation preventing the invocation of - * lower priority features. False, otherwise.. + * lower priority features. False, otherwise. */ default boolean beforeHalt(PolicyController controller) { return false; diff --git a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java index 27b96999..d5e1dc6a 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java +++ b/policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java @@ -22,7 +22,7 @@ package org.onap.policy.drools.features; import java.util.Properties; -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.OrderedService; import org.onap.policy.drools.core.lock.PolicyResourceLockManager; import org.onap.policy.drools.protocol.configuration.PdpdConfiguration; diff --git a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java index 503ba336..1d08af27 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java @@ -67,12 +67,12 @@ import lombok.Getter; import lombok.Setter; import lombok.ToString; import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.endpoints.event.comm.Topic; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.http.server.YamlMessageBodyHandler; +import org.onap.policy.common.message.bus.event.Topic; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +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.logging.LoggerUtils; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.protocol.coders.EventProtocolCoderConstants; diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/Main.java b/policy-management/src/main/java/org/onap/policy/drools/system/Main.java index f0530d05..a8dd5c25 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/Main.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/Main.java @@ -25,10 +25,10 @@ import java.util.Properties; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; 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.HttpServletServerFactoryInstance; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; import org.onap.policy.common.utils.logging.LoggerUtils; import org.onap.policy.common.utils.resources.MessageConstants; import org.onap.policy.common.utils.security.CryptoUtils; diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java index 931e8a55..04d88145 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java @@ -3,7 +3,7 @@ * policy-management * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. - * Modifications Copyright (C) 2021 Nordix Foundation. + * Modifications Copyright (C) 2021, 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. @@ -25,9 +25,9 @@ import java.util.List; import java.util.Properties; import org.onap.policy.common.capabilities.Lockable; import org.onap.policy.common.capabilities.Startable; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -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.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @@ -94,9 +94,9 @@ public interface PolicyController extends Startable, Lockable { * @return true if successful, false if a failure has occurred. * @throws IllegalArgumentException when invalid or insufficient properties are provided * @throws IllegalStateException when the engine is in a state where this operation is not - * permitted (ie. locked or stopped). + * permitted (i.e. locked or stopped). * @throws UnsupportedOperationException when the engine cannot deliver due to the functionality - * missing (ie. communication infrastructure not supported. + * missing (i.e. communication infrastructure not supported). */ boolean deliver(CommInfrastructure busType, String topic, Object event); diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java index 3fc2e292..d755932e 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java @@ -26,11 +26,11 @@ import java.util.Properties; import java.util.concurrent.ScheduledExecutorService; import org.onap.policy.common.capabilities.Lockable; import org.onap.policy.common.capabilities.Startable; -import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; -import org.onap.policy.common.endpoints.event.comm.TopicListener; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure; +import org.onap.policy.common.message.bus.event.TopicListener; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.drools.core.lock.Lock; import org.onap.policy.drools.core.lock.LockCallback; import org.onap.policy.drools.features.PolicyEngineFeatureApi; @@ -314,9 +314,9 @@ public interface PolicyEngine extends Startable, Lockable, TopicListener { * @return true if successful, false if a failure has occurred. * @throws IllegalArgumentException when invalid or insufficient properties are provided * @throws IllegalStateException when the engine is in a state where this operation is not - * permitted (ie. locked or stopped). + * permitted (i.e. locked or stopped). * @throws UnsupportedOperationException when the engine cannot deliver due to the functionality - * missing (ie. communication infrastructure not supported. + * missing (i.e. communication infrastructure not supported). */ boolean deliver(CommInfrastructure busType, String topic, String event); diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java index 9a762c0b..9781c756 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java @@ -3,7 +3,7 @@ * policy-management * ================================================================================ * Copyright (C) 2019, 2021-2022 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. @@ -43,6 +43,13 @@ public final class PolicyEngineConstants { */ public static final String TELEMETRY_SERVER_DEFAULT_NAME = "TELEMETRY"; + /** + * Topics constants. + */ + public static final String PROPERTY_TOPIC_EVENTS_SUFFIX = ".events"; + public static final String PROPERTY_TOPIC_EVENTS_CUSTOM_MODEL_CODER_GSON_SUFFIX = ".events.custom.gson"; + public static final String PROPERTY_TOPIC_EVENTS_FILTER_SUFFIX = ".filter"; + /** * Policy Engine Manager. */ diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java index dbcb7917..580d4244 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java @@ -47,12 +47,6 @@ import lombok.Setter; import lombok.Synchronized; import lombok.ToString; import org.apache.commons.lang3.StringUtils; -import org.onap.policy.common.endpoints.event.comm.Topic; -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.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.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactory; import org.onap.policy.common.endpoints.http.client.HttpClientFactoryInstance; @@ -62,6 +56,12 @@ import org.onap.policy.common.endpoints.http.server.HttpServletServerFactoryInst import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.gson.annotation.GsonJsonIgnore; import org.onap.policy.common.gson.annotation.GsonJsonProperty; +import org.onap.policy.common.message.bus.event.Topic; +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.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.logging.LoggerUtils; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.common.utils.resources.PrometheusUtils; diff --git a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java index 2c85c26e..2a0c582f 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java +++ b/policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java @@ -30,13 +30,13 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; import lombok.Getter; import lombok.ToString; -import org.onap.policy.common.endpoints.event.comm.Topic; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.TopicListener; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.gson.annotation.GsonJsonIgnore; +import org.onap.policy.common.message.bus.event.Topic; +import org.onap.policy.common.message.bus.event.TopicEndpoint; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.TopicListener; +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.FeatureApiUtils; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.controller.DroolsControllerConstants; diff --git a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java index fdbfab8f..877489d8 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java +++ b/policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java @@ -58,7 +58,7 @@ import org.mockito.ArgumentCaptor; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.mockito.junit.jupiter.MockitoExtension; -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.OrderedServiceImpl; import org.onap.policy.drools.core.PolicyContainer; import org.onap.policy.drools.core.PolicySession; diff --git a/policy-management/src/test/java/org/onap/policy/drools/features/DroolsControllerFeatureApiTest.java b/policy-management/src/test/java/org/onap/policy/drools/features/DroolsControllerFeatureApiTest.java index 83171dae..55520ece 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/features/DroolsControllerFeatureApiTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/features/DroolsControllerFeatureApiTest.java @@ -27,7 +27,7 @@ import static org.junit.jupiter.api.Assertions.assertNull; import java.util.Collections; import java.util.Properties; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSink; import org.onap.policy.drools.controller.DroolsController; /** diff --git a/policy-management/src/test/java/org/onap/policy/drools/features/PolicyControllerFeatureApiTest.java b/policy-management/src/test/java/org/onap/policy/drools/features/PolicyControllerFeatureApiTest.java index f48bf937..5760a6b1 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/features/PolicyControllerFeatureApiTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/features/PolicyControllerFeatureApiTest.java @@ -22,7 +22,7 @@ package org.onap.policy.drools.features; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; -import static org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure.NOOP; +import static org.onap.policy.common.message.bus.event.Topic.CommInfrastructure.NOOP; import java.util.Properties; import org.junit.jupiter.api.Test; diff --git a/policy-management/src/test/java/org/onap/policy/drools/features/PolicyEngineFeatureApiTest.java b/policy-management/src/test/java/org/onap/policy/drools/features/PolicyEngineFeatureApiTest.java index 90feeb20..94024ae1 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/features/PolicyEngineFeatureApiTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/features/PolicyEngineFeatureApiTest.java @@ -26,7 +26,7 @@ import static org.mockito.Mockito.mock; import java.util.Properties; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.Topic; +import org.onap.policy.common.message.bus.event.Topic; import org.onap.policy.drools.core.lock.PolicyResourceLockManager; import org.onap.policy.drools.protocol.configuration.PdpdConfiguration; import org.onap.policy.drools.system.PolicyEngine; diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java index c98467ea..27b67c4c 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java @@ -24,13 +24,13 @@ package org.onap.policy.drools.protocol.coders; import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; import java.util.Properties; import lombok.AllArgsConstructor; import lombok.Getter; import org.junit.jupiter.api.Test; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; /** @@ -71,7 +71,7 @@ class EventProtocolCoderTest { void test() { final Properties noopSinkProperties = new Properties(); - noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); + noopSinkProperties.put(PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); @@ -93,7 +93,7 @@ class EventProtocolCoderTest { @Test void test_extra() { final Properties noopSinkProperties = new Properties(); - noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); + noopSinkProperties.put(PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties); diff --git a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java index cb4397c8..4df04d9c 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java @@ -35,6 +35,8 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.Mockito.doCallRealMethod; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; +import static org.onap.policy.drools.system.PolicyEngineConstants.PROPERTY_TOPIC_EVENTS_SUFFIX; import com.google.gson.Gson; import com.google.gson.GsonBuilder; @@ -49,9 +51,8 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.kie.api.builder.ReleaseId; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.TopicSink; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.controller.DroolsControllerConstants; import org.onap.policy.drools.controller.internal.MavenDroolsControllerTest; @@ -296,7 +297,7 @@ public class ProtocolCoderToolsetTest { } Properties sinkConfig = new Properties(); - sinkConfig.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, JUNIT_PROTOCOL_CODER_TOPIC); + sinkConfig.put(PROPERTY_NOOP_SINK_TOPICS, JUNIT_PROTOCOL_CODER_TOPIC); final List noopTopics = TopicEndpointManager.getManager().addTopicSinks(sinkConfig); Properties droolsControllerConfig = getDroolsControllerConfig(); @@ -310,8 +311,8 @@ public class ProtocolCoderToolsetTest { droolsControllerConfig.put(DroolsPropertyConstants.RULES_ARTIFACTID, releaseId.getArtifactId()); droolsControllerConfig.put(DroolsPropertyConstants.RULES_VERSION, releaseId.getVersion()); droolsControllerConfig.put( - PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS + "." + JUNIT_PROTOCOL_CODER_TOPIC - + PolicyEndPointProperties.PROPERTY_TOPIC_EVENTS_SUFFIX, + PROPERTY_NOOP_SINK_TOPICS + "." + JUNIT_PROTOCOL_CODER_TOPIC + + PROPERTY_TOPIC_EVENTS_SUFFIX, ThreeStrings.class.getName()); return droolsControllerConfig; } diff --git a/policy-management/src/test/java/org/onap/policy/drools/server/restful/RestManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/server/restful/RestManagerTest.java index 89cce098..7e535933 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/server/restful/RestManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/server/restful/RestManagerTest.java @@ -57,8 +57,8 @@ import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.MockedStatic; import org.mockito.MockitoAnnotations; -import org.onap.policy.common.endpoints.event.comm.TopicEndpoint; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; +import org.onap.policy.common.message.bus.event.TopicEndpoint; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.controller.internal.NullDroolsController; import org.onap.policy.drools.features.PolicyControllerFeatureApi; diff --git a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java index 1ceff3d0..cb92b2ef 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java @@ -22,6 +22,16 @@ package org.onap.policy.drools.server.restful.test; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX; +import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX; +import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX; +import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER; +import static org.onap.policy.common.endpoints.properties.PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_KAFKA_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_KAFKA_SOURCE_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SOURCE_TOPICS; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; import java.io.IOException; import java.nio.file.Files; @@ -49,10 +59,9 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; -import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.http.server.YamlJacksonHandler; -import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; import org.onap.policy.common.gson.JacksonHandler; +import org.onap.policy.common.message.bus.event.TopicEndpointManager; import org.onap.policy.common.utils.network.NetworkUtil; import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.onap.policy.drools.system.PolicyControllerConstants; @@ -71,10 +80,10 @@ public class RestManagerTest { private static final String FOO_CONTROLLER = "foo"; private static final String KAFKA_TOPIC = "kafka-topic-test"; private static final String NOOP_TOPIC = "noop_topic"; - private static final String KAFKA_SOURCE_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS - + "." + KAFKA_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; - private static final String KAFKA_SINK_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "." - + KAFKA_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; + private static final String KAFKA_SOURCE_SERVER_PROPERTY = PROPERTY_KAFKA_SOURCE_TOPICS + + "." + KAFKA_TOPIC + PROPERTY_TOPIC_SERVERS_SUFFIX; + private static final String KAFKA_SINK_SERVER_PROPERTY = PROPERTY_KAFKA_SINK_TOPICS + "." + + KAFKA_TOPIC + PROPERTY_TOPIC_SERVERS_SUFFIX; private static final String KAFKA_SERVER = "localhost:9092"; private static final String FOO_CONTROLLER_FILE = FOO_CONTROLLER + "-controller.properties"; @@ -99,25 +108,25 @@ public class RestManagerTest { /* override default port */ final Properties engineProps = PolicyEngineConstants.getManager().defaultTelemetryConfig(); - engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + engineProps.put(PROPERTY_HTTP_SERVER_SERVICES + "." + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME - + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, "" + DEFAULT_TELEMETRY_PORT); - engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + + PROPERTY_HTTP_PORT_SUFFIX, "" + DEFAULT_TELEMETRY_PORT); + engineProps.put(PROPERTY_HTTP_SERVER_SERVICES + "." + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME - + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, + + PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, TELEMETRY_USER); - engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + engineProps.put(PROPERTY_HTTP_SERVER_SERVICES + "." + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME - + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX, + + PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX, TELEMETRY_PASSWORD); - engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + engineProps.put(PROPERTY_HTTP_SERVER_SERVICES + "." + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME - + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, + + PROPERTY_HTTP_SERIALIZATION_PROVIDER, String.join(",", JacksonHandler.class.getName(), YamlJacksonHandler.class.getName())); /* other properties */ - engineProps.put(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS, KAFKA_TOPIC); - engineProps.put(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS, KAFKA_TOPIC); + engineProps.put(PROPERTY_KAFKA_SOURCE_TOPICS, KAFKA_TOPIC); + engineProps.put(PROPERTY_KAFKA_SINK_TOPICS, KAFKA_TOPIC); engineProps.put(KAFKA_SOURCE_SERVER_PROPERTY, KAFKA_SERVER); engineProps.put(KAFKA_SINK_SERVER_PROPERTY, KAFKA_SERVER); @@ -138,8 +147,8 @@ public class RestManagerTest { } Properties noopProperties = new Properties(); - noopProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS, NOOP_TOPIC); - noopProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); + noopProperties.put(PROPERTY_NOOP_SOURCE_TOPICS, NOOP_TOPIC); + noopProperties.put(PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); TopicEndpointManager.getManager().addTopics(noopProperties); } @@ -204,12 +213,12 @@ public class RestManagerTest { putTest(HOST_URL + "/engine/topics/sources/noop/" + NOOP_TOPIC + "/events", 200, "{x:y}", ContentType.TEXT_PLAIN); putTest(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/events", 200, - "FOOOO", ContentType.TEXT_PLAIN); + "FOOOO", ContentType.TEXT_PLAIN); putTest(HOST_URL + "/engine/topics/sources/kafka/fiznits/events", 406, - "FOOOO", ContentType.TEXT_PLAIN); + "FOOOO", ContentType.TEXT_PLAIN); putTest(HOST_URL + "/engine/topics/switches/lock", 200); putTest(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/events", - 406, "FOOOO", ContentType.TEXT_PLAIN); + 406, "FOOOO", ContentType.TEXT_PLAIN); deleteTest(HOST_URL + "/engine/topics/switches/lock", 200); } diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/GsonMgmtTestBuilder.java b/policy-management/src/test/java/org/onap/policy/drools/system/GsonMgmtTestBuilder.java index bf6201b9..bb390972 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/GsonMgmtTestBuilder.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/GsonMgmtTestBuilder.java @@ -3,7 +3,7 @@ * policy-management * ================================================================================ * Copyright (C) 2019 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,9 +27,9 @@ import com.google.gson.TypeAdapterFactory; import com.google.gson.reflect.TypeToken; import com.google.gson.stream.JsonWriter; import java.io.IOException; -import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.http.server.HttpServletServer; +import org.onap.policy.common.message.bus.event.TopicSink; +import org.onap.policy.common.message.bus.event.TopicSource; import org.onap.policy.common.utils.gson.GsonSerializer; import org.onap.policy.common.utils.gson.GsonTestUtilsBuilder; import org.onap.policy.drools.controller.DroolsController; diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java index 138ad9f8..14ca1714 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java @@ -54,14 +54,14 @@ import java.util.function.Consumer; 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.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.http.client.HttpClient; import org.onap.policy.common.endpoints.http.client.HttpClientFactory; import org.onap.policy.common.endpoints.http.server.HttpServletServer; import org.onap.policy.common.endpoints.http.server.HttpServletServerFactory; +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.utils.gson.GsonTestUtils; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.core.lock.Lock; diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java index a1b45de2..4e305872 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java @@ -25,6 +25,7 @@ import static org.awaitility.Awaitility.await; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.common.message.bus.properties.MessageBusProperties.PROPERTY_NOOP_SINK_TOPICS; import static org.onap.policy.drools.system.PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME; import java.io.File; @@ -38,10 +39,10 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.TestMethodOrder; -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.bus.NoopTopicFactories; import org.onap.policy.common.endpoints.properties.PolicyEndPointProperties; +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.noop.NoopTopicFactories; import org.onap.policy.common.utils.gson.GsonTestUtils; import org.onap.policy.drools.persistence.SystemPersistenceConstants; import org.onap.policy.drools.properties.DroolsPropertyConstants; @@ -213,7 +214,7 @@ class PolicyEngineTest { @Test void test350TopicDeliver() { final Properties noopSinkProperties = new Properties(); - noopSinkProperties.put(PolicyEndPointProperties.PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); + noopSinkProperties.put(PROPERTY_NOOP_SINK_TOPICS, NOOP_TOPIC); TopicEndpointManager.getManager().addTopicSinks(noopSinkProperties).get(0).start(); diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java index bc81a3cb..02774e17 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java @@ -43,10 +43,10 @@ import java.util.function.BiConsumer; import java.util.function.Consumer; 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.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.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.utils.gson.GsonTestUtils; import org.onap.policy.drools.controller.DroolsController; import org.onap.policy.drools.controller.DroolsControllerFactory; -- cgit 1.2.3-korg