summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x[-rw-r--r--]participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java6
-rwxr-xr-xparticipant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java21
-rwxr-xr-x[-rw-r--r--]participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java15
3 files changed, 21 insertions, 21 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 b4735f1c0..c7cb54893 100644..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
@@ -29,6 +29,8 @@ import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
@@ -264,6 +266,7 @@ public class AutomationCompositionHandler {
int startPhase = ParticipantUtils.findStartPhase(
cacheProvider.getCommonProperties(automationComposition.getInstanceId(), acElement.getId()));
if (startPhaseMsg.equals(startPhase)) {
+ acElement.setDeployState(DeployState.UNDEPLOYING);
listener.undeploy(messageId, automationComposition.getInstanceId(), acElement.getId());
}
}
@@ -275,6 +278,7 @@ public class AutomationCompositionHandler {
int startPhase = ParticipantUtils.findStartPhase(
cacheProvider.getCommonProperties(automationComposition.getInstanceId(), acElement.getId()));
if (startPhaseMsg.equals(startPhase)) {
+ acElement.setDeployState(DeployState.DELETING);
listener.delete(messageId, automationComposition.getInstanceId(), acElement.getId());
}
}
@@ -293,6 +297,7 @@ public class AutomationCompositionHandler {
int startPhase = ParticipantUtils.findStartPhase(
cacheProvider.getCommonProperties(automationComposition.getInstanceId(), acElement.getId()));
if (startPhaseMsg.equals(startPhase)) {
+ acElement.setLockState(LockState.LOCKING);
listener.lock(messageId, automationComposition.getInstanceId(), acElement.getId());
}
}
@@ -311,6 +316,7 @@ public class AutomationCompositionHandler {
int startPhase = ParticipantUtils.findStartPhase(
cacheProvider.getCommonProperties(automationComposition.getInstanceId(), acElement.getId()));
if (startPhaseMsg.equals(startPhase)) {
+ acElement.setLockState(LockState.UNLOCKING);
listener.unlock(messageId, automationComposition.getInstanceId(), acElement.getId());
}
}
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index 8d906c07b..6b025c78c 100755
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -29,7 +29,6 @@ import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
@@ -236,24 +235,4 @@ public class ParticipantHandler {
return heartbeat;
}
-
- /**
- * get AutomationComposition Info List.
- *
- * @return list of AutomationCompositionInfo
- */
- private List<AutomationCompositionInfo> getAutomationCompositionInfoList() {
- List<AutomationCompositionInfo> automationCompositionInfoList = new ArrayList<>();
- for (var entry : cacheProvider.getAutomationCompositions().entrySet()) {
- var acInfo = new AutomationCompositionInfo();
- acInfo.setAutomationCompositionId(entry.getKey());
- acInfo.setDeployState(entry.getValue().getDeployState());
- acInfo.setLockState(entry.getValue().getLockState());
- for (var element : entry.getValue().getElements().values()) {
- acInfo.getElements().add(automationCompositionOutHandler.getAutomationCompositionElementInfo(element));
- }
- automationCompositionInfoList.add(acInfo);
- }
- return automationCompositionInfoList;
- }
}
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 6509491ce..cb7e560ba 100644..100755
--- 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
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.acm.participant.intermediary.handler;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
+import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
@@ -37,6 +38,8 @@ import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.Common
import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
@@ -87,6 +90,9 @@ class AutomationCompositionHandlerTest {
var ach = new AutomationCompositionHandler(cacheProvider, participantMessagePublisher, listener);
ach.handleAutomationCompositionStateChange(automationCompositionStateChange);
verify(listener, times(automationComposition.getElements().size())).undeploy(any(), any(), any());
+ for (var element: automationComposition.getElements().values()) {
+ assertEquals(DeployState.UNDEPLOYING, element.getDeployState());
+ }
}
@Test
@@ -104,6 +110,9 @@ class AutomationCompositionHandlerTest {
var ach = new AutomationCompositionHandler(cacheProvider, participantMessagePublisher, listener);
ach.handleAutomationCompositionStateChange(automationCompositionStateChange);
verify(listener, times(automationComposition.getElements().size())).lock(any(), any(), any());
+ for (var element: automationComposition.getElements().values()) {
+ assertEquals(LockState.LOCKING, element.getLockState());
+ }
}
@Test
@@ -121,6 +130,9 @@ class AutomationCompositionHandlerTest {
var ach = new AutomationCompositionHandler(cacheProvider, participantMessagePublisher, listener);
ach.handleAutomationCompositionStateChange(automationCompositionStateChange);
verify(listener, times(automationComposition.getElements().size())).unlock(any(), any(), any());
+ for (var element: automationComposition.getElements().values()) {
+ assertEquals(LockState.UNLOCKING, element.getLockState());
+ }
}
@Test
@@ -138,6 +150,9 @@ class AutomationCompositionHandlerTest {
var ach = new AutomationCompositionHandler(cacheProvider, participantMessagePublisher, listener);
ach.handleAutomationCompositionStateChange(automationCompositionStateChange);
verify(listener, times(automationComposition.getElements().size())).delete(any(), any(), any());
+ for (var element: automationComposition.getElements().values()) {
+ assertEquals(DeployState.DELETING, element.getDeployState());
+ }
}
@Test