summaryrefslogtreecommitdiffstats
path: root/runtime-acm/src/test/java
diff options
context:
space:
mode:
authorFrancescoFioraEst <francesco.fiora@est.tech>2023-02-23 17:03:24 +0000
committerFrancesco Fiora <francesco.fiora@est.tech>2023-02-24 13:56:09 +0000
commit660e20098d446046a27b03b44bccd069aae5408b (patch)
tree10cebe66be95d227422f51fc8c8923da51368578 /runtime-acm/src/test/java
parent7dfd781843a2c915a7ba89b676c241ad2e1c88b9 (diff)
Fix ClassCastException in ACM
Fix ClassCastException in ACM when acm-runtime starts after participants. Issue-ID: POLICY-4575 Change-Id: Icef82d3ba7f3847c821362ed063c1cf8e81604c5 Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'runtime-acm/src/test/java')
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java
index 246ba7dc7..fb12e040a 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java
@@ -25,14 +25,16 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import java.util.ArrayList;
+import java.util.List;
import java.util.Optional;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantDeregisterAckPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantRegisterAckPublisher;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
+import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
@@ -66,12 +68,15 @@ class SupervisionParticipantHandlerTest {
var participantRegisterMessage = new ParticipantRegister();
participantRegisterMessage.setMessageId(UUID.randomUUID());
participantRegisterMessage.setParticipantId(CommonTestData.getParticipantId());
+ var supportedElementType = new ParticipantSupportedElementType();
+ supportedElementType.setTypeName("Type");
+ supportedElementType.setTypeVersion("1.0.0");
+ participantRegisterMessage.setParticipantSupportedElementType(List.of(supportedElementType));
+
var participantProvider = mock(ParticipantProvider.class);
var participantRegisterAckPublisher = mock(ParticipantRegisterAckPublisher.class);
var handler = new SupervisionParticipantHandler(participantProvider, participantRegisterAckPublisher,
- mock(ParticipantDeregisterAckPublisher.class));
- participantRegisterMessage.setParticipantSupportedElementType(new ArrayList<>());
-
+ mock(ParticipantDeregisterAckPublisher.class));
handler.handleParticipantMessage(participantRegisterMessage);
verify(participantProvider).saveParticipant(any());
@@ -84,7 +89,11 @@ class SupervisionParticipantHandlerTest {
var participantStatusMessage = new ParticipantStatus();
participantStatusMessage.setParticipantId(CommonTestData.getParticipantId());
participantStatusMessage.setState(ParticipantState.ON_LINE);
- participantStatusMessage.setParticipantSupportedElementType(new ArrayList<>());
+ var supportedElementType = new ParticipantSupportedElementType();
+ supportedElementType.setTypeName("Type");
+ supportedElementType.setTypeVersion("1.0.0");
+ participantStatusMessage.setParticipantSupportedElementType(List.of(supportedElementType));
+ participantStatusMessage.setAutomationCompositionInfoList(List.of(new AutomationCompositionInfo()));
var participantProvider = mock(ParticipantProvider.class);
var handler = new SupervisionParticipantHandler(participantProvider,