summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2022-12-13 13:57:47 +0000
committerFrancesco Fiora <francesco.fiora@est.tech>2022-12-13 16:45:51 +0000
commita01c89adfa3a6fe0918d77282759295a7f0514e5 (patch)
treef5885152f94b408e3b3634ab600471e035d72da0 /participant/participant-intermediary/src
parent04ffb73ae3fcd3c666030d5c867febd88ef6537c (diff)
Replace ToscaConceptIdentifier with UUID in Participant Messages ACM
Replace in all messages the reference to Automation Composition ToscaConceptIdentifier(name, version) with instanceId(UUID). Issue-ID: POLICY-4479 Change-Id: I7bc9a7494103b9c1752a1e2c6f6d5a527196913d Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src')
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java13
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/ParticipantIntermediaryApi.java2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImpl.java2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java23
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/api/impl/ParticipantIntermediaryApiImplTest.java6
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java36
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java5
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java26
-rw-r--r--participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json5
9 files changed, 59 insertions, 59 deletions
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java
index f2832c5b5..ee769f481 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/api/AutomationCompositionElementListener.java
@@ -20,13 +20,12 @@
package org.onap.policy.clamp.acm.participant.intermediary.api;
+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.models.base.PfModelException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
/**
* This interface is implemented by participant implementations to receive updates on automation composition elements.
@@ -40,18 +39,18 @@ public interface AutomationCompositionElementListener {
* @param newState the state to which the automation composition element is changing to
* @throws PfModelException in case of a model exception
*/
- public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionState currentState,
AutomationCompositionOrderedState newState) throws PfModelException;
/**
* Handle an update on a automation composition element.
*
+ * @param automationCompositionId the automationComposition Id
* @param element the information on the automation composition element
- * @param automationCompositionElementDefinition toscaNodeTemplate
+ * @param properties properties Map
* @throws PfModelException from Policy framework
*/
- public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element, ToscaNodeTemplate automationCompositionElementDefinition)
- throws PfModelException;
+ public void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) throws PfModelException;
}
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 754a8305f..367215a29 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
@@ -107,7 +107,7 @@ public interface ParticipantIntermediaryApi {
* @param newState the state of the automation composition element
* @return AutomationCompositionElement updated automation composition element
*/
- AutomationCompositionElement updateAutomationCompositionElementState(ToscaConceptIdentifier automationCompositionId,
+ AutomationCompositionElement updateAutomationCompositionElementState(UUID automationCompositionId,
UUID id, AutomationCompositionOrderedState currentState, AutomationCompositionState newState,
ParticipantMessageType messageType);
}
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 cf7a93fb4..6dfc82791 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
@@ -120,7 +120,7 @@ public class ParticipantIntermediaryApiImpl implements ParticipantIntermediaryAp
@Override
public AutomationCompositionElement updateAutomationCompositionElementState(
- ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState currentState,
+ 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 cb5b572a5..66ac0c1dc 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
@@ -22,6 +22,7 @@
package org.onap.policy.clamp.acm.participant.intermediary.handler;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -63,7 +64,7 @@ public class AutomationCompositionHandler {
private final ParticipantMessagePublisher publisher;
@Getter
- private final Map<ToscaConceptIdentifier, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
+ private final Map<UUID, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
@Getter
private final Map<UUID, AutomationCompositionElement> elementsOnThisParticipant = new LinkedHashMap<>();
@@ -97,7 +98,7 @@ public class AutomationCompositionHandler {
* @return automationCompositionElement the updated automation composition element
*/
public AutomationCompositionElement updateAutomationCompositionElementState(
- ToscaConceptIdentifier automationCompositionId, UUID id, AutomationCompositionOrderedState orderedState,
+ UUID automationCompositionId, UUID id, AutomationCompositionOrderedState orderedState,
AutomationCompositionState newState) {
if (id == null) {
@@ -254,8 +255,7 @@ public class AutomationCompositionHandler {
}
automationComposition = new AutomationComposition();
- automationComposition.setName(updateMsg.getAutomationCompositionId().getName());
- automationComposition.setVersion(updateMsg.getAutomationCompositionId().getVersion());
+ automationComposition.setInstanceId(updateMsg.getAutomationCompositionId());
var acElements = storeElementsOnThisParticipant(updateMsg.getParticipantUpdatesList());
var acElementMap = prepareAcElementMap(acElements);
automationComposition.setElements(acElementMap);
@@ -278,7 +278,7 @@ public class AutomationCompositionHandler {
private void handleAutomationCompositionElementUpdate(List<AutomationCompositionElement> acElements,
List<AutomationCompositionElementDefinition> acElementDefinitions, Integer startPhaseMsg,
- ToscaConceptIdentifier automationCompositionId) {
+ UUID automationCompositionId) {
try {
for (var element : acElements) {
var acElementNodeTemplate = getAcElementNodeTemplate(acElementDefinitions, element.getDefinition());
@@ -286,8 +286,9 @@ public class AutomationCompositionHandler {
int startPhase = ParticipantUtils.findStartPhase(acElementNodeTemplate.getProperties());
if (startPhaseMsg.equals(startPhase)) {
for (var acElementListener : listeners) {
- acElementListener.automationCompositionElementUpdate(automationCompositionId, element,
- acElementNodeTemplate);
+ var map = new HashMap<>(acElementNodeTemplate.getProperties());
+ map.putAll(element.getProperties());
+ acElementListener.automationCompositionElementUpdate(automationCompositionId, element, map);
}
}
}
@@ -345,7 +346,7 @@ public class AutomationCompositionHandler {
.filter(element -> !AutomationCompositionState.UNINITIALISED.equals(element.getState())).findAny()
.isEmpty();
if (isAllUninitialised) {
- automationCompositionMap.remove(automationComposition.getKey().asIdentifier());
+ automationCompositionMap.remove(automationComposition.getInstanceId());
automationComposition.getElements().values()
.forEach(element -> elementsOnThisParticipant.remove(element.getId()));
}
@@ -398,7 +399,7 @@ public class AutomationCompositionHandler {
automationCompositionAck.setParticipantType(participantType);
automationCompositionAck.setMessage("Automation composition is already in state " + orderedState);
automationCompositionAck.setResult(false);
- automationCompositionAck.setAutomationCompositionId(automationComposition.getKey().asIdentifier());
+ automationCompositionAck.setAutomationCompositionId(automationComposition.getInstanceId());
publisher.sendAutomationCompositionAck(automationCompositionAck);
return;
}
@@ -418,11 +419,11 @@ public class AutomationCompositionHandler {
for (var acElementListener : listeners) {
try {
acElementListener.automationCompositionElementStateChange(
- automationComposition.getKey().asIdentifier(), acElement.getId(), acElement.getState(),
+ automationComposition.getInstanceId(), acElement.getId(), acElement.getState(),
orderedState);
} catch (PfModelException e) {
LOGGER.debug("Automation composition element update failed {}",
- automationComposition.getKey().asIdentifier());
+ automationComposition.getInstanceId());
}
}
}
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 440958e33..4458f0bfa 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
@@ -75,9 +75,9 @@ class ParticipantIntermediaryApiImplTest {
var idType = new ToscaConceptIdentifier(ID_NAME_TYPE, ID_VERSION_TYPE);
assertEquals(idType, element.getParticipantType());
- var acElement =
- apiImpl.updateAutomationCompositionElementState(id, uuid, AutomationCompositionOrderedState.UNINITIALISED,
- AutomationCompositionState.PASSIVE, ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ var acElement = apiImpl.updateAutomationCompositionElementState(UUID.randomUUID(), uuid,
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE,
+ ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
assertEquals(AutomationCompositionOrderedState.UNINITIALISED, acElement.getOrderedState());
assertEquals(uuid, acElement.getId());
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 95f16d3e2..06700fcce 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
@@ -63,7 +63,7 @@ class AutomationCompositionHandlerTest {
var element = new AutomationCompositionElement();
element.setId(elementId1);
element.setDefinition(
- new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "1.0.1"));
+ new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "1.0.1"));
element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
@@ -78,10 +78,10 @@ class AutomationCompositionHandlerTest {
var ach = commonTestData.getMockAutomationCompositionHandler();
assertNull(ach.updateAutomationCompositionElementState(null, null,
- AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
assertNull(ach.updateAutomationCompositionElementState(null, id,
- AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE));
}
@Test
@@ -93,19 +93,19 @@ class AutomationCompositionHandlerTest {
var key = ach.getElementsOnThisParticipant().keySet().iterator().next();
var value = ach.getElementsOnThisParticipant().get(key);
assertEquals(AutomationCompositionState.UNINITIALISED, value.getState());
- ach.updateAutomationCompositionElementState(id, uuid, AutomationCompositionOrderedState.UNINITIALISED,
- AutomationCompositionState.PASSIVE);
+ ach.updateAutomationCompositionElementState(CommonTestData.AC_ID_1, uuid,
+ AutomationCompositionOrderedState.UNINITIALISED, AutomationCompositionState.PASSIVE);
assertEquals(AutomationCompositionState.PASSIVE, value.getState());
ach.getAutomationCompositionMap().values().iterator().next().getElements().putIfAbsent(key, value);
- ach.updateAutomationCompositionElementState(id, key, AutomationCompositionOrderedState.PASSIVE,
- AutomationCompositionState.RUNNING);
+ ach.updateAutomationCompositionElementState(CommonTestData.AC_ID_1, key,
+ AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.RUNNING);
assertEquals(AutomationCompositionState.RUNNING, value.getState());
ach.getElementsOnThisParticipant().remove(key, value);
ach.getAutomationCompositionMap().values().iterator().next().getElements().clear();
- assertNull(ach.updateAutomationCompositionElementState(id, key, AutomationCompositionOrderedState.PASSIVE,
- AutomationCompositionState.RUNNING));
+ assertNull(ach.updateAutomationCompositionElementState(CommonTestData.AC_ID_1, key,
+ AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.RUNNING));
}
@@ -115,19 +115,19 @@ class AutomationCompositionHandlerTest {
var id = CommonTestData.getParticipantId();
var stateChange = getStateChange(id, uuid, AutomationCompositionOrderedState.RUNNING);
var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
- assertDoesNotThrow(
- () -> ach.handleAutomationCompositionStateChange(mock(AutomationCompositionStateChange.class), List.of()));
+ assertDoesNotThrow(() -> ach
+ .handleAutomationCompositionStateChange(mock(AutomationCompositionStateChange.class), List.of()));
ach.handleAutomationCompositionStateChange(stateChange, List.of());
var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChange.setAutomationCompositionId(newid);
+ stateChange.setAutomationCompositionId(UUID.randomUUID());
stateChange.setParticipantId(newid);
assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChange, List.of()));
var acd = new AutomationCompositionElementDefinition();
acd.setAcElementDefinitionId(id);
var updateMsg = new AutomationCompositionUpdate();
- updateMsg.setAutomationCompositionId(id);
+ updateMsg.setAutomationCompositionId(UUID.randomUUID());
updateMsg.setMessageId(uuid);
updateMsg.setParticipantId(id);
updateMsg.setStartPhase(0);
@@ -140,7 +140,7 @@ class AutomationCompositionHandlerTest {
updateMsg.setStartPhase(0);
assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
- updateMsg.setAutomationCompositionId(new ToscaConceptIdentifier("new", "0.0.1"));
+ updateMsg.setAutomationCompositionId(UUID.randomUUID());
updateMsg.setParticipantUpdatesList(List.of(mock(ParticipantUpdates.class)));
assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
@@ -170,7 +170,7 @@ class AutomationCompositionHandlerTest {
var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
ach.handleAutomationCompositionStateChange(stateChangeUninitialised, List.of());
var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChangeUninitialised.setAutomationCompositionId(newid);
+ stateChangeUninitialised.setAutomationCompositionId(UUID.randomUUID());
stateChangeUninitialised.setParticipantId(newid);
assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChangeUninitialised, List.of()));
}
@@ -185,15 +185,15 @@ class AutomationCompositionHandlerTest {
var ach = commonTestData.setTestAutomationCompositionHandler(id, uuid);
ach.handleAutomationCompositionStateChange(stateChangePassive, List.of());
var newid = new ToscaConceptIdentifier("id", "1.2.3");
- stateChangePassive.setAutomationCompositionId(newid);
+ stateChangePassive.setAutomationCompositionId(UUID.randomUUID());
stateChangePassive.setParticipantId(newid);
assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChangePassive, List.of()));
}
private AutomationCompositionStateChange getStateChange(ToscaConceptIdentifier id, UUID uuid,
- AutomationCompositionOrderedState state) {
+ AutomationCompositionOrderedState state) {
var stateChange = new AutomationCompositionStateChange();
- stateChange.setAutomationCompositionId(id);
+ stateChange.setAutomationCompositionId(UUID.randomUUID());
stateChange.setParticipantId(id);
stateChange.setMessageId(uuid);
stateChange.setOrderedState(state);
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 a87d8e1aa..fd0b54f5e 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
@@ -80,7 +80,7 @@ class ParticipantHandlerTest {
var participantHandler = commonTestData.getMockParticipantHandler();
var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
- participantUpdateMsg.setAutomationCompositionId(id);
+ participantUpdateMsg.setAutomationCompositionId(CommonTestData.AC_ID_1);
participantUpdateMsg.setParticipantId(id);
participantUpdateMsg.setParticipantType(id);
participantUpdateMsg.setMessageId(UUID.randomUUID());
@@ -160,9 +160,8 @@ class ParticipantHandlerTest {
@Test
void getAutomationCompositionInfoListTest() throws CoderException {
var participantHandler = commonTestData.getParticipantHandlerAutomationCompositions();
- var id = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
participantHandler.sendHeartbeat();
- assertEquals(id, participantHandler.makeHeartbeat(false)
+ assertEquals(CommonTestData.AC_ID_1, participantHandler.makeHeartbeat(false)
.getAutomationCompositionInfoList()
.get(0)
.getAutomationCompositionId());
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 91552ee34..01a8f3c28 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
@@ -55,6 +55,8 @@ public class CommonTestData {
public static final List<TopicParameters> TOPIC_PARAMS = List.of(getTopicParams());
public static final Coder CODER = new StandardCoder();
private static final Object lockit = new Object();
+ public static final UUID AC_ID_0 = UUID.randomUUID();
+ public static final UUID AC_ID_1 = UUID.randomUUID();
/**
* Get ParticipantIntermediaryParameters.
@@ -64,7 +66,7 @@ public class CommonTestData {
public ParticipantIntermediaryParameters getParticipantIntermediaryParameters() {
try {
return CODER.convert(getIntermediaryParametersMap(PARTICIPANT_GROUP_NAME),
- ParticipantIntermediaryParameters.class);
+ ParticipantIntermediaryParameters.class);
} catch (final CoderException e) {
throw new RuntimeException("cannot create ParticipantSimulatorParameters from map", e);
}
@@ -195,9 +197,9 @@ public class CommonTestData {
public ParticipantHandler getParticipantHandlerAutomationCompositions() throws CoderException {
var automationCompositionHandler = Mockito.mock(AutomationCompositionHandler.class);
Mockito.doReturn(getTestAutomationCompositions()).when(automationCompositionHandler)
- .getAutomationCompositions();
+ .getAutomationCompositions();
Mockito.doReturn(getTestAutomationCompositionMap()).when(automationCompositionHandler)
- .getAutomationCompositionMap();
+ .getAutomationCompositionMap();
var publisher = new ParticipantMessagePublisher();
publisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
var parameters = getParticipantParameters();
@@ -218,12 +220,11 @@ public class CommonTestData {
*
* @throws CoderException if there is an error with .json file.
*/
- public Map<ToscaConceptIdentifier, AutomationComposition> getTestAutomationCompositionMap() throws CoderException {
+ public Map<UUID, AutomationComposition> getTestAutomationCompositionMap() throws CoderException {
var automationCompositions = getTestAutomationCompositions();
var automationComposition = automationCompositions.getAutomationCompositionList().get(1);
- var id = getParticipantId();
- Map<ToscaConceptIdentifier, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
- automationCompositionMap.put(id, automationComposition);
+ Map<UUID, AutomationComposition> automationCompositionMap = new LinkedHashMap<>();
+ automationCompositionMap.put(automationComposition.getInstanceId(), automationComposition);
return automationCompositionMap;
}
@@ -235,8 +236,11 @@ public class CommonTestData {
* @throws CoderException if there is an error with .json file.
*/
public AutomationCompositions getTestAutomationCompositions() throws CoderException {
- return new StandardCoder().decode(new File("src/test/resources/providers/TestAutomationCompositions.json"),
- AutomationCompositions.class);
+ var automationCompositions = new StandardCoder().decode(
+ new File("src/test/resources/providers/TestAutomationCompositions.json"), AutomationCompositions.class);
+ automationCompositions.getAutomationCompositionList().get(1).setInstanceId(AC_ID_0);
+ automationCompositions.getAutomationCompositionList().get(1).setInstanceId(AC_ID_1);
+ return automationCompositions;
}
/**
@@ -246,7 +250,7 @@ public class CommonTestData {
* @return a map suitable for elementsOnThisParticipant
*/
public Map<UUID, AutomationCompositionElement> setAutomationCompositionElementTest(UUID uuid,
- ToscaConceptIdentifier id) {
+ ToscaConceptIdentifier id) {
var acElement = new AutomationCompositionElement();
acElement.setId(uuid);
acElement.setParticipantId(id);
@@ -265,7 +269,7 @@ public class CommonTestData {
* @return a AutomationCompositionHander with elements
*/
public AutomationCompositionHandler setTestAutomationCompositionHandler(ToscaConceptIdentifier id, UUID uuid)
- throws CoderException {
+ throws CoderException {
var ach = getMockAutomationCompositionHandler();
var key = getTestAutomationCompositionMap().keySet().iterator().next();
diff --git a/participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json b/participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json
index 10ed6d187..9f2eed066 100644
--- a/participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json
+++ b/participant/participant-intermediary/src/test/resources/providers/TestAutomationCompositions.json
@@ -35,10 +35,7 @@
},
"709c62b3-8918-41b9-a747-e21eb79c6c22": {
"id": "709c62b3-8918-41b9-a747-d21eb79c6c22",
- "definition": {
- "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
- "version": "1.2.3"
- },
+ "compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
"participantType": {
"name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
"version": "2.3.1"