summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/Participant.java25
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDefinition.java3
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java4
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipant.java100
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java5
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java21
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaParticipantTest.java122
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java23
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/CommonTestData.java17
-rwxr-xr-xpackages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml4
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml4
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml4
-rw-r--r--packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml4
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml4
-rwxr-xr-xparticipant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml4
-rw-r--r--participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml4
-rw-r--r--participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml4
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml4
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java18
-rw-r--r--participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml4
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java5
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml4
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java2
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java3
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java15
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java23
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java7
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java4
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java4
-rw-r--r--runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json15
-rw-r--r--runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml12
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java3
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java7
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java17
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationComposition.json15
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json5
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json15
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json15
48 files changed, 166 insertions, 433 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 e5c85dd10..bea2278a8 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
@@ -50,7 +50,7 @@ public class AutomationCompositionElement {
private ToscaConceptIdentifier participantType = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
@NonNull
- private ToscaConceptIdentifier participantId = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
+ private UUID participantId = UUID.randomUUID();
@NonNull
private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
@@ -75,7 +75,7 @@ public class AutomationCompositionElement {
this.id = otherElement.id;
this.definition = new ToscaConceptIdentifier(otherElement.definition);
this.participantType = new ToscaConceptIdentifier(otherElement.participantType);
- this.participantId = new ToscaConceptIdentifier(otherElement.participantId);
+ this.participantId = otherElement.participantId;
this.state = otherElement.state;
this.orderedState = otherElement.orderedState;
this.toscaServiceTemplateFragment = otherElement.toscaServiceTemplateFragment;
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 56c01837f..4741bafca 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
@@ -26,22 +26,18 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
-import org.onap.policy.models.base.PfConceptKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaEntity;
/**
* Class to represent details of a running participant instance.
*/
@NoArgsConstructor
@Data
-@EqualsAndHashCode(callSuper = true)
-public class Participant extends ToscaEntity implements Comparable<Participant> {
+@EqualsAndHashCode
+public class Participant {
@NonNull
private UUID participantId;
- @NonNull
- private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
@NonNull
private ParticipantState participantState = ParticipantState.ON_LINE;
@@ -52,29 +48,12 @@ public class Participant extends ToscaEntity implements Comparable<Participant>
@NonNull
private Map<UUID, ParticipantSupportedElementType> participantSupportedElementTypes;
- @Override
- public String getType() {
- return definition.getName();
- }
-
- @Override
- public String getTypeVersion() {
- return definition.getVersion();
- }
-
- @Override
- public int compareTo(final Participant other) {
- return compareNameVersion(this, other);
- }
-
/**
* Copy constructor.
*
* @param otherParticipant the participant to copy from
*/
public Participant(Participant otherParticipant) {
- super(otherParticipant);
- this.definition = new ToscaConceptIdentifier(otherParticipant.definition);
this.participantState = otherParticipant.participantState;
this.participantType = otherParticipant.participantType;
this.participantId = otherParticipant.participantId;
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 949a7c47d..aff619873 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
@@ -22,6 +22,7 @@ package org.onap.policy.clamp.models.acm.concepts;
import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -38,7 +39,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@ToString
public class ParticipantDefinition {
- private ToscaConceptIdentifier participantId;
+ private UUID participantId;
private ToscaConceptIdentifier participantType;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java
index 1872a6144..031fd5c02 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java
@@ -22,12 +22,12 @@ package org.onap.policy.clamp.models.acm.concepts;
import java.util.ArrayList;
import java.util.List;
+import java.util.UUID;
import lombok.Data;
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.
@@ -38,7 +38,7 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@ToString
public class ParticipantUpdates {
- private ToscaConceptIdentifier participantId;
+ private UUID participantId;
// List of AutomationCompositionElement values for a particular participant
private List<AutomationCompositionElement> automationCompositionElementList = new ArrayList<>();
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 c6d56904d..8d847f8d4 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
@@ -55,7 +55,7 @@ public class ParticipantAckMessage {
/**
* Participant ID, or {@code null} for messages from participants.
*/
- private ToscaConceptIdentifier participantId;
+ private UUID participantId;
/**
* Participant State, or {@code null} for messages from participants.
@@ -94,7 +94,7 @@ public class ParticipantAckMessage {
* @return {@code true} if this message applies to this participant, {@code false} otherwise
*/
public boolean appliesTo(@NonNull final ToscaConceptIdentifier participantType,
- @NonNull final ToscaConceptIdentifier participantId) {
+ @NonNull final UUID participantId) {
// Broadcast message to all participants
if (this.participantType == 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 c1ef4b416..525dab75f 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
@@ -55,7 +55,7 @@ public class ParticipantMessage {
/**
* Participant ID, or {@code null} for messages from participants.
*/
- private ToscaConceptIdentifier participantId;
+ private UUID participantId;
/**
* Automation Composition ID, or {@code null} for messages to participants.
@@ -94,7 +94,7 @@ public class ParticipantMessage {
* @return {@code true} if this message applies to this participant, {@code false} otherwise
*/
public boolean appliesTo(@NonNull final ToscaConceptIdentifier participantType,
- @NonNull final ToscaConceptIdentifier participantId) {
+ @NonNull final UUID participantId) {
// Broadcast message to all participants
if (this.participantType == 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 79576f6eb..23fc0a93e 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
@@ -85,11 +85,9 @@ public class JpaAutomationCompositionElement extends Validated
@AttributeOverride(name = "version", column = @Column(name = "participant_type_version"))
private PfConceptKey participantType;
+ @Column
@NotNull
- @AttributeOverride(name = "name", column = @Column(name = "participant_name"))
- @AttributeOverride(name = "version", column = @Column(name = "participant_version"))
- private PfConceptKey participantId;
- // @formatter:on
+ private String participantId;
@Column
@NotNull
@@ -154,7 +152,7 @@ public class JpaAutomationCompositionElement extends Validated
this.instanceId = copyConcept.instanceId;
this.definition = new PfConceptKey(copyConcept.definition);
this.participantType = new PfConceptKey(copyConcept.participantType);
- this.participantId = new PfConceptKey(copyConcept.participantId);
+ this.participantId = copyConcept.participantId;
this.state = copyConcept.state;
this.orderedState = copyConcept.orderedState;
this.description = copyConcept.description;
@@ -177,7 +175,7 @@ public class JpaAutomationCompositionElement extends Validated
element.setId(UUID.fromString(elementId));
element.setDefinition(new ToscaConceptIdentifier(definition));
element.setParticipantType(new ToscaConceptIdentifier(participantType));
- element.setParticipantId(new ToscaConceptIdentifier(participantId));
+ element.setParticipantId(UUID.fromString(participantId));
element.setState(state);
element.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
element.setDescription(description);
@@ -190,7 +188,7 @@ public class JpaAutomationCompositionElement extends Validated
public void fromAuthorative(@NonNull final AutomationCompositionElement element) {
this.definition = element.getDefinition().asConceptKey();
this.participantType = element.getParticipantType().asConceptKey();
- this.participantId = element.getParticipantId().asConceptKey();
+ this.participantId = element.getParticipantId().toString();
this.state = element.getState();
this.orderedState = element.getOrderedState();
this.description = element.getDescription();
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 7d043ace0..b7e95cfa7 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
@@ -28,10 +28,10 @@ import java.util.UUID;
import javax.persistence.AttributeOverride;
import javax.persistence.CascadeType;
import javax.persistence.Column;
-import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
+import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
@@ -46,10 +46,8 @@ 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.PfConcept;
import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.base.PfKey;
-import org.onap.policy.models.base.validation.annotations.VerifyKey;
+import org.onap.policy.models.base.Validated;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -62,28 +60,16 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
@Data
@EqualsAndHashCode(callSuper = false)
-public class JpaParticipant extends PfConcept implements PfAuthorative<Participant>, Serializable {
+public class JpaParticipant extends Validated
+ implements PfAuthorative<Participant>, Comparable<JpaParticipant>, Serializable {
private static final long serialVersionUID = -4697758484642403483L;
- @Column
+ @Id
@NotNull
private String participantId;
- @EmbeddedId
- @VerifyKey
- @NotNull
- private PfConceptKey key;
-
- // @formatter:off
- @VerifyKey
@NotNull
- @AttributeOverride(name = "name", column = @Column(name = "definition_name"))
- @AttributeOverride(name = "version", column = @Column(name = "definition_version"))
- private PfConceptKey definition;
- // @formatter:on
-
- @NotNull
- @AttributeOverride(name = "name", column = @Column(name = "participant_type_name"))
+ @AttributeOverride(name = "name", column = @Column(name = "participant_type_name"))
@AttributeOverride(name = "version", column = @Column(name = "participant_type_version"))
private PfConceptKey participantType;
@@ -104,36 +90,20 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
* The Default Constructor creates a {@link JpaParticipant} object with a null key.
*/
public JpaParticipant() {
- this(new PfConceptKey());
- }
-
- /**
- * The Key Constructor creates a {@link JpaParticipant} object with the given concept key.
- *
- * @param key the key
- */
- public JpaParticipant(@NonNull final PfConceptKey key) {
- this(UUID.randomUUID().toString(), key, new PfConceptKey(), ParticipantState.ON_LINE, new ArrayList<>());
+ this(UUID.randomUUID().toString(), ParticipantState.ON_LINE, new ArrayList<>());
}
/**
* The Key Constructor creates a {@link JpaParticipant} object with all mandatory fields.
*
* @param participantId the participant id
- * @param key the key
- * @param definition the TOSCA definition of the participant
* @param participantState the state of the participant
*/
- public JpaParticipant(@NotNull String participantId,
- @NonNull final PfConceptKey key,
- @NonNull final PfConceptKey definition,
- @NonNull final ParticipantState participantState,
- @NonNull final List<JpaParticipantSupportedElementType> supportedAcElementTypes) {
- this.key = key;
- this.definition = definition;
- this.participantState = participantState;
+ public JpaParticipant(@NonNull String participantId, @NonNull final ParticipantState participantState,
+ @NonNull final List<JpaParticipantSupportedElementType> supportedElements) {
this.participantId = participantId;
- this.supportedElements = supportedAcElementTypes;
+ this.participantState = participantState;
+ this.supportedElements = supportedElements;
}
/**
@@ -142,9 +112,6 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
* @param copyConcept the concept to copy from
*/
public JpaParticipant(@NonNull final JpaParticipant copyConcept) {
- super(copyConcept);
- this.key = new PfConceptKey(copyConcept.key);
- this.definition = new PfConceptKey(copyConcept.definition);
this.participantState = copyConcept.participantState;
this.description = copyConcept.description;
this.participantType = copyConcept.participantType;
@@ -165,11 +132,7 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
public Participant toAuthorative() {
var participant = new Participant();
- participant.setName(key.getName());
- participant.setVersion(key.getVersion());
- participant.setDefinition(new ToscaConceptIdentifier(definition));
participant.setParticipantState(participantState);
- participant.setDescription(description);
participant.setParticipantType(new ToscaConceptIdentifier(participantType));
participant.setParticipantId(UUID.fromString(participantId));
participant.setParticipantSupportedElementTypes(new LinkedHashMap<>(this.supportedElements.size()));
@@ -183,13 +146,7 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
@Override
public void fromAuthorative(@NonNull final Participant participant) {
- if (this.key == null || this.getKey().isNullKey()) {
- this.setKey(new PfConceptKey(participant.getName(), participant.getVersion()));
- }
-
- this.definition = participant.getDefinition().asConceptKey();
this.setParticipantState(participant.getParticipantState());
- this.setDescription(participant.getDescription());
this.participantType = participant.getParticipantType().asConceptKey();
this.participantId = participant.getParticipantId().toString();
this.supportedElements = new ArrayList<>(participant.getParticipantSupportedElementTypes().size());
@@ -203,42 +160,15 @@ public class JpaParticipant extends PfConcept implements PfAuthorative<Participa
}
@Override
- public List<PfKey> getKeys() {
- List<PfKey> keyList = getKey().getKeys();
-
- keyList.add(definition);
- keyList.add(participantType);
-
- return keyList;
- }
-
- @Override
- public void clean() {
- key.clean();
- definition.clean();
- description = (description == null ? null : description.trim());
- participantType.clean();
- }
-
- @Override
- public int compareTo(final PfConcept otherConcept) {
- if (otherConcept == null) {
+ public int compareTo(final JpaParticipant other) {
+ if (other == null) {
return -1;
}
- if (this == otherConcept) {
+ if (this == other) {
return 0;
}
- if (getClass() != otherConcept.getClass()) {
- return getClass().getName().compareTo(otherConcept.getClass().getName());
- }
-
- final JpaParticipant other = (JpaParticipant) otherConcept;
- int result = key.compareTo(other.key);
- if (result != 0) {
- return result;
- }
- result = definition.compareTo(other.definition);
+ var result = participantId.compareTo(other.participantId);
if (result != 0) {
return result;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
index fa8979d58..7b8ebc038 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
@@ -29,9 +29,7 @@ import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantRepository;
-import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.base.PfModelRuntimeException;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -60,11 +58,10 @@ public class ParticipantProvider {
*
* @param participantId the id of the participant to get
* @return the participant found
- * @throws PfModelException on errors getting participant
*/
@Transactional(readOnly = true)
public Participant getParticipantById(UUID participantId) {
- var participant = participantRepository.findByParticipantId(participantId.toString());
+ var participant = participantRepository.findById(participantId.toString());
if (participant.isEmpty()) {
throw new PfModelRuntimeException(Status.NOT_FOUND,
"Participant Not Found with ID: " + participantId);
@@ -80,8 +77,8 @@ public class ParticipantProvider {
* @return the participant found
*/
@Transactional(readOnly = true)
- public Optional<Participant> findParticipant(@NonNull final ToscaConceptIdentifier participantId) {
- return participantRepository.findById(participantId.asConceptKey()).map(JpaParticipant::toAuthorative);
+ public Optional<Participant> findParticipant(@NonNull final UUID participantId) {
+ return participantRepository.findById(participantId.toString()).map(JpaParticipant::toAuthorative);
}
/**
@@ -91,7 +88,6 @@ public class ParticipantProvider {
* @return the participant created
*/
public Participant saveParticipant(@NonNull final Participant participant) {
- participant.setParticipantId(UUID.randomUUID());
var result = participantRepository
.save(ProviderUtils.getJpaAndValidate(participant, JpaParticipant::new, "participant"));
@@ -120,7 +116,7 @@ public class ParticipantProvider {
* @return the participant deleted
*/
public Participant deleteParticipant(@NonNull final UUID participantId) {
- var jpaDeleteParticipantOpt = participantRepository.findByParticipantId(participantId.toString());
+ var jpaDeleteParticipantOpt = participantRepository.findById(participantId.toString());
if (jpaDeleteParticipantOpt.isEmpty()) {
String errorMessage =
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java
index b448731ba..310d9981c 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/ParticipantRepository.java
@@ -20,14 +20,11 @@
package org.onap.policy.clamp.models.acm.persistence.repository;
-import java.util.Optional;
import org.onap.policy.clamp.models.acm.persistence.concepts.JpaParticipant;
-import org.onap.policy.models.base.PfConceptKey;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
@Repository
-public interface ParticipantRepository extends JpaRepository<JpaParticipant, PfConceptKey> {
+public interface ParticipantRepository extends JpaRepository<JpaParticipant, String> {
- Optional<JpaParticipant> findByParticipantId(String participantId);
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java
index f6eb3e0ff..0ae1a90e2 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/concepts/ParticipantTest.java
@@ -27,22 +27,9 @@ import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.junit.jupiter.api.Test;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.clamp.models.acm.utils.CommonTestData;
class ParticipantTest {
- @Test
- void testParticipant() {
-
- Participant p0 = new Participant();
- p0.setDefinition(new ToscaConceptIdentifier("dfName", "1.2.3"));
- assertEquals("dfName", p0.getType());
- assertEquals("1.2.3", p0.getTypeVersion());
-
- Participant p1 = new Participant(p0);
- assertEquals(p0, p1);
-
- assertEquals(0, p0.compareTo(p1));
- }
@Test
void testParticipantLombok() {
@@ -57,11 +44,8 @@ class ParticipantTest {
Participant p1 = new Participant();
- p1.setDefinition(new ToscaConceptIdentifier("defName", "0.0.1"));
- p1.setDescription("Description");
- p1.setName("Name");
+ p1.setParticipantId(CommonTestData.getParticipantId());
p1.setParticipantState(ParticipantState.ON_LINE);
- p1.setVersion("0.0.1");
assertThat(p1.toString()).contains("Participant(");
assertNotEquals(0, p1.hashCode());
@@ -73,7 +57,6 @@ class ParticipantTest {
Participant p2 = new Participant();
// @formatter:off
- assertThatThrownBy(() -> p2.setDefinition(null)). isInstanceOf(NullPointerException.class);
assertThatThrownBy(() -> p2.setParticipantState(null)).isInstanceOf(NullPointerException.class);
// @formatter:on
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 b798fb093..f293085c3 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
@@ -28,13 +28,11 @@ import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.ArrayList;
-import java.util.HashMap;
import java.util.LinkedHashMap;
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.base.PfConceptKey;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
/**
@@ -42,71 +40,34 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
*/
class JpaParticipantTest {
- private static final String NULL_KEY_ERROR = "key is marked .*ull but is null";
+ private static final String NULL_KEY_ERROR = "participantId is marked .*ull but is null";
@Test
void testJpaParticipantConstructor() {
assertThatThrownBy(() -> new JpaParticipant((JpaParticipant) null))
.hasMessageMatching("copyConcept is marked .*ull but is null");
- assertThatThrownBy(() -> new JpaParticipant((PfConceptKey) null)).hasMessageMatching(NULL_KEY_ERROR);
+ assertThatThrownBy(() -> new JpaParticipant(null, null, null)).hasMessageMatching(NULL_KEY_ERROR);
- assertThatThrownBy(() -> new JpaParticipant(null, null, null, null, null)).hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> new JpaParticipant(null, null, null, null, null))
- .hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> new JpaParticipant(null, null, null, ParticipantState.ON_LINE, null))
- .hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(
- () -> new JpaParticipant(null, null, null, ParticipantState.ON_LINE, null))
- .hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> new JpaParticipant(null, null, new PfConceptKey(), null, null))
- .hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> new JpaParticipant(null, null, new PfConceptKey(), null, null))
+ assertThatThrownBy(() -> new JpaParticipant(null, ParticipantState.ON_LINE, new ArrayList<>()))
.hasMessageMatching(NULL_KEY_ERROR);
- assertThatThrownBy(() -> new JpaParticipant(null, null, new PfConceptKey(), ParticipantState.ON_LINE, null))
- .hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> new JpaParticipant(null, null, new PfConceptKey(), ParticipantState.ON_LINE, null))
- .hasMessageMatching(NULL_KEY_ERROR);
-
- assertThatThrownBy(() -> new JpaParticipant(null, new PfConceptKey(), null, null, null))
- .hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaParticipant(null, new PfConceptKey(), null, null, null))
- .hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaParticipant(null, new PfConceptKey(), null, ParticipantState.ON_LINE, null))
- .hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaParticipant(null, new PfConceptKey(), null, ParticipantState.ON_LINE, null
- )).hasMessageMatching("definition is marked .*ull but is null");
-
- assertThatThrownBy(() -> new JpaParticipant(null, new PfConceptKey(), new PfConceptKey(), null, null))
+ assertThatThrownBy(() -> new JpaParticipant(UUID.randomUUID().toString(), null, new ArrayList<>()))
.hasMessageMatching("participantState is marked .*ull but is null");
- assertThatThrownBy(
- () -> new JpaParticipant(null, new PfConceptKey(), new PfConceptKey(), null, null))
- .hasMessageMatching("participantState is marked .*ull but is null");
+ assertThatThrownBy(() -> new JpaParticipant(UUID.randomUUID().toString(), ParticipantState.ON_LINE, null))
+ .hasMessageMatching("supportedElements is marked .*ull but is null");
assertNotNull(new JpaParticipant());
- assertNotNull(new JpaParticipant((new PfConceptKey())));
- assertNotNull(new JpaParticipant(null, new PfConceptKey(), new PfConceptKey(),
- ParticipantState.ON_LINE, new ArrayList<>()));
- assertNotNull(new JpaParticipant(UUID.randomUUID().toString(), new PfConceptKey(),
- new PfConceptKey(), ParticipantState.ON_LINE, new ArrayList<>()));
+ assertNotNull(new JpaParticipant(UUID.randomUUID().toString(), ParticipantState.ON_LINE, new ArrayList<>()));
+
}
@Test
void testJpaParticipant() {
- JpaParticipant testJpaParticipant = createJpaParticipantInstance();
+ var testJpaParticipant = createJpaParticipantInstance();
- Participant participant = createParticipantInstance();
+ var participant = createParticipantInstance();
participant.setParticipantId(testJpaParticipant.toAuthorative().getParticipantId());
@@ -117,38 +78,19 @@ class JpaParticipantTest {
assertThatThrownBy(() -> new JpaParticipant((JpaParticipant) null)).isInstanceOf(NullPointerException.class);
- JpaParticipant testJpaParticipantFa = new JpaParticipant();
- testJpaParticipantFa.setKey(null);
+ var testJpaParticipantFa = new JpaParticipant();
testJpaParticipantFa.fromAuthorative(participant);
testJpaParticipantFa.setParticipantId(testJpaParticipant.getParticipantId());
assertEquals(testJpaParticipant, testJpaParticipantFa);
- testJpaParticipantFa.setKey(PfConceptKey.getNullKey());
- testJpaParticipantFa.fromAuthorative(participant);
- assertEquals(testJpaParticipant, testJpaParticipantFa);
- testJpaParticipantFa.setKey(new PfConceptKey("participant", "0.0.1"));
- testJpaParticipantFa.fromAuthorative(participant);
- assertEquals(testJpaParticipant, testJpaParticipantFa);
-
- assertEquals("participant", testJpaParticipant.getKey().getName());
- assertEquals("participant", new JpaParticipant(createJpaParticipantInstance()).getKey().getName());
- assertEquals("participant",
- ((PfConceptKey) new JpaParticipant(createJpaParticipantInstance()).getKeys().get(0)).getName());
-
- testJpaParticipant.clean();
- assertEquals("participant", testJpaParticipant.getKey().getName());
- testJpaParticipant.setDescription(" A Message ");
- testJpaParticipant.clean();
- assertEquals("A Message", testJpaParticipant.getDescription());
-
- JpaParticipant testJpaParticipant2 = new JpaParticipant(testJpaParticipant);
+ var testJpaParticipant2 = new JpaParticipant(testJpaParticipant);
testJpaParticipant2.setParticipantId(testJpaParticipant.getParticipantId());
assertEquals(testJpaParticipant, testJpaParticipant2);
}
@Test
void testJpaParticipantValidation() {
- JpaParticipant testJpaParticipant = createJpaParticipantInstance();
+ var testJpaParticipant = createJpaParticipantInstance();
assertThatThrownBy(() -> testJpaParticipant.validate(null))
.hasMessageMatching("fieldName is marked .*ull but is null");
@@ -158,32 +100,22 @@ class JpaParticipantTest {
@Test
void testJpaParticipantCompareTo() {
- JpaParticipant testJpaParticipant = createJpaParticipantInstance();
+ var testJpaParticipant = createJpaParticipantInstance();
- JpaParticipant otherJpaParticipant = new JpaParticipant(testJpaParticipant);
+ var otherJpaParticipant = new JpaParticipant(testJpaParticipant);
otherJpaParticipant.setParticipantId(testJpaParticipant.getParticipantId());
assertEquals(0, testJpaParticipant.compareTo(otherJpaParticipant));
assertEquals(-1, testJpaParticipant.compareTo(null));
assertEquals(0, testJpaParticipant.compareTo(testJpaParticipant));
assertNotEquals(0, testJpaParticipant.compareTo(new DummyJpaParticipantChild()));
- testJpaParticipant.setKey(new PfConceptKey("BadValue", "0.0.1"));
- assertNotEquals(0, testJpaParticipant.compareTo(otherJpaParticipant));
- testJpaParticipant.setKey(new PfConceptKey("participant", "0.0.1"));
- assertEquals(0, testJpaParticipant.compareTo(otherJpaParticipant));
-
- testJpaParticipant.setDefinition(new PfConceptKey("BadValue", "0.0.1"));
- assertNotEquals(0, testJpaParticipant.compareTo(otherJpaParticipant));
- testJpaParticipant.setDefinition(new PfConceptKey("participantDefinitionName", "0.0.1"));
- assertEquals(0, testJpaParticipant.compareTo(otherJpaParticipant));
-
testJpaParticipant.setParticipantState(ParticipantState.OFF_LINE);
assertNotEquals(0, testJpaParticipant.compareTo(otherJpaParticipant));
testJpaParticipant.setParticipantState(ParticipantState.ON_LINE);
assertEquals(0, testJpaParticipant.compareTo(otherJpaParticipant));
assertEquals(testJpaParticipant, new JpaParticipant(testJpaParticipant));
- JpaParticipant newJpaParticipant = new JpaParticipant(testJpaParticipant);
+ var newJpaParticipant = new JpaParticipant(testJpaParticipant);
newJpaParticipant.setParticipantId(testJpaParticipant.getParticipantId());
assertEquals(testJpaParticipant, newJpaParticipant);
}
@@ -191,7 +123,7 @@ class JpaParticipantTest {
@Test
void testJpaParticipantLombok() {
assertNotNull(new Participant());
- JpaParticipant p0 = new JpaParticipant();
+ var p0 = new JpaParticipant();
assertThat(p0.toString()).contains("JpaParticipant(");
assertThat(p0.hashCode()).isNotZero();
@@ -199,11 +131,7 @@ class JpaParticipantTest {
assertNotEquals(null, p0);
- JpaParticipant p1 = new JpaParticipant();
-
- p1.setDefinition(new PfConceptKey("defName", "0.0.1"));
- p1.setDescription("Description");
- p1.setKey(new PfConceptKey("participant", "0.0.1"));
+ var p1 = new JpaParticipant();
p1.setParticipantState(ParticipantState.ON_LINE);
assertThat(p1.toString()).contains("Participant(");
@@ -213,28 +141,24 @@ class JpaParticipantTest {
assertNotEquals(p1, p0);
- JpaParticipant p2 = new JpaParticipant();
+ var p2 = new JpaParticipant();
p2.setParticipantId(p0.getParticipantId());
assertEquals(p2, p0);
}
private JpaParticipant createJpaParticipantInstance() {
- Participant testParticipant = createParticipantInstance();
- JpaParticipant testJpaParticipant = new JpaParticipant();
- testJpaParticipant.setKey(null);
+ var testParticipant = createParticipantInstance();
+ var testJpaParticipant = new JpaParticipant();
testParticipant.setParticipantId(UUID.fromString(testJpaParticipant.getParticipantId()));
testJpaParticipant.fromAuthorative(testParticipant);
- testJpaParticipant.setKey(PfConceptKey.getNullKey());
testJpaParticipant.fromAuthorative(testParticipant);
return testJpaParticipant;
}
private Participant createParticipantInstance() {
- Participant testParticipant = new Participant();
- testParticipant.setName("participant");
- testParticipant.setVersion("0.0.1");
- testParticipant.setDefinition(new ToscaConceptIdentifier("participantDefinitionName", "0.0.1"));
+ var testParticipant = new Participant();
+ testParticipant.setParticipantId(UUID.randomUUID());
testParticipant.setParticipantType(new ToscaConceptIdentifier("participantTypeName", "0.0.1"));
testParticipant.setParticipantSupportedElementTypes(new LinkedHashMap<>());
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
index 325272b69..a40d1cc1f 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
@@ -38,22 +38,20 @@ import org.onap.policy.clamp.models.acm.persistence.repository.ParticipantReposi
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
class ParticipantProviderTest {
private static final Coder CODER = new StandardCoder();
private static final String PARTICIPANT_JSON = "src/test/resources/providers/TestParticipant.json";
private static final String LIST_IS_NULL = ".*. is marked .*ull but is null";
- private static final ToscaConceptIdentifier INVALID_ID = new ToscaConceptIdentifier("invalid_name", "1.0.1");
+ private static final UUID INVALID_ID = UUID.randomUUID();
private final List<Participant> inputParticipants = new ArrayList<>();
private List<JpaParticipant> jpaParticipantList;
private final String originalJson = ResourceUtils.getResourceAsString(PARTICIPANT_JSON);
@BeforeEach
- void beforeSetupDao() throws Exception {
+ void beforeSetup() throws Exception {
inputParticipants.add(CODER.decode(originalJson, Participant.class));
jpaParticipantList = ProviderUtils.getJpaAndValidateList(inputParticipants, JpaParticipant::new, "participant");
}
@@ -62,7 +60,7 @@ class ParticipantProviderTest {
void testParticipantSave() {
var participantRepository = mock(ParticipantRepository.class);
for (var participant : jpaParticipantList) {
- when(participantRepository.getById(new PfConceptKey(participant.getName(), participant.getVersion())))
+ when(participantRepository.getById(participant.getParticipantId()))
.thenReturn(participant);
}
var participantProvider = new ParticipantProvider(participantRepository);
@@ -71,7 +69,7 @@ class ParticipantProviderTest {
when(participantRepository.save(any())).thenReturn(jpaParticipantList.get(0));
- Participant savedParticipant = participantProvider.saveParticipant(inputParticipants.get(0));
+ var savedParticipant = participantProvider.saveParticipant(inputParticipants.get(0));
savedParticipant.setParticipantId(inputParticipants.get(0).getParticipantId());
assertThat(savedParticipant).usingRecursiveComparison().isEqualTo(inputParticipants.get(0));
@@ -81,7 +79,7 @@ class ParticipantProviderTest {
void testParticipantUpdate() {
var participantRepository = mock(ParticipantRepository.class);
for (var participant : jpaParticipantList) {
- when(participantRepository.getById(new PfConceptKey(participant.getName(), participant.getVersion())))
+ when(participantRepository.getById(participant.getParticipantId()))
.thenReturn(participant);
}
var participantProvider = new ParticipantProvider(participantRepository);
@@ -91,7 +89,7 @@ class ParticipantProviderTest {
when(participantRepository.save(any())).thenReturn(jpaParticipantList.get(0));
- Participant updatedParticipant = participantProvider.updateParticipant(inputParticipants.get(0));
+ var updatedParticipant = participantProvider.updateParticipant(inputParticipants.get(0));
updatedParticipant.setParticipantId(inputParticipants.get(0).getParticipantId());
assertThat(updatedParticipant).usingRecursiveComparison().isEqualTo(inputParticipants.get(0));
}
@@ -106,7 +104,7 @@ class ParticipantProviderTest {
when(participantRepository.findAll()).thenReturn(jpaParticipantList);
assertThat(participantProvider.getParticipants()).hasSize(inputParticipants.size());
- when(participantRepository.findByParticipantId(any())).thenReturn(
+ when(participantRepository.findById(any())).thenReturn(
Optional.ofNullable(jpaParticipantList.get(0)));
var participant = participantProvider.getParticipantById(inputParticipants.get(0)
@@ -120,15 +118,14 @@ class ParticipantProviderTest {
var participantRepository = mock(ParticipantRepository.class);
var participantProvider = new ParticipantProvider(participantRepository);
- var participantId = UUID.randomUUID();
+ var participantId = inputParticipants.get(0).getParticipantId();
assertThatThrownBy(() -> participantProvider.deleteParticipant(participantId))
.hasMessageMatching(".*.failed, participant does not exist");
- when(participantRepository.findByParticipantId(participantId.toString()))
+ when(participantRepository.findById(participantId.toString()))
.thenReturn(Optional.of(jpaParticipantList.get(0)));
- Participant deletedParticipant =
- participantProvider.deleteParticipant(participantId);
+ var deletedParticipant = participantProvider.deleteParticipant(participantId);
assertThat(inputParticipants.get(0)).usingRecursiveComparison().isEqualTo(deletedParticipant);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/CommonTestData.java b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/CommonTestData.java
index 0d47fa6e3..88ace1706 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/CommonTestData.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/CommonTestData.java
@@ -20,8 +20,7 @@
package org.onap.policy.clamp.models.acm.utils;
-import org.onap.policy.models.base.PfConceptKey;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import java.util.UUID;
/**
* Class to hold/create all parameters for test cases.
@@ -29,14 +28,14 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
*/
public class CommonTestData {
- public static final ToscaConceptIdentifier PARTCICIPANT_ID = new ToscaConceptIdentifier("id", "1.2.3");
+ public static final UUID PARTCICIPANT_ID = UUID.randomUUID();
/**
* Returns participantId for test cases.
*
* @return participant Id
*/
- public static ToscaConceptIdentifier getParticipantId() {
+ public static UUID getParticipantId() {
return PARTCICIPANT_ID;
}
@@ -45,16 +44,16 @@ public class CommonTestData {
*
* @return participant Id
*/
- public static PfConceptKey getJpaParticipantId() {
- return PARTCICIPANT_ID.asConceptKey();
+ public static String getJpaParticipantId() {
+ return PARTCICIPANT_ID.toString();
}
/**
- * Returns second participantId for test cases.
+ * Returns random participantId for test cases.
*
* @return participant Id
*/
- public static ToscaConceptIdentifier getRndParticipantId() {
- return new ToscaConceptIdentifier("idDiff", "1.2.3");
+ public static UUID getRndParticipantId() {
+ return UUID.randomUUID();
}
}
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml
index 54a592484..54bb43704 100755
--- a/packages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml
@@ -25,9 +25,7 @@ participant:
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
- participantId:
- name: A1PMSParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c00
participantType:
name: org.onap.policy.clamp.acm.A1PMSParticipant
version: 2.3.4
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
index 41c9f99be..b31a160c5 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml
@@ -16,9 +16,7 @@ participant:
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
- participantId:
- name: HttpParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
participantType:
name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
index 06a1b7c08..531a9cd16 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml
@@ -19,9 +19,7 @@ participant:
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
- participantId:
- name: K8sParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c02
participantType:
name: org.onap.policy.clamp.acm.KubernetesParticipant
version: 2.3.4
diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
index 9cd06ad26..7cdefd3d8 100644
--- a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
+++ b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml
@@ -32,9 +32,7 @@ participant:
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
- participantId:
- name: org.onap.PM_Policy
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c03
participantType:
name: org.onap.policy.clamp.acm.PolicyParticipant
version: 2.3.1
diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml
index fcc2057b2..9c4e4370a 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml
@@ -25,9 +25,7 @@ participant:
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
- participantId:
- name: A1PMSParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c00
participantType:
name: org.onap.policy.clamp.acm.A1PMSParticipant
version: 2.3.4
diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml
index 867357e93..ced319cfc 100755
--- a/participant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml
+++ b/participant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml
@@ -2,9 +2,7 @@ participant:
intermediaryParameters:
reportingTimeInterval: 120000
description: Participant Description
- participantId:
- name: A1PMSParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c00
participantType:
name: org.onap.policy.clamp.acm.A1PMSParticipant
version: 2.3.4
diff --git a/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
index 1f60ffc97..a7015d95c 100644
--- a/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml
@@ -16,9 +16,7 @@ participant:
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
- participantId:
- name: HttpParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
participantType:
name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
diff --git a/participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml
index 1effd4e4c..bf429df02 100644
--- a/participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml
+++ b/participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml
@@ -2,9 +2,7 @@ participant:
intermediaryParameters:
reportingTimeInterval: 120000
description: Participant Description
- participantId:
- version: 1.0.0
- name: HttpParticipant0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
participantType:
version: 2.3.4
name: org.onap.clamp.acm.HttpParticipant
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
index a906cb6fa..de9794d3c 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml
@@ -19,9 +19,7 @@ participant:
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
- participantId:
- name: K8sParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c02
participantType:
name: org.onap.policy.clamp.acm.KubernetesParticipant
version: 2.3.4
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
index 8a9619dce..3b74066bd 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java
@@ -104,7 +104,7 @@ public class CommonTestData {
map.put("reportingTimeIntervalMs", TIME_INTERVAL);
map.put("description", DESCRIPTION);
map.put("participantId", getParticipantId());
- map.put("participantType", getParticipantId());
+ map.put("participantType", getParticipantType());
map.put("clampAutomationCompositionTopics", getTopicParametersMap(false));
map.put("participantSupportedElementTypes", new ArrayList<>());
}
@@ -113,17 +113,25 @@ public class CommonTestData {
}
/**
- * Returns participantId for test cases.
+ * Returns participantType for test cases.
*
- * @return participant Id
+ * @return participant Type
*/
- public static ToscaConceptIdentifier getParticipantId() {
- final ToscaConceptIdentifier participantId = new ToscaConceptIdentifier();
+ public static ToscaConceptIdentifier getParticipantType() {
+ final var participantId = new ToscaConceptIdentifier();
participantId.setName("K8sParticipant0");
participantId.setVersion("1.0.0");
return participantId;
}
+ /**
+ * Returns participantId for test cases.
+ *
+ * @return participant Id
+ */
+ public static UUID getParticipantId() {
+ return UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c02");
+ }
/**
* Returns a property map for a TopicParameters map for test cases.
diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml
index 7fc792878..62cef60c4 100644
--- a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml
+++ b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml
@@ -8,9 +8,7 @@ participant:
name: Participant parameters
description: Participant Description
reportingTimeInterval: 120000
- participantId:
- name: K8sParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c02
participantType:
version: 2.3.4
name: org.onap.k8s.acm.K8SAutomationCompositionParticipant
diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
index 6af516e71..e7b59bef4 100644
--- a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
+++ b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml
@@ -32,9 +32,7 @@ participant:
intermediaryParameters:
reportingTimeIntervalMs: 120000
description: Participant Description
- participantId:
- name: org.onap.PM_Policy
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c03
participantType:
name: org.onap.policy.clamp.acm.PolicyParticipant
version: 2.3.1
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java
index b69c5c353..925214ec1 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
+import java.util.UUID;
import org.onap.policy.common.endpoints.parameters.TopicParameters;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.CoderException;
@@ -173,7 +174,7 @@ public class CommonTestData {
*
* @return participant Id
*/
- public static ToscaConceptIdentifier getParticipantId() {
- return new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0");
+ public static UUID getParticipantId() {
+ return UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03");
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml
index 434df0dfe..7a366f611 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml
+++ b/participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml
@@ -2,9 +2,7 @@ participant:
intermediaryParameters:
reportingTimeInterval: 120000
description: Participant Description
- participantId:
- version: 1.0.0
- name: org.onap.PM_Policy
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c03
participantType:
version: 1.0.0
name: org.onap.PM_CDS_Blueprint
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
index 568ab8a36..49b16d23d 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
@@ -59,7 +59,7 @@ public class AutomationCompositionHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionHandler.class);
private final ToscaConceptIdentifier participantType;
- private final ToscaConceptIdentifier participantId;
+ private final UUID participantId;
private final ParticipantMessagePublisher publisher;
@Getter
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
index f9023be1a..7e881b59d 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java
@@ -64,7 +64,7 @@ public class ParticipantHandler {
private final ToscaConceptIdentifier participantType;
@Getter
- private final ToscaConceptIdentifier participantId;
+ private final UUID participantId;
private final AutomationCompositionHandler automationCompositionHandler;
private final ParticipantMessagePublisher publisher;
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
index 953084890..8f32c6f9a 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/parameters/ParticipantIntermediaryParameters.java
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.acm.participant.intermediary.parameters;
import java.util.List;
+import java.util.UUID;
import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@@ -42,7 +43,7 @@ public class ParticipantIntermediaryParameters {
// The ID and description of this participant
@NotNull
@Valid
- private ToscaConceptIdentifier participantId;
+ private UUID participantId;
@NotBlank
private String description;
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
index b7d66bec6..45703848e 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/main/parameters/CommonTestData.java
@@ -61,8 +61,7 @@ public class CommonTestData {
private static final Object lockit = new Object();
public static final UUID AC_ID_0 = UUID.randomUUID();
public static final UUID AC_ID_1 = UUID.randomUUID();
- public static final ToscaConceptIdentifier PARTCICIPANT_ID =
- new ToscaConceptIdentifier("org.onap.PM_Policy", "0.0.0");
+ public static final UUID PARTCICIPANT_ID = UUID.randomUUID();
/**
* Get ParticipantIntermediaryParameters.
@@ -155,12 +154,12 @@ public class CommonTestData {
*
* @return participant Id
*/
- public static ToscaConceptIdentifier getParticipantId() {
+ public static UUID getParticipantId() {
return PARTCICIPANT_ID;
}
- public static ToscaConceptIdentifier getRndParticipantId() {
- return new ToscaConceptIdentifier("diff", "0.0.0");
+ public static UUID getRndParticipantId() {
+ return UUID.randomUUID();
}
public static ToscaConceptIdentifier getDefinition() {
@@ -269,7 +268,7 @@ public class CommonTestData {
* @return a map suitable for elementsOnThisParticipant
*/
public Map<UUID, AutomationCompositionElement> setAutomationCompositionElementTest(UUID uuid,
- ToscaConceptIdentifier definition, ToscaConceptIdentifier participantId) {
+ ToscaConceptIdentifier definition, UUID participantId) {
var acElement = new AutomationCompositionElement();
acElement.setId(uuid);
acElement.setParticipantId(participantId);
@@ -289,7 +288,7 @@ public class CommonTestData {
* @return a AutomationCompositionHander with elements
*/
public AutomationCompositionHandler setTestAutomationCompositionHandler(ToscaConceptIdentifier definition,
- UUID uuid, ToscaConceptIdentifier participantId) {
+ UUID uuid, UUID participantId) {
var ach = getMockAutomationCompositionHandler();
var key = getTestAutomationCompositionMap().keySet().iterator().next();
@@ -311,7 +310,7 @@ public class CommonTestData {
* @param state a AutomationCompositionOrderedState
* @return a AutomationCompositionStateChange
*/
- public AutomationCompositionStateChange getStateChange(ToscaConceptIdentifier participantId, UUID uuid,
+ public AutomationCompositionStateChange getStateChange(UUID participantId, UUID uuid,
AutomationCompositionOrderedState state) {
var stateChange = new AutomationCompositionStateChange();
stateChange.setAutomationCompositionId(UUID.randomUUID());
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
index 099c0e740..53288d15e 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java
@@ -243,7 +243,7 @@ public class AutomationCompositionInstantiationProvider {
var result = new BeanValidationResult("AutomationComposition", automationComposition);
var participantMap = participants.stream()
- .collect(Collectors.toMap(participant -> participant.getKey().asIdentifier(), Function.identity()));
+ .collect(Collectors.toMap(participant -> participant.getParticipantId(), Function.identity()));
for (var element : automationComposition.getElements().values()) {
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java
index 617f75668..18a8e8a26 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/participants/AcmParticipantProvider.java
@@ -23,12 +23,11 @@ package org.onap.policy.clamp.acm.runtime.participants;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import lombok.RequiredArgsConstructor;
import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusReqPublisher;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.clamp.models.acm.concepts.ParticipantInformation;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
@@ -36,25 +35,20 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
+@RequiredArgsConstructor
public class AcmParticipantProvider {
private static final Logger LOGGER = LoggerFactory.getLogger(AcmParticipantProvider.class);
private final ParticipantProvider participantProvider;
private final ParticipantStatusReqPublisher participantStatusReqPublisher;
- public AcmParticipantProvider(ParticipantProvider participantProvider,
- ParticipantStatusReqPublisher participantStatusReqPublisher) {
- this.participantProvider = participantProvider;
- this.participantStatusReqPublisher = participantStatusReqPublisher;
- }
-
/**
* Get all participants.
*
* @return A list of available participants
*/
public List<ParticipantInformation> getAllParticipants() {
- List<Participant> participants = this.participantProvider.getParticipants();
+ var participants = this.participantProvider.getParticipants();
List<ParticipantInformation> participantInformationList = new ArrayList<>();
participants.forEach(participant -> {
@@ -72,8 +66,8 @@ public class AcmParticipantProvider {
* @return The participant
*/
public ParticipantInformation getParticipantById(UUID participantId) {
- Participant participant = this.participantProvider.getParticipantById(participantId);
- ParticipantInformation participantInformation = new ParticipantInformation();
+ var participant = this.participantProvider.getParticipantById(participantId);
+ var participantInformation = new ParticipantInformation();
participantInformation.setParticipant(participant);
return participantInformation;
}
@@ -84,11 +78,10 @@ public class AcmParticipantProvider {
* @param participantId The UUID of the participant to send request to
*/
public void sendParticipantStatusRequest(UUID participantId) {
- Participant participant = this.participantProvider.getParticipantById(participantId);
- ToscaConceptIdentifier id = participant.getKey().asIdentifier();
+ var participant = this.participantProvider.getParticipantById(participantId);
LOGGER.debug("Requesting Participant Status Now ParticipantStatusReq");
- participantStatusReqPublisher.send(id);
+ participantStatusReqPublisher.send(participantId);
participant.setParticipantState(ParticipantState.OFF_LINE);
participantProvider.updateParticipant(participant);
}
@@ -98,6 +91,6 @@ public class AcmParticipantProvider {
*
*/
public void sendAllParticipantStatusRequest() {
- this.participantStatusReqPublisher.send((ToscaConceptIdentifier) null);
+ this.participantStatusReqPublisher.send((UUID) null);
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
index 6f0f5cc7b..f58543684 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
@@ -106,9 +106,7 @@ public class SupervisionParticipantHandler {
if (participantOpt.isEmpty()) {
ParticipantRegister registerMessage = (ParticipantRegister) participantMessage;
var participant = new Participant();
- participant.setName(registerMessage.getParticipantId().getName());
- participant.setVersion(registerMessage.getParticipantId().getVersion());
- participant.setDefinition(registerMessage.getParticipantId());
+ participant.setParticipantId(participantMessage.getParticipantId());
participant.setParticipantType(registerMessage.getParticipantType());
participant.setParticipantSupportedElementTypes(listToMap(registerMessage
.getParticipantSupportedElementType()));
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
index f758c9893..0e5aab5e3 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
@@ -36,7 +36,6 @@ import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
-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;
@@ -50,7 +49,7 @@ public class SupervisionScanner {
private static final Logger LOGGER = LoggerFactory.getLogger(SupervisionScanner.class);
private final HandleCounter<UUID> automationCompositionCounter = new HandleCounter<>();
- private final HandleCounter<ToscaConceptIdentifier> participantStatusCounter = new HandleCounter<>();
+ private final HandleCounter<UUID> participantStatusCounter = new HandleCounter<>();
private final Map<UUID, Integer> phaseMap = new HashMap<>();
@@ -118,7 +117,7 @@ public class SupervisionScanner {
}
private void scanParticipantStatus(Participant participant) {
- var id = participant.getKey().asIdentifier();
+ var id = participant.getParticipantId();
if (participantStatusCounter.isFault(id)) {
LOGGER.debug("report Participant fault");
return;
@@ -135,7 +134,7 @@ public class SupervisionScanner {
/**
* handle participant Status message.
*/
- public void handleParticipantStatus(ToscaConceptIdentifier id) {
+ public void handleParticipantStatus(UUID id) {
participantStatusCounter.clear(id);
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
index bd8f2b560..3cadff6ee 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantRegisterAckPublisher.java
@@ -40,7 +40,7 @@ public class ParticipantRegisterAckPublisher extends AbstractParticipantAckPubli
* @param participantType the participant Type
*/
@Timed(value = "publisher.participant_register_ack", description = "PARTICIPANT_REGISTER_ACK messages published")
- public void send(UUID responseTo, ToscaConceptIdentifier participantId, ToscaConceptIdentifier participantType) {
+ public void send(UUID responseTo, UUID participantId, ToscaConceptIdentifier participantType) {
var message = new ParticipantRegisterAck();
message.setParticipantId(participantId);
message.setParticipantType(participantType);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
index d1f183ee8..db69cdaf8 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantStatusReqPublisher.java
@@ -22,8 +22,8 @@ package org.onap.policy.clamp.acm.runtime.supervision.comm;
import io.micrometer.core.annotation.Timed;
import java.time.Instant;
+import java.util.UUID;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -39,7 +39,7 @@ public class ParticipantStatusReqPublisher extends AbstractParticipantPublisher<
* @param participantId the participant Id
*/
@Timed(value = "publisher.participant_status_req", description = "PARTICIPANT_STATUS_REQ messages published")
- public void send(ToscaConceptIdentifier participantId) {
+ public void send(UUID participantId) {
ParticipantStatusReq message = new ParticipantStatusReq();
message.setParticipantId(participantId);
message.setTimestamp(Instant.now());
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
index af9023815..504ddc28c 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java
@@ -68,7 +68,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
* @param participantId the ParticipantId
*/
@Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
- public void sendCommissioning(ToscaConceptIdentifier participantType, ToscaConceptIdentifier participantId) {
+ public void sendCommissioning(ToscaConceptIdentifier participantType, UUID participantId) {
var list = acDefinitionProvider.getAllAcDefinitions();
if (list.isEmpty()) {
LOGGER.warn("No tosca service template found, cannot send participantupdate");
@@ -88,7 +88,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
*/
@Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
public void sendCommissioning(AutomationCompositionDefinition acmDefinition,
- ToscaConceptIdentifier participantType, ToscaConceptIdentifier participantId) {
+ ToscaConceptIdentifier participantType, UUID participantId) {
var message = new ParticipantUpdate();
message.setCompositionId(acmDefinition.getCompositionId());
message.setParticipantType(participantType);
diff --git a/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json b/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json
index 55b99b28c..a1d0a999d 100644
--- a/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json
+++ b/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.json
@@ -15,10 +15,7 @@
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Sink Automation Composition Element for the Demo",
@@ -34,10 +31,7 @@
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Bridge Automation Composition Element for the Demo",
@@ -53,10 +47,7 @@
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"state": "UNINITIALISED",
"orderedState": "UNINITIALISED",
"description": "Starter Automation Composition Element for the Demo",
diff --git a/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml b/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml
index 3fa6506ea..3b007fda6 100644
--- a/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml
+++ b/runtime-acm/src/main/resources/openapi/examples/getAllCompositionInstancesResponse.yaml
@@ -11,9 +11,7 @@ automationCompositionList:
participantType:
name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- participantId:
- name: HttpParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
state: UNINITIALISED
orderedState: UNINITIALISED
description: Sink Automation Composition Element for the Demo
@@ -26,9 +24,7 @@ automationCompositionList:
participantType:
name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- participantId:
- name: HttpParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
state: UNINITIALISED
orderedState: UNINITIALISED
description: Bridge Automation Composition Element for the Demo
@@ -41,9 +37,7 @@ automationCompositionList:
participantType:
name: org.onap.policy.clamp.acm.HttpParticipant
version: 2.3.4
- participantId:
- name: HttpParticipant0
- version: 1.0.0
+ participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01
state: UNINITIALISED
orderedState: UNINITIALISED
description: Starter Automation Composition Element for the Demo
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
index 4516ccd97..1db95e4b5 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java
@@ -20,6 +20,7 @@
package org.onap.policy.clamp.acm.runtime.supervision;
+import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -257,7 +258,7 @@ class SupervisionHandlerTest {
mock(ParticipantUpdatePublisher.class), AutomationCompositionOrderedState.PASSIVE,
AutomationCompositionState.UNINITIALISED);
- handler.handleParticipantMessage(participantUpdateAckMessage);
+ assertThatCode(() -> handler.handleParticipantMessage(participantUpdateAckMessage)).doesNotThrowAnyException();
}
@Test
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
index 93f15f64d..683dd539a 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
@@ -130,7 +130,7 @@ class SupervisionScannerTest {
automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
acRuntimeParameterGroup);
- supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
+ supervisionScanner.handleParticipantStatus(participant.getParticipantId());
supervisionScanner.run(true);
verify(automationCompositionProvider, times(0)).updateAutomationComposition(any(AutomationComposition.class));
}
@@ -182,7 +182,6 @@ class SupervisionScannerTest {
var participant = CommonTestData.createParticipant(PARTICIPANT_TYPE, CommonTestData.getParticipantId());
participant.setParticipantState(ParticipantState.OFF_LINE);
- participant.setDefinition(new ToscaConceptIdentifier("unknown", "0.0.0"));
var participantProvider = mock(ParticipantProvider.class);
when(participantProvider.getParticipants()).thenReturn(List.of(participant));
@@ -193,9 +192,9 @@ class SupervisionScannerTest {
automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
acRuntimeParameterGroup);
- supervisionScanner.handleParticipantStatus(participant.getKey().asIdentifier());
+ supervisionScanner.handleParticipantStatus(participant.getParticipantId());
supervisionScanner.run(true);
- verify(participantProvider, times(0)).updateParticipant(any());
+ verify(participantProvider, times(0)).saveParticipant(any());
supervisionScanner.run(true);
verify(participantProvider, times(1)).updateParticipant(any());
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
index 195afdc5d..7d80228db 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java
@@ -21,6 +21,7 @@
package org.onap.policy.clamp.acm.runtime.util;
import java.util.List;
+import java.util.UUID;
import javax.ws.rs.core.Response.Status;
import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
@@ -76,13 +77,13 @@ public class CommonTestData {
public static List<Participant> createParticipants() {
var participant1 = createParticipant(
new ToscaConceptIdentifier("org.onap.policy.clamp.acm.KubernetesParticipant", "2.3.4"),
- new ToscaConceptIdentifier("K8sParticipant0", "1.0.0"));
+ UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c02"));
var participant2 = createParticipant(
new ToscaConceptIdentifier("org.onap.policy.clamp.acm.HttpParticipant", "2.3.4"),
- new ToscaConceptIdentifier("HttpParticipant0", "1.0.0"));
+ UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c01"));
var participant3 = createParticipant(
new ToscaConceptIdentifier("org.onap.policy.clamp.acm.PolicyParticipant", "2.3.1"),
- new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0"));
+ UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03"));
return List.of(participant1, participant2, participant3);
}
@@ -94,16 +95,14 @@ public class CommonTestData {
* @return a new Participant
*/
public static Participant createParticipant(ToscaConceptIdentifier participantType,
- ToscaConceptIdentifier participantId) {
+ UUID participantId) {
var participant = new Participant();
- participant.setDefinition(participantId);
+ participant.setParticipantId(participantId);
participant.setParticipantType(participantType);
- participant.setName(participantId.getName());
- participant.setVersion(participantId.getVersion());
return participant;
}
- public static ToscaConceptIdentifier getParticipantId() {
- return new ToscaConceptIdentifier("org.onap.PM_Policy", "1.0.0");
+ public static UUID getParticipantId() {
+ return UUID.fromString("101c62b3-8918-41b9-a747-d21eb79c6c03");
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
index a754de9d3..77078e6eb 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
@@ -12,10 +12,7 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "K8sParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
"participantType": {
"name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
@@ -30,10 +27,7 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"participantType": {
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
@@ -48,10 +42,7 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
"participantType": {
"name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
index ccfd587a4..80facb29c 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
@@ -54,10 +54,7 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
"participantType": {
"name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
index 0fe9671e2..e66f3f68d 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
@@ -12,10 +12,7 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"participantType": {
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
@@ -30,10 +27,7 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
"participantType": {
"name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"
@@ -48,10 +42,7 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "K8sParticipant0t",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
"participantType": {
"name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
index 75dbed72a..d0372a342 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
@@ -12,10 +12,7 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "K8sParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
"participantType": {
"name": "org.onap.policy.clamp.acm.KubernetesParticipant",
"version": "2.3.4"
@@ -30,10 +27,7 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "HttpParticipant0",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
"participantType": {
"name": "org.onap.policy.clamp.acm.HttpParticipant",
"version": "2.3.4"
@@ -48,10 +42,7 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": {
- "name": "org.onap.PM_Policy",
- "version": "1.0.0"
- },
+ "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
"participantType": {
"name": "org.onap.policy.clamp.acm.PolicyParticipant",
"version": "2.3.1"