aboutsummaryrefslogtreecommitdiffstats
path: root/runtime-acm/src
diff options
context:
space:
mode:
Diffstat (limited to 'runtime-acm/src')
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandler.java8
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java5
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AcElementPropertiesPublisher.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimePublisher.java4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantSyncPublisher.java2
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java12
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java10
10 files changed, 27 insertions, 22 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandler.java
index 3e2057ed5..75477866a 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandler.java
@@ -247,8 +247,7 @@ public class SupervisionAcHandler {
for (var element : automationComposition.getElements().values()) {
if (element.getParticipantId().equals(automationCompositionAckMessage.getParticipantId())) {
element.setDeployState(DeployState.DELETED);
- automationCompositionProvider.updateAutomationCompositionElement(element,
- automationComposition.getInstanceId());
+ automationCompositionProvider.updateAutomationCompositionElement(element);
}
}
} else {
@@ -263,7 +262,7 @@ public class SupervisionAcHandler {
automationCompositionAckMessage.getAutomationCompositionResultMap().entrySet(),
automationCompositionAckMessage.getStateChangeResult());
if (updated) {
- automationCompositionProvider.updateAutomationComposition(automationComposition);
+ automationComposition = automationCompositionProvider.updateAcState(automationComposition);
var acDefinition = acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId());
participantSyncPublisher.sendSync(acDefinition.getServiceTemplate(), automationComposition);
}
@@ -289,8 +288,7 @@ public class SupervisionAcHandler {
element.setDeployState(acElementAck.getValue().getDeployState());
element.setLockState(acElementAck.getValue().getLockState());
element.setRestarting(null);
- automationCompositionProvider.updateAutomationCompositionElement(element,
- automationComposition.getInstanceId());
+ automationCompositionProvider.updateAutomationCompositionElement(element);
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
index 75a2f0540..d1aa6c239 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
@@ -201,12 +201,13 @@ public class SupervisionScanner {
if (StateChangeResult.TIMEOUT.equals(automationComposition.getStateChangeResult())) {
automationComposition.setStateChangeResult(StateChangeResult.NO_ERROR);
}
+ var acToUpdate = automationComposition;
if (DeployState.DELETED.equals(automationComposition.getDeployState())) {
automationCompositionProvider.deleteAutomationComposition(automationComposition.getInstanceId());
} else {
- automationCompositionProvider.updateAutomationComposition(automationComposition);
+ acToUpdate = automationCompositionProvider.updateAcState(acToUpdate);
}
- participantSyncPublisher.sendSync(serviceTemplate, automationComposition);
+ participantSyncPublisher.sendSync(serviceTemplate, acToUpdate);
}
private void handleTimeout(AutomationCompositionDefinition acDefinition) {
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AcElementPropertiesPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AcElementPropertiesPublisher.java
index 338f2960d..cc5d1461f 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AcElementPropertiesPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AcElementPropertiesPublisher.java
@@ -56,7 +56,7 @@ public class AcElementPropertiesPublisher extends AbstractParticipantPublisher<P
propertiesUpdate.setParticipantUpdatesList(
AcmUtils.createParticipantDeployList(automationComposition, DeployOrder.UPDATE));
- LOGGER.debug("AC Element properties update sent {}", propertiesUpdate);
+ LOGGER.debug("AC Element properties update sent {}", propertiesUpdate.getMessageId());
super.send(propertiesUpdate);
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
index 2b6435e67..7fe63a7c5 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
@@ -87,7 +87,7 @@ public class AutomationCompositionDeployPublisher extends AbstractParticipantPub
acDeployMsg.setTimestamp(Instant.now());
acDeployMsg.setParticipantUpdatesList(participantDeploys);
- LOGGER.debug("AutomationCompositionDeploy message sent {}", acDeployMsg);
+ LOGGER.debug("AutomationCompositionDeploy message sent {}", acDeployMsg.getMessageId());
super.send(acDeployMsg);
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimePublisher.java
index b0848bd51..360e526cc 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimePublisher.java
@@ -72,7 +72,7 @@ public class ParticipantPrimePublisher extends AbstractParticipantPublisher<Part
message.setParticipantId(participantId);
message.setTimestamp(Instant.now());
message.setParticipantDefinitionUpdates(participantDefinitions);
- LOGGER.debug("Participant Update sent {}", message);
+ LOGGER.debug("Participant Update sent {}", message.getMessageId());
super.send(message);
}
@@ -127,7 +127,7 @@ public class ParticipantPrimePublisher extends AbstractParticipantPublisher<Part
// DeCommission the automation composition but deleting participantdefinitions on participants
message.setParticipantDefinitionUpdates(null);
- LOGGER.debug("Participant Update sent {}", message);
+ LOGGER.debug("Participant Update sent {}", message.getMessageId());
super.send(message);
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java
index 96d6338f1..540cf62be 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRestartPublisher.java
@@ -69,7 +69,7 @@ public class ParticipantRestartPublisher extends AbstractParticipantPublisher<Pa
message.getAutomationcompositionList().add(restartAc);
}
- LOGGER.debug("Participant Restart sent {}", message);
+ LOGGER.debug("Participant Restart sent {}", message.getMessageId());
super.send(message);
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
index 1f6b7c8a5..96abac494 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
@@ -44,7 +44,7 @@ public class ParticipantStatusReqPublisher extends AbstractParticipantPublisher<
message.setParticipantId(participantId);
message.setTimestamp(Instant.now());
- LOGGER.debug("Participant StatusReq sent {}", message);
+ LOGGER.debug("Participant StatusReq sent {}", message.getMessageId());
super.send(message);
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantSyncPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantSyncPublisher.java
index b63bc0a6b..eb1db6f0e 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantSyncPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantSyncPublisher.java
@@ -144,7 +144,7 @@ public class ParticipantSyncPublisher extends AbstractParticipantPublisher<Parti
}
message.getAutomationcompositionList().add(syncAc);
- LOGGER.debug("Participant AutomationComposition Sync sent {}", message);
+ LOGGER.debug("Participant AutomationComposition Sync sent {}", message.getMessageId());
super.send(message);
}
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
index 0bec9d0ce..e895401a4 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionAcHandlerTest.java
@@ -66,6 +66,8 @@ class SupervisionAcHandlerTest {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
when(automationCompositionProvider.findAutomationComposition(IDENTIFIER))
.thenReturn(Optional.of(automationComposition));
+ when(automationCompositionProvider.updateAcState(any(AutomationComposition.class)))
+ .thenReturn(automationComposition);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
when(acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId()))
@@ -82,7 +84,7 @@ class SupervisionAcHandlerTest {
handler.handleAutomationCompositionStateChangeAckMessage(automationCompositionAckMessage);
verify(automationCompositionProvider, times(3))
- .updateAutomationCompositionElement(any(AutomationCompositionElement.class), any());
+ .updateAutomationCompositionElement(any(AutomationCompositionElement.class));
}
private AutomationCompositionDeployAck getAutomationCompositionDeployAck(ParticipantMessageType messageType,
@@ -107,6 +109,8 @@ class SupervisionAcHandlerTest {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
when(automationCompositionProvider.findAutomationComposition(IDENTIFIER))
.thenReturn(Optional.of(automationComposition));
+ when(automationCompositionProvider.updateAcState(any(AutomationComposition.class)))
+ .thenReturn(automationComposition);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
when(acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId()))
@@ -124,7 +128,7 @@ class SupervisionAcHandlerTest {
handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage);
- verify(automationCompositionProvider).updateAutomationComposition(any(AutomationComposition.class));
+ verify(automationCompositionProvider).updateAcState(any(AutomationComposition.class));
}
@Test
@@ -162,7 +166,7 @@ class SupervisionAcHandlerTest {
handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage);
verify(automationCompositionProvider)
- .updateAutomationCompositionElement(any(AutomationCompositionElement.class), any());
+ .updateAutomationCompositionElement(any(AutomationCompositionElement.class));
}
@Test
@@ -322,7 +326,7 @@ class SupervisionAcHandlerTest {
handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage);
verify(automationCompositionProvider)
- .updateAutomationCompositionElement(any(AutomationCompositionElement.class), any());
+ .updateAutomationCompositionElement(any(AutomationCompositionElement.class));
}
@Test
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
index fa5929f0b..6bdab706c 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
@@ -186,6 +186,7 @@ class SupervisionScannerTest {
automationComposition.setCompositionId(compositionId);
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
when(automationCompositionProvider.getAcInstancesInTransition()).thenReturn(List.of(automationComposition));
+ when(automationCompositionProvider.updateAcState(any())).thenReturn(automationComposition);
var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
@@ -196,7 +197,7 @@ class SupervisionScannerTest {
mock(ParticipantSyncPublisher.class), acRuntimeParameterGroup);
supervisionScanner.run();
- verify(automationCompositionProvider).updateAutomationComposition(any(AutomationComposition.class));
+ verify(automationCompositionProvider).updateAcState(any(AutomationComposition.class));
}
@Test
@@ -255,7 +256,7 @@ class SupervisionScannerTest {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
when(automationCompositionProvider.getAcInstancesInTransition()).thenReturn(List.of(automationComposition));
-
+ when(automationCompositionProvider.updateAcState(any())).thenReturn(automationComposition);
var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
@@ -282,7 +283,7 @@ class SupervisionScannerTest {
entry.getValue().setDeployState(DeployState.DEPLOYED);
}
scannerObj2.run();
- verify(automationCompositionProvider, times(1)).updateAutomationComposition(any(AutomationComposition.class));
+ verify(automationCompositionProvider, times(1)).updateAcState(any(AutomationComposition.class));
assertEquals(StateChangeResult.NO_ERROR, automationComposition.getStateChangeResult());
}
@@ -341,6 +342,7 @@ class SupervisionScannerTest {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
when(automationCompositionProvider.getAcInstancesInTransition()).thenReturn(List.of(automationComposition));
+ when(automationCompositionProvider.updateAcState(any())).thenReturn(automationComposition);
var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
@@ -358,7 +360,7 @@ class SupervisionScannerTest {
automationComposition.getElements().entrySet().iterator().next().getValue()
.setDeployState(DeployState.DEPLOYED);
supervisionScanner.run();
- verify(automationCompositionProvider, times(1)).updateAutomationComposition(any(AutomationComposition.class));
+ verify(automationCompositionProvider, times(1)).updateAcState(any(AutomationComposition.class));
assertEquals(DeployState.DEPLOYED, automationComposition.getDeployState());
assertEquals(compositionTargetId, automationComposition.getCompositionId());