Fix references and organize dependencies in policy-drools after 50/139350/2
authoradheli.tavares <adheli.tavares@est.tech>
Mon, 4 Nov 2024 13:41:34 +0000 (13:41 +0000)
committeradheli.tavares <adheli.tavares@est.tech>
Thu, 7 Nov 2024 18:40:16 +0000 (18:40 +0000)
splitting policy-endpoints and message-bus in policy-common

Issue-ID: POLICY-5131
Change-Id: I0696fa2d692c794f332491bc15c106baff84a603
Signed-off-by: adheli.tavares <adheli.tavares@est.tech>
48 files changed:
feature-healthcheck/src/test/java/org/onap/policy/drools/healthcheck/RestHealthCheckTest.java
feature-legacy-config/src/main/java/org/onap/policy/drools/legacy/config/LegacyConfig.java
feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigFeatureTest.java
feature-legacy-config/src/test/java/org/onap/policy/drools/legacy/config/LegacyConfigTest.java
feature-legacy-config/src/test/java/org/onap/policy/drools/server/restful/RestLegacyConfigTest.java
feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/LifecycleFsm.java
feature-lifecycle/src/main/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsController.java
feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleFsmUpdateTest.java
feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateActivePoliciesTest.java
feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/LifecycleStateRunningTest.java
feature-lifecycle/src/test/java/org/onap/policy/drools/lifecycle/PolicyTypeNativeDroolsControllerTest.java
feature-lifecycle/src/test/java/org/onap/policy/drools/server/restful/RestLifecycleManagerTest.java
feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeature.java
feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManagerImpl.java
feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/TopicMessageManager.java
feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/EndToEndFeatureTest.java
feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/FeatureTest.java
feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingFeatureTest.java
feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/PoolingManagerImplTest.java
feature-pooling-messages/src/test/java/org/onap/policy/drools/pooling/TopicMessageManagerTest.java
policy-management/pom.xml
policy-management/src/main/java/org/onap/policy/drools/controller/DroolsController.java
policy-management/src/main/java/org/onap/policy/drools/controller/DroolsControllerFactory.java
policy-management/src/main/java/org/onap/policy/drools/controller/IndexedDroolsControllerFactory.java
policy-management/src/main/java/org/onap/policy/drools/controller/internal/MavenDroolsController.java
policy-management/src/main/java/org/onap/policy/drools/controller/internal/NullDroolsController.java
policy-management/src/main/java/org/onap/policy/drools/features/DroolsControllerFeatureApi.java
policy-management/src/main/java/org/onap/policy/drools/features/PolicyControllerFeatureApi.java
policy-management/src/main/java/org/onap/policy/drools/features/PolicyEngineFeatureApi.java
policy-management/src/main/java/org/onap/policy/drools/server/restful/RestManager.java
policy-management/src/main/java/org/onap/policy/drools/system/Main.java
policy-management/src/main/java/org/onap/policy/drools/system/PolicyController.java
policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngine.java
policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineConstants.java
policy-management/src/main/java/org/onap/policy/drools/system/PolicyEngineManager.java
policy-management/src/main/java/org/onap/policy/drools/system/internal/AggregatedPolicyController.java
policy-management/src/test/java/org/onap/policy/drools/controller/internal/MavenDroolsController2Test.java
policy-management/src/test/java/org/onap/policy/drools/features/DroolsControllerFeatureApiTest.java
policy-management/src/test/java/org/onap/policy/drools/features/PolicyControllerFeatureApiTest.java
policy-management/src/test/java/org/onap/policy/drools/features/PolicyEngineFeatureApiTest.java
policy-management/src/test/java/org/onap/policy/drools/protocol/coders/EventProtocolCoderTest.java
policy-management/src/test/java/org/onap/policy/drools/protocol/coders/ProtocolCoderToolsetTest.java
policy-management/src/test/java/org/onap/policy/drools/server/restful/RestManagerTest.java
policy-management/src/test/java/org/onap/policy/drools/server/restful/test/RestManagerTest.java
policy-management/src/test/java/org/onap/policy/drools/system/GsonMgmtTestBuilder.java
policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineManagerTest.java
policy-management/src/test/java/org/onap/policy/drools/system/PolicyEngineTest.java
policy-management/src/test/java/org/onap/policy/drools/system/internal/AggregatedPolicyControllerTest.java

index 63825fa..4e75d31 100644 (file)
@@ -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;
index 7ca4632..6f28226 100644 (file)
@@ -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;
index c837189..85d152f 100644 (file)
@@ -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;
 
index 09e03b3..69d5bf2 100644 (file)
@@ -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 {
index 5180c48..9183403 100644 (file)
@@ -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;
index 7237eb9..6e33490 100644 (file)
@@ -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;
index 6e248e8..8526b98 100644 (file)
@@ -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;
index c24c61c..0a9dd41 100644 (file)
@@ -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();
index 2ed368d..81904b3 100644 (file)
@@ -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));
index c9d1216..a0ad4c3 100644 (file)
@@ -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;
index 29272a0..fe5a3b2 100644 (file)
@@ -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 =
index 8aa3f43..86d58dd 100644 (file)
@@ -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);
index a1368d8..2557917 100644 (file)
@@ -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;
index fec6ba8..e613787 100644 (file)
@@ -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
index 4c9b3f3..b2986e6 100644 (file)
@@ -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;
 
index 1ad5d51..b487762 100644 (file)
@@ -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
         }
index f1b48b3..f4e7437 100644 (file)
@@ -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;
index 1eb9e36..f288767 100644 (file)
@@ -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;
index 9830068..65b52eb 100644 (file)
@@ -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;
index 7409848..82fe3a8 100644 (file)
@@ -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 {
 
index c2a3b37..05cabea 100644 (file)
                                 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
                             </importMappings>
                             <typeMappings>
             <artifactId>policy-domains</artifactId>
             <version>${project.version}</version>
         </dependency>
-
+        <dependency>
+            <groupId>org.onap.policy.common</groupId>
+            <artifactId>message-bus</artifactId>
+            <version>${policy.common.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.onap.policy.common</groupId>
             <artifactId>policy-endpoints</artifactId>
index 27a3289..2afce99 100644 (file)
@@ -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);
 
index a355f6f..a3939c4 100644 (file)
@@ -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;
 
 /**
index a6459d6..5829d49 100644 (file)
 
 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<? extends TopicSource> eventSources,
-            List<? extends TopicSink> eventSinks) throws LinkageError {
+                                  List<? extends TopicSink> eventSinks) throws LinkageError {
 
         String groupId = properties.getProperty(DroolsPropertyConstants.RULES_GROUPID);
         if (StringUtils.isBlank(groupId)) {
@@ -103,13 +110,13 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory {
         List<TopicCoderFilterConfiguration> 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<TopicCoderFilterConfiguration> decoderConfigurations,
-            List<TopicCoderFilterConfiguration> encoderConfigurations) throws LinkageError {
+                                  List<TopicCoderFilterConfiguration> decoderConfigurations,
+                                  List<TopicCoderFilterConfiguration> 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<TopicCoderFilterConfiguration> decoderConfigurations,
-                    List<TopicCoderFilterConfiguration> encoderConfigurations) {
+                                                 String newVersion,
+                                                 List<TopicCoderFilterConfiguration> decoderConfigurations,
+                                                 List<TopicCoderFilterConfiguration> 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<TopicCoderFilterConfiguration> codersAndFilters(Properties properties,
-            List<? extends Topic> topicEntities) {
+                                                                   List<? extends Topic> topicEntities) {
 
         List<TopicCoderFilterConfiguration> 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<PotentialCoderFilter> 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<PotentialCoderFilter> getFilterExpressions(Properties properties, String propertyPrefix,
-                    @NonNull String eventClasses) {
+                                                            @NonNull String eventClasses) {
 
         List<PotentialCoderFilter> 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);
index aa701df..82d1877 100644 (file)
@@ -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;
index 5ac1d6d..9730247 100644 (file)
@@ -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;
index bb11bb6..d7ca045 100644 (file)
@@ -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;
index 15b48a5..2036eec 100644 (file)
@@ -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;
index 27b9699..d5e1dc6 100644 (file)
@@ -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;
index 503ba33..1d08af2 100644 (file)
@@ -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;
index f0530d0..a8dd5c2 100644 (file)
@@ -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;
index 931e8a5..04d8814 100644 (file)
@@ -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);
 
index 3fc2e29..d755932 100644 (file)
@@ -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);
 
index 9a762c0..9781c75 100644 (file)
@@ -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.
      */
index dbcb791..580d424 100644 (file)
@@ -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;
index 2c85c26..2a0c582 100644 (file)
@@ -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;
index fdbfab8..877489d 100644 (file)
@@ -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;
index 83171da..55520ec 100644 (file)
@@ -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;
 
 /**
index f48bf93..5760a6b 100644 (file)
@@ -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;
index 90feeb2..94024ae 100644 (file)
@@ -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;
index c98467e..27b67c4 100644 (file)
@@ -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);
 
index cb4397c..4df04d9 100644 (file)
@@ -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<TopicSink> 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;
     }
index 89cce09..7e53593 100644 (file)
@@ -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;
index 1ceff3d..cb92b2e 100644 (file)
 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);
     }
 
index bf6201b..bb39097 100644 (file)
@@ -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;
index 138ad9f..14ca171 100644 (file)
@@ -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;
index a1b45de..4e30587 100644 (file)
@@ -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();
 
index bc81a3c..02774e1 100644 (file)
@@ -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;