summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiam Fallon <liam.fallon@est.tech>2021-01-06 20:44:53 +0000
committerGerrit Code Review <gerrit@onap.org>2021-01-06 20:44:53 +0000
commitd05021ebfc7a7f57cb88a5e380b403118ceeaa13 (patch)
tree9669dfb7faf166301c6b7a848e93e01bbbb4249f
parent65450784b137f50442fdf170a2358c3953560d1d (diff)
parentf9455834e7e014fed6e941184ab80eb9fe91d89f (diff)
Merge "Changed identifiers to concept identifiers"
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java20
-rw-r--r--services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java20
-rw-r--r--services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java18
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/ApexStarterActivator.java6
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java14
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java17
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpStateChangeMessageHandler.java8
-rw-r--r--services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpUpdateMessageHandler.java8
8 files changed, 55 insertions, 56 deletions
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java
index 4d3349b83..cadcc7ee8 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexActivator.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2019-2020 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -50,7 +50,7 @@ import org.onap.policy.apex.service.parameters.engineservice.EngineServiceParame
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerPeeredMode;
import org.onap.policy.common.parameters.ParameterService;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -69,10 +69,10 @@ public class ApexActivator {
// The parameters of the Apex activator when running with multiple policies
@Getter
@Setter
- private Map<ToscaPolicyIdentifier, ApexParameters> apexParametersMap;
+ private Map<ToscaConceptIdentifier, ApexParameters> apexParametersMap;
@Getter
- Map<ToscaPolicyIdentifier, AxPolicyModel> policyModelsMap;
+ Map<ToscaConceptIdentifier, AxPolicyModel> policyModelsMap;
// Event unmarshalers are used to receive events asynchronously into Apex
private final Map<String, ApexEventUnmarshaller> unmarshallerMap = new LinkedHashMap<>();
@@ -95,7 +95,7 @@ public class ApexActivator {
*
* @param parametersMap the apex parameters map for the Apex service
*/
- public ApexActivator(Map<ToscaPolicyIdentifier, ApexParameters> parametersMap) {
+ public ApexActivator(Map<ToscaConceptIdentifier, ApexParameters> parametersMap) {
apexParametersMap = parametersMap;
}
@@ -128,7 +128,7 @@ public class ApexActivator {
policyModelsMap = new LinkedHashMap<>();
Map<String, EventHandlerParameters> inputParametersMap = new LinkedHashMap<>();
Map<String, EventHandlerParameters> outputParametersMap = new LinkedHashMap<>();
- Set<Entry<ToscaPolicyIdentifier, ApexParameters>> apexParamsEntrySet = new LinkedHashSet<>(
+ Set<Entry<ToscaConceptIdentifier, ApexParameters>> apexParamsEntrySet = new LinkedHashSet<>(
apexParametersMap.entrySet());
apexParamsEntrySet.stream().forEach(apexParamsEntry -> {
ApexParameters apexParams = apexParamsEntry.getValue();
@@ -175,12 +175,12 @@ public class ApexActivator {
startUnmarshallers(inputParametersMap);
}
- private AxPolicyModel aggregatePolicyModels(Map<ToscaPolicyIdentifier, AxPolicyModel> policyModelsMap) {
+ private AxPolicyModel aggregatePolicyModels(Map<ToscaConceptIdentifier, AxPolicyModel> policyModelsMap) {
// Doing a deep copy so that original values in policyModelsMap is retained
// after reduction operation
- Set<Entry<ToscaPolicyIdentifier, AxPolicyModel>> policyModelsEntries = policyModelsMap.entrySet().stream()
+ Set<Entry<ToscaConceptIdentifier, AxPolicyModel>> policyModelsEntries = policyModelsMap.entrySet().stream()
.map(entry -> new AbstractMap.SimpleEntry<>(entry.getKey(), entry.getValue())).collect(Collectors.toSet());
- Optional<Entry<ToscaPolicyIdentifier, AxPolicyModel>> finalPolicyModelEntry = policyModelsEntries.stream()
+ Optional<Entry<ToscaConceptIdentifier, AxPolicyModel>> finalPolicyModelEntry = policyModelsEntries.stream()
.reduce((entry1, entry2) -> {
try {
entry1.setValue(
@@ -303,7 +303,7 @@ public class ApexActivator {
* @param apexParamsMap the apex parameters map for the Apex service
* @throws ApexException on errors
*/
- public void updateModel(Map<ToscaPolicyIdentifier, ApexParameters> apexParamsMap) throws ApexException {
+ public void updateModel(Map<ToscaConceptIdentifier, ApexParameters> apexParamsMap) throws ApexException {
try {
ApexParameters apexParameters = apexParamsMap.values().iterator().next();
setUpModelMarshallerAndUnmarshaller(apexParameters);
diff --git a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
index 459cdff24..5707c95ad 100644
--- a/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
+++ b/services/services-engine/src/main/java/org/onap/policy/apex/service/engine/main/ApexMain.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2016-2018 Ericsson. All rights reserved.
- * Modification Copyright (C) 2019-2020 Nordix Foundation.
+ * Modification Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -43,7 +43,7 @@ import org.onap.policy.apex.service.parameters.ApexParameterHandler;
import org.onap.policy.apex.service.parameters.ApexParameters;
import org.onap.policy.apex.service.parameters.eventhandler.EventHandlerParameters;
import org.onap.policy.common.parameters.ParameterService;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.ext.XLogger;
import org.slf4j.ext.XLoggerFactory;
@@ -62,7 +62,7 @@ public class ApexMain {
// The parameters read in from JSON for each policy
@Getter
- private Map<ToscaPolicyIdentifier, ApexParameters> apexParametersMap;
+ private Map<ToscaConceptIdentifier, ApexParameters> apexParametersMap;
//engineParameters are aggregated in case of multiple policies
private EngineParameters aggregatedEngineParameters;
@@ -83,7 +83,7 @@ public class ApexMain {
apexParametersMap = new LinkedHashMap<>();
aggregatedEngineParameters = new EngineParameters();
try {
- apexParametersMap.put(new ToscaPolicyIdentifier(), populateApexParameters(args));
+ apexParametersMap.put(new ToscaConceptIdentifier(), populateApexParameters(args));
} catch (ApexException e) {
LOGGER.error(APEX_SERVICE_FAILED_MSG, e);
return;
@@ -112,10 +112,10 @@ public class ApexMain {
* @param policyArgumentsMap the map with command line arguments as value and policy-id as key
* @throws ApexException on errors
*/
- public ApexMain(Map<ToscaPolicyIdentifier, String[]> policyArgumentsMap) throws ApexException {
+ public ApexMain(Map<ToscaConceptIdentifier, String[]> policyArgumentsMap) throws ApexException {
apexParametersMap = new LinkedHashMap<>();
aggregatedEngineParameters = new EngineParameters();
- for (Entry<ToscaPolicyIdentifier, String[]> policyArgsEntry: policyArgumentsMap.entrySet()) {
+ for (Entry<ToscaConceptIdentifier, String[]> policyArgsEntry: policyArgumentsMap.entrySet()) {
try {
apexParametersMap.put(policyArgsEntry.getKey(), populateApexParameters(policyArgsEntry.getValue()));
} catch (ApexException e) {
@@ -157,14 +157,14 @@ public class ApexMain {
* @param policyArgsMap the map with command line arguments as value and policy-id as key
* @throws ApexException on errors
*/
- public void updateModel(Map<ToscaPolicyIdentifier, String[]> policyArgsMap) throws ApexException {
+ public void updateModel(Map<ToscaConceptIdentifier, String[]> policyArgsMap) throws ApexException {
// flag that determines if any policy received in PDP_UPDATE is already deployed in the engine
boolean isAnyPolicyDeployed = policyArgsMap.keySet().stream().anyMatch(apexParametersMap::containsKey);
apexParametersMap.clear();
aggregatedEngineParameters = new EngineParameters();
AxContextAlbums albums = ModelService.getModel(AxContextAlbums.class);
Map<AxArtifactKey, AxContextAlbum> albumsMap = new TreeMap<>();
- for (Entry<ToscaPolicyIdentifier, String[]> policyArgsEntry : policyArgsMap.entrySet()) {
+ for (Entry<ToscaConceptIdentifier, String[]> policyArgsEntry : policyArgsMap.entrySet()) {
findAlbumsToHold(albumsMap, policyArgsEntry.getKey());
try {
apexParametersMap.put(policyArgsEntry.getKey(), populateApexParameters(policyArgsEntry.getValue()));
@@ -207,8 +207,8 @@ public class ApexMain {
* @param albumsMap the albums which should be kept during model update
* @param policyId the policy id of current policy
*/
- private void findAlbumsToHold(Map<AxArtifactKey, AxContextAlbum> albumsMap, ToscaPolicyIdentifier policyId) {
- for (Entry<ToscaPolicyIdentifier, AxPolicyModel> policyModelsEntry : activator.getPolicyModelsMap()
+ private void findAlbumsToHold(Map<AxArtifactKey, AxContextAlbum> albumsMap, ToscaConceptIdentifier policyId) {
+ for (Entry<ToscaConceptIdentifier, AxPolicyModel> policyModelsEntry : activator.getPolicyModelsMap()
.entrySet()) {
// If a policy with the same major version is received in PDP_UPDATE,
// context for that policy has to be retained. For this, take such policies' albums
diff --git a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
index 122e47bb1..68472d4de 100644
--- a/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
+++ b/services/services-engine/src/test/java/org/onap/policy/apex/service/engine/main/ApexMainTest.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Ericsson. All rights reserved.
- * Modifications Copyright (C) 2020 Nordix Foundation.
+ * Modifications Copyright (C) 2020-2021 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -37,7 +37,7 @@ import org.junit.After;
import org.junit.Test;
import org.onap.policy.apex.model.basicmodel.concepts.ApexException;
import org.onap.policy.apex.service.parameters.ApexParameters;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Test the ApexMain class.
@@ -146,9 +146,9 @@ public class ApexMainTest {
public void testCorrectParametersWithMultiplePolicies() throws ApexException {
OutputStream outContent = new ByteArrayOutputStream();
System.setOut(new PrintStream(outContent));
- Map<ToscaPolicyIdentifier, String[]> argsMap = new HashMap<ToscaPolicyIdentifier, String[]>();
+ Map<ToscaConceptIdentifier, String[]> argsMap = new HashMap<ToscaConceptIdentifier, String[]>();
String[] args = {"-p", "src/test/resources/parameters/correctParams.json"};
- argsMap.put(new ToscaPolicyIdentifier("id1", "v1"), args);
+ argsMap.put(new ToscaConceptIdentifier("id1", "v1"), args);
final ApexMain apexMain = new ApexMain(argsMap);
ApexParameters apexParam = (ApexParameters) apexMain.getApexParametersMap().values().toArray()[0];
assertEquals("MyApexEngine", apexParam.getEngineServiceParameters().getName());
@@ -161,10 +161,10 @@ public class ApexMainTest {
public void testInCorrectParametersWithMultiplePolicies() throws ApexException {
OutputStream outContent = new ByteArrayOutputStream();
System.setOut(new PrintStream(outContent));
- Map<ToscaPolicyIdentifier, String[]> argsMap = new HashMap<ToscaPolicyIdentifier, String[]>();
+ Map<ToscaConceptIdentifier, String[]> argsMap = new HashMap<ToscaConceptIdentifier, String[]>();
String[] args = {"-p", "src/test/resources/parameters/correctParams.json"};
- argsMap.put(new ToscaPolicyIdentifier("id1", "v1"), args);
- argsMap.put(new ToscaPolicyIdentifier("id2", "v2"), args);
+ argsMap.put(new ToscaConceptIdentifier("id1", "v1"), args);
+ argsMap.put(new ToscaConceptIdentifier("id2", "v2"), args);
final ApexMain apexMain = new ApexMain(argsMap);
ApexParameters apexParam = (ApexParameters) apexMain.getApexParametersMap().values().toArray()[0];
assertEquals("MyApexEngine", apexParam.getEngineServiceParameters().getName());
@@ -179,9 +179,9 @@ public class ApexMainTest {
public void testInvalidArgsWithMultiplePolicies() throws ApexException {
OutputStream outContent = new ByteArrayOutputStream();
System.setOut(new PrintStream(outContent));
- Map<ToscaPolicyIdentifier, String[]> argsMap = new HashMap<ToscaPolicyIdentifier, String[]>();
+ Map<ToscaConceptIdentifier, String[]> argsMap = new HashMap<ToscaConceptIdentifier, String[]>();
String[] args = {"-c", "file1", "-m", "file2"};
- argsMap.put(new ToscaPolicyIdentifier("id1", "v1"), args);
+ argsMap.put(new ToscaConceptIdentifier("id1", "v1"), args);
final ApexMain apexMain = new ApexMain(argsMap);
final String outString = outContent.toString();
apexMain.shutdown();
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 364221fc1..6a309632e 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 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -41,7 +41,7 @@ import org.onap.policy.common.utils.services.Registry;
import org.onap.policy.common.utils.services.ServiceManager;
import org.onap.policy.common.utils.services.ServiceManagerException;
import org.onap.policy.models.pdp.enums.PdpMessageType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -78,7 +78,7 @@ public class ApexStarterActivator {
private volatile boolean alive = false;
@Getter
- private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes;
+ private List<ToscaConceptIdentifier> supportedPolicyTypes;
/**
* Instantiate the activator for onappf PDP-A.
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java
index f90938013..4d560a3bb 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/ApexEngineHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* Modifications Copyright (C) 2020 Bell Canada. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,8 +33,8 @@ import org.onap.policy.apex.service.engine.main.ApexMain;
import org.onap.policy.apex.services.onappf.exception.ApexStarterException;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
import org.slf4j.Logger;
@@ -58,7 +58,7 @@ public class ApexEngineHandler {
* @throws ApexStarterException if the apex engine instantiation failed using the policies passed
*/
public ApexEngineHandler(List<ToscaPolicy> policies) throws ApexStarterException {
- Map<ToscaPolicyIdentifier, String[]> policyArgsMap = createPolicyArgsMap(policies);
+ Map<ToscaConceptIdentifier, String[]> policyArgsMap = createPolicyArgsMap(policies);
LOGGER.debug("Starting apex engine.");
try {
apexMain = new ApexMain(policyArgsMap);
@@ -77,7 +77,7 @@ public class ApexEngineHandler {
if (null == apexMain || !apexMain.isAlive()) {
throw new ApexStarterException("Apex Engine not initialized.");
}
- Map<ToscaPolicyIdentifier, String[]> policyArgsMap = createPolicyArgsMap(policies);
+ Map<ToscaConceptIdentifier, String[]> policyArgsMap = createPolicyArgsMap(policies);
try {
apexMain.updateModel(policyArgsMap);
} catch (ApexException e) {
@@ -85,9 +85,9 @@ public class ApexEngineHandler {
}
}
- private Map<ToscaPolicyIdentifier, String[]> createPolicyArgsMap(List<ToscaPolicy> policies)
+ private Map<ToscaConceptIdentifier, String[]> createPolicyArgsMap(List<ToscaPolicy> policies)
throws ApexStarterException {
- Map<ToscaPolicyIdentifier, String[]> policyArgsMap = new LinkedHashMap<>();
+ Map<ToscaConceptIdentifier, String[]> policyArgsMap = new LinkedHashMap<>();
for (ToscaPolicy policy : policies) {
String policyName = policy.getIdentifier().getName();
final StandardCoder standardCoder = new StandardCoder();
@@ -129,7 +129,7 @@ public class ApexEngineHandler {
/**
* Method that return the list of running policies in the apex engine.
*/
- public List<ToscaPolicyIdentifier> getRunningPolicies() {
+ public List<ToscaConceptIdentifier> getRunningPolicies() {
return new ArrayList<>(apexMain.getApexParametersMap().keySet());
}
diff --git a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java
index e82e34755..c16f11c9c 100644
--- a/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java
+++ b/services/services-onappf/src/main/java/org/onap/policy/apex/services/onappf/handler/PdpMessageHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,9 +39,8 @@ import org.onap.policy.models.pdp.enums.PdpEngineWorkerState;
import org.onap.policy.models.pdp.enums.PdpHealthStatus;
import org.onap.policy.models.pdp.enums.PdpResponseStatus;
import org.onap.policy.models.pdp.enums.PdpState;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,13 +79,13 @@ public class PdpMessageHandler {
* @param pdpStatusParameters pdp status parameters
* @return supportedPolicyTypes list of PolicyTypeIdent
*/
- public List<ToscaPolicyTypeIdentifier> getSupportedPolicyTypesFromParameters(
+ public List<ToscaConceptIdentifier> getSupportedPolicyTypesFromParameters(
final PdpStatusParameters pdpStatusParameters) {
- final List<ToscaPolicyTypeIdentifier> supportedPolicyTypes =
+ final List<ToscaConceptIdentifier> supportedPolicyTypes =
new ArrayList<>(pdpStatusParameters.getSupportedPolicyTypes().size());
for (final ToscaPolicyTypeIdentifierParameters policyTypeIdentParameters : pdpStatusParameters
.getSupportedPolicyTypes()) {
- supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(policyTypeIdentParameters.getName(),
+ supportedPolicyTypes.add(new ToscaConceptIdentifier(policyTypeIdentParameters.getName(),
policyTypeIdentParameters.getVersion()));
}
return supportedPolicyTypes;
@@ -222,11 +221,11 @@ public class PdpMessageHandler {
*
* @return policyTypeIdentifiers
*/
- public List<ToscaPolicyIdentifier> getToscaPolicyIdentifiers(final List<ToscaPolicy> policies) {
- final List<ToscaPolicyIdentifier> policyIdentifiers = new ArrayList<>(policies.size());
+ public List<ToscaConceptIdentifier> getToscaPolicyIdentifiers(final List<ToscaPolicy> policies) {
+ final List<ToscaConceptIdentifier> policyIdentifiers = new ArrayList<>(policies.size());
for (final ToscaPolicy policy : policies) {
if (null != policy.getName() && null != policy.getVersion()) {
- policyIdentifiers.add(new ToscaPolicyIdentifier(policy.getName(), policy.getVersion()));
+ policyIdentifiers.add(new ToscaConceptIdentifier(policy.getName(), policy.getVersion()));
}
}
return policyIdentifiers;
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 46d04f63f..bbdbb22db 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -32,8 +32,8 @@ import org.onap.policy.models.pdp.concepts.PdpStateChange;
import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.enums.PdpResponseStatus;
import org.onap.policy.models.pdp.enums.PdpState;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -118,7 +118,7 @@ public class PdpStateChangeMessageHandler {
final ApexEngineHandler apexEngineHandler = new ApexEngineHandler(policies);
Registry.registerOrReplace(ApexStarterConstants.REG_APEX_ENGINE_HANDLER, apexEngineHandler);
if (apexEngineHandler.isApexEngineRunning()) {
- List<ToscaPolicyIdentifier> runningPolicies = apexEngineHandler.getRunningPolicies();
+ List<ToscaConceptIdentifier> runningPolicies = apexEngineHandler.getRunningPolicies();
// only the policies which are succesfully executed should be there in the heartbeat
pdpStatusContext.setPolicies(runningPolicies);
if (new HashSet<>(runningPolicies)
@@ -129,7 +129,7 @@ public class PdpStateChangeMessageHandler {
} else {
StringBuilder message = new StringBuilder(
"Apex engine started. But, only the following polices are running - ");
- for (ToscaPolicyIdentifier policy : runningPolicies) {
+ for (ToscaConceptIdentifier policy : runningPolicies) {
message.append(policy.getName()).append(":").append(policy.getVersion()).append(" ");
}
message.append(". Other policies failed execution. Please see the logs for more details.");
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 aa5a6457e..bf72b0999 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019-2020 Nordix Foundation.
+ * Copyright (C) 2019-2021 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@ import org.onap.policy.models.pdp.concepts.PdpStatus;
import org.onap.policy.models.pdp.concepts.PdpUpdate;
import org.onap.policy.models.pdp.enums.PdpResponseStatus;
import org.onap.policy.models.pdp.enums.PdpState;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -170,7 +170,7 @@ public class PdpUpdateMessageHandler {
Registry.registerOrReplace(ApexStarterConstants.REG_APEX_ENGINE_HANDLER, apexEngineHandler);
}
if (apexEngineHandler.isApexEngineRunning()) {
- List<ToscaPolicyIdentifier> runningPolicies = apexEngineHandler.getRunningPolicies();
+ List<ToscaConceptIdentifier> runningPolicies = apexEngineHandler.getRunningPolicies();
if (new HashSet<>(runningPolicies)
.equals(new HashSet<>(pdpMessageHandler.getToscaPolicyIdentifiers(pdpUpdateMsg.getPolicies())))) {
pdpResponseDetails = pdpMessageHandler.createPdpResonseDetails(pdpUpdateMsg.getRequestId(),
@@ -178,7 +178,7 @@ public class PdpUpdateMessageHandler {
} else {
StringBuilder message =
new StringBuilder("Apex engine started. But, only the following polices are running - ");
- for (ToscaPolicyIdentifier policy : runningPolicies) {
+ for (ToscaConceptIdentifier policy : runningPolicies) {
message.append(policy.getName()).append(":").append(policy.getVersion()).append(" ");
}
message.append(". Other policies failed execution. Please see the logs for more details.");