aboutsummaryrefslogtreecommitdiffstats
path: root/models/src
diff options
context:
space:
mode:
Diffstat (limited to 'models/src')
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java5
-rw-r--r--models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java5
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java20
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java12
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java6
-rw-r--r--models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java10
14 files changed, 83 insertions, 23 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java
index c3e630681..a8b268b4d 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatus.java
@@ -32,7 +32,6 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantStatistics;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
* Class to represent the PARTICIPANT_STATUS message that all the participants send to the control loop runtime.
@@ -51,11 +50,11 @@ public class ParticipantStatus extends ParticipantMessage {
// A map with Participant ID as its key, and a map of ControlLoopElements as value.
// Returned in response to ParticipantStatusReq only
- private Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
+ private Map<String, Map<UUID, ControlLoopElementDefinition>>
participantDefinitionUpdateMap = new LinkedHashMap<>();
// Map of ControlLoopInfo types indexed by ControlLoopId, one entry for each control loop
- private Map<ToscaConceptIdentifier, ControlLoopInfo> controlLoopInfoMap;
+ private Map<String, ControlLoopInfo> controlLoopInfoMap;
/**
* Constructor for instantiating ParticipantStatus class with message name.
diff --git a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java
index 5fd00e278..2733de474 100644
--- a/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdate.java
@@ -23,14 +23,11 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.UUID;
-import java.util.function.UnaryOperator;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
import org.onap.policy.models.base.PfUtils;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
* Class to represent the PARTICIPANT_UPDATE message that the control loop runtime sends to a participant.
@@ -42,7 +39,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
public class ParticipantUpdate extends ParticipantMessage {
// A map with Participant ID as its key, and a map of ControlLoopElements as value.
- private Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
+ private Map<String, Map<UUID, ControlLoopElementDefinition>>
participantDefinitionUpdateMap = new LinkedHashMap<>();
/**
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java
index dd6a814a7..1bf155e9a 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ControlLoopStateChangeTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
@@ -29,6 +30,7 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopOrderedState;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopState;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -37,7 +39,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ControlLoopStateChangeTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ControlLoopStateChange(null)).isInstanceOf(NullPointerException.class);
ControlLoopStateChange orig = new ControlLoopStateChange();
@@ -57,5 +59,7 @@ class ControlLoopStateChangeTest {
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ControlLoopStateChange(orig).toString()));
+
+ assertSerializable(orig, ControlLoopStateChange.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java
index 82ba5d186..b9c1053f3 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantAckMessageTest.java
@@ -22,15 +22,17 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.common.utils.coder.CoderException;
class ParticipantAckMessageTest {
private ParticipantAckMessage message;
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantAckMessage((ParticipantAckMessage) null))
.isInstanceOf(NullPointerException.class);
@@ -45,6 +47,8 @@ class ParticipantAckMessageTest {
newmsg = new ParticipantAckMessage(message);
newmsg.setResponseTo(message.getResponseTo());
assertEquals(message.toString(), newmsg.toString());
+
+ assertSerializable(message, ParticipantAckMessage.class);
}
private ParticipantAckMessage makeMessage() {
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java
index cfb891e2a..f1ae5f709 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterAckTest.java
@@ -22,16 +22,18 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ParticipantDeregisterAckTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantDeregisterAck(null)).isInstanceOf(NullPointerException.class);
final ParticipantDeregisterAck orig = new ParticipantDeregisterAck();
@@ -51,5 +53,7 @@ class ParticipantDeregisterAckTest {
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantDeregisterAck(orig).toString()));
+
+ assertSerializable(orig, ParticipantDeregisterAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java
index 2daefb6cc..89546890a 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantDeregisterTest.java
@@ -22,17 +22,19 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ParticipantDeregisterTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantDeregister(null)).isInstanceOf(NullPointerException.class);
final ParticipantDeregister orig = new ParticipantDeregister();
@@ -53,5 +55,7 @@ class ParticipantDeregisterTest {
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantDeregister(orig).toString()));
+
+ assertSerializable(orig, ParticipantDeregister.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java
index 8d644f1f1..924ad8fa8 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageTest.java
@@ -24,17 +24,19 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import java.time.Instant;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ParticipantMessageTest {
private ParticipantMessage message;
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantMessage((ParticipantMessage) null))
.isInstanceOf(NullPointerException.class);
@@ -51,6 +53,8 @@ class ParticipantMessageTest {
newmsg.setMessageId(message.getMessageId());
newmsg.setTimestamp(message.getTimestamp());
assertEquals(message.toString(), newmsg.toString());
+
+ assertSerializable(message, ParticipantMessage.class);
}
@Test
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java
index dfbc25d1b..78c278f98 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantMessageUtils.java
@@ -20,6 +20,11 @@
package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
+import static org.junit.Assert.assertEquals;
+
+import org.onap.policy.common.utils.coder.CoderException;
+import org.onap.policy.common.utils.coder.StandardCoder;
+
/**
* Utility class for tests of ParticipantMessage subclasses.
*/
@@ -32,4 +37,19 @@ public class ParticipantMessageUtils {
public static String removeVariableFields(String text) {
return text.replaceAll("messageId=[^,]*", "messageId=xxx").replaceAll("timestamp=[^,]*", "timestamp=nnn");
}
+
+ /**
+ * Check if object is Serializable.
+ *
+ * @param object the Object
+ * @param clazz the class of the Object
+ * @throws CoderException if object is not Serializable
+ */
+ public static <T> void assertSerializable(Object object, Class<T> clazz) throws CoderException {
+ var standardCoder = new StandardCoder();
+ var json = standardCoder.encode(object);
+ var other = standardCoder.decode(json, clazz);
+
+ assertEquals(removeVariableFields(object.toString()), removeVariableFields(other.toString()));
+ }
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java
index f0c721186..886933aba 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterAckTest.java
@@ -22,16 +22,18 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ParticipantRegisterAckTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantRegisterAck(null)).isInstanceOf(NullPointerException.class);
final ParticipantRegisterAck orig = new ParticipantRegisterAck();
@@ -51,5 +53,7 @@ class ParticipantRegisterAckTest {
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantRegisterAck(orig).toString()));
+
+ assertSerializable(orig, ParticipantRegisterAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java
index d7ce5bf38..e86d9e885 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantRegisterTest.java
@@ -22,17 +22,19 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ParticipantRegisterTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantRegister(null)).isInstanceOf(NullPointerException.class);
final ParticipantRegister orig = new ParticipantRegister();
@@ -53,5 +55,7 @@ class ParticipantRegisterTest {
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantRegister(orig).toString()));
+
+ assertSerializable(orig, ParticipantRegister.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java
index b391aa2cf..98c127107 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusReqTest.java
@@ -22,11 +22,13 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -34,7 +36,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
*/
class ParticipantStatusReqTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantStatusReq(null)).isInstanceOf(NullPointerException.class);
ParticipantStatusReq orig = new ParticipantStatusReq();
@@ -48,5 +50,7 @@ class ParticipantStatusReqTest {
ParticipantStatusReq other = new ParticipantStatusReq(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
+
+ assertSerializable(orig, ParticipantStatusReq.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java
index 05cfdd78b..14252cd95 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantStatusTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
@@ -37,13 +38,14 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopStatistics;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantHealthStatus;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ParticipantState;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
class ParticipantStatusTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantStatus(null)).isInstanceOf(NullPointerException.class);
final ParticipantStatus orig = new ParticipantStatus();
@@ -63,16 +65,18 @@ class ParticipantStatusTest {
orig.setTimestamp(Instant.ofEpochMilli(3000));
ControlLoopInfo clInfo = getControlLoopInfo(id);
- orig.setControlLoopInfoMap(Map.of(id, clInfo));
+ orig.setControlLoopInfoMap(Map.of(id.toString(), clInfo));
ControlLoopElementDefinition clDefinition = getClElementDefinition();
Map<UUID, ControlLoopElementDefinition> clElementDefinitionMap = Map.of(UUID.randomUUID(), clDefinition);
- Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
- participantDefinitionUpdateMap = Map.of(id, clElementDefinitionMap);
+ Map<String, Map<UUID, ControlLoopElementDefinition>>
+ participantDefinitionUpdateMap = Map.of(id.toString(), clElementDefinitionMap);
orig.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantStatus(orig).toString()));
+
+ assertSerializable(orig, ParticipantStatus.class);
}
private ControlLoopInfo getControlLoopInfo(ToscaConceptIdentifier id) {
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java
index 868147637..d2a191018 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateAckTest.java
@@ -22,16 +22,18 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.util.UUID;
import org.junit.jupiter.api.Test;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ParticipantUpdateAckTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantUpdateAck(null)).isInstanceOf(NullPointerException.class);
final ParticipantUpdateAck orig = new ParticipantUpdateAck();
@@ -51,5 +53,7 @@ class ParticipantUpdateAckTest {
assertEquals(removeVariableFields(orig.toString()),
removeVariableFields(new ParticipantUpdateAck(orig).toString()));
+
+ assertSerializable(orig, ParticipantUpdateAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java
index 094431233..6ccdd20ec 100644
--- a/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/controlloop/models/messages/dmaap/participant/ParticipantUpdateTest.java
@@ -22,6 +22,7 @@ package org.onap.policy.clamp.controlloop.models.messages.dmaap.participant;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
+import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable;
import static org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields;
import java.time.Instant;
@@ -29,6 +30,7 @@ import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoopElementDefinition;
+import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
@@ -37,7 +39,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
*/
class ParticipantUpdateTest {
@Test
- void testCopyConstructor() {
+ void testCopyConstructor() throws CoderException {
assertThatThrownBy(() -> new ParticipantUpdate(null)).isInstanceOf(NullPointerException.class);
ParticipantUpdate orig = new ParticipantUpdate();
@@ -65,12 +67,14 @@ class ParticipantUpdateTest {
Map<UUID, ControlLoopElementDefinition> clElementDefinitionMap = Map.of(UUID.randomUUID(), clDefinition);
- Map<ToscaConceptIdentifier, Map<UUID, ControlLoopElementDefinition>>
- participantDefinitionUpdateMap = Map.of(id, clElementDefinitionMap);
+ Map<String, Map<UUID, ControlLoopElementDefinition>> participantDefinitionUpdateMap =
+ Map.of(id.toString(), clElementDefinitionMap);
orig.setParticipantDefinitionUpdateMap(participantDefinitionUpdateMap);
ParticipantUpdate other = new ParticipantUpdate(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
+
+ assertSerializable(orig, ParticipantUpdate.class);
}
}