aboutsummaryrefslogtreecommitdiffstats
path: root/services/services-onappf
diff options
context:
space:
mode:
Diffstat (limited to 'services/services-onappf')
-rw-r--r--services/services-onappf/pom.xml2
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java8
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStateChangeListener.java4
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStatusPublisher.java6
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpUpdateListener.java4
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java1
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java68
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java6
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java4
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java2
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java19
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java2
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterGroup.java4
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestToscaPolicyTypeIdentifierParameters.java49
-rw-r--r--services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/rest/TestHealthCheckRestControllerV1.java3
15 files changed, 125 insertions, 57 deletions
diff --git a/services/services-onappf/pom.xml b/services/services-onappf/pom.xml
index 799f580f6..013066a90 100644
--- a/services/services-onappf/pom.xml
+++ b/services/services-onappf/pom.xml
@@ -24,7 +24,7 @@
<parent>
<groupId>org.onap.policy.apex-pdp.services</groupId>
<artifactId>services</artifactId>
- <version>4.0.0-SNAPSHOT</version>
+ <version>4.0.2-SNAPSHOT</version>
</parent>
<artifactId>services-onappf</artifactId>
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
index de262856d..bffc635f8 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2021, 2023 Nordix Foundation.
+ * Copyright (C) 2019-2021, 2023-2024 Nordix Foundation.
* Modifications Copyright (C) 2019, 2021 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2021 Bell Canada. All rights reserved.
* ================================================================================
@@ -33,11 +33,11 @@ import org.onap.policy.apex.services.onappf.exception.ApexStarterRunTimeExceptio
import org.onap.policy.apex.services.onappf.handler.PdpMessageHandler;
import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterGroup;
import org.onap.policy.apex.services.onappf.rest.HealthCheckRestControllerV1;
-import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager;
-import org.onap.policy.common.endpoints.event.comm.TopicSink;
-import org.onap.policy.common.endpoints.event.comm.TopicSource;
import org.onap.policy.common.endpoints.http.server.RestServer;
import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher;
+import org.onap.policy.common.message.bus.event.TopicEndpointManager;
+import org.onap.policy.common.message.bus.event.TopicSink;
+import org.onap.policy.common.message.bus.event.TopicSource;
import org.onap.policy.common.utils.network.NetworkUtil;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.common.utils.services.ServiceManager;
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStateChangeListener.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStateChangeListener.java
index 404749051..433886878 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStateChangeListener.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStateChangeListener.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,8 @@
package org.onap.policy.apex.services.onappf.comm;
import org.onap.policy.apex.services.onappf.handler.PdpStateChangeMessageHandler;
-import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
+import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.models.pdp.concepts.PdpStateChange;
import org.slf4j.Logger;
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStatusPublisher.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStatusPublisher.java
index 499a0280a..c374817f8 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStatusPublisher.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpStatusPublisher.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -26,8 +26,8 @@ import java.util.Timer;
import java.util.TimerTask;
import lombok.Getter;
import org.onap.policy.apex.services.onappf.handler.PdpMessageHandler;
-import org.onap.policy.common.endpoints.event.comm.TopicSink;
-import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
+import org.onap.policy.common.message.bus.event.TopicSink;
+import org.onap.policy.common.message.bus.event.client.TopicSinkClient;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpUpdateListener.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpUpdateListener.java
index 5633d60fb..7012e4cf1 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpUpdateListener.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/comm/PdpUpdateListener.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2024 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,8 +21,8 @@
package org.onap.policy.apex.services.onappf.comm;
import org.onap.policy.apex.services.onappf.handler.PdpUpdateMessageHandler;
-import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
+import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.coder.StandardCoderObject;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
import org.slf4j.Logger;
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java
index 4d3de3293..e70d39bc1 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java
@@ -25,7 +25,6 @@ package org.onap.policy.apex.services.onappf.handler;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
-import java.util.stream.Collectors;
import org.onap.policy.apex.service.engine.main.ApexPolicyStatisticsManager;
import org.onap.policy.apex.services.onappf.ApexStarterConstants;
import org.onap.policy.apex.services.onappf.comm.PdpStatusPublisher;
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java
index f6567f06e..89aba1e77 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java
@@ -32,7 +32,7 @@ import org.onap.policy.apex.service.engine.main.ApexPolicyStatisticsManager;
import org.onap.policy.apex.services.onappf.ApexStarterConstants;
import org.onap.policy.apex.services.onappf.comm.PdpStatusPublisher;
import org.onap.policy.apex.services.onappf.exception.ApexStarterException;
-import org.onap.policy.common.endpoints.event.comm.TopicSink;
+import org.onap.policy.common.message.bus.event.TopicSink;
import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.models.pdp.concepts.PdpResponseDetails;
import org.onap.policy.models.pdp.concepts.PdpStatus;
@@ -64,15 +64,15 @@ public class PdpUpdateMessageHandler {
final var pdpStatusContext = Registry.get(ApexStarterConstants.REG_PDP_STATUS_OBJECT, PdpStatus.class);
PdpResponseDetails pdpResponseDetails = null;
if (pdpUpdateMsg.appliesTo(pdpStatusContext.getName(), pdpStatusContext.getPdpGroup(),
- pdpStatusContext.getPdpSubgroup())) {
+ pdpStatusContext.getPdpSubgroup())) {
if (checkIfAlreadyHandled(pdpUpdateMsg, pdpStatusContext)) {
pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpUpdateMsg.getRequestId(),
- PdpResponseStatus.SUCCESS, "Pdp already updated");
+ PdpResponseStatus.SUCCESS, "Pdp already updated");
} else {
pdpResponseDetails = handlePdpUpdate(pdpUpdateMsg, pdpMessageHandler, pdpStatusContext);
}
final var pdpStatusPublisherTemp =
- Registry.get(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
+ Registry.get(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
final var pdpStatus = pdpMessageHandler.createPdpStatusFromContext();
pdpStatus.setResponse(pdpResponseDetails);
pdpStatus.setDescription("Pdp status response message for PdpUpdate");
@@ -83,39 +83,39 @@ public class PdpUpdateMessageHandler {
/**
* Method to do pdp update.
*
- * @param pdpUpdateMsg the pdp update message
+ * @param pdpUpdateMsg the pdp update message
* @param pdpMessageHandler the message handler
- * @param pdpStatusContext the pdp status in memory
+ * @param pdpStatusContext the pdp status in memory
* @return pdpResponseDetails the pdp response
*/
private PdpResponseDetails handlePdpUpdate(final PdpUpdate pdpUpdateMsg, final PdpMessageHandler pdpMessageHandler,
- final PdpStatus pdpStatusContext) {
+ final PdpStatus pdpStatusContext) {
PdpResponseDetails pdpResponseDetails = null;
final var pdpStatusPublisher =
- Registry.get(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
+ Registry.get(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
if (null != pdpUpdateMsg.getPdpHeartbeatIntervalMs() && pdpUpdateMsg.getPdpHeartbeatIntervalMs() > 0
- && pdpStatusPublisher.getInterval() != pdpUpdateMsg.getPdpHeartbeatIntervalMs()) {
+ && pdpStatusPublisher.getInterval() != pdpUpdateMsg.getPdpHeartbeatIntervalMs()) {
updateInterval(pdpUpdateMsg.getPdpHeartbeatIntervalMs());
}
pdpStatusContext.setPdpGroup(pdpUpdateMsg.getPdpGroup());
pdpStatusContext.setPdpSubgroup(pdpUpdateMsg.getPdpSubgroup());
@SuppressWarnings("unchecked")
List<ToscaPolicy> policies = Registry.getOrDefault(ApexStarterConstants.REG_APEX_TOSCA_POLICY_LIST,
- List.class, new ArrayList<>());
+ List.class, new ArrayList<>());
policies.addAll(pdpUpdateMsg.getPoliciesToBeDeployed());
policies.removeIf(policy -> pdpUpdateMsg.getPoliciesToBeUndeployed().contains(policy.getIdentifier()));
Set<ToscaConceptIdentifier> policiesInDeployment = policies.stream().map(ToscaPolicy::getIdentifier)
- .collect(Collectors.toSet());
+ .collect(Collectors.toSet());
policiesInDeployment.removeAll(pdpUpdateMsg.getPoliciesToBeUndeployed());
pdpStatusContext.setPolicies(new ArrayList<>(policiesInDeployment));
Registry.registerOrReplace(ApexStarterConstants.REG_APEX_TOSCA_POLICY_LIST,
- policies);
+ policies);
if (pdpStatusContext.getState().equals(PdpState.ACTIVE)) {
pdpResponseDetails = startOrStopApexEngineBasedOnPolicies(pdpUpdateMsg, pdpMessageHandler);
var apexEngineHandler =
Registry.getOrDefault(ApexStarterConstants.REG_APEX_ENGINE_HANDLER, ApexEngineHandler.class, null);
- // in hearbeat while in active state, only the policies which are running should be there.
+ // in heartbeat while in active state, only the policies which are running should be there.
// if some policy fails, that shouldn't go in the heartbeat.
// If no policies are running, then the policy list in the heartbeat can be empty
if (null != apexEngineHandler && apexEngineHandler.isApexEngineRunning()) {
@@ -129,7 +129,7 @@ public class PdpUpdateMessageHandler {
}
if (null == pdpResponseDetails) {
pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpUpdateMsg.getRequestId(),
- PdpResponseStatus.SUCCESS, "Pdp update successful.");
+ PdpResponseStatus.SUCCESS, "Pdp update successful.");
}
return pdpResponseDetails;
}
@@ -137,14 +137,14 @@ public class PdpUpdateMessageHandler {
/**
* Method to start or stop apex engine based on the list of policies received from pap. When current state is
* active, if PAP sends PdpUpdate with empty policies list, stop apex engine, or, if there is a change in policies,
- * stop the current running policies and the deploy the new ones.
+ * stop the current running policies and then deploy the new ones.
*
- * @param pdpUpdateMsg the pdp update message from pap
+ * @param pdpUpdateMsg the pdp update message from pap
* @param pdpMessageHandler pdp message handler
* @return pdpResponseDetails the pdp response
*/
private PdpResponseDetails startOrStopApexEngineBasedOnPolicies(final PdpUpdate pdpUpdateMsg,
- final PdpMessageHandler pdpMessageHandler) {
+ final PdpMessageHandler pdpMessageHandler) {
PdpResponseDetails pdpResponseDetails = null;
ApexEngineHandler apexEngineHandler = null;
try {
@@ -163,7 +163,8 @@ public class PdpUpdateMessageHandler {
}
private PdpResponseDetails stopApexEngineBasedOnPolicies(final PdpUpdate pdpUpdateMsg,
- final PdpMessageHandler pdpMessageHandler, ApexEngineHandler apexEngineHandler) {
+ final PdpMessageHandler pdpMessageHandler,
+ ApexEngineHandler apexEngineHandler) {
PdpResponseDetails pdpResponseDetails = null;
if (null != apexEngineHandler && apexEngineHandler.isApexEngineRunning()) {
List<ToscaConceptIdentifier> runningPolicies = apexEngineHandler.getRunningPolicies();
@@ -175,7 +176,7 @@ public class PdpUpdateMessageHandler {
} catch (final ApexStarterException e) {
LOGGER.error("Pdp update failed as the policies couldn't be undeployed.", e);
pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpUpdateMsg.getRequestId(),
- PdpResponseStatus.FAIL, "Pdp update failed as the policies couldn't be undeployed.");
+ PdpResponseStatus.FAIL, "Pdp update failed as the policies couldn't be undeployed.");
}
updateDeploymentCounts(runningPolicies, pdpUpdateMsg);
}
@@ -183,7 +184,8 @@ public class PdpUpdateMessageHandler {
}
private PdpResponseDetails startApexEngineBasedOnPolicies(final PdpUpdate pdpUpdateMsg,
- final PdpMessageHandler pdpMessageHandler, ApexEngineHandler apexEngineHandler) {
+ final PdpMessageHandler pdpMessageHandler,
+ ApexEngineHandler apexEngineHandler) {
PdpResponseDetails pdpResponseDetails = null;
List<ToscaConceptIdentifier> runningPolicies = new ArrayList<>();
try {
@@ -206,14 +208,15 @@ public class PdpUpdateMessageHandler {
} catch (final ApexStarterException e) {
LOGGER.error("Apex engine service running failed. ", e);
pdpResponseDetails = pdpMessageHandler.createPdpResponseDetails(pdpUpdateMsg.getRequestId(),
- PdpResponseStatus.FAIL, "Apex engine service running failed. " + e.getMessage());
+ PdpResponseStatus.FAIL, "Apex engine service running failed. " + e.getMessage());
}
updateDeploymentCounts(runningPolicies, pdpUpdateMsg);
return pdpResponseDetails;
}
private PdpResponseDetails populateResponseForEngineInitiation(final PdpUpdate pdpUpdateMsg,
- final PdpMessageHandler pdpMessageHandler, ApexEngineHandler apexEngineHandler) {
+ final PdpMessageHandler pdpMessageHandler,
+ ApexEngineHandler apexEngineHandler) {
PdpResponseDetails pdpResponseDetails;
Set<ToscaConceptIdentifier> runningPolicies = new HashSet<>(apexEngineHandler.getRunningPolicies());
List<ToscaConceptIdentifier> policiesToBeDeployed =
@@ -252,7 +255,7 @@ public class PdpUpdateMessageHandler {
/**
* Method checks if the Pdp update message is already handled by checking the values in the context.
*
- * @param pdpUpdateMsg pdp update message received from pap
+ * @param pdpUpdateMsg pdp update message received from pap
* @param pdpStatusContext values saved in context memory
* @return boolean flag which tells if the information is same or not
*/
@@ -263,7 +266,7 @@ public class PdpUpdateMessageHandler {
&& pdpStatusContext.getPdpSubgroup().equals(pdpUpdateMsg.getPdpSubgroup())
&& null != pdpStatusContext.getPolicies()
&& pdpStatusContext.getPolicies()
- .containsAll(new PdpMessageHandler().getToscaPolicyIdentifiers(pdpUpdateMsg.getPoliciesToBeDeployed()))
+ .containsAll(new PdpMessageHandler().getToscaPolicyIdentifiers(pdpUpdateMsg.getPoliciesToBeDeployed()))
&& !containsAny(new HashSet<>(pdpStatusContext.getPolicies()), pdpUpdateMsg.getPoliciesToBeUndeployed());
}
@@ -274,32 +277,33 @@ public class PdpUpdateMessageHandler {
*/
public void updateInterval(final long interval) {
final var pdpStatusPublisher =
- Registry.get(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
+ Registry.get(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER, PdpStatusPublisher.class);
pdpStatusPublisher.terminate();
final List<TopicSink> topicSinks = Registry.get(ApexStarterConstants.REG_APEX_PDP_TOPIC_SINKS);
Registry.registerOrReplace(ApexStarterConstants.REG_PDP_STATUS_PUBLISHER,
- new PdpStatusPublisher(topicSinks, interval));
+ new PdpStatusPublisher(topicSinks, interval));
}
/**
* Checks if one list contains any element of another.
*
- * @param listToCheckWith list to check contents of
+ * @param listToCheckWith list to check contents of
* @param listToCheckAgainst list to check against other list for similarities
* @return boolean flag which tells if lists share same elements or not
*/
private boolean containsAny(Set<ToscaConceptIdentifier> listToCheckWith,
- List<ToscaConceptIdentifier> listToCheckAgainst) {
+ List<ToscaConceptIdentifier> listToCheckAgainst) {
return listToCheckAgainst.stream().anyMatch(listToCheckWith::contains);
}
/**
* Update count values for deployment actions (deploy and undeploy) when applicable.
+ *
* @param runningPolicies the policies running in apex engine
- * @param pdpUpdateMsg the pdp update message from pap
+ * @param pdpUpdateMsg the pdp update message from pap
*/
private void updateDeploymentCounts(final List<ToscaConceptIdentifier> runningPolicies,
- final PdpUpdate pdpUpdateMsg) {
+ final PdpUpdate pdpUpdateMsg) {
final var statisticsManager = ApexPolicyStatisticsManager.getInstanceFromRegistry();
if (statisticsManager != null && runningPolicies != null) {
if (pdpUpdateMsg.getPoliciesToBeDeployed() != null && !pdpUpdateMsg.getPoliciesToBeDeployed().isEmpty()) {
@@ -310,7 +314,7 @@ public class PdpUpdateMessageHandler {
policiesSuccessfullyDeployed.retainAll(runningPolicies);
policiesSuccessfullyDeployed.forEach(policy -> statisticsManager.updatePolicyDeployCounter(true));
- var policiesFailedToDeploy = new ArrayList<>(policiesToDeploy);
+ var policiesFailedToDeploy = new ArrayList<>(policiesToDeploy);
policiesFailedToDeploy.removeIf(runningPolicies::contains);
policiesFailedToDeploy.forEach(policy -> statisticsManager.updatePolicyDeployCounter(false));
}
@@ -321,7 +325,7 @@ public class PdpUpdateMessageHandler {
policiesFailedToUndeploy.retainAll(runningPolicies);
policiesFailedToUndeploy.forEach(policy -> statisticsManager.updatePolicyUndeployCounter(false));
- var policiesSuccessfullyUndeployed = new ArrayList<>(policiesToUndeploy);
+ var policiesSuccessfullyUndeployed = new ArrayList<>(policiesToUndeploy);
policiesSuccessfullyUndeployed.removeIf(runningPolicies::contains);
policiesSuccessfullyUndeployed.forEach(policy -> statisticsManager.updatePolicyUndeployCounter(true));
}
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java
index f752348b4..4fc5d4a14 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/parameters/ApexStarterParameterGroup.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,12 +22,12 @@
package org.onap.policy.apex.services.onappf.parameters;
import lombok.Getter;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
-import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
import org.onap.policy.common.parameters.ParameterGroupImpl;
import org.onap.policy.common.parameters.annotations.NotBlank;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
+import org.onap.policy.common.parameters.rest.RestServerParameters;
+import org.onap.policy.common.parameters.topic.TopicParameterGroup;
/**
* Class to hold all parameters needed for apex starter component.
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java
index b6962e925..f99f394cc 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/rest/HealthCheckProvider.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2019, 2024 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -23,7 +23,7 @@ package org.onap.policy.apex.services.onappf.rest;
import org.onap.policy.apex.services.onappf.ApexStarterActivator;
import org.onap.policy.apex.services.onappf.ApexStarterConstants;
-import org.onap.policy.common.endpoints.report.HealthCheckReport;
+import org.onap.policy.common.utils.report.HealthCheckReport;
import org.onap.policy.common.utils.services.Registry;
/**
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java
index 7bff64652..395759846 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpStateChangeListener.java
@@ -44,7 +44,7 @@ import org.onap.policy.apex.services.onappf.exception.ApexStarterException;
import org.onap.policy.apex.services.onappf.handler.ApexEngineHandler;
import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterGroup;
import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterHandler;
-import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.cmd.CommandLineException;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.services.Registry;
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java
index 56889cf72..da11bb7e3 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/comm/TestPdpUpdateListener.java
@@ -45,7 +45,7 @@ import org.onap.policy.apex.services.onappf.handler.ApexEngineHandler;
import org.onap.policy.apex.services.onappf.handler.PdpMessageHandler;
import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterGroup;
import org.onap.policy.apex.services.onappf.parameters.ApexStarterParameterHandler;
-import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
+import org.onap.policy.common.message.bus.event.Topic.CommInfrastructure;
import org.onap.policy.common.utils.cmd.CommandLineException;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.services.Registry;
@@ -212,4 +212,21 @@ class TestPdpUpdateListener {
"Apex engine started. But, only the following polices are running - apex_policy_name:1.0 . "
+ "Other policies failed execution. Please see the logs for more details."));
}
+
+ @Test
+ void testPdpUpdateMessageListener_pdpUpdateMessageIntervalZero() throws CoderException {
+ final PdpStatus pdpStatus = Registry.get(ApexStarterConstants.REG_PDP_STATUS_OBJECT);
+ final ToscaPolicy toscaPolicy =
+ TestListenerUtils.createToscaPolicy("apex policy name", "1.0", "src/test/resources/dummyProperties.json");
+ final List<ToscaPolicy> toscaPolicies = new ArrayList<ToscaPolicy>();
+ toscaPolicies.add(toscaPolicy);
+ final PdpUpdate pdpUpdateMsg = TestListenerUtils.createPdpUpdateMsg(pdpStatus, toscaPolicies,
+ new LinkedList<>());
+ pdpUpdateMsg.setPdpHeartbeatIntervalMs((long) -1);
+ pdpUpdateMessageListener.onTopicEvent(INFRA, TOPIC, null, pdpUpdateMsg);
+ assertEquals(pdpStatus.getPdpGroup(), pdpUpdateMsg.getPdpGroup());
+ assertEquals(pdpStatus.getPdpSubgroup(), pdpUpdateMsg.getPdpSubgroup());
+ assertEquals(pdpStatus.getPolicies(),
+ new PdpMessageHandler().getToscaPolicyIdentifiers(pdpUpdateMsg.getPoliciesToBeDeployed()));
+ }
}
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
index 099663af9..cdfb76c84 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/CommonTestData.java
@@ -23,8 +23,8 @@ package org.onap.policy.apex.services.onappf.parameters;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
-import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.parameters.ParameterGroup;
+import org.onap.policy.common.parameters.topic.TopicParameters;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterGroup.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterGroup.java
index bd063d06a..c1e5daa0a 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterGroup.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestApexStarterParameterGroup.java
@@ -29,9 +29,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Map;
import org.junit.jupiter.api.Test;
-import org.onap.policy.common.endpoints.parameters.RestServerParameters;
-import org.onap.policy.common.endpoints.parameters.TopicParameterGroup;
import org.onap.policy.common.parameters.ValidationResult;
+import org.onap.policy.common.parameters.rest.RestServerParameters;
+import org.onap.policy.common.parameters.topic.TopicParameterGroup;
/**
* Class to perform unit test of {@link ApexStarterParameterGroup}.
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestToscaPolicyTypeIdentifierParameters.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestToscaPolicyTypeIdentifierParameters.java
new file mode 100644
index 000000000..001087dbc
--- /dev/null
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/parameters/TestToscaPolicyTypeIdentifierParameters.java
@@ -0,0 +1,49 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * 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.
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.apex.services.onappf.parameters;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.Test;
+
+class TestToscaPolicyTypeIdentifierParameters {
+
+ ToscaPolicyTypeIdentifierParameters parameters;
+ ToscaPolicyTypeIdentifierParameters parametersCopy;
+
+ @Test
+ void test() {
+ parameters = getParametersInstance();
+ parametersCopy = getParametersInstance();
+
+ // testing the equals method ToscaPolicyTypeIdentifierParameters
+ assertTrue(parameters.equals(parametersCopy)); //NOSONAR
+ assertEquals(parameters.hashCode(), parametersCopy.hashCode());
+ }
+
+ protected ToscaPolicyTypeIdentifierParameters getParametersInstance() {
+ ToscaPolicyTypeIdentifierParameters parametersTest = new ToscaPolicyTypeIdentifierParameters();
+ parametersTest.setName("testName");
+ parametersTest.setVersion("1.0.0");
+ return parametersTest;
+ }
+} \ No newline at end of file
diff --git a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/rest/TestHealthCheckRestControllerV1.java b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/rest/TestHealthCheckRestControllerV1.java
index a63824a0e..3364efa8a 100644
--- a/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/rest/TestHealthCheckRestControllerV1.java
+++ b/services/services-onappf/src/test/java/org/onap/policy/apex/services/onappf/rest/TestHealthCheckRestControllerV1.java
@@ -27,9 +27,8 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.client.SyncInvoker;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import org.onap.policy.common.endpoints.report.HealthCheckReport;
+import org.onap.policy.common.utils.report.HealthCheckReport;
/**
* Class to perform unit test of {@link HealthCheckRestControllerV1}.