summaryrefslogtreecommitdiffstats
path: root/models/src/test/java
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-02-02 15:42:56 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-02-03 09:25:32 +0000
commit4ad78088b7d1098f5529611eff15b1d61fc66a04 (patch)
tree7babd109983b2ac320eb5890342905b6397d7766 /models/src/test/java
parent26814a2d839be880fa56c658f0d88940d957e872 (diff)
Handle AC Element Instance Deployment and undeployment on ACM-R
Part of the implementation related to Deployment and undeployment, missing part will be implemented in POLICY-4509. push-upstream: POLICY-4506 Change-Id: Ie7ad2da6c0a3286938fc4993d70ee71caee833ba Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src/test/java')
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java9
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java23
2 files changed, 21 insertions, 11 deletions
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
index 30e225995..0f10c8c03 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
@@ -60,6 +60,10 @@ class JpaAutomationCompositionTest {
}).hasMessageMatching("copyConcept is marked .*ull but is null");
assertThatThrownBy(() -> {
+ new JpaAutomationComposition((AutomationComposition) null);
+ }).hasMessageMatching("authorativeConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
new JpaAutomationComposition(null, null, null, null, null, null, null);
}).hasMessageMatching(NULL_INSTANCE_ID_ERROR);
@@ -211,11 +215,6 @@ class JpaAutomationCompositionTest {
testJpaAutomationComposition.setDescription(null);
assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
- testJpaAutomationComposition.setPrimed(true);
- assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
- testJpaAutomationComposition.setPrimed(false);
- assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
-
assertEquals(testJpaAutomationComposition, new JpaAutomationComposition(testJpaAutomationComposition));
}
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 413139999..c16beaf87 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
@@ -39,6 +39,8 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+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.document.concepts.DocToscaServiceTemplate;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -58,6 +60,15 @@ class AcmUtilsTest {
private static final String TOSCA_TEMPLATE_YAML = "clamp/acm/pmsh/funtional-pmsh-usecase.yaml";
@Test
+ void testIsInTransitionalState() {
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKED)).isFalse();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYING, LockState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.UNDEPLOYING, LockState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKING)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.UNLOCKING)).isTrue();
+ }
+
+ @Test
void testCommonUtilsParticipantUpdate() {
var acElement = new AutomationCompositionElement();
List<ParticipantDeploy> participantUpdates = new ArrayList<>();
@@ -111,10 +122,9 @@ class AcmUtilsTest {
@Test
void testCommonUtilsServiceTemplate() {
- var acElement = new AutomationCompositionElement();
var toscaServiceTemplate = getDummyToscaServiceTemplate();
- AcmUtils.setAcPolicyInfo(acElement, toscaServiceTemplate);
- assertEquals(getDummyToscaDataTypeMap(), acElement.getToscaServiceTemplateFragment().getDataTypes());
+ var toscaServiceTemplateFragment = AcmUtils.getToscaServiceTemplateFragment(toscaServiceTemplate);
+ assertEquals(getDummyToscaDataTypeMap(), toscaServiceTemplateFragment.getDataTypes());
}
@Test
@@ -122,9 +132,10 @@ class AcmUtilsTest {
var toscaServiceTemplate = getDummyToscaServiceTemplate();
toscaServiceTemplate.setPolicyTypes(null);
toscaServiceTemplate.getToscaTopologyTemplate().setPolicies(null);
- AutomationCompositionElement acElement = new AutomationCompositionElement();
- AcmUtils.setAcPolicyInfo(new AutomationCompositionElement(), toscaServiceTemplate);
- assertNull(acElement.getToscaServiceTemplateFragment());
+ var toscaServiceTemplateFragment = AcmUtils.getToscaServiceTemplateFragment(toscaServiceTemplate);
+ assertNull(toscaServiceTemplateFragment.getPolicyTypes());
+ assertNull(toscaServiceTemplateFragment.getToscaTopologyTemplate());
+ assertNull(toscaServiceTemplateFragment.getDataTypes());
}
@Test