aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java5
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java12
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java4
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java2
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java25
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java2
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java20
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java60
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java28
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java22
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java13
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java9
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java23
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java22
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java9
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java35
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandlerTest.java63
-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
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java2
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java2
34 files changed, 236 insertions, 256 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java
index 14aee1dd8..c43e4db91 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionInfo.java
@@ -20,10 +20,10 @@
package org.onap.policy.clamp.models.acm.concepts;
+import java.util.UUID;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to represent a automation composition info instance.
@@ -33,7 +33,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@ToString
public class AutomationCompositionInfo {
- private ToscaConceptIdentifier automationCompositionId;
+ private UUID automationCompositionId;
private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java
index c0a21d61a..c1ec67c83 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,6 @@ import lombok.Setter;
import lombok.ToString;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to represent the AUTOMATION_COMPOSITION_ACK message that a participant sends
@@ -41,7 +40,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@ToString(callSuper = true)
public class AutomationCompositionAck extends ParticipantAckMessage {
- private ToscaConceptIdentifier automationCompositionId;
+ private UUID automationCompositionId;
private Integer startPhase;
// A map with AutomationCompositionElementID as its key, and a pair of result and message as value per
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java
index c358376b2..ae6dce515 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -60,7 +60,7 @@ public class ParticipantMessage {
/**
* Automation Composition ID, or {@code null} for messages to participants.
*/
- private ToscaConceptIdentifier automationCompositionId;
+ private UUID automationCompositionId;
/**
* Constructor for instantiating a participant message class.
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
index 3d2813eb2..8c39f6e2b 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java
@@ -80,6 +80,18 @@ public class AutomationCompositionProvider {
}
/**
+ * Find automation composition.
+ *
+ * @param instanceId the ID of the automation composition to get
+ * @return the automation composition found
+ */
+ @Transactional(readOnly = true)
+ public Optional<AutomationComposition> findAutomationComposition(final UUID instanceId) {
+ var result = automationCompositionRepository.findByInstanceId(instanceId.toString());
+ return result.stream().map(JpaAutomationComposition::toAuthorative).findFirst();
+ }
+
+ /**
* Find automation composition by automationCompositionId.
*
* @param automationCompositionId the ID of the automation composition to get
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
index c750610d4..8702808cd 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
@@ -48,7 +48,7 @@ class AutomationCompositionAckTest {
// verify with all values
var id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setAutomationCompositionId(id);
+ orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(id);
orig.setParticipantType(id);
var acElementResult = new AutomationCompositionElementAck(AutomationCompositionState.UNINITIALISED,
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java
index 6e8f41a4f..ff738a01a 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java
@@ -50,7 +50,7 @@ class AutomationCompositionStateChangeTest {
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setAutomationCompositionId(id);
+ orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(id);
orig.setMessageId(UUID.randomUUID());
orig.setOrderedState(AutomationCompositionOrderedState.RUNNING);
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
index a2417df6b..9f7417a0b 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
@@ -49,14 +49,14 @@ class AutomationCompositionUpdateTest {
var orig = new AutomationCompositionUpdate();
// verify with all values
- var id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setAutomationCompositionId(id);
+ orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(null);
orig.setMessageId(UUID.randomUUID());
orig.setTimestamp(Instant.ofEpochMilli(3000));
var acElement = new AutomationCompositionElement();
acElement.setId(UUID.randomUUID());
+ var id = new ToscaConceptIdentifier("id", "1.2.3");
acElement.setDefinition(id);
acElement.setDescription("Description");
acElement.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java
index d8dd15dbd..02b79878c 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java
@@ -47,7 +47,7 @@ class ParticipantDeregisterTest {
ToscaConceptIdentifier id = new ToscaConceptIdentifier();
id.setName("id");
id.setVersion("1.2.3");
- orig.setAutomationCompositionId(id);
+ orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java
index 215f4a9ec..b8be8b0d9 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java
@@ -47,7 +47,7 @@ class ParticipantRegisterTest {
ToscaConceptIdentifier id = new ToscaConceptIdentifier();
id.setName("id");
id.setVersion("1.2.3");
- orig.setAutomationCompositionId(id);
+ orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java
index eeb8ba3dd..a8a2267ad 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java
@@ -47,15 +47,16 @@ class ParticipantStatusTest {
void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantStatus(null)).isInstanceOf(NullPointerException.class);
- final ParticipantStatus orig = new ParticipantStatus();
+ final var orig = new ParticipantStatus();
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantStatus(orig).toString()));
// verify with all values
- ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setAutomationCompositionId(id);
+ var automationCompositionId = UUID.randomUUID();
+ orig.setAutomationCompositionId(automationCompositionId);
+ var id = new ToscaConceptIdentifier("id", "1.2.3");
orig.setParticipantId(id);
ToscaConceptIdentifier type = new ToscaConceptIdentifier("type", "2.3.4");
orig.setParticipantType(type);
@@ -64,13 +65,13 @@ class ParticipantStatusTest {
orig.setHealthStatus(ParticipantHealthStatus.HEALTHY);
orig.setTimestamp(Instant.ofEpochMilli(3000));
- AutomationCompositionInfo acInfo = getAutomationCompositionInfo(id);
+ var acInfo = getAutomationCompositionInfo(automationCompositionId);
orig.setAutomationCompositionInfoList(List.of(acInfo));
- ParticipantDefinition participantDefinitionUpdate = new ParticipantDefinition();
+ var participantDefinitionUpdate = new ParticipantDefinition();
participantDefinitionUpdate.setParticipantId(id);
participantDefinitionUpdate.setParticipantType(type);
- AutomationCompositionElementDefinition acDefinition = getAcElementDefinition(id);
+ var acDefinition = getAcElementDefinition(id);
participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition));
orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate));
@@ -80,8 +81,8 @@ class ParticipantStatusTest {
assertSerializable(orig, ParticipantStatus.class);
}
- private AutomationCompositionInfo getAutomationCompositionInfo(ToscaConceptIdentifier id) {
- AutomationCompositionInfo acInfo = new AutomationCompositionInfo();
+ private AutomationCompositionInfo getAutomationCompositionInfo(UUID id) {
+ var acInfo = new AutomationCompositionInfo();
acInfo.setState(AutomationCompositionState.PASSIVE2RUNNING);
acInfo.setAutomationCompositionId(id);
@@ -89,20 +90,20 @@ class ParticipantStatusTest {
}
private AutomationCompositionElementDefinition getAcElementDefinition(ToscaConceptIdentifier id) {
- ToscaNodeTemplate toscaNodeTemplate = new ToscaNodeTemplate();
+ var toscaNodeTemplate = new ToscaNodeTemplate();
toscaNodeTemplate.setName("nodeTemplate");
toscaNodeTemplate.setDerivedFrom("parentNodeTemplate");
toscaNodeTemplate.setDescription("Description of nodeTemplate");
toscaNodeTemplate.setVersion("1.2.3");
- AutomationCompositionElementDefinition acDefinition = new AutomationCompositionElementDefinition();
+ var acDefinition = new AutomationCompositionElementDefinition();
acDefinition.setAcElementDefinitionId(id);
acDefinition.setAutomationCompositionElementToscaNodeTemplate(toscaNodeTemplate);
- ToscaProperty property = new ToscaProperty();
+ var property = new ToscaProperty();
property.setName("test");
property.setType("testType");
- Map<String, ToscaProperty> commonPropertiesMap = Map.of("Prop1", property);
+ var commonPropertiesMap = Map.of("Prop1", property);
acDefinition.setCommonPropertiesMap(commonPropertiesMap);
return acDefinition;
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
index dd49e1355..074f6f2e2 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
@@ -49,7 +49,7 @@ class ParticipantUpdateTest {
ParticipantUpdate orig = new ParticipantUpdate();
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
- orig.setAutomationCompositionId(id);
+ orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(id);
orig.setParticipantType(id);
orig.setMessageId(UUID.randomUUID());
diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
index 9b942b961..bcc3fd498 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/main/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AutomationCompositionElementHandler.java
@@ -23,9 +23,7 @@ package org.onap.policy.clamp.acm.participant.a1pms.handler;
import java.lang.invoke.MethodHandles;
import java.util.HashMap;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
-import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.ValidationException;
import lombok.AccessLevel;
@@ -46,8 +44,6 @@ import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -75,18 +71,19 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Handle a automation composition element state change.
*
+ * @param automationCompositionId the ID of the automation composition
* @param automationCompositionElementId the ID of the automation composition element
* @param currentState the current state of the automation composition element
* @param newState the state to which the automation composition element is changing to
* @throws PfModelException in case of a model exception
*/
@Override
- public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionState currentState,
AutomationCompositionOrderedState newState) throws A1PolicyServiceException {
switch (newState) {
case UNINITIALISED:
- ConfigurationEntity configurationEntity = configRequestMap.get(automationCompositionElementId);
+ var configurationEntity = configRequestMap.get(automationCompositionElementId);
if (configurationEntity != null && acA1PmsClient.isPmsHealthy()) {
acA1PmsClient.deleteService(configurationEntity.getPolicyServiceEntities());
configRequestMap.remove(automationCompositionElementId);
@@ -118,15 +115,16 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Callback method to handle an update on an automation composition element.
*
+ * @param automationCompositionId the ID of the automation composition
* @param element the information on the automation composition element
- * @param nodeTemplate toscaNodeTemplate
+ * @param properties properties Map
*/
@Override
- public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) throws A1PolicyServiceException {
+ public void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) throws A1PolicyServiceException {
try {
- var configurationEntity = CODER.convert(nodeTemplate.getProperties(), ConfigurationEntity.class);
- Set<ConstraintViolation<ConfigurationEntity>> violations =
+ var configurationEntity = CODER.convert(properties, ConfigurationEntity.class);
+ var violations =
Validation.buildDefaultValidatorFactory().getValidator().validate(configurationEntity);
if (violations.isEmpty()) {
if (acA1PmsClient.isPmsHealthy()) {
diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java
index 635b77486..ce775b616 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/handler/AcElementHandlerTest.java
@@ -39,10 +39,8 @@ import org.onap.policy.clamp.acm.participant.a1pms.utils.CommonTestData;
import org.onap.policy.clamp.acm.participant.a1pms.utils.ToscaUtils;
import org.onap.policy.clamp.acm.participant.a1pms.webclient.AcA1PmsClient;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
-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.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -54,14 +52,13 @@ class AcElementHandlerTest {
@InjectMocks
@Spy
private AutomationCompositionElementHandler automationCompositionElementHandler =
- new AutomationCompositionElementHandler(acA1PmsClient);
-
+ new AutomationCompositionElementHandler(acA1PmsClient);
private final CommonTestData commonTestData = new CommonTestData();
private static ToscaServiceTemplate serviceTemplate;
private static final String A1_AUTOMATION_COMPOSITION_ELEMENT =
- "org.onap.domain.database.A1PMSAutomationCompositionElement";
+ "org.onap.domain.database.A1PMSAutomationCompositionElement";
@BeforeAll
static void init() {
@@ -81,22 +78,22 @@ class AcElementHandlerTest {
var element = commonTestData.getAutomationCompositionElement();
var automationCompositionElementId = element.getId();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT));
+ var nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ automationCompositionElementHandler
+ .automationCompositionElementUpdate(commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT).getProperties());
assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
- automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.PASSIVE));
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.PASSIVE));
assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
- automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.UNINITIALISED));
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.UNINITIALISED));
assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementStateChange(
- automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.RUNNING));
+ automationCompositionId, automationCompositionElementId, AutomationCompositionState.PASSIVE,
+ AutomationCompositionOrderedState.RUNNING));
when(acA1PmsClient.isPmsHealthy()).thenReturn(Boolean.FALSE);
assertThrows(A1PolicyServiceException.class,
@@ -107,35 +104,30 @@ class AcElementHandlerTest {
@Test
void test_AutomationCompositionElementUpdate() {
- AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
+ var element = commonTestData.getAutomationCompositionElement();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT)));
+ var nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ assertDoesNotThrow(() -> automationCompositionElementHandler
+ .automationCompositionElementUpdate(commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT).getProperties()));
}
@Test
void test_AutomationCompositionElementUpdateWithUnhealthyA1pms() {
- AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
+ var element = commonTestData.getAutomationCompositionElement();
when(acA1PmsClient.isPmsHealthy()).thenReturn(Boolean.FALSE);
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- assertThrows(A1PolicyServiceException.class,
- () -> automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT)));
+ var nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ assertThrows(A1PolicyServiceException.class, () -> automationCompositionElementHandler
+ .automationCompositionElementUpdate(commonTestData.getAutomationCompositionId(), element,
+ nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT).getProperties()));
}
@Test
void test_AutomationCompositionElementUpdateWithInvalidConfiguration() {
- AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
-
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
- ToscaNodeTemplate toscaNodeTemplate = nodeTemplatesMap.get(A1_AUTOMATION_COMPOSITION_ELEMENT);
- toscaNodeTemplate.setProperties(Map.of());
- assertThrows(A1PolicyServiceException.class,
- () -> automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element, toscaNodeTemplate));
+ var element = commonTestData.getAutomationCompositionElement();
+ assertThrows(A1PolicyServiceException.class, () -> automationCompositionElementHandler
+ .automationCompositionElementUpdate(commonTestData.getAutomationCompositionId(), element,
+ Map.of()));
}
}
diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java
index be573cb37..b68faa692 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-a1pms/src/test/java/org/onap/policy/clamp/acm/participant/a1pms/utils/CommonTestData.java
@@ -31,6 +31,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
public class CommonTestData {
private static final String TEST_KEY_NAME = "org.onap.domain.database.A1PMSAutomationCompositionElement";
+ private static final List<UUID> AC_ID_LIST = List.of(UUID.randomUUID(), UUID.randomUUID());
/**
* Get a automationComposition Element.
@@ -38,7 +39,7 @@ public class CommonTestData {
* @return automationCompositionElement object
*/
public AutomationCompositionElement getAutomationCompositionElement() {
- AutomationCompositionElement element = new AutomationCompositionElement();
+ var element = new AutomationCompositionElement();
element.setId(UUID.randomUUID());
element.setDefinition(new ToscaConceptIdentifier(TEST_KEY_NAME, "1.0.1"));
element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
@@ -48,30 +49,41 @@ public class CommonTestData {
/**
* Get automation composition id.
*
+ * @param instanceNo Identifier instance no
* @return ToscaConceptIdentifier automationCompositionId
*/
- public ToscaConceptIdentifier getAutomationCompositionId() {
+ public ToscaConceptIdentifier getA1PolicyServiceId(int instanceNo) {
+ return new ToscaConceptIdentifier("A1PMSInstance" + instanceNo, "1.0.0");
+ }
+
+ /**
+ * Get automation composition id.
+ *
+ * @return UUID automationCompositionId
+ */
+ public UUID getAutomationCompositionId() {
return getAutomationCompositionId(0);
}
/**
* Get automation composition id.
+ *
* @param instanceNo Identifier instance no
- * @return ToscaConceptIdentifier automationCompositionId
+ * @return UUID automationCompositionId
*/
- public ToscaConceptIdentifier getAutomationCompositionId(int instanceNo) {
- return new ToscaConceptIdentifier("A1PMSInstance" + instanceNo, "1.0.0");
+ public UUID getAutomationCompositionId(int instanceNo) {
+ return AC_ID_LIST.get(instanceNo);
}
-
/**
* Get valid policy entities.
+ *
* @return List of policy entities
*/
public List<A1PolicyServiceEntity> getValidPolicyEntities() {
- A1PolicyServiceEntity a1PolicyServiceEntity1 = new A1PolicyServiceEntity(getAutomationCompositionId(0),
+ var a1PolicyServiceEntity1 = new A1PolicyServiceEntity(getA1PolicyServiceId(0),
"testService1", "http://localhost", 0);
- A1PolicyServiceEntity a1PolicyServiceEntity2 = new A1PolicyServiceEntity(getAutomationCompositionId(1),
+ var a1PolicyServiceEntity2 = new A1PolicyServiceEntity(getA1PolicyServiceId(1),
"testService2", "http://127.0.0.1", 0);
return List.of(a1PolicyServiceEntity1, a1PolicyServiceEntity2);
}
diff --git a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
index 6b723750a..42b26c6a4 100644
--- a/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-http/src/main/java/org/onap/policy/clamp/acm/participant/http/main/handler/AutomationCompositionElementHandler.java
@@ -23,17 +23,13 @@ package org.onap.policy.clamp.acm.participant.http.main.handler;
import java.io.Closeable;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
-import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import java.util.stream.Collectors;
-import javax.validation.ConstraintViolation;
import javax.validation.Validation;
import javax.validation.ValidationException;
import lombok.Setter;
@@ -51,7 +47,6 @@ import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpStatus;
@@ -83,7 +78,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
* @throws PfModelException in case of a model exception
*/
@Override
- public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionState currentState,
AutomationCompositionOrderedState newState) {
switch (newState) {
@@ -111,19 +106,20 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Callback method to handle an update on a automation composition element.
*
+ * @param automationCompositionId the automationComposition Id
* @param element the information on the automation composition element
- * @param nodeTemplate toscaNodeTemplate
+ * @param properties properties Map
*/
@Override
- public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) {
+ public void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) {
try {
- var configRequest = CODER.convert(nodeTemplate.getProperties(), ConfigRequest.class);
- Set<ConstraintViolation<ConfigRequest>> violations =
+ var configRequest = CODER.convert(properties, ConfigRequest.class);
+ var violations =
Validation.buildDefaultValidatorFactory().getValidator().validate(configRequest);
if (violations.isEmpty()) {
invokeHttpClient(configRequest);
- List<Pair<Integer, String>> failedResponseStatus = restResponseMap.values().stream()
+ var failedResponseStatus = restResponseMap.values().stream()
.filter(response -> !HttpStatus.valueOf(response.getKey())
.is2xxSuccessful()).collect(Collectors.toList());
if (failedResponseStatus.isEmpty()) {
@@ -149,7 +145,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
*/
public void invokeHttpClient(ConfigRequest configRequest) throws ExecutionException, InterruptedException {
// Invoke runnable thread to execute https requests of all config entities
- Future<Map> result = executor.submit(new AcHttpClient(configRequest, restResponseMap), restResponseMap);
+ var result = executor.submit(new AcHttpClient(configRequest, restResponseMap), restResponseMap);
if (!result.get().isEmpty()) {
LOGGER.debug("Http Request Completed: {}", result.isDone());
}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
index 04cb34269..8e77b2acc 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/handler/AcElementHandlerTest.java
@@ -25,7 +25,7 @@ import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doNothing;
import java.io.IOException;
-import java.util.Map;
+import java.util.HashMap;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
@@ -38,10 +38,8 @@ import org.onap.policy.clamp.acm.participant.http.main.models.ConfigRequest;
import org.onap.policy.clamp.acm.participant.http.utils.CommonTestData;
import org.onap.policy.clamp.acm.participant.http.utils.ToscaUtils;
import org.onap.policy.clamp.acm.participant.intermediary.api.ParticipantIntermediaryApi;
-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.tosca.authorative.concepts.ToscaNodeTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -96,12 +94,13 @@ class AcElementHandlerTest {
@Test
void test_AutomationCompositionElementUpdate() throws Exception {
doNothing().when(automationCompositionElementHandler).invokeHttpClient(any());
- AutomationCompositionElement element = commonTestData.getAutomationCompositionElement();
+ var element = commonTestData.getAutomationCompositionElement();
- Map<String, ToscaNodeTemplate> nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ var nodeTemplatesMap = serviceTemplate.getToscaTopologyTemplate().getNodeTemplates();
+ var map = new HashMap<>(nodeTemplatesMap.get(HTTP_AUTOMATION_COMPOSITION_ELEMENT).getProperties());
+ map.putAll(element.getProperties());
assertDoesNotThrow(() -> automationCompositionElementHandler.automationCompositionElementUpdate(
- commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(HTTP_AUTOMATION_COMPOSITION_ELEMENT)));
+ commonTestData.getAutomationCompositionId(), element, map));
}
}
diff --git a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java
index 010d29a66..48b7bdcd7 100644
--- a/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-http/src/test/java/org/onap/policy/clamp/acm/participant/http/utils/CommonTestData.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2022 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -34,6 +34,7 @@ public class CommonTestData {
private static final String TEST_KEY_NAME =
"org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement";
+ public static final UUID AC_ID = UUID.randomUUID();
/**
* Get a automationComposition Element.
@@ -119,10 +120,10 @@ public class CommonTestData {
/**
* Get automation composition id.
*
- * @return ToscaConceptIdentifier automationCompositionId
+ * @return UUID automationCompositionId
*/
- public ToscaConceptIdentifier getAutomationCompositionId() {
- return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ public UUID getAutomationCompositionId() {
+ return AC_ID;
}
/**
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
index ba49ff1f9..c64bc4906 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandler.java
@@ -29,7 +29,6 @@ import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@@ -47,8 +46,6 @@ import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
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;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -92,12 +89,12 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
* @param newState the state to which the automation composition element is changing to
*/
@Override
- public synchronized void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public synchronized void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionState currentState,
AutomationCompositionOrderedState newState) {
switch (newState) {
case UNINITIALISED:
- ChartInfo chart = chartMap.get(automationCompositionElementId);
+ var chart = chartMap.get(automationCompositionElementId);
if (chart != null) {
LOGGER.info("Helm deployment to be deleted {} ", chart.getReleaseName());
try {
@@ -131,15 +128,16 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Callback method to handle an update on a automation composition element.
*
+ * @param automationCompositionId the automationComposition Id
* @param element the information on the automation composition element
- * @param nodeTemplate toscaNodeTemplate
+ * @param properties properties Map
* @throws PfModelException in case of an exception
*/
@Override
- public synchronized void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element, ToscaNodeTemplate nodeTemplate) throws PfModelException {
+ public synchronized void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) throws PfModelException {
@SuppressWarnings("unchecked")
- Map<String, Object> chartData = (Map<String, Object>) nodeTemplate.getProperties().get("chart");
+ var chartData = (Map<String, Object>) properties.get("chart");
LOGGER.info("Installation request received for the Helm Chart {} ", chartData);
try {
@@ -147,8 +145,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
if (chartService.installChart(chartInfo)) {
chartMap.put(element.getId(), chartInfo);
- var config = CODER.convert(nodeTemplate.getProperties(),
- ThreadConfig.class);
+ var config = CODER.convert(properties, ThreadConfig.class);
checkPodStatus(automationCompositionId, element.getId(), chartInfo,
config.uninitializedToPassiveTimeout, config.podStatusCheckInterval);
}
@@ -163,10 +160,10 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
*
* @param chart ChartInfo
*/
- public void checkPodStatus(ToscaConceptIdentifier automationCompositionId, UUID elementId,
+ public void checkPodStatus(UUID automationCompositionId, UUID elementId,
ChartInfo chart, int timeout, int podStatusCheckInterval) throws ExecutionException, InterruptedException {
// Invoke runnable thread to check pod status
- Future<String> result = executor.submit(new PodStatusValidator(chart, timeout,
+ var result = executor.submit(new PodStatusValidator(chart, timeout,
podStatusCheckInterval), "Done");
if (!result.get().isEmpty()) {
LOGGER.info("Pod Status Validator Completed: {}", result.isDone());
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
index fbd18ef67..f1357e435 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/handler/AutomationCompositionElementHandlerTest.java
@@ -32,7 +32,6 @@ import static org.mockito.Mockito.doThrow;
import java.io.File;
import java.io.IOException;
import java.util.List;
-import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
@@ -59,7 +58,6 @@ import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
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;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -100,8 +98,8 @@ class AutomationCompositionElementHandlerTest {
@Test
void test_AutomationCompositionElementStateChange() throws ServiceException {
- UUID automationCompositionElementId1 = UUID.randomUUID();
- UUID automationCompositionElementId2 = UUID.randomUUID();
+ var automationCompositionElementId1 = UUID.randomUUID();
+ var automationCompositionElementId2 = UUID.randomUUID();
automationCompositionElementHandler.getChartMap().put(automationCompositionElementId1, charts.get(0));
automationCompositionElementHandler.getChartMap().put(automationCompositionElementId2, charts.get(1));
@@ -133,27 +131,27 @@ class AutomationCompositionElementHandlerTest {
ExecutionException, InterruptedException {
doReturn(true).when(chartService).installChart(any());
doNothing().when(automationCompositionElementHandler).checkPodStatus(any(), any(), any(), anyInt(), anyInt());
- UUID elementId1 = UUID.randomUUID();
- AutomationCompositionElement element = new AutomationCompositionElement();
+ var elementId1 = UUID.randomUUID();
+ var element = new AutomationCompositionElement();
element.setId(elementId1);
element.setDefinition(new ToscaConceptIdentifier(KEY_NAME, "1.0.1"));
element.setOrderedState(AutomationCompositionOrderedState.PASSIVE);
- Map<String, ToscaNodeTemplate> nodeTemplatesMap =
+ var nodeTemplatesMap =
toscaServiceTemplate.getToscaTopologyTemplate().getNodeTemplates();
automationCompositionElementHandler.automationCompositionElementUpdate(
commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT));
+ nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT).getProperties());
assertThat(automationCompositionElementHandler.getChartMap()).hasSize(1).containsKey(elementId1);
doThrow(new ServiceException("Error installing the chart")).when(chartService).installChart(Mockito.any());
- UUID elementId2 = UUID.randomUUID();
+ var elementId2 = UUID.randomUUID();
element.setId(elementId2);
automationCompositionElementHandler.automationCompositionElementUpdate(
commonTestData.getAutomationCompositionId(), element,
- nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT));
+ nodeTemplatesMap.get(K8S_AUTOMATION_COMPOSITION_ELEMENT).getProperties());
assertThat(automationCompositionElementHandler.getChartMap().containsKey(elementId2)).isFalse();
}
@@ -164,8 +162,8 @@ class AutomationCompositionElementHandlerTest {
doReturn("Done").when(result).get();
doReturn(true).when(result).isDone();
var chartInfo = charts.get(0);
- ToscaConceptIdentifier automationCompositionId = new ToscaConceptIdentifier();
- AutomationCompositionElement element = new AutomationCompositionElement();
+ var automationCompositionId = UUID.randomUUID();
+ var element = new AutomationCompositionElement();
assertDoesNotThrow(
() -> automationCompositionElementHandler.checkPodStatus(automationCompositionId,
element.getId(), chartInfo, 1, 1));
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
index 7ffd68812..97d2fbbd2 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
@@ -24,6 +24,7 @@ package org.onap.policy.clamp.acm.participant.kubernetes.parameters;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import java.util.UUID;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
@@ -37,7 +38,7 @@ public class CommonTestData {
public static final long TIME_INTERVAL = 2000;
public static final List<TopicParameters> TOPIC_PARAMS = List.of(getTopicParams());
public static final Coder CODER = new StandardCoder();
-
+ private static final UUID AC_ID = UUID.randomUUID();
/**
* Get ParticipantK8sParameters.
@@ -152,9 +153,9 @@ public class CommonTestData {
/**
* Get automation composition id.
- * @return ToscaConceptIdentifier automationCompositionId
+ * @return UUID automationCompositionId
*/
- public ToscaConceptIdentifier getAutomationCompositionId() {
- return new ToscaConceptIdentifier("PMSHInstance0", "1.0.0");
+ public UUID getAutomationCompositionId() {
+ return AC_ID;
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
index bdf4f8fcf..ca27c8214 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
+++ b/participant/participant-impl/participant-impl-policy/src/main/java/org/onap/policy/clamp/acm/participant/policy/main/handler/AutomationCompositionElementHandler.java
@@ -24,7 +24,6 @@ package org.onap.policy.clamp.acm.participant.policy.main.handler;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.UUID;
import lombok.Setter;
import org.apache.http.HttpStatus;
@@ -39,11 +38,7 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMe
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.pdp.concepts.DeploymentSubGroup;
-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.ToscaPolicy;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -84,7 +79,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
* @param orderedState the state to which the automation composition element is changing to
*/
@Override
- public void automationCompositionElementStateChange(ToscaConceptIdentifier automationCompositionId,
+ public void automationCompositionElementStateChange(UUID automationCompositionId,
UUID automationCompositionElementId,
AutomationCompositionState currentState,
AutomationCompositionOrderedState orderedState) {
@@ -120,26 +115,26 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
}
}
- private void deletePolicyData(ToscaConceptIdentifier automationCompositionId,
+ private void deletePolicyData(UUID automationCompositionId,
UUID automationCompositionElementId, AutomationCompositionOrderedState newState) {
// Delete all policies of this automationComposition from policy framework
- for (Entry<String, String> policy : policyMap.entrySet()) {
+ for (var policy : policyMap.entrySet()) {
apiHttpClient.deletePolicy(policy.getKey(), policy.getValue());
}
policyMap.clear();
// Delete all policy types of this automation composition from policy framework
- for (Entry<String, String> policyType : policyTypeMap.entrySet()) {
+ for (var policyType : policyTypeMap.entrySet()) {
apiHttpClient.deletePolicyType(policyType.getKey(), policyType.getValue());
}
policyTypeMap.clear();
}
- private void deployPolicies(ToscaConceptIdentifier automationCompositionId, UUID automationCompositionElementId,
+ private void deployPolicies(UUID automationCompositionId, UUID automationCompositionElementId,
AutomationCompositionOrderedState newState) {
var deployFailure = false;
// Deploy all policies of this automationComposition from Policy Framework
if (!policyMap.entrySet().isEmpty()) {
- for (Entry<String, String> policy : policyMap.entrySet()) {
+ for (var policy : policyMap.entrySet()) {
var deployPolicyResp = papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(),
DeploymentSubGroup.Action.POST).getStatus();
if (deployPolicyResp != HttpStatus.SC_ACCEPTED) {
@@ -161,7 +156,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
private void undeployPolicies(UUID automationCompositionElementId) {
// Undeploy all policies of this automation composition from Policy Framework
if (!policyMap.entrySet().isEmpty()) {
- for (Entry<String, String> policy : policyMap.entrySet()) {
+ for (var policy : policyMap.entrySet()) {
papHttpClient.handlePolicyDeployOrUndeploy(policy.getKey(), policy.getValue(),
DeploymentSubGroup.Action.DELETE);
}
@@ -174,22 +169,21 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
/**
* Callback method to handle an update on automation composition element.
*
+ * @param automationCompositionId the automationComposition Id
* @param element the information on the automation composition element
- * @param acElementDefinition toscaNodeTemplate
+ * @param properties properties Map
* @throws PfModelException in case of an exception
*/
@Override
- public void automationCompositionElementUpdate(ToscaConceptIdentifier automationCompositionId,
- AutomationCompositionElement element,
- ToscaNodeTemplate acElementDefinition)
- throws PfModelException {
+ public void automationCompositionElementUpdate(UUID automationCompositionId,
+ AutomationCompositionElement element, Map<String, Object> properties) throws PfModelException {
var createPolicyTypeResp = HttpStatus.SC_OK;
var createPolicyResp = HttpStatus.SC_OK;
- ToscaServiceTemplate automationCompositionDefinition = element.getToscaServiceTemplateFragment();
+ var automationCompositionDefinition = element.getToscaServiceTemplateFragment();
if (automationCompositionDefinition.getToscaTopologyTemplate() != null) {
if (automationCompositionDefinition.getPolicyTypes() != null) {
- for (ToscaPolicyType policyType : automationCompositionDefinition.getPolicyTypes().values()) {
+ for (var policyType : automationCompositionDefinition.getPolicyTypes().values()) {
policyTypeMap.put(policyType.getName(), policyType.getVersion());
}
LOGGER.info("Found Policy Types in automation composition definition: {} , Creating Policy Types",
@@ -197,8 +191,7 @@ public class AutomationCompositionElementHandler implements AutomationCompositio
createPolicyTypeResp = apiHttpClient.createPolicyType(automationCompositionDefinition).getStatus();
}
if (automationCompositionDefinition.getToscaTopologyTemplate().getPolicies() != null) {
- for (Map<String, ToscaPolicy> gotPolicyMap : automationCompositionDefinition.getToscaTopologyTemplate()
- .getPolicies()) {
+ for (var gotPolicyMap : automationCompositionDefinition.getToscaTopologyTemplate().getPolicies()) {
for (ToscaPolicy policy : gotPolicyMap.values()) {
policyMap.put(policy.getName(), policy.getVersion());
}
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 34162a29b..0836dbb3c 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
@@ -39,45 +39,34 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedSta
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;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyType;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaTopologyTemplate;
-
class AutomationCompositionElementHandlerTest {
private static final String ID_NAME = "org.onap.PM_CDS_Blueprint";
private static final String ID_VERSION = "1.0.1";
private static final UUID automationCompositionElementId = UUID.randomUUID();
- private static final ToscaConceptIdentifier automationCompositionId =
- new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
+ public static final UUID AC_ID = UUID.randomUUID();
+ private static final ToscaConceptIdentifier PARTICIPANT_ID = new ToscaConceptIdentifier(ID_NAME, ID_VERSION);
private PolicyApiHttpClient api = Mockito.mock(PolicyApiHttpClient.class);
- private PolicyPapHttpClient pap = Mockito.mock(PolicyPapHttpClient.class);
+ private PolicyPapHttpClient pap = Mockito.mock(PolicyPapHttpClient.class);
@Test
void testHandlerDoesNotThrowExceptions() {
- AutomationCompositionElementHandler handler = getTestingHandler();
-
- assertDoesNotThrow(() -> handler
- .automationCompositionElementStateChange(automationCompositionId,
- automationCompositionElementId,
- AutomationCompositionState.UNINITIALISED,
- AutomationCompositionOrderedState.PASSIVE));
-
- assertDoesNotThrow(() -> handler
- .automationCompositionElementStateChange(automationCompositionId,
- automationCompositionElementId,
- AutomationCompositionState.RUNNING,
- AutomationCompositionOrderedState.UNINITIALISED));
-
- assertDoesNotThrow(() -> handler
- .automationCompositionElementStateChange(automationCompositionId,
- automationCompositionElementId,
- AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.RUNNING));
+ var handler = getTestingHandler();
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(AC_ID, automationCompositionElementId,
+ AutomationCompositionState.UNINITIALISED, AutomationCompositionOrderedState.PASSIVE));
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(AC_ID, automationCompositionElementId,
+ AutomationCompositionState.RUNNING, AutomationCompositionOrderedState.UNINITIALISED));
+
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(AC_ID, automationCompositionElementId,
+ AutomationCompositionState.PASSIVE, AutomationCompositionOrderedState.RUNNING));
}
private AutomationCompositionElementHandler getTestingHandler() {
@@ -91,11 +80,11 @@ class AutomationCompositionElementHandlerTest {
private AutomationCompositionElement getTestingAcElement() {
var element = new AutomationCompositionElement();
- element.setDefinition(automationCompositionId);
+ element.setDefinition(PARTICIPANT_ID);
element.setDescription("Description");
element.setId(automationCompositionElementId);
element.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED);
- element.setParticipantId(automationCompositionId);
+ element.setParticipantId(PARTICIPANT_ID);
element.setState(AutomationCompositionState.UNINITIALISED);
var template = new ToscaServiceTemplate();
template.setToscaTopologyTemplate(new ToscaTopologyTemplate());
@@ -112,28 +101,20 @@ class AutomationCompositionElementHandlerTest {
doReturn(Response.ok().build()).when(api).createPolicy(any());
doReturn(Response.accepted().build()).when(pap).handlePolicyDeployOrUndeploy(any(), any(), any());
- AutomationCompositionElementHandler handler = getTestingHandler();
+ var handler = getTestingHandler();
var element = getTestingAcElement();
- var acElementDefinition = Mockito.mock(ToscaNodeTemplate.class);
-
- assertDoesNotThrow(() -> handler
- .automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition));
- assertDoesNotThrow(() -> handler
- .automationCompositionElementStateChange(automationCompositionId,
- automationCompositionElementId,
- AutomationCompositionState.PASSIVE,
- AutomationCompositionOrderedState.UNINITIALISED));
+ assertDoesNotThrow(() -> handler.automationCompositionElementUpdate(AC_ID, element, Map.of()));
+ assertDoesNotThrow(() -> handler.automationCompositionElementStateChange(AC_ID, automationCompositionElementId,
+ AutomationCompositionState.PASSIVE, AutomationCompositionOrderedState.UNINITIALISED));
- //Mock failure in policy deployment
+ // Mock failure in policy deployment
doReturn(Response.serverError().build()).when(pap).handlePolicyDeployOrUndeploy(any(), any(), any());
- assertDoesNotThrow(() -> handler
- .automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition));
+ assertDoesNotThrow(() -> handler.automationCompositionElementUpdate(AC_ID, element, Map.of()));
// Mock failure in policy type creation
doReturn(Response.serverError().build()).when(api).createPolicyType(any());
- assertDoesNotThrow(() -> handler
- .automationCompositionElementUpdate(automationCompositionId, element, acElementDefinition));
+ assertDoesNotThrow(() -> handler.automationCompositionElementUpdate(AC_ID, element, Map.of()));
}
}
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"
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java
index 79b8f90c2..4c3cc958b 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangePublisher.java
@@ -43,7 +43,7 @@ public class AutomationCompositionStateChangePublisher
description = "AUTOMATION_COMPOSITION_STATE_CHANGE messages published")
public void send(AutomationComposition automationComposition, int startPhase) {
var acsc = new AutomationCompositionStateChange();
- acsc.setAutomationCompositionId(automationComposition.getKey().asIdentifier());
+ acsc.setAutomationCompositionId(automationComposition.getInstanceId());
acsc.setMessageId(UUID.randomUUID());
acsc.setOrderedState(automationComposition.getOrderedState());
acsc.setStartPhase(startPhase);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
index 61ab78fad..c10e47bb4 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
@@ -70,7 +70,7 @@ public class AutomationCompositionUpdatePublisher extends AbstractParticipantPub
public void send(AutomationComposition automationComposition, int startPhase) {
var automationCompositionUpdateMsg = new AutomationCompositionUpdate();
automationCompositionUpdateMsg.setStartPhase(startPhase);
- automationCompositionUpdateMsg.setAutomationCompositionId(automationComposition.getKey().asIdentifier());
+ automationCompositionUpdateMsg.setAutomationCompositionId(automationComposition.getInstanceId());
automationCompositionUpdateMsg.setMessageId(UUID.randomUUID());
automationCompositionUpdateMsg.setTimestamp(Instant.now());
var toscaServiceTemplate = acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId());
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
index 3a707cd52..832d25da0 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
@@ -62,7 +62,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class SupervisionHandlerTest {
private static final String AC_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/acm/AutomationComposition.json";
- private static final ToscaConceptIdentifier identifier = new ToscaConceptIdentifier("PMSHInstance0Crud", "1.0.1");
+ private static final UUID identifier = UUID.randomUUID();
private static final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier("ParticipantId", "1.0.0");
private static final ToscaConceptIdentifier participantType =
new ToscaConceptIdentifier("ParticipantType", "1.0.0");