diff options
70 files changed, 570 insertions, 882 deletions
diff --git a/feature-distributed-locking/pom.xml b/feature-distributed-locking/pom.xml index b86a2bfc..9210620e 100644 --- a/feature-distributed-locking/pom.xml +++ b/feature-distributed-locking/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>feature-distributed-locking</artifactId> diff --git a/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java b/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java index 74a3c761..2e173cf0 100644 --- a/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java +++ b/feature-distributed-locking/src/test/java/org/onap/policy/distributed/locking/DistributedLockManagerTest.java @@ -48,7 +48,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import java.io.Serial; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; @@ -967,7 +966,6 @@ class DistributedLockManagerTest { protected DistributedLock makeLock(LockState state, String resourceId, String ownerKey, int holdSec, LockCallback callback) { return new DistributedLock(state, resourceId, ownerKey, holdSec, callback, feature) { - @Serial private static final long serialVersionUID = 1L; @Override @@ -1352,7 +1350,6 @@ class DistributedLockManagerTest { protected DistributedLock makeLock(LockState state, String resourceId, String ownerKey, int holdSec, LockCallback callback) { return new DistributedLock(state, resourceId, ownerKey, holdSec, callback, feature) { - @Serial private static final long serialVersionUID = 1L; private int ntimes = 0; @@ -1721,7 +1718,6 @@ class DistributedLockManagerTest { LockCallback callback) { return new DistributedLock(state, resourceId, ownerKey, holdSec, callback, feature) { - @Serial private static final long serialVersionUID = 1L; private boolean checked = false; diff --git a/feature-healthcheck/pom.xml b/feature-healthcheck/pom.xml index 77b29ac7..863c9f95 100644 --- a/feature-healthcheck/pom.xml +++ b/feature-healthcheck/pom.xml @@ -3,7 +3,7 @@ ONAP ================================================================================ Copyright (C) 2017-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. @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>feature-healthcheck</artifactId> @@ -38,6 +38,7 @@ <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> diff --git a/feature-legacy-config/pom.xml b/feature-legacy-config/pom.xml index 1639b55d..390d177a 100644 --- a/feature-legacy-config/pom.xml +++ b/feature-legacy-config/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>feature-legacy-config</artifactId> diff --git a/feature-legacy-config/src/main/feature/config/feature-legacy-config.properties b/feature-legacy-config/src/main/feature/config/feature-legacy-config.properties index 47a4e229..9cb73c58 100644 --- a/feature-legacy-config/src/main/feature/config/feature-legacy-config.properties +++ b/feature-legacy-config/src/main/feature/config/feature-legacy-config.properties @@ -17,7 +17,7 @@ # limitations under the License. # ============LICENSE_END========================================================= -kafka.source.topics=pdpd-configuration +kafka.source.topics=${envd:PDPD_CONFIGURATION_TOPIC} kafka.source.topics.fetchTimeout=15000 kafka.source.topics.pdpd-configuration.servers=${envd:KAFKA_SERVERS} kafka.source.topics.pdpd-configuration.effectiveTopic=${envd:PDPD_CONFIGURATION_TOPIC} @@ -26,4 +26,4 @@ kafka.source.topics.pdpd-configuration.apiSecret=${envd:PDPD_CONFIGURATION_API_S kafka.source.topics.pdpd-configuration.consumerGroup=${envd:PDPD_CONFIGURATION_CONSUMER_GROUP} kafka.source.topics.pdpd-configuration.consumerInstance=${envd:PDPD_CONFIGURATION_CONSUMER_INSTANCE} kafka.source.topics.pdpd-configuration.managed=false -kafka.source.topics.pdpd-configuration.https=${envd:KAFKA_HTTPS:true} +kafka.source.topics.pdpd-configuration.https=${envd:KAFKA_HTTPS:false} diff --git a/feature-lifecycle/pom.xml b/feature-lifecycle/pom.xml index 5aea16be..29d4eb5f 100644 --- a/feature-lifecycle/pom.xml +++ b/feature-lifecycle/pom.xml @@ -3,7 +3,7 @@ ONAP ================================================================================ Copyright (C) 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 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>feature-lifecycle</artifactId> @@ -37,6 +37,7 @@ <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> @@ -111,7 +112,10 @@ <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> </dependency> - + <dependency> + <groupId>io.prometheus</groupId> + <artifactId>simpleclient_hotspot</artifactId> + </dependency> </dependencies> </project> diff --git a/feature-lifecycle/src/main/feature/config/feature-lifecycle.properties b/feature-lifecycle/src/main/feature/config/feature-lifecycle.properties index 06fa87e5..4a60650c 100644 --- a/feature-lifecycle/src/main/feature/config/feature-lifecycle.properties +++ b/feature-lifecycle/src/main/feature/config/feature-lifecycle.properties @@ -23,17 +23,17 @@ lifecycle.pdp.type=${envd:POLICY_PDP_PAP_TYPE:drools} # Mandatory policy types that this PDP-D must support at a minimum lifecycle.pdp.policytypes=${envd:POLICY_PDP_PAP_POLICYTYPES} -kafka.source.topics=POLICY-PDP-PAP -kafka.sink.topics=POLICY-PDP-PAP +kafka.source.topics=${envd:POLICY_PDP_PAP_TOPIC} +kafka.sink.topics=${envd:POLICY_PDP_PAP_TOPIC} -kafka.source.topics.POLICY-PDP-PAP.servers=${envd:KAFKA_SERVERS} -kafka.source.topics.POLICY-PDP-PAP.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC} -kafka.source.topics.POLICY-PDP-PAP.apiKey=${envd:POLICY_PDP_PAP_API_KEY} -kafka.source.topics.POLICY-PDP-PAP.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET} -kafka.source.topics.POLICY-PDP-PAP.https=${envd:KAFKA_HTTPS:true} +kafka.source.topics.policy-pdp-pap.servers=${envd:KAFKA_SERVERS} +kafka.source.topics.policy-pdp-pap.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC} +kafka.source.topics.policy-pdp-pap.apiKey=${envd:POLICY_PDP_PAP_API_KEY} +kafka.source.topics.policy-pdp-pap.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET} +kafka.source.topics.policy-pdp-pap.https=${envd:KAFKA_HTTPS:false} -kafka.sink.topics.POLICY-PDP-PAP.servers=${envd:KAFKA_SERVERS} -kafka.sink.topics.POLICY-PDP-PAP.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC} -kafka.sink.topics.POLICY-PDP-PAP.apiKey=${envd:POLICY_PDP_PAP_API_KEY} -kafka.sink.topics.POLICY-PDP-PAP.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET} -kafka.sink.topics.POLICY-PDP-PAP.https=${envd:KAFKA_HTTPS:true} +kafka.sink.topics.policy-pdp-pap.servers=${envd:KAFKA_SERVERS} +kafka.sink.topics.policy-pdp-pap.effectiveTopic=${envd:POLICY_PDP_PAP_TOPIC} +kafka.sink.topics.policy-pdp-pap.apiKey=${envd:POLICY_PDP_PAP_API_KEY} +kafka.sink.topics.policy-pdp-pap.apiSecret=${envd:POLICY_PDP_PAP_API_SECRET} +kafka.sink.topics.policy-pdp-pap.https=${envd:KAFKA_HTTPS:false} 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 e7656ae6..7237eb91 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 @@ -283,7 +283,8 @@ public class LifecycleFsm implements Startable { policyTypesMap.values().stream() .filter(PolicyTypeDroolsController.class::isInstance) .map(PolicyTypeDroolsController.class::cast) - .filter(opController -> opController.getControllers().containsKey(controller.getName())).toList(); + .filter(opController -> opController.getControllers().containsKey(controller.getName())) + .collect(Collectors.toList()); for (PolicyTypeDroolsController opController : opControllers) { opController.remove(controller); diff --git a/feature-no-locking/pom.xml b/feature-no-locking/pom.xml index fe88cb3c..69d2d941 100644 --- a/feature-no-locking/pom.xml +++ b/feature-no-locking/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>feature-no-locking</artifactId> diff --git a/feature-pooling-messages/pom.xml b/feature-pooling-messages/pom.xml index 9270dcca..e0c1fb61 100644 --- a/feature-pooling-messages/pom.xml +++ b/feature-pooling-messages/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>feature-pooling-messages</artifactId> diff --git a/feature-pooling-messages/src/main/feature/config/feature-pooling-messages.properties b/feature-pooling-messages/src/main/feature/config/feature-pooling-messages.properties index 925d1698..8497538e 100644 --- a/feature-pooling-messages/src/main/feature/config/feature-pooling-messages.properties +++ b/feature-pooling-messages/src/main/feature/config/feature-pooling-messages.properties @@ -72,18 +72,18 @@ # be enabled at the same time. pooling.usecases.enabled=true -pooling.usecases.topic=${env:POOLING_TOPIC} +pooling.usecases.topic=${envd:POOLING_TOPIC} # the list of sources and sinks should be identical -kafka.source.topics=POOLING_TOPIC -kafka.sink.topics=POOLING_TOPIC - -kafka.source.topics.POOLING_TOPIC.servers=${env:KAFKA_SERVERS} -kafka.source.topics.POOLING_TOPIC.effectiveTopic=${env:POOLING_TOPIC} -kafka.source.topics.POOLING_TOPIC.apiKey= -kafka.source.topics.POOLING_TOPIC.apiSecret= - -kafka.sink.topics.POOLING_TOPIC.servers=${env:kafka_SERVERS} -kafka.sink.topics.POOLING_TOPIC.effectiveTopic=${env:POOLING_TOPIC} -kafka.sink.topics.POOLING_TOPIC.apiKey= -kafka.sink.topics.POOLING_TOPIC.apiSecret= +kafka.source.topics=${envd:POOLING_TOPIC} +kafka.sink.topics=${envd:POOLING_TOPIC} + +kafka.source.topics.policy-pdp-pooling.servers=${envd:KAFKA_SERVERS} +kafka.source.topics.policy-pdp-pooling.effectiveTopic=${envd:POOLING_TOPIC} +kafka.source.topics.policy-pdp-pooling.apiKey= +kafka.source.topics.policy-pdp-pooling.apiSecret= + +kafka.sink.topics.policy-pdp-pooling.servers=${envd:KAFKA_SERVERS} +kafka.sink.topics.policy-pdp-pooling.effectiveTopic=${envd:POOLING_TOPIC} +kafka.sink.topics.policy-pdp-pooling.apiKey= +kafka.sink.topics.policy-pdp-pooling.apiSecret= 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 6411dd81..a1368d8c 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 @@ -52,7 +52,7 @@ import org.slf4j.LoggerFactory; * hosts, instead of all running on a single, active host. * * <p>With each controller, there is an - * associated DMaaP topic that is used for internal communication between the different hosts + * associated topic that is used for internal communication between the different hosts * serving the controller. */ public class PoolingFeature implements PolicyEngineFeatureApi, PolicyControllerFeatureApi, DroolsControllerFeatureApi { diff --git a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeatureException.java b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeatureException.java index 5d7b9f76..eafa0a7b 100644 --- a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeatureException.java +++ b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeatureException.java @@ -21,13 +21,10 @@ package org.onap.policy.drools.pooling; -import java.io.Serial; - /** * Exception thrown by the pooling feature. */ public class PoolingFeatureException extends Exception { - @Serial private static final long serialVersionUID = 1L; public PoolingFeatureException() { diff --git a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeatureRtException.java b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeatureRtException.java index 5d0a2755..46b71979 100644 --- a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeatureRtException.java +++ b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingFeatureRtException.java @@ -21,13 +21,10 @@ package org.onap.policy.drools.pooling; -import java.io.Serial; - /** * A runtime exception thrown by the pooling feature. */ public class PoolingFeatureRtException extends RuntimeException { - @Serial private static final long serialVersionUID = 1L; public PoolingFeatureRtException() { diff --git a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManager.java b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManager.java index 5e358e61..20f51023 100644 --- a/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManager.java +++ b/feature-pooling-messages/src/main/java/org/onap/policy/drools/pooling/PoolingManager.java @@ -46,10 +46,10 @@ public interface PoolingManager { String getHost(); /** - * Gets the name of the internal DMaaP topic used by this manager to communicate with + * Gets the name of the internal topic used by this manager to communicate with * its other hosts. * - * @return the name of the internal DMaaP topic + * @return the name of the internal topic */ String getTopic(); 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 7c0436eb..fec6ba81 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 @@ -91,13 +91,13 @@ public class PoolingManagerImpl implements PoolingManager, TopicListener { private final Serializer serializer; /** - * Internal DMaaP topic used by this controller. + * Internal topic used by this controller. */ @Getter private final String topic; /** - * Manager for the internal DMaaP topic. + * Manager for the internal topic. */ private final TopicMessageManager topicMessageManager; @@ -157,7 +157,7 @@ public class PoolingManagerImpl implements PoolingManager, TopicListener { throw new PoolingFeatureRtException(e); } catch (PoolingFeatureException e) { - logger.error("failed to attach internal DMaaP topic to controller {}", controller.getName()); + logger.error("failed to attach internal topic to controller {}", controller.getName()); throw new PoolingFeatureRtException(e); } } @@ -598,9 +598,9 @@ public class PoolingManagerImpl implements PoolingManager, TopicListener { } /** - * Creates a DMaaP manager. + * Creates a topic manager. * - * @param topic name of the internal DMaaP topic + * @param topic name of the internal topic * @return a new topic messages manager * @throws PoolingFeatureException if an error occurs */ 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 31ad207c..1ad5d513 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 @@ -64,11 +64,11 @@ import org.slf4j.LoggerFactory; /** * End-to-end tests of the pooling feature. Launches one or more "hosts", each one having its own - * feature object. Uses real feature objects, as well as real DMaaP sources and sinks. However, the + * feature object. Uses real feature objects, as well as real sources and sinks. However, the * following are not: <dl> <dt>PolicyEngine, PolicyController, DroolsController</dt> <dd>mocked</dd> * </dl> * - * <p>The following fields must be set before executing this: <ul> <li>UEB_SERVERS</li> + * <p>The following fields must be set before executing this: <ul> <li>SERVER</li> * <li>INTERNAL_TOPIC</li> <li>EXTERNAL_TOPIC</li> </ul> */ public class EndToEndFeatureTest { @@ -76,9 +76,9 @@ public class EndToEndFeatureTest { private static final Logger logger = LoggerFactory.getLogger(EndToEndFeatureTest.class); /** - * UEB servers for both internal & external topics. + * KAFKA servers for both internal & external topics. */ - private static final String UEB_SERVERS = "ueb-server"; + private static final String SERVER = "localhost:9092"; /** * Name of the topic used for inter-host communication. @@ -101,7 +101,7 @@ public class EndToEndFeatureTest { private static final String CONTROLLER1 = "controller.one"; /** - * Maximum number of items to fetch from DMaaP in a single poll. + * Maximum number of items to fetch from Kafka in a single poll. */ private static final String FETCH_LIMIT = "5"; @@ -124,12 +124,12 @@ public class EndToEndFeatureTest { private static final ThreadLocal<Host> currentHost = new ThreadLocal<Host>(); /** - * Sink for external DMaaP topic. + * Sink for external Kafka topic. */ private static TopicSink externalSink; /** - * Sink for internal DMaaP topic. + * Sink for internal Kafka topic. */ private static TopicSink internalSink; @@ -237,13 +237,13 @@ public class EndToEndFeatureTest { private static Properties makeSinkProperties(String topic) { Properties props = new Properties(); - props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS, topic); + props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS, topic); - props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX, UEB_SERVERS); - props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_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_UEB_SINK_TOPICS + "." + topic + props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false"); return props; @@ -252,18 +252,18 @@ public class EndToEndFeatureTest { private static Properties makeSourceProperties(String topic) { Properties props = new Properties(); - props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS, topic); + props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS, topic); - props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "." + topic - + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX, UEB_SERVERS); - props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_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_UEB_SOURCE_TOPICS + "." + topic + props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_MANAGED_SUFFIX, "false"); if (EXTERNAL_TOPIC.equals(topic)) { // consumer group is a constant - props.setProperty(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "." + topic + props.setProperty(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS + "." + topic + PolicyEndPointProperties.PROPERTY_TOPIC_SOURCE_CONSUMER_GROUP_SUFFIX, EXTERNAL_GROUP); // consumer instance is generated by the BusConsumer code @@ -348,14 +348,14 @@ public class EndToEndFeatureTest { * Starts the hosts. */ public void startHosts() { - hosts.forEach(host -> host.start()); + hosts.forEach(Host::start); } /** * Stops the hosts. */ public void stopHosts() { - hosts.forEach(host -> host.stop()); + hosts.forEach(Host::stop); } /** @@ -489,10 +489,10 @@ public class EndToEndFeatureTest { when(controller.getName()).thenReturn(CONTROLLER1); when(controller.getDrools()).thenReturn(drools); - externalSource = TopicEndpointManager.getManager().addTopicSources(makeSourceProperties(EXTERNAL_TOPIC)) - .get(0); - internalSource = TopicEndpointManager.getManager().addTopicSources(makeSourceProperties(INTERNAL_TOPIC)) - .get(0); + externalSource = TopicEndpointManager.getManager() + .addTopicSources(makeSourceProperties(EXTERNAL_TOPIC)).get(0); + internalSource = TopicEndpointManager.getManager() + .addTopicSources(makeSourceProperties(INTERNAL_TOPIC)).get(0); // stop consuming events if the controller stops when(controller.stop()).thenAnswer(args -> { @@ -520,8 +520,8 @@ public class EndToEndFeatureTest { } /** - * Starts threads for the host so that it begins consuming from both the external "DMaaP" - * topic and its own internal "DMaaP" topic. + * Starts threads for the host so that it begins consuming from both the external + * topic and its own internal topic. */ public void start() { feature.beforeStart(engine); @@ -646,7 +646,7 @@ public class EndToEndFeatureTest { if (!host.beforeInsert(fact)) { // feature did not handle it so we handle it here - host.afterInsert(fact, result); + host.afterInsert(fact, true); host.sawMessage(); context.addEvent(); @@ -775,7 +775,7 @@ public class EndToEndFeatureTest { } /** - * DMaaP Manager with overrides. + * TopicManager with overrides. */ private static class TopicMessageManagerImpl extends TopicMessageManager { 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 e9bd3cb5..f1b48b3e 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 @@ -68,7 +68,6 @@ import org.slf4j.LoggerFactory; * End-to-end tests of the pooling feature. Launches one or more "hosts", each one having * its own feature object. Uses real feature objects. However, the following are not: * <dl> - * <dt>DMaaP sources and sinks</dt> * <dd>simulated using queues. There is one queue for the external topic, and one queue * for each host's internal topic. Messages published to the "admin" channel are simply * sent to all of the hosts' internal topic queues</dd> @@ -430,13 +429,13 @@ class FeatureTest { private final AtomicBoolean sawMsg = new AtomicBoolean(false); /** - * This host's internal "DMaaP" topic. + * This host's internal topic. */ private final BlockingQueue<String> msgQueue = new LinkedBlockingQueue<>(); /** - * Queue for the external "DMaaP" topic. + * Queue for the external topic. */ @Getter private final BlockingQueue<String> externalTopic = new LinkedBlockingQueue<String>(); @@ -486,7 +485,7 @@ class FeatureTest { /** * Starts threads for the host so that it begins consuming from both the external - * "DMaaP" topic and its own internal "DMaaP" topic. + * topic and its own internal topic. */ public void start() { @@ -794,7 +793,7 @@ class FeatureTest { if (msg == null) { return; } - listener.onTopicEvent(CommInfrastructure.UEB, topic, msg); + listener.onTopicEvent(CommInfrastructure.KAFKA, topic, msg); } } } @@ -987,7 +986,7 @@ class FeatureTest { } /** - * DMaaP Manager with overrides. + * TopicManager with overrides. */ private static class TopicMessageManagerImpl extends TopicMessageManager { 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 1b05e021..1eb9e361 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 @@ -298,7 +298,7 @@ class PoolingFeatureTest { @Test void testBeforeOffer() { - assertFalse(pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1)); + assertFalse(pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1)); verify(mgr1).beforeOffer(TOPIC1, EVENT1); // ensure that the args were captured @@ -307,7 +307,7 @@ class PoolingFeatureTest { // ensure it's still in the map by re-invoking - assertFalse(pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC2, EVENT2)); + assertFalse(pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC2, EVENT2)); verify(mgr1).beforeOffer(TOPIC2, EVENT2); // ensure that the new args were captured @@ -315,12 +315,12 @@ class PoolingFeatureTest { verify(mgr1).beforeInsert(TOPIC2, OBJECT2); - assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC1, EVENT1)); + assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC1, EVENT1)); } @Test void testBeforeOffer_NotFound() { - assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC1, EVENT1)); + assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC1, EVENT1)); } @Test @@ -329,28 +329,28 @@ class PoolingFeatureTest { // manager will return true when(mgr1.beforeOffer(any(), any())).thenReturn(true); - assertTrue(pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1)); + assertTrue(pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1)); verify(mgr1).beforeOffer(TOPIC1, EVENT1); // ensure it's still in the map by re-invoking - assertTrue(pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC2, EVENT2)); + assertTrue(pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC2, EVENT2)); verify(mgr1).beforeOffer(TOPIC2, EVENT2); - assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC1, EVENT1)); + assertFalse(pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC1, EVENT1)); } @Test void testBeforeInsert() { - pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1); + pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1); assertFalse(pool.beforeInsert(drools1, OBJECT1)); verify(mgr1).beforeInsert(TOPIC1, OBJECT1); // ensure it's still in the map by re-invoking - pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC2, EVENT2); + pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC2, EVENT2); assertFalse(pool.beforeInsert(drools1, OBJECT2)); verify(mgr1).beforeInsert(TOPIC2, OBJECT2); - pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC2, EVENT2); + pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC2, EVENT2); assertFalse(pool.beforeInsert(droolsDisabled, OBJECT1)); } @@ -375,7 +375,7 @@ class PoolingFeatureTest { } }; - pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1); + pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1); assertFalse(pool.beforeInsert(drools1, OBJECT1)); verify(mgr1, never()).beforeInsert(any(), any()); } @@ -390,7 +390,7 @@ class PoolingFeatureTest { } }; - pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1); + pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1); assertFalse(pool.beforeInsert(drools1, OBJECT1)); verify(mgr1, never()).beforeInsert(any(), any()); } @@ -406,7 +406,7 @@ class PoolingFeatureTest { } }; - pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1); + pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1); assertFalse(pool.beforeInsert(drools1, OBJECT1)); verify(mgr1, never()).beforeInsert(any(), any()); } @@ -414,17 +414,17 @@ class PoolingFeatureTest { @Test void testBeforeInsert_NotFound() { - pool.beforeOffer(controllerDisabled, CommInfrastructure.UEB, TOPIC2, EVENT2); + pool.beforeOffer(controllerDisabled, CommInfrastructure.KAFKA, TOPIC2, EVENT2); assertFalse(pool.beforeInsert(droolsDisabled, OBJECT1)); } @Test void testAfterOffer() { // this will create OfferArgs - pool.beforeOffer(controller1, CommInfrastructure.UEB, TOPIC1, EVENT1); + pool.beforeOffer(controller1, CommInfrastructure.KAFKA, TOPIC1, EVENT1); // this should clear them - assertFalse(pool.afterOffer(controller1, CommInfrastructure.UEB, TOPIC2, EVENT2, true)); + assertFalse(pool.afterOffer(controller1, CommInfrastructure.KAFKA, TOPIC2, EVENT2, true)); assertFalse(pool.beforeInsert(drools1, OBJECT1)); verify(mgr1, never()).beforeInsert(any(), any()); 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 ac60ae27..98300683 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 @@ -37,6 +37,7 @@ import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.LinkedList; +import java.util.Objects; import java.util.Properties; import java.util.Queue; import java.util.concurrent.CountDownLatch; @@ -504,7 +505,7 @@ class PoolingManagerImplTest { } @Test - void testOnTopicEvent() throws Exception { + void testOnTopicEvent() { startMgr(); StartState st = (StartState) mgr.getCurrent(); @@ -517,16 +518,16 @@ class PoolingManagerImplTest { String msg = ser.encodeMsg(hb); - mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, msg); + mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg); assertInstanceOf(QueryState.class, mgr.getCurrent()); } @Test - void testOnTopicEvent_NullEvent() throws Exception { + void testOnTopicEvent_NullEvent() { startMgr(); - assertThatCode(() -> mgr.onTopicEvent(CommInfrastructure.UEB, TOPIC2, null)).doesNotThrowAnyException(); + assertThatCode(() -> mgr.onTopicEvent(CommInfrastructure.KAFKA, TOPIC2, null)).doesNotThrowAnyException(); } @Test @@ -563,12 +564,12 @@ class PoolingManagerImplTest { @Test void testHandleExternalCommInfrastructureStringStringString_NullReqId() throws Exception { - validateHandleReqId(null); + validateHandleReqId(); } @Test void testHandleExternalCommInfrastructureStringStringString_EmptyReqId() throws Exception { - validateHandleReqId(""); + validateHandleReqId(); } @Test @@ -717,7 +718,7 @@ class PoolingManagerImplTest { String msg = ser.encodeMsg(hb); - mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, msg); + mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg); assertInstanceOf(QueryState.class, mgr.getCurrent()); } @@ -726,7 +727,7 @@ class PoolingManagerImplTest { void testHandleInternal_IoEx() throws Exception { startMgr(); - mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, "invalid message"); + mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, "invalid message"); assertInstanceOf(StartState.class, mgr.getCurrent()); } @@ -746,7 +747,7 @@ class PoolingManagerImplTest { String msg = ser.encodeMsg(hb); - mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, msg); + mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg); assertInstanceOf(StartState.class, mgr.getCurrent()); } @@ -859,7 +860,7 @@ class PoolingManagerImplTest { String msg = ser.encodeMsg(hb); - mgr.onTopicEvent(CommInfrastructure.UEB, MY_TOPIC, msg); + mgr.onTopicEvent(CommInfrastructure.KAFKA, MY_TOPIC, msg); assertInstanceOf(QueryState.class, mgr.getCurrent()); @@ -870,7 +871,7 @@ class PoolingManagerImplTest { assertEquals(1, latch.getCount()); } - private void validateHandleReqId(String requestId) throws PoolingFeatureException { + private void validateHandleReqId() { startMgr(); assertFalse(mgr.beforeInsert(TOPIC2, DECODED_EVENT)); @@ -887,7 +888,7 @@ class PoolingManagerImplTest { verify(topicMessageManager, times(START_PUB)).publish(any()); } - private void validateUnhandled() throws PoolingFeatureException { + private void validateUnhandled() { startMgr(); assertFalse(mgr.beforeInsert(TOPIC2, DECODED_EVENT)); } @@ -985,7 +986,7 @@ class PoolingManagerImplTest { @Override protected Object decodeEventWrapper(DroolsController drools2, String topic2, String event) { - if (drools2 == drools && TOPIC2.equals(topic2) && event == THE_EVENT) { + if (drools2 == drools && TOPIC2.equals(topic2) && Objects.equals(event, THE_EVENT)) { return DECODED_EVENT; } else { return null; diff --git a/feature-test-transaction/pom.xml b/feature-test-transaction/pom.xml index c287f818..02ed52d8 100644 --- a/feature-test-transaction/pom.xml +++ b/feature-test-transaction/pom.xml @@ -25,7 +25,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>feature-test-transaction</artifactId> diff --git a/packages/base/pom.xml b/packages/base/pom.xml index a681eae8..35815b1f 100644 --- a/packages/base/pom.xml +++ b/packages/base/pom.xml @@ -27,7 +27,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-packages</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>base</artifactId> diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index f3a1aa68..4715cc99 100644 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -28,7 +28,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-packages</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>docker</artifactId> diff --git a/packages/docker/pom.xml.versionsBackup b/packages/docker/pom.xml.versionsBackup new file mode 100644 index 00000000..f3a1aa68 --- /dev/null +++ b/packages/docker/pom.xml.versionsBackup @@ -0,0 +1,160 @@ +<!-- + ============LICENSE_START======================================================= + ONAP Policy Engine - Docker files + ================================================================================ + Copyright (C) 2017-2018, 2021 AT&T Intellectual Property. All rights reserved. + Modifications Copyright (C) 2019-2020 Bell Canada. + Modifications Copyright (C) 2022-2023 Nordix Foundation. + ================================================================================ + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + ============LICENSE_END========================================================= + --> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.onap.policy.drools-pdp</groupId> + <artifactId>drools-packages</artifactId> + <version>2.1.2-SNAPSHOT</version> + </parent> + + <artifactId>docker</artifactId> + <packaging>pom</packaging> + <name>Policy Drools PDP - Docker build</name> + <description>ONAP Policy Drools PDP Docker Build</description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> + <dist.project.version>${project.version}</dist.project.version> + <docker.skip>false</docker.skip> + <docker.skip.build>false</docker.skip.build> + <docker.skip.push>false</docker.skip.push> + <docker.skip.deployconfig>true</docker.skip.deployconfig> + <docker.contextDir>${project.basedir}/src/main/docker</docker.contextDir> + <maven.build.timestamp.format>yyyyMMdd'T'HHmm</maven.build.timestamp.format> + <docker.buildArg.BUILD_VERSION_DROOLS>${project.version}</docker.buildArg.BUILD_VERSION_DROOLS> + <docker.buildArg.MVN_SNAPSHOT_REPO_URL>${nexusproxy}/${snapshots.path}</docker.buildArg.MVN_SNAPSHOT_REPO_URL> + <docker.buildArg.MVN_RELEASE_REPO_URL>${nexusproxy}/${releases.path}</docker.buildArg.MVN_RELEASE_REPO_URL> + </properties> + + <build> + <finalName>${project.artifactId}-${project.version}</finalName> + <plugins> + <plugin> + <groupId>org.codehaus.gmaven</groupId> + <artifactId>groovy-maven-plugin</artifactId> + <executions> + <execution> + <phase>validate</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <source>https://github.com/onap/policy-docker/raw/master/utils/groovy/docker-tag.groovy</source> + </configuration> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>io.github.git-commit-id</groupId> + <artifactId>git-commit-id-maven-plugin</artifactId> + </plugin> + + <plugin> + <groupId>io.fabric8</groupId> + <artifactId>docker-maven-plugin</artifactId> + <configuration> + <verbose>true</verbose> + <apiVersion>1.23</apiVersion> + <pullRegistry>${docker.pull.registry}</pullRegistry> + <pushRegistry>${docker.push.registry}</pushRegistry> + <images> + <image> + <name>onap/policy-drools</name> + <build> + <cleanup>try</cleanup> + <dockerFile>${dockerFile}</dockerFile> + <contextDir>${docker.contextDir}</contextDir> + <tags> + <tag>${project.version}</tag> + <tag>${project.version}-${maven.build.timestamp}</tag> + <tag>${project.docker.latest.minmax.tag.version}</tag> + </tags> + <assembly> + <inline> + <dependencySets> + <dependencySet> + <includes> + <include>org.onap.policy.drools-pdp:install-drools</include> + </includes> + <outputDirectory>.</outputDirectory> + <outputFileNameMapping>install-drools.zip</outputFileNameMapping> + </dependencySet> + </dependencySets> + </inline> + </assembly> + </build> + </image> + </images> + </configuration> + <executions> + <execution> + <id>clean-images</id> + <phase>pre-clean</phase> + <goals> + <goal>remove</goal> + </goals> + <configuration> + <removeAll>true</removeAll> + </configuration> + </execution> + <execution> + <id>generate-images</id> + <phase>generate-sources</phase> + <goals> + <goal>build</goal> + </goals> + </execution> + <execution> + <id>push-images</id> + <phase>deploy</phase> + <goals> + <goal>build</goal> + <goal>push</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <configuration> + <skip>${docker.skip.deployconfig}</skip> + </configuration> + </plugin> + </plugins> + </build> + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>install-drools</artifactId> + <version>${project.version}</version> + <type>zip</type> + </dependency> + </dependencies> +</project> diff --git a/packages/docker/src/main/docker/Dockerfile b/packages/docker/src/main/docker/Dockerfile index 193f4365..40e81a8d 100644 --- a/packages/docker/src/main/docker/Dockerfile +++ b/packages/docker/src/main/docker/Dockerfile @@ -19,7 +19,7 @@ # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= #------------------------------------------------------------------------------- -FROM onap/policy-jdk-alpine:3.1.2-SNAPSHOT +FROM onap/policy-jdk-alpine:3.1.3-SNAPSHOT LABEL maintainer="Policy Team" LABEL org.opencontainers.image.title="Policy Drools PDP" diff --git a/packages/install/pom.xml b/packages/install/pom.xml index 39868675..9454187b 100644 --- a/packages/install/pom.xml +++ b/packages/install/pom.xml @@ -29,7 +29,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-packages</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>install-drools</artifactId> diff --git a/packages/install/src/files/base.conf b/packages/install/src/files/base.conf index 3b447647..a0bacfa3 100644 --- a/packages/install/src/files/base.conf +++ b/packages/install/src/files/base.conf @@ -138,10 +138,10 @@ DCAE_TOPIC= DCAE_SERVERS= DCAE_CONSUMER_GROUP= -# Open DMaaP +# Kafka -# DMAAP_SERVERS= -# DMAAP_HTTPS=true +KAFKA_SERVERS= +KAFKA_HTTPS=false # AAI diff --git a/packages/install/src/files/feature-pooling-messages.conf b/packages/install/src/files/feature-pooling-messages.conf index 0ef81951..eb5a5434 100644 --- a/packages/install/src/files/feature-pooling-messages.conf +++ b/packages/install/src/files/feature-pooling-messages.conf @@ -17,4 +17,4 @@ # limitations under the License. # ============LICENSE_END========================================================= ### -POOLING_TOPIC=POLICY-PDP-POOLING +POOLING_TOPIC=policy-pdp-pooling diff --git a/packages/install/src/files/policy-management.conf b/packages/install/src/files/policy-management.conf index 12ad0f43..b44bc49d 100644 --- a/packages/install/src/files/policy-management.conf +++ b/packages/install/src/files/policy-management.conf @@ -22,4 +22,3 @@ CONTROLLER_ARTIFACT_ID=policy-management CONTROLLER_NAME=policy-management-controller CONTROLLER_PORT=9696 RULES_ARTIFACT=org.onap.policy:dummy-artifact:1.0.0-SNAPSHOT -UEB_TOPIC=policyengine-develop diff --git a/packages/pom.xml b/packages/pom.xml index a67c92b4..ba797d3c 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>drools-packages</artifactId> <packaging>pom</packaging> diff --git a/policy-core/pom.xml b/policy-core/pom.xml index 95e13945..afd69e26 100644 --- a/policy-core/pom.xml +++ b/policy-core/pom.xml @@ -5,7 +5,7 @@ ================================================================================ Copyright (C) 2017-2021, 2023 AT&T Intellectual Property. All rights reserved. Modifications Copyright (C) 2019 Bell Canada. - Modifications Copyright (C) 2020,2022-2023 Nordix Foundation. + Modifications Copyright (C) 2020,2022-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. @@ -29,7 +29,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <dependencies> @@ -47,24 +47,18 @@ <dependency> <groupId>org.apache.ant</groupId> <artifactId>ant</artifactId> - <version>1.10.13</version> + <version>1.10.14</version> + </dependency> + + <dependency> + <groupId>org.mvel</groupId> + <artifactId>mvel2</artifactId> + <version>2.5.2.Final</version> </dependency> <dependency> <groupId>org.kie</groupId> <artifactId>kie-ci</artifactId> - <!-- - Issue: 2 of 2 - Excluding these 2 dependencies in order to force upgrade security fixes - identified. As declared above. Any changes here should be reflected above - and vice versa. - --> - <exclusions> - <exclusion> - <groupId>org.apache.ant</groupId> - <artifactId>ant</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> @@ -115,17 +109,14 @@ <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-xjc</artifactId> - <version>4.0.3</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-core</artifactId> - <version>4.0.3</version> </dependency> <dependency> <groupId>com.sun.xml.bind</groupId> <artifactId>jaxb-impl</artifactId> - <version>4.0.3</version> </dependency> <dependency> <groupId>jakarta.activation</groupId> @@ -139,6 +130,10 @@ <groupId>jakarta.xml.bind</groupId> <artifactId>jakarta.xml.bind-api</artifactId> </dependency> + <dependency> + <groupId>org.glassfish.hk2.external</groupId> + <artifactId>javax.inject</artifactId> + </dependency> </dependencies> </project> diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java index 0c10e984..760f9533 100644 --- a/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java +++ b/policy-core/src/main/java/org/onap/policy/drools/core/PolicySession.java @@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory; * This class is a wrapper around 'KieSession', which adds the following: * * <p>1) A thread running 'KieSession.fireUntilHalt()' - * 2) Access to UEB + * 2) Access to topic * 3) Logging of events */ public class PolicySession implements AgendaEventListener, RuleRuntimeEventListener { diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/lock/AlwaysFailLock.java b/policy-core/src/main/java/org/onap/policy/drools/core/lock/AlwaysFailLock.java index df0ac151..edb7f475 100644 --- a/policy-core/src/main/java/org/onap/policy/drools/core/lock/AlwaysFailLock.java +++ b/policy-core/src/main/java/org/onap/policy/drools/core/lock/AlwaysFailLock.java @@ -21,7 +21,6 @@ package org.onap.policy.drools.core.lock; -import java.io.Serial; import lombok.NoArgsConstructor; /** @@ -29,7 +28,6 @@ import lombok.NoArgsConstructor; */ @NoArgsConstructor public class AlwaysFailLock extends LockImpl { - @Serial private static final long serialVersionUID = 1L; /** diff --git a/policy-core/src/main/java/org/onap/policy/drools/core/lock/AlwaysSuccessLock.java b/policy-core/src/main/java/org/onap/policy/drools/core/lock/AlwaysSuccessLock.java index ced6c4c9..b4364515 100644 --- a/policy-core/src/main/java/org/onap/policy/drools/core/lock/AlwaysSuccessLock.java +++ b/policy-core/src/main/java/org/onap/policy/drools/core/lock/AlwaysSuccessLock.java @@ -21,14 +21,12 @@ package org.onap.policy.drools.core.lock; -import java.io.Serial; import lombok.NonNull; /** * Lock implementation whose operations always succeed. */ public class AlwaysSuccessLock extends LockImpl { - @Serial private static final long serialVersionUID = 1L; /** diff --git a/policy-domains/pom.xml b/policy-domains/pom.xml index 2667b714..9aa46193 100644 --- a/policy-domains/pom.xml +++ b/policy-domains/pom.xml @@ -3,7 +3,7 @@ ONAP ================================================================================ Copyright (C) 2020 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2023 Nordix Foundation. + Modifications Copyright (C) 2023-2024 Nordix Foundation. ================================================================================ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>policy-domains</artifactId> @@ -35,7 +35,6 @@ <description>domain policies</description> <dependencies> - <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> @@ -45,27 +44,28 @@ <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> </dependency> - <dependency> <groupId>com.openpojo</groupId> <artifactId>openpojo</artifactId> <scope>test</scope> </dependency> - <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>utils</artifactId> <version>${policy.common.version}</version> <scope>test</scope> </dependency> - <dependency> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>policy-utils</artifactId> <version>${project.version}</version> <scope>test</scope> </dependency> - + <dependency> + <groupId>org.onap.policy.models</groupId> + <artifactId>policy-models-examples</artifactId> + <version>${policy.models.version}</version> + </dependency> </dependencies> </project> diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java index b16af396..dfb75da6 100644 --- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java +++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerPolicy.java @@ -21,7 +21,6 @@ package org.onap.policy.drools.domain.models.controller; -import java.io.Serial; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; @@ -36,8 +35,6 @@ import org.onap.policy.drools.domain.models.DroolsPolicy; @SuperBuilder @EqualsAndHashCode(callSuper = true) public class ControllerPolicy extends DroolsPolicy implements Serializable { - - @Serial private static final long serialVersionUID = -8171337852833516581L; private ControllerProperties properties; diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerProperties.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerProperties.java index b55e4344..31854a71 100644 --- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerProperties.java +++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerProperties.java @@ -21,7 +21,6 @@ package org.onap.policy.drools.domain.models.controller; -import java.io.Serial; import java.io.Serializable; import java.util.List; import java.util.Map; @@ -36,7 +35,6 @@ import lombok.Data; @Data @Builder public class ControllerProperties implements Serializable { - @Serial private static final long serialVersionUID = 1259434187110418986L; private String controllerName; diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java index 57c07f2d..af5c1cb0 100644 --- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java +++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSinkTopic.java @@ -21,7 +21,6 @@ package org.onap.policy.drools.domain.models.controller; -import java.io.Serial; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; @@ -36,7 +35,6 @@ import lombok.experimental.SuperBuilder; @SuperBuilder @EqualsAndHashCode(callSuper = true) public class ControllerSinkTopic extends ControllerTopic implements Serializable { - @Serial private static final long serialVersionUID = 8770353732981476267L; @Override diff --git a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java index 3c7f1f03..63bdc243 100644 --- a/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java +++ b/policy-domains/src/main/java/org/onap/policy/drools/domain/models/controller/ControllerSourceTopic.java @@ -21,7 +21,6 @@ package org.onap.policy.drools.domain.models.controller; -import java.io.Serial; import java.io.Serializable; import lombok.Data; import lombok.EqualsAndHashCode; @@ -36,7 +35,6 @@ import lombok.experimental.SuperBuilder; @SuperBuilder @EqualsAndHashCode(callSuper = true) public class ControllerSourceTopic extends ControllerTopic implements Serializable { - @Serial private static final long serialVersionUID = -1732598566914643612L; @Override diff --git a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DroolsPolicyTest.java b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DroolsPolicyTest.java index 99494d71..e2e628a7 100644 --- a/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DroolsPolicyTest.java +++ b/policy-domains/src/test/java/org/onap/policy/drools/domain/models/DroolsPolicyTest.java @@ -30,7 +30,6 @@ import com.openpojo.validation.Validator; import com.openpojo.validation.ValidatorBuilder; import com.openpojo.validation.test.impl.GetterTester; import com.openpojo.validation.test.impl.SetterTester; -import java.io.Serial; import java.io.Serializable; import java.util.List; import lombok.Data; @@ -46,7 +45,6 @@ class DroolsPolicyTest { @NoArgsConstructor @EqualsAndHashCode(callSuper = true) public static class DerivedDomainPolicy extends DroolsPolicy implements Serializable { - @Serial private static final long serialVersionUID = -1027974819756498893L; } diff --git a/policy-management/pom.xml b/policy-management/pom.xml index 86303584..312c9e5a 100644 --- a/policy-management/pom.xml +++ b/policy-management/pom.xml @@ -4,7 +4,7 @@ ONAP Policy Engine - Drools PDP ================================================================================ Copyright (C) 2017-2022 AT&T Intellectual Property. All rights reserved. - Modifications Copyright (C) 2020,2023 Nordix Foundation. + Modifications Copyright (C) 2020, 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,7 +27,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <artifactId>policy-management</artifactId> @@ -38,6 +38,7 @@ <build> <plugins> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-assembly-plugin</artifactId> <executions> <execution> @@ -81,6 +82,7 @@ </executions> </plugin> <plugin> + <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <executions> <execution> @@ -226,13 +228,11 @@ <artifactId>utils</artifactId> <version>${policy.common.version}</version> </dependency> - <dependency> <groupId>org.onap.policy.models</groupId> <artifactId>policy-models-pdp</artifactId> <version>${policy.models.version}</version> </dependency> - <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> @@ -241,11 +241,6 @@ <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> </dependency> - - <dependency> - <groupId>com.google.code.gson</groupId> - <artifactId>gson</artifactId> - </dependency> <dependency> <groupId>com.fatboyindustrial.gson-javatime-serialisers</groupId> <artifactId>gson-javatime-serialisers</artifactId> @@ -259,11 +254,23 @@ <groupId>org.apache.commons</groupId> <artifactId>commons-collections4</artifactId> </dependency> - - <!-- if we don't explicitly specify the version here, we seem to end up - with version 1.4 (as a dependency to drools-core). This version is - not compatible with 'saClientLibrary' version 1.2.1-oss - --> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-jexl3</artifactId> + </dependency> + <dependency> + <groupId>org.glassfish.jersey.inject</groupId> + <artifactId>jersey-hk2</artifactId> + </dependency> + <dependency> + <groupId>io.prometheus</groupId> + <artifactId>simpleclient_servlet_jakarta</artifactId> + </dependency> + <dependency> + <groupId>io.prometheus</groupId> + <artifactId>simpleclient_hotspot</artifactId> + <scope>runtime</scope> + </dependency> <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> @@ -273,6 +280,10 @@ <artifactId>logback-classic</artifactId> </dependency> <dependency> + <groupId>org.apache.kafka</groupId> + <artifactId>kafka-clients</artifactId> + </dependency> + <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <scope>test</scope> @@ -309,6 +320,18 @@ <groupId>io.swagger.core.v3</groupId> <artifactId>swagger-annotations</artifactId> </dependency> + <dependency> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-jaxrs2-servlet-initializer-v2-jakarta</artifactId> + </dependency> + <dependency> + <groupId>io.swagger.core.v3</groupId> + <artifactId>swagger-jaxrs2-jakarta</artifactId> + </dependency> + <dependency> + <groupId>jakarta.servlet</groupId> + <artifactId>jakarta.servlet-api</artifactId> + </dependency> </dependencies> </project> 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 1965e22f..7f28f9bb 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 @@ -258,13 +258,7 @@ class IndexedDroolsControllerFactory implements DroolsControllerFactory { private String getPropertyTopicPrefix(Topic topic) { boolean isSource = topic instanceof TopicSource; var commInfra = topic.getTopicCommInfrastructure(); - if (commInfra == CommInfrastructure.UEB) { - if (isSource) { - return PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "."; - } else { - return PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "."; - } - } else if (commInfra == CommInfrastructure.NOOP) { + if (commInfra == CommInfrastructure.NOOP) { if (isSource) { return PolicyEndPointProperties.PROPERTY_NOOP_SOURCE_TOPICS + "."; } else { 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 87001ad6..8edf394e 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 @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -232,7 +233,7 @@ public interface PolicyEngineFeatureApi extends OrderedService { } /** - * Intercept an event from UEB/DMaaP before the PolicyEngine processes it. + * Intercept an event from Bus before the PolicyEngine processes it. * * @return True if this feature intercepts and takes ownership of the operation * preventing the invocation of lower priority features. False, otherwise. diff --git a/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java b/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java index d35f5469..9fb76d87 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.java +++ b/policy-management/src/main/java/org/onap/policy/drools/persistence/FileSystemPersistence.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. @@ -152,13 +153,13 @@ public class FileSystemPersistence implements SystemPersistence { protected Properties getProperties(Path propertiesPath) { if (!Files.exists(propertiesPath)) { - throw new IllegalArgumentException("properties for " + propertiesPath.toString() + " are not persisted."); + throw new IllegalArgumentException("properties for " + propertiesPath + " are not persisted."); } try { return PropertyUtil.getProperties(propertiesPath.toFile()); } catch (final Exception e) { - throw new IllegalArgumentException("can't read properties for " + propertiesPath.toString(), e); + throw new IllegalArgumentException("can't read properties for " + propertiesPath, e); } } diff --git a/policy-management/src/main/java/org/onap/policy/drools/persistence/SystemPersistenceConstants.java b/policy-management/src/main/java/org/onap/policy/drools/persistence/SystemPersistenceConstants.java index ba6c5e71..dba6d4c1 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/persistence/SystemPersistenceConstants.java +++ b/policy-management/src/main/java/org/onap/policy/drools/persistence/SystemPersistenceConstants.java @@ -32,7 +32,7 @@ public final class SystemPersistenceConstants { public static final String DEFAULT_CONFIGURATION_DIR = "config"; /** - * Persistence Manager. For now it is a file-based properties management, In the future, it will + * Persistence Manager. For now, it is a file-based properties management, In the future, it will * probably be DB based, so manager implementation will change. */ @Getter diff --git a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java index 76836ba2..f008407c 100644 --- a/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java +++ b/policy-management/src/main/java/org/onap/policy/drools/protocol/configuration/PdpdConfiguration.java @@ -165,30 +165,32 @@ public class PdpdConfiguration { } protected boolean declaredProperty(String name, Object value) { - return switch (name) { - case "requestID" -> { + switch (name) { + case "requestID": callSetRequestId(value); - yield true; - } - case "entity" -> { + return true; + case "entity": callSetEntity(value); - yield true; - } - case "controllers" -> { + return true; + case "controllers": callSetControllers(value); - yield true; - } - default -> false; - }; + return true; + default: + return false; + } } protected Object declaredPropertyOrNotFound(String name, Object notFoundValue) { - return switch (name) { - case "requestID" -> getRequestId(); - case "entity" -> getEntity(); - case "controllers" -> getControllers(); - default -> notFoundValue; - }; + switch (name) { + case "requestID": + return getRequestId(); + case "entity": + return getEntity(); + case "controllers": + return getControllers(); + default: + return notFoundValue; + } } /** @@ -240,7 +242,7 @@ public class PdpdConfiguration { } else { throw new IllegalArgumentException( "property \"requestID\" is of type \"java.lang.String\", but got " - + value.getClass().toString()); + + value.getClass()); } } @@ -255,7 +257,7 @@ public class PdpdConfiguration { } else { throw new IllegalArgumentException( "property \"entity\" is of type \"java.lang.String\", but got " - + value.getClass().toString()); + + value.getClass()); } } 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 ecc6c083..48cd8140 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 @@ -1392,7 +1392,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sources/{comm: ueb|kafka|noop}") + @Path("engine/topics/sources/{comm: kafka|noop}") public Response commSources( @PathParam("comm") String comm) { if (!checkValidNameInput(comm)) { @@ -1405,9 +1405,6 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA List<TopicSource> sources = new ArrayList<>(); var status = Status.OK; switch (CommInfrastructure.valueOf(comm.toUpperCase())) { - case UEB: - sources.addAll(TopicEndpointManager.getManager().getUebTopicSources()); - break; case NOOP: sources.addAll(TopicEndpointManager.getManager().getNoopTopicSources()); break; @@ -1427,7 +1424,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sinks/{comm: ueb|kafka|noop}") + @Path("engine/topics/sinks/{comm: kafka|noop}") public Response commSinks( @PathParam("comm") String comm) { if (!checkValidNameInput(comm)) { @@ -1440,9 +1437,6 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA List<TopicSink> sinks = new ArrayList<>(); var status = Status.OK; switch (CommInfrastructure.valueOf(comm.toUpperCase())) { - case UEB: - sinks.addAll(TopicEndpointManager.getManager().getUebTopicSinks()); - break; case NOOP: sinks.addAll(TopicEndpointManager.getManager().getNoopTopicSinks()); break; @@ -1462,7 +1456,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}") + @Path("engine/topics/sources/{comm: kafka|noop}/{topic}") public Response sourceTopic( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1478,7 +1472,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}") + @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}") public Response sinkTopic( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1494,7 +1488,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/events") + @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/events") public Response sourceEvents( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1510,7 +1504,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/events") + @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/events") public Response sinkEvents( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1526,7 +1520,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches") + @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches") public Response commSourceTopicSwitches( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1538,7 +1532,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @GET - @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches") + @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches") public Response commSinkTopicSwitches( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1550,7 +1544,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/lock") + @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches/lock") public Response commSourceTopicLock( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1564,7 +1558,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @DELETE - @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/lock") + @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches/lock") public Response commSourceTopicUnlock( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1578,7 +1572,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/activation") + @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches/activation") public Response commSourceTopicActivation( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1592,7 +1586,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @DELETE - @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/switches/activation") + @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/switches/activation") public Response commSourceTopicDeactivation( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1606,7 +1600,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/lock") + @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches/lock") public Response commSinkTopicLock( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1620,7 +1614,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @DELETE - @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/lock") + @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches/lock") public Response commSinkTopicUnlock( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1634,7 +1628,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/activation") + @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches/activation") public Response commSinkTopicActivation( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1648,7 +1642,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @DELETE - @Path("engine/topics/sinks/{comm: ueb|kafka|noop}/{topic}/switches/activation") + @Path("engine/topics/sinks/{comm: kafka|noop}/{topic}/switches/activation") public Response commSinkTopicDeactivation( @PathParam("comm") String comm, @PathParam("topic") String topic) { @@ -1676,7 +1670,7 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA */ @Override @PUT - @Path("engine/topics/sources/{comm: ueb|kafka|noop}/{topic}/events") + @Path("engine/topics/sources/{comm: kafka|noop}/{topic}/events") @Consumes(MediaType.TEXT_PLAIN) public Response commEventOffer( @PathParam("comm") String comm, @@ -1722,11 +1716,12 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA @Path("engine/tools/loggers") public Response loggers() { final List<String> names = new ArrayList<>(); - if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext context)) { + if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext)) { logger.warn("The SLF4J logger factory is not configured for logback"); return Response.status(Status.INTERNAL_SERVER_ERROR).entity(names).build(); } + final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); for (final Logger lgr : context.getLoggerList()) { names.add(lgr.getName()); } @@ -1744,11 +1739,12 @@ public class RestManager implements SwaggerApi, DefaultApi, FeaturesApi, InputsA @Path("engine/tools/loggers/{logger}") @Produces(MediaType.TEXT_PLAIN) public Response loggerName1(@PathParam("logger") String loggerName) { - if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext context)) { + if (!(LoggerFactory.getILoggerFactory() instanceof LoggerContext)) { logger.warn("The SLF4J logger factory is not configured for logback"); return Response.status(Status.INTERNAL_SERVER_ERROR).build(); } + final LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); var lgr = context.getLogger(loggerName); if (lgr == null) { return Response.status(Status.NOT_FOUND).build(); 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 3d167352..f0530d05 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 @@ -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. @@ -124,7 +125,7 @@ public class Main { try { engineProperties = SystemPersistenceConstants.getManager().getEngineProperties(); } catch (IllegalArgumentException iae) { - logger.warn("Main: engine properties not found. Using default configuration.", iae); + logger.warn("Main: engine properties not found. Using default configuration. {}", iae.getMessage()); engineProperties = PolicyEngineConstants.getManager().defaultTelemetryConfig(); } 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 75e7c74a..3fc2e292 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 @@ -3,6 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2022 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,13 +42,10 @@ import org.onap.policy.drools.stats.PolicyStatsManager; /** * Policy Engine, the top abstraction for the Drools PDP Policy Engine. It abstracts away a Drools - * PDP Engine from management purposes. This is the best place to looking at the code from a top - * down approach. Other managed entities can be obtained from the PolicyEngine, hierarchically. <br> + * PDP Engine from management purposes. This is the best place to looking at the code from a top-down + * approach. Other managed entities can be obtained from the PolicyEngine, hierarchically. <br> * PolicyEngine 1 --- * PolicyController 1 --- 1 DroolsController 1 --- 1 PolicyContainer 1 --- * * PolicySession <br> PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicReader 1 --- 1 - * UebTopicReader <br> PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicReader 1 --- 1 - * DmaapTopicReader <br> PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicWriter 1 --- 1 - * DmaapTopicWriter <br> PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicReader 1 --- 1 * RestTopicReader <br> PolicyEngine 1 --- 1 TopicEndpointManager 1 -- * TopicWriter 1 --- 1 * RestTopicWriter <br> PolicyEngine 1 --- 1 ManagementServer */ 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 06b3f4ea..2c85c26e 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 @@ -3,7 +3,7 @@ * ONAP * ================================================================================ * Copyright (C) 2017-2021 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. @@ -140,9 +140,9 @@ public class AggregatedPolicyController implements PolicyController, TopicListen this.name = name; /* - * 1. Register read topics with network infrastructure (ueb, dmaap, rest) 2. Register write - * topics with network infrastructure (ueb, dmaap, rest) 3. Register with drools - * infrastructure + * 1. Register read topics with network infrastructure + * 2. Register write topics with network infrastructure + * 3. Register with drools infrastructure */ // Create/Reuse Readers/Writers for all event sources endpoints diff --git a/policy-management/src/main/resources/openapi/openapi.yaml b/policy-management/src/main/resources/openapi/openapi.yaml index 80a3ae63..da1b17d9 100644 --- a/policy-management/src/main/resources/openapi/openapi.yaml +++ b/policy-management/src/main/resources/openapi/openapi.yaml @@ -2238,7 +2238,7 @@ paths: tags: - pdp-d-telemetry summary: Retrieves the managed topic sources - description: Network Topic Sources Agregation + description: Network Topic Sources Aggregation operationId: sources responses: 200: @@ -2255,7 +2255,7 @@ paths: tags: - pdp-d-telemetry summary: Retrieves the managed topic sinks - description: Network Topic Sinks Agregation + description: Network Topic Sinks Aggregation operationId: sinks responses: 200: @@ -2338,7 +2338,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string responses: 200: @@ -2363,7 +2363,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string responses: 200: @@ -2389,7 +2389,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2412,7 +2412,7 @@ paths: tags: - pdp-d-telemetry summary: Retrieves a managed topic sink - description: This is a Network Communicaton Endpoint destination of messages + description: This is a Network Communication Endpoint destination of messages from the Engine operationId: sinkTopic parameters: @@ -2421,7 +2421,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2443,8 +2443,8 @@ paths: get: tags: - pdp-d-telemetry - summary: Retrieves the latest events received by an UEB topic - description: This is a Network Communicaton Endpoint source of messages for + summary: Retrieves the latest events received by a topic + description: This is a Network Communication Endpoint source of messages for the Engine operationId: sourceEvents parameters: @@ -2453,7 +2453,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2483,7 +2483,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2523,8 +2523,8 @@ paths: get: tags: - pdp-d-telemetry - summary: Retrieves the latest events received by an UEB topic - description: This is a Network Communicaton Endpoint source of messages for + summary: Retrieves the latest events received by a topic + description: This is a Network Communication Endpoint source of messages for the Engine operationId: sinkEvents parameters: @@ -2533,7 +2533,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2563,7 +2563,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2596,7 +2596,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2631,7 +2631,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2662,7 +2662,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2692,7 +2692,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2725,7 +2725,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2759,7 +2759,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2792,7 +2792,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2826,7 +2826,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2859,7 +2859,7 @@ paths: description: Communication Mechanism required: true schema: - pattern: ueb|dmaap|noop + pattern: kafka|noop type: string - name: topic in: path @@ -2886,7 +2886,7 @@ paths: tags: - pdp-d-legacy summary: Legacy Engine Configuration Properties - description: Used for booststrapping the engine + description: Used for bootstrapping the engine operationId: properties responses: 200: @@ -2935,8 +2935,6 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST @@ -3008,8 +3006,6 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST @@ -3822,80 +3818,6 @@ components: $ref: '#/components/schemas/CoderFilters' customCoder: $ref: '#/components/schemas/CustomCoder' - DmaapTopicSink: - type: object - properties: - partitionKey: - type: string - apiKey: - type: string - apiSecret: - type: string - effectiveTopic: - type: string - recentEvents: - type: array - items: - type: string - topic: - type: string - servers: - type: array - items: - type: string - topicCommInfrastructure: - type: string - enum: - - UEB - - DMAAP - - KAFKA - - NOOP - - REST - alive: - type: boolean - locked: - type: boolean - DmaapTopicSource: - type: object - properties: - consumerInstance: - type: string - consumerGroup: - type: string - fetchTimeout: - type: integer - format: int32 - fetchLimit: - type: integer - format: int32 - apiKey: - type: string - apiSecret: - type: string - effectiveTopic: - type: string - recentEvents: - type: array - items: - type: string - topic: - type: string - servers: - type: array - items: - type: string - topicCommInfrastructure: - type: string - enum: - - UEB - - DMAAP - - KAFKA - - NOOP - - REST - alive: - type: boolean - locked: - type: boolean KafkaTopicSink: type: object properties: @@ -3920,8 +3842,6 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST @@ -3961,8 +3881,6 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST @@ -3992,8 +3910,6 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST @@ -4019,26 +3935,12 @@ components: topicCommInfrastructure: type: string enum: - - UEB - - DMAAP - KAFKA - NOOP - REST TopicEndpoint: type: object properties: - uebTopicSources: - type: array - items: - $ref: '#/components/schemas/UebTopicSource' - uebTopicSinks: - type: array - items: - $ref: '#/components/schemas/UebTopicSink' - dmaapTopicSinks: - type: array - items: - $ref: '#/components/schemas/DmaapTopicSink' kafkaTopicSinks: type: array items: @@ -4047,10 +3949,6 @@ components: type: array items: $ref: '#/components/schemas/NoopTopicSink' - dmaapTopicSources: - type: array - items: - $ref: '#/components/schemas/DmaapTopicSource' kafkaTopicSources: type: array items: @@ -4071,80 +3969,6 @@ components: type: boolean locked: type: boolean - UebTopicSink: - type: object - properties: - partitionKey: - type: string - apiKey: - type: string - apiSecret: - type: string - effectiveTopic: - type: string - recentEvents: - type: array - items: - type: string - topic: - type: string - servers: - type: array - items: - type: string - topicCommInfrastructure: - type: string - enum: - - UEB - - DMAAP - - KAFKA - - NOOP - - REST - alive: - type: boolean - locked: - type: boolean - UebTopicSource: - type: object - properties: - consumerInstance: - type: string - consumerGroup: - type: string - fetchTimeout: - type: integer - format: int32 - fetchLimit: - type: integer - format: int32 - apiKey: - type: string - apiSecret: - type: string - effectiveTopic: - type: string - recentEvents: - type: array - items: - type: string - topic: - type: string - servers: - type: array - items: - type: string - topicCommInfrastructure: - type: string - enum: - - UEB - - DMAAP - - KAFKA - - NOOP - - REST - alive: - type: boolean - locked: - type: boolean PdpdConfiguration: type: object properties: diff --git a/policy-management/src/main/resources/swagger/swagger.json b/policy-management/src/main/resources/swagger/swagger.json index 9fb709b9..b3433208 100644 --- a/policy-management/src/main/resources/swagger/swagger.json +++ b/policy-management/src/main/resources/swagger/swagger.json @@ -3187,7 +3187,7 @@ "get" : { "tags" : [ "pdp-d-telemetry" ], "summary" : "Retrieves the managed topic sources", - "description" : "Network Topic Sources Agregation", + "description" : "Network Topic Sources Aggregation", "operationId" : "sources", "responses" : { "200" : { @@ -3212,7 +3212,7 @@ "get" : { "tags" : [ "pdp-d-telemetry" ], "summary" : "Retrieves the managed topic sinks", - "description" : "Network Topic Sinks Agregation", + "description" : "Network Topic Sinks Aggregation", "operationId" : "sinks", "responses" : { "200" : { @@ -3328,7 +3328,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } } ], @@ -3365,7 +3365,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } } ], @@ -3402,7 +3402,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3439,7 +3439,7 @@ "get" : { "tags" : [ "pdp-d-telemetry" ], "summary" : "Retrieves a managed topic sink", - "description" : "This is a Network Communicaton Endpoint destination of messages from the Engine", + "description" : "This is a Network Communication Endpoint destination of messages from the Engine", "operationId" : "sinkTopic", "parameters" : [ { "name" : "comm", @@ -3449,7 +3449,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3485,8 +3485,8 @@ "/topics/sources/{comm}/{topic}/events" : { "get" : { "tags" : [ "pdp-d-telemetry" ], - "summary" : "Retrieves the latest events received by an UEB topic", - "description" : "This is a Network Communicaton Endpoint source of messages for the Engine", + "summary" : "Retrieves the latest events received by a topic", + "description" : "This is a Network Communication Endpoint source of messages for the Engine", "operationId" : "sourceEvents", "parameters" : [ { "name" : "comm", @@ -3496,7 +3496,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3541,7 +3541,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3601,8 +3601,8 @@ "/topics/sinks/{comm}/{topic}/events" : { "get" : { "tags" : [ "pdp-d-telemetry" ], - "summary" : "Retrieves the latest events received by an UEB topic", - "description" : "This is a Network Communicaton Endpoint source of messages for the Engine", + "summary" : "Retrieves the latest events received by a topic", + "description" : "This is a Network Communication Endpoint source of messages for the Engine", "operationId" : "sinkEvents", "parameters" : [ { "name" : "comm", @@ -3612,7 +3612,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3658,7 +3658,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3706,7 +3706,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3757,7 +3757,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3804,7 +3804,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3850,7 +3850,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3898,7 +3898,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3948,7 +3948,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -3996,7 +3996,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -4046,7 +4046,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -4094,7 +4094,7 @@ "style" : "simple", "explode" : false, "schema" : { - "pattern" : "ueb|dmaap|noop", + "pattern" : "kafka|noop", "type" : "string" } }, { @@ -4135,7 +4135,7 @@ "get" : { "tags" : [ "pdp-d-legacy" ], "summary" : "Legacy Engine Configuration Properties", - "description" : "Used for booststrapping the engine", + "description" : "Used for bootstrapping the engine", "operationId" : "properties", "responses" : { "200" : { @@ -4207,7 +4207,7 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] }, "alive" : { "type" : "boolean" @@ -4299,7 +4299,7 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] }, "alive" : { "type" : "boolean" @@ -5486,101 +5486,6 @@ } } }, - "DmaapTopicSink" : { - "type" : "object", - "properties" : { - "partitionKey" : { - "type" : "string" - }, - "apiKey" : { - "type" : "string" - }, - "apiSecret" : { - "type" : "string" - }, - "effectiveTopic" : { - "type" : "string" - }, - "recentEvents" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "topic" : { - "type" : "string" - }, - "servers" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "topicCommInfrastructure" : { - "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] - }, - "alive" : { - "type" : "boolean" - }, - "locked" : { - "type" : "boolean" - } - } - }, - "DmaapTopicSource" : { - "type" : "object", - "properties" : { - "consumerInstance" : { - "type" : "string" - }, - "consumerGroup" : { - "type" : "string" - }, - "fetchTimeout" : { - "type" : "integer", - "format" : "int32" - }, - "fetchLimit" : { - "type" : "integer", - "format" : "int32" - }, - "apiKey" : { - "type" : "string" - }, - "apiSecret" : { - "type" : "string" - }, - "effectiveTopic" : { - "type" : "string" - }, - "recentEvents" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "topic" : { - "type" : "string" - }, - "servers" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "topicCommInfrastructure" : { - "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] - }, - "alive" : { - "type" : "boolean" - }, - "locked" : { - "type" : "boolean" - } - } - }, "KafkaTopicSink" : { "type" : "object", "properties" : { @@ -5613,7 +5518,7 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] }, "alive" : { "type" : "boolean" @@ -5666,7 +5571,7 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] }, "alive" : { "type" : "boolean" @@ -5705,7 +5610,7 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] } } }, @@ -5738,31 +5643,13 @@ }, "topicCommInfrastructure" : { "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] + "enum" : [ "KAFKA", "NOOP", "REST" ] } } }, "TopicEndpoint" : { "type" : "object", "properties" : { - "uebTopicSources" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/UebTopicSource" - } - }, - "uebTopicSinks" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/UebTopicSink" - } - }, - "dmaapTopicSinks" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/DmaapTopicSink" - } - }, "kafkaTopicSinks" : { "type" : "array", "items" : { @@ -5775,12 +5662,6 @@ "$ref" : "#/components/schemas/NoopTopicSink" } }, - "dmaapTopicSources" : { - "type" : "array", - "items" : { - "$ref" : "#/components/schemas/DmaapTopicSource" - } - }, "kafkaTopicSources" : { "type" : "array", "items" : { @@ -5813,101 +5694,6 @@ } } }, - "UebTopicSink" : { - "type" : "object", - "properties" : { - "partitionKey" : { - "type" : "string" - }, - "apiKey" : { - "type" : "string" - }, - "apiSecret" : { - "type" : "string" - }, - "effectiveTopic" : { - "type" : "string" - }, - "recentEvents" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "topic" : { - "type" : "string" - }, - "servers" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "topicCommInfrastructure" : { - "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] - }, - "alive" : { - "type" : "boolean" - }, - "locked" : { - "type" : "boolean" - } - } - }, - "UebTopicSource" : { - "type" : "object", - "properties" : { - "consumerInstance" : { - "type" : "string" - }, - "consumerGroup" : { - "type" : "string" - }, - "fetchTimeout" : { - "type" : "integer", - "format" : "int32" - }, - "fetchLimit" : { - "type" : "integer", - "format" : "int32" - }, - "apiKey" : { - "type" : "string" - }, - "apiSecret" : { - "type" : "string" - }, - "effectiveTopic" : { - "type" : "string" - }, - "recentEvents" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "topic" : { - "type" : "string" - }, - "servers" : { - "type" : "array", - "items" : { - "type" : "string" - } - }, - "topicCommInfrastructure" : { - "type" : "string", - "enum" : [ "UEB", "DMAAP", "KAFKA", "NOOP", "REST" ] - }, - "alive" : { - "type" : "boolean" - }, - "locked" : { - "type" : "boolean" - } - } - }, "PdpdConfiguration" : { "type" : "object", "properties" : { diff --git a/policy-management/src/main/server-gen/bin/add-secured-participant b/policy-management/src/main/server-gen/bin/add-secured-participant index 3ddc120f..579f4d47 100644 --- a/policy-management/src/main/server-gen/bin/add-secured-participant +++ b/policy-management/src/main/server-gen/bin/add-secured-participant @@ -73,7 +73,7 @@ until [ -z "$1" ]; do done if [ -z "${BUS_HOST}" ]; then - echo "An UEB/KAFKA server must be provided." + echo "A KAFKA server must be provided." echo usage exit 1 diff --git a/policy-management/src/main/server-gen/bin/create-api-key b/policy-management/src/main/server-gen/bin/create-api-key index e57c1e92..6d320729 100644 --- a/policy-management/src/main/server-gen/bin/create-api-key +++ b/policy-management/src/main/server-gen/bin/create-api-key @@ -53,7 +53,7 @@ until [ -z "$1" ]; do done if [ -z "${BUS_HOST}" ]; then - echo "An UEB/KAFKA server must be provided." + echo "A KAFKA server must be provided." echo usage exit 1 diff --git a/policy-management/src/main/server-gen/bin/create-secured-topic b/policy-management/src/main/server-gen/bin/create-secured-topic index 2aed99ae..f5c640f2 100644 --- a/policy-management/src/main/server-gen/bin/create-secured-topic +++ b/policy-management/src/main/server-gen/bin/create-secured-topic @@ -72,7 +72,7 @@ until [ -z "$1" ]; do done if [ -z "${BUS_HOST}" ]; then - echo "An UEB/KAFKA server must be provided." + echo "A KAFKA server must be provided." echo usage exit 1 diff --git a/policy-management/src/main/server-gen/bin/features b/policy-management/src/main/server-gen/bin/features index 93f58239..3343ffc4 100644 --- a/policy-management/src/main/server-gen/bin/features +++ b/policy-management/src/main/server-gen/bin/features @@ -773,7 +773,7 @@ function disableFeatureDeps() rm -f "${LIB}"/"${depJarName}" # case there were multiple features using this library - # re-enable link fron an enabled feature + # re-enable link from an enabled feature for aDepsEnabledMap in ${xDepsEnabledMap}; do if [ $(basename "${aDepsEnabledMap}") = ${depJarName} ]; then ln -s -f "${aDepsEnabledMap}" "${LIB}/" diff --git a/policy-management/src/main/server-gen/bin/pdpd-configuration b/policy-management/src/main/server-gen/bin/pdpd-configuration index 5182f3ad..0be7cef3 100644 --- a/policy-management/src/main/server-gen/bin/pdpd-configuration +++ b/policy-management/src/main/server-gen/bin/pdpd-configuration @@ -38,9 +38,10 @@ function usage() { echo "" } -BUS_PORT=9092 +BUS_PORT=29092 +BUS_HOST=kafka REQUEST_ID="7f5474ca-16a9-42ac-abc0-d86f62296fbc" -TOPIC="PDPD-CONFIGURATION" +TOPIC="pdpd-configuration" # command line options parsing until [ -z "$1" ]; do @@ -88,7 +89,7 @@ until [ -z "$1" ]; do done if [ -z "${BUS_HOST}" ]; then - echo "An UEB/KAFKA server must be provided." + echo "A KAFKA server must be provided." echo usage exit 1 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 65447d80..6a17f269 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 @@ -69,26 +69,18 @@ public class RestManagerTest { private static final String TELEMETRY_USER = "x"; private static final String TELEMETRY_PASSWORD = "y"; private static final String FOO_CONTROLLER = "foo"; - - private static final String UEB_TOPIC = "ueb-topic-test"; private static final String KAFKA_TOPIC = "kafka-topic-test"; private static final String NOOP_TOPIC = "noop_topic"; - - private static final String UEB_SOURCE_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS + "." - + UEB_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; - private static final String UEB_SINK_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS + "." - + UEB_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; private static final String KAFKA_SOURCE_SERVER_PROPERTY = PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS - + "." + KAFKA_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; + + "." + 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 UEB_SERVER = "localhost"; + + KAFKA_TOPIC + PolicyEndPointProperties.PROPERTY_TOPIC_SERVERS_SUFFIX; private static final String KAFKA_SERVER = "localhost:9092"; private static final String FOO_CONTROLLER_FILE = FOO_CONTROLLER + "-controller.properties"; private static final String FOO_CONTROLLER_FILE_BAK = FOO_CONTROLLER_FILE + ".bak"; private static final String PDP_CONFIGURATION_JSON = - "src/test/resources/org/onap/policy/drools/server/restful/PdpConfiguration.json"; + "src/test/resources/org/onap/policy/drools/server/restful/PdpConfiguration.json"; private static CloseableHttpClient client; @@ -108,28 +100,24 @@ public class RestManagerTest { /* override default port */ final Properties engineProps = PolicyEngineConstants.getManager().defaultTelemetryConfig(); engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." - + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME - + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, "" + DEFAULT_TELEMETRY_PORT); + + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME + + PolicyEndPointProperties.PROPERTY_HTTP_PORT_SUFFIX, "" + DEFAULT_TELEMETRY_PORT); engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_USERNAME_SUFFIX, - TELEMETRY_USER); + TELEMETRY_USER); engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME + PolicyEndPointProperties.PROPERTY_HTTP_AUTH_PASSWORD_SUFFIX, - TELEMETRY_PASSWORD); + TELEMETRY_PASSWORD); engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME + PolicyEndPointProperties.PROPERTY_HTTP_SERIALIZATION_PROVIDER, - String.join(",", JacksonHandler.class.getName(), YamlJacksonHandler.class.getName())); + String.join(",", JacksonHandler.class.getName(), YamlJacksonHandler.class.getName())); /* other properties */ - engineProps.put(PolicyEndPointProperties.PROPERTY_UEB_SOURCE_TOPICS, UEB_TOPIC); - engineProps.put(PolicyEndPointProperties.PROPERTY_UEB_SINK_TOPICS, UEB_TOPIC); engineProps.put(PolicyEndPointProperties.PROPERTY_KAFKA_SOURCE_TOPICS, KAFKA_TOPIC); engineProps.put(PolicyEndPointProperties.PROPERTY_KAFKA_SINK_TOPICS, KAFKA_TOPIC); - engineProps.put(UEB_SOURCE_SERVER_PROPERTY, UEB_SERVER); - engineProps.put(UEB_SINK_SERVER_PROPERTY, UEB_SERVER); engineProps.put(KAFKA_SOURCE_SERVER_PROPERTY, KAFKA_SERVER); engineProps.put(KAFKA_SINK_SERVER_PROPERTY, KAFKA_SERVER); @@ -197,41 +185,30 @@ public class RestManagerTest { } private void putDeleteTopicSwitches() throws IOException { - putDeleteSwitch("/engine/topics/sources/ueb/", UEB_TOPIC, "lock"); putDeleteSwitch("/engine/topics/sources/kafka/", KAFKA_TOPIC, "lock"); putDeleteSwitch("/engine/topics/sources/noop/", NOOP_TOPIC, "lock"); - putDeleteSwitch("/engine/topics/sinks/ueb/", UEB_TOPIC, "lock"); putDeleteSwitch("/engine/topics/sinks/kafka/", KAFKA_TOPIC, "lock"); putDeleteSwitch("/engine/topics/sinks/noop/", NOOP_TOPIC, "lock"); - putDeleteSwitch("/engine/topics/sources/ueb/", UEB_TOPIC, "activation"); putDeleteSwitch("/engine/topics/sources/kafka/", KAFKA_TOPIC, "activation"); putDeleteSwitch("/engine/topics/sources/noop/", NOOP_TOPIC, "activation"); - putDeleteSwitch("/engine/topics/sinks/ueb/", UEB_TOPIC, "activation"); putDeleteSwitch("/engine/topics/sinks/kafka/", KAFKA_TOPIC, "activation"); putDeleteSwitch("/engine/topics/sinks/noop/", NOOP_TOPIC, "activation"); - putSwitch("/engine/topics/sources/ueb/", UEB_TOPIC, "activation"); putSwitch("/engine/topics/sources/kafka/", KAFKA_TOPIC, "activation"); putSwitch("/engine/topics/sources/noop/", NOOP_TOPIC, "activation"); - putSwitch("/engine/topics/sinks/ueb/", UEB_TOPIC, "activation"); putSwitch("/engine/topics/sinks/kafka/", KAFKA_TOPIC, "activation"); putSwitch("/engine/topics/sinks/noop/", NOOP_TOPIC, "activation"); } private void putDeleteTopicsSources() throws IOException { - putTest(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC + "/events", 200, - "{x:y}", ContentType.TEXT_PLAIN); 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); - putTest(HOST_URL + "/engine/topics/sources/ueb/fiznits/events", 406, "FOOOO", ContentType.TEXT_PLAIN); putTest(HOST_URL + "/engine/topics/sources/kafka/fiznits/events", 406, "FOOOO", ContentType.TEXT_PLAIN); putTest(HOST_URL + "/engine/topics/switches/lock", 200); - putTest(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC + "/events", - 406, "FOOOO", ContentType.TEXT_PLAIN); putTest(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/events", 406, "FOOOO", ContentType.TEXT_PLAIN); deleteTest(HOST_URL + "/engine/topics/switches/lock", 200); @@ -246,10 +223,10 @@ public class RestManagerTest { deleteTest(HOST_URL + "/engine/controllers/" + FOO_CONTROLLER, 200); } - private void postTest(String uri, int statusCode, String payload, ContentType contentType) throws IOException { + private void postTest(String uri, int statusCode, String payload) throws IOException { HttpPost post = new HttpPost(uri); - if (contentType != null) { - post.setEntity(new StringEntity(payload, contentType)); + if (ContentType.APPLICATION_JSON != null) { + post.setEntity(new StringEntity(payload, ContentType.APPLICATION_JSON)); } requestTest(post, statusCode); } @@ -293,28 +270,19 @@ public class RestManagerTest { @Test void testPost() throws IOException { postTest(HOST_URL + "/engine/inputs/configuration", 406, - Files.readString(Paths.get(PDP_CONFIGURATION_JSON)), - ContentType.APPLICATION_JSON); + Files.readString(Paths.get(PDP_CONFIGURATION_JSON))); - postTest(HOST_URL + "/engine/controllers", 400, - "{}", - ContentType.APPLICATION_JSON); + postTest(HOST_URL + "/engine/controllers", 400, "{}"); - postTest(HOST_URL + "/engine/controllers", 304, - "{controller.name : foo}", - ContentType.APPLICATION_JSON); + postTest(HOST_URL + "/engine/controllers", 304, "{controller.name : foo}"); - postTest(HOST_URL + "/engine/controllers", 206, - "{controller.name : new}", - ContentType.APPLICATION_JSON); + postTest(HOST_URL + "/engine/controllers", 206, "{controller.name : new}"); deleteTest(HOST_URL + "/engine/controllers/new", 200); - postTest(HOST_URL + "/engine/controllers/foo/drools/facts/session1/query1/entity1", 200, - "[{f:v}]", ContentType.APPLICATION_JSON); + postTest(HOST_URL + "/engine/controllers/foo/drools/facts/session1/query1/entity1", 200, "[{f:v}]"); - postTest(HOST_URL + "/engine/controllers/new/drools/facts/session1/query1/entity1", 404, - "[{f:v}]", ContentType.APPLICATION_JSON); + postTest(HOST_URL + "/engine/controllers/new/drools/facts/session1/query1/entity1", 404, "[{f:v}]"); } @Test @@ -491,6 +459,18 @@ public class RestManagerTest { assertEquals(404, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); + testGetDroolsControllers(); + + testGetControllersDecoders(); + + testGetTopics(); + + testGetEngineTools(); + } + + private static void testGetDroolsControllers() throws IOException { + CloseableHttpResponse response; + HttpGet httpGet; /* * GET: /engine/controllers/controllerName/drools/facts * /engine/controllers/controllerName/drools/facts/session @@ -523,7 +503,7 @@ public class RestManagerTest { httpGet.releaseConnection(); httpGet = new HttpGet( - HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/drools/facts/session/query/queriedEntity"); + HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/drools/facts/session/query/queriedEntity"); response = client.execute(httpGet); logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); assertEquals(200, response.getStatusLine().getStatusCode()); @@ -534,8 +514,36 @@ public class RestManagerTest { logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); assertEquals(404, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); + } + private static void testGetEngineTools() throws IOException { + CloseableHttpResponse response; + HttpGet httpGet; + /* + * GET: /engine/tools/uuid /engine/tools/loggers /engine/tools/loggers/loggerName + */ + httpGet = new HttpGet(HOST_URL + "/engine/tools/uuid"); + response = client.execute(httpGet); + logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); + assertEquals(200, response.getStatusLine().getStatusCode()); + httpGet.releaseConnection(); + httpGet = new HttpGet(HOST_URL + "/engine/tools/loggers"); + response = client.execute(httpGet); + logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); + assertEquals(200, response.getStatusLine().getStatusCode()); + httpGet.releaseConnection(); + + httpGet = new HttpGet(HOST_URL + "/engine/tools/loggers/ROOT"); + response = client.execute(httpGet); + logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); + assertEquals(200, response.getStatusLine().getStatusCode()); + httpGet.releaseConnection(); + } + + private static void testGetControllersDecoders() throws IOException { + HttpGet httpGet; + CloseableHttpResponse response; /* * GET: /engine/controllers/controllerName/decoders * /engine/controllers/controllerName/decoders/filters @@ -589,14 +597,14 @@ public class RestManagerTest { httpGet.releaseConnection(); httpGet = new HttpGet( - HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/decoders/topic/filters/factType/rules"); + HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/decoders/topic/filters/factType/rules"); response = client.execute(httpGet); logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); assertEquals(404, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); httpGet = new HttpGet( - HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/decoders/topic/filters/factType/rules/ruleName"); + HOST_URL + "/engine/controllers/" + FOO_CONTROLLER + "/decoders/topic/filters/factType/rules/ruleName"); response = client.execute(httpGet); logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); assertEquals(404, response.getStatusLine().getStatusCode()); @@ -607,15 +615,22 @@ public class RestManagerTest { logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); assertEquals(200, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); + } + private static void testGetTopics() throws IOException { + CloseableHttpResponse response; + HttpGet httpGet; /* - * GET: /engine/topics /engine/topics/switches /engine/topics/sources /engine/topics/sinks - * /engine/topics/sinks/ueb /engine/topics/sources/ueb /engine/topics/sinks/kafka - * /engine/topics/sources/kafka /engine/topics/sinks/ueb/topic - * /engine/topics/sources/ueb/topic /engine/topics/sinks/kafka/topic - * /engine/topics/sources/kafka/topic /engine/topics/sinks/ueb/topic/events - * /engine/topics/sources/ueb/topic/events /engine/topics/sinks/kafka/topic/events - * /engine/topics/sources/kafka/topic/events /engine/topics/sources/ueb/topic/switches + * GET: /engine/topics + * /engine/topics/switches + * /engine/topics/sources + * /engine/topics/sinks + * /engine/topics/sinks/kafka + * /engine/topics/sources/kafka + * /engine/topics/sinks/kafka/topic + * /engine/topics/sources/kafka/topic + * /engine/topics/sinks/kafka/topic/events + * /engine/topics/sources/kafka/topic/events * /engine/topics/sources/kafka/topic/switches */ httpGet = new HttpGet(HOST_URL + "/engine/topics"); @@ -642,18 +657,6 @@ public class RestManagerTest { assertEquals(200, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/kafka"); response = client.execute(httpGet); logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); @@ -678,30 +681,6 @@ public class RestManagerTest { assertEquals(200, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/foobar"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(500, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/" + UEB_TOPIC); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/foobar"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(500, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC); response = client.execute(httpGet); logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); @@ -750,30 +729,6 @@ public class RestManagerTest { assertEquals(500, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC + "/events"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/foobar/events"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(500, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/" + UEB_TOPIC + "/events"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/foobar/events"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(500, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/events"); response = client.execute(httpGet); logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); @@ -822,12 +777,6 @@ public class RestManagerTest { assertEquals(500, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/ueb/" + UEB_TOPIC + "/switches"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sources/kafka/" + KAFKA_TOPIC + "/switches"); response = client.execute(httpGet); logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); @@ -840,12 +789,6 @@ public class RestManagerTest { assertEquals(200, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/ueb/" + UEB_TOPIC + "/switches"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - httpGet = new HttpGet(HOST_URL + "/engine/topics/sinks/kafka/" + KAFKA_TOPIC + "/switches"); response = client.execute(httpGet); logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); @@ -857,27 +800,6 @@ public class RestManagerTest { logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); assertEquals(200, response.getStatusLine().getStatusCode()); httpGet.releaseConnection(); - - /* - * GET: /engine/tools/uuid /engine/tools/loggers /engine/tools/loggers/loggerName - */ - httpGet = new HttpGet(HOST_URL + "/engine/tools/uuid"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/tools/loggers"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); - - httpGet = new HttpGet(HOST_URL + "/engine/tools/loggers/ROOT"); - response = client.execute(httpGet); - logger.info(httpGet.getRequestLine() + " response code: {}", response.getStatusLine().getStatusCode()); - assertEquals(200, response.getStatusLine().getStatusCode()); - httpGet.releaseConnection(); } /** @@ -902,10 +824,10 @@ public class RestManagerTest { private static void cleanUpWorkingDirs() throws IOException { final Path testControllerPath = Paths.get( - SystemPersistenceConstants.getManager().getConfigurationPath().toString(), FOO_CONTROLLER_FILE); + SystemPersistenceConstants.getManager().getConfigurationPath().toString(), FOO_CONTROLLER_FILE); final Path testControllerBakPath = - Paths.get(SystemPersistenceConstants.getManager().getConfigurationPath().toString(), - FOO_CONTROLLER_FILE_BAK); + Paths.get(SystemPersistenceConstants.getManager().getConfigurationPath().toString(), + FOO_CONTROLLER_FILE_BAK); Files.deleteIfExists(testControllerPath); Files.deleteIfExists(testControllerBakPath); 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 a6b8ac3f..b4915ef4 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.drools.system.PolicyEngineConstants.TELEMETRY_SERVER_DEFAULT_NAME; import java.io.File; import java.io.IOException; @@ -33,7 +34,6 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.Properties; import java.util.concurrent.TimeUnit; -import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.MethodOrderer; import org.junit.jupiter.api.Test; @@ -49,6 +49,7 @@ import org.onap.policy.drools.protocol.coders.EventProtocolCoderConstants; import org.onap.policy.drools.protocol.coders.EventProtocolParams; import org.onap.policy.drools.protocol.coders.JsonProtocolFilter; import org.onap.policy.drools.protocol.configuration.DroolsConfiguration; +import org.onap.policy.drools.server.restful.RestManager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -152,6 +153,8 @@ class PolicyEngineTest { void test100Configure() { var manager = (PolicyEngineManager) PolicyEngineConstants.getManager(); var engineProps = manager.defaultTelemetryConfig(); + engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." + TELEMETRY_SERVER_DEFAULT_NAME + + PolicyEndPointProperties.PROPERTY_HTTP_REST_CLASSES_SUFFIX, RestManager.class.getName()); /* override default port */ engineProps.put(PolicyEndPointProperties.PROPERTY_HTTP_SERVER_SERVICES + "." diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/internal/FeatureLockImplTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/internal/FeatureLockImplTest.java index 23511abd..8a10c516 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/internal/FeatureLockImplTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/internal/FeatureLockImplTest.java @@ -40,7 +40,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import java.io.Serial; import java.util.concurrent.ScheduledExecutorService; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; @@ -189,7 +188,6 @@ class FeatureLockImplTest { PolicySession session = mock(PolicySession.class); MyLock lock = new MyLock(LockState.WAITING, RESOURCE, OWNER_KEY, HOLD_SEC, callback) { - @Serial private static final long serialVersionUID = 1L; @Override @@ -397,7 +395,6 @@ class FeatureLockImplTest { * Lock that inherits the normal getSession() method. */ public static class MyLockStdSession extends FeatureLockImpl { - @Serial private static final long serialVersionUID = 1L; protected int nupdates = 0; @@ -433,7 +430,6 @@ class FeatureLockImplTest { } public static class MyLock extends MyLockStdSession { - @Serial private static final long serialVersionUID = 1L; public MyLock() { @@ -451,7 +447,6 @@ class FeatureLockImplTest { } public static class MyLockNoFeature extends MyLock { - @Serial private static final long serialVersionUID = 1L; public MyLockNoFeature() { diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/internal/LockManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/internal/LockManagerTest.java index 74e1a9c1..47d0f275 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/internal/LockManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/internal/LockManagerTest.java @@ -33,7 +33,6 @@ import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; -import java.io.Serial; import java.util.concurrent.ScheduledExecutorService; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; @@ -225,7 +224,6 @@ class LockManagerTest { } private class MyLock extends FeatureLockImpl { - @Serial private static final long serialVersionUID = 1L; public MyLock(LockState waiting, String resourceId, String ownerKey, int holdSec, LockCallback callback) { diff --git a/policy-management/src/test/java/org/onap/policy/drools/system/internal/SimpleLockManagerTest.java b/policy-management/src/test/java/org/onap/policy/drools/system/internal/SimpleLockManagerTest.java index 3ee5583a..242492bb 100644 --- a/policy-management/src/test/java/org/onap/policy/drools/system/internal/SimpleLockManagerTest.java +++ b/policy-management/src/test/java/org/onap/policy/drools/system/internal/SimpleLockManagerTest.java @@ -44,7 +44,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; -import java.io.Serial; import java.util.ArrayList; import java.util.List; import java.util.Properties; @@ -310,7 +309,6 @@ class SimpleLockManagerTest { protected SimpleLock makeLock(LockState waiting, String resourceId, String ownerKey, int holdSec, LockCallback callback) { return new SimpleLock(waiting, resourceId, ownerKey, holdSec, callback, feature) { - @Serial private static final long serialVersionUID = 1L; @Override @@ -367,7 +365,6 @@ class SimpleLockManagerTest { madeLock = true; return new SimpleLock(waiting, resourceId, ownerKey, holdSec, callback, feature) { - @Serial private static final long serialVersionUID = 1L; @Override diff --git a/policy-utils/pom.xml b/policy-utils/pom.xml index 2d84d104..53cb94b7 100644 --- a/policy-utils/pom.xml +++ b/policy-utils/pom.xml @@ -29,7 +29,7 @@ <parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> </parent> <dependencies> diff --git a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Metadata.java b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Metadata.java index e81bdd05..0707e411 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Metadata.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Metadata.java @@ -22,7 +22,6 @@ package org.onap.policy.drools.models.domains.a; import com.google.gson.annotations.SerializedName; -import java.io.Serial; import java.io.Serializable; import lombok.Builder; import lombok.Data; @@ -30,7 +29,6 @@ import lombok.Data; @Data @Builder public class Metadata implements Serializable { - @Serial private static final long serialVersionUID = 476541531265304644L; @SerializedName("policy-id") diff --git a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Nested.java b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Nested.java index 1d46d59d..711e064e 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Nested.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Nested.java @@ -22,7 +22,6 @@ package org.onap.policy.drools.models.domains.a; import com.google.gson.annotations.SerializedName; -import java.io.Serial; import java.io.Serializable; import lombok.Builder; import lombok.Data; @@ -30,7 +29,6 @@ import lombok.Data; @Data @Builder public class Nested implements Serializable { - @Serial private static final long serialVersionUID = -1203143214137354429L; @SerializedName("nested1") diff --git a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Properties.java b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Properties.java index e323e8ac..d403ad22 100644 --- a/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Properties.java +++ b/policy-utils/src/test/java/org/onap/policy/drools/models/domains/a/Properties.java @@ -22,7 +22,6 @@ package org.onap.policy.drools.models.domains.a; import com.google.gson.annotations.SerializedName; -import java.io.Serial; import java.io.Serializable; import lombok.Builder; import lombok.Data; @@ -30,7 +29,6 @@ import lombok.Data; @Data @Builder public class Properties implements Serializable { - @Serial private static final long serialVersionUID = 8476625479607243095L; @SerializedName("nested") @@ -27,13 +27,13 @@ <parent> <groupId>org.onap.policy.parent</groupId> <artifactId>integration</artifactId> - <version>4.1.2-SNAPSHOT</version> + <version>4.1.3-SNAPSHOT</version> <relativePath /> </parent> <groupId>org.onap.policy.drools-pdp</groupId> <artifactId>drools-pdp</artifactId> - <version>2.1.2-SNAPSHOT</version> + <version>2.1.3-SNAPSHOT</version> <packaging>pom</packaging> <name>policy-drools-pdp</name> @@ -51,8 +51,8 @@ <json.path.version>2.9.0</json.path.version> <hibernate.commons.annotations.version>6.0.6.Final</hibernate.commons.annotations.version> <xml.apis.version>1.4.01</xml.apis.version> - <policy.common.version>2.1.2-SNAPSHOT</policy.common.version> - <policy.models.version>3.1.2-SNAPSHOT</policy.models.version> + <policy.common.version>2.1.3-SNAPSHOT</policy.common.version> + <policy.models.version>3.1.3-SNAPSHOT</policy.models.version> </properties> <modules> @@ -84,6 +84,10 @@ <scope>provided</scope> </dependency> <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </dependency> + <dependency> <groupId>org.onap.policy.common</groupId> <artifactId>utils-test</artifactId> <version>${policy.common.version}</version> @@ -157,7 +161,7 @@ <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> - <release>${java.version}</release> + <release>11</release> </configuration> </plugin> <plugin> diff --git a/releases/2.1.2-container.yaml b/releases/2.1.2-container.yaml new file mode 100644 index 00000000..9cbbfa04 --- /dev/null +++ b/releases/2.1.2-container.yaml @@ -0,0 +1,8 @@ +distribution_type: 'container' +container_release_tag: '2.1.2' +project: 'policy-drools-pdp' +log_dir: 'policy-drools-pdp-maven-docker-stage-master/1416' +ref: 3546b42b80eae4d6ff9138a497ddbabeb19e13b4 +containers: + - name: 'policy-drools' + version: '2.1.2-20240425T1239' diff --git a/releases/2.1.2.yaml b/releases/2.1.2.yaml new file mode 100644 index 00000000..c5e5776a --- /dev/null +++ b/releases/2.1.2.yaml @@ -0,0 +1,5 @@ +distribution_type: 'maven' +version: '2.1.2' +project: 'policy-drools-pdp' +tag_release: false +log_dir: 'policy-drools-pdp-maven-stage-master/1423/' diff --git a/version.properties b/version.properties index 50539a03..28a1d8d2 100644 --- a/version.properties +++ b/version.properties @@ -4,7 +4,7 @@ major=2 minor=1 -patch=2 +patch=3 base_version=${major}.${minor}.${patch} |