summaryrefslogtreecommitdiffstats
path: root/participant/participant-intermediary/src
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-10-16 12:57:37 +0100
committerFrancesco Fiora <francesco.fiora@est.tech>2023-10-16 15:08:36 +0000
commit7f7d2bfe1673f3334e43029bb81408d3305fa2e2 (patch)
tree70aa8b88ac15517ff34a481dca04a7dacbafd123 /participant/participant-intermediary/src
parent9bd7cd21ab1b8afa935f0c1d7f8ef422bf86b19f (diff)
Fix messages in ACM
Fix TIMEOUT support in MIGRATING. Avoid conflicts updating AC instance Element instead of a full AC instance. Using ExecutorService to send messages to the participant, the transaction will completed before the message is sent. Issue-ID: POLICY-4811 Change-Id: I2730ae694c8a5c9edfe500b1fa93cfb3787f32c5 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'participant/participant-intermediary/src')
-rwxr-xr-xparticipant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java1
-rwxr-xr-xparticipant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandler.java3
-rwxr-xr-xparticipant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java2
3 files changed, 4 insertions, 2 deletions
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 02fce5548..79fef3def 100755
--- 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
@@ -267,6 +267,7 @@ public class AutomationCompositionHandler {
*/
private void handleUndeployState(UUID messageId, final AutomationComposition automationComposition,
Integer startPhaseMsg) {
+ automationComposition.setCompositionTargetId(null);
for (var acElement : automationComposition.getElements().values()) {
int startPhase = ParticipantUtils.findStartPhase(
cacheProvider.getCommonProperties(automationComposition.getInstanceId(), acElement.getId()));
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandler.java
index e2e93dabb..927eaa61d 100755
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandler.java
@@ -123,7 +123,8 @@ public class AutomationCompositionOutHandler {
var checkOpt = automationComposition.getElements().values().stream()
.filter(acElement -> !deployState.equals(acElement.getDeployState())).findAny();
if (checkOpt.isEmpty()) {
- if (DeployState.MIGRATING.equals(automationComposition.getDeployState())) {
+ if (DeployState.DEPLOYED.equals(automationComposition.getDeployState())
+ && automationComposition.getCompositionTargetId() != null) {
// migration scenario
automationComposition.setCompositionId(automationComposition.getCompositionTargetId());
automationComposition.setCompositionTargetId(null);
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java
index cbd236efe..a04f9079c 100755
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java
@@ -231,7 +231,7 @@ class AutomationCompositionOutHandlerTest {
var compositionTarget = UUID.randomUUID();
automationComposition.setCompositionTargetId(compositionTarget);
- automationComposition.setDeployState(DeployState.MIGRATING);
+ automationComposition.setDeployState(DeployState.DEPLOYED);
when(cacheProvider.getAcElementsDefinitions()).thenReturn(Map.of(compositionTarget, Map.of()));
for (var element : automationComposition.getElements().values()) {