Remove participantType and references 19/133019/2
authorsaul.gill <saul.gill@est.tech>
Mon, 23 Jan 2023 17:44:13 +0000 (17:44 +0000)
committersaul.gill <saul.gill@est.tech>
Thu, 26 Jan 2023 09:27:28 +0000 (09:27 +0000)
Issue-ID: POLICY-4538
Change-Id: Idf3f0308254a318b3e72aa8a234fd7c78f6ffd82
Signed-off-by: saul.gill <saul.gill@est.tech>
41 files changed:
models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java
models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java
models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtils.java
models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java
models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java
models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java
models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUtilsTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java
models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java
participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java
participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java

index bea2278..b153ef5 100644 (file)
@@ -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.
@@ -46,9 +46,6 @@ public class AutomationCompositionElement {
     @NonNull
     private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
 
-    @NonNull
-    private ToscaConceptIdentifier participantType = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
-
     @NonNull
     private UUID participantId = UUID.randomUUID();
 
@@ -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;
index 8503516..c045c92 100644 (file)
@@ -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.
@@ -44,9 +43,6 @@ public class Participant {
     @NonNull
     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);
index aff6198..d3e800c 100644 (file)
@@ -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);
index 9d26ce4..015a96a 100644 (file)
@@ -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.
 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;
 
@@ -39,24 +35,6 @@ public final class ParticipantUtils {
     private static final String AUTOMATION_COMPOSITION_ELEMENT =
         "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.
      *
@@ -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;
     }
index 8d847f8..bdb2be8 100644 (file)
@@ -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.
@@ -47,11 +46,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.
      */
@@ -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;
         }
index 525dab7..81eda8c 100644 (file)
@@ -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
@@ -47,11 +46,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.
      */
@@ -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;
         }
index 23fc0a9..743bb7f 100644 (file)
@@ -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;
index b7e95cf..0674873 100644 (file)
@@ -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);
     }
 }
index 220a3c1..8bd9039 100644 (file)
@@ -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;
index 77b3ccc..b3efc27 100644 (file)
@@ -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;
 
@@ -46,13 +45,6 @@ class ParticipantUtilsTest {
     private static final String PARTICIPANT_AUTOMATION_COMPOSITION_ELEMENT = "org.onap.policy.clamp.acm.Participant";
     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;
index cfae1b1..8c5528c 100644 (file)
@@ -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);
index 8125c37..c1be289 100644 (file)
@@ -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");
index 3594755..32f9b24 100644 (file)
@@ -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);
index dec1682..91d3ffa 100644 (file)
@@ -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));
 
index 42c3152..96d3ac8 100644 (file)
@@ -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));
index af1b9e6..fc73dff 100644 (file)
@@ -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));
 
index 5cbbc2c..c5687ac 100644 (file)
@@ -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));
 
index 8675d24..feeb692 100644 (file)
@@ -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));
index 7d57afc..ffbd63f 100644 (file)
@@ -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));
index 460f3ab..83e13c7 100644 (file)
@@ -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", "{}"));
 
index f293085..1ad757f 100644 (file)
@@ -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;
index c659f5a..c5acada 100644 (file)
@@ -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());
     }
index 3b74066..8041a4e 100644 (file)
@@ -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<>());
         }
@@ -112,18 +110,6 @@ public class CommonTestData {
         return map;
     }
 
-    /**
-     * 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.
      *
index 6d52d7a..5551832 100644 (file)
@@ -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");
-    }
 }
index 925214e..c99097e 100644 (file)
@@ -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<>());
         }
@@ -159,16 +157,6 @@ public class CommonTestData {
         return topicParams;
     }
 
-    /**
-     * 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.
      *
index 31d62c7..b7058a8 100644 (file)
@@ -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());
 
index 49b16d2..422fc3e 100644 (file)
@@ -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());
index 7e881b5..f324cea 100644 (file)
@@ -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;
@@ -60,9 +59,6 @@ import org.springframework.stereotype.Component;
 public class ParticipantHandler {
     private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantHandler.class);
 
-    @Getter
-    private final ToscaConceptIdentifier participantType;
-
     @Getter
     private final UUID participantId;
 
@@ -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);
             }
index 8f32c6f..77a578e 100644 (file)
@@ -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
index dc9e3d3..6698ef9 100644 (file)
@@ -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()));
     }
-
 }
index 8e65abf..c538a02 100644 (file)
@@ -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));
 
     }
index 4570384..9641edc 100644 (file)
@@ -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<>());
index 53288d1..b7e7644 100644 (file)
@@ -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);
index f585436..75fed71 100644 (file)
@@ -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);
index 3cadff6..cbdba53 100644 (file)
@@ -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);
index 504ddc2..e4bfedd 100644 (file)
@@ -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);
             }
         }
index 1033211..aa89059 100644 (file)
@@ -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),
index 9463d79..b53a17e 100644 (file)
@@ -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);
index 683dd53..936555a 100644 (file)
@@ -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));
index d9c4ed6..5ea3bea 100644 (file)
@@ -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();
index 7d80228..b991409 100644 (file)
@@ -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;
     }