diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2023-07-11 11:19:34 +0100 |
---|---|---|
committer | Francesco Fiora <francesco.fiora@est.tech> | 2023-07-12 07:55:23 +0000 |
commit | b13d8dc3a73bc372dabe47ebd88ed1892ee688ea (patch) | |
tree | 50b943e34be0f2e7e6792f17154071957e85f852 /models/src/test/java | |
parent | b28ae291bc1b4a7426d4c6e5098c0a20f3948796 (diff) |
Add support participant restart in ACM runtime
Issue-ID: POLICY-4744
Change-Id: I33d31751be7ca5d7c215a2b465564d3ab0c7bee6
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src/test/java')
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()); |