aboutsummaryrefslogtreecommitdiffstats
path: root/participant
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2022-12-19 14:43:11 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2022-12-20 10:35:32 +0000
commitc71863696d729286502f951a64c3d2193c6641e7 (patch)
tree024363ddde071c3f59d7468bdc9ddfd011d3701e /participant
parent66208f7d9ec65d859803ed347c3fdecd2d99022f (diff)
Add compositionId into Messages between ACM and Participants
Issue-ID: POLICY-4489 Change-Id: I1fb8c04eacee040d5c944c522ca59a2a9a50376b Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant')
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java3
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java20
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java59
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java71
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java113
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java123
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java29
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java2
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java44
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java2
10 files changed, 86 insertions, 380 deletions
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
index 0836dbb3c..c28355d7f 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java
@@ -23,7 +23,6 @@ package org.onap.policy.clamp.acm.participant.policy.main.handler;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.when;
import java.util.List;
import java.util.Map;
@@ -72,8 +71,6 @@ class AutomationCompositionElementHandlerTest {
private AutomationCompositionElementHandler getTestingHandler() {
var handler = new AutomationCompositionElementHandler(api, pap);
var intermediaryApi = Mockito.mock(ParticipantIntermediaryApi.class);
- var element = getTestingAcElement();
- when(intermediaryApi.getAutomationCompositionElement(automationCompositionElementId)).thenReturn(element);
handler.setIntermediaryApi(intermediaryApi);
return handler;
}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
index d0ad72f83..59d64e754 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
@@ -25,20 +25,14 @@ import static org.junit.Assert.assertTrue;
import java.io.FileNotFoundException;
import java.time.Instant;
import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
import java.util.Set;
import java.util.UUID;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -70,19 +64,7 @@ public final class TestListenerUtils {
// Add policies to the toscaServiceTemplate
TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate);
- List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
- for (Map.Entry<String, ToscaNodeTemplate> toscaInputEntry : toscaServiceTemplate.getToscaTopologyTemplate()
- .getNodeTemplates().entrySet()) {
- if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(),
- toscaServiceTemplate)) {
- AcmUtils.prepareParticipantDefinitionUpdate(
- ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()),
- toscaInputEntry.getKey(), toscaInputEntry.getValue(),
- participantDefinitionUpdates, null);
- }
- }
-
- participantUpdateMsg.setParticipantDefinitionUpdates(participantDefinitionUpdates);
+ participantUpdateMsg.setParticipantDefinitionUpdates(new ArrayList<>());
return participantUpdateMsg;
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java
index 367215a29..d74c41f35 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java
@@ -21,18 +21,11 @@
package org.onap.policy.clamp.acm.participant.intermediary.api;
-import java.util.List;
-import java.util.Map;
import java.util.UUID;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
/**
* This interface is used by participant implementations to use the participant intermediary.
@@ -48,58 +41,6 @@ public interface ParticipantIntermediaryApi {
AutomationCompositionElementListener automationCompositionElementListener);
/**
- * Get participants loops from the intermediary API.
- *
- * @param name the participant name, null for all
- * @param version the participant version, null for all
- * @return the participants
- */
- List<Participant> getParticipants(String name, String version);
-
- /**
- * Get common properties of a automation composition element.
- *
- * @param acElementDef the automation composition element definition
- * @return the common properties
- */
- Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef);
-
- /**
- * Update the state of a participant.
- *
- * @param definition the definition of the participant to update the state on
- * @param state the state of the participant
- * @return the participant
- */
- Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state);
-
- /**
- * Get automation compositions from the intermediary API.
- *
- * @param name the automation composition element name, null for all
- * @param version the automation composition element version, null for all
- * @return the automation composition elements
- */
- AutomationCompositions getAutomationCompositions(String name, String version);
-
- /**
- * Get automation composition elements from the intermediary API.
- *
- * @param name the automation composition element name, null for all
- * @param version the automation composition element version, null for all
- * @return the automation composition elements
- */
- Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version);
-
- /**
- * Get automation composition element from the intermediary API.
- *
- * @param id automation composition element ID
- * @return the automation composition element
- */
- AutomationCompositionElement getAutomationCompositionElement(UUID id);
-
- /**
* Update the state of a automation composition element.
*
* @param id the ID of the automation composition element to update the state on
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
index 6dfc82791..acbcc37a6 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java
@@ -21,24 +21,14 @@
package org.onap.policy.clamp.acm.participant.intermediary.api.impl;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
import java.util.UUID;
import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
import org.onap.policy.clamp.acm.participant.intermediary.handler.AutomationCompositionHandler;
-import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
-import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
import org.springframework.stereotype.Component;
/**
@@ -47,21 +37,15 @@ import org.springframework.stereotype.Component;
@Component
public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryApi {
- // The handler for the participant intermediary
- private final ParticipantHandler participantHandler;
-
// The handler for the automationComposition intermediary
private final AutomationCompositionHandler automationCompositionHandler;
/**
* Constructor.
*
- * @param participantHandler ParticipantHandler
* @param automationCompositionHandler AutomationCompositionHandler
*/
- public ParticipantIntermediaryApiImpl(ParticipantHandler participantHandler,
- AutomationCompositionHandler automationCompositionHandler) {
- this.participantHandler = participantHandler;
+ public ParticipantIntermediaryApiImpl(AutomationCompositionHandler automationCompositionHandler) {
this.automationCompositionHandler = automationCompositionHandler;
}
@@ -72,56 +56,9 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp
}
@Override
- public List<Participant> getParticipants(String name, String version) {
- return List.of(participantHandler.getParticipant(name, version));
- }
-
- @Override
- public Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef) {
- return participantHandler.getAcElementDefinitionCommonProperties(acElementDef);
- }
-
- @Override
- public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState state) {
- return participantHandler.updateParticipantState(definition, state);
- }
-
- @Override
- public AutomationCompositions getAutomationCompositions(String name, String version) {
- return automationCompositionHandler.getAutomationCompositions();
- }
-
- @Override
- public Map<UUID, AutomationCompositionElement> getAutomationCompositionElements(String name, String version) {
- var automationCompositions =
- automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
-
- for (var automationComposition : automationCompositions) {
- if (name.equals(automationComposition.getName())) {
- return automationComposition.getElements();
- }
- }
- return new LinkedHashMap<>();
- }
-
- @Override
- public AutomationCompositionElement getAutomationCompositionElement(UUID id) {
- List<AutomationComposition> automationCompositions =
- automationCompositionHandler.getAutomationCompositions().getAutomationCompositionList();
-
- for (AutomationComposition automationComposition : automationCompositions) {
- AutomationCompositionElement acElement = automationComposition.getElements().get(id);
- if (acElement != null) {
- return acElement;
- }
- }
- return null;
- }
-
- @Override
- public AutomationCompositionElement updateAutomationCompositionElementState(
- UUID automationCompositionId, UUID id, AutomationCompositionOrderedState currentState,
- AutomationCompositionState newState, ParticipantMessageType messageType) {
+ public AutomationCompositionElement updateAutomationCompositionElementState(UUID automationCompositionId, UUID id,
+ AutomationCompositionOrderedState currentState, AutomationCompositionState newState,
+ ParticipantMessageType messageType) {
return automationCompositionHandler.updateAutomationCompositionElementState(automationCompositionId, id,
currentState, newState);
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
index 66ac0c1dc..568ab8a36 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
@@ -38,7 +38,6 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
@@ -97,9 +96,8 @@ public class AutomationCompositionHandler {
* @param newState the ordered state
* @return automationCompositionElement the updated automation composition element
*/
- public AutomationCompositionElement updateAutomationCompositionElementState(
- UUID automationCompositionId, UUID id, AutomationCompositionOrderedState orderedState,
- AutomationCompositionState newState) {
+ public AutomationCompositionElement updateAutomationCompositionElementState(UUID automationCompositionId, UUID id,
+ AutomationCompositionOrderedState orderedState, AutomationCompositionState newState) {
if (id == null) {
LOGGER.warn("Cannot update Automation composition element state, id is null");
@@ -114,7 +112,7 @@ public class AutomationCompositionHandler {
element.setState(newState);
}
var checkOpt = automationComposition.getElements().values().stream()
- .filter(acElement -> !newState.equals(acElement.getState())).findAny();
+ .filter(acElement -> !newState.equals(acElement.getState())).findAny();
if (checkOpt.isEmpty()) {
automationComposition.setState(newState);
automationComposition.setOrderedState(orderedState);
@@ -125,18 +123,18 @@ public class AutomationCompositionHandler {
var acElement = elementsOnThisParticipant.get(id);
if (acElement != null) {
var automationCompositionStateChangeAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionStateChangeAck.setParticipantId(participantId);
automationCompositionStateChangeAck.setParticipantType(participantType);
automationCompositionStateChangeAck.setAutomationCompositionId(automationCompositionId);
acElement.setOrderedState(orderedState);
acElement.setState(newState);
automationCompositionStateChangeAck.getAutomationCompositionResultMap().put(acElement.getId(),
- new AutomationCompositionElementAck(newState, true,
- "Automation composition element {} state changed to {}\", id, newState)"));
+ new AutomationCompositionElementAck(newState, true,
+ "Automation composition element {} state changed to {}\", id, newState)"));
LOGGER.debug("Automation composition element {} state changed to {}", id, newState);
automationCompositionStateChangeAck
- .setMessage("AutomationCompositionElement state changed to {} " + newState);
+ .setMessage("AutomationCompositionElement state changed to {} " + newState);
automationCompositionStateChangeAck.setResult(true);
publisher.sendAutomationCompositionAck(automationCompositionStateChangeAck);
return acElement;
@@ -151,7 +149,7 @@ public class AutomationCompositionHandler {
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
public void handleAutomationCompositionStateChange(AutomationCompositionStateChange stateChangeMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
if (stateChangeMsg.getAutomationCompositionId() == null) {
return;
}
@@ -160,22 +158,22 @@ public class AutomationCompositionHandler {
if (automationComposition == null) {
var automationCompositionAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAck.setParticipantId(participantId);
automationCompositionAck.setParticipantType(participantType);
automationCompositionAck.setMessage("Automation composition " + stateChangeMsg.getAutomationCompositionId()
- + " does not use this participant " + participantId);
+ + " does not use this participant " + participantId);
automationCompositionAck.setResult(false);
automationCompositionAck.setResponseTo(stateChangeMsg.getMessageId());
automationCompositionAck.setAutomationCompositionId(stateChangeMsg.getAutomationCompositionId());
publisher.sendAutomationCompositionAck(automationCompositionAck);
LOGGER.debug("Automation composition {} does not use this participant",
- stateChangeMsg.getAutomationCompositionId());
+ stateChangeMsg.getAutomationCompositionId());
return;
}
handleState(automationComposition, stateChangeMsg.getOrderedState(), stateChangeMsg.getStartPhase(),
- acElementDefinitions);
+ acElementDefinitions);
}
/**
@@ -187,8 +185,8 @@ public class AutomationCompositionHandler {
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
private void handleState(final AutomationComposition automationComposition,
- AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
switch (orderedState) {
case UNINITIALISED:
handleUninitialisedState(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
@@ -200,8 +198,7 @@ public class AutomationCompositionHandler {
handleRunningState(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
break;
default:
- LOGGER.debug("StateChange message has no state, state is null {}",
- automationComposition.getKey());
+ LOGGER.debug("StateChange message has no state, state is null {}", automationComposition.getKey());
break;
}
}
@@ -213,7 +210,7 @@ public class AutomationCompositionHandler {
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
if (!updateMsg.appliesTo(participantType, participantId)) {
return;
@@ -227,7 +224,7 @@ public class AutomationCompositionHandler {
}
private void handleAcUpdatePhase0(AutomationCompositionUpdate updateMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
var automationComposition = automationCompositionMap.get(updateMsg.getAutomationCompositionId());
// TODO: Updates to existing AutomationCompositions are not supported yet (Addition/Removal of
@@ -235,12 +232,12 @@ public class AutomationCompositionHandler {
// elements to existing AutomationComposition has to be supported).
if (automationComposition != null) {
var automationCompositionUpdateAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
automationCompositionUpdateAck.setParticipantId(participantId);
automationCompositionUpdateAck.setParticipantType(participantType);
automationCompositionUpdateAck.setMessage("Automation composition " + updateMsg.getAutomationCompositionId()
- + " already defined on participant " + participantId);
+ + " already defined on participant " + participantId);
automationCompositionUpdateAck.setResult(false);
automationCompositionUpdateAck.setResponseTo(updateMsg.getMessageId());
automationCompositionUpdateAck.setAutomationCompositionId(updateMsg.getAutomationCompositionId());
@@ -250,7 +247,7 @@ public class AutomationCompositionHandler {
if (updateMsg.getParticipantUpdatesList().isEmpty()) {
LOGGER.warn("No AutomationCompositionElement updates in message {}",
- updateMsg.getAutomationCompositionId());
+ updateMsg.getAutomationCompositionId());
return;
}
@@ -262,23 +259,23 @@ public class AutomationCompositionHandler {
automationCompositionMap.put(updateMsg.getAutomationCompositionId(), automationComposition);
handleAutomationCompositionElementUpdate(acElements, acElementDefinitions, updateMsg.getStartPhase(),
- updateMsg.getAutomationCompositionId());
+ updateMsg.getAutomationCompositionId());
}
private void handleAcUpdatePhaseN(AutomationCompositionUpdate updateMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
var acElementList = updateMsg.getParticipantUpdatesList().stream()
- .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
- .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
+ .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
+ .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
handleAutomationCompositionElementUpdate(acElementList, acElementDefinitions, updateMsg.getStartPhase(),
- updateMsg.getAutomationCompositionId());
+ updateMsg.getAutomationCompositionId());
}
private void handleAutomationCompositionElementUpdate(List<AutomationCompositionElement> acElements,
- List<AutomationCompositionElementDefinition> acElementDefinitions, Integer startPhaseMsg,
- UUID automationCompositionId) {
+ List<AutomationCompositionElementDefinition> acElementDefinitions, Integer startPhaseMsg,
+ UUID automationCompositionId) {
try {
for (var element : acElements) {
var acElementNodeTemplate = getAcElementNodeTemplate(acElementDefinitions, element.getDefinition());
@@ -300,7 +297,7 @@ public class AutomationCompositionHandler {
}
private ToscaNodeTemplate getAcElementNodeTemplate(
- List<AutomationCompositionElementDefinition> acElementDefinitions, ToscaConceptIdentifier acElementDefId) {
+ List<AutomationCompositionElementDefinition> acElementDefinitions, ToscaConceptIdentifier acElementDefId) {
for (var acElementDefinition : acElementDefinitions) {
if (acElementDefId.getName().contains(acElementDefinition.getAcElementDefinitionId().getName())) {
@@ -311,10 +308,10 @@ public class AutomationCompositionHandler {
}
private List<AutomationCompositionElement> storeElementsOnThisParticipant(
- List<ParticipantUpdates> participantUpdates) {
+ List<ParticipantUpdates> participantUpdates) {
var acElementList = participantUpdates.stream()
- .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
- .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
+ .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
+ .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList());
for (var element : acElementList) {
elementsOnThisParticipant.put(element.getId(), element);
@@ -339,16 +336,16 @@ public class AutomationCompositionHandler {
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
private void handleUninitialisedState(final AutomationComposition automationComposition,
- final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
boolean isAllUninitialised = automationComposition.getElements().values().stream()
- .filter(element -> !AutomationCompositionState.UNINITIALISED.equals(element.getState())).findAny()
- .isEmpty();
+ .filter(element -> !AutomationCompositionState.UNINITIALISED.equals(element.getState())).findAny()
+ .isEmpty();
if (isAllUninitialised) {
automationCompositionMap.remove(automationComposition.getInstanceId());
automationComposition.getElements().values()
- .forEach(element -> elementsOnThisParticipant.remove(element.getId()));
+ .forEach(element -> elementsOnThisParticipant.remove(element.getId()));
}
}
@@ -361,8 +358,8 @@ public class AutomationCompositionHandler {
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
private void handlePassiveState(final AutomationComposition automationComposition,
- final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
}
@@ -375,8 +372,8 @@ public class AutomationCompositionHandler {
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
private void handleRunningState(final AutomationComposition automationComposition,
- final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
handleStateChange(automationComposition, orderedState, startPhaseMsg, acElementDefinitions);
}
@@ -389,12 +386,12 @@ public class AutomationCompositionHandler {
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
private void handleStateChange(AutomationComposition automationComposition,
- final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ final AutomationCompositionOrderedState orderedState, Integer startPhaseMsg,
+ List<AutomationCompositionElementDefinition> acElementDefinitions) {
if (orderedState.equals(automationComposition.getOrderedState())) {
var automationCompositionAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAck.setParticipantId(participantId);
automationCompositionAck.setParticipantType(participantType);
automationCompositionAck.setMessage("Automation composition is already in state " + orderedState);
@@ -405,22 +402,21 @@ public class AutomationCompositionHandler {
}
automationComposition.getElements().values().stream()
- .forEach(acElement -> automationCompositionElementStateChange(automationComposition, orderedState,
- acElement, startPhaseMsg, acElementDefinitions));
+ .forEach(acElement -> automationCompositionElementStateChange(automationComposition, orderedState,
+ acElement, startPhaseMsg, acElementDefinitions));
}
private void automationCompositionElementStateChange(AutomationComposition automationComposition,
- AutomationCompositionOrderedState orderedState, AutomationCompositionElement acElement, Integer startPhaseMsg,
- List<AutomationCompositionElementDefinition> acElementDefinitions) {
+ AutomationCompositionOrderedState orderedState, AutomationCompositionElement acElement,
+ Integer startPhaseMsg, List<AutomationCompositionElementDefinition> acElementDefinitions) {
var acElementNodeTemplate = getAcElementNodeTemplate(acElementDefinitions, acElement.getDefinition());
if (acElementNodeTemplate != null) {
int startPhase = ParticipantUtils.findStartPhase(acElementNodeTemplate.getProperties());
if (startPhaseMsg.equals(startPhase)) {
for (var acElementListener : listeners) {
try {
- acElementListener.automationCompositionElementStateChange(
- automationComposition.getInstanceId(), acElement.getId(), acElement.getState(),
- orderedState);
+ acElementListener.automationCompositionElementStateChange(automationComposition.getInstanceId(),
+ acElement.getId(), acElement.getState(), orderedState);
} catch (PfModelException e) {
LOGGER.debug("Automation composition element update failed {}",
automationComposition.getInstanceId());
@@ -429,15 +425,4 @@ public class AutomationCompositionHandler {
}
}
}
-
- /**
- * Get automation compositions as a {@link ConrolLoops} class.
- *
- * @return the automation compositions
- */
- public AutomationCompositions getAutomationCompositions() {
- var automationCompositions = new AutomationCompositions();
- automationCompositions.setAutomationCompositionList(new ArrayList<>(automationCompositionMap.values()));
- return automationCompositions;
- }
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index d29186844..b442b9967 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -27,7 +27,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.Objects;
import java.util.UUID;
import lombok.Getter;
import lombok.Setter;
@@ -35,7 +34,6 @@ import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessag
import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
@@ -52,7 +50,6 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantSt
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -79,7 +76,7 @@ public class ParticipantHandler {
@Setter
private ParticipantHealthStatus healthStatus = ParticipantHealthStatus.UNKNOWN;
- private final List<AutomationCompositionElementDefinition> acElementDefsOnThisParticipant = new ArrayList<>();
+ private final Map<UUID, List<AutomationCompositionElementDefinition>> acElementDefsMap = new HashMap<>();
/**
* Constructor, set the participant ID and sender.
@@ -88,7 +85,7 @@ public class ParticipantHandler {
* @param publisher the publisher for sending responses to messages
*/
public ParticipantHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher,
- AutomationCompositionHandler automationCompositionHandler) {
+ AutomationCompositionHandler automationCompositionHandler) {
this.participantType = parameters.getIntermediaryParameters().getParticipantType();
this.participantId = parameters.getIntermediaryParameters().getParticipantId();
this.publisher = publisher;
@@ -100,8 +97,7 @@ public class ParticipantHandler {
*
* @param participantStatusReqMsg participant participantStatusReq message
*/
- @Timed(value = "listener.participant_status_req",
- description = "PARTICIPANT_STATUS_REQ messages received")
+ @Timed(value = "listener.participant_status_req", description = "PARTICIPANT_STATUS_REQ messages received")
public void handleParticipantStatusReq(final ParticipantStatusReq participantStatusReqMsg) {
var participantStatus = makeHeartbeat(true);
publisher.sendParticipantStatus(participantStatus);
@@ -112,10 +108,12 @@ public class ParticipantHandler {
*
* @param updateMsg the update message
*/
- @Timed(value = "listener.automation_composition_update",
+ @Timed(
+ value = "listener.automation_composition_update",
description = "AUTOMATION_COMPOSITION_UPDATE messages received")
public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg) {
- automationCompositionHandler.handleAutomationCompositionUpdate(updateMsg, acElementDefsOnThisParticipant);
+ automationCompositionHandler.handleAutomationCompositionUpdate(updateMsg,
+ acElementDefsMap.get(updateMsg.getCompositionId()));
}
/**
@@ -123,75 +121,12 @@ public class ParticipantHandler {
*
* @param stateChangeMsg the state change message
*/
- @Timed(value = "listener.automation_composition_state_change",
+ @Timed(
+ value = "listener.automation_composition_state_change",
description = "AUTOMATION_COMPOSITION_STATE_CHANGE messages received")
public void handleAutomationCompositionStateChange(AutomationCompositionStateChange stateChangeMsg) {
automationCompositionHandler.handleAutomationCompositionStateChange(stateChangeMsg,
- acElementDefsOnThisParticipant);
- }
-
- private void handleStateChange(ParticipantState newParticipantState, ParticipantUpdateAck response) {
- if (state.equals(newParticipantState)) {
- response.setResult(false);
- response.setMessage("Participant already in state " + newParticipantState);
- } else {
- response.setResult(true);
- response.setMessage("Participant state changed from " + state + " to " + newParticipantState);
- state = newParticipantState;
- }
- }
-
- /**
- * Method to update participant state.
- *
- * @param definition participant definition
- * @param participantState participant state
- * @return the participant
- */
- public Participant updateParticipantState(ToscaConceptIdentifier definition, ParticipantState participantState) {
- if (!Objects.equals(definition, participantId)) {
- LOGGER.debug("No participant with this ID {}", definition.getName());
- return null;
- }
-
- var participantUpdateAck = new ParticipantUpdateAck();
- handleStateChange(participantState, participantUpdateAck);
- publisher.sendParticipantUpdateAck(participantUpdateAck);
- return getParticipant(definition.getName(), definition.getVersion());
- }
-
- /**
- * Get participants as a {@link Participant} class.
- *
- * @param name the participant name to get
- * @param version the version of the participant to get
- * @return the participant
- */
- public Participant getParticipant(String name, String version) {
- if (participantId.getName().equals(name)) {
- var participant = new Participant();
- participant.setDefinition(participantId);
- participant.setParticipantState(state);
- participant.setHealthStatus(healthStatus);
- return participant;
- }
- return null;
- }
-
- /**
- * Get common properties of a automation composition element.
- *
- * @param acElementDef the automation composition element definition
- * @return the common properties
- */
- public Map<String, ToscaProperty> getAcElementDefinitionCommonProperties(ToscaConceptIdentifier acElementDef) {
- Map<String, ToscaProperty> commonPropertiesMap = new HashMap<>();
- acElementDefsOnThisParticipant.stream().forEach(definition -> {
- if (definition.getAcElementDefinitionId().equals(acElementDef)) {
- commonPropertiesMap.putAll(definition.getCommonPropertiesMap());
- }
- });
- return commonPropertiesMap;
+ acElementDefsMap.get(stateChangeMsg.getCompositionId()));
}
/**
@@ -230,11 +165,10 @@ public class ParticipantHandler {
*
* @param participantRegisterAckMsg the participantRegisterAck message
*/
- @Timed(value = "listener.participant_register_ack",
- description = "PARTICIPANT_REGISTER_ACK messages received")
+ @Timed(value = "listener.participant_register_ack", description = "PARTICIPANT_REGISTER_ACK messages received")
public void handleParticipantRegisterAck(ParticipantRegisterAck participantRegisterAckMsg) {
LOGGER.debug("ParticipantRegisterAck message received as responseTo {}",
- participantRegisterAckMsg.getResponseTo());
+ participantRegisterAckMsg.getResponseTo());
statusToPassive();
publisher.sendParticipantStatus(makeHeartbeat(false));
}
@@ -266,11 +200,10 @@ public class ParticipantHandler {
*
* @param participantDeregisterAckMsg the participantDeregisterAck message
*/
- @Timed(value = "listener.participant_deregister_ack",
- description = "PARTICIPANT_DEREGISTER_ACK messages received")
+ @Timed(value = "listener.participant_deregister_ack", description = "PARTICIPANT_DEREGISTER_ACK messages received")
public void handleParticipantDeregisterAck(ParticipantDeregisterAck participantDeregisterAckMsg) {
LOGGER.debug("ParticipantDeregisterAck message received as responseTo {}",
- participantDeregisterAckMsg.getResponseTo());
+ participantDeregisterAckMsg.getResponseTo());
}
/**
@@ -278,25 +211,25 @@ public class ParticipantHandler {
*
* @param participantUpdateMsg the ParticipantUpdate message
*/
- @Timed(value = "listener.participant_update",
- description = "PARTICIPANT_UPDATE messages received")
+ @Timed(value = "listener.participant_update", description = "PARTICIPANT_UPDATE messages received")
public void handleParticipantUpdate(ParticipantUpdate participantUpdateMsg) {
LOGGER.debug("ParticipantUpdate message received for participantId {}",
- participantUpdateMsg.getParticipantId());
+ participantUpdateMsg.getParticipantId());
+ acElementDefsMap.putIfAbsent(participantUpdateMsg.getCompositionId(), new ArrayList<>());
if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) {
statusToPassive();
// This message is to commission the automation composition
- for (ParticipantDefinition participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
+ for (var participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
if (participantDefinition.getParticipantType().equals(participantType)) {
- acElementDefsOnThisParticipant
- .addAll(participantDefinition.getAutomationCompositionElementDefinitionList());
+ acElementDefsMap.get(participantUpdateMsg.getCompositionId())
+ .addAll(participantDefinition.getAutomationCompositionElementDefinitionList());
break;
}
}
} else {
// This message is to decommission the automation composition
- acElementDefsOnThisParticipant.clear();
+ acElementDefsMap.get(participantUpdateMsg.getCompositionId()).clear();
this.state = ParticipantState.TERMINATED;
}
sendParticipantUpdateAck(participantUpdateMsg.getMessageId());
@@ -335,11 +268,15 @@ public class ParticipantHandler {
heartbeat.setAutomationCompositionInfoList(getAutomationCompositionInfoList());
if (responseToParticipantStatusReq) {
- ParticipantDefinition participantDefinition = new ParticipantDefinition();
- participantDefinition.setParticipantId(participantId);
- participantDefinition.setParticipantType(participantType);
- participantDefinition.setAutomationCompositionElementDefinitionList(acElementDefsOnThisParticipant);
- heartbeat.setParticipantDefinitionUpdates(List.of(participantDefinition));
+ List<ParticipantDefinition> participantDefinitionList = new ArrayList<>(acElementDefsMap.size());
+ for (var acElementDefsOnThisParticipant : acElementDefsMap.values()) {
+ var participantDefinition = new ParticipantDefinition();
+ participantDefinition.setParticipantId(participantId);
+ participantDefinition.setParticipantType(participantType);
+ participantDefinition.setAutomationCompositionElementDefinitionList(acElementDefsOnThisParticipant);
+ participantDefinitionList.add(participantDefinition);
+ }
+ heartbeat.setParticipantDefinitionUpdates(participantDefinitionList);
}
return heartbeat;
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
index 4458f0bfa..bc5db8571 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java
@@ -20,10 +20,7 @@
package org.onap.policy.clamp.acm.participant.intermediary.api.impl;
-import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.assertEquals;
-import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.UUID;
import org.junit.jupiter.api.Test;
@@ -32,7 +29,6 @@ import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationComposit
import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -43,38 +39,15 @@ class ParticipantIntermediaryApiImplTest {
private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
private static final String ID_VERSION = "1.0.1";
- private static final String ID_NAME_E = "PMSHInstance1";
- private static final String ID_VERSION_E = "1.0.1";
-
- private static final String ID_NAME_TYPE = "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant";
- private static final String ID_VERSION_TYPE = "2.3.4";
-
@Test
void mockParticipantIntermediaryApiImplTest() throws CoderException {
var uuid = UUID.randomUUID();
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
var automationComposiitonHandler = commonTestData.setTestAutomationCompositionHandler(id, uuid);
- var apiImpl = new ParticipantIntermediaryApiImpl(participantHandler, automationComposiitonHandler);
+ var apiImpl = new ParticipantIntermediaryApiImpl(automationComposiitonHandler);
var acElementListener = Mockito.mock(AutomationCompositionElementListener.class);
apiImpl.registerAutomationCompositionElementListener(acElementListener);
- assertNotNull(apiImpl.getAutomationCompositions(id.getName(), id.getVersion()));
- assertThat(apiImpl.getAcElementDefinitionCommonProperties(id)).isEmpty();
-
- var participants = apiImpl.getParticipants(id.getName(), id.getVersion());
- assertEquals(ParticipantState.UNKNOWN, participants.get(0).getParticipantState());
-
- var participant = apiImpl.updateParticipantState(id, ParticipantState.TERMINATED);
- assertEquals(ParticipantState.TERMINATED, participant.getParticipantState());
-
- var elements = apiImpl.getAutomationCompositionElements(ID_NAME_E, ID_VERSION_E);
- assertFalse(elements.containsKey(uuid));
-
- var element = apiImpl.getAutomationCompositionElement(elements.keySet().iterator().next());
- var idType = new ToscaConceptIdentifier(ID_NAME_TYPE, ID_VERSION_TYPE);
- assertEquals(idType, element.getParticipantType());
-
var acElement = apiImpl.updateAutomationCompositionElementState(UUID.randomUUID(), uuid,
AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE,
ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
index 06700fcce..8b52c1cfe 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
@@ -54,8 +54,6 @@ class AutomationCompositionHandlerTest {
@Test
void automationCompositionHandlerTest() {
var ach = commonTestData.getMockAutomationCompositionHandler();
- assertNotNull(ach.getAutomationCompositions());
-
assertNotNull(ach.getAutomationCompositionMap());
assertNotNull(ach.getElementsOnThisParticipant());
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
index fd0b54f5e..f6988b0e8 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
@@ -24,7 +24,6 @@ import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
-import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.time.Instant;
@@ -35,12 +34,9 @@ import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantHealthStatus;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -52,19 +48,6 @@ class ParticipantHandlerTest {
private static final String ID_VERSION = "1.0.1";
@Test
- void mockParticipantHandlerTest() {
- var participantHandler = commonTestData.getMockParticipantHandler();
- assertNull(participantHandler.getParticipant(null, null));
- assertEquals("org.onap.PM_CDS_Blueprint 1.0.1", participantHandler.getParticipantId().toString());
-
- var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- assertEquals(id, participantHandler.getParticipantId());
- assertEquals(id, participantHandler.getParticipantType());
- assertThat(participantHandler.getAcElementDefinitionCommonProperties(id)).isEmpty();
-
- }
-
- @Test
void handleUpdateTest() {
var parameters = CommonTestData.getParticipantParameters();
var automationCompositionHander = commonTestData.getMockAutomationCompositionHandler();
@@ -81,6 +64,7 @@ class ParticipantHandlerTest {
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
participantUpdateMsg.setAutomationCompositionId(CommonTestData.AC_ID_1);
+ participantUpdateMsg.setCompositionId(CommonTestData.AC_ID_1);
participantUpdateMsg.setParticipantId(id);
participantUpdateMsg.setParticipantType(id);
participantUpdateMsg.setMessageId(UUID.randomUUID());
@@ -91,7 +75,6 @@ class ParticipantHandlerTest {
assertThat(heartbeatF.getAutomationCompositionInfoList()).isEmpty();
participantHandler.handleParticipantUpdate(participantUpdateMsg);
- assertThat(participantHandler.getAcElementDefinitionCommonProperties(id)).isEmpty();
var heartbeatT = participantHandler.makeHeartbeat(true);
assertEquals(id, heartbeatT.getParticipantId());
@@ -116,31 +99,6 @@ class ParticipantHandlerTest {
}
@Test
- void handleParticipantTest() {
- var participantHandler = commonTestData.getMockParticipantHandler();
- var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- var p = participantHandler.getParticipant(id.getName(), id.getVersion());
- assertEquals(ParticipantState.UNKNOWN, p.getParticipantState());
-
- participantHandler.updateParticipantState(id, ParticipantState.PASSIVE);
- var p2 = participantHandler.getParticipant(id.getName(), id.getVersion());
- assertEquals(ParticipantState.PASSIVE, p2.getParticipantState());
-
- var participantRegisterAckMsg = new ParticipantRegisterAck();
- participantRegisterAckMsg.setState(ParticipantState.TERMINATED);
- participantHandler.handleParticipantRegisterAck(participantRegisterAckMsg);
- assertEquals(ParticipantHealthStatus.HEALTHY, participantHandler.makeHeartbeat(false).getHealthStatus());
-
- var emptyid = new ToscaConceptIdentifier("", ID_VERSION);
- assertNull(participantHandler.updateParticipantState(emptyid, ParticipantState.PASSIVE));
-
- var sameid = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- var participant = participantHandler.updateParticipantState(sameid, ParticipantState.PASSIVE);
- assertEquals(participant.getDefinition(), sameid);
-
- }
-
- @Test
void checkAppliesTo() {
var participantHandler = commonTestData.getMockParticipantHandler();
var participantAckMsg =
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
index 01a8f3c28..10c438f93 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
@@ -196,8 +196,6 @@ public class CommonTestData {
*/
public ParticipantHandler getParticipantHandlerAutomationCompositions() throws CoderException {
var automationCompositionHandler = Mockito.mock(AutomationCompositionHandler.class);
- Mockito.doReturn(getTestAutomationCompositions()).when(automationCompositionHandler)
- .getAutomationCompositions();
Mockito.doReturn(getTestAutomationCompositionMap()).when(automationCompositionHandler)
.getAutomationCompositionMap();
var publisher = new ParticipantMessagePublisher();