diff options
Diffstat (limited to 'models/src/test')
3 files changed, 42 insertions, 1 deletions
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java index 6bb7f1eb7..bac0842f1 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java @@ -47,9 +47,31 @@ class ParticipantUtilsTest { @Test void testGetFirstStartPhase() throws CoderException { var serviceTemplate = CommonTestData.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML); + var automationComposition = + CODER.decode(ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON), AutomationCompositions.class) + .getAutomationCompositionList().get(0); + automationComposition.setDeployState(DeployState.DEPLOYING); + automationComposition.setLockState(LockState.NONE); + var result = ParticipantUtils.getFirstStartPhase(automationComposition, serviceTemplate); + assertThat(result).isZero(); + + automationComposition.setDeployState(DeployState.DEPLOYED); + automationComposition.setLockState(LockState.UNLOCKING); + result = ParticipantUtils.getFirstStartPhase(automationComposition, serviceTemplate); + assertThat(result).isZero(); + + automationComposition.setDeployState(DeployState.UNDEPLOYING); + automationComposition.setLockState(LockState.NONE); + result = ParticipantUtils.getFirstStartPhase(automationComposition, serviceTemplate); + assertThat(result).isEqualTo(1); + } + + @Test + void testGetFirstStage() throws CoderException { + var serviceTemplate = CommonTestData.getToscaServiceTemplate(TOSCA_TEMPLATE_YAML); var automationCompositions = CODER.decode(ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON), AutomationCompositions.class); - var result = ParticipantUtils.getFirstStartPhase(automationCompositions.getAutomationCompositionList().get(0), + var result = ParticipantUtils.getFirstStage(automationCompositions.getAutomationCompositionList().get(0), serviceTemplate); assertThat(result).isZero(); } diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java index 609d4c1c0..fab3dac9b 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java @@ -217,6 +217,11 @@ class JpaAutomationCompositionElementTest { testJpaAcElement.setOperationalState("DEFAULT"); assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement)); + testJpaAcElement.setStage(1); + assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement)); + testJpaAcElement.setStage(null); + assertEquals(0, testJpaAcElement.compareTo(otherJpaAcElement)); + testJpaAcElement.setMessage("Message"); assertNotEquals(0, testJpaAcElement.compareTo(otherJpaAcElement)); testJpaAcElement.setMessage(null); diff --git a/models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml b/models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml index 2b0b4feff..6539a9c75 100644 --- a/models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml +++ b/models/src/test/resources/examples/acm/test-pm-subscription-handling.yaml @@ -317,6 +317,15 @@ node_types: provider: type: string required: false + stage: + type: array + required: false + items: + type: integer + constraints: + - greater-or-equal: 0 + metadata: + common: true startPhase: type: integer required: false @@ -394,6 +403,7 @@ topology_template: description: Participant for DCAE microservices properties: provider: ONAP + startPhase: 0 org.onap.policy.acm.PolicyAutomationCompositionParticipant: version: 2.3.1 type: org.onap.policy.clamp.acm.Participant @@ -401,6 +411,7 @@ topology_template: description: Participant for DCAE microservices properties: provider: ONAP + startPhase: 0 org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant: version: 2.2.1 type: org.onap.policy.clamp.acm.Participant @@ -408,6 +419,7 @@ topology_template: description: Participant for DCAE microservices properties: provider: ONAP + startPhase: 1 org.onap.domain.pmsh.PMSH_DCAEMicroservice: version: 1.2.3 type: org.onap.policy.clamp.acm.DCAEMicroserviceAutomationCompositionElement @@ -415,6 +427,7 @@ topology_template: description: Automation composition element for the DCAE microservice for Performance Management Subscription Handling properties: provider: Ericsson + startPhase: 1 dcae_blueprint: tosca_definitions_version: cloudify_dsl_1_3 imports: @@ -641,6 +654,7 @@ topology_template: version: 1.0.0 policy_id: get_input: pmsh_monitoring_policy + stage: [0,1,2] org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement: version: 1.2.3 type: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement |