summaryrefslogtreecommitdiffstats
path: root/models/src/test/java/org
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-01-30 13:43:10 +0000
committerFrancescoFioraEst <francesco.fiora@est.tech>2023-01-31 10:20:02 +0000
commit7f762dfa19f673241f8ea1b2ff3d56d2d58bdcdb (patch)
tree591b04b568efed20c76f7d67973163d075d27162 /models/src/test/java/org
parent934f7bd443225a6945b0542fa5cb7c043deac426 (diff)
Refactor ACM Update message to ACM Deploy message in ACM
Refactor ACM Update message to ACM Deploy message in ACM and add AcElementDeploy in Deploy message. AutomationCompositionElement will be removed from the message after POLICY-4506 and POLICY-4507. Issue-ID: POLICY-4543 Change-Id: I8444e15b3b4cb1209ffd083fb965e0707fbd9625 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'models/src/test/java/org')
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java)20
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java (renamed from models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java)22
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java13
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java4
4 files changed, 28 insertions, 31 deletions
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java
index 8c5528cc6..038c140ed 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,39 +28,39 @@ import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.Partic
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
-class AutomationCompositionAckTest {
+class AutomationCompositionDeployAckTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new AutomationCompositionAck((AutomationCompositionAck) null))
+ assertThatThrownBy(() -> new AutomationCompositionDeployAck((AutomationCompositionDeployAck) null))
.isInstanceOf(NullPointerException.class);
- final var orig = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
+ final var orig = new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY);
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new AutomationCompositionAck(orig).toString()));
+ removeVariableFields(new AutomationCompositionDeployAck(orig).toString()));
// verify with all values
orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(CommonTestData.getParticipantId());
- var acElementResult = new AutomationCompositionElementAck(AutomationCompositionState.UNINITIALISED,
+ var acElementResult = new AcElementDeployAck(AutomationCompositionState.UNINITIALISED, null,
true, "AutomationCompositionElement result");
final var automationCompositionResultMap = Map.of(UUID.randomUUID(), acElementResult);
orig.setAutomationCompositionResultMap(automationCompositionResultMap);
orig.setResponseTo(UUID.randomUUID());
orig.setResult(true);
- orig.setMessage("Successfully processed AutomationCompositionUpdate message");
+ orig.setMessage("Successfully processed AutomationCompositionDeploy message");
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new AutomationCompositionAck(orig).toString()));
+ removeVariableFields(new AutomationCompositionDeployAck(orig).toString()));
- assertSerializable(orig, AutomationCompositionAck.class);
+ assertSerializable(orig, AutomationCompositionDeployAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java
index c1be28958..2912dee9b 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -43,12 +43,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
/**
* Test the copy constructor.
*/
-class AutomationCompositionUpdateTest {
+class AutomationCompositionDeployTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new AutomationCompositionUpdate(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new AutomationCompositionDeploy(null)).isInstanceOf(NullPointerException.class);
- var orig = new AutomationCompositionUpdate();
+ var orig = new AutomationCompositionDeploy();
// verify with all values
orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(null);
@@ -74,14 +74,14 @@ class AutomationCompositionUpdateTest {
var propertiesMap = Map.of("Prop1", (Object) json);
acElement.setProperties(propertiesMap);
- var participantUpdates = new ParticipantUpdates();
- participantUpdates.setParticipantId(participantId);
- participantUpdates.setAutomationCompositionElementList(List.of(acElement));
- orig.setParticipantUpdatesList(List.of(participantUpdates));
+ var participantDeploy = new ParticipantDeploy();
+ participantDeploy.setParticipantId(participantId);
+ participantDeploy.setAutomationCompositionElementList(List.of(acElement));
+ orig.setParticipantUpdatesList(List.of(participantDeploy));
- var other = new AutomationCompositionUpdate(orig);
+ var other = new AutomationCompositionDeploy(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
- assertSerializable(orig, AutomationCompositionUpdate.class);
+ assertSerializable(orig, AutomationCompositionDeploy.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
index ce23a821f..4a1a2d9de 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +20,12 @@
package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
-import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
-import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.rule.impl.GetterMustExistRule;
import com.openpojo.validation.rule.impl.SetterMustExistRule;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.test.ToStringTester;
@@ -39,18 +36,18 @@ class ParticipantPojosTest {
@Test
void testPojos() {
- List<PojoClass> pojoClasses =
+ var pojoClasses =
PojoClassFactory.getPojoClasses(ParticipantPojosTest.class.getPackageName());
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantMessage.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantMessageTest.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantAckMessage.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantAckMessageTest.class));
- pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionAck.class));
- pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionAckTest.class));
+ pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionDeployAck.class));
+ pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionDeployAckTest.class));
// @formatter:off
- final Validator validator = ValidatorBuilder
+ final var validator = ValidatorBuilder
.create()
.with(new ToStringTester())
.with(new SetterMustExistRule())
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 c23c38c5b..413139999 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,7 +39,7 @@ 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.ParticipantUpdates;
+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;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -60,7 +60,7 @@ class AcmUtilsTest {
@Test
void testCommonUtilsParticipantUpdate() {
var acElement = new AutomationCompositionElement();
- List<ParticipantUpdates> participantUpdates = new ArrayList<>();
+ List<ParticipantDeploy> participantUpdates = new ArrayList<>();
assertThat(participantUpdates).isEmpty();
AcmUtils.prepareParticipantUpdate(acElement, participantUpdates);