aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java6
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrime.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java)14
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAck.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java)14
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java11
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/AutomationCompositionProvider.java12
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java50
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java)16
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeTest.java (renamed from models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java)10
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java9
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java23
-rw-r--r--models/src/test/resources/providers/TestAutomationCompositions.json72
-rw-r--r--models/src/test/resources/providers/TestParticipant.json4
-rw-r--r--models/src/test/resources/providers/UpdateAutomationCompositions.json36
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java24
-rw-r--r--participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java20
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java14
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantPrimeListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java)14
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java48
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java6
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java18
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java28
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java10
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProvider.java123
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java6
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java41
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimeAckListener.java (renamed from runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdateAckListener.java)26
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimePublisher.java (renamed from runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdatePublisher.java)16
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java14
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivatorTest.java16
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java74
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java140
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java48
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java20
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/util/CommonTestData.java5
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationComposition.json31
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json37
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json36
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json31
-rw-r--r--runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json31
41 files changed, 493 insertions, 669 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
index 18a62ae94..363668619 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java
@@ -53,13 +53,10 @@ public class AutomationComposition extends ToscaEntity implements Comparable<Aut
private DeployState deployState = DeployState.UNDEPLOYED;
@NonNull
- private LockState lockState = LockState.LOCKED;
+ private LockState lockState = LockState.NONE;
private Map<UUID, AutomationCompositionElement> elements;
- @NonNull
- private Boolean primed = false;
-
/**
* Copy contructor, does a deep copy.
*
@@ -74,7 +71,6 @@ public class AutomationComposition extends ToscaEntity implements Comparable<Aut
this.deployState = otherAutomationComposition.deployState;
this.lockState = otherAutomationComposition.lockState;
this.elements = PfUtils.mapMap(otherAutomationComposition.elements, AutomationCompositionElement::new);
- this.primed = otherAutomationComposition.primed;
}
@Override
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java
index 502896188..474bcd36f 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -77,13 +77,13 @@ public enum ParticipantMessageType {
/**
* Used by automation composition runtime to send ToscaServiceTemplate to participant.
*/
- PARTICIPANT_UPDATE,
+ PARTICIPANT_PRIME,
/**
* Used by participant to acknowledge the receipt of PARTICIPANT_UPDATE message
* from automation composition runtime.
*/
- PARTICIPANT_UPDATE_ACK,
+ PARTICIPANT_PRIME_ACK,
/**
* Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_DEPLOY message
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrime.java
index 36842a8cf..b9d82a5c8 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrime.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,23 +30,23 @@ import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent the PARTICIPANT_UPDATE message that the ACM runtime sends to a participant.
+ * Class to represent the PARTICIPANT_PRIME message that the ACM runtime sends to a participant.
* the ACM Runtime sends automation composition element Definitions and Common Parameter Values to Participants.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ParticipantUpdate extends ParticipantMessage {
+public class ParticipantPrime extends ParticipantMessage {
// A list of updates to ParticipantDefinitions
private List<ParticipantDefinition> participantDefinitionUpdates = new ArrayList<>();
/**
- * Constructor for instantiating ParticipantUpdate class with message name.
+ * Constructor for instantiating ParticipantPrime class with message name.
*
*/
- public ParticipantUpdate() {
- super(ParticipantMessageType.PARTICIPANT_UPDATE);
+ public ParticipantPrime() {
+ super(ParticipantMessageType.PARTICIPANT_PRIME);
}
/**
@@ -54,7 +54,7 @@ public class ParticipantUpdate extends ParticipantMessage {
*
* @param source source from which to copy
*/
- public ParticipantUpdate(ParticipantUpdate source) {
+ public ParticipantPrime(ParticipantPrime source) {
super(source);
this.participantDefinitionUpdates = PfUtils.mapList(source.participantDefinitionUpdates,
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAck.java
index 2c3a68e22..156fe919c 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAck.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -27,19 +27,19 @@ import lombok.Setter;
import lombok.ToString;
/**
- * Class to represent the PARTICIPANT_UPDATE_ACK message that registered participant sends to the ACM runtime.
+ * Class to represent the PARTICIPANT_PRIME_ACK message that registered participant sends to the ACM runtime.
*/
@Getter
@Setter
@ToString(callSuper = true)
-public class ParticipantUpdateAck extends ParticipantAckMessage {
+public class ParticipantPrimeAck extends ParticipantAckMessage {
/**
- * Constructor for instantiating ParticipantUpdateAck class with message name.
+ * Constructor for instantiating ParticipantPrimeAck class with message name.
*
*/
- public ParticipantUpdateAck() {
- super(ParticipantMessageType.PARTICIPANT_UPDATE_ACK);
+ public ParticipantPrimeAck() {
+ super(ParticipantMessageType.PARTICIPANT_PRIME_ACK);
}
/**
@@ -47,7 +47,7 @@ public class ParticipantUpdateAck extends ParticipantAckMessage {
*
* @param source source from which to copy
*/
- public ParticipantUpdateAck(final ParticipantUpdateAck source) {
+ public ParticipantPrimeAck(final ParticipantPrimeAck source) {
super(source);
}
}
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 00f83122d..2aacc74b6 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
@@ -100,9 +100,6 @@ public class JpaAutomationComposition extends Validated
@Column
private String description;
- @Column(columnDefinition = "TINYINT DEFAULT 1")
- private Boolean primed;
-
@NotNull
@OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinColumn(name = "instanceId", foreignKey = @ForeignKey(name = "ac_element_fk"))
@@ -155,7 +152,6 @@ public class JpaAutomationComposition extends Validated
this.lockState = copyConcept.lockState;
this.description = copyConcept.description;
this.elements = PfUtils.mapList(copyConcept.elements, JpaAutomationCompositionElement::new);
- this.primed = copyConcept.primed;
}
/**
@@ -180,7 +176,6 @@ public class JpaAutomationComposition extends Validated
automationComposition.setDeployState(deployState);
automationComposition.setLockState(lockState);
automationComposition.setDescription(description);
- automationComposition.setPrimed(primed);
automationComposition.setElements(new LinkedHashMap<>(this.elements.size()));
for (var element : this.elements) {
automationComposition.getElements().put(UUID.fromString(element.getElementId()), element.toAuthorative());
@@ -200,7 +195,6 @@ public class JpaAutomationComposition extends Validated
this.deployState = automationComposition.getDeployState();
this.lockState = automationComposition.getLockState();
this.description = automationComposition.getDescription();
- this.primed = automationComposition.getPrimed();
this.elements = new ArrayList<>(automationComposition.getElements().size());
for (var elementEntry : automationComposition.getElements().entrySet()) {
@@ -264,11 +258,6 @@ public class JpaAutomationComposition extends Validated
if (result != 0) {
return result;
}
-
- result = ObjectUtils.compare(primed, other.primed);
- if (result != 0) {
- return result;
- }
return PfUtils.compareObjects(elements, other.elements);
}
}
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 21efc66d3..197955d3a 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
@@ -30,8 +30,11 @@ import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.persistence.concepts.JpaAutomationComposition;
import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
+import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.onap.policy.models.base.PfModelRuntimeException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.springframework.data.domain.Example;
@@ -97,6 +100,7 @@ public class AutomationCompositionProvider {
*/
public AutomationComposition createAutomationComposition(final AutomationComposition automationComposition) {
automationComposition.setInstanceId(UUID.randomUUID());
+ AcmUtils.setCascadedState(automationComposition, DeployState.UNDEPLOYED, LockState.NONE);
var result = automationCompositionRepository.save(ProviderUtils.getJpaAndValidate(automationComposition,
JpaAutomationComposition::new, "automation composition"));
@@ -110,7 +114,9 @@ public class AutomationCompositionProvider {
* @param automationComposition the automation composition to update
* @return the updated automation composition
*/
- public AutomationComposition updateAutomationComposition(final AutomationComposition automationComposition) {
+ public AutomationComposition updateAutomationComposition(
+ @NonNull final AutomationComposition automationComposition) {
+ AcmUtils.setCascadedState(automationComposition, DeployState.UNDEPLOYED, LockState.NONE);
var result = automationCompositionRepository.save(ProviderUtils.getJpaAndValidate(automationComposition,
JpaAutomationComposition::new, "automation composition"));
@@ -154,6 +160,8 @@ public class AutomationCompositionProvider {
example.setInstanceId(null);
example.setElements(null);
example.setState(null);
+ example.setDeployState(null);
+ example.setLockState(null);
return Example.of(example);
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
index 7d1e80f54..af29deb3f 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
@@ -39,6 +39,8 @@ import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.NodeTemplateState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
@@ -97,25 +99,23 @@ public final class AcmUtils {
}
/**
- * Set the Policy information in the service template for the automation composition element.
+ * Get the Policy information in the service template for the deploy message to participants.
*
- * @param acElement automation composition element
* @param toscaServiceTemplate ToscaServiceTemplate
*/
- public static void setAcPolicyInfo(AutomationCompositionElement acElement,
- ToscaServiceTemplate toscaServiceTemplate) {
+ public static ToscaServiceTemplate getToscaServiceTemplateFragment(ToscaServiceTemplate toscaServiceTemplate) {
// Pass respective PolicyTypes or Policies as part of toscaServiceTemplateFragment
if (toscaServiceTemplate.getPolicyTypes() == null
&& toscaServiceTemplate.getToscaTopologyTemplate().getPolicies() == null) {
- return;
+ return new ToscaServiceTemplate();
}
- ToscaServiceTemplate toscaServiceTemplateFragment = new ToscaServiceTemplate();
+ var toscaServiceTemplateFragment = new ToscaServiceTemplate();
toscaServiceTemplateFragment.setPolicyTypes(toscaServiceTemplate.getPolicyTypes());
- ToscaTopologyTemplate toscaTopologyTemplate = new ToscaTopologyTemplate();
+ var toscaTopologyTemplate = new ToscaTopologyTemplate();
toscaTopologyTemplate.setPolicies(toscaServiceTemplate.getToscaTopologyTemplate().getPolicies());
toscaServiceTemplateFragment.setToscaTopologyTemplate(toscaTopologyTemplate);
toscaServiceTemplateFragment.setDataTypes(toscaServiceTemplate.getDataTypes());
- acElement.setToscaServiceTemplateFragment(toscaServiceTemplateFragment);
+ return toscaServiceTemplateFragment;
}
/**
@@ -196,7 +196,7 @@ public final class AcmUtils {
public static List<Entry<String, ToscaNodeTemplate>> extractAcElementsFromServiceTemplate(
ToscaServiceTemplate serviceTemplate) {
return serviceTemplate.getToscaTopologyTemplate().getNodeTemplates().entrySet().stream().filter(
- nodeTemplateEntry -> checkIfNodeTemplateIsAutomationCompositionElement(nodeTemplateEntry.getValue(),
+ nodeTemplateEntry -> checkIfNodeTemplateIsAutomationCompositionElement(nodeTemplateEntry.getValue(),
serviceTemplate))
.collect(Collectors.toList());
}
@@ -308,4 +308,36 @@ public final class AcmUtils {
.collect(Collectors.toList());
// @formatter:on
}
+
+
+ /**
+ * Return true if DeployState and LockState are in a Transitional State.
+ *
+ * @return true if DeployState and LockState are in a Transitional State
+ */
+ public static boolean isInTransitionalState(DeployState deployState, LockState lockState) {
+ return DeployState.DEPLOYING.equals(deployState) || DeployState.UNDEPLOYING.equals(deployState)
+ || LockState.LOCKING.equals(lockState) || LockState.UNLOCKING.equals(lockState);
+ }
+
+ /**
+ * Set the states on the automation composition and on all its automation composition elements.
+ *
+ * @param deployState the DeployState we want the automation composition to transition to
+ * @param lockState the LockState we want the automation composition to transition to
+ */
+ public static void setCascadedState(final AutomationComposition automationComposition,
+ final DeployState deployState, final LockState lockState) {
+ automationComposition.setDeployState(deployState);
+ automationComposition.setLockState(lockState);
+
+ if (MapUtils.isEmpty(automationComposition.getElements())) {
+ return;
+ }
+
+ for (var element : automationComposition.getElements().values()) {
+ element.setDeployState(deployState);
+ element.setLockState(lockState);
+ }
+ }
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAckTest.java
index e2c3454a4..e4684b8d0 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAckTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,30 +30,30 @@ import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
-class ParticipantUpdateAckTest {
+class ParticipantPrimeAckTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new ParticipantUpdateAck(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ParticipantPrimeAck(null)).isInstanceOf(NullPointerException.class);
- final ParticipantUpdateAck orig = new ParticipantUpdateAck();
+ final ParticipantPrimeAck orig = new ParticipantPrimeAck();
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantUpdateAck(orig).toString()));
+ removeVariableFields(new ParticipantPrimeAck(orig).toString()));
// verify with all values
ToscaConceptIdentifier id = new ToscaConceptIdentifier();
id.setName("id");
id.setVersion("1.2.3");
orig.setResponseTo(UUID.randomUUID());
- orig.setMessageType(ParticipantMessageType.PARTICIPANT_UPDATE_ACK);
+ orig.setMessageType(ParticipantMessageType.PARTICIPANT_PRIME_ACK);
orig.setResult(true);
orig.setMessage("Successfully processed message");
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new ParticipantUpdateAck(orig).toString()));
+ removeVariableFields(new ParticipantPrimeAck(orig).toString()));
- assertSerializable(orig, ParticipantUpdateAck.class);
+ assertSerializable(orig, ParticipantPrimeAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeTest.java
index ffbd63f1a..890fc55ae 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeTest.java
@@ -40,12 +40,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
/**
* Test the copy constructor.
*/
-class ParticipantUpdateTest {
+class ParticipantPrimeTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new ParticipantUpdate(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new ParticipantPrime(null)).isInstanceOf(NullPointerException.class);
- var orig = new ParticipantUpdate();
+ var orig = new ParticipantPrime();
// verify with all values
orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(CommonTestData.getParticipantId());
@@ -70,11 +70,11 @@ class ParticipantUpdateTest {
participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition));
orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate));
- var other = new ParticipantUpdate(orig);
+ var other = new ParticipantPrime(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
- assertSerializable(orig, ParticipantUpdate.class);
+ assertSerializable(orig, ParticipantPrime.class);
}
private AutomationCompositionElementDefinition getAcElementDefinition(ToscaConceptIdentifier id) {
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 30e225995..0f10c8c03 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
@@ -60,6 +60,10 @@ class JpaAutomationCompositionTest {
}).hasMessageMatching("copyConcept is marked .*ull but is null");
assertThatThrownBy(() -> {
+ new JpaAutomationComposition((AutomationComposition) null);
+ }).hasMessageMatching("authorativeConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
new JpaAutomationComposition(null, null, null, null, null, null, null);
}).hasMessageMatching(NULL_INSTANCE_ID_ERROR);
@@ -211,11 +215,6 @@ class JpaAutomationCompositionTest {
testJpaAutomationComposition.setDescription(null);
assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
- testJpaAutomationComposition.setPrimed(true);
- assertNotEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
- testJpaAutomationComposition.setPrimed(false);
- assertEquals(0, testJpaAutomationComposition.compareTo(otherJpaAutomationComposition));
-
assertEquals(testJpaAutomationComposition, new JpaAutomationComposition(testJpaAutomationComposition));
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
index 413139999..c16beaf87 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java
@@ -39,6 +39,8 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.document.concepts.DocToscaServiceTemplate;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -58,6 +60,15 @@ class AcmUtilsTest {
private static final String TOSCA_TEMPLATE_YAML = "clamp/acm/pmsh/funtional-pmsh-usecase.yaml";
@Test
+ void testIsInTransitionalState() {
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKED)).isFalse();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYING, LockState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.UNDEPLOYING, LockState.NONE)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.LOCKING)).isTrue();
+ assertThat(AcmUtils.isInTransitionalState(DeployState.DEPLOYED, LockState.UNLOCKING)).isTrue();
+ }
+
+ @Test
void testCommonUtilsParticipantUpdate() {
var acElement = new AutomationCompositionElement();
List<ParticipantDeploy> participantUpdates = new ArrayList<>();
@@ -111,10 +122,9 @@ class AcmUtilsTest {
@Test
void testCommonUtilsServiceTemplate() {
- var acElement = new AutomationCompositionElement();
var toscaServiceTemplate = getDummyToscaServiceTemplate();
- AcmUtils.setAcPolicyInfo(acElement, toscaServiceTemplate);
- assertEquals(getDummyToscaDataTypeMap(), acElement.getToscaServiceTemplateFragment().getDataTypes());
+ var toscaServiceTemplateFragment = AcmUtils.getToscaServiceTemplateFragment(toscaServiceTemplate);
+ assertEquals(getDummyToscaDataTypeMap(), toscaServiceTemplateFragment.getDataTypes());
}
@Test
@@ -122,9 +132,10 @@ class AcmUtilsTest {
var toscaServiceTemplate = getDummyToscaServiceTemplate();
toscaServiceTemplate.setPolicyTypes(null);
toscaServiceTemplate.getToscaTopologyTemplate().setPolicies(null);
- AutomationCompositionElement acElement = new AutomationCompositionElement();
- AcmUtils.setAcPolicyInfo(new AutomationCompositionElement(), toscaServiceTemplate);
- assertNull(acElement.getToscaServiceTemplateFragment());
+ var toscaServiceTemplateFragment = AcmUtils.getToscaServiceTemplateFragment(toscaServiceTemplate);
+ assertNull(toscaServiceTemplateFragment.getPolicyTypes());
+ assertNull(toscaServiceTemplateFragment.getToscaTopologyTemplate());
+ assertNull(toscaServiceTemplateFragment.getDataTypes());
}
@Test
diff --git a/models/src/test/resources/providers/TestAutomationCompositions.json b/models/src/test/resources/providers/TestAutomationCompositions.json
index bf1d76fbc..24f5a4870 100644
--- a/models/src/test/resources/providers/TestAutomationCompositions.json
+++ b/models/src/test/resources/providers/TestAutomationCompositions.json
@@ -3,8 +3,8 @@
{
"compositionId": "709c62b3-8918-41b9-a747-e21eb79c6c40",
"instanceId": "809c62b3-8918-41b9-a748-e21eb79c6c89",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"elements": {
"709c62b3-8918-41b9-a747-e21eb79c6c20": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c20",
@@ -12,12 +12,8 @@
"name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "DCAE automation composition element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c21": {
@@ -26,12 +22,8 @@
"name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Monitoring Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c22": {
@@ -40,12 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c23": {
@@ -54,12 +42,8 @@
"name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "CDS automation composition element for the PMSH instance 0 automation composition"
}
},
@@ -70,8 +54,8 @@
{
"compositionId": "709c62b3-8918-41b9-a747-e21eb79c6c40",
"instanceId": "809c62b3-8918-41b9-a748-e21eb79c6c90",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"elements": {
"709c62b3-8918-41b9-a747-e21eb79c6c24": {
"id": "709c62b3-8918-41b9-a747-e21eb79c6c24",
@@ -79,12 +63,8 @@
"name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "DCAE automation composition element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c25": {
@@ -93,12 +73,8 @@
"name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Monitoring Policy element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c26": {
@@ -107,12 +83,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy element for the PMSH instance 1 automation composition"
},
"709c62b3-8918-41b9-a747-e21eb79c6c27": {
@@ -121,12 +93,8 @@
"name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "CDS element for the PMSH instance 1 automation composition"
}
},
diff --git a/models/src/test/resources/providers/TestParticipant.json b/models/src/test/resources/providers/TestParticipant.json
index 2f4f910f1..689c6a2b2 100644
--- a/models/src/test/resources/providers/TestParticipant.json
+++ b/models/src/test/resources/providers/TestParticipant.json
@@ -8,10 +8,6 @@
"participantState": "ON_LINE",
"description": "A dummy PMSH participant1",
"participantId": "82fd8ef9-1d1e-4343-9b28-7f9564ee3de6",
- "participantType":{
- "name": "org.onap.domain.pmsh.PolicyAutomationCompositionDefinition",
- "version": "1.0.0"
- },
"participantSupportedElementTypes": {
"68fe8c61-7629-4be7-99d8-18bc6a92d178": {
"id": "68fe8c61-7629-4be7-99d8-18bc6a92d178",
diff --git a/models/src/test/resources/providers/UpdateAutomationCompositions.json b/models/src/test/resources/providers/UpdateAutomationCompositions.json
index f118ea799..9681ef247 100644
--- a/models/src/test/resources/providers/UpdateAutomationCompositions.json
+++ b/models/src/test/resources/providers/UpdateAutomationCompositions.json
@@ -7,8 +7,8 @@
"name": "org.onap.domain.pmsh.PMSHAutomationCompositionDefinition",
"version": "1.0.0"
},
- "state": "RUNNING",
- "orderedState": "RUNNING",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -17,12 +17,8 @@
"name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
- },
- "state": "RUNNING",
- "orderedState": "RUNNING",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "DCAE element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -31,12 +27,8 @@
"name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "RUNNING",
- "orderedState": "RUNNING",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Monitoring Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -45,12 +37,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "2.3.1"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "1.0.0"
- },
- "state": "RUNNING",
- "orderedState": "RUNNING",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -59,12 +47,8 @@
"name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "RUNNING",
- "orderedState": "RUNNING",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "CDS element for the PMSH instance 0 automation composition"
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java
index 555183227..5ba598cc8 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java
@@ -32,18 +32,18 @@ import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mockito;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantDeregisterAckListener;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
+import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantPrimeListener;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantRegisterAckListener;
-import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantUpdateListener;
import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
import org.onap.policy.clamp.acm.participant.policy.main.parameters.CommonTestData;
import org.onap.policy.clamp.acm.participant.policy.main.utils.TestListenerUtils;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.springframework.beans.factory.annotation.Autowired;
@@ -126,11 +126,11 @@ class ParticipantMessagesTest {
@Test
void testReceiveParticipantUpdateMessage() {
- ParticipantUpdate participantUpdateMsg = TestListenerUtils.createParticipantUpdateMsg();
+ ParticipantPrime participantPrimeMsg = TestListenerUtils.createParticipantPrimeMsg();
synchronized (lockit) {
- ParticipantUpdateListener participantUpdateListener = new ParticipantUpdateListener(participantHandler);
- participantUpdateListener.onTopicEvent(INFRA, TOPIC, null, participantUpdateMsg);
+ ParticipantPrimeListener participantPrimeListener = new ParticipantPrimeListener(participantHandler);
+ participantPrimeListener.onTopicEvent(INFRA, TOPIC, null, participantPrimeMsg);
}
// Verify the result of GET participants with what is stored
@@ -138,16 +138,16 @@ class ParticipantMessagesTest {
}
@Test
- void testSendParticipantUpdateAckMessage() {
- final ParticipantUpdateAck participantUpdateAckMsg = new ParticipantUpdateAck();
- participantUpdateAckMsg.setMessage("ParticipantUpdateAck message");
- participantUpdateAckMsg.setResponseTo(UUID.randomUUID());
- participantUpdateAckMsg.setResult(true);
+ void testSendParticipantPrimeAckMessage() {
+ final ParticipantPrimeAck participantPrimeAckMsg = new ParticipantPrimeAck();
+ participantPrimeAckMsg.setMessage("ParticipantPrimeAck message");
+ participantPrimeAckMsg.setResponseTo(UUID.randomUUID());
+ participantPrimeAckMsg.setResult(true);
synchronized (lockit) {
ParticipantMessagePublisher participantMessagePublisher = new ParticipantMessagePublisher();
participantMessagePublisher.active(Collections.singletonList(Mockito.mock(TopicSink.class)));
- assertThatCode(() -> participantMessagePublisher.sendParticipantUpdateAck(participantUpdateAckMsg))
+ assertThatCode(() -> participantMessagePublisher.sendParticipantPrimeAck(participantPrimeAckMsg))
.doesNotThrowAnyException();
}
}
diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
index b7058a84f..17d961880 100644
--- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
+++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java
@@ -29,7 +29,7 @@ import java.util.UUID;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import org.onap.policy.clamp.acm.participant.policy.main.parameters.CommonTestData;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime;
import org.onap.policy.common.utils.coder.YamlJsonTranslator;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
@@ -45,23 +45,23 @@ public final class TestListenerUtils {
/**
* Method to create participantUpdateMsg.
*
- * @return ParticipantUpdate message
+ * @return ParticipantPrime message
*/
- public static ParticipantUpdate createParticipantUpdateMsg() {
- final var participantUpdateMsg = new ParticipantUpdate();
+ public static ParticipantPrime createParticipantPrimeMsg() {
+ final var participantPrimeMsg = new ParticipantPrime();
var participantId = CommonTestData.getParticipantId();
- participantUpdateMsg.setParticipantId(participantId);
- participantUpdateMsg.setTimestamp(Instant.now());
- participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000));
- participantUpdateMsg.setMessageId(UUID.randomUUID());
+ participantPrimeMsg.setParticipantId(participantId);
+ participantPrimeMsg.setTimestamp(Instant.now());
+ participantPrimeMsg.setTimestamp(Instant.ofEpochMilli(3000));
+ participantPrimeMsg.setMessageId(UUID.randomUUID());
var toscaServiceTemplate = testAutomationCompositionRead();
// Add policies to the toscaServiceTemplate
TestListenerUtils.addPoliciesToToscaServiceTemplate(toscaServiceTemplate);
- participantUpdateMsg.setParticipantDefinitionUpdates(new ArrayList<>());
- return participantUpdateMsg;
+ participantPrimeMsg.setParticipantDefinitionUpdates(new ArrayList<>());
+ return participantPrimeMsg;
}
private static ToscaServiceTemplate testAutomationCompositionRead() {
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
index b18875813..4c885fa26 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java
@@ -28,9 +28,9 @@ import org.onap.policy.clamp.acm.participant.intermediary.handler.Publisher;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.common.endpoints.event.comm.TopicSink;
import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient;
import org.slf4j.Logger;
@@ -100,15 +100,15 @@ public class ParticipantMessagePublisher implements Publisher {
}
/**
- * Method to send Participant Update Ack message to runtime.
+ * Method to send Participant Prime Ack message to runtime.
*
- * @param participantUpdateAck the Participant Update Ack
+ * @param participantPrimeAck the Participant Prime Ack
*/
- @Timed(value = "publisher.participant_update_ack", description = "PARTICIPANT_UPDATE_ACK messages published")
- public void sendParticipantUpdateAck(final ParticipantUpdateAck participantUpdateAck) {
+ @Timed(value = "publisher.participant_prime_ack", description = "PARTICIPANT_PRIME_ACK messages published")
+ public void sendParticipantPrimeAck(final ParticipantPrimeAck participantPrimeAck) {
validate();
- topicSinkClient.send(participantUpdateAck);
- LOGGER.debug("Sent Participant Update Ack message to CLAMP - {}", participantUpdateAck);
+ topicSinkClient.send(participantPrimeAck);
+ LOGGER.debug("Sent Participant Prime Ack message to CLAMP - {}", participantPrimeAck);
}
/**
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantPrimeListener.java
index 19eb5fb30..e114c74f9 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantUpdateListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantPrimeListener.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,26 +22,26 @@ package org.onap.policy.clamp.acm.participant.intermediary.comm;
import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime;
import org.springframework.stereotype.Component;
/**
- * Listener for Participant Update messages sent by runtime.
+ * Listener for Participant Prime messages sent by runtime.
*/
@Component
-public class ParticipantUpdateListener extends ParticipantListener<ParticipantUpdate> {
+public class ParticipantPrimeListener extends ParticipantListener<ParticipantPrime> {
/**
* Constructs the object.
*
* @param participantHandler the handler for managing the state of the participant
*/
- public ParticipantUpdateListener(final ParticipantHandler participantHandler) {
- super(ParticipantUpdate.class, participantHandler, participantHandler::handleParticipantUpdate);
+ public ParticipantPrimeListener(final ParticipantHandler participantHandler) {
+ super(ParticipantPrime.class, participantHandler, participantHandler::handleParticipantPrime);
}
@Override
public String getType() {
- return ParticipantMessageType.PARTICIPANT_UPDATE.name();
+ return ParticipantMessageType.PARTICIPANT_PRIME.name();
}
}
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 050d66d0b..3aae2c41a 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
@@ -42,12 +42,12 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAc
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -186,44 +186,44 @@ public class ParticipantHandler {
}
/**
- * Handle a ParticipantUpdate message.
+ * Handle a ParticipantPrime message.
*
- * @param participantUpdateMsg the ParticipantUpdate message
+ * @param participantPrimeMsg the ParticipantPrime message
*/
- @Timed(value = "listener.participant_update", description = "PARTICIPANT_UPDATE messages received")
- public void handleParticipantUpdate(ParticipantUpdate participantUpdateMsg) {
- LOGGER.debug("ParticipantUpdate message received for participantId {}",
- participantUpdateMsg.getParticipantId());
+ @Timed(value = "listener.participant_prime", description = "PARTICIPANT_PRIME messages received")
+ public void handleParticipantPrime(ParticipantPrime participantPrimeMsg) {
+ LOGGER.debug("ParticipantPrime message received for participantId {}",
+ participantPrimeMsg.getParticipantId());
- acElementDefsMap.putIfAbsent(participantUpdateMsg.getCompositionId(), new ArrayList<>());
- if (!participantUpdateMsg.getParticipantDefinitionUpdates().isEmpty()) {
+ acElementDefsMap.putIfAbsent(participantPrimeMsg.getCompositionId(), new ArrayList<>());
+ if (!participantPrimeMsg.getParticipantDefinitionUpdates().isEmpty()) {
// This message is to commission the automation composition
- for (var participantDefinition : participantUpdateMsg.getParticipantDefinitionUpdates()) {
+ for (var participantDefinition : participantPrimeMsg.getParticipantDefinitionUpdates()) {
if (participantDefinition.getParticipantId().equals(participantId)) {
- acElementDefsMap.get(participantUpdateMsg.getCompositionId())
+ acElementDefsMap.get(participantPrimeMsg.getCompositionId())
.addAll(participantDefinition.getAutomationCompositionElementDefinitionList());
break;
}
}
} else {
// This message is to decommission the automation composition
- acElementDefsMap.get(participantUpdateMsg.getCompositionId()).clear();
+ acElementDefsMap.get(participantPrimeMsg.getCompositionId()).clear();
}
- sendParticipantUpdateAck(participantUpdateMsg.getMessageId(), participantUpdateMsg.getCompositionId());
+ sendParticipantPrimeAck(participantPrimeMsg.getMessageId(), participantPrimeMsg.getCompositionId());
}
/**
- * Method to send ParticipantUpdateAck message to automation composition runtime.
+ * Method to send ParticipantPrimeAck message to automation composition runtime.
*/
- public void sendParticipantUpdateAck(UUID messageId, UUID compositionId) {
- var participantUpdateAck = new ParticipantUpdateAck();
- participantUpdateAck.setResponseTo(messageId);
- participantUpdateAck.setCompositionId(compositionId);
- participantUpdateAck.setMessage("Participant Update Ack message");
- participantUpdateAck.setResult(true);
- participantUpdateAck.setParticipantId(participantId);
- participantUpdateAck.setState(ParticipantState.ON_LINE);
- publisher.sendParticipantUpdateAck(participantUpdateAck);
+ public void sendParticipantPrimeAck(UUID messageId, UUID compositionId) {
+ var participantPrimeAck = new ParticipantPrimeAck();
+ participantPrimeAck.setResponseTo(messageId);
+ participantPrimeAck.setCompositionId(compositionId);
+ participantPrimeAck.setMessage("Participant Prime Ack message");
+ participantPrimeAck.setResult(true);
+ participantPrimeAck.setParticipantId(participantId);
+ participantPrimeAck.setState(ParticipantState.ON_LINE);
+ publisher.sendParticipantPrimeAck(participantPrimeAck);
}
/**
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
index d9d99da4e..1540d6e4c 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -56,8 +56,8 @@ class ParticipantCommTest {
assertEquals(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK.name(),
participantDeregisterAckListener.getType());
- var participantUpdateListener = new ParticipantUpdateListener(participantHandler);
- assertEquals(ParticipantMessageType.PARTICIPANT_UPDATE.name(), participantUpdateListener.getType());
+ var participantPrimeListener = new ParticipantPrimeListener(participantHandler);
+ assertEquals(ParticipantMessageType.PARTICIPANT_PRIME.name(), participantPrimeListener.getType());
var automationCompositionUpdateListener = new AutomationCompositionDeployListener(participantHandler);
assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY.name(),
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java
index 4e51cc518..559eda5f7 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/IntermediaryActivatorTest.java
@@ -27,17 +27,14 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.List;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantStatusReqListener;
import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
-import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatusReq;
import org.onap.policy.common.utils.coder.Coder;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -51,26 +48,25 @@ class IntermediaryActivatorTest {
private static final String TOPIC_FIRST = "TOPIC1";
private static final String TOPIC_SECOND = "TOPIC2";
- @Disabled
@Test
void testStartAndStop() throws Exception {
- ParticipantParameters parameters = CommonTestData.getParticipantParameters();
+ var parameters = CommonTestData.getParticipantParameters();
- var publisherFirst = spy(mock(Publisher.class));
- var publisherSecond = spy(mock(Publisher.class));
+ var publisherFirst = mock(Publisher.class);
+ var publisherSecond = mock(Publisher.class);
var publishers = List.of(publisherFirst, publisherSecond);
- var listenerFirst = spy(mock(ParticipantStatusReqListener.class));
+ var listenerFirst = mock(ParticipantStatusReqListener.class);
when(listenerFirst.getType()).thenReturn(TOPIC_FIRST);
when(listenerFirst.getScoListener()).thenReturn(listenerFirst);
- var listenerSecond = spy(mock(ParticipantStatusReqListener.class));
+ var listenerSecond = mock(ParticipantStatusReqListener.class);
when(listenerSecond.getType()).thenReturn(TOPIC_SECOND);
when(listenerSecond.getScoListener()).thenReturn(listenerSecond);
List<Listener<ParticipantStatusReq>> listeners = List.of(listenerFirst, listenerSecond);
- ParticipantHandler handler = mock(ParticipantHandler.class);
+ var handler = mock(ParticipantHandler.class);
try (var activator = new IntermediaryActivator(parameters, handler, publishers, listeners)) {
assertFalse(activator.isAlive());
@@ -83,7 +79,7 @@ class IntermediaryActivatorTest {
verify(publisherFirst, times(1)).active(anyList());
verify(publisherSecond, times(1)).active(anyList());
- StandardCoderObject sco = CODER.decode("{messageType:" + TOPIC_FIRST + "}", StandardCoderObject.class);
+ var sco = CODER.decode("{messageType:" + TOPIC_FIRST + "}", StandardCoderObject.class);
activator.getMsgDispatcher().onTopicEvent(null, "msg", sco);
verify(listenerFirst, times(1)).onTopicEvent(any(), any(), any());
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
index 9f1bf29be..7349ab9c0 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java
@@ -39,8 +39,8 @@ import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessage;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
import org.onap.policy.common.utils.coder.CoderException;
class ParticipantHandlerTest {
@@ -54,43 +54,43 @@ class ParticipantHandlerTest {
var publisher = new ParticipantMessagePublisher();
var emptyParticipantHandler =
new ParticipantHandler(parameters, publisher, automationCompositionHander);
- var participantUpdateMsg = new ParticipantUpdate();
+ var participantPrimeMsg = new ParticipantPrime();
assertThatThrownBy(() ->
- emptyParticipantHandler.handleParticipantUpdate(participantUpdateMsg))
+ emptyParticipantHandler.handleParticipantPrime(participantPrimeMsg))
.isInstanceOf(RuntimeException.class);
var participantHandler = commonTestData.getMockParticipantHandler();
var participantId = CommonTestData.getParticipantId();
- participantUpdateMsg.setAutomationCompositionId(CommonTestData.AC_ID_1);
- participantUpdateMsg.setCompositionId(CommonTestData.AC_ID_1);
- participantUpdateMsg.setParticipantId(participantId);
- participantUpdateMsg.setMessageId(UUID.randomUUID());
- participantUpdateMsg.setTimestamp(Instant.ofEpochMilli(3000));
+ participantPrimeMsg.setAutomationCompositionId(CommonTestData.AC_ID_1);
+ participantPrimeMsg.setCompositionId(CommonTestData.AC_ID_1);
+ participantPrimeMsg.setParticipantId(participantId);
+ participantPrimeMsg.setMessageId(UUID.randomUUID());
+ participantPrimeMsg.setTimestamp(Instant.ofEpochMilli(3000));
var heartbeatF = participantHandler.makeHeartbeat(false);
assertEquals(participantId, heartbeatF.getParticipantId());
assertThat(heartbeatF.getAutomationCompositionInfoList()).isEmpty();
- participantHandler.handleParticipantUpdate(participantUpdateMsg);
+ participantHandler.handleParticipantPrime(participantPrimeMsg);
var heartbeatT = participantHandler.makeHeartbeat(true);
assertEquals(participantId, heartbeatT.getParticipantId());
assertThat(heartbeatT.getParticipantDefinitionUpdates()).isNotEmpty();
assertEquals(participantId, heartbeatT.getParticipantDefinitionUpdates().get(0).getParticipantId());
- var pum = setListParticipantDefinition(participantUpdateMsg);
- participantHandler.handleParticipantUpdate(pum);
+ var pum = setListParticipantDefinition(participantPrimeMsg);
+ participantHandler.handleParticipantPrime(pum);
var heartbeatTAfterUpdate = participantHandler.makeHeartbeat(true);
assertEquals(participantId, heartbeatTAfterUpdate.getParticipantId());
}
- private ParticipantUpdate setListParticipantDefinition(ParticipantUpdate participantUpdateMsg) {
+ private ParticipantPrime setListParticipantDefinition(ParticipantPrime participantPrimeMsg) {
var def = new ParticipantDefinition();
def.setParticipantId(CommonTestData.getParticipantId());
- participantUpdateMsg.setParticipantDefinitionUpdates(List.of(def));
- return participantUpdateMsg;
+ participantPrimeMsg.setParticipantDefinitionUpdates(List.of(def));
+ return participantPrimeMsg;
}
@Test
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
index c273a627a..456e61c20 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProvider.java
@@ -25,7 +25,7 @@ import java.util.UUID;
import java.util.stream.Collectors;
import javax.ws.rs.core.Response.Status;
import lombok.RequiredArgsConstructor;
-import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantUpdatePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantPrimePublisher;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
import org.onap.policy.clamp.models.acm.messages.rest.commissioning.AcTypeStateUpdate;
@@ -53,7 +53,7 @@ public class CommissioningProvider {
private final AcDefinitionProvider acDefinitionProvider;
private final AutomationCompositionProvider acProvider;
private final AcTypeStateResolver acTypeStateResolver;
- private final ParticipantUpdatePublisher participantUpdatePublisher;
+ private final ParticipantPrimePublisher participantPrimePublisher;
private CommissioningResponse createCommissioningResponse(UUID compositionId,
ToscaServiceTemplate serviceTemplate) {
@@ -191,9 +191,9 @@ public class CommissioningProvider {
}
private void prime(AutomationCompositionDefinition acmDefinition) {
- var prearation = participantUpdatePublisher.prepareParticipantPriming(acmDefinition);
+ var prearation = participantPrimePublisher.prepareParticipantPriming(acmDefinition);
acDefinitionProvider.updateAcDefinition(acmDefinition);
- participantUpdatePublisher.sendPriming(prearation, acmDefinition.getCompositionId(), null);
+ participantPrimePublisher.sendPriming(prearation, acmDefinition.getCompositionId(), null);
}
private void deprime(AutomationCompositionDefinition acmDefinition) {
@@ -204,7 +204,7 @@ public class CommissioningProvider {
acmDefinition.setState(AcTypeState.DEPRIMING);
acDefinitionProvider.updateAcDefinition(acmDefinition);
}
- participantUpdatePublisher.sendDepriming(acmDefinition.getCompositionId());
+ participantPrimePublisher.sendDepriming(acmDefinition.getCompositionId());
}
}
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 4949c6612..5281cb537 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
@@ -21,25 +21,20 @@
package org.onap.policy.clamp.acm.runtime.instantiation;
-import java.util.List;
import java.util.UUID;
-import java.util.function.Function;
-import java.util.stream.Collectors;
+import javax.validation.Valid;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import lombok.AllArgsConstructor;
-import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
-import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
-import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
+import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
-import org.onap.policy.clamp.models.acm.concepts.Participant;
-import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AcInstanceStateUpdate;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
+import org.onap.policy.clamp.models.acm.persistence.provider.AcInstanceStateResolver;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
-import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ObjectValidationResult;
@@ -55,14 +50,11 @@ import org.springframework.transaction.annotation.Transactional;
@Transactional
@AllArgsConstructor
public class AutomationCompositionInstantiationProvider {
- private static final String AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE = "AutomationCompositionElement";
private static final String DO_NOT_MATCH = " do not match with ";
private final AutomationCompositionProvider automationCompositionProvider;
- private final SupervisionHandler supervisionHandler;
- private final ParticipantProvider participantProvider;
private final AcDefinitionProvider acDefinitionProvider;
- private static final String ENTRY = "entry ";
+ private final AcInstanceStateResolver acInstanceStateResolver;
/**
* Create automation composition.
@@ -142,10 +134,24 @@ public class AutomationCompositionInstantiationProvider {
if (acDefinitionOpt.isEmpty()) {
result.addResult(new ObjectValidationResult("ServiceTemplate", "", ValidationStatus.INVALID,
"Commissioned automation composition definition not found"));
- } else {
- result.addResult(AcmUtils.validateAutomationComposition(automationComposition,
- acDefinitionOpt.get().getServiceTemplate()));
+ return result;
}
+ if (!AcTypeState.PRIMED.equals(acDefinitionOpt.get().getState())) {
+ result.addResult(new ObjectValidationResult("ServiceTemplate", "", ValidationStatus.INVALID,
+ "Commissioned automation composition definition not primed"));
+ return result;
+ }
+ result.addResult(AcmUtils.validateAutomationComposition(automationComposition,
+ acDefinitionOpt.get().getServiceTemplate()));
+
+ if (result.isValid()) {
+ for (var element : automationComposition.getElements().values()) {
+ var name = element.getDefinition().getName();
+ var participantId = acDefinitionOpt.get().getElementStateMap().get(name).getParticipantId();
+ element.setParticipantId(participantId);
+ }
+ }
+
return result;
}
@@ -208,61 +214,42 @@ public class AutomationCompositionInstantiationProvider {
}
/**
- * Issue a command to automation compositions, setting their ordered state.
+ * Handle Composition Instance State.
*
- * @param automationComposition the AutomationComposition
- * @param command the command to issue to automation compositions
+ * @param compositionId the compositionId
+ * @param instanceId the instanceId
+ * @param acInstanceStateUpdate the AcInstanceStateUpdate
*/
- public void issueAutomationCompositionCommand(AutomationComposition automationComposition,
- InstantiationCommand command) {
-
- if (command.getOrderedState() == null) {
- throw new AutomationCompositionRuntimeException(Status.BAD_REQUEST,
- "ordered state invalid or not specified on command");
- }
-
- var participants = participantProvider.getParticipants();
- if (participants.isEmpty()) {
- throw new AutomationCompositionRuntimeException(Status.BAD_REQUEST, "No participants registered");
- }
- var validationResult = validateIssueAutomationComposition(automationComposition, participants);
- if (!validationResult.isValid()) {
- throw new AutomationCompositionRuntimeException(Response.Status.BAD_REQUEST, validationResult.getResult());
- }
-
- automationComposition.setCascadedOrderedState(command.getOrderedState());
- try {
- supervisionHandler.triggerAutomationCompositionSupervision(automationComposition);
- } catch (AutomationCompositionException e) {
- throw new AutomationCompositionRuntimeException(Response.Status.BAD_REQUEST, e.getMessage());
+ public void compositionInstanceState(UUID compositionId, UUID instanceId,
+ @Valid AcInstanceStateUpdate acInstanceStateUpdate) {
+ var automationComposition = automationCompositionProvider.getAutomationComposition(instanceId);
+ if (!compositionId.equals(automationComposition.getCompositionId())) {
+ throw new PfModelRuntimeException(Response.Status.BAD_REQUEST,
+ automationComposition.getCompositionId() + DO_NOT_MATCH + compositionId);
}
- automationCompositionProvider.updateAutomationComposition(automationComposition);
- }
-
- private BeanValidationResult validateIssueAutomationComposition(AutomationComposition automationComposition,
- List<Participant> participants) {
- var result = new BeanValidationResult("AutomationComposition", automationComposition);
-
- var participantMap = participants.stream()
- .collect(Collectors.toMap(participant -> participant.getParticipantId(), Function.identity()));
-
- for (var element : automationComposition.getElements().values()) {
-
- var subResult = new BeanValidationResult(ENTRY + element.getDefinition().getName(), element);
- var p = participantMap.get(element.getParticipantId());
- if (p == null) {
- subResult.addResult(new ObjectValidationResult(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE,
- element.getDefinition().getName(), ValidationStatus.INVALID,
- "Participant with ID " + element.getParticipantId() + " is not registered"));
- } else if (!p.getParticipantId().equals(element.getParticipantId())) {
- subResult.addResult(new ObjectValidationResult(AUTOMATION_COMPOSITION_NODE_ELEMENT_TYPE,
- element.getDefinition().getName(), ValidationStatus.INVALID,
- "Participant with ID " + " - " + element.getParticipantId()
- + " is not registered"));
- }
- result.addResult(subResult);
+ var acDefinition = acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId());
+ var result = acInstanceStateResolver.resolve(acInstanceStateUpdate.getDeployOrder(),
+ acInstanceStateUpdate.getLockOrder(), automationComposition.getDeployState(),
+ automationComposition.getLockState());
+ switch (result) {
+ case "DEPLOY":
+ //
+ break;
+
+ case "UNDEPLOY":
+ //
+ break;
+
+ case "LOCK":
+ //
+ break;
+
+ case "UNLOCK":
+ //
+ break;
+
+ default:
+ throw new PfModelRuntimeException(Status.BAD_REQUEST, "Not valid " + acInstanceStateUpdate);
}
-
- return result;
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
index 94c111e00..afe09314f 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/main/rest/InstantiationController.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -116,7 +116,7 @@ public class InstantiationController extends AbstractRestController implements A
@Override
public ResponseEntity<Void> compositionInstanceState(UUID compositionId, UUID instanceId,
@Valid AcInstanceStateUpdate body, UUID requestId) {
- // TODO Auto-generated method stub
- return null;
+ provider.compositionInstanceState(compositionId, instanceId, body);
+ return ResponseEntity.accepted().build();
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
index 374df0135..db726e09d 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021,2023 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -36,7 +36,7 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
import org.slf4j.Logger;
@@ -85,29 +85,29 @@ public class SupervisionHandler {
}
/**
- * Handle a ParticipantUpdateAck message from a participant.
+ * Handle a ParticipantPrimeAck message from a participant.
*
- * @param participantUpdateAckMessage the ParticipantUpdateAck message received from a participant
+ * @param participantPrimeAckMessage the ParticipantPrimeAck message received from a participant
*/
- @Timed(value = "listener.participant_update_ack", description = "PARTICIPANT_UPDATE_ACK messages received")
- public void handleParticipantMessage(ParticipantUpdateAck participantUpdateAckMessage) {
- LOGGER.debug("Participant Update Ack message received {}", participantUpdateAckMessage);
- var acDefinitionOpt = acDefinitionProvider.findAcDefinition(participantUpdateAckMessage.getCompositionId());
+ @Timed(value = "listener.participant_prime_ack", description = "PARTICIPANT_PRIME_ACK messages received")
+ public void handleParticipantMessage(ParticipantPrimeAck participantPrimeAckMessage) {
+ LOGGER.debug("Participant Prime Ack message received {}", participantPrimeAckMessage);
+ var acDefinitionOpt = acDefinitionProvider.findAcDefinition(participantPrimeAckMessage.getCompositionId());
if (acDefinitionOpt.isEmpty()) {
- LOGGER.warn("AC Definition not found in database {}", participantUpdateAckMessage.getCompositionId());
+ LOGGER.warn("AC Definition not found in database {}", participantPrimeAckMessage.getCompositionId());
return;
}
var acDefinition = acDefinitionOpt.get();
if (!AcTypeState.PRIMING.equals(acDefinition.getState())
&& !AcTypeState.DEPRIMING.equals(acDefinition.getState())) {
LOGGER.warn("AC Definition {} already primed/deprimed with participant {}",
- participantUpdateAckMessage.getCompositionId(), participantUpdateAckMessage.getParticipantId());
+ participantPrimeAckMessage.getCompositionId(), participantPrimeAckMessage.getParticipantId());
return;
}
var state = AcTypeState.PRIMING.equals(acDefinition.getState()) ? AcTypeState.PRIMED : AcTypeState.COMMISSIONED;
boolean completed = true;
for (var element : acDefinition.getElementStateMap().values()) {
- if (participantUpdateAckMessage.getParticipantId().equals(element.getParticipantId())) {
+ if (participantPrimeAckMessage.getParticipantId().equals(element.getParticipantId())) {
element.setState(state);
} else if (!state.equals(element.getState())) {
completed = false;
@@ -141,7 +141,6 @@ public class SupervisionHandler {
if (automationComposition.isPresent()) {
var updated = updateState(automationComposition.get(),
automationCompositionAckMessage.getAutomationCompositionResultMap().entrySet());
- updated |= setPrimed(automationComposition.get());
if (updated) {
automationCompositionProvider.updateAutomationComposition(automationComposition.get());
}
@@ -165,24 +164,6 @@ public class SupervisionHandler {
return updated;
}
- private boolean setPrimed(AutomationComposition automationComposition) {
- var acElements = automationComposition.getElements().values();
- if (acElements != null) {
- Boolean primedFlag = true;
- var checkOpt = automationComposition.getElements().values().stream()
- .filter(acElement -> (!acElement.getState().equals(AutomationCompositionState.PASSIVE)
- || !acElement.getState().equals(AutomationCompositionState.RUNNING)))
- .findAny();
- if (checkOpt.isEmpty()) {
- primedFlag = false;
- }
- automationComposition.setPrimed(primedFlag);
- return true;
- }
-
- return false;
- }
-
/**
* Supervise a automation composition, performing whatever actions need to be performed on the automation
* composition.
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
index 4a0abc180..0811a5a44 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
@@ -78,7 +78,7 @@ public class AutomationCompositionDeployPublisher extends AbstractParticipantPub
List<ParticipantDeploy> participantDeploys = new ArrayList<>();
for (var element : automationComposition.getElements().values()) {
- AcmUtils.setAcPolicyInfo(element, toscaServiceTemplate);
+ element.setToscaServiceTemplateFragment(AcmUtils.getToscaServiceTemplateFragment(toscaServiceTemplate));
AcmUtils.prepareParticipantUpdate(element, participantDeploys);
}
acDeployMsg.setParticipantUpdatesList(participantDeploys);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdateAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimeAckListener.java
index d75de775b..163d0708e 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantUpdateAckListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/ParticipantPrimeAckListener.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,7 +24,7 @@ package org.onap.policy.clamp.acm.runtime.supervision.comm;
import org.onap.policy.clamp.acm.runtime.config.messaging.Listener;
import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
import org.onap.policy.common.utils.coder.StandardCoderObject;
@@ -33,37 +33,37 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
- * Listener for ParticipantUpdateAck messages sent by participants.
+ * Listener for ParticipantPrimeAck messages sent by participants.
*/
@Component
-public class ParticipantUpdateAckListener extends ScoListener<ParticipantUpdateAck>
- implements Listener<ParticipantUpdateAck> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantUpdateAckListener.class);
+public class ParticipantPrimeAckListener extends ScoListener<ParticipantPrimeAck>
+ implements Listener<ParticipantPrimeAck> {
+ private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantPrimeAckListener.class);
private final SupervisionHandler supervisionHandler;
/**
* Constructs the object.
*/
- public ParticipantUpdateAckListener(SupervisionHandler supervisionHandler) {
- super(ParticipantUpdateAck.class);
+ public ParticipantPrimeAckListener(SupervisionHandler supervisionHandler) {
+ super(ParticipantPrimeAck.class);
this.supervisionHandler = supervisionHandler;
}
@Override
public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
- final ParticipantUpdateAck participantUpdateAckMessage) {
- LOGGER.debug("ParticipantUpdateAck message received from participant - {}", participantUpdateAckMessage);
- supervisionHandler.handleParticipantMessage(participantUpdateAckMessage);
+ final ParticipantPrimeAck participantPrimeAckMessage) {
+ LOGGER.debug("ParticipantPrimeAck message received from participant - {}", participantPrimeAckMessage);
+ supervisionHandler.handleParticipantMessage(participantPrimeAckMessage);
}
@Override
public String getType() {
- return ParticipantMessageType.PARTICIPANT_UPDATE_ACK.name();
+ return ParticipantMessageType.PARTICIPANT_PRIME_ACK.name();
}
@Override
- public ScoListener<ParticipantUpdateAck> getScoListener() {
+ public ScoListener<ParticipantPrimeAck> getScoListener() {
return this;
}
}
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/ParticipantPrimePublisher.java
index 1915f1b0d..24dcc2382 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/ParticipantPrimePublisher.java
@@ -32,7 +32,7 @@ import lombok.AllArgsConstructor;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime;
import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -41,18 +41,18 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
- * This class is used to send ParticipantUpdate messages to participants on DMaaP.
+ * This class is used to send ParticipantPrime messages to participants on DMaaP.
*/
@Component
@AllArgsConstructor
-public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<ParticipantUpdate> {
+public class ParticipantPrimePublisher extends AbstractParticipantPublisher<ParticipantPrime> {
- private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantUpdatePublisher.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(ParticipantPrimePublisher.class);
private final ParticipantProvider participantProvider;
/**
- * Send ParticipantUpdate to Participant
+ * Send ParticipantPrime to Participant
* if participantId is null then message is broadcast.
*
* @param participantDefinitions the list of ParticipantDefinition to send
@@ -62,7 +62,7 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
@Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
public void sendPriming(List<ParticipantDefinition> participantDefinitions, UUID compositionId,
UUID participantId) {
- var message = new ParticipantUpdate();
+ var message = new ParticipantPrime();
message.setCompositionId(compositionId);
message.setParticipantId(participantId);
message.setTimestamp(Instant.now());
@@ -106,11 +106,11 @@ public class ParticipantUpdatePublisher extends AbstractParticipantPublisher<Par
}
/**
- * Send ParticipantUpdate to Participant after that commissioning has been removed.
+ * Send ParticipantPrime to Participant after that commissioning has been removed.
*/
@Timed(value = "publisher.participant_update", description = "PARTICIPANT_UPDATE messages published")
public void sendDepriming(UUID compositionId) {
- var message = new ParticipantUpdate();
+ var message = new ParticipantPrime();
message.setCompositionId(compositionId);
message.setTimestamp(Instant.now());
// DeCommission the automation composition but deleting participantdefinitions on participants
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java
index 071fc26fd..327d881a1 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/commissioning/CommissioningProviderTest.java
@@ -33,7 +33,7 @@ import java.util.List;
import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
-import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantUpdatePublisher;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantPrimePublisher;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
@@ -154,15 +154,15 @@ class CommissioningProviderTest {
var compositionId = acmDefinition.getCompositionId();
when(acDefinitionProvider.getAcDefinition(compositionId)).thenReturn(acmDefinition);
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+ var participantPrimePublisher = mock(ParticipantPrimePublisher.class);
var provider = new CommissioningProvider(acDefinitionProvider, mock(AutomationCompositionProvider.class),
- new AcTypeStateResolver(), participantUpdatePublisher);
+ new AcTypeStateResolver(), participantPrimePublisher);
var acTypeStateUpdate = new AcTypeStateUpdate();
acTypeStateUpdate.setPrimeOrder(PrimeOrder.PRIME);
provider.compositionDefinitionPriming(compositionId, acTypeStateUpdate);
verify(acDefinitionProvider).updateAcDefinition(acmDefinition);
- verify(participantUpdatePublisher).sendPriming(any(), any(), any());
+ verify(participantPrimePublisher).sendPriming(any(), any(), any());
}
@Test
@@ -173,13 +173,13 @@ class CommissioningProviderTest {
var compositionId = acmDefinition.getCompositionId();
when(acDefinitionProvider.getAcDefinition(compositionId)).thenReturn(acmDefinition);
- var participantUpdatePublisher = mock(ParticipantUpdatePublisher.class);
+ var participantPrimePublisher = mock(ParticipantPrimePublisher.class);
var provider = new CommissioningProvider(acDefinitionProvider, mock(AutomationCompositionProvider.class),
- new AcTypeStateResolver(), participantUpdatePublisher);
+ new AcTypeStateResolver(), participantPrimePublisher);
var acTypeStateUpdate = new AcTypeStateUpdate();
acTypeStateUpdate.setPrimeOrder(PrimeOrder.DEPRIME);
provider.compositionDefinitionPriming(compositionId, acTypeStateUpdate);
- verify(participantUpdatePublisher).sendDepriming(compositionId);
+ verify(participantPrimePublisher).sendDepriming(compositionId);
}
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivatorTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivatorTest.java
index 7d49bc2f6..f45517f7c 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivatorTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/config/messaging/MessageDispatcherActivatorTest.java
@@ -27,15 +27,12 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyList;
import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.List;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
import org.onap.policy.clamp.acm.runtime.supervision.comm.ParticipantStatusListener;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
@@ -54,20 +51,19 @@ class MessageDispatcherActivatorTest {
private static final String TOPIC_FIRST = "TOPIC1";
private static final String TOPIC_SECOND = "TOPIC2";
- @Disabled
@Test
void testStartAndStop() throws Exception {
- AcRuntimeParameterGroup parameterGroup = CommonTestData.geParameterGroup("dbtest");
+ var parameterGroup = CommonTestData.geParameterGroup("dbtest");
- var publisherFirst = spy(mock(Publisher.class));
- var publisherSecond = spy(mock(Publisher.class));
+ var publisherFirst = mock(Publisher.class);
+ var publisherSecond = mock(Publisher.class);
var publishers = List.of(publisherFirst, publisherSecond);
- var listenerFirst = spy(mock(ParticipantStatusListener.class));
+ var listenerFirst = mock(ParticipantStatusListener.class);
when(listenerFirst.getType()).thenReturn(TOPIC_FIRST);
when(listenerFirst.getScoListener()).thenReturn(listenerFirst);
- var listenerSecond = spy(mock(ParticipantStatusListener.class));
+ var listenerSecond = mock(ParticipantStatusListener.class);
when(listenerSecond.getType()).thenReturn(TOPIC_SECOND);
when(listenerSecond.getScoListener()).thenReturn(listenerSecond);
@@ -85,7 +81,7 @@ class MessageDispatcherActivatorTest {
verify(publisherFirst, times(1)).active(anyList());
verify(publisherSecond, times(1)).active(anyList());
- StandardCoderObject sco = CODER.decode("{messageType:" + TOPIC_FIRST + "}", StandardCoderObject.class);
+ var sco = CODER.decode("{messageType:" + TOPIC_FIRST + "}", StandardCoderObject.class);
activator.getMsgDispatcher().onTopicEvent(null, "msg", sco);
verify(listenerFirst, times(1)).onTopicEvent(any(), any(), any());
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
index 0a46bc6b8..019d53c0b 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/AutomationCompositionInstantiationProviderTest.java
@@ -33,17 +33,13 @@ import java.util.Optional;
import java.util.UUID;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.mockito.Mockito;
-import org.onap.policy.clamp.acm.runtime.supervision.SupervisionHandler;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationCommand;
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.clamp.models.acm.persistence.provider.ProviderUtils;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
@@ -56,13 +52,13 @@ class AutomationCompositionInstantiationProviderTest {
private static final String AC_INSTANTIATION_CREATE_JSON = "src/test/resources/rest/acm/AutomationComposition.json";
private static final String AC_INSTANTIATION_UPDATE_JSON =
"src/test/resources/rest/acm/AutomationCompositionUpdate.json";
- private static final String AC_INSTANTIATION_CHANGE_STATE_JSON = "src/test/resources/rest/acm/PassiveCommand.json";
+
private static final String AC_INSTANTIATION_DEFINITION_NAME_NOT_FOUND_JSON =
"src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json";
private static final String AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON =
"src/test/resources/rest/acm/AutomationCompositionNotFound.json";
private static final String DELETE_BAD_REQUEST = "Automation composition state is still %s";
- private static final String ORDERED_STATE_INVALID = "ordered state invalid or not specified on command";
+
private static final String AC_ELEMENT_NAME_NOT_FOUND =
"\"AutomationComposition\" INVALID, item has status INVALID\n"
+ " \"entry PMSHInstance0AcElementNotFound\" INVALID, item has status INVALID\n"
@@ -86,18 +82,13 @@ class AutomationCompositionInstantiationProviderTest {
@Test
void testInstantiationCrud() throws AutomationCompositionException {
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var participants = CommonTestData.createParticipants();
- when(participantProvider.getParticipants()).thenReturn(participants);
-
var acDefinitionProvider = mock(AcDefinitionProvider.class);
var acDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
var compositionId = acDefinition.getCompositionId();
when(acDefinitionProvider.findAcDefinition(compositionId)).thenReturn(Optional.of(acDefinition));
- var supervisionHandler = mock(SupervisionHandler.class);
var acProvider = mock(AutomationCompositionProvider.class);
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var instantiationProvider =
+ new AutomationCompositionInstantiationProvider(acProvider, acDefinitionProvider, null);
var automationCompositionCreate =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud");
automationCompositionCreate.setCompositionId(compositionId);
@@ -132,15 +123,6 @@ class AutomationCompositionInstantiationProviderTest {
verify(acProvider).updateAutomationComposition(automationCompositionUpdate);
- var instantiationCommand =
- InstantiationUtils.getInstantiationCommandFromResource(AC_INSTANTIATION_CHANGE_STATE_JSON);
- instantiationProvider.issueAutomationCompositionCommand(automationCompositionUpdate,
- instantiationCommand);
- verify(supervisionHandler).triggerAutomationCompositionSupervision(automationCompositionUpdate);
-
- // in order to delete a automationComposition the state must be UNINITIALISED
- automationCompositionCreate.setState(AutomationCompositionState.UNINITIALISED);
-
when(acProvider.deleteAutomationComposition(automationCompositionUpdate.getInstanceId()))
.thenReturn(automationCompositionUpdate);
instantiationProvider.deleteAutomationComposition(automationCompositionCreate.getCompositionId(),
@@ -154,13 +136,11 @@ class AutomationCompositionInstantiationProviderTest {
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete");
- var participantProvider = Mockito.mock(ParticipantProvider.class);
var acProvider = mock(AutomationCompositionProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
.thenReturn(automationComposition);
@@ -185,13 +165,11 @@ class AutomationCompositionInstantiationProviderTest {
private void assertThatDeleteThrownBy(AutomationComposition automationComposition,
AutomationCompositionState state) {
automationComposition.setState(state);
- var participantProvider = Mockito.mock(ParticipantProvider.class);
var acProvider = mock(AutomationCompositionProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
.thenReturn(automationComposition);
@@ -218,11 +196,8 @@ class AutomationCompositionInstantiationProviderTest {
when(acProvider.createAutomationComposition(automationCompositionCreate))
.thenReturn(automationCompositionCreate);
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
-
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
var instantiationResponse = instantiationProvider.createAutomationComposition(
automationCompositionCreate.getCompositionId(), automationCompositionCreate);
@@ -247,10 +222,8 @@ class AutomationCompositionInstantiationProviderTest {
automationComposition.setCompositionId(compositionId);
var acProvider = mock(AutomationCompositionProvider.class);
- var participantProvider = mock(ParticipantProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var provider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var provider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
assertThatThrownBy(() -> provider.createAutomationComposition(compositionId, automationComposition))
.hasMessageMatching(AC_ELEMENT_NAME_NOT_FOUND);
@@ -267,14 +240,12 @@ class AutomationCompositionInstantiationProviderTest {
var automationComposition = InstantiationUtils
.getAutomationCompositionFromResource(AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON, "AcNotFound");
- var participantProvider = Mockito.mock(ParticipantProvider.class);
var acProvider = mock(AutomationCompositionProvider.class);
when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
.thenReturn(automationComposition);
- var supervisionHandler = mock(SupervisionHandler.class);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
- var provider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
+ var provider = new AutomationCompositionInstantiationProvider(acProvider,
+ acDefinitionProvider, null);
var compositionId = automationComposition.getCompositionId();
assertThatThrownBy(() -> provider.createAutomationComposition(compositionId, automationComposition))
@@ -290,21 +261,4 @@ class AutomationCompositionInstantiationProviderTest {
assertThatThrownBy(() -> provider.updateAutomationComposition(wrongCompositionId, automationComposition))
.hasMessageMatching(compositionId + DO_NOT_MATCH + wrongCompositionId);
}
-
- @Test
- void testIssueAutomationCompositionCommand_OrderedStateInvalid() {
- var participantProvider = Mockito.mock(ParticipantProvider.class);
- var acProvider = mock(AutomationCompositionProvider.class);
- var supervisionHandler = mock(SupervisionHandler.class);
- var acDefinitionProvider = mock(AcDefinitionProvider.class);
- var instantiationProvider = new AutomationCompositionInstantiationProvider(acProvider, supervisionHandler,
- participantProvider, acDefinitionProvider);
- var automationComposition = InstantiationUtils
- .getAutomationCompositionFromResource(AC_INSTANTIATION_AC_DEFINITION_NOT_FOUND_JSON, "AcNotFound");
- when(acProvider.getAutomationComposition(automationComposition.getInstanceId()))
- .thenReturn(automationComposition);
-
- assertThatThrownBy(() -> instantiationProvider.issueAutomationCompositionCommand(automationComposition,
- new InstantiationCommand())).hasMessageMatching(ORDERED_STATE_INVALID);
- }
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
index 38db863c3..fe0a477f9 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/instantiation/rest/InstantiationControllerTest.java
@@ -30,10 +30,8 @@ import static org.onap.policy.clamp.acm.runtime.util.CommonTestData.TOSCA_SERVIC
import java.util.UUID;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.Response;
-import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.onap.policy.clamp.acm.runtime.instantiation.AutomationCompositionInstantiationProvider;
@@ -41,14 +39,13 @@ import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
import org.onap.policy.clamp.acm.runtime.main.rest.InstantiationController;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.acm.runtime.util.rest.CommonRestController;
+import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositions;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.AcInstanceStateUpdate;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
import org.onap.policy.clamp.models.acm.messages.rest.instantiation.InstantiationResponse;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
-import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
-import org.onap.policy.clamp.models.acm.persistence.repository.AutomationCompositionRepository;
-import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@@ -74,10 +71,6 @@ class InstantiationControllerTest extends CommonRestController {
private static final String INSTANTIATION_ENDPOINT = "compositions/%s/instances";
private static ToscaServiceTemplate serviceTemplate = new ToscaServiceTemplate();
- private UUID compositionId = UUID.randomUUID();
-
- @Autowired
- private AutomationCompositionRepository automationCompositionRepository;
@Autowired
private AcDefinitionProvider acDefinitionProvider;
@@ -85,9 +78,6 @@ class InstantiationControllerTest extends CommonRestController {
@Autowired
private AutomationCompositionInstantiationProvider instantiationProvider;
- @Autowired
- private ParticipantProvider participantProvider;
-
@LocalServerPort
private int randomServerPort;
@@ -97,25 +87,15 @@ class InstantiationControllerTest extends CommonRestController {
}
@BeforeEach
- public void populateDb() {
- createEntryInDB();
- }
-
- @BeforeEach
public void setUpPort() {
super.setHttpPrefix(randomServerPort);
}
- @AfterEach
- public void cleanDatabase() {
- deleteEntryInDB();
- }
-
- private String getInstanceEndPoint() {
+ private String getInstanceEndPoint(UUID compositionId) {
return String.format(INSTANTIATION_ENDPOINT, compositionId.toString());
}
- private String getInstanceEndPoint(UUID instanceId) {
+ private String getInstanceEndPoint(UUID compositionId, UUID instanceId) {
return String.format(INSTANTIATION_ENDPOINT, compositionId.toString()) + "/" + instanceId;
}
@@ -129,12 +109,12 @@ class InstantiationControllerTest extends CommonRestController {
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Unauthorized");
- assertUnauthorizedPost(getInstanceEndPoint(), Entity.json(automationComposition));
+ assertUnauthorizedPost(getInstanceEndPoint(UUID.randomUUID()), Entity.json(automationComposition));
}
@Test
void testQuery_Unauthorized() {
- assertUnauthorizedGet(getInstanceEndPoint());
+ assertUnauthorizedGet(getInstanceEndPoint(UUID.randomUUID()));
}
@Test
@@ -142,42 +122,45 @@ class InstantiationControllerTest extends CommonRestController {
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Unauthorized");
- assertUnauthorizedPut(getInstanceEndPoint(), Entity.json(automationComposition));
+ assertUnauthorizedPut(getInstanceEndPoint(UUID.randomUUID()), Entity.json(automationComposition));
}
@Test
void testDelete_Unauthorized() {
- assertUnauthorizedDelete(getInstanceEndPoint());
+ assertUnauthorizedDelete(getInstanceEndPoint(UUID.randomUUID()));
}
@Test
void testCreate() {
+ var compositionId = createAcDefinitionInDB("Create");
var automationCompositionFromRsc =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Create");
automationCompositionFromRsc.setCompositionId(compositionId);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint());
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId));
var resp = invocationBuilder.post(Entity.json(automationCompositionFromRsc));
assertEquals(Response.Status.CREATED.getStatusCode(), resp.getStatus());
var instResponse = resp.readEntity(InstantiationResponse.class);
InstantiationUtils.assertInstantiationResponse(instResponse, automationCompositionFromRsc);
automationCompositionFromRsc.setInstanceId(instResponse.getInstanceId());
+ automationCompositionFromRsc.getElements().values()
+ .forEach(element -> element.setParticipantId(CommonTestData.getParticipantId()));
var automationCompositionFromDb =
instantiationProvider.getAutomationComposition(compositionId, instResponse.getInstanceId());
assertNotNull(automationCompositionFromDb);
assertEquals(automationCompositionFromRsc, automationCompositionFromDb);
-
}
@Test
void testCreateBadRequest() {
+ var compositionId = createAcDefinitionInDB("CreateBadRequest");
var automationCompositionFromRsc = InstantiationUtils
.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "CreateBadRequest");
automationCompositionFromRsc.setCompositionId(compositionId);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint());
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId));
var resp = invocationBuilder.post(Entity.json(automationCompositionFromRsc));
assertEquals(Response.Status.CREATED.getStatusCode(), resp.getStatus());
@@ -191,7 +174,8 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testQuery_NoResultWithThisName() {
- var invocationBuilder = super.sendRequest(getInstanceEndPoint() + "?name=noResultWithThisName");
+ var invocationBuilder =
+ super.sendRequest(getInstanceEndPoint(UUID.randomUUID()) + "?name=noResultWithThisName");
var rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
var resp = rawresp.readEntity(AutomationCompositions.class);
@@ -200,14 +184,15 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testQuery() {
+ var compositionId = createAcDefinitionInDB("Query");
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Query");
automationComposition.setCompositionId(compositionId);
instantiationProvider.createAutomationComposition(compositionId, automationComposition);
- var invocationBuilder =
- super.sendRequest(getInstanceEndPoint() + "?name=" + automationComposition.getKey().getName());
+ var invocationBuilder = super.sendRequest(
+ getInstanceEndPoint(compositionId) + "?name=" + automationComposition.getKey().getName());
var rawresp = invocationBuilder.buildGet().invoke();
assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
var automationCompositionsQuery = rawresp.readEntity(AutomationCompositions.class);
@@ -217,7 +202,26 @@ class InstantiationControllerTest extends CommonRestController {
}
@Test
+ void testGet() {
+ var compositionId = createAcDefinitionInDB("Get");
+ var automationComposition =
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Get");
+ automationComposition.setCompositionId(compositionId);
+
+ instantiationProvider.createAutomationComposition(compositionId, automationComposition);
+
+ var invocationBuilder = super.sendRequest(
+ getInstanceEndPoint(compositionId, automationComposition.getInstanceId()));
+ var rawresp = invocationBuilder.buildGet().invoke();
+ assertEquals(Response.Status.OK.getStatusCode(), rawresp.getStatus());
+ var automationCompositionGet = rawresp.readEntity(AutomationComposition.class);
+ assertNotNull(automationCompositionGet);
+ assertEquals(automationComposition, automationCompositionGet);
+ }
+
+ @Test
void testUpdate() {
+ var compositionId = createAcDefinitionInDB("Update");
var automationCompositionCreate =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Update");
automationCompositionCreate.setCompositionId(compositionId);
@@ -228,7 +232,10 @@ class InstantiationControllerTest extends CommonRestController {
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_UPDATE_JSON, "Update");
automationComposition.setCompositionId(compositionId);
automationComposition.setInstanceId(response.getInstanceId());
- var invocationBuilder = super.sendRequest(getInstanceEndPoint());
+ automationComposition.getElements().values()
+ .forEach(element -> element.setParticipantId(CommonTestData.getParticipantId()));
+
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId));
var resp = invocationBuilder.post(Entity.json(automationComposition));
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
@@ -245,6 +252,7 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testDelete() {
+ var compositionId = createAcDefinitionInDB("Delete");
var automationCompositionFromRsc =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Delete");
automationCompositionFromRsc.setCompositionId(compositionId);
@@ -252,7 +260,7 @@ class InstantiationControllerTest extends CommonRestController {
var instResponse =
instantiationProvider.createAutomationComposition(compositionId, automationCompositionFromRsc);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(instResponse.getInstanceId()));
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, instResponse.getInstanceId()));
var resp = invocationBuilder.delete();
assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
instResponse = resp.readEntity(InstantiationResponse.class);
@@ -265,30 +273,31 @@ class InstantiationControllerTest extends CommonRestController {
@Test
void testDeleteNotFound() {
+ var compositionId = createAcDefinitionInDB("DeleteNotFound");
var automationCompositionFromRsc =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "DelNotFound");
automationCompositionFromRsc.setCompositionId(compositionId);
instantiationProvider.createAutomationComposition(compositionId, automationCompositionFromRsc);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(UUID.randomUUID()));
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, UUID.randomUUID()));
var resp = invocationBuilder.delete();
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), resp.getStatus());
}
- @Disabled
@Test
- void testCommand_NotFound1() {
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(UUID.randomUUID()));
- var resp = invocationBuilder.post(Entity.json(new AutomationComposition()));
+ void testDeploy_NotFound() {
+ var compositionId = createAcDefinitionInDB("Deploy_NotFound");
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, UUID.randomUUID()));
+ var resp = invocationBuilder.put(Entity.json(new AcInstanceStateUpdate()));
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), resp.getStatus());
}
- @Disabled
@Test
- void testCommand_NotFound2() {
+ void testDeploy_BadRequest() {
+ var compositionId = createAcDefinitionInDB("Deploy_BadRequest");
var acFromRsc =
- InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "DelNotFound");
+ InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "BadRequest");
acFromRsc.setCompositionId(compositionId);
var instResponse = instantiationProvider.createAutomationComposition(compositionId, acFromRsc);
@@ -297,50 +306,33 @@ class InstantiationControllerTest extends CommonRestController {
command.setDeployOrder(null);
command.setLockOrder(null);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(instResponse.getInstanceId()));
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, instResponse.getInstanceId()));
var resp = invocationBuilder.put(Entity.json(command));
assertEquals(Response.Status.BAD_REQUEST.getStatusCode(), resp.getStatus());
}
- @Disabled
@Test
- void testCommand() throws PfModelException {
+ void testDeploy() {
+ var compositionId = createAcDefinitionInDB("Deploy");
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Command");
automationComposition.setCompositionId(compositionId);
var instResponse = instantiationProvider.createAutomationComposition(compositionId, automationComposition);
- var participants = CommonTestData.createParticipants();
- for (var participant : participants) {
- participantProvider.saveParticipant(participant);
- }
-
var instantiationUpdate = new AcInstanceStateUpdate();
+ instantiationUpdate.setDeployOrder(DeployOrder.DEPLOY);
+ instantiationUpdate.setLockOrder(null);
- var invocationBuilder = super.sendRequest(getInstanceEndPoint(instResponse.getInstanceId()));
+ var invocationBuilder = super.sendRequest(getInstanceEndPoint(compositionId, instResponse.getInstanceId()));
var resp = invocationBuilder.put(Entity.json(instantiationUpdate));
- assertEquals(Response.Status.OK.getStatusCode(), resp.getStatus());
- instResponse = resp.readEntity(InstantiationResponse.class);
- InstantiationUtils.assertInstantiationResponse(instResponse, automationComposition);
-
- // check passive state on DB
- var toscaConceptIdentifier = instResponse.getAffectedAutomationComposition();
- var automationCompositionsGet = instantiationProvider.getAutomationCompositions(compositionId,
- toscaConceptIdentifier.getName(), toscaConceptIdentifier.getVersion());
- assertThat(automationCompositionsGet.getAutomationCompositionList()).hasSize(1);
- }
-
- private synchronized void deleteEntryInDB() {
- automationCompositionRepository.deleteAll();
- var list = acDefinitionProvider.findAcDefinition(compositionId);
- if (!list.isEmpty()) {
- acDefinitionProvider.deleteAcDefintion(compositionId);
- }
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), resp.getStatus());
}
- private synchronized void createEntryInDB() {
- deleteEntryInDB();
- var acmDefinition = acDefinitionProvider.createAutomationCompositionDefinition(serviceTemplate);
- compositionId = acmDefinition.getCompositionId();
+ private UUID createAcDefinitionInDB(String name) {
+ var serviceTemplateCreate = new ToscaServiceTemplate(serviceTemplate);
+ serviceTemplateCreate.setName(name);
+ var acmDefinition = CommonTestData.createAcDefinition(serviceTemplate, AcTypeState.PRIMED);
+ acDefinitionProvider.updateAcDefinition(acmDefinition);
+ return acmDefinition.getCompositionId();
}
}
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 8ae21ca75..0fa15b62d 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
@@ -40,15 +40,17 @@ import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionD
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionException;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
import org.onap.policy.clamp.models.acm.concepts.AcTypeState;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
@@ -214,7 +216,10 @@ class SupervisionHandlerTest {
AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED);
var automationCompositionAckMessage =
new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
- automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of());
+ var acElementDeployAck =
+ new AcElementDeployAck(AutomationCompositionState.PASSIVE, DeployState.DEPLOYED, true, "");
+ automationCompositionAckMessage.setAutomationCompositionResultMap(
+ Map.of(UUID.fromString("709c62b3-8918-41b9-a747-d21eb79c6c20"), acElementDeployAck));
automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER);
handler.handleAutomationCompositionStateChangeAckMessage(automationCompositionAckMessage);
@@ -227,7 +232,10 @@ class SupervisionHandlerTest {
var automationCompositionAckMessage =
new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK);
automationCompositionAckMessage.setParticipantId(CommonTestData.getParticipantId());
- automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of());
+ var acElementDeployAck =
+ new AcElementDeployAck(AutomationCompositionState.PASSIVE, DeployState.DEPLOYED, true, "");
+ automationCompositionAckMessage.setAutomationCompositionResultMap(
+ Map.of(UUID.fromString("709c62b3-8918-41b9-a747-d21eb79c6c20"), acElementDeployAck));
automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER);
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var handler = createSupervisionHandler(automationCompositionProvider,
@@ -240,28 +248,28 @@ class SupervisionHandlerTest {
}
@Test
- void testParticipantUpdateAckNotFound() {
- var participantUpdateAckMessage = new ParticipantUpdateAck();
- participantUpdateAckMessage.setParticipantId(CommonTestData.getParticipantId());
- participantUpdateAckMessage.setState(ParticipantState.ON_LINE);
+ void testParticipantPrimeAckNotFound() {
+ var participantPrimeAckMessage = new ParticipantPrimeAck();
+ participantPrimeAckMessage.setParticipantId(CommonTestData.getParticipantId());
+ participantPrimeAckMessage.setState(ParticipantState.ON_LINE);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
var handler = new SupervisionHandler(mock(AutomationCompositionProvider.class), acDefinitionProvider,
mock(AutomationCompositionDeployPublisher.class),
mock(AutomationCompositionStateChangePublisher.class));
- handler.handleParticipantMessage(participantUpdateAckMessage);
+ handler.handleParticipantMessage(participantPrimeAckMessage);
verify(acDefinitionProvider).findAcDefinition(any());
}
@Test
- void testParticipantUpdateAckPrimed() {
- var participantUpdateAckMessage = new ParticipantUpdateAck();
- participantUpdateAckMessage.setParticipantId(CommonTestData.getParticipantId());
- participantUpdateAckMessage.setState(ParticipantState.ON_LINE);
+ void testParticipantPrimeAckPrimed() {
+ var participantPrimeAckMessage = new ParticipantPrimeAck();
+ participantPrimeAckMessage.setParticipantId(CommonTestData.getParticipantId());
+ participantPrimeAckMessage.setState(ParticipantState.ON_LINE);
var acDefinition = CommonTestData.createAcDefinition(
InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML), AcTypeState.PRIMED);
- participantUpdateAckMessage.setCompositionId(acDefinition.getCompositionId());
+ participantPrimeAckMessage.setCompositionId(acDefinition.getCompositionId());
var acDefinitionProvider = mock(AcDefinitionProvider.class);
when(acDefinitionProvider.findAcDefinition(acDefinition.getCompositionId()))
@@ -271,19 +279,19 @@ class SupervisionHandlerTest {
mock(AutomationCompositionDeployPublisher.class),
mock(AutomationCompositionStateChangePublisher.class));
- handler.handleParticipantMessage(participantUpdateAckMessage);
+ handler.handleParticipantMessage(participantPrimeAckMessage);
verify(acDefinitionProvider).findAcDefinition(any());
}
@Test
- void testParticipantUpdateAck() {
- var participantUpdateAckMessage = new ParticipantUpdateAck();
- participantUpdateAckMessage.setParticipantId(CommonTestData.getParticipantId());
- participantUpdateAckMessage.setState(ParticipantState.ON_LINE);
+ void testParticipantPrimeAck() {
+ var participantPrimeAckMessage = new ParticipantPrimeAck();
+ participantPrimeAckMessage.setParticipantId(CommonTestData.getParticipantId());
+ participantPrimeAckMessage.setState(ParticipantState.ON_LINE);
var acDefinition = CommonTestData.createAcDefinition(
InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML), AcTypeState.PRIMING);
- participantUpdateAckMessage.setCompositionId(acDefinition.getCompositionId());
+ participantPrimeAckMessage.setCompositionId(acDefinition.getCompositionId());
var acDefinitionProvider = mock(AcDefinitionProvider.class);
when(acDefinitionProvider.findAcDefinition(acDefinition.getCompositionId()))
@@ -293,7 +301,7 @@ class SupervisionHandlerTest {
mock(AutomationCompositionDeployPublisher.class),
mock(AutomationCompositionStateChangePublisher.class));
- handler.handleParticipantMessage(participantUpdateAckMessage);
+ handler.handleParticipantMessage(participantPrimeAckMessage);
verify(acDefinitionProvider).findAcDefinition(any());
verify(acDefinitionProvider).updateAcDefinition(any());
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
index 010e8ba38..c2d4e0ff7 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java
@@ -46,10 +46,10 @@ import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCom
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantUpdateAck;
import org.onap.policy.clamp.models.acm.persistence.provider.ParticipantProvider;
import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure;
@@ -105,12 +105,12 @@ class SupervisionMessagesTest {
}
@Test
- void testReceiveParticipantUpdateAckMessage() {
- final var participantUpdateAckMsg = new ParticipantUpdateAck();
+ void testReceiveParticipantPrimeAckMessage() {
+ final var participantPrimeAckMsg = new ParticipantPrimeAck();
var supervisionHandler = mock(SupervisionHandler.class);
- var participantUpdateAckListener = new ParticipantUpdateAckListener(supervisionHandler);
- participantUpdateAckListener.onTopicEvent(INFRA, TOPIC, null, participantUpdateAckMsg);
- verify(supervisionHandler).handleParticipantMessage(participantUpdateAckMsg);
+ var participantPrimeAckListener = new ParticipantPrimeAckListener(supervisionHandler);
+ participantPrimeAckListener.onTopicEvent(INFRA, TOPIC, null, participantPrimeAckMsg);
+ verify(supervisionHandler).handleParticipantMessage(participantPrimeAckMsg);
}
@Test
@@ -138,8 +138,8 @@ class SupervisionMessagesTest {
}
@Test
- void testParticipantUpdatePublisherDecomisioning() {
- var publisher = new ParticipantUpdatePublisher(mock(ParticipantProvider.class));
+ void testParticipantPrimePublisherDecommissioning() {
+ var publisher = new ParticipantPrimePublisher(mock(ParticipantProvider.class));
var topicSink = mock(TopicSink.class);
publisher.active(List.of(topicSink));
publisher.sendDepriming(UUID.randomUUID());
@@ -147,7 +147,7 @@ class SupervisionMessagesTest {
}
@Test
- void testParticipantUpdatePublisherPriming() {
+ void testParticipantPrimePublisherPriming() {
var participantId = UUID.randomUUID();
Map<ToscaConceptIdentifier, UUID> supportedElementMap = new HashMap<>();
supportedElementMap.put(
@@ -160,7 +160,7 @@ class SupervisionMessagesTest {
participantId);
var participantProvider = mock(ParticipantProvider.class);
when(participantProvider.getSupportedElementMap()).thenReturn(supportedElementMap);
- var publisher = new ParticipantUpdatePublisher(participantProvider);
+ var publisher = new ParticipantPrimePublisher(participantProvider);
var topicSink = mock(TopicSink.class);
publisher.active(List.of(topicSink));
var serviceTemplate = InstantiationUtils.getToscaServiceTemplate(TOSCA_SERVICE_TEMPLATE_YAML);
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 702a93678..69c1302bc 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
@@ -114,6 +114,11 @@ public class CommonTestData {
acDefinition.setServiceTemplate(serviceTemplate);
var acElements = AcmUtils.extractAcElementsFromServiceTemplate(serviceTemplate);
acDefinition.setElementStateMap(AcmUtils.createElementStateMap(acElements, state));
+ if (AcTypeState.PRIMED.equals(state)) {
+ for (var element : acDefinition.getElementStateMap().values()) {
+ element.setParticipantId(getParticipantId());
+ }
+ }
return acDefinition;
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
index 77078e6eb..0e6988d9b 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationComposition.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -12,13 +12,8 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the K8S microservice for PMSH"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -27,13 +22,8 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.HttpParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the http requests of PMSH microservice"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -42,13 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.PolicyParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the operational policy for Performance Management Subscription Handling"
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
index 80facb29c..34ee3f69d 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionElementsNotFound.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -12,12 +12,8 @@
"name": "org.onap.domain.pmsh.DCAEMicroservice",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -26,12 +22,8 @@
"name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -40,12 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -54,13 +42,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.PolicyParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json
index a17ba399a..9b3664294 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionNotFound.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -12,12 +12,8 @@
"name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.dcae.acm.DCAEMicroserviceAutomationCompositionParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "DCAE Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -26,12 +22,8 @@
"name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Monitoring Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -40,12 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.policy.acm.PolicyAutomationCompositionParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -54,12 +42,8 @@
"name": "org.onap.domain.pmsh.PMSH_CDS_AutomationCompositionElement",
"version": "1.2.3"
},
- "participantType": {
- "name": "org.onap.ccsdk.cds.acm.CdsAutomationCompositionParticipant",
- "version": "2.2.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "CDS Automation Composition Element for the PMSH instance 0 automation composition"
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
index e66f3f68d..7a226ac92 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionSmoke.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c20": {
@@ -12,13 +12,8 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.HttpParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Http Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -27,13 +22,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.PolicyParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -42,13 +32,8 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "K8s Automation Composition Element for the PMSH instance 0 automation composition"
}
}
diff --git a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
index d0372a342..37568fb19 100644
--- a/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
+++ b/runtime-acm/src/test/resources/rest/acm/AutomationCompositionUpdate.json
@@ -2,8 +2,8 @@
"name": "PMSHInstance0",
"version": "1.0.1",
"compositionId": "709c62b3-8918-41b9-a747-d21eb79c6c40",
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "PMSH automation composition instance 0",
"elements": {
"709c62b3-8918-41b9-a747-d21eb79c6c21": {
@@ -12,13 +12,8 @@
"name": "org.onap.domain.database.PMSH_K8SMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.KubernetesParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the K8S microservice for PMSH"
},
"709c62b3-8918-41b9-a747-d21eb79c6c22": {
@@ -27,13 +22,8 @@
"name": "org.onap.domain.database.Http_PMSHMicroserviceAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.HttpParticipant",
- "version": "2.3.4"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Automation composition element for the operational policy for Performance Management Subscription Handling"
},
"709c62b3-8918-41b9-a747-d21eb79c6c23": {
@@ -42,13 +32,8 @@
"name": "org.onap.domain.pmsh.PMSH_OperationalPolicyAutomationCompositionElement",
"version": "1.2.3"
},
- "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c03",
- "participantType": {
- "name": "org.onap.policy.clamp.acm.PolicyParticipant",
- "version": "2.3.1"
- },
- "state": "UNINITIALISED",
- "orderedState": "UNINITIALISED",
+ "deployState": "UNDEPLOYED",
+ "lockState": "NONE",
"description": "Operational Policy Automation Composition Element for the PMSH instance 0 automation composition"
}
}