aboutsummaryrefslogtreecommitdiffstats
path: root/participant
diff options
context:
space:
mode:
authorJorge Hernandez <jorge.hernandez-herrero@att.com>2021-08-12 15:33:10 +0000
committerGerrit Code Review <gerrit@onap.org>2021-08-12 15:33:10 +0000
commita37bd982693785af5fc791df0baaa49dda039846 (patch)
tree3f230384fdce5ee3148b20bd8e794832a78d9073 /participant
parent9796dd1e99aea6768a8ed9bf11557db0c2a9c210 (diff)
parent20e2a1787c703a7957728e0c9a190a556b0ae536 (diff)
Merge "Fix serialization of messages in Control Loop and Participants"
Diffstat (limited to 'participant')
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java6
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java21
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java10
3 files changed, 17 insertions, 20 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java
index aed03556a..08e7154bb 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/endtoend/ParticipantMessagesTest.java
@@ -156,12 +156,12 @@ class ParticipantMessagesTest {
final ParticipantStatus heartbeat = new ParticipantStatus();
heartbeat.setParticipantId(getParticipantId());
ControlLoopInfo clInfo = getControlLoopInfo(getControlLoopId());
- heartbeat.setControlLoopInfoMap(Map.of(getControlLoopId(), clInfo));
+ heartbeat.setControlLoopInfoMap(Map.of(getControlLoopId().toString(), clInfo));
ControlLoopElementDefinition clDefinition = getClElementDefinition();
Map<UUID, ControlLoopElementDefinition> clElementDefinitionMap = Map.of(UUID.randomUUID(), clDefinition);
- Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
- participantDefinitionUpdateMap = Map.of(getParticipantId(), clElementDefinitionMap);
+ Map<String, Map<UUID, ControlLoopElementDefinition>>
+ participantDefinitionUpdateMap = Map.of(getParticipantId().toString(), clElementDefinitionMap);
heartbeat.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
synchronized (lockit) {
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
index b91cff22c..f87714e0e 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/controlloop/participant/policy/main/utils/TestListenerUtils.java
@@ -34,7 +34,6 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
-import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopStateChange;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate;
import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantUpdate;
@@ -181,7 +180,7 @@ public class TestListenerUtils {
final ParticipantUpdate participantUpdateMsg = new ParticipantUpdate();
ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0");
ToscaConceptIdentifier participantType = new ToscaConceptIdentifier(
- "org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1");
+ "org.onap.policy.controlloop.PolicyControlLoopParticipant", "2.3.1");
participantUpdateMsg.setParticipantId(participantId);
participantUpdateMsg.setTimestamp(Instant.now());
@@ -200,10 +199,10 @@ public class TestListenerUtils {
clDefinition.setCommonPropertiesMap(commonPropertiesMap);
Map<UUID, ControlLoopElementDefinition> controlLoopElementDefinitionMap =
- Map.of(UUID.randomUUID(), clDefinition);
+ Map.of(UUID.randomUUID(), clDefinition);
- Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
- participantDefinitionUpdateMap = Map.of(participantId, controlLoopElementDefinitionMap);
+ Map<String, Map<UUID, ControlLoopElementDefinition>> participantDefinitionUpdateMap =
+ Map.of(participantId.toString(), controlLoopElementDefinitionMap);
participantUpdateMsg.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
return participantUpdateMsg;
@@ -217,10 +216,8 @@ public class TestListenerUtils {
* @return ControlLoopUpdate message
* @throws CoderException exception while reading the file to object
*/
- public static ControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath)
- throws CoderException {
- ControlLoopUpdate controlLoopUpdateMsg =
- CODER.decode(new File(jsonFilePath), ControlLoopUpdate.class);
+ public static ControlLoopUpdate createParticipantClUpdateMsgFromJson(String jsonFilePath) throws CoderException {
+ ControlLoopUpdate controlLoopUpdateMsg = CODER.decode(new File(jsonFilePath), ControlLoopUpdate.class);
return controlLoopUpdateMsg;
}
@@ -254,7 +251,7 @@ public class TestListenerUtils {
String policyTypeString = ResourceUtils.getResourceAsString(policyTypeFilePath);
ToscaServiceTemplate foundPolicyTypeSt =
- yamlTranslator.fromYaml(policyTypeString, ToscaServiceTemplate.class);
+ yamlTranslator.fromYaml(policyTypeString, ToscaServiceTemplate.class);
toscaServiceTemplate.setDerivedFrom(foundPolicyTypeSt.getDerivedFrom());
toscaServiceTemplate.setDescription(foundPolicyTypeSt.getDescription());
@@ -291,7 +288,7 @@ public class TestListenerUtils {
String policiesString = ResourceUtils.getResourceAsString(policiesFilePath);
ToscaServiceTemplate foundPoliciesSt =
- yamlTranslator.fromYaml(policiesString, ToscaServiceTemplate.class);
+ yamlTranslator.fromYaml(policiesString, ToscaServiceTemplate.class);
toscaServiceTemplate.getToscaTopologyTemplate().setPolicies(
foundPoliciesSt.getToscaTopologyTemplate().getPolicies());
}
@@ -305,7 +302,7 @@ public class TestListenerUtils {
}
ToscaServiceTemplate serviceTemplate = yamlTranslator.fromYaml(
- controlLoopString, ToscaServiceTemplate.class);
+ controlLoopString, ToscaServiceTemplate.class);
return serviceTemplate;
} catch (FileNotFoundException e) {
LOGGER.error("cannot find YAML file", controlLoopFilePath);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
index 80c40683a..e1c0f7c46 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/controlloop/participant/intermediary/handler/ParticipantHandler.java
@@ -202,7 +202,7 @@ public class ParticipantHandler implements Closeable {
*/
public void handleParticipantRegisterAck(ParticipantRegisterAck participantRegisterAckMsg) {
LOGGER.debug("ParticipantRegisterAck message received as responseTo {}",
- participantRegisterAckMsg.getResponseTo());
+ participantRegisterAckMsg.getResponseTo());
}
/**
@@ -223,7 +223,7 @@ public class ParticipantHandler implements Closeable {
*/
public void handleParticipantDeregisterAck(ParticipantDeregisterAck participantDeregisterAckMsg) {
LOGGER.debug("ParticipantDeregisterAck message received as responseTo {}",
- participantDeregisterAckMsg.getResponseTo());
+ participantDeregisterAckMsg.getResponseTo());
}
/**
@@ -233,14 +233,14 @@ public class ParticipantHandler implements Closeable {
*/
public void handleParticipantUpdate(ParticipantUpdate participantUpdateMsg) {
LOGGER.debug("ParticipantUpdate message received for participantId {}",
- participantUpdateMsg.getParticipantId());
+ participantUpdateMsg.getParticipantId());
if (!participantUpdateMsg.appliesTo(participantType, participantId)) {
return;
}
- Map<UUID, ControlLoopElementDefinition> clDefinitionMap =
- participantUpdateMsg.getParticipantDefinitionUpdateMap().get(participantUpdateMsg.getParticipantId());
+ Map<UUID, ControlLoopElementDefinition> clDefinitionMap = participantUpdateMsg
+ .getParticipantDefinitionUpdateMap().get(participantUpdateMsg.getParticipantId().toString());
for (ControlLoopElementDefinition element : clDefinitionMap.values()) {
clElementDefsOnThisParticipant.put(element.getId(), element);