diff options
Diffstat (limited to 'models/src')
22 files changed, 56 insertions, 209 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()); } |