diff options
author | Liam Fallon <liam.fallon@est.tech> | 2022-12-20 09:55:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2022-12-20 09:55:45 +0000 |
commit | e70bf5c909a4d5abcbc7adcbb4aa120c2e045660 (patch) | |
tree | 2622919eb5c86d6400cab8ff35795bd8c75cd730 /models | |
parent | ba5988ab370f3dc5e5214823046e897d25aba0bf (diff) | |
parent | e18a523f4fc8075dc5022871fa96ca8754c2c979 (diff) |
Merge "Refactor instanceId as primary key in JpaAutomationComposition"
Diffstat (limited to 'models')
12 files changed, 273 insertions, 480 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java index 28a558cc1..f9cc880d0 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java @@ -20,19 +20,21 @@ package org.onap.policy.clamp.models.acm.persistence.concepts; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; -import java.util.Map; import java.util.UUID; 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.Index; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; -import javax.persistence.ManyToMany; +import javax.persistence.JoinColumn; +import javax.persistence.OneToMany; import javax.persistence.Table; import lombok.Data; import lombok.EqualsAndHashCode; @@ -44,12 +46,9 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; 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.PfReferenceKey; import org.onap.policy.models.base.PfUtils; -import org.onap.policy.models.base.validation.annotations.VerifyKey; +import org.onap.policy.models.base.Validated; /** * Class to represent a automation composition in the database. @@ -61,17 +60,20 @@ import org.onap.policy.models.base.validation.annotations.VerifyKey; @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Data @EqualsAndHashCode(callSuper = false) -public class JpaAutomationComposition extends PfConcept implements PfAuthorative<AutomationComposition> { - private static final long serialVersionUID = -4725410933242154805L; +public class JpaAutomationComposition extends Validated + implements PfAuthorative<AutomationComposition>, Comparable<JpaAutomationComposition> { - @Column + @Id @NotNull private String instanceId; - @EmbeddedId - @VerifyKey @NotNull - private PfConceptKey key; + @Column + private String name; + + @NotNull + @Column + private String version; @Column @NotNull @@ -91,17 +93,17 @@ public class JpaAutomationComposition extends PfConcept implements PfAuthorative @Column(columnDefinition = "TINYINT DEFAULT 1") private Boolean primed; - @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @NotNull - private Map<@NotNull UUID, @NotNull @Valid JpaAutomationCompositionElement> elements; - // @formatter:on + @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) + @JoinColumn(name = "instanceId", foreignKey = @ForeignKey(name = "ac_element_fk")) + private List<@NotNull @Valid JpaAutomationCompositionElement> elements; /** * The Default Constructor creates a {@link JpaAutomationComposition} object with a null key. */ public JpaAutomationComposition() { this(UUID.randomUUID().toString(), new PfConceptKey(), UUID.randomUUID().toString(), - AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>()); + AutomationCompositionState.UNINITIALISED, new ArrayList<>()); } /** @@ -115,9 +117,10 @@ public class JpaAutomationComposition extends PfConcept implements PfAuthorative */ public JpaAutomationComposition(@NonNull final String instanceId, @NonNull final PfConceptKey key, @NonNull final String compositionId, @NonNull final AutomationCompositionState state, - @NonNull final Map<UUID, JpaAutomationCompositionElement> elements) { + @NonNull final List<JpaAutomationCompositionElement> elements) { this.instanceId = instanceId; - this.key = key; + this.name = key.getName(); + this.version = key.getVersion(); this.compositionId = compositionId; this.state = state; this.elements = elements; @@ -129,15 +132,14 @@ public class JpaAutomationComposition extends PfConcept implements PfAuthorative * @param copyConcept the concept to copy from */ public JpaAutomationComposition(@NonNull final JpaAutomationComposition copyConcept) { - super(copyConcept); this.instanceId = copyConcept.instanceId; - this.key = new PfConceptKey(copyConcept.key); + this.name = copyConcept.name; + this.version = copyConcept.version; this.compositionId = copyConcept.compositionId; this.state = copyConcept.state; this.orderedState = copyConcept.orderedState; this.description = copyConcept.description; - this.elements = - PfUtils.mapMap(copyConcept.elements, JpaAutomationCompositionElement::new, new LinkedHashMap<>(0)); + this.elements = PfUtils.mapList(copyConcept.elements, JpaAutomationCompositionElement::new); this.primed = copyConcept.primed; } @@ -155,15 +157,17 @@ public class JpaAutomationComposition extends PfConcept implements PfAuthorative var automationComposition = new AutomationComposition(); automationComposition.setInstanceId(UUID.fromString(instanceId)); - automationComposition.setName(getKey().getName()); - automationComposition.setVersion(getKey().getVersion()); + automationComposition.setName(name); + automationComposition.setVersion(version); automationComposition.setCompositionId(UUID.fromString(compositionId)); automationComposition.setState(state); automationComposition.setOrderedState(orderedState != null ? orderedState : state.asOrderedState()); automationComposition.setDescription(description); - automationComposition.setElements( - PfUtils.mapMap(elements, JpaAutomationCompositionElement::toAuthorative, new LinkedHashMap<>(0))); automationComposition.setPrimed(primed); + automationComposition.setElements(new LinkedHashMap<>(this.elements.size())); + for (var element : this.elements) { + automationComposition.getElements().put(UUID.fromString(element.getElementId()), element.toAuthorative()); + } return automationComposition; } @@ -171,66 +175,43 @@ public class JpaAutomationComposition extends PfConcept implements PfAuthorative @Override public void fromAuthorative(@NonNull final AutomationComposition automationComposition) { this.instanceId = automationComposition.getInstanceId().toString(); - if (this.key == null || this.getKey().isNullKey()) { - this.setKey(new PfConceptKey(automationComposition.getName(), automationComposition.getVersion())); - } - + this.name = automationComposition.getName(); + this.version = automationComposition.getVersion(); this.compositionId = automationComposition.getCompositionId().toString(); this.state = automationComposition.getState(); this.orderedState = automationComposition.getOrderedState(); this.description = automationComposition.getDescription(); this.primed = automationComposition.getPrimed(); - this.elements = new LinkedHashMap<>(automationComposition.getElements().size()); + this.elements = new ArrayList<>(automationComposition.getElements().size()); for (var elementEntry : automationComposition.getElements().entrySet()) { - var jpaAutomationCompositionElement = new JpaAutomationCompositionElement(); - jpaAutomationCompositionElement - .setKey(new PfReferenceKey(getKey(), elementEntry.getValue().getId().toString())); + var jpaAutomationCompositionElement = + new JpaAutomationCompositionElement(elementEntry.getKey().toString(), this.instanceId); jpaAutomationCompositionElement.fromAuthorative(elementEntry.getValue()); - this.elements.put(elementEntry.getKey(), jpaAutomationCompositionElement); - } - } - - @Override - public List<PfKey> getKeys() { - var keyList = getKey().getKeys(); - - for (var element : elements.values()) { - keyList.addAll(element.getKeys()); - } - - return keyList; - } - - @Override - public void clean() { - key.clean(); - description = (description == null ? null : description.trim()); - - for (var element : elements.values()) { - element.clean(); + this.elements.add(jpaAutomationCompositionElement); } } @Override - public int compareTo(final PfConcept otherConcept) { - if (otherConcept == null) { + public int compareTo(final JpaAutomationComposition other) { + if (other == null) { return -1; } - if (this == otherConcept) { + if (this == other) { return 0; } - if (getClass() != otherConcept.getClass()) { - return this.getClass().getName().compareTo(otherConcept.getClass().getName()); - } - final var other = (JpaAutomationComposition) otherConcept; var result = ObjectUtils.compare(instanceId, other.instanceId); if (result != 0) { return result; } - result = key.compareTo(other.key); + result = ObjectUtils.compare(name, other.name); + if (result != 0) { + return result; + } + + result = ObjectUtils.compare(version, other.version); if (result != 0) { return result; } 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 d8e4237b7..79576f6eb 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 @@ -23,15 +23,14 @@ package org.onap.policy.clamp.models.acm.persistence.concepts; import java.util.LinkedHashMap; -import java.util.List; import java.util.Map; import java.util.UUID; import java.util.function.UnaryOperator; import javax.persistence.AttributeOverride; import javax.persistence.Column; import javax.persistence.Convert; -import javax.persistence.EmbeddedId; import javax.persistence.Entity; +import javax.persistence.Id; import javax.persistence.Inheritance; import javax.persistence.InheritanceType; import javax.persistence.Lob; @@ -46,11 +45,9 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState; 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.PfReferenceKey; import org.onap.policy.models.base.PfUtils; +import org.onap.policy.models.base.Validated; import org.onap.policy.models.base.validation.annotations.VerifyKey; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @@ -64,13 +61,16 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; @Inheritance(strategy = InheritanceType.TABLE_PER_CLASS) @Data @EqualsAndHashCode(callSuper = false) -public class JpaAutomationCompositionElement extends PfConcept implements PfAuthorative<AutomationCompositionElement> { - private static final long serialVersionUID = -1791732273187890213L; +public class JpaAutomationCompositionElement extends Validated + implements PfAuthorative<AutomationCompositionElement>, Comparable<JpaAutomationCompositionElement> { - @EmbeddedId - @VerifyKey + @Id @NotNull - private PfReferenceKey key; + private String elementId; + + @Column + @NotNull + private String instanceId; // @formatter:off @VerifyKey @@ -112,29 +112,33 @@ public class JpaAutomationCompositionElement extends PfConcept implements PfAuth * The Default Constructor creates a {@link JpaAutomationCompositionElement} object with a null key. */ public JpaAutomationCompositionElement() { - this(new PfReferenceKey()); + this(UUID.randomUUID().toString(), UUID.randomUUID().toString()); } /** * The Key Constructor creates a {@link JpaAutomationCompositionElement} object with the given concept key. * - * @param key the key + * @param elementId The id of the automation composition instance Element + * @param instanceId The id of the automation composition instance */ - public JpaAutomationCompositionElement(@NonNull final PfReferenceKey key) { - this(key, new PfConceptKey(), new PfConceptKey(), AutomationCompositionState.UNINITIALISED); + public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId) { + this(elementId, instanceId, new PfConceptKey(), new PfConceptKey(), AutomationCompositionState.UNINITIALISED); } /** * The Key Constructor creates a {@link JpaAutomationCompositionElement} object with all mandatory fields. * - * @param key the key + * @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 PfReferenceKey key, @NonNull final PfConceptKey definition, - @NonNull final PfConceptKey participantType, @NonNull final AutomationCompositionState state) { - this.key = key; + public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId, + @NonNull final PfConceptKey definition, @NonNull final PfConceptKey participantType, + @NonNull final AutomationCompositionState state) { + this.elementId = elementId; + this.instanceId = instanceId; this.definition = definition; this.participantType = participantType; this.state = state; @@ -146,8 +150,8 @@ public class JpaAutomationCompositionElement extends PfConcept implements PfAuth * @param copyConcept the concept to copy from */ public JpaAutomationCompositionElement(@NonNull final JpaAutomationCompositionElement copyConcept) { - super(copyConcept); - this.key = new PfReferenceKey(copyConcept.key); + this.elementId = copyConcept.elementId; + this.instanceId = copyConcept.instanceId; this.definition = new PfConceptKey(copyConcept.definition); this.participantType = new PfConceptKey(copyConcept.participantType); this.participantId = new PfConceptKey(copyConcept.participantId); @@ -170,7 +174,7 @@ public class JpaAutomationCompositionElement extends PfConcept implements PfAuth public AutomationCompositionElement toAuthorative() { var element = new AutomationCompositionElement(); - element.setId(UUID.fromString(getKey().getLocalName())); + element.setId(UUID.fromString(elementId)); element.setDefinition(new ToscaConceptIdentifier(definition)); element.setParticipantType(new ToscaConceptIdentifier(participantType)); element.setParticipantId(new ToscaConceptIdentifier(participantId)); @@ -184,11 +188,6 @@ public class JpaAutomationCompositionElement extends PfConcept implements PfAuth @Override public void fromAuthorative(@NonNull final AutomationCompositionElement element) { - if (this.key == null || this.getKey().isNullKey()) { - this.setKey(new PfReferenceKey()); - getKey().setLocalName(element.getId().toString()); - } - this.definition = element.getDefinition().asConceptKey(); this.participantType = element.getParticipantType().asConceptKey(); this.participantId = element.getParticipantId().asConceptKey(); @@ -199,42 +198,20 @@ public class JpaAutomationCompositionElement extends PfConcept implements PfAuth } @Override - public List<PfKey> getKeys() { - List<PfKey> keyList = getKey().getKeys(); - - keyList.add(definition); - keyList.add(participantType); - keyList.add(participantId); - - return keyList; - } - - @Override - public void clean() { - key.clean(); - definition.clean(); - participantType.clean(); - participantId.clean(); - - if (description != null) { - description = description.trim(); - } - } - - @Override - public int compareTo(final PfConcept otherConcept) { - if (otherConcept == null) { + public int compareTo(final JpaAutomationCompositionElement other) { + if (other == null) { return -1; } - if (this == otherConcept) { + if (this == other) { return 0; } - if (getClass() != otherConcept.getClass()) { - return this.getClass().getName().compareTo(otherConcept.getClass().getName()); + + var result = ObjectUtils.compare(elementId, other.elementId); + if (result != 0) { + return result; } - final JpaAutomationCompositionElement other = (JpaAutomationCompositionElement) otherConcept; - int result = key.compareTo(other.key); + result = ObjectUtils.compare(instanceId, other.instanceId); if (result != 0) { return result; } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java index 8c39f6e2b..21efc66d3 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java @@ -25,7 +25,6 @@ package org.onap.policy.clamp.models.acm.persistence.provider; import java.util.List; import java.util.Optional; import java.util.UUID; -import javax.persistence.EntityNotFoundException; import javax.ws.rs.core.Response; import javax.ws.rs.core.Response.Status; import lombok.AllArgsConstructor; @@ -33,9 +32,9 @@ import lombok.NonNull; import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition; import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository; -import org.onap.policy.models.base.PfConceptKey; import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.springframework.data.domain.Example; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -57,7 +56,7 @@ public class AutomationCompositionProvider { */ @Transactional(readOnly = true) public AutomationComposition getAutomationComposition(final UUID instanceId) { - var result = automationCompositionRepository.findByInstanceId(instanceId.toString()); + var result = automationCompositionRepository.findById(instanceId.toString()); if (result.isEmpty()) { throw new PfModelRuntimeException(Status.NOT_FOUND, "AutomationComposition not found"); } @@ -65,21 +64,6 @@ public class AutomationCompositionProvider { } /** - * Get automation composition. - * - * @param automationCompositionId the ID of the automation composition to get - * @return the automation composition found - */ - @Transactional(readOnly = true) - public AutomationComposition getAutomationComposition(final ToscaConceptIdentifier automationCompositionId) { - try { - return automationCompositionRepository.getById(automationCompositionId.asConceptKey()).toAuthorative(); - } catch (EntityNotFoundException e) { - throw new PfModelRuntimeException(Status.NOT_FOUND, "AutomationComposition not found", e); - } - } - - /** * Find automation composition. * * @param instanceId the ID of the automation composition to get @@ -87,7 +71,7 @@ public class AutomationCompositionProvider { */ @Transactional(readOnly = true) public Optional<AutomationComposition> findAutomationComposition(final UUID instanceId) { - var result = automationCompositionRepository.findByInstanceId(instanceId.toString()); + var result = automationCompositionRepository.findById(instanceId.toString()); return result.stream().map(JpaAutomationComposition::toAuthorative).findFirst(); } @@ -100,11 +84,9 @@ public class AutomationCompositionProvider { @Transactional(readOnly = true) public Optional<AutomationComposition> findAutomationComposition( final ToscaConceptIdentifier automationCompositionId) { - return findAutomationComposition(automationCompositionId.asConceptKey()); - } - - private Optional<AutomationComposition> findAutomationComposition(@NonNull final PfConceptKey key) { - return automationCompositionRepository.findById(key).map(JpaAutomationComposition::toAuthorative); + return automationCompositionRepository + .findOne(createExample(null, automationCompositionId.getName(), automationCompositionId.getVersion())) + .map(JpaAutomationComposition::toAuthorative); } /** @@ -156,10 +138,24 @@ public class AutomationCompositionProvider { * @return the automation compositions found */ @Transactional(readOnly = true) - public List<AutomationComposition> getAutomationCompositions(final String name, final String version) { + public List<AutomationComposition> getAutomationCompositions(final UUID compositionId, final String name, + final String version) { + + return ProviderUtils + .asEntityList(automationCompositionRepository.findAll(createExample(compositionId, name, version))); + } - return ProviderUtils.asEntityList( - automationCompositionRepository.getFiltered(JpaAutomationComposition.class, name, version)); + private Example<JpaAutomationComposition> createExample(final UUID compositionId, final String name, + final String version) { + var example = new JpaAutomationComposition(); + example.setCompositionId(compositionId != null ? compositionId.toString() : null); + example.setName(name); + example.setVersion(version); + example.setInstanceId(null); + example.setElements(null); + example.setState(null); + + return Example.of(example); } /** @@ -169,14 +165,14 @@ public class AutomationCompositionProvider { * @return the automation composition deleted */ public AutomationComposition deleteAutomationComposition(@NonNull final UUID instanceId) { - var jpaDeleteAutomationComposition = automationCompositionRepository.findByInstanceId(instanceId.toString()); + var jpaDeleteAutomationComposition = automationCompositionRepository.findById(instanceId.toString()); if (jpaDeleteAutomationComposition.isEmpty()) { var errorMessage = "delete of automation composition \"" + instanceId + "\" failed, automation composition does not exist"; throw new PfModelRuntimeException(Response.Status.NOT_FOUND, errorMessage); } - automationCompositionRepository.deleteById(jpaDeleteAutomationComposition.get().getKey()); + automationCompositionRepository.deleteById(instanceId.toString()); return jpaDeleteAutomationComposition.get().toAuthorative(); } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java index 9dc07ae72..871aa8902 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ProviderUtils.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021-2022 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 lombok.AccessLevel; import lombok.NoArgsConstructor; import org.onap.policy.common.parameters.BeanValidationResult; import org.onap.policy.models.base.PfAuthorative; -import org.onap.policy.models.base.PfConcept; import org.onap.policy.models.base.PfModelRuntimeException; import org.onap.policy.models.base.Validated; @@ -44,7 +43,7 @@ public final class ProviderUtils { * @param conceptDescription the description used for validation result * @return the list of Jpa objects */ - public static <A, J extends PfConcept & PfAuthorative<A>> List<J> getJpaAndValidateList( + public static <A, J extends Validated & PfAuthorative<A>> List<J> getJpaAndValidateList( List<A> authorativeConceptList, Supplier<J> jpaSupplier, String conceptDescription) { var validationResult = new BeanValidationResult(conceptDescription + " List", authorativeConceptList); diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java index aba752667..bb8b3e6d9 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/AutomationCompositionRepository.java @@ -21,17 +21,14 @@ package org.onap.policy.clamp.models.acm.persistence.repository; import java.util.List; -import java.util.Optional; import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition; -import org.onap.policy.models.base.PfConceptKey; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.repository.query.QueryByExampleExecutor; import org.springframework.stereotype.Repository; @Repository public interface AutomationCompositionRepository - extends JpaRepository<JpaAutomationComposition, PfConceptKey>, FilterRepository { - - Optional<JpaAutomationComposition> findByInstanceId(String instanceId); + extends JpaRepository<JpaAutomationComposition, String>, QueryByExampleExecutor<JpaAutomationComposition> { List<JpaAutomationComposition> findByCompositionId(String compositionId); } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java index cdedc5eb5..fb4c0bc48 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepository.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,6 @@ package org.onap.policy.clamp.models.acm.persistence.repository; import java.util.List; import org.onap.policy.models.base.PfConcept; -import org.onap.policy.models.dao.PfFilterParametersIntfc; public interface FilterRepository { @@ -33,18 +32,6 @@ public interface FilterRepository { * @param someClass the class of the object to get, a subclass of {@link PfConcept}, if name is null, all concepts * of type T are returned, if name is not null and version is null, all versions of that concept matching the * name are returned. - * @param filterParams filter parameters - * @return the objects that was retrieved from the database - */ - <T extends PfConcept> List<T> getFiltered(Class<T> someClass, PfFilterParametersIntfc filterParams); - - /** - * Get an object from the database, referred to by concept key. - * - * @param <T> the type of the object to get, a subclass of {@link PfConcept} - * @param someClass the class of the object to get, a subclass of {@link PfConcept}, if name is null, all concepts - * of type T are returned, if name is not null and version is null, all versions of that concept matching the - * name are returned. * @param name the name of the object to get, null returns all objects * @param version the version the object to get, null returns all objects for a specified name * @return the objects that was retrieved from the database diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java index d7e81d4da..470f05379 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImpl.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,6 @@ import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import org.onap.policy.models.base.PfConcept; import org.onap.policy.models.dao.PfDao; -import org.onap.policy.models.dao.PfFilterParametersIntfc; import org.onap.policy.models.dao.impl.ProxyDao; import org.springframework.stereotype.Repository; @@ -40,11 +39,6 @@ public class FilterRepositoryImpl implements FilterRepository { } @Override - public <T extends PfConcept> List<T> getFiltered(Class<T> someClass, PfFilterParametersIntfc filterParams) { - return getPfDao().getFiltered(someClass, filterParams); - } - - @Override public <T extends PfConcept> List<T> getFiltered(Class<T> someClass, String name, String version) { return getPfDao().getFiltered(someClass, name, version); } diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java index d38aaf735..3781c3a7d 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. + * Copyright (C) 2021-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -39,16 +39,18 @@ import org.onap.policy.clamp.models.acm.concepts.Participant; import org.onap.policy.common.utils.coder.CoderException; import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.models.base.PfConceptKey; -import org.onap.policy.models.base.PfKey; -import org.onap.policy.models.base.PfReferenceKey; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; /** - * Test the {@link JpaAutomationCompositionElement} class. + * Test the{@link JpaAutomationCompositionElement} class. */ class JpaAutomationCompositionElementTest { - private static final String NULL_KEY_ERROR = "key is marked .*ull but is null"; + private static final String NULL_INSTANCE_ID_ERROR = "instanceId is marked .*ull but is null"; + private static final String NULL_ELEMENT_ID_ERROR = "elementId is marked .*ull but is null"; + private static final String NULL_ERROR = " is marked .*ull but is null"; + private static final String ELEMENT_ID = "a95757ba-b34a-4049-a2a8-46773abcbe5e"; + private static final String INSTANCE_ID = "a78757co-b34a-8949-a2a8-46773abcbe2a"; @Test void testJpaAutomationCompositionElementConstructor() { @@ -57,182 +59,121 @@ class JpaAutomationCompositionElementTest { }).hasMessageMatching("copyConcept is marked .*ull but is null"); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement((PfReferenceKey) null); - }).hasMessageMatching(NULL_KEY_ERROR); + new JpaAutomationCompositionElement("key", null); + }).hasMessageMatching(NULL_INSTANCE_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, null, null, null); - }).hasMessageMatching(NULL_KEY_ERROR); + new JpaAutomationCompositionElement(null, "key"); + }).hasMessageMatching(NULL_ELEMENT_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, null, null, AutomationCompositionState.UNINITIALISED); - }).hasMessageMatching(NULL_KEY_ERROR); + new JpaAutomationCompositionElement(null, null); + }).hasMessageMatching(NULL_ELEMENT_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, null, new PfConceptKey("participant", "0.0.1"), null); - }).hasMessageMatching(NULL_KEY_ERROR); + new JpaAutomationCompositionElement(null, null, null, null, null); + }).hasMessageMatching(NULL_ELEMENT_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, null, new PfConceptKey("participant", "0.0.1"), - AutomationCompositionState.UNINITIALISED); - }).hasMessageMatching(NULL_KEY_ERROR); + new JpaAutomationCompositionElement("key", null, null, null, AutomationCompositionState.UNINITIALISED); + }).hasMessageMatching(NULL_INSTANCE_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, new PfConceptKey(), null, null); - }).hasMessageMatching(NULL_KEY_ERROR); + new JpaAutomationCompositionElement("key", "key", null, new PfConceptKey("participant", "0.0.1"), null); + }).hasMessageMatching("definition" + NULL_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, new PfConceptKey(), null, - AutomationCompositionState.UNINITIALISED); - }).hasMessageMatching(NULL_KEY_ERROR); + new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), null, + AutomationCompositionState.UNINITIALISED); + }).hasMessageMatching("participantType" + NULL_ERROR); assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"), - null); - }).hasMessageMatching(NULL_KEY_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(null, new PfConceptKey(), new PfConceptKey("participant", "0.0.1"), - AutomationCompositionState.UNINITIALISED); - }).hasMessageMatching(NULL_KEY_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(new PfReferenceKey(), null, null, null); - }).hasMessageMatching("definition is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(new PfReferenceKey(), null, null, - AutomationCompositionState.UNINITIALISED); - }).hasMessageMatching("definition is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"), - null); - }).hasMessageMatching("definition is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(new PfReferenceKey(), null, new PfConceptKey("participant", "0.0.1"), - AutomationCompositionState.UNINITIALISED); - }).hasMessageMatching("definition is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(), null, null); - }).hasMessageMatching("participantType is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(), null, - AutomationCompositionState.UNINITIALISED); - }).hasMessageMatching("participantType is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(), - new PfConceptKey("participant", "0.0.1"), null); - }).hasMessageMatching("state is marked .*ull but is null"); + new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), new PfConceptKey(), null); + }).hasMessageMatching("state" + NULL_ERROR); assertNotNull(new JpaAutomationCompositionElement()); - assertNotNull(new JpaAutomationCompositionElement((new PfReferenceKey()))); - assertNotNull(new JpaAutomationCompositionElement(new PfReferenceKey(), new PfConceptKey(), - new PfConceptKey("participant", "0.0.1"), AutomationCompositionState.UNINITIALISED)); + assertNotNull(new JpaAutomationCompositionElement("key", "key")); + assertNotNull(new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), + new PfConceptKey("participant", "0.0.1"), AutomationCompositionState.UNINITIALISED)); } @Test void testJpaAutomationCompositionElement() { - var testJpaAutomationCompositionElement = - createJpaAutomationCompositionElementInstance(); + var testJpaAcElement = createJpaAutomationCompositionElementInstance(); var ace = createAutomationCompositionElementInstance(); - assertEquals(ace, testJpaAutomationCompositionElement.toAuthorative()); + assertEquals(ace, testJpaAcElement.toAuthorative()); assertThatThrownBy(() -> { - testJpaAutomationCompositionElement.fromAuthorative(null); + testJpaAcElement.fromAuthorative(null); }).hasMessageMatching("element is marked .*ull but is null"); assertThatThrownBy(() -> new JpaAutomationCompositionElement((JpaAutomationCompositionElement) null)) - .isInstanceOf(NullPointerException.class); - - var testJpaAutomationCompositionElementFa = new JpaAutomationCompositionElement(); - testJpaAutomationCompositionElementFa.setKey(null); - testJpaAutomationCompositionElementFa.fromAuthorative(ace); - assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa); - testJpaAutomationCompositionElementFa.setKey(PfReferenceKey.getNullKey()); - testJpaAutomationCompositionElementFa.fromAuthorative(ace); - assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa); - testJpaAutomationCompositionElementFa.setKey( - new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, "a95757ba-b34a-4049-a2a8-46773abcbe5e")); - testJpaAutomationCompositionElementFa.fromAuthorative(ace); - assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElementFa); - - assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e", - testJpaAutomationCompositionElement.getKey().getLocalName()); - assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e", - new JpaAutomationCompositionElement(createAutomationCompositionElementInstance()).getKey().getLocalName()); - assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e", - ((PfReferenceKey) new JpaAutomationCompositionElement(createAutomationCompositionElementInstance()) - .getKeys().get(0)).getLocalName()); - - testJpaAutomationCompositionElement.clean(); - assertEquals("a95757ba-b34a-4049-a2a8-46773abcbe5e", - testJpaAutomationCompositionElement.getKey().getLocalName()); - - testJpaAutomationCompositionElement.setDescription(" A Message "); - testJpaAutomationCompositionElement.clean(); - assertEquals("A Message", testJpaAutomationCompositionElement.getDescription()); - - var testJpaAutomationCompositionElement2 = - new JpaAutomationCompositionElement(testJpaAutomationCompositionElement); - assertEquals(testJpaAutomationCompositionElement, testJpaAutomationCompositionElement2); + .isInstanceOf(NullPointerException.class); + + var testJpaAcElementFa = + new JpaAutomationCompositionElement(ace.getId().toString(), testJpaAcElement.getInstanceId()); + testJpaAcElementFa.fromAuthorative(ace); + assertEquals(testJpaAcElement, testJpaAcElementFa); + + assertEquals(ELEMENT_ID, testJpaAcElement.getElementId()); + + var testJpaAutomationCompositionElement2 = new JpaAutomationCompositionElement(testJpaAcElement); + assertEquals(testJpaAcElement, testJpaAutomationCompositionElement2); } @Test void testJpaAutomationCompositionElementOrderedState() throws CoderException { var testAutomationCompositionElement = createAutomationCompositionElementInstance(); - var testJpaAutomationCompositionElement = - createJpaAutomationCompositionElementInstance(); + var testJpaAutomationCompositionElement = createJpaAutomationCompositionElementInstance(); testJpaAutomationCompositionElement.setOrderedState(null); assertEquals(testAutomationCompositionElement, testJpaAutomationCompositionElement.toAuthorative()); testJpaAutomationCompositionElement.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); var noOrderedStateAce = new StandardCoder().decode( - new File("src/test/resources/json/AutomationCompositionElementNoOrderedState.json"), - AutomationCompositionElement.class); + new File("src/test/resources/json/AutomationCompositionElementNoOrderedState.json"), + AutomationCompositionElement.class); var noOrderedStateJpaAce = new JpaAutomationCompositionElement(noOrderedStateAce); assertNull(noOrderedStateJpaAce.getOrderedState()); noOrderedStateAce.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); noOrderedStateJpaAce = new JpaAutomationCompositionElement(noOrderedStateAce); + noOrderedStateJpaAce.setInstanceId(testJpaAutomationCompositionElement.getInstanceId()); + noOrderedStateJpaAce.setElementId(testJpaAutomationCompositionElement.getElementId()); assertEquals(testJpaAutomationCompositionElement, noOrderedStateJpaAce); } @Test void testJpaAutomationCompositionElementValidation() { - var testJpaAutomationCompositionElement = - createJpaAutomationCompositionElementInstance(); + var testJpaAutomationCompositionElement = createJpaAutomationCompositionElementInstance(); assertThatThrownBy(() -> testJpaAutomationCompositionElement.validate(null)) - .hasMessageMatching("fieldName is marked .*ull but is null"); + .hasMessageMatching("fieldName is marked .*ull but is null"); assertTrue(testJpaAutomationCompositionElement.validate("").isValid()); } @Test void testJpaAutomationCompositionElementCompareTo() { - var testJpaAutomationCompositionElement = - createJpaAutomationCompositionElementInstance(); + var testJpaAutomationCompositionElement = createJpaAutomationCompositionElementInstance(); var otherJpaAutomationCompositionElement = - new JpaAutomationCompositionElement(testJpaAutomationCompositionElement); + new JpaAutomationCompositionElement(testJpaAutomationCompositionElement); assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); assertEquals(-1, testJpaAutomationCompositionElement.compareTo(null)); assertEquals(0, testJpaAutomationCompositionElement.compareTo(testJpaAutomationCompositionElement)); assertNotEquals(0, - testJpaAutomationCompositionElement.compareTo(new DummyJpaAutomationCompositionElementChild())); + testJpaAutomationCompositionElement.compareTo(new DummyJpaAutomationCompositionElementChild())); - testJpaAutomationCompositionElement - .setKey(new PfReferenceKey("BadValue", "0.0.1", "a95757ba-b34a-4049-a2a8-46773abcbe5e")); + testJpaAutomationCompositionElement.setElementId("BadValue"); assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); - testJpaAutomationCompositionElement.setKey( - new PfReferenceKey(PfKey.NULL_KEY_NAME, PfKey.NULL_KEY_VERSION, "a95757ba-b34a-4049-a2a8-46773abcbe5e")); + testJpaAutomationCompositionElement.setElementId(ELEMENT_ID); + assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); + + testJpaAutomationCompositionElement.setInstanceId("BadValue"); + assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); + testJpaAutomationCompositionElement.setInstanceId(INSTANCE_ID); assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); testJpaAutomationCompositionElement.setDefinition(new PfConceptKey("BadValue", "0.0.1")); @@ -261,7 +202,7 @@ class JpaAutomationCompositionElementTest { assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement)); assertEquals(testJpaAutomationCompositionElement, - new JpaAutomationCompositionElement(testJpaAutomationCompositionElement)); + new JpaAutomationCompositionElement(testJpaAutomationCompositionElement)); } @Test @@ -274,7 +215,7 @@ class JpaAutomationCompositionElementTest { assertEquals(ace0, ace0); assertNotEquals(null, ace0); - var ace1 = new JpaAutomationCompositionElement(); + var ace1 = new JpaAutomationCompositionElement(ace0.getElementId(), ace0.getInstanceId()); ace1.setDefinition(new PfConceptKey("defName", "0.0.1")); ace1.setDescription("Description"); @@ -289,25 +230,23 @@ class JpaAutomationCompositionElementTest { assertNotEquals(ace1, ace0); - var ace2 = new JpaAutomationCompositionElement(); + var ace2 = new JpaAutomationCompositionElement(ace0.getElementId(), ace0.getInstanceId()); assertEquals(ace2, ace0); } private JpaAutomationCompositionElement createJpaAutomationCompositionElementInstance() { var testAce = createAutomationCompositionElementInstance(); - var testJpaAutomationCompositionElement = new JpaAutomationCompositionElement(); - testJpaAutomationCompositionElement.setKey(null); - testJpaAutomationCompositionElement.fromAuthorative(testAce); - testJpaAutomationCompositionElement.setKey(PfReferenceKey.getNullKey()); - testJpaAutomationCompositionElement.fromAuthorative(testAce); - testJpaAutomationCompositionElement.setProperties(Map.of("key", "{}")); - - return testJpaAutomationCompositionElement; + var testJpaAcElement = + new JpaAutomationCompositionElement(testAce.getId().toString(), INSTANCE_ID); + testJpaAcElement.fromAuthorative(testAce); + testJpaAcElement.setProperties(Map.of("key", "{}")); + + return testJpaAcElement; } private AutomationCompositionElement createAutomationCompositionElementInstance() { var automationCompositionElement = new AutomationCompositionElement(); - automationCompositionElement.setId(UUID.fromString("a95757ba-b34a-4049-a2a8-46773abcbe5e")); + automationCompositionElement.setId(UUID.fromString(ELEMENT_ID)); automationCompositionElement.setDefinition(new ToscaConceptIdentifier("aceDef", "0.0.1")); automationCompositionElement.setParticipantType(new ToscaConceptIdentifier("participantType", "0.0.1")); automationCompositionElement.setProperties(Map.of("key", "{}")); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java index f5a2149b4..2164f5782 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. + * Copyright (C) 2021-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,15 +21,15 @@ package org.onap.policy.clamp.models.acm.persistence.concepts; import static org.assertj.core.api.Assertions.assertThat; -import static org.assertj.core.api.Assertions.assertThatCode; import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.Assert.assertNull; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; import java.io.File; +import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.UUID; import org.junit.jupiter.api.Test; @@ -42,12 +42,13 @@ import org.onap.policy.common.utils.coder.StandardCoder; import org.onap.policy.models.base.PfConceptKey; /** - * Test the {@link JpaAutomationCompositionTest} class. + * Test the{@link JpaAutomationCompositionTest} class. */ class JpaAutomationCompositionTest { - private static final String NULL_KEY_ERROR = "instanceId is marked .*ull but is null"; - private static final UUID INSTANCE_ID = UUID.fromString("709c62b3-8918-41b9-a747-d21eb79c6c20"); + private static final String NULL_INSTANCE_ID_ERROR = "instanceId is marked .*ull but is null"; + private static final String NULL_TEXT_ERROR = " is marked .*ull but is null"; + private static final String INSTANCE_ID = "709c62b3-8918-41b9-a747-d21eb79c6c20"; private static final String COMPOSITION_ID = "709c62b3-8918-41b9-a747-e21eb79c6c41"; @Test @@ -58,69 +59,29 @@ class JpaAutomationCompositionTest { assertThatThrownBy(() -> { new JpaAutomationComposition(null, null, null, null, null); - }).hasMessageMatching(NULL_KEY_ERROR); + }).hasMessageMatching(NULL_INSTANCE_ID_ERROR); assertThatThrownBy(() -> { - new JpaAutomationComposition(null, null, null, null, new LinkedHashMap<>()); - }).hasMessageMatching(NULL_KEY_ERROR); + new JpaAutomationComposition(INSTANCE_ID, null, null, null, new ArrayList<>()); + }).hasMessageMatching("key" + NULL_TEXT_ERROR); assertThatThrownBy(() -> { - new JpaAutomationComposition(null, null, null, AutomationCompositionState.UNINITIALISED, null); - }).hasMessageMatching(NULL_KEY_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(null, null, null, AutomationCompositionState.UNINITIALISED, - new LinkedHashMap<>()); - }).hasMessageMatching(NULL_KEY_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(null, null, "key", null, new LinkedHashMap<>()); - }).hasMessageMatching(NULL_KEY_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(null, null, "key", AutomationCompositionState.UNINITIALISED, null); - }).hasMessageMatching(NULL_KEY_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(null, null, "key", AutomationCompositionState.UNINITIALISED, - new LinkedHashMap<>()); - }).hasMessageMatching(NULL_KEY_ERROR); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(INSTANCE_ID.toString(), new PfConceptKey(), null, null, null); - }).hasMessageMatching("compositionId is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(INSTANCE_ID.toString(), new PfConceptKey(), null, null, new LinkedHashMap<>()); - }).hasMessageMatching("compositionId is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(INSTANCE_ID.toString(), new PfConceptKey(), null, + new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), null, AutomationCompositionState.UNINITIALISED, null); - }).hasMessageMatching("compositionId is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(INSTANCE_ID.toString(), new PfConceptKey(), null, - AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>()); - }).hasMessageMatching("compositionId is marked .*ull but is null"); + }).hasMessageMatching("compositionId" + NULL_TEXT_ERROR); assertThatThrownBy(() -> { - new JpaAutomationComposition(INSTANCE_ID.toString(), new PfConceptKey(), "key", null, null); - }).hasMessageMatching("state is marked .*ull but is null"); + new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(), null, null); + }).hasMessageMatching("state" + NULL_TEXT_ERROR); assertThatThrownBy(() -> { - new JpaAutomationComposition(INSTANCE_ID.toString(), new PfConceptKey(), "key", null, - new LinkedHashMap<>()); - }).hasMessageMatching("state is marked .*ull but is null"); - - assertThatThrownBy(() -> { - new JpaAutomationComposition(INSTANCE_ID.toString(), new PfConceptKey(), "key", + new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(), AutomationCompositionState.UNINITIALISED, null); - }).hasMessageMatching("elements is marked .*ull but is null"); + }).hasMessageMatching("elements" + NULL_TEXT_ERROR); assertNotNull(new JpaAutomationComposition()); - assertNotNull(new JpaAutomationComposition(INSTANCE_ID.toString(), new PfConceptKey(), "key", - AutomationCompositionState.UNINITIALISED, new LinkedHashMap<>())); + assertNotNull(new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(), + AutomationCompositionState.UNINITIALISED, new ArrayList<>())); } @Test @@ -138,29 +99,13 @@ class JpaAutomationCompositionTest { .isInstanceOf(NullPointerException.class); var testJpaAutomationCompositionFa = new JpaAutomationComposition(); - testJpaAutomationCompositionFa.setKey(null); - testJpaAutomationCompositionFa.fromAuthorative(participant); - assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa); - testJpaAutomationCompositionFa.setKey(PfConceptKey.getNullKey()); - testJpaAutomationCompositionFa.fromAuthorative(participant); - assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa); - testJpaAutomationCompositionFa.setKey(new PfConceptKey("automation-composition", "0.0.1")); + testJpaAutomationCompositionFa.setInstanceId(null); testJpaAutomationCompositionFa.fromAuthorative(participant); assertEquals(testJpaAutomationComposition, testJpaAutomationCompositionFa); - assertEquals("automation-composition", testJpaAutomationComposition.getKey().getName()); - assertEquals("automation-composition", - new JpaAutomationComposition(createAutomationCompositionInstance()).getKey().getName()); + assertEquals("automation-composition", testJpaAutomationComposition.getName()); assertEquals("automation-composition", - ((PfConceptKey) new JpaAutomationComposition(createAutomationCompositionInstance()).getKeys().get(0)) - .getName()); - - testJpaAutomationComposition.clean(); - assertEquals("automation-composition", testJpaAutomationComposition.getKey().getName()); - - testJpaAutomationComposition.setDescription(" A Message "); - testJpaAutomationComposition.clean(); - assertEquals("A Message", testJpaAutomationComposition.getDescription()); + new JpaAutomationComposition(createAutomationCompositionInstance()).getName()); var testJpaAutomationComposition2 = new JpaAutomationComposition(testJpaAutomationComposition); assertEquals(testJpaAutomationComposition, testJpaAutomationComposition2); @@ -179,7 +124,7 @@ class JpaAutomationCompositionTest { new StandardCoder().decode(new File("src/test/resources/json/AutomationCompositionNoOrderedState.json"), AutomationComposition.class); - noOrderedStateAc.setInstanceId(INSTANCE_ID); + noOrderedStateAc.setInstanceId(UUID.fromString(INSTANCE_ID)); var noOrderedStateJpaAc = new JpaAutomationComposition(noOrderedStateAc); assertNull(noOrderedStateJpaAc.getOrderedState()); noOrderedStateAc.setOrderedState(AutomationCompositionOrderedState.UNINITIALISED); @@ -190,12 +135,9 @@ class JpaAutomationCompositionTest { new StandardCoder().decode(new File("src/test/resources/providers/TestAutomationCompositions.json"), AutomationCompositions.class).getAutomationCompositionList().get(0); - acWithElements.setInstanceId(INSTANCE_ID); + acWithElements.setInstanceId(UUID.fromString(INSTANCE_ID)); var jpaAutomationCompositionWithElements = new JpaAutomationComposition(acWithElements); assertEquals(4, jpaAutomationCompositionWithElements.getElements().size()); - assertEquals(17, jpaAutomationCompositionWithElements.getKeys().size()); - assertThatCode(jpaAutomationCompositionWithElements::clean).doesNotThrowAnyException(); - assertEquals(acWithElements, jpaAutomationCompositionWithElements.toAuthorative()); } @@ -219,9 +161,9 @@ class JpaAutomationCompositionTest { assertEquals(0, testJpaAutomationComposition.compareTo(testJpaAutomationComposition)); assertNotEquals(0, testJpaAutomationComposition.compareTo(new DummyJpaAutomationCompositionChild())); - testJpaAutomationComposition.setKey(new PfConceptKey("BadValue", "0.0.1")); + testJpaAutomationComposition.setInstanceId("BadValue"); assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition)); - testJpaAutomationComposition.setKey(new PfConceptKey("automation-composition", "0.0.1")); + testJpaAutomationComposition.setInstanceId(INSTANCE_ID); assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition)); testJpaAutomationComposition.setCompositionId(UUID.randomUUID().toString()); @@ -229,6 +171,16 @@ class JpaAutomationCompositionTest { testJpaAutomationComposition.setCompositionId(COMPOSITION_ID); assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition)); + testJpaAutomationComposition.setName("BadValue"); + assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition)); + testJpaAutomationComposition.setName("automation-composition"); + assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition)); + + testJpaAutomationComposition.setVersion("0.0.0"); + assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition)); + testJpaAutomationComposition.setVersion("0.0.1"); + assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition)); + testJpaAutomationComposition.setState(AutomationCompositionState.PASSIVE); assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition)); testJpaAutomationComposition.setState(AutomationCompositionState.UNINITIALISED); @@ -267,8 +219,8 @@ class JpaAutomationCompositionTest { ac1.setCompositionId(UUID.randomUUID().toString()); ac1.setDescription("Description"); - ac1.setElements(new LinkedHashMap<>()); - ac1.setKey(new PfConceptKey("participant", "0.0.1")); + ac1.setElements(new ArrayList<>()); + ac1.setInstanceId(INSTANCE_ID); ac1.setState(AutomationCompositionState.UNINITIALISED); assertThat(ac1.toString()).contains("AutomationComposition("); @@ -287,9 +239,6 @@ class JpaAutomationCompositionTest { private JpaAutomationComposition createJpaAutomationCompositionInstance() { var testAutomationComposition = createAutomationCompositionInstance(); var testJpaAutomationComposition = new JpaAutomationComposition(); - testJpaAutomationComposition.setKey(null); - testJpaAutomationComposition.fromAuthorative(testAutomationComposition); - testJpaAutomationComposition.setKey(PfConceptKey.getNullKey()); testJpaAutomationComposition.fromAuthorative(testAutomationComposition); return testJpaAutomationComposition; @@ -298,7 +247,7 @@ class JpaAutomationCompositionTest { private AutomationComposition createAutomationCompositionInstance() { var testAutomationComposition = new AutomationComposition(); testAutomationComposition.setName("automation-composition"); - testAutomationComposition.setInstanceId(INSTANCE_ID); + testAutomationComposition.setInstanceId(UUID.fromString(INSTANCE_ID)); testAutomationComposition.setVersion("0.0.1"); testAutomationComposition.setCompositionId(UUID.fromString(COMPOSITION_ID)); testAutomationComposition.setElements(new LinkedHashMap<>()); diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java index d7d96e9bd..ba1e33c27 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProviderTest.java @@ -24,33 +24,27 @@ import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; import java.util.List; import java.util.Optional; import java.util.UUID; -import javax.persistence.EntityNotFoundException; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.concepts.AutomationComposition; +import org.mockito.Mockito; import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions; import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition; import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository; 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.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.springframework.data.domain.Example; class AutomationCompositionProviderTest { private static final String OBJECT_IS_NULL = "automationComposition is marked non-null but is null"; - private static final String ID_NAME = "PMSHInstance1"; - private static final String ID_VERSION = "1.0.1"; - private static final String ID_NAME_NOT_EXTST = "not_exist"; - private static final Coder CODER = new StandardCoder(); private static final String AUTOMATION_COMPOSITION_JSON = "src/test/resources/providers/TestAutomationCompositions.json"; @@ -100,55 +94,58 @@ class AutomationCompositionProviderTest { @Test void testGetAutomationCompositions() throws Exception { - var automationComposition0 = inputAutomationCompositions.getAutomationCompositionList().get(1); - var name = automationComposition0.getName(); - var version = automationComposition0.getVersion(); - var automationComposition1 = inputAutomationCompositions.getAutomationCompositionList().get(1); - var automationCompositionRepository = mock(AutomationCompositionRepository.class); - when(automationCompositionRepository.getFiltered(eq(JpaAutomationComposition.class), any(), any())) - .thenReturn(List.of(new JpaAutomationComposition(automationComposition0), - new JpaAutomationComposition(automationComposition1))); - when(automationCompositionRepository.findById(automationComposition0.getKey().asIdentifier().asConceptKey())) - .thenReturn(Optional.of(new JpaAutomationComposition(automationComposition0))); - when(automationCompositionRepository.getById(automationComposition0.getKey().asIdentifier().asConceptKey())) - .thenReturn(new JpaAutomationComposition(automationComposition0)); - when(automationCompositionRepository.getFiltered(JpaAutomationComposition.class, name, version)) - .thenReturn(List.of(new JpaAutomationComposition(automationComposition0))); - when(automationCompositionRepository.findById(automationComposition1.getKey().asIdentifier().asConceptKey())) - .thenReturn(Optional.of(new JpaAutomationComposition(automationComposition1))); - var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository); - assertEquals(1, automationCompositionProvider.getAutomationCompositions(name, version).size()); - var ac = automationCompositionProvider - .findAutomationComposition(new ToscaConceptIdentifier(ID_NAME, ID_VERSION)) - .orElse(new AutomationComposition()); - assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(1), ac); + var automationComposition = inputAutomationCompositions.getAutomationCompositionList().get(0); + var acList = automationCompositionProvider.getAutomationCompositions(UUID.randomUUID(), + automationComposition.getName(), automationComposition.getVersion()); + assertThat(acList).isEmpty(); - ac = automationCompositionProvider.getAutomationComposition(new ToscaConceptIdentifier(ID_NAME, ID_VERSION)); - assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(1), ac); + when(automationCompositionRepository.findAll(Mockito.<Example<JpaAutomationComposition>>any())) + .thenReturn(inputAutomationCompositionsJpa); + acList = automationCompositionProvider.getAutomationCompositions(automationComposition.getCompositionId(), null, + null); + assertThat(acList).hasSize(2); + } - when(automationCompositionRepository.getById(any())).thenThrow(EntityNotFoundException.class); + @Test + void testGetAutomationComposition() { + var automationCompositionRepository = mock(AutomationCompositionRepository.class); + var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository); - assertThatThrownBy(() -> automationCompositionProvider - .getAutomationComposition(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION))) + var automationComposition = inputAutomationCompositions.getAutomationCompositionList().get(0); + assertThatThrownBy( + () -> automationCompositionProvider.getAutomationComposition(automationComposition.getInstanceId())) .hasMessageMatching("AutomationComposition not found"); - assertThat(automationCompositionProvider - .findAutomationComposition(new ToscaConceptIdentifier(ID_NAME_NOT_EXTST, ID_VERSION))).isEmpty(); + when(automationCompositionRepository.findById(automationComposition.getInstanceId().toString())) + .thenReturn(Optional.of(inputAutomationCompositionsJpa.get(0))); + var ac = automationCompositionProvider.getAutomationComposition(automationComposition.getInstanceId()); + assertEquals(automationComposition, ac); } @Test - void testGetAutomationComposition() { + void testFindAutomationComposition() { var automationCompositionRepository = mock(AutomationCompositionRepository.class); var automationCompositionProvider = new AutomationCompositionProvider(automationCompositionRepository); var automationComposition = inputAutomationCompositions.getAutomationCompositionList().get(0); - when(automationCompositionRepository.findByInstanceId(automationComposition.getInstanceId().toString())) + var acOpt = automationCompositionProvider.findAutomationComposition(automationComposition.getInstanceId()); + assertThat(acOpt).isEmpty(); + + acOpt = automationCompositionProvider.findAutomationComposition(automationComposition.getKey().asIdentifier()); + assertThat(acOpt).isEmpty(); + + when(automationCompositionRepository.findById(automationComposition.getInstanceId().toString())) .thenReturn(Optional.of(inputAutomationCompositionsJpa.get(0))); - var ac = automationCompositionProvider.getAutomationComposition(automationComposition.getInstanceId()); - assertEquals(inputAutomationCompositions.getAutomationCompositionList().get(0), ac); + acOpt = automationCompositionProvider.findAutomationComposition(automationComposition.getInstanceId()); + assertEquals(automationComposition, acOpt.get()); + + when(automationCompositionRepository.findOne(Mockito.<Example<JpaAutomationComposition>>any())) + .thenReturn(Optional.of(inputAutomationCompositionsJpa.get(0))); + acOpt = automationCompositionProvider.findAutomationComposition(automationComposition.getKey().asIdentifier()); + assertEquals(automationComposition, acOpt.get()); } @Test @@ -173,7 +170,7 @@ class AutomationCompositionProviderTest { .hasMessageMatching(".*.failed, automation composition does not exist"); var automationComposition = inputAutomationCompositions.getAutomationCompositionList().get(0); - when(automationCompositionRepository.findByInstanceId(automationComposition.getInstanceId().toString())) + when(automationCompositionRepository.findById(automationComposition.getInstanceId().toString())) .thenReturn(Optional.of(inputAutomationCompositionsJpa.get(0))); var deletedAc = diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java index 7210a6afd..c441c2fe8 100644 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/repository/FilterRepositoryImplTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation. + * Copyright (C) 2021-2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,28 +22,29 @@ package org.onap.policy.clamp.models.acm.persistence.repository; import static org.assertj.core.api.Assertions.assertThat; +import java.util.ArrayList; import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions; -import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition; +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.provider.ProviderUtils; 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.dao.PfDao; -import org.onap.policy.models.dao.PfFilterParameters; import org.onap.policy.models.provider.PolicyModelsProviderParameters; import org.onap.policy.models.provider.impl.ModelsProvider; class FilterRepositoryImplTest { - private static final String AUTOMATION_COMPOSITION_JSON = - "src/test/resources/providers/TestAutomationCompositions.json"; + private static final String PARTICIPANT_JSON = "src/test/resources/providers/TestParticipant.json"; + private final List<Participant> inputParticipants = new ArrayList<>(); + private List<JpaParticipant> jpaParticipantList; + private final String originalJson = ResourceUtils.getResourceAsString(PARTICIPANT_JSON); private static final Coder CODER = new StandardCoder(); + private static final AtomicInteger dbNameCounter = new AtomicInteger(); - private static final String originalJson = ResourceUtils.getResourceAsString(AUTOMATION_COMPOSITION_JSON); - private static List<JpaAutomationComposition> jpaAutomationCompositions; private PfDao pfDao; @BeforeEach @@ -58,12 +59,9 @@ class FilterRepositoryImplTest { parameters.setPersistenceUnit("ToscaConceptTest"); pfDao = ModelsProvider.init(parameters); - var inputAutomationCompositions = CODER.decode(originalJson, AutomationCompositions.class); - jpaAutomationCompositions = - ProviderUtils.getJpaAndValidateList(inputAutomationCompositions.getAutomationCompositionList(), - JpaAutomationComposition::new, "AutomationCompositions"); - - pfDao.createCollection(jpaAutomationCompositions); + inputParticipants.add(CODER.decode(originalJson, Participant.class)); + jpaParticipantList = ProviderUtils.getJpaAndValidateList(inputParticipants, JpaParticipant::new, "participant"); + pfDao.createCollection(jpaParticipantList); } @Test @@ -79,31 +77,10 @@ class FilterRepositoryImplTest { return pfDao; } }; - var result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class, null, null); - assertThat(result).hasSize(2); - - result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class, - jpaAutomationCompositions.get(0).getName(), null); + var result = filterRepositoryImpl.getFiltered(JpaParticipant.class, null, null); assertThat(result).hasSize(1); - } - - @Test - void testGetFiltered() { - var filterRepositoryImpl = new FilterRepositoryImpl() { - @Override - protected PfDao getPfDao() { - return pfDao; - } - }; - - // @formatter:off - PfFilterParameters filterParams = PfFilterParameters - .builder() - .name(jpaAutomationCompositions.get(0).getName()) - .build(); - // @formatter:on - var result = filterRepositoryImpl.getFiltered(JpaAutomationComposition.class, filterParams); + result = filterRepositoryImpl.getFiltered(JpaParticipant.class, jpaParticipantList.get(0).getName(), null); assertThat(result).hasSize(1); } } diff --git a/models/src/test/resources/providers/TestAutomationCompositions.json b/models/src/test/resources/providers/TestAutomationCompositions.json index 286759988..bf1d76fbc 100644 --- a/models/src/test/resources/providers/TestAutomationCompositions.json +++ b/models/src/test/resources/providers/TestAutomationCompositions.json @@ -7,7 +7,7 @@ "orderedState": "UNINITIALISED", "elements": { "709c62b3-8918-41b9-a747-e21eb79c6c20": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "id": "709c62b3-8918-41b9-a747-e21eb79c6c20", "definition": { "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", "version": "1.2.3" @@ -21,7 +21,7 @@ "description": "DCAE automation composition element for the PMSH instance 0 automation composition" }, "709c62b3-8918-41b9-a747-e21eb79c6c21": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", + "id": "709c62b3-8918-41b9-a747-e21eb79c6c21", "definition": { "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement", "version": "1.2.3" @@ -35,7 +35,7 @@ "description": "Monitoring Policy element for the PMSH instance 0 automation composition" }, "709c62b3-8918-41b9-a747-e21eb79c6c22": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "id": "709c62b3-8918-41b9-a747-e21eb79c6c22", "definition": { "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement", "version": "1.2.3" @@ -49,7 +49,7 @@ "description": "Operational Policy element for the PMSH instance 0 automation composition" }, "709c62b3-8918-41b9-a747-e21eb79c6c23": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c23", + "id": "709c62b3-8918-41b9-a747-e21eb79c6c23", "definition": { "name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement", "version": "1.2.3" |