diff options
author | saul.gill <saul.gill@est.tech> | 2023-01-23 17:44:13 +0000 |
---|---|---|
committer | saul.gill <saul.gill@est.tech> | 2023-01-26 09:27:28 +0000 |
commit | 73d0c089fe3e3019e8caa54a60a4c76de5edd72a (patch) | |
tree | 3197ed2af3da4a57abf8226c1cf21e6500a42444 /runtime-acm | |
parent | db615d9fed370c7896a638704d00807c19b6f5d3 (diff) |
Remove participantType and references
Issue-ID: POLICY-4538
Change-Id: Idf3f0308254a318b3e72aa8a234fd7c78f6ffd82
Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'runtime-acm')
9 files changed, 26 insertions, 58 deletions
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java index 53288d15e..b7e7644ef 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. + * Copyright (C) 2021-2023 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -253,10 +253,10 @@ public class AutomationCompositionInstantiationProvider { subResult.addResult(new ObjectValidationResult(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE, element.getDefinition().getName(), ValidationStatus.INVALID, "Participant with ID " + element.getParticipantId() + " is not registered")); - } else if (!p.getParticipantType().equals(element.getParticipantType())) { + } else if (!p.getParticipantId().equals(element.getParticipantId())) { subResult.addResult(new ObjectValidationResult(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE, element.getDefinition().getName(), ValidationStatus.INVALID, - "Participant with ID " + element.getParticipantType() + " - " + element.getParticipantId() + "Participant with ID " + " - " + element.getParticipantId() + " is not registered")); } result.addResult(subResult); diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java index f58543684..75fed71e0 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java @@ -65,7 +65,7 @@ public class SupervisionParticipantHandler { saveParticipantStatus(participantRegisterMsg); participantRegisterAckPublisher.send(participantRegisterMsg.getMessageId(), - participantRegisterMsg.getParticipantId(), participantRegisterMsg.getParticipantType()); + participantRegisterMsg.getParticipantId()); } /** @@ -107,7 +107,6 @@ public class SupervisionParticipantHandler { ParticipantRegister registerMessage = (ParticipantRegister) participantMessage; var participant = new Participant(); participant.setParticipantId(participantMessage.getParticipantId()); - participant.setParticipantType(registerMessage.getParticipantType()); participant.setParticipantSupportedElementTypes(listToMap(registerMessage .getParticipantSupportedElementType())); participant.setParticipantState(ParticipantState.ON_LINE); diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java index 3cadff6ee..cbdba53ac 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021,2022 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. @@ -23,7 +23,6 @@ package org.onap.policy.clamp.acm.runtime.supervision.comm; import io.micrometer.core.annotation.Timed; import java.util.UUID; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.springframework.stereotype.Component; /** @@ -37,13 +36,11 @@ public class ParticipantRegisterAckPublisher extends AbstractParticipantAckPubli * * @param responseTo the original request id in the request. * @param participantId the participant Id - * @param participantType the participant Type */ @Timed(value = "publisher.participant_register_ack", description = "PARTICIPANT_REGISTER_ACK messages published") - public void send(UUID responseTo, UUID participantId, ToscaConceptIdentifier participantType) { + public void send(UUID responseTo, UUID participantId) { var message = new ParticipantRegisterAck(); message.setParticipantId(participantId); - message.setParticipantType(participantType); message.setResponseTo(responseTo); message.setMessage("Participant Register Ack"); message.setResult(true); diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java index 504ddc28c..e4bfedd9d 100644 --- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java +++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021,2022 Nordix Foundation. + * Copyright (C) 2021-2023 Nordix Foundation. * ================================================================================ * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ @@ -34,7 +34,6 @@ import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.clamp.models.acm.utils.AcmUtils; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -57,41 +56,38 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par */ @Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published") public void sendComissioningBroadcast(AutomationCompositionDefinition acmDefinition) { - sendCommissioning(acmDefinition, null, null); + sendCommissioning(acmDefinition, null); } /** * Send ParticipantUpdate to Participant - * if participantType and participantId are null then message is broadcast. + * if participantId is null then message is broadcast. * - * @param participantType the ParticipantType * @param participantId the ParticipantId */ @Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published") - public void sendCommissioning(ToscaConceptIdentifier participantType, UUID participantId) { + public void sendCommissioning(UUID participantId) { var list = acDefinitionProvider.getAllAcDefinitions(); if (list.isEmpty()) { LOGGER.warn("No tosca service template found, cannot send participantupdate"); } for (var acmDefinition : list) { - sendCommissioning(acmDefinition, participantType, participantId); + sendCommissioning(acmDefinition, participantId); } } /** * Send ParticipantUpdate to Participant - * if participantType and participantId are null then message is broadcast. + * if participantId is null then message is broadcast. * * @param acmDefinition the AutomationComposition Definition - * @param participantType the ParticipantType * @param participantId the ParticipantId */ @Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published") public void sendCommissioning(AutomationCompositionDefinition acmDefinition, - ToscaConceptIdentifier participantType, UUID participantId) { + UUID participantId) { var message = new ParticipantUpdate(); message.setCompositionId(acmDefinition.getCompositionId()); - message.setParticipantType(participantType); message.setParticipantId(participantId); message.setTimestamp(Instant.now()); @@ -101,7 +97,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par if (ParticipantUtils.checkIfNodeTemplateIsAutomationCompositionElement(toscaInputEntry.getValue(), toscaServiceTemplate)) { AcmUtils.prepareParticipantDefinitionUpdate( - ParticipantUtils.findParticipantType(toscaInputEntry.getValue().getProperties()), + participantId, toscaInputEntry.getKey(), toscaInputEntry.getValue(), participantDefinitionUpdates); } } diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java index 10332117c..aa8905917 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java @@ -53,13 +53,10 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUp import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider; import org.onap.policy.models.base.PfModelException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionHandlerTest { private static final String AC_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/acm/AutomationComposition.json"; private static final UUID IDENTIFIER = UUID.randomUUID(); - private static final ToscaConceptIdentifier PARTICIPANT_TYPE = - new ToscaConceptIdentifier("ParticipantType", "1.0.0"); @Test void testTriggerAutomationCompositionSupervision() throws AutomationCompositionException { @@ -235,7 +232,6 @@ class SupervisionHandlerTest { var automationCompositionAckMessage = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK); automationCompositionAckMessage.setParticipantId(CommonTestData.getParticipantId()); - automationCompositionAckMessage.setParticipantType(PARTICIPANT_TYPE); automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of()); automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER); var automationCompositionProvider = mock(AutomationCompositionProvider.class); @@ -253,7 +249,6 @@ class SupervisionHandlerTest { void testParticipantUpdateAck() { var participantUpdateAckMessage = new ParticipantUpdateAck(); participantUpdateAckMessage.setParticipantId(CommonTestData.getParticipantId()); - participantUpdateAckMessage.setParticipantType(PARTICIPANT_TYPE); participantUpdateAckMessage.setState(ParticipantState.ON_LINE); var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class), mock(AutomationCompositionUpdatePublisher.class), mock(AutomationCompositionStateChangePublisher.class), 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 9463d7977..b53a17ece 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 @@ -40,12 +40,11 @@ import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionParticipantHandlerTest { - private static final ToscaConceptIdentifier PARTICIPANT_TYPE = - new ToscaConceptIdentifier("ParticipantType", "1.0.0"); + private static final ToscaConceptIdentifier PARTICIPANT_ID = new ToscaConceptIdentifier("ParticipantId", "1.0.0"); @Test void testHandleParticipantDeregister() { - var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId()); + var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); var participantProvider = mock(ParticipantProvider.class); when(participantProvider.findParticipant(CommonTestData.getParticipantId())) @@ -54,7 +53,6 @@ class SupervisionParticipantHandlerTest { var participantDeregisterMessage = new ParticipantDeregister(); participantDeregisterMessage.setMessageId(UUID.randomUUID()); participantDeregisterMessage.setParticipantId(CommonTestData.getParticipantId()); - participantDeregisterMessage.setParticipantType(PARTICIPANT_TYPE); var participantDeregisterAckPublisher = mock(ParticipantDeregisterAckPublisher.class); var handler = new SupervisionParticipantHandler(participantProvider, mock(ParticipantRegisterAckPublisher.class), participantDeregisterAckPublisher); @@ -70,7 +68,6 @@ class SupervisionParticipantHandlerTest { var participantRegisterMessage = new ParticipantRegister(); participantRegisterMessage.setMessageId(UUID.randomUUID()); participantRegisterMessage.setParticipantId(CommonTestData.getParticipantId()); - participantRegisterMessage.setParticipantType(PARTICIPANT_TYPE); var participantProvider = mock(ParticipantProvider.class); var participantRegisterAckPublisher = mock(ParticipantRegisterAckPublisher.class); var handler = new SupervisionParticipantHandler(participantProvider, participantRegisterAckPublisher, @@ -81,21 +78,20 @@ class SupervisionParticipantHandlerTest { verify(participantProvider).saveParticipant(any()); verify(participantRegisterAckPublisher).send(participantRegisterMessage.getMessageId(), - CommonTestData.getParticipantId(), PARTICIPANT_TYPE); + CommonTestData.getParticipantId()); } @Test void testHandleParticipantStatus() { var participantStatusMessage = new ParticipantStatus(); participantStatusMessage.setParticipantId(CommonTestData.getParticipantId()); - participantStatusMessage.setParticipantType(PARTICIPANT_TYPE); participantStatusMessage.setState(ParticipantState.ON_LINE); participantStatusMessage.setParticipantSupportedElementType(new ArrayList<>()); var participantProvider = mock(ParticipantProvider.class); var handler = new SupervisionParticipantHandler(participantProvider, mock(ParticipantRegisterAckPublisher.class), mock(ParticipantDeregisterAckPublisher.class)); - var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId()); + var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); when(participantProvider.findParticipant(CommonTestData.getParticipantId())) .thenReturn(Optional.of(participant)); handler.handleParticipantMessage(participantStatusMessage); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java index 683dd539a..936555aa3 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java @@ -119,7 +119,7 @@ class SupervisionScannerTest { .thenReturn(List.of(automationComposition)); var participantProvider = mock(ParticipantProvider.class); - var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId()); + var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); when(participantProvider.getParticipants()).thenReturn(List.of(participant)); var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class); @@ -180,7 +180,7 @@ class SupervisionScannerTest { acRuntimeParameterGroup.getParticipantParameters().getUpdateParameters().setMaxWaitMs(-1); acRuntimeParameterGroup.getParticipantParameters().setMaxStatusWaitMs(-1); - var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId()); + var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId()); participant.setParticipantState(ParticipantState.OFF_LINE); var participantProvider = mock(ParticipantProvider.class); when(participantProvider.getParticipants()).thenReturn(List.of(participant)); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java index d9c4ed67f..5ea3bea2c 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java @@ -49,7 +49,6 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUp import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class SupervisionMessagesTest { @@ -170,14 +169,10 @@ class SupervisionMessagesTest { var publisher = new ParticipantRegisterAckPublisher(); var topicSink = mock(TopicSink.class); publisher.active(List.of(topicSink)); - publisher.send(UUID.randomUUID(), CommonTestData.getParticipantId(), getParticipantType()); + publisher.send(UUID.randomUUID(), CommonTestData.getParticipantId()); verify(topicSink).send(anyString()); } - private ToscaConceptIdentifier getParticipantType() { - return new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"); - } - @Test void testParticipantDeregisterAckPublisher() { var publisher = new ParticipantDeregisterAckPublisher(); diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java index 7d80228db..b99140914 100644 --- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java +++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 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. @@ -30,7 +30,6 @@ import org.onap.policy.common.utils.coder.Coder; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.resources.ResourceUtils; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to hold/create all parameters for test cases. @@ -75,30 +74,21 @@ public class CommonTestData { * @return a List of Participants */ public static List<Participant> createParticipants() { - var participant1 = createParticipant( - new ToscaConceptIdentifier("org.onap.policy.clamp.acm.KubernetesParticipant", "2.3.4"), - UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c02")); - var participant2 = createParticipant( - new ToscaConceptIdentifier("org.onap.policy.clamp.acm.HttpParticipant", "2.3.4"), - UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c01")); - var participant3 = createParticipant( - new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyParticipant", "2.3.1"), - UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03")); + var participant1 = createParticipant(UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c02")); + var participant2 = createParticipant(UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c01")); + var participant3 = createParticipant(UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03")); return List.of(participant1, participant2, participant3); } /** * Create a new Participant. * - * @param participantType the participant Type * @param participantId the participant id * @return a new Participant */ - public static Participant createParticipant(ToscaConceptIdentifier participantType, - UUID participantId) { + public static Participant createParticipant(UUID participantId) { var participant = new Participant(); participant.setParticipantId(participantId); - participant.setParticipantType(participantType); return participant; } |