diff options
41 files changed, 95 insertions, 346 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java index bea2278a8..b153ef508 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.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. @@ -47,9 +47,6 @@ public class AutomationCompositionElement { private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey()); @NonNull - private ToscaConceptIdentifier participantType = new ToscaConceptIdentifier(PfConceptKey.getNullKey()); - - @NonNull private UUID participantId = UUID.randomUUID(); @NonNull @@ -74,7 +71,6 @@ public class AutomationCompositionElement { public AutomationCompositionElement(final AutomationCompositionElement otherElement) { this.id = otherElement.id; this.definition = new ToscaConceptIdentifier(otherElement.definition); - this.participantType = new ToscaConceptIdentifier(otherElement.participantType); this.participantId = otherElement.participantId; this.state = otherElement.state; this.orderedState = otherElement.orderedState; diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java index 8503516a1..c045c928b 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java @@ -28,7 +28,6 @@ import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.NonNull; import org.onap.policy.models.base.PfUtils; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to represent details of a running participant instance. @@ -45,9 +44,6 @@ public class Participant { private ParticipantState participantState = ParticipantState.ON_LINE; @NonNull - private ToscaConceptIdentifier participantType = new ToscaConceptIdentifier(); - - @NonNull private Map<UUID, ParticipantSupportedElementType> participantSupportedElementTypes = new HashMap<>(); /** @@ -57,7 +53,6 @@ public class Participant { */ public Participant(Participant otherParticipant) { this.participantState = otherParticipant.participantState; - this.participantType = otherParticipant.participantType; this.participantId = otherParticipant.participantId; this.participantSupportedElementTypes = PfUtils.mapMap(otherParticipant.getParticipantSupportedElementTypes(), ParticipantSupportedElementType::new); diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java index aff619873..d3e800cf1 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 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. @@ -28,7 +28,6 @@ import lombok.Getter; import lombok.NoArgsConstructor; import lombok.ToString; import org.onap.policy.models.base.PfUtils; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to represent a participant definition update instance. @@ -41,7 +40,6 @@ public class ParticipantDefinition { private UUID participantId; - private ToscaConceptIdentifier participantType; // List of AutomationCompositionElementDefinition values for a particular participant private List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList = new ArrayList<>(); @@ -53,7 +51,6 @@ public class ParticipantDefinition { */ public ParticipantDefinition(final ParticipantDefinition participantDefinition) { this.participantId = participantDefinition.participantId; - this.participantType = participantDefinition.participantType; this.automationCompositionElementDefinitionList = PfUtils.mapList(participantDefinition.automationCompositionElementDefinitionList, AutomationCompositionElementDefinition::new); diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java index 9d26ce406..015a96aad 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 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. @@ -21,14 +21,10 @@ package org.onap.policy.clamp.models.acm.concepts; import java.util.Map; -import javax.ws.rs.core.Response; import lombok.AccessLevel; import lombok.NoArgsConstructor; 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.models.base.PfModelRuntimeException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; @@ -40,24 +36,6 @@ public final class ParticipantUtils { "org.onap.policy.clamp.acm.AutomationCompositionElement"; /** - * Finds participantType from a map of properties. - * - * @param properties Map of properties - * @return participantType - */ - public static ToscaConceptIdentifier findParticipantType(Map<String, Object> properties) { - var objParticipantType = properties.get("participantType"); - if (objParticipantType != null) { - try { - return CODER.decode(objParticipantType.toString(), ToscaConceptIdentifier.class); - } catch (CoderException e) { - throw new PfModelRuntimeException(Response.Status.BAD_REQUEST, e.getMessage(), e); - } - } - return null; - } - - /** * Get the First StartPhase. * * <p>This depends on the state of the automation composition and also on all start phases defined in the @@ -91,9 +69,9 @@ public final class ParticipantUtils { * @return startPhase */ public static int findStartPhase(Map<String, Object> properties) { - var objParticipantType = properties.get("startPhase"); - if (objParticipantType != null) { - return Integer.valueOf(objParticipantType.toString()); + var objStartPhase = properties.get("startPhase"); + if (objStartPhase != null) { + return Integer.valueOf(objStartPhase.toString()); } return 0; } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java index 8d847f8d4..bdb2be861 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.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. @@ -26,7 +26,6 @@ import lombok.NonNull; import lombok.Setter; import lombok.ToString; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to represent participant Ack message. @@ -48,11 +47,6 @@ public class ParticipantAckMessage { private ParticipantMessageType messageType; /** - * Participant Type, or {@code null} for messages from participants. - */ - private ToscaConceptIdentifier participantType; - - /** * Participant ID, or {@code null} for messages from participants. */ private UUID participantId; @@ -81,7 +75,6 @@ public class ParticipantAckMessage { this.result = source.result; this.message = source.message; this.messageType = source.messageType; - this.participantType = source.participantType; this.participantId = source.participantId; this.state = source.state; } @@ -89,22 +82,11 @@ public class ParticipantAckMessage { /** * Determines if this message applies to this participant type. * - * @param participantType type of the participant to match against * @param participantId id of the participant to match against * @return {@code true} if this message applies to this participant, {@code false} otherwise */ - public boolean appliesTo(@NonNull final ToscaConceptIdentifier participantType, - @NonNull final UUID participantId) { + public boolean appliesTo(@NonNull final UUID participantId) { // Broadcast message to all participants - if (this.participantType == null) { - return true; - } - - if (!participantType.equals(this.participantType)) { - return false; - } - - // Broadcast message to all automation composition elements on this participant if (this.participantId == null) { return true; } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java index 525dab75f..81eda8ce2 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.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. @@ -27,7 +27,6 @@ import lombok.Getter; import lombok.NonNull; import lombok.Setter; import lombok.ToString; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to represent the base class for various messages that will be exchanged between the ACM runtime and @@ -48,11 +47,6 @@ public class ParticipantMessage { private Instant timestamp = Instant.now(); /** - * Participant Type, or {@code null} for messages from participants. - */ - private ToscaConceptIdentifier participantType; - - /** * Participant ID, or {@code null} for messages from participants. */ private UUID participantId; @@ -80,7 +74,6 @@ public class ParticipantMessage { */ public ParticipantMessage(final ParticipantMessage source) { this.messageType = source.messageType; - this.participantType = source.participantType; this.participantId = source.participantId; this.automationCompositionId = source.automationCompositionId; this.compositionId = source.compositionId; @@ -89,22 +82,11 @@ public class ParticipantMessage { /** * Determines if this message applies to this participant type. * - * @param participantType type of the participant to match against * @param participantId id of the participant to match against * @return {@code true} if this message applies to this participant, {@code false} otherwise */ - public boolean appliesTo(@NonNull final ToscaConceptIdentifier participantType, - @NonNull final UUID participantId) { + public boolean appliesTo(@NonNull final UUID participantId) { // Broadcast message to all participants - if (this.participantType == null) { - return true; - } - - if (!participantType.equals(this.participantType)) { - return false; - } - - // Broadcast message to all automation composition elements on this participant if (this.participantId == null) { return true; } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java index 23fc0a93e..743bb7fd3 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.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. * ================================================================================ @@ -79,13 +79,6 @@ public class JpaAutomationCompositionElement extends Validated @AttributeOverride(name = "version", column = @Column(name = "definition_version")) private PfConceptKey definition; - @VerifyKey - @NotNull - @AttributeOverride(name = "name", column = @Column(name = "participant_type_name")) - @AttributeOverride(name = "version", column = @Column(name = "participant_type_version")) - private PfConceptKey participantType; - - @Column @NotNull private String participantId; @@ -120,7 +113,7 @@ public class JpaAutomationCompositionElement extends Validated * @param instanceId The id of the automation composition instance */ public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId) { - this(elementId, instanceId, new PfConceptKey(), new PfConceptKey(), AutomationCompositionState.UNINITIALISED); + this(elementId, instanceId, new PfConceptKey(), AutomationCompositionState.UNINITIALISED); } /** @@ -129,16 +122,14 @@ public class JpaAutomationCompositionElement extends Validated * @param elementId The id of the automation composition instance Element * @param instanceId The id of the automation composition instance * @param definition the TOSCA definition of the automation composition element - * @param participantType the TOSCA definition of the participant running the automation composition element * @param state the state of the automation composition */ public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId, - @NonNull final PfConceptKey definition, @NonNull final PfConceptKey participantType, + @NonNull final PfConceptKey definition, @NonNull final AutomationCompositionState state) { this.elementId = elementId; this.instanceId = instanceId; this.definition = definition; - this.participantType = participantType; this.state = state; } @@ -151,7 +142,6 @@ public class JpaAutomationCompositionElement extends Validated this.elementId = copyConcept.elementId; this.instanceId = copyConcept.instanceId; this.definition = new PfConceptKey(copyConcept.definition); - this.participantType = new PfConceptKey(copyConcept.participantType); this.participantId = copyConcept.participantId; this.state = copyConcept.state; this.orderedState = copyConcept.orderedState; @@ -174,7 +164,6 @@ public class JpaAutomationCompositionElement extends Validated element.setId(UUID.fromString(elementId)); element.setDefinition(new ToscaConceptIdentifier(definition)); - element.setParticipantType(new ToscaConceptIdentifier(participantType)); element.setParticipantId(UUID.fromString(participantId)); element.setState(state); element.setOrderedState(orderedState != null ? orderedState : state.asOrderedState()); @@ -187,7 +176,6 @@ public class JpaAutomationCompositionElement extends Validated @Override public void fromAuthorative(@NonNull final AutomationCompositionElement element) { this.definition = element.getDefinition().asConceptKey(); - this.participantType = element.getParticipantType().asConceptKey(); this.participantId = element.getParticipantId().toString(); this.state = element.getState(); this.orderedState = element.getOrderedState(); @@ -219,11 +207,6 @@ public class JpaAutomationCompositionElement extends Validated return result; } - result = participantType.compareTo(other.participantType); - if (result != 0) { - return result; - } - result = participantId.compareTo(other.participantId); if (result != 0) { return result; diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java index b7e95cfa7..0674873a9 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.UUID; -import javax.persistence.AttributeOverride; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; @@ -46,9 +45,7 @@ import org.onap.policy.clamp.models.acm.concepts.ParticipantState; import org.onap.policy.common.parameters.annotations.NotNull; import org.onap.policy.common.parameters.annotations.Valid; import org.onap.policy.models.base.PfAuthorative; -import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.Validated; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to represent a participant in the database. @@ -68,11 +65,6 @@ public class JpaParticipant extends Validated @NotNull private String participantId; - @NotNull - @AttributeOverride(name = "name", column = @Column(name = "participant_type_name")) - @AttributeOverride(name = "version", column = @Column(name = "participant_type_version")) - private PfConceptKey participantType; - @Column @NotNull private ParticipantState participantState; @@ -114,7 +106,6 @@ public class JpaParticipant extends Validated public JpaParticipant(@NonNull final JpaParticipant copyConcept) { this.participantState = copyConcept.participantState; this.description = copyConcept.description; - this.participantType = copyConcept.participantType; this.participantId = copyConcept.participantId; this.supportedElements = copyConcept.supportedElements; } @@ -133,7 +124,6 @@ public class JpaParticipant extends Validated var participant = new Participant(); participant.setParticipantState(participantState); - participant.setParticipantType(new ToscaConceptIdentifier(participantType)); participant.setParticipantId(UUID.fromString(participantId)); participant.setParticipantSupportedElementTypes(new LinkedHashMap<>(this.supportedElements.size())); for (var element : this.supportedElements) { @@ -147,7 +137,6 @@ public class JpaParticipant extends Validated @Override public void fromAuthorative(@NonNull final Participant participant) { this.setParticipantState(participant.getParticipantState()); - this.participantType = participant.getParticipantType().asConceptKey(); this.participantId = participant.getParticipantId().toString(); this.supportedElements = new ArrayList<>(participant.getParticipantSupportedElementTypes().size()); @@ -178,11 +167,6 @@ public class JpaParticipant extends Validated return result; } - result = ObjectUtils.compare(participantType, other.participantType); - if (result != 0) { - return result; - } - return ObjectUtils.compare(description, other.description); } } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java index 220a3c132..8bd9039fd 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.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. @@ -24,6 +24,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.UUID; import java.util.function.Function; import java.util.function.UnaryOperator; import java.util.stream.Collectors; @@ -112,13 +113,14 @@ public final class AcmUtils { /** * Prepare ParticipantDefinitionUpdate to set in the message. * - * @param acParticipantType participant type + * @param acParticipantId participant id * @param entryKey key for the entry * @param entryValue value relates to toscaNodeTemplate * @param participantDefinitionUpdates list of participantDefinitionUpdates */ - public static void prepareParticipantDefinitionUpdate(ToscaConceptIdentifier acParticipantType, String entryKey, - ToscaNodeTemplate entryValue, List<ParticipantDefinition> participantDefinitionUpdates) { + public static void prepareParticipantDefinitionUpdate(UUID acParticipantId, String entryKey, + ToscaNodeTemplate entryValue, + List<ParticipantDefinition> participantDefinitionUpdates) { var acDefinition = new AutomationCompositionElementDefinition(); acDefinition.setAcElementDefinitionId(new ToscaConceptIdentifier(entryKey, entryValue.getVersion())); @@ -127,28 +129,30 @@ public final class AcmUtils { List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList = new ArrayList<>(); if (participantDefinitionUpdates.isEmpty()) { - participantDefinitionUpdates.add(getParticipantDefinition(acDefinition, acParticipantType, + participantDefinitionUpdates.add(getParticipantDefinition(acDefinition, acParticipantId, automationCompositionElementDefinitionList)); } else { var participantExists = false; for (ParticipantDefinition participantDefinitionUpdate : participantDefinitionUpdates) { - if (participantDefinitionUpdate.getParticipantType().equals(acParticipantType)) { - participantDefinitionUpdate.getAutomationCompositionElementDefinitionList().add(acDefinition); - participantExists = true; + if (acParticipantId != null || participantDefinitionUpdate.getParticipantId() != null) { + if (participantDefinitionUpdate.getParticipantId().equals(acParticipantId)) { + participantDefinitionUpdate.getAutomationCompositionElementDefinitionList().add(acDefinition); + participantExists = true; + } } } if (!participantExists) { - participantDefinitionUpdates.add(getParticipantDefinition(acDefinition, acParticipantType, + participantDefinitionUpdates.add(getParticipantDefinition(acDefinition, acParticipantId, automationCompositionElementDefinitionList)); } } } private static ParticipantDefinition getParticipantDefinition(AutomationCompositionElementDefinition acDefinition, - ToscaConceptIdentifier acParticipantType, + UUID acParticipantId, List<AutomationCompositionElementDefinition> automationCompositionElementDefinitionList) { var participantDefinition = new ParticipantDefinition(); - participantDefinition.setParticipantType(acParticipantType); + participantDefinition.setParticipantId(acParticipantId); automationCompositionElementDefinitionList.add(acDefinition); participantDefinition.setAutomationCompositionElementDefinitionList(automationCompositionElementDefinitionList); return participantDefinition; diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java index 77b3cccf8..b3efc2765 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.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. @@ -29,7 +29,6 @@ import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.common.utils.coder.StandardYamlCoder; import org.onap.policy.common.utils.resources.ResourceUtils; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; @@ -47,13 +46,6 @@ class ParticipantUtilsTest { private static final StandardYamlCoder YAML_TRANSLATOR = new StandardYamlCoder(); @Test - void testFindParticipantType() throws CoderException { - var identifier = new ToscaConceptIdentifier("Identifier", "1.0.1"); - var result = ParticipantUtils.findParticipantType(Map.of("participantType", CODER.encode(identifier))); - assertThat(result).isEqualTo(identifier); - } - - @Test void testFindStartPhase() { var identifier = 13; var result = ParticipantUtils.findStartPhase(Map.of("startPhase", identifier)); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java index cfae1b1db..8c5528cc6 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.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. @@ -32,7 +32,6 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; import org.onap.policy.clamp.models.acm.utils.CommonTestData; import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class AutomationCompositionAckTest { @@ -50,8 +49,6 @@ class AutomationCompositionAckTest { // verify with all values orig.setAutomationCompositionId(UUID.randomUUID()); orig.setParticipantId(CommonTestData.getParticipantId()); - var id = new ToscaConceptIdentifier("id", "1.2.3"); - orig.setParticipantType(id); var acElementResult = new AutomationCompositionElementAck(AutomationCompositionState.UNINITIALISED, true, "AutomationCompositionElement result"); final var automationCompositionResultMap = Map.of(UUID.randomUUID(), acElementResult); 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 8125c37d7..c1be28958 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 @@ -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. @@ -65,7 +65,6 @@ class AutomationCompositionUpdateTest { var participantId = CommonTestData.getParticipantId(); acElement.setParticipantId(participantId); - acElement.setParticipantType(id); var property = new ToscaProperty(); property.setName("test"); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java index 3594755b8..32f9b2462 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.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. @@ -61,11 +61,7 @@ class ParticipantAckMessageTest { @Test void testAppliesTo_NullParticipantId() { message = makeMessage(); - - assertThatThrownBy(() -> message.appliesTo(null, null)).isInstanceOf(NullPointerException.class); - assertThatThrownBy(() -> message.appliesTo(PTYPE_456, null)).isInstanceOf(NullPointerException.class); - var participantId = CommonTestData.getParticipantId(); - assertThatThrownBy(() -> message.appliesTo(null, participantId)).isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> message.appliesTo(null)).isInstanceOf(NullPointerException.class); } @Test @@ -73,9 +69,8 @@ class ParticipantAckMessageTest { message = makeMessage(); // ParticipantId matches - assertTrue(message.appliesTo(PTYPE_456, CommonTestData.getParticipantId())); - assertFalse(message.appliesTo(PTYPE_456, CommonTestData.getRndParticipantId())); - assertFalse(message.appliesTo(PTYPE_457, CommonTestData.getParticipantId())); + assertTrue(message.appliesTo(CommonTestData.getParticipantId())); + assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); } @Test @@ -83,18 +78,13 @@ class ParticipantAckMessageTest { message = makeMessage(); // ParticipantId does not match - ToscaConceptIdentifier id = new ToscaConceptIdentifier(); - id.setName("id1111"); - id.setVersion("3.2.1"); - assertFalse(message.appliesTo(id, CommonTestData.getRndParticipantId())); - message.setParticipantType(null); - assertTrue(message.appliesTo(id, CommonTestData.getRndParticipantId())); + assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); + assertTrue(message.appliesTo(CommonTestData.getParticipantId())); } private ParticipantAckMessage makeMessage() { ParticipantAckMessage msg = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK); - msg.setParticipantType(PTYPE_456); msg.setParticipantId(CommonTestData.getParticipantId()); msg.setMessage("Successfull Ack"); msg.setResult(true); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java index dec168232..91d3ffacb 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.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. @@ -50,7 +50,6 @@ class ParticipantDeregisterTest { id.setVersion("1.2.3"); orig.setAutomationCompositionId(UUID.randomUUID()); orig.setParticipantId(CommonTestData.getParticipantId()); - orig.setParticipantType(id); orig.setMessageId(UUID.randomUUID()); orig.setTimestamp(Instant.ofEpochMilli(3000)); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java index 42c3152c3..96d3ac8a3 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java @@ -65,10 +65,7 @@ class ParticipantMessageTest { void testAppliesTo_NullParticipantId() { message = makeMessage(); - assertThatThrownBy(() -> message.appliesTo(null, null)).isInstanceOf(NullPointerException.class); - assertThatThrownBy(() -> message.appliesTo(PTYPE_456, null)).isInstanceOf(NullPointerException.class); - var participantId = CommonTestData.getParticipantId(); - assertThatThrownBy(() -> message.appliesTo(null, participantId)).isInstanceOf(NullPointerException.class); + assertThatThrownBy(() -> message.appliesTo(null)).isInstanceOf(NullPointerException.class); } @Test @@ -76,28 +73,20 @@ class ParticipantMessageTest { message = makeMessage(); // ParticipantId matches - assertTrue(message.appliesTo(PTYPE_456, CommonTestData.getParticipantId())); - assertFalse(message.appliesTo(PTYPE_456, CommonTestData.getRndParticipantId())); - assertFalse(message.appliesTo(PTYPE_457, CommonTestData.getParticipantId())); + assertTrue(message.appliesTo(CommonTestData.getParticipantId())); + assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); } @Test void testAppliesTo_ParticipantIdNoMatch() { message = makeMessage(); - - // ParticipantId does not match - var id = new ToscaConceptIdentifier(); - id.setName("id1111"); - id.setVersion("3.2.1"); - assertFalse(message.appliesTo(id, CommonTestData.getRndParticipantId())); - message.setParticipantType(null); - assertTrue(message.appliesTo(id, CommonTestData.getRndParticipantId())); + assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); + assertTrue(message.appliesTo(CommonTestData.getParticipantId())); } private ParticipantMessage makeMessage() { var msg = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); - msg.setParticipantType(PTYPE_456); msg.setParticipantId(CommonTestData.getParticipantId()); msg.setMessageId(UUID.randomUUID()); msg.setTimestamp(Instant.ofEpochMilli(3000)); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java index af1b9e692..fc73dffd6 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.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. @@ -50,7 +50,6 @@ class ParticipantRegisterTest { id.setVersion("1.2.3"); orig.setAutomationCompositionId(UUID.randomUUID()); orig.setParticipantId(CommonTestData.getParticipantId()); - orig.setParticipantType(id); orig.setMessageId(UUID.randomUUID()); orig.setTimestamp(Instant.ofEpochMilli(3000)); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java index 5cbbc2c5d..c5687ac19 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.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. @@ -43,7 +43,6 @@ class ParticipantStatusReqTest { // verify with all values orig.setParticipantId(CommonTestData.getParticipantId()); orig.setAutomationCompositionId(null); - orig.setParticipantType(null); orig.setMessageId(UUID.randomUUID()); orig.setTimestamp(Instant.ofEpochMilli(3000)); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java index 8675d24ff..feeb692e1 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java @@ -57,7 +57,6 @@ class ParticipantStatusTest { var participantId = CommonTestData.getParticipantId(); orig.setParticipantId(participantId); var type = new ToscaConceptIdentifier("type", "2.3.4"); - orig.setParticipantType(type); orig.setMessageId(UUID.randomUUID()); orig.setState(ParticipantState.ON_LINE); orig.setTimestamp(Instant.ofEpochMilli(3000)); @@ -67,7 +66,6 @@ class ParticipantStatusTest { var participantDefinitionUpdate = new ParticipantDefinition(); participantDefinitionUpdate.setParticipantId(participantId); - participantDefinitionUpdate.setParticipantType(type); var acDefinition = getAcElementDefinition(new ToscaConceptIdentifier("id", "1.2.3")); participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition)); orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate)); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java index 7d57afc3f..ffbd63f1a 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.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. @@ -49,8 +49,6 @@ class ParticipantUpdateTest { // verify with all values orig.setAutomationCompositionId(UUID.randomUUID()); orig.setParticipantId(CommonTestData.getParticipantId()); - var type = new ToscaConceptIdentifier("id", "1.2.3"); - orig.setParticipantType(type); orig.setMessageId(UUID.randomUUID()); orig.setTimestamp(Instant.ofEpochMilli(3000)); @@ -67,7 +65,7 @@ class ParticipantUpdateTest { toscaNodeTemplate.setVersion("1.2.3"); var participantDefinitionUpdate = new ParticipantDefinition(); - participantDefinitionUpdate.setParticipantType(type); + var type = new ToscaConceptIdentifier("id", "1.2.3"); var acDefinition = getAcElementDefinition(type); participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition)); orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate)); 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 460f3ab4b..83e13c74a 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 @@ -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. @@ -72,30 +72,21 @@ class JpaAutomationCompositionElementTest { }).hasMessageMatching(NULL_ELEMENT_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, null, null, null, null); + new JpaAutomationCompositionElement(null, null, null, null); }).hasMessageMatching(NULL_ELEMENT_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement("key", null, null, null, AutomationCompositionState.UNINITIALISED); + new JpaAutomationCompositionElement("key", null, null, AutomationCompositionState.UNINITIALISED); }).hasMessageMatching(NULL_INSTANCE_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement("key", "key", null, new PfConceptKey("participant", "0.0.1"), null); - }).hasMessageMatching("definition" + NULL_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), null, - AutomationCompositionState.UNINITIALISED); - }).hasMessageMatching("participantType" + NULL_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), new PfConceptKey(), null); + new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), null); }).hasMessageMatching("state" + NULL_ERROR); assertNotNull(new JpaAutomationCompositionElement()); assertNotNull(new JpaAutomationCompositionElement("key", "key")); - assertNotNull(new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), - new PfConceptKey("participant", "0.0.1"), AutomationCompositionState.UNINITIALISED)); + assertNotNull(new JpaAutomationCompositionElement("key", "key", + new PfConceptKey(), AutomationCompositionState.UNINITIALISED)); } @Test @@ -198,10 +189,9 @@ class JpaAutomationCompositionElementTest { testJpaAutomationCompositionElement.setState(AutomationCompositionState.UNINITIALISED); assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); - testJpaAutomationCompositionElement.setParticipantType(new PfConceptKey("dummy", "0.0.1")); - assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); - testJpaAutomationCompositionElement.setParticipantType(new PfConceptKey("participantType", "0.0.1")); assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); + testJpaAutomationCompositionElement.setParticipantId(UUID.randomUUID().toString()); + assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); assertEquals(testJpaAutomationCompositionElement, new JpaAutomationCompositionElement(testJpaAutomationCompositionElement)); @@ -250,7 +240,6 @@ class JpaAutomationCompositionElementTest { var automationCompositionElement = new AutomationCompositionElement(); automationCompositionElement.setId(UUID.fromString(ELEMENT_ID)); automationCompositionElement.setDefinition(new ToscaConceptIdentifier("aceDef", "0.0.1")); - automationCompositionElement.setParticipantType(new ToscaConceptIdentifier("participantType", "0.0.1")); automationCompositionElement.setParticipantId(CommonTestData.getParticipantId()); automationCompositionElement.setProperties(Map.of("key", "{}")); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java index f293085c3..1ad757fcb 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java @@ -33,7 +33,6 @@ import java.util.UUID; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.models.acm.concepts.Participant; import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Test the {@link JpaParticipant} class. @@ -159,7 +158,6 @@ class JpaParticipantTest { private Participant createParticipantInstance() { var testParticipant = new Participant(); testParticipant.setParticipantId(UUID.randomUUID()); - testParticipant.setParticipantType(new ToscaConceptIdentifier("participantTypeName", "0.0.1")); testParticipant.setParticipantSupportedElementTypes(new LinkedHashMap<>()); return testParticipant; diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java index c659f5ae2..c5acada59 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.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. @@ -67,7 +67,6 @@ class AcmUtilsTest { assertNotEquals(participantId, participantUpdates.get(0).getParticipantId()); acElement.setParticipantId(participantId); - acElement.setParticipantType(TYPE); AcmUtils.prepareParticipantUpdate(acElement, participantUpdates); assertEquals(participantId, participantUpdates.get(1).getParticipantId()); } diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java index 3b74066bd..8041a4ea5 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java @@ -30,7 +30,6 @@ import org.onap.policy.common.endpoints.parameters.TopicParameters; 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.models.tosca.authorative.concepts.ToscaConceptIdentifier; public class CommonTestData { @@ -104,7 +103,6 @@ public class CommonTestData { map.put("reportingTimeIntervalMs", TIME_INTERVAL); map.put("description", DESCRIPTION); map.put("participantId", getParticipantId()); - map.put("participantType", getParticipantType()); map.put("clampAutomationCompositionTopics", getTopicParametersMap(false)); map.put("participantSupportedElementTypes", new ArrayList<>()); } @@ -113,18 +111,6 @@ public class CommonTestData { } /** - * Returns participantType for test cases. - * - * @return participant Type - */ - public static ToscaConceptIdentifier getParticipantType() { - final var participantId = new ToscaConceptIdentifier(); - participantId.setName("K8sParticipant0"); - participantId.setVersion("1.0.0"); - return participantId; - } - - /** * Returns participantId for test cases. * * @return participant Id diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java index 6d52d7a94..555183227 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.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"); @@ -46,7 +46,6 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUp import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck; 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; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; @@ -70,7 +69,6 @@ class ParticipantMessagesTest { final ParticipantRegister participantRegisterMsg = new ParticipantRegister(); participantRegisterMsg.setParticipantId(CommonTestData.getParticipantId()); participantRegisterMsg.setTimestamp(Instant.now()); - participantRegisterMsg.setParticipantType(getParticipantType()); synchronized (lockit) { ParticipantMessagePublisher participantMessagePublisher = @@ -101,7 +99,6 @@ class ParticipantMessagesTest { final ParticipantDeregister participantDeregisterMsg = new ParticipantDeregister(); participantDeregisterMsg.setParticipantId(CommonTestData.getParticipantId()); participantDeregisterMsg.setTimestamp(Instant.now()); - participantDeregisterMsg.setParticipantType(getParticipantType()); synchronized (lockit) { ParticipantMessagePublisher participantMessagePublisher = @@ -164,8 +161,4 @@ class ParticipantMessagesTest { assertThatCode(() -> publisher.sendHeartbeat(heartbeat)).doesNotThrowAnyException(); } } - - private ToscaConceptIdentifier getParticipantType() { - return new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"); - } } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java index 925214ec1..c99097efa 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java @@ -29,7 +29,6 @@ import org.onap.policy.common.endpoints.parameters.TopicParameters; 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.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to hold/create all parameters for test cases. @@ -123,7 +122,6 @@ public class CommonTestData { map.put("reportingTimeIntervalMs", TIME_INTERVAL); map.put("description", DESCRIPTION); map.put("participantId", getParticipantId()); - map.put("participantType", getParticipantType()); map.put("clampAutomationCompositionTopics", getTopicParametersMap(false)); map.put("participantSupportedElementTypes", new ArrayList<>()); } @@ -160,16 +158,6 @@ public class CommonTestData { } /** - * Returns participantType for test cases. - * - * @return participant Type - */ - public static ToscaConceptIdentifier getParticipantType() { - return new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0"); - } - - - /** * Returns participantId for test cases. * * @return participant Id diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java index 31d62c70e..b7058a84f 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.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. @@ -32,7 +32,6 @@ import org.onap.policy.clamp.acm.participant.policy.main.parameters.CommonTestDa import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; import org.onap.policy.common.utils.coder.YamlJsonTranslator; import org.onap.policy.common.utils.resources.ResourceUtils; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,12 +50,9 @@ public final class TestListenerUtils { public static ParticipantUpdate createParticipantUpdateMsg() { final var participantUpdateMsg = new ParticipantUpdate(); var participantId = CommonTestData.getParticipantId(); - var participantType = - new ToscaConceptIdentifier("org.onap.policy.acm.PolicyAutomationCompositionParticipant", "2.3.1"); participantUpdateMsg.setParticipantId(participantId); participantUpdateMsg.setTimestamp(Instant.now()); - participantUpdateMsg.setParticipantType(participantType); participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000)); participantUpdateMsg.setMessageId(UUID.randomUUID()); diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java index 49b16d23d..422fc3e23 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.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"); @@ -58,7 +58,6 @@ import org.springframework.stereotype.Component; public class AutomationCompositionHandler { private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionHandler.class); - private final ToscaConceptIdentifier participantType; private final UUID participantId; private final ParticipantMessagePublisher publisher; @@ -78,7 +77,6 @@ public class AutomationCompositionHandler { * @param publisher the ParticipantMessage Publisher */ public AutomationCompositionHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher) { - this.participantType = parameters.getIntermediaryParameters().getParticipantType(); this.participantId = parameters.getIntermediaryParameters().getParticipantId(); this.publisher = publisher; } @@ -125,7 +123,6 @@ public class AutomationCompositionHandler { var automationCompositionStateChangeAck = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK); automationCompositionStateChangeAck.setParticipantId(participantId); - automationCompositionStateChangeAck.setParticipantType(participantType); automationCompositionStateChangeAck.setAutomationCompositionId(automationCompositionId); acElement.setOrderedState(orderedState); acElement.setState(newState); @@ -160,7 +157,6 @@ public class AutomationCompositionHandler { var automationCompositionAck = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK); automationCompositionAck.setParticipantId(participantId); - automationCompositionAck.setParticipantType(participantType); automationCompositionAck.setMessage("Automation composition " + stateChangeMsg.getAutomationCompositionId() + " does not use this participant " + participantId); automationCompositionAck.setResult(false); @@ -212,7 +208,7 @@ public class AutomationCompositionHandler { public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg, List<AutomationCompositionElementDefinition> acElementDefinitions) { - if (!updateMsg.appliesTo(participantType, participantId)) { + if (!updateMsg.appliesTo(participantId)) { return; } @@ -234,7 +230,6 @@ public class AutomationCompositionHandler { var automationCompositionUpdateAck = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK); automationCompositionUpdateAck.setParticipantId(participantId); - automationCompositionUpdateAck.setParticipantType(participantType); automationCompositionUpdateAck.setMessage("Automation composition " + updateMsg.getAutomationCompositionId() + " already defined on participant " + participantId); @@ -267,7 +262,7 @@ public class AutomationCompositionHandler { var acElementList = updateMsg.getParticipantUpdatesList().stream() .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream()) - .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList()); + .filter(element -> participantId.equals(element.getParticipantId())).collect(Collectors.toList()); handleAutomationCompositionElementUpdate(acElementList, acElementDefinitions, updateMsg.getStartPhase(), updateMsg.getAutomationCompositionId()); @@ -311,7 +306,7 @@ public class AutomationCompositionHandler { List<ParticipantUpdates> participantUpdates) { var acElementList = participantUpdates.stream() .flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream()) - .filter(element -> participantType.equals(element.getParticipantType())).collect(Collectors.toList()); + .filter(element -> participantId.equals(element.getParticipantId())).collect(Collectors.toList()); for (var element : acElementList) { elementsOnThisParticipant.put(element.getId(), element); @@ -393,7 +388,6 @@ public class AutomationCompositionHandler { var automationCompositionAck = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK); automationCompositionAck.setParticipantId(participantId); - automationCompositionAck.setParticipantType(participantType); automationCompositionAck.setMessage("Automation composition is already in state " + orderedState); automationCompositionAck.setResult(false); automationCompositionAck.setAutomationCompositionId(automationComposition.getInstanceId()); diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java index 7e881b59d..f324cea0c 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java @@ -48,7 +48,6 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantSt import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Component; @@ -61,9 +60,6 @@ public class ParticipantHandler { private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantHandler.class); @Getter - private final ToscaConceptIdentifier participantType; - - @Getter private final UUID participantId; private final AutomationCompositionHandler automationCompositionHandler; @@ -81,7 +77,6 @@ public class ParticipantHandler { */ public ParticipantHandler(ParticipantParameters parameters, ParticipantMessagePublisher publisher, AutomationCompositionHandler automationCompositionHandler) { - this.participantType = parameters.getIntermediaryParameters().getParticipantType(); this.participantId = parameters.getIntermediaryParameters().getParticipantId(); this.publisher = publisher; this.automationCompositionHandler = automationCompositionHandler; @@ -133,7 +128,7 @@ public class ParticipantHandler { * @return true if it applies, false otherwise */ public boolean appliesTo(ParticipantMessage participantMsg) { - return participantMsg.appliesTo(participantType, participantId); + return participantMsg.appliesTo(participantId); } /** @@ -143,7 +138,7 @@ public class ParticipantHandler { * @return true if it applies, false otherwise */ public boolean appliesTo(ParticipantAckMessage participantMsg) { - return participantMsg.appliesTo(participantType, participantId); + return participantMsg.appliesTo(participantId); } /** @@ -152,7 +147,6 @@ public class ParticipantHandler { public void sendParticipantRegister() { var participantRegister = new ParticipantRegister(); participantRegister.setParticipantId(participantId); - participantRegister.setParticipantType(participantType); participantRegister.setParticipantSupportedElementType(supportedAcElementTypes); publisher.sendParticipantRegister(participantRegister); @@ -176,7 +170,6 @@ public class ParticipantHandler { public void sendParticipantDeregister() { var participantDeregister = new ParticipantDeregister(); participantDeregister.setParticipantId(participantId); - participantDeregister.setParticipantType(participantType); publisher.sendParticipantDeregister(participantDeregister); } @@ -206,7 +199,7 @@ public class ParticipantHandler { if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) { // This message is to commission the automation composition for (var participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) { - if (participantDefinition.getParticipantType().equals(participantType)) { + if (participantDefinition.getParticipantId().equals(participantId)) { acElementDefsMap.get(participantUpdateMsg.getCompositionId()) .addAll(participantDefinition.getAutomationCompositionElementDefinitionList()); break; @@ -228,7 +221,6 @@ public class ParticipantHandler { participantUpdateAck.setMessage("Participant Update Ack message"); participantUpdateAck.setResult(true); participantUpdateAck.setParticipantId(participantId); - participantUpdateAck.setParticipantType(participantType); participantUpdateAck.setState(ParticipantState.ON_LINE); publisher.sendParticipantUpdateAck(participantUpdateAck); } @@ -246,7 +238,6 @@ public class ParticipantHandler { public ParticipantStatus makeHeartbeat(boolean responseToParticipantStatusReq) { var heartbeat = new ParticipantStatus(); heartbeat.setParticipantId(participantId); - heartbeat.setParticipantType(participantType); heartbeat.setState(ParticipantState.ON_LINE); heartbeat.setAutomationCompositionInfoList(getAutomationCompositionInfoList()); @@ -255,7 +246,6 @@ public class ParticipantHandler { for (var acElementDefsOnThisParticipant : acElementDefsMap.values()) { var participantDefinition = new ParticipantDefinition(); participantDefinition.setParticipantId(participantId); - participantDefinition.setParticipantType(participantType); participantDefinition.setAutomationCompositionElementDefinitionList(acElementDefsOnThisParticipant); participantDefinitionList.add(participantDefinition); } diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java index 8f32c6f9a..77a578ea8 100644 --- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java +++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java @@ -31,7 +31,6 @@ import lombok.Setter; import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; import org.onap.policy.common.parameters.validation.ParameterGroupConstraint; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** * Class to hold all parameters needed for participant component. @@ -48,11 +47,6 @@ public class ParticipantIntermediaryParameters { @NotBlank private String description; - // The participant type of this participant - @NotNull - @Valid - private ToscaConceptIdentifier participantType; - // The time interval for periodic reporting of status to the CLAMP ACM server @Valid @Positive diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java index dc9e3d307..6698ef9a8 100644 --- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java +++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.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. @@ -146,7 +146,6 @@ class AutomationCompositionHandlerTest { var participantUpdate = new ParticipantUpdates(); participantUpdate.setParticipantId(partecipantId); var element = new AutomationCompositionElement(); - element.setParticipantType(definition); element.setDefinition(definition); participantUpdate.setAutomationCompositionElementList(List.of(element)); updateMsg.setParticipantUpdatesList(List.of(participantUpdate)); @@ -189,5 +188,4 @@ class AutomationCompositionHandlerTest { stateChangePassive.setParticipantId(CommonTestData.getRndParticipantId()); assertDoesNotThrow(() -> ach.handleAutomationCompositionStateChange(stateChangePassive, List.of())); } - } diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java index 8e65abffb..c538a0248 100644 --- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java +++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.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. @@ -38,7 +38,6 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMe import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType; import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate; import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; class ParticipantHandlerTest { @@ -61,12 +60,10 @@ class ParticipantHandlerTest { var participantHandler = commonTestData.getMockParticipantHandler(); - var participantType = new ToscaConceptIdentifier(ID_NAME, ID_VERSION); var participantId = CommonTestData.getParticipantId(); participantUpdateMsg.setAutomationCompositionId(CommonTestData.AC_ID_1); participantUpdateMsg.setCompositionId(CommonTestData.AC_ID_1); participantUpdateMsg.setParticipantId(participantId); - participantUpdateMsg.setParticipantType(participantType); participantUpdateMsg.setMessageId(UUID.randomUUID()); participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000)); @@ -90,7 +87,6 @@ class ParticipantHandlerTest { private ParticipantUpdate setListParticipantDefinition(ParticipantUpdate participantUpdateMsg) { var def = new ParticipantDefinition(); def.setParticipantId(CommonTestData.getParticipantId()); - def.setParticipantType(new ToscaConceptIdentifier(ID_NAME, ID_VERSION)); participantUpdateMsg.setParticipantDefinitionUpdates(List.of(def)); return participantUpdateMsg; } @@ -106,8 +102,8 @@ class ParticipantHandlerTest { new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATUS); assertTrue(participantHandler.appliesTo(participantMsg)); - var emptyid = new ToscaConceptIdentifier("", ID_VERSION); - participantMsg.setParticipantType(emptyid); + var randomId = UUID.randomUUID(); + participantMsg.setParticipantId(randomId); assertFalse(participantHandler.appliesTo(participantMsg)); } diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java index 45703848e..9641edc2e 100644 --- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java +++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java @@ -113,7 +113,6 @@ public class CommonTestData { map.put("name", name); map.put("participantId", getParticipantId()); map.put("description", DESCRIPTION); - map.put("participantType", getDefinition()); map.put("reportingTimeIntervalMs", TIME_INTERVAL); map.put("clampAutomationCompositionTopics", getTopicParametersMap(false)); map.put("participantSupportedElementTypes", new ArrayList<>()); 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; } |