summaryrefslogtreecommitdiffstats
path: root/models/src/test/java
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2022-12-08 12:41:49 +0000
committerFrancesco Fiora <francesco.fiora@est.tech>2022-12-08 13:53:38 +0000
commit73088c5cd088a764b5d517de481392d91d9e8043 (patch)
tree13ccb070e8bdd13b3f0415c11e449c7a743524bc /models/src/test/java
parent2d3c8c987001ac176acb2feaadd885ceb1f7d234 (diff)
Add support for instance properties
Issue-ID: POLICY-4483 Change-Id: I6ca953e05e74d68262507b393fb6415573fa3eab 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/messages/dmaap/participant/AutomationCompositionUpdateTest.java19
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java3
2 files changed, 14 insertions, 8 deletions
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/AutomationCompositionUpdateTest.java
index 1d56bc9ee..a2417df6b 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/AutomationCompositionUpdateTest.java
@@ -35,6 +35,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedSta
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
@@ -46,15 +47,15 @@ class AutomationCompositionUpdateTest {
void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new AutomationCompositionUpdate(null)).isInstanceOf(NullPointerException.class);
- AutomationCompositionUpdate orig = new AutomationCompositionUpdate();
+ var orig = new AutomationCompositionUpdate();
// verify with all values
- ToscaConceptIdentifier id = new ToscaConceptIdentifier("id", "1.2.3");
+ var id = new ToscaConceptIdentifier("id", "1.2.3");
orig.setAutomationCompositionId(id);
orig.setParticipantId(null);
orig.setMessageId(UUID.randomUUID());
orig.setTimestamp(Instant.ofEpochMilli(3000));
- AutomationCompositionElement acElement = new AutomationCompositionElement();
+ var acElement = new AutomationCompositionElement();
acElement.setId(UUID.randomUUID());
acElement.setDefinition(id);
acElement.setDescription("Description");
@@ -63,18 +64,20 @@ class AutomationCompositionUpdateTest {
acElement.setParticipantId(id);
acElement.setParticipantType(id);
- ToscaProperty property = new ToscaProperty();
+ var property = new ToscaProperty();
property.setName("test");
property.setType("testType");
- Map<String, ToscaProperty> propertiesMap = Map.of("Prop1", property);
- acElement.setPropertiesMap(propertiesMap);
+ var standardCoder = new StandardCoder();
+ var json = standardCoder.encode(property);
+ var propertiesMap = Map.of("Prop1", (Object) json);
+ acElement.setProperties(propertiesMap);
- ParticipantUpdates participantUpdates = new ParticipantUpdates();
+ var participantUpdates = new ParticipantUpdates();
participantUpdates.setParticipantId(id);
participantUpdates.setAutomationCompositionElementList(List.of(acElement));
orig.setParticipantUpdatesList(List.of(participantUpdates));
- AutomationCompositionUpdate other = new AutomationCompositionUpdate(orig);
+ var other = new AutomationCompositionUpdate(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
assertSerializable(orig, AutomationCompositionUpdate.class);
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 7103f7f7a..d38aaf735 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
@@ -29,6 +29,7 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.File;
+import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
@@ -299,6 +300,7 @@ class JpaAutomationCompositionElementTest {
testJpaAutomationCompositionElement.fromAuthorative(testAce);
testJpaAutomationCompositionElement.setKey(PfReferenceKey.getNullKey());
testJpaAutomationCompositionElement.fromAuthorative(testAce);
+ testJpaAutomationCompositionElement.setProperties(Map.of("key", "{}"));
return testJpaAutomationCompositionElement;
}
@@ -308,6 +310,7 @@ class JpaAutomationCompositionElementTest {
automationCompositionElement.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e"));
automationCompositionElement.setDefinition(new ToscaConceptIdentifier("aceDef", "0.0.1"));
automationCompositionElement.setParticipantType(new ToscaConceptIdentifier("participantType", "0.0.1"));
+ automationCompositionElement.setProperties(Map.of("key", "{}"));
return automationCompositionElement;
}