diff options
author | Pamela Dragosh <pd1248@att.com> | 2022-12-12 15:19:14 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-12-12 15:19:14 +0000 |
commit | ea4473217760d9ba62a6b9a05c81f0694590a03e (patch) | |
tree | 2d08ea1dee0a98c1ded0925c76ed4c07ab9ed58a /models/src/test | |
parent | 4929903fa30d8192529a80242a4e3803941df2b3 (diff) | |
parent | 73088c5cd088a764b5d517de481392d91d9e8043 (diff) |
Merge "Add support for instance properties"
Diffstat (limited to 'models/src/test')
4 files changed, 17 insertions, 9 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; } diff --git a/models/src/test/resources/META-INF/persistence.xml b/models/src/test/resources/META-INF/persistence.xml index 1e1d89309..6f9cb61eb 100644 --- a/models/src/test/resources/META-INF/persistence.xml +++ b/models/src/test/resources/META-INF/persistence.xml @@ -29,6 +29,7 @@ <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationCompositionDefinition</class> <class>org.onap.policy.clamp.models.acm.persistence.concepts.StringToServiceTemplateConverter</class> <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationCompositionElement</class> + <class>org.onap.policy.clamp.models.acm.persistence.concepts.StringToMapConverter</class> <class>org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant</class> <properties> diff --git a/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json b/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json index 872499abf..934535a05 100644 --- a/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json +++ b/models/src/test/resources/json/AutomationCompositionElementNoOrderedState.json @@ -9,5 +9,6 @@ "version": "0.0.1" }, "state": "UNINITIALISED", - "orderedState": null + "orderedState": null, + "properties":{"key":"{}"} } |