aboutsummaryrefslogtreecommitdiffstats
path: root/models/src/test
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-07-11 11:19:34 +0100
committerLiam Fallon <liam.fallon@est.tech>2023-07-12 12:28:09 +0000
commit97b1f9e67cf2d13099e1bcf4d2ec670f9c2bfcd9 (patch)
tree50b943e34be0f2e7e6792f17154071957e85f852 /models/src/test
parentb28ae291bc1b4a7426d4c6e5098c0a20f3948796 (diff)
Add support participant restart in ACM runtime
Issue-ID: POLICY-4744 Change-Id: I33d31751be7ca5d7c215a2b465564d3ab0c7bee6 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech> (cherry picked from commit b13d8dc3a73bc372dabe47ebd88ed1892ee688ea)
Diffstat (limited to 'models/src/test')
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java10
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java12
2 files changed, 15 insertions, 7 deletions
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java
index 1ae607ebe..ba84ac76f 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java
@@ -29,9 +29,7 @@ import java.time.Instant;
import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy;
-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.AcElementRestart;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc;
import org.onap.policy.clamp.models.acm.utils.CommonTestData;
@@ -60,7 +58,7 @@ class ParticipantRestartTest {
participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition));
orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate));
- var acElement = new AcElementDeploy();
+ var acElement = new AcElementRestart();
acElement.setId(UUID.randomUUID());
var id = new ToscaConceptIdentifier("id", "1.2.3");
acElement.setDefinition(id);
@@ -68,10 +66,8 @@ class ParticipantRestartTest {
var acRestart = new ParticipantRestartAc();
acRestart.setAcElementList(List.of(acElement));
acRestart.setAutomationCompositionId(UUID.randomUUID());
- acRestart.setDeployState(DeployState.DEPLOYED);
- acRestart.setLockState(LockState.LOCKED);
- orig.setAutocompositionList(List.of(acRestart));
+ orig.setAutomationcompositionList(List.of(acRestart));
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantRestart(orig).toString()));
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
index 7e8f60525..a9bd25f81 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
@@ -66,6 +66,8 @@ class AcmUtilsTest {
assertThat(AcmUtils.isInTransitionalState(DeployState.UNDEPLOYING, LockState.NONE)).isTrue();
assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKING)).isTrue();
assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.UNLOCKING)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DELETING, LockState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.UPDATING, LockState.LOCKED)).isTrue();
}
@Test
@@ -192,6 +194,16 @@ class AcmUtilsTest {
assertEquals(element.getDefinition(), result.getDefinition());
}
+ @Test
+ void testCreateAcElementRestart() {
+ var element = getDummyAutomationComposition().getElements().values().iterator().next();
+ var result = AcmUtils.createAcElementRestart(element);
+ assertEquals(element.getId(), result.getId());
+ assertEquals(element.getDefinition(), result.getDefinition());
+ assertEquals(element.getDeployState(), result.getDeployState());
+ assertEquals(element.getLockState(), result.getLockState());
+ }
+
private AutomationComposition getDummyAutomationComposition() {
var automationComposition = new AutomationComposition();
automationComposition.setCompositionId(UUID.randomUUID());