aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeploy.java67
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeployAck.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java)7
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationComposition.java10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java8
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDeploy.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java)18
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeploy.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java)18
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAck.java (renamed from models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java)13
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java10
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationComposition.java35
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java34
-rw-r--r--models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java10
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java (renamed from models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java)20
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java (renamed from models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java)22
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java13
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java41
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java29
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java47
-rw-r--r--models/src/test/java/org/onap/policy/clamp/models/acm/utils/AcmUtilsTest.java4
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionDeployListener.java (renamed from participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java)16
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantMessagePublisher.java4
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java30
-rw-r--r--participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandler.java6
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/comm/ParticipantCommTest.java8
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java26
-rw-r--r--participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java2
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandler.java23
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java12
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java (renamed from runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java)44
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java12
-rw-r--r--runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java14
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionHandlerTest.java40
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java24
-rw-r--r--runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/comm/SupervisionMessagesTest.java6
33 files changed, 458 insertions, 215 deletions
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeploy.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeploy.java
new file mode 100644
index 000000000..6b6eda319
--- /dev/null
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeploy.java
@@ -0,0 +1,67 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.clamp.models.acm.concepts;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.UnaryOperator;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.NonNull;
+import lombok.ToString;
+import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder;
+import org.onap.policy.models.base.PfConceptKey;
+import org.onap.policy.models.base.PfUtils;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+
+/**
+ * Class to represent a automation composition instance to send for deploy.
+ */
+@NoArgsConstructor
+@Data
+@ToString
+public class AcElementDeploy {
+
+ @NonNull
+ private ToscaConceptIdentifier definition = new ToscaConceptIdentifier(PfConceptKey.getNullKey());
+
+ @NonNull
+ private DeployOrder orderedState = DeployOrder.DEPLOY;
+
+ private ToscaServiceTemplate toscaServiceTemplateFragment;
+
+ // A map indexed by the property name. Each map entry is the serialized value of the property,
+ // which can be deserialized into an instance of the type of the property.
+ private Map<String, Object> properties = new LinkedHashMap<>();
+
+ /**
+ * Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
+ *
+ * @param otherElement the other element to copy from
+ */
+ public AcElementDeploy(final AcElementDeploy otherElement) {
+ this.definition = new ToscaConceptIdentifier(otherElement.definition);
+ this.orderedState = otherElement.orderedState;
+ this.toscaServiceTemplateFragment = otherElement.toscaServiceTemplateFragment;
+ this.properties = PfUtils.mapMap(otherElement.properties, UnaryOperator.identity());
+ }
+}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeployAck.java
index b100f28c0..2db1555bf 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElementAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AcElementDeployAck.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -29,11 +29,14 @@ import lombok.ToString;
@Setter
@AllArgsConstructor
@ToString
-public class AutomationCompositionElementAck {
+public class AcElementDeployAck {
// State of the AutomationCompositionElement
private AutomationCompositionState state;
+ // State of the AutomationCompositionElement
+ private DeployState deployState;
+
// Result: Success/Fail.
private Boolean result;
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 83c51eadb..18a62ae94 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -49,6 +49,12 @@ public class AutomationComposition extends ToscaEntity implements Comparable<Aut
@NonNull
private AutomationCompositionOrderedState orderedState = AutomationCompositionOrderedState.UNINITIALISED;
+ @NonNull
+ private DeployState deployState = DeployState.UNDEPLOYED;
+
+ @NonNull
+ private LockState lockState = LockState.LOCKED;
+
private Map<UUID, AutomationCompositionElement> elements;
@NonNull
@@ -65,6 +71,8 @@ public class AutomationComposition extends ToscaEntity implements Comparable<Aut
this.compositionId = otherAutomationComposition.compositionId;
this.state = otherAutomationComposition.state;
this.orderedState = otherAutomationComposition.orderedState;
+ this.deployState = otherAutomationComposition.deployState;
+ this.lockState = otherAutomationComposition.lockState;
this.elements = PfUtils.mapMap(otherAutomationComposition.elements, AutomationCompositionElement::new);
this.primed = otherAutomationComposition.primed;
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
index b153ef508..ab234f604 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/AutomationCompositionElement.java
@@ -53,6 +53,12 @@ public class AutomationCompositionElement {
private AutomationCompositionState state = AutomationCompositionState.UNINITIALISED;
@NonNull
+ private DeployState deployState = DeployState.UNDEPLOYED;
+
+ @NonNull
+ private LockState lockState = LockState.LOCKED;
+
+ @NonNull
private AutomationCompositionOrderedState orderedState = AutomationCompositionOrderedState.UNINITIALISED;
private ToscaServiceTemplate toscaServiceTemplateFragment;
@@ -77,5 +83,7 @@ public class AutomationCompositionElement {
this.toscaServiceTemplateFragment = otherElement.toscaServiceTemplateFragment;
this.description = otherElement.description;
this.properties = PfUtils.mapMap(otherElement.properties, UnaryOperator.identity());
+ this.deployState = otherElement.deployState;
+ this.lockState = otherElement.lockState;
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDeploy.java
index 031fd5c02..337a09d17 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantUpdates.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/concepts/ParticipantDeploy.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 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,27 +30,31 @@ import lombok.ToString;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent a participant definition update instance.
+ * Class to represent a participant definition instance for Deploy.
*/
@Getter
@NoArgsConstructor
@Data
@ToString
-public class ParticipantUpdates {
+public class ParticipantDeploy {
private UUID participantId;
// List of AutomationCompositionElement values for a particular participant
private List<AutomationCompositionElement> automationCompositionElementList = new ArrayList<>();
+ // List of Automation Composition Element Deploy for a particular participant
+ private List<AcElementDeploy> acElementList = new ArrayList<>();
+
/**
* Copy constructor, does a deep copy but as all fields here are immutable, it's just a regular copy.
*
- * @param participantUpdates the participant with updates to copy from
+ * @param copyConstructor the participant with updates to copy from
*/
- public ParticipantUpdates(final ParticipantUpdates participantUpdates) {
- this.participantId = participantUpdates.participantId;
+ public ParticipantDeploy(final ParticipantDeploy copyConstructor) {
+ this.participantId = copyConstructor.participantId;
this.automationCompositionElementList = PfUtils.mapList(
- participantUpdates.automationCompositionElementList, AutomationCompositionElement::new);
+ copyConstructor.automationCompositionElementList, AutomationCompositionElement::new);
+ this.acElementList = PfUtils.mapList(copyConstructor.acElementList, AcElementDeploy::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeploy.java
index 6bc79f67e..f0ba43f2a 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdate.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeploy.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 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.
@@ -25,11 +25,11 @@ import java.util.List;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.models.base.PfUtils;
/**
- * Class to represent the AUTOMATION_COMPOSITION_UPDATE message that the automation composition runtime sends to a
+ * Class to represent the AUTOMATION_COMPOSITION_DEPLOY message that the automation composition runtime sends to a
* participant. When a participant receives this message, it creates the automation composition elements contained in
* the message and sets them to state PASSIVE. subsequent AUTOMATION_COMPOSITION_STATE_CHANGE messages are used to
* activate the automation compositions.
@@ -37,18 +37,18 @@ import org.onap.policy.models.base.PfUtils;
@Getter
@Setter
@ToString(callSuper = true)
-public class AutomationCompositionUpdate extends ParticipantMessage {
+public class AutomationCompositionDeploy extends ParticipantMessage {
// A list of ParticipantUpdates instances which carries details of an updated participant.
- private List<ParticipantUpdates> participantUpdatesList = new ArrayList<>();
+ private List<ParticipantDeploy> participantUpdatesList = new ArrayList<>();
private Integer startPhase = 0;
/**
* Constructor for instantiating class with message name.
*
*/
- public AutomationCompositionUpdate() {
- super(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
+ public AutomationCompositionDeploy() {
+ super(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY);
}
/**
@@ -56,9 +56,9 @@ public class AutomationCompositionUpdate extends ParticipantMessage {
*
* @param source source from which to copy
*/
- public AutomationCompositionUpdate(AutomationCompositionUpdate source) {
+ public AutomationCompositionDeploy(AutomationCompositionDeploy source) {
super(source);
this.startPhase = source.startPhase;
- this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantUpdates::new);
+ this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantDeploy::new);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAck.java
index c1ec67c83..8d52955cc 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAck.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAck.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ import java.util.function.UnaryOperator;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
import org.onap.policy.models.base.PfUtils;
/**
@@ -38,20 +38,20 @@ import org.onap.policy.models.base.PfUtils;
@Getter
@Setter
@ToString(callSuper = true)
-public class AutomationCompositionAck extends ParticipantAckMessage {
+public class AutomationCompositionDeployAck extends ParticipantAckMessage {
private UUID automationCompositionId;
private Integer startPhase;
// A map with AutomationCompositionElementID as its key, and a pair of result and message as value per
// AutomationCompositionElement.
- private Map<UUID, AutomationCompositionElementAck> automationCompositionResultMap = new LinkedHashMap<>();
+ private Map<UUID, AcElementDeployAck> automationCompositionResultMap = new LinkedHashMap<>();
/**
* Constructor for instantiating ParticipantRegisterAck class with message name.
*
*/
- public AutomationCompositionAck(final ParticipantMessageType messageType) {
+ public AutomationCompositionDeployAck(final ParticipantMessageType messageType) {
super(messageType);
}
@@ -60,9 +60,10 @@ public class AutomationCompositionAck extends ParticipantAckMessage {
*
* @param source source from which to copy
*/
- public AutomationCompositionAck(final AutomationCompositionAck source) {
+ public AutomationCompositionDeployAck(final AutomationCompositionDeployAck source) {
super(source);
this.automationCompositionId = source.automationCompositionId;
+ this.startPhase = source.startPhase;
this.automationCompositionResultMap =
PfUtils.mapMap(source.automationCompositionResultMap, UnaryOperator.identity());
}
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 4f6bcdbf3..502896188 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
@@ -37,10 +37,10 @@ public enum ParticipantMessageType {
PARTICIPANT_STATE_CHANGE,
/**
- * Used by acm runtime to update the automation compositions running on participants, triggers a
- * PARTICIPANT_STATUS message with the result of the AUTOMATION_COMPOSITION_UPDATE operation.
+ * Used by acm runtime to deploy the automation compositions running on participants, triggers a
+ * PARTICIPANT_STATUS message with the result of the AUTOMATION_COMPOSITION_DEPLOY operation.
*/
- AUTOMATION_COMPOSITION_UPDATE,
+ AUTOMATION_COMPOSITION_DEPLOY,
/**
* Used by acm runtime to change the state of automation compositions in participants, triggers a
@@ -86,10 +86,10 @@ public enum ParticipantMessageType {
PARTICIPANT_UPDATE_ACK,
/**
- * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_UPDATE message
+ * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_DEPLOY message
* from automation composition runtime.
*/
- AUTOMATION_COMPOSITION_UPDATE_ACK,
+ AUTOMATION_COMPOSITION_DEPLOY_ACK,
/**
* Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_STATE_CHANGE message
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 f9cc880d0..00f83122d 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
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -43,6 +43,8 @@ import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
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.LockState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -88,6 +90,14 @@ public class JpaAutomationComposition extends Validated
private AutomationCompositionOrderedState orderedState;
@Column
+ @NotNull
+ private DeployState deployState;
+
+ @Column
+ @NotNull
+ private LockState lockState;
+
+ @Column
private String description;
@Column(columnDefinition = "TINYINT DEFAULT 1")
@@ -103,7 +113,7 @@ public class JpaAutomationComposition extends Validated
*/
public JpaAutomationComposition() {
this(UUID.randomUUID().toString(), new PfConceptKey(), UUID.randomUUID().toString(),
- AutomationCompositionState.UNINITIALISED, new ArrayList<>());
+ AutomationCompositionState.UNINITIALISED, new ArrayList<>(), DeployState.UNDEPLOYED, LockState.LOCKED);
}
/**
@@ -117,12 +127,15 @@ public class JpaAutomationComposition extends Validated
*/
public JpaAutomationComposition(@NonNull final String instanceId, @NonNull final PfConceptKey key,
@NonNull final String compositionId, @NonNull final AutomationCompositionState state,
- @NonNull final List<JpaAutomationCompositionElement> elements) {
+ @NonNull final List<JpaAutomationCompositionElement> elements,
+ @NonNull final DeployState deployState, @NonNull final LockState lockState) {
this.instanceId = instanceId;
this.name = key.getName();
this.version = key.getVersion();
this.compositionId = compositionId;
this.state = state;
+ this.deployState = deployState;
+ this.lockState = lockState;
this.elements = elements;
}
@@ -138,6 +151,8 @@ public class JpaAutomationComposition extends Validated
this.compositionId = copyConcept.compositionId;
this.state = copyConcept.state;
this.orderedState = copyConcept.orderedState;
+ this.deployState = copyConcept.deployState;
+ this.lockState = copyConcept.lockState;
this.description = copyConcept.description;
this.elements = PfUtils.mapList(copyConcept.elements, JpaAutomationCompositionElement::new);
this.primed = copyConcept.primed;
@@ -162,6 +177,8 @@ public class JpaAutomationComposition extends Validated
automationComposition.setCompositionId(UUID.fromString(compositionId));
automationComposition.setState(state);
automationComposition.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
+ automationComposition.setDeployState(deployState);
+ automationComposition.setLockState(lockState);
automationComposition.setDescription(description);
automationComposition.setPrimed(primed);
automationComposition.setElements(new LinkedHashMap<>(this.elements.size()));
@@ -180,6 +197,8 @@ public class JpaAutomationComposition extends Validated
this.compositionId = automationComposition.getCompositionId().toString();
this.state = automationComposition.getState();
this.orderedState = automationComposition.getOrderedState();
+ this.deployState = automationComposition.getDeployState();
+ this.lockState = automationComposition.getLockState();
this.description = automationComposition.getDescription();
this.primed = automationComposition.getPrimed();
@@ -231,6 +250,16 @@ public class JpaAutomationComposition extends Validated
return result;
}
+ result = ObjectUtils.compare(deployState, other.deployState);
+ if (result != 0) {
+ return result;
+ }
+
+ result = ObjectUtils.compare(lockState, other.lockState);
+ if (result != 0) {
+ return result;
+ }
+
result = ObjectUtils.compare(description, other.description);
if (result != 0) {
return result;
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
index 743bb7fd3..4020243bb 100644
--- a/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
+++ b/models/src/main/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElement.java
@@ -42,6 +42,8 @@ import org.apache.commons.lang3.ObjectUtils;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
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.LockState;
import org.onap.policy.common.parameters.annotations.NotNull;
import org.onap.policy.common.parameters.annotations.Valid;
import org.onap.policy.models.base.PfAuthorative;
@@ -91,6 +93,14 @@ public class JpaAutomationCompositionElement extends Validated
private AutomationCompositionOrderedState orderedState;
@Column
+ @NotNull
+ private DeployState deployState;
+
+ @Column
+ @NotNull
+ private LockState lockState;
+
+ @Column
private String description;
@Lob
@@ -113,7 +123,8 @@ public class JpaAutomationCompositionElement extends Validated
* @param instanceId The id of the automation composition instance
*/
public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId) {
- this(elementId, instanceId, new PfConceptKey(), AutomationCompositionState.UNINITIALISED);
+ this(elementId, instanceId, new PfConceptKey(),
+ AutomationCompositionState.UNINITIALISED, DeployState.UNDEPLOYED, LockState.LOCKED);
}
/**
@@ -126,11 +137,14 @@ public class JpaAutomationCompositionElement extends Validated
*/
public JpaAutomationCompositionElement(@NonNull final String elementId, @NonNull final String instanceId,
@NonNull final PfConceptKey definition,
- @NonNull final AutomationCompositionState state) {
+ @NonNull final AutomationCompositionState state,
+ @NonNull final DeployState deployState, @NonNull final LockState lockState) {
this.elementId = elementId;
this.instanceId = instanceId;
this.definition = definition;
this.state = state;
+ this.deployState = deployState;
+ this.lockState = lockState;
}
/**
@@ -147,6 +161,8 @@ public class JpaAutomationCompositionElement extends Validated
this.orderedState = copyConcept.orderedState;
this.description = copyConcept.description;
this.properties = (copyConcept.properties != null ? new LinkedHashMap<>(copyConcept.properties) : null);
+ this.deployState = copyConcept.deployState;
+ this.lockState = copyConcept.lockState;
}
/**
@@ -169,6 +185,8 @@ public class JpaAutomationCompositionElement extends Validated
element.setOrderedState(orderedState != null ? orderedState : state.asOrderedState());
element.setDescription(description);
element.setProperties(PfUtils.mapMap(properties, UnaryOperator.identity()));
+ element.setDeployState(deployState);
+ element.setLockState(lockState);
return element;
}
@@ -181,6 +199,8 @@ public class JpaAutomationCompositionElement extends Validated
this.orderedState = element.getOrderedState();
this.description = element.getDescription();
properties = PfUtils.mapMap(element.getProperties(), UnaryOperator.identity());
+ this.deployState = element.getDeployState();
+ this.lockState = element.getLockState();
}
@Override
@@ -222,6 +242,16 @@ public class JpaAutomationCompositionElement extends Validated
return result;
}
+ result = ObjectUtils.compare(deployState, other.deployState);
+ if (result != 0) {
+ return result;
+ }
+
+ result = ObjectUtils.compare(lockState, other.lockState);
+ if (result != 0) {
+ return result;
+ }
+
return ObjectUtils.compare(description, other.description);
}
}
diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java b/models/src/main/java/org/onap/policy/clamp/models/acm/utils/AcmUtils.java
index 9f73cb144..7d1e80f54 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
@@ -41,7 +41,7 @@ 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.NodeTemplateState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.common.parameters.BeanValidationResult;
import org.onap.policy.common.parameters.ObjectValidationResult;
import org.onap.policy.common.parameters.ValidationResult;
@@ -71,14 +71,14 @@ public final class AcmUtils {
* @param participantUpdates list of participantUpdates
*/
public static void prepareParticipantUpdate(AutomationCompositionElement acElement,
- List<ParticipantUpdates> participantUpdates) {
+ List<ParticipantDeploy> participantUpdates) {
if (participantUpdates.isEmpty()) {
participantUpdates.add(getAutomationCompositionElementList(acElement));
return;
}
var participantExists = false;
- for (ParticipantUpdates participantUpdate : participantUpdates) {
+ for (ParticipantDeploy participantUpdate : participantUpdates) {
if (participantUpdate.getParticipantId().equals(acElement.getParticipantId())) {
participantUpdate.getAutomationCompositionElementList().add(acElement);
participantExists = true;
@@ -89,8 +89,8 @@ public final class AcmUtils {
}
}
- private static ParticipantUpdates getAutomationCompositionElementList(AutomationCompositionElement acElement) {
- var participantUpdate = new ParticipantUpdates();
+ private static ParticipantDeploy getAutomationCompositionElementList(AutomationCompositionElement acElement) {
+ var participantUpdate = new ParticipantDeploy();
participantUpdate.setParticipantId(acElement.getParticipantId());
participantUpdate.getAutomationCompositionElementList().add(acElement);
return participantUpdate;
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java
index 8c5528cc6..038c140ed 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionAckTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,39 +28,39 @@ import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.Partic
import java.util.Map;
import java.util.UUID;
import org.junit.jupiter.api.Test;
-import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementAck;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
-class AutomationCompositionAckTest {
+class AutomationCompositionDeployAckTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new AutomationCompositionAck((AutomationCompositionAck) null))
+ assertThatThrownBy(() -> new AutomationCompositionDeployAck((AutomationCompositionDeployAck) null))
.isInstanceOf(NullPointerException.class);
- final var orig = new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
+ final var orig = new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY);
// verify with null values
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new AutomationCompositionAck(orig).toString()));
+ removeVariableFields(new AutomationCompositionDeployAck(orig).toString()));
// verify with all values
orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(CommonTestData.getParticipantId());
- var acElementResult = new AutomationCompositionElementAck(AutomationCompositionState.UNINITIALISED,
+ var acElementResult = new AcElementDeployAck(AutomationCompositionState.UNINITIALISED, null,
true, "AutomationCompositionElement result");
final var automationCompositionResultMap = Map.of(UUID.randomUUID(), acElementResult);
orig.setAutomationCompositionResultMap(automationCompositionResultMap);
orig.setResponseTo(UUID.randomUUID());
orig.setResult(true);
- orig.setMessage("Successfully processed AutomationCompositionUpdate message");
+ orig.setMessage("Successfully processed AutomationCompositionDeploy message");
assertEquals(removeVariableFields(orig.toString()),
- removeVariableFields(new AutomationCompositionAck(orig).toString()));
+ removeVariableFields(new AutomationCompositionDeployAck(orig).toString()));
- assertSerializable(orig, AutomationCompositionAck.class);
+ assertSerializable(orig, AutomationCompositionDeployAck.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java
index c1be28958..2912dee9b 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionUpdateTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2023 Nordix Foundation.
+ * Copyright (C) 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.
@@ -33,7 +33,7 @@ import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
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.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
@@ -43,12 +43,12 @@ import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty;
/**
* Test the copy constructor.
*/
-class AutomationCompositionUpdateTest {
+class AutomationCompositionDeployTest {
@Test
void testCopyConstructor() throws CoderException {
- assertThatThrownBy(() -> new AutomationCompositionUpdate(null)).isInstanceOf(NullPointerException.class);
+ assertThatThrownBy(() -> new AutomationCompositionDeploy(null)).isInstanceOf(NullPointerException.class);
- var orig = new AutomationCompositionUpdate();
+ var orig = new AutomationCompositionDeploy();
// verify with all values
orig.setAutomationCompositionId(UUID.randomUUID());
orig.setParticipantId(null);
@@ -74,14 +74,14 @@ class AutomationCompositionUpdateTest {
var propertiesMap = Map.of("Prop1", (Object) json);
acElement.setProperties(propertiesMap);
- var participantUpdates = new ParticipantUpdates();
- participantUpdates.setParticipantId(participantId);
- participantUpdates.setAutomationCompositionElementList(List.of(acElement));
- orig.setParticipantUpdatesList(List.of(participantUpdates));
+ var participantDeploy = new ParticipantDeploy();
+ participantDeploy.setParticipantId(participantId);
+ participantDeploy.setAutomationCompositionElementList(List.of(acElement));
+ orig.setParticipantUpdatesList(List.of(participantDeploy));
- var other = new AutomationCompositionUpdate(orig);
+ var other = new AutomationCompositionDeploy(orig);
assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString()));
- assertSerializable(orig, AutomationCompositionUpdate.class);
+ assertSerializable(orig, AutomationCompositionDeploy.class);
}
}
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
index ce23a821f..4a1a2d9de 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.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.
@@ -20,15 +20,12 @@
package org.onap.policy.clamp.models.acm.messages.dmaap.participant;
-import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.impl.PojoClassFactory;
-import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.rule.impl.GetterMustExistRule;
import com.openpojo.validation.rule.impl.SetterMustExistRule;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-import java.util.List;
import org.junit.jupiter.api.Test;
import org.onap.policy.common.utils.test.ToStringTester;
@@ -39,18 +36,18 @@ class ParticipantPojosTest {
@Test
void testPojos() {
- List<PojoClass> pojoClasses =
+ var pojoClasses =
PojoClassFactory.getPojoClasses(ParticipantPojosTest.class.getPackageName());
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantMessage.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantMessageTest.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantAckMessage.class));
pojoClasses.remove(PojoClassFactory.getPojoClass(ParticipantAckMessageTest.class));
- pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionAck.class));
- pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionAckTest.class));
+ pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionDeployAck.class));
+ pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionDeployAckTest.class));
// @formatter:off
- final Validator validator = ValidatorBuilder
+ final var validator = ValidatorBuilder
.create()
.with(new ToStringTester())
.with(new SetterMustExistRule())
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
index 83e13c74a..3274833ca 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionElementTest.java
@@ -35,6 +35,8 @@ import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElement;
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.LockState;
import org.onap.policy.clamp.models.acm.concepts.Participant;
import org.onap.policy.clamp.models.acm.utils.CommonTestData;
import org.onap.policy.common.utils.coder.CoderException;
@@ -56,6 +58,10 @@ class JpaAutomationCompositionElementTest {
@Test
void testJpaAutomationCompositionElementConstructor() {
assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement((AutomationCompositionElement) null);
+ }).hasMessageMatching("authorativeConcept is marked .*ull but is null");
+
+ assertThatThrownBy(() -> {
new JpaAutomationCompositionElement((JpaAutomationCompositionElement) null);
}).hasMessageMatching("copyConcept is marked .*ull but is null");
@@ -72,21 +78,38 @@ class JpaAutomationCompositionElementTest {
}).hasMessageMatching(NULL_ELEMENT_ID_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement(null, null, null, null);
+ new JpaAutomationCompositionElement(null, null, null, null, null, null);
}).hasMessageMatching(NULL_ELEMENT_ID_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement("key", null, null, AutomationCompositionState.UNINITIALISED);
+ new JpaAutomationCompositionElement("key", null, null,
+ AutomationCompositionState.UNINITIALISED, DeployState.UNDEPLOYED, LockState.LOCKED);
}).hasMessageMatching(NULL_INSTANCE_ID_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), null);
+ new JpaAutomationCompositionElement("key", "key", null,
+ AutomationCompositionState.UNINITIALISED, DeployState.UNDEPLOYED, LockState.LOCKED);
+ }).hasMessageMatching("definition" + NULL_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement("key", "key", new PfConceptKey(), null,
+ DeployState.UNDEPLOYED, LockState.LOCKED);
}).hasMessageMatching("state" + NULL_ERROR);
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement("key", "key", new PfConceptKey(),
+ AutomationCompositionState.UNINITIALISED, null, LockState.LOCKED);
+ }).hasMessageMatching("deployState" + NULL_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationCompositionElement("key", "key", new PfConceptKey(),
+ AutomationCompositionState.UNINITIALISED, DeployState.UNDEPLOYED, null);
+ }).hasMessageMatching("lockState" + NULL_ERROR);
+
assertNotNull(new JpaAutomationCompositionElement());
assertNotNull(new JpaAutomationCompositionElement("key", "key"));
assertNotNull(new JpaAutomationCompositionElement("key", "key",
- new PfConceptKey(), AutomationCompositionState.UNINITIALISED));
+ new PfConceptKey(), AutomationCompositionState.UNINITIALISED, DeployState.UNDEPLOYED, LockState.LOCKED));
}
@Test
@@ -189,6 +212,16 @@ class JpaAutomationCompositionElementTest {
testJpaAutomationCompositionElement.setState(AutomationCompositionState.UNINITIALISED);
assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setDeployState(DeployState.DEPLOYED);
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setDeployState(DeployState.UNDEPLOYED);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
+ testJpaAutomationCompositionElement.setLockState(LockState.UNLOCKED);
+ assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+ testJpaAutomationCompositionElement.setLockState(LockState.LOCKED);
+ assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
+
assertEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
testJpaAutomationCompositionElement.setParticipantId(UUID.randomUUID().toString());
assertNotEquals(0, testJpaAutomationCompositionElement.compareTo(otherJpaAutomationCompositionElement));
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 2164f5782..30e225995 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/concepts/JpaAutomationCompositionTest.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021-2022 Nordix Foundation.
+ * Copyright (C) 2021-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.
@@ -37,6 +37,8 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
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.AutomationCompositions;
+import org.onap.policy.clamp.models.acm.concepts.DeployState;
+import org.onap.policy.clamp.models.acm.concepts.LockState;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
import org.onap.policy.models.base.PfConceptKey;
@@ -58,30 +60,43 @@ class JpaAutomationCompositionTest {
}).hasMessageMatching("copyConcept is marked .*ull but is null");
assertThatThrownBy(() -> {
- new JpaAutomationComposition(null, null, null, null, null);
+ new JpaAutomationComposition(null, null, null, null, null, null, null);
}).hasMessageMatching(NULL_INSTANCE_ID_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationComposition(INSTANCE_ID, null, null, null, new ArrayList<>());
+ new JpaAutomationComposition(INSTANCE_ID, null, null, null, new ArrayList<>(),
+ DeployState.UNDEPLOYED, LockState.LOCKED);
}).hasMessageMatching("key" + NULL_TEXT_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), null,
- AutomationCompositionState.UNINITIALISED, null);
+ AutomationCompositionState.UNINITIALISED, new ArrayList<>(),
+ DeployState.UNDEPLOYED, LockState.LOCKED);
}).hasMessageMatching("compositionId" + NULL_TEXT_ERROR);
assertThatThrownBy(() -> {
- new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(), null, null);
+ new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(), null,
+ new ArrayList<>(), DeployState.UNDEPLOYED, LockState.LOCKED);
}).hasMessageMatching("state" + NULL_TEXT_ERROR);
assertThatThrownBy(() -> {
new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(),
- AutomationCompositionState.UNINITIALISED, null);
+ AutomationCompositionState.UNINITIALISED, null, DeployState.UNDEPLOYED, LockState.LOCKED);
}).hasMessageMatching("elements" + NULL_TEXT_ERROR);
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(),
+ AutomationCompositionState.UNINITIALISED, new ArrayList<>(), null, LockState.LOCKED);
+ }).hasMessageMatching("deployState" + NULL_TEXT_ERROR);
+
+ assertThatThrownBy(() -> {
+ new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(),
+ AutomationCompositionState.UNINITIALISED, new ArrayList<>(), DeployState.UNDEPLOYED, null);
+ }).hasMessageMatching("lockState" + NULL_TEXT_ERROR);
+
assertNotNull(new JpaAutomationComposition());
assertNotNull(new JpaAutomationComposition(INSTANCE_ID, new PfConceptKey(), COMPOSITION_ID.toString(),
- AutomationCompositionState.UNINITIALISED, new ArrayList<>()));
+ AutomationCompositionState.UNINITIALISED, new ArrayList<>(), DeployState.UNDEPLOYED, LockState.LOCKED));
}
@Test
diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
index 784f1cfde..b479f022f 100644
--- a/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
+++ b/models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/AcDefinitionProviderTest.java
@@ -27,6 +27,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -89,6 +90,24 @@ class AcDefinitionProviderTest {
var result = acDefinitionProvider.createAutomationCompositionDefinition(inputServiceTemplate);
assertThat(result.getServiceTemplate()).isEqualTo(docServiceTemplate.toAuthorative());
+ assertThat(result.getServiceTemplate().getMetadata() != null);
+ }
+
+ @Test
+ void testCreateServiceTemplateWithMetadata() {
+ var docServiceTemplate = new DocToscaServiceTemplate(inputServiceTemplate);
+ var acmDefinition = getAcDefinition(docServiceTemplate);
+
+ var acmDefinitionRepository = mock(AutomationCompositionDefinitionRepository.class);
+ when(acmDefinitionRepository.save(any(JpaAutomationCompositionDefinition.class)))
+ .thenReturn(new JpaAutomationCompositionDefinition(acmDefinition));
+
+ var acDefinitionProvider = new AcDefinitionProvider(acmDefinitionRepository);
+ inputServiceTemplate.setMetadata(new HashMap<>());
+ var result = acDefinitionProvider.createAutomationCompositionDefinition(inputServiceTemplate);
+
+ assertThat(result.getServiceTemplate()).isEqualTo(docServiceTemplate.toAuthorative());
+ assertThat(result.getServiceTemplate().getMetadata() != null);
}
@Test
@@ -191,6 +210,34 @@ class AcDefinitionProviderTest {
assertThat(result.get(0)).isEqualTo(acmDefinition.getServiceTemplate());
}
+ @Test
+ void testGetServiceTemplateNulls() {
+ var docServiceTemplate = new DocToscaServiceTemplate(inputServiceTemplate);
+ var acmDefinition = getAcDefinition(docServiceTemplate);
+ var acmDefinitionRepository = mock(AutomationCompositionDefinitionRepository.class);
+ when(acmDefinitionRepository.findAll(Mockito.<Example<JpaAutomationCompositionDefinition>>any()))
+ .thenReturn(List.of(new JpaAutomationCompositionDefinition(acmDefinition)));
+
+ var acDefinitionProvider = new AcDefinitionProvider(acmDefinitionRepository);
+ var result = acDefinitionProvider.getServiceTemplateList(null,
+ inputServiceTemplate.getVersion());
+
+ assertThat(result).hasSize(1);
+ assertThat(result.get(0)).isEqualTo(acmDefinition.getServiceTemplate());
+
+ result = acDefinitionProvider.getServiceTemplateList(inputServiceTemplate.getName(),
+ null);
+
+ assertThat(result).hasSize(1);
+ assertThat(result.get(0)).isEqualTo(acmDefinition.getServiceTemplate());
+
+ result = acDefinitionProvider.getServiceTemplateList(null,
+ null);
+
+ assertThat(result).hasSize(0);
+ assertThat(result.isEmpty());
+ }
+
private AutomationCompositionDefinition getAcDefinition(DocToscaServiceTemplate docServiceTemplate) {
var acmDefinition = new AutomationCompositionDefinition();
acmDefinition.setCompositionId(UUID.randomUUID());
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 c23c38c5b..413139999 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,7 +39,7 @@ 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.ParticipantUpdates;
+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;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -60,7 +60,7 @@ class AcmUtilsTest {
@Test
void testCommonUtilsParticipantUpdate() {
var acElement = new AutomationCompositionElement();
- List<ParticipantUpdates> participantUpdates = new ArrayList<>();
+ List<ParticipantDeploy> participantUpdates = new ArrayList<>();
assertThat(participantUpdates).isEmpty();
AcmUtils.prepareParticipantUpdate(acElement, participantUpdates);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionDeployListener.java
index 6c5dc127d..412d26e2e 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionUpdateListener.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/comm/AutomationCompositionDeployListener.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2021 Nordix Foundation.
+ * Copyright (C) 2023 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,28 +21,28 @@
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.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.springframework.stereotype.Component;
/**
- * Listener for Automation Composition Update messages sent by ACM.
+ * Listener for Automation Composition Deploy messages sent by ACM.
*/
@Component
-public class AutomationCompositionUpdateListener extends ParticipantListener<AutomationCompositionUpdate> {
+public class AutomationCompositionDeployListener extends ParticipantListener<AutomationCompositionDeploy> {
/**
* Constructs the object.
*
* @param participantHandler the handler for managing the state of the participant
*/
- public AutomationCompositionUpdateListener(final ParticipantHandler participantHandler) {
- super(AutomationCompositionUpdate.class, participantHandler,
- participantHandler::handleAutomationCompositionUpdate);
+ public AutomationCompositionDeployListener(final ParticipantHandler participantHandler) {
+ super(AutomationCompositionDeploy.class, participantHandler,
+ participantHandler::handleAutomationCompositionDeploy);
}
@Override
public String getType() {
- return ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY.name();
}
}
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 9023d9460..b18875813 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
@@ -26,7 +26,7 @@ import java.util.List;
import javax.ws.rs.core.Response.Status;
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.AutomationCompositionAck;
+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.ParticipantRegister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantStatus;
@@ -118,7 +118,7 @@ public class ParticipantMessagePublisher implements Publisher {
*/
@Timed(value = "publisher.automation_composition_update_ack",
description = "AUTOMATION_COMPOSITION_UPDATE_ACK/AUTOMATION_COMPOSITION_STATECHANGE_ACK messages published")
- public void sendAutomationCompositionAck(final AutomationCompositionAck automationCompositionAck) {
+ public void sendAutomationCompositionAck(final AutomationCompositionDeployAck automationCompositionAck) {
validate();
topicSinkClient.send(automationCompositionAck);
LOGGER.debug("Sent AutomationComposition Update/StateChange Ack to runtime - {}", automationCompositionAck);
diff --git a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
index 422fc3e23..f2fd636e9 100644
--- a/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
+++ b/participant/participant-intermediary/src/main/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandler.java
@@ -32,17 +32,17 @@ import lombok.Getter;
import org.onap.policy.clamp.acm.participant.intermediary.api.AutomationCompositionElementListener;
import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantMessagePublisher;
import org.onap.policy.clamp.acm.participant.intermediary.parameters.ParticipantParameters;
+import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck;
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.AutomationCompositionElementAck;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition;
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.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
import org.onap.policy.clamp.models.acm.concepts.ParticipantUtils;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeployAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
import org.onap.policy.models.base.PfModelException;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
@@ -121,13 +121,13 @@ public class AutomationCompositionHandler {
var acElement = elementsOnThisParticipant.get(id);
if (acElement != null) {
var automationCompositionStateChangeAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionStateChangeAck.setParticipantId(participantId);
automationCompositionStateChangeAck.setAutomationCompositionId(automationCompositionId);
acElement.setOrderedState(orderedState);
acElement.setState(newState);
automationCompositionStateChangeAck.getAutomationCompositionResultMap().put(acElement.getId(),
- new AutomationCompositionElementAck(newState, true,
+ new AcElementDeployAck(newState, null, true,
"Automation composition element {} state changed to {}\", id, newState)"));
LOGGER.debug("Automation composition element {} state changed to {}", id, newState);
automationCompositionStateChangeAck
@@ -155,7 +155,7 @@ public class AutomationCompositionHandler {
if (automationComposition == null) {
var automationCompositionAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAck.setParticipantId(participantId);
automationCompositionAck.setMessage("Automation composition " + stateChangeMsg.getAutomationCompositionId()
+ " does not use this participant " + participantId);
@@ -200,12 +200,12 @@ public class AutomationCompositionHandler {
}
/**
- * Handle a automation composition update message.
+ * Handle a automation composition Deploy message.
*
- * @param updateMsg the update message
+ * @param updateMsg the Deploy message
* @param acElementDefinitions the list of AutomationCompositionElementDefinition
*/
- public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg,
+ public void handleAutomationCompositionDeploy(AutomationCompositionDeploy updateMsg,
List<AutomationCompositionElementDefinition> acElementDefinitions) {
if (!updateMsg.appliesTo(participantId)) {
@@ -219,7 +219,7 @@ public class AutomationCompositionHandler {
}
}
- private void handleAcUpdatePhase0(AutomationCompositionUpdate updateMsg,
+ private void handleAcUpdatePhase0(AutomationCompositionDeploy updateMsg,
List<AutomationCompositionElementDefinition> acElementDefinitions) {
var automationComposition = automationCompositionMap.get(updateMsg.getAutomationCompositionId());
@@ -228,7 +228,7 @@ public class AutomationCompositionHandler {
// elements to existing AutomationComposition has to be supported).
if (automationComposition != null) {
var automationCompositionUpdateAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK);
automationCompositionUpdateAck.setParticipantId(participantId);
automationCompositionUpdateAck.setMessage("Automation composition " + updateMsg.getAutomationCompositionId()
@@ -257,7 +257,7 @@ public class AutomationCompositionHandler {
updateMsg.getAutomationCompositionId());
}
- private void handleAcUpdatePhaseN(AutomationCompositionUpdate updateMsg,
+ private void handleAcUpdatePhaseN(AutomationCompositionDeploy updateMsg,
List<AutomationCompositionElementDefinition> acElementDefinitions) {
var acElementList = updateMsg.getParticipantUpdatesList().stream()
@@ -303,7 +303,7 @@ public class AutomationCompositionHandler {
}
private List<AutomationCompositionElement> storeElementsOnThisParticipant(
- List<ParticipantUpdates> participantUpdates) {
+ List<ParticipantDeploy> participantUpdates) {
var acElementList = participantUpdates.stream()
.flatMap(participantUpdate -> participantUpdate.getAutomationCompositionElementList().stream())
.filter(element -> participantId.equals(element.getParticipantId())).collect(Collectors.toList());
@@ -386,7 +386,7 @@ public class AutomationCompositionHandler {
if (orderedState.equals(automationComposition.getOrderedState())) {
var automationCompositionAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAck.setParticipantId(participantId);
automationCompositionAck.setMessage("Automation composition is already in state " + orderedState);
automationCompositionAck.setResult(false);
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 75f2d81ab..050d66d0b 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
@@ -36,8 +36,8 @@ import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo;
import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition;
import org.onap.policy.clamp.models.acm.concepts.ParticipantState;
import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantAckMessage;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck;
@@ -103,8 +103,8 @@ public class ParticipantHandler {
@Timed(
value = "listener.automation_composition_update",
description = "AUTOMATION_COMPOSITION_UPDATE messages received")
- public void handleAutomationCompositionUpdate(AutomationCompositionUpdate updateMsg) {
- automationCompositionHandler.handleAutomationCompositionUpdate(updateMsg,
+ public void handleAutomationCompositionDeploy(AutomationCompositionDeploy updateMsg) {
+ automationCompositionHandler.handleAutomationCompositionDeploy(updateMsg,
acElementDefsMap.get(updateMsg.getCompositionId()));
}
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 f8db70cc9..d9d99da4e 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
@@ -30,7 +30,7 @@ import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.policy.clamp.acm.participant.intermediary.main.parameters.CommonTestData;
import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+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.ParticipantMessageType;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister;
@@ -59,8 +59,8 @@ class ParticipantCommTest {
var participantUpdateListener = new ParticipantUpdateListener(participantHandler);
assertEquals(ParticipantMessageType.PARTICIPANT_UPDATE.name(), participantUpdateListener.getType());
- var automationCompositionUpdateListener = new AutomationCompositionUpdateListener(participantHandler);
- assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE.name(),
+ var automationCompositionUpdateListener = new AutomationCompositionDeployListener(participantHandler);
+ assertEquals(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY.name(),
automationCompositionUpdateListener.getType());
var automationCompositionStateChangeListener = new AutomationCompositionStateChangeListener(participantHandler);
@@ -86,7 +86,7 @@ class ParticipantCommTest {
assertThrows(AutomationCompositionRuntimeException.class,
() -> participantMessagePublisher.sendParticipantDeregister(participantDeregister));
- var automationCompositionAck = Mockito.mock(AutomationCompositionAck.class);
+ var automationCompositionAck = Mockito.mock(AutomationCompositionDeployAck.class);
assertThrows(AutomationCompositionRuntimeException.class,
() -> participantMessagePublisher.sendAutomationCompositionAck(automationCompositionAck));
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
index 6698ef9a8..ae8a8b2a0 100644
--- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
+++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionHandlerTest.java
@@ -37,9 +37,9 @@ 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.AutomationCompositionOrderedState;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionStateChange;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier;
import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@@ -124,36 +124,36 @@ class AutomationCompositionHandlerTest {
var acd = new AutomationCompositionElementDefinition();
acd.setAcElementDefinitionId(definition);
- var updateMsg = new AutomationCompositionUpdate();
+ var updateMsg = new AutomationCompositionDeploy();
updateMsg.setAutomationCompositionId(UUID.randomUUID());
updateMsg.setMessageId(uuid);
updateMsg.setParticipantId(partecipantId);
updateMsg.setStartPhase(0);
var acElementDefinitions = List.of(acd);
- assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionDeploy(updateMsg, acElementDefinitions));
updateMsg.setStartPhase(1);
- assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionDeploy(updateMsg, acElementDefinitions));
ach.getAutomationCompositionMap().clear();
updateMsg.setStartPhase(0);
- assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionDeploy(updateMsg, acElementDefinitions));
updateMsg.setAutomationCompositionId(UUID.randomUUID());
- updateMsg.setParticipantUpdatesList(List.of(mock(ParticipantUpdates.class)));
- assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, acElementDefinitions));
+ updateMsg.setParticipantUpdatesList(List.of(mock(ParticipantDeploy.class)));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionDeploy(updateMsg, acElementDefinitions));
updateMsg.setStartPhase(1);
- var participantUpdate = new ParticipantUpdates();
- participantUpdate.setParticipantId(partecipantId);
+ var participantDeploy = new ParticipantDeploy();
+ participantDeploy.setParticipantId(partecipantId);
var element = new AutomationCompositionElement();
element.setDefinition(definition);
- participantUpdate.setAutomationCompositionElementList(List.of(element));
- updateMsg.setParticipantUpdatesList(List.of(participantUpdate));
+ participantDeploy.setAutomationCompositionElementList(List.of(element));
+ updateMsg.setParticipantUpdatesList(List.of(participantDeploy));
var acd2 = new AutomationCompositionElementDefinition();
acd2.setAcElementDefinitionId(definition);
acd2.setAutomationCompositionElementToscaNodeTemplate(mock(ToscaNodeTemplate.class));
- assertDoesNotThrow(() -> ach.handleAutomationCompositionUpdate(updateMsg, List.of(acd2)));
+ assertDoesNotThrow(() -> ach.handleAutomationCompositionDeploy(updateMsg, List.of(acd2)));
}
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 dc04440ca..9f1bf29be 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
@@ -97,7 +97,7 @@ class ParticipantHandlerTest {
void checkAppliesTo() {
var participantHandler = commonTestData.getMockParticipantHandler();
var participantAckMsg =
- new ParticipantAckMessage(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
+ new ParticipantAckMessage(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY);
assertTrue(participantHandler.appliesTo(participantAckMsg));
var participantMsg =
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 2542bdb15..374df0135 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
@@ -27,15 +27,15 @@ import java.util.Set;
import java.util.UUID;
import javax.ws.rs.core.Response;
import lombok.AllArgsConstructor;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
-import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
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.AutomationCompositionElementAck;
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.AutomationCompositionAck;
+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.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.persistence.provider.AutomationCompositionProvider;
@@ -66,7 +66,7 @@ public class SupervisionHandler {
private final AcDefinitionProvider acDefinitionProvider;
// Publishers for participant communication
- private final AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher;
+ private final AutomationCompositionDeployPublisher automationCompositionDeployPublisher;
private final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher;
/**
@@ -76,9 +76,10 @@ public class SupervisionHandler {
*/
@MessageIntercept
@Timed(
- value = "listener.automation_composition_update_ack",
- description = "AUTOMATION_COMPOSITION_UPDATE_ACK messages received")
- public void handleAutomationCompositionUpdateAckMessage(AutomationCompositionAck automationCompositionAckMessage) {
+ value = "listener.automation_composition_deploy_ack",
+ description = "AUTOMATION_COMPOSITION_DEPLOY_ACK messages received")
+ public void handleAutomationCompositionUpdateAckMessage(
+ AutomationCompositionDeployAck automationCompositionAckMessage) {
LOGGER.debug("AutomationComposition Update Ack message received {}", automationCompositionAckMessage);
setAcElementStateInDb(automationCompositionAckMessage);
}
@@ -128,12 +129,12 @@ public class SupervisionHandler {
value = "listener.automation_composition_statechange_ack",
description = "AUTOMATION_COMPOSITION_STATECHANGE_ACK messages received")
public void handleAutomationCompositionStateChangeAckMessage(
- AutomationCompositionAck automationCompositionAckMessage) {
+ AutomationCompositionDeployAck automationCompositionAckMessage) {
LOGGER.debug("AutomationComposition StateChange Ack message received {}", automationCompositionAckMessage);
setAcElementStateInDb(automationCompositionAckMessage);
}
- private void setAcElementStateInDb(AutomationCompositionAck automationCompositionAckMessage) {
+ private void setAcElementStateInDb(AutomationCompositionDeployAck automationCompositionAckMessage) {
if (automationCompositionAckMessage.getAutomationCompositionResultMap() != null) {
var automationComposition = automationCompositionProvider
.findAutomationComposition(automationCompositionAckMessage.getAutomationCompositionId());
@@ -152,7 +153,7 @@ public class SupervisionHandler {
}
private boolean updateState(AutomationComposition automationComposition,
- Set<Map.Entry<UUID, AutomationCompositionElementAck>> automationCompositionResultSet) {
+ Set<Map.Entry<UUID, AcElementDeployAck>> automationCompositionResultSet) {
var updated = false;
for (var acElementAck : automationCompositionResultSet) {
var element = automationComposition.getElements().get(acElementAck.getKey());
@@ -256,7 +257,7 @@ public class SupervisionHandler {
break;
case UNINITIALISED:
automationComposition.setState(AutomationCompositionState.UNINITIALISED2PASSIVE);
- automationCompositionUpdatePublisher.send(automationComposition);
+ automationCompositionDeployPublisher.send(automationComposition);
break;
case UNINITIALISED2PASSIVE:
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
index 0e5aab5e3..68ec44dc0 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScanner.java
@@ -26,8 +26,8 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.onap.policy.clamp.acm.runtime.main.parameters.AcRuntimeParameterGroup;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
-import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
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.Participant;
@@ -56,7 +56,7 @@ public class SupervisionScanner {
private final AutomationCompositionProvider automationCompositionProvider;
private final AcDefinitionProvider acDefinitionProvider;
private final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher;
- private final AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher;
+ private final AutomationCompositionDeployPublisher automationCompositionDeployPublisher;
private final ParticipantProvider participantProvider;
/**
@@ -65,20 +65,20 @@ public class SupervisionScanner {
* @param automationCompositionProvider the provider to use to read automation compositions from the database
* @param acDefinitionProvider the Policy Models Provider
* @param automationCompositionStateChangePublisher the AutomationComposition StateChange Publisher
- * @param automationCompositionUpdatePublisher the AutomationCompositionUpdate Publisher
+ * @param automationCompositionDeployPublisher the AutomationCompositionUpdate Publisher
* @param participantProvider the Participant Provider
* @param acRuntimeParameterGroup the parameters for the automation composition runtime
*/
public SupervisionScanner(final AutomationCompositionProvider automationCompositionProvider,
AcDefinitionProvider acDefinitionProvider,
final AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher,
- AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
+ AutomationCompositionDeployPublisher automationCompositionDeployPublisher,
ParticipantProvider participantProvider,
final AcRuntimeParameterGroup acRuntimeParameterGroup) {
this.automationCompositionProvider = automationCompositionProvider;
this.acDefinitionProvider = acDefinitionProvider;
this.automationCompositionStateChangePublisher = automationCompositionStateChangePublisher;
- this.automationCompositionUpdatePublisher = automationCompositionUpdatePublisher;
+ this.automationCompositionDeployPublisher = automationCompositionDeployPublisher;
this.participantProvider = participantProvider;
automationCompositionCounter.setMaxRetryCount(
@@ -229,7 +229,7 @@ public class SupervisionScanner {
private void sendAutomationCompositionMsg(AutomationComposition automationComposition, int startPhase) {
if (AutomationCompositionState.UNINITIALISED2PASSIVE.equals(automationComposition.getState())) {
LOGGER.debug("retry message AutomationCompositionUpdate");
- automationCompositionUpdatePublisher.send(automationComposition, startPhase);
+ automationCompositionDeployPublisher.send(automationComposition, startPhase);
} else {
LOGGER.debug("retry message AutomationCompositionStateChange");
automationCompositionStateChangePublisher.send(automationComposition, startPhase);
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
index 57556e088..4a0abc180 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdatePublisher.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionDeployPublisher.java
@@ -29,8 +29,8 @@ import java.util.List;
import java.util.UUID;
import lombok.AllArgsConstructor;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
-import org.onap.policy.clamp.models.acm.concepts.ParticipantUpdates;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionUpdate;
+import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy;
+import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionDeploy;
import org.onap.policy.clamp.models.acm.persistence.provider.AcDefinitionProvider;
import org.onap.policy.clamp.models.acm.utils.AcmUtils;
import org.slf4j.Logger;
@@ -38,52 +38,52 @@ import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
- * This class is used to send AutomationCompositionUpdate messages to participants on DMaaP.
+ * This class is used to send AutomationCompositionDeploy messages to participants on DMaaP.
*/
@Component
@AllArgsConstructor
-public class AutomationCompositionUpdatePublisher extends AbstractParticipantPublisher<AutomationCompositionUpdate> {
+public class AutomationCompositionDeployPublisher extends AbstractParticipantPublisher<AutomationCompositionDeploy> {
- private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdatePublisher.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionDeployPublisher.class);
private final AcDefinitionProvider acDefinitionProvider;
/**
- * Send AutomationCompositionUpdate to Participant.
+ * Send AutomationCompositionDeploy to Participant.
*
* @param automationComposition the AutomationComposition
*/
- @Timed(value = "publisher.automation_composition_update",
- description = "AUTOMATION_COMPOSITION_UPDATE messages published")
+ @Timed(value = "publisher.automation_composition_deploy",
+ description = "AUTOMATION_COMPOSITION_DEPLOY messages published")
public void send(AutomationComposition automationComposition) {
send(automationComposition, 0);
}
/**
- * Send AutomationCompositionUpdate to Participant.
+ * Send AutomationCompositionDeploy to Participant.
*
* @param automationComposition the AutomationComposition
* @param startPhase the Start Phase
*/
- @Timed(value = "publisher.automation_composition_update",
- description = "AUTOMATION_COMPOSITION_UPDATE messages published")
+ @Timed(value = "publisher.automation_composition_deploy",
+ description = "AUTOMATION_COMPOSITION_DEPLOY messages published")
public void send(AutomationComposition automationComposition, int startPhase) {
- var automationCompositionUpdateMsg = new AutomationCompositionUpdate();
- automationCompositionUpdateMsg.setCompositionId(automationComposition.getCompositionId());
- automationCompositionUpdateMsg.setStartPhase(startPhase);
- automationCompositionUpdateMsg.setAutomationCompositionId(automationComposition.getInstanceId());
- automationCompositionUpdateMsg.setMessageId(UUID.randomUUID());
- automationCompositionUpdateMsg.setTimestamp(Instant.now());
+ var acDeployMsg = new AutomationCompositionDeploy();
+ acDeployMsg.setCompositionId(automationComposition.getCompositionId());
+ acDeployMsg.setStartPhase(startPhase);
+ acDeployMsg.setAutomationCompositionId(automationComposition.getInstanceId());
+ acDeployMsg.setMessageId(UUID.randomUUID());
+ acDeployMsg.setTimestamp(Instant.now());
var toscaServiceTemplate =
acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId()).getServiceTemplate();
- List<ParticipantUpdates> participantUpdates = new ArrayList<>();
+ List<ParticipantDeploy> participantDeploys = new ArrayList<>();
for (var element : automationComposition.getElements().values()) {
AcmUtils.setAcPolicyInfo(element, toscaServiceTemplate);
- AcmUtils.prepareParticipantUpdate(element, participantUpdates);
+ AcmUtils.prepareParticipantUpdate(element, participantDeploys);
}
- automationCompositionUpdateMsg.setParticipantUpdatesList(participantUpdates);
+ acDeployMsg.setParticipantUpdatesList(participantDeploys);
- LOGGER.debug("AutomationCompositionUpdate message sent {}", automationCompositionUpdateMsg);
- super.send(automationCompositionUpdateMsg);
+ LOGGER.debug("AutomationCompositionDeploy message sent {}", acDeployMsg);
+ super.send(acDeployMsg);
}
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
index dd07be680..ed1662a95 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionStateChangeAckListener.java
@@ -23,7 +23,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.AutomationCompositionAck;
+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.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
@@ -36,8 +36,8 @@ import org.springframework.stereotype.Component;
* Listener for AutomationCompositionStateChangeAck messages sent by participants.
*/
@Component
-public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionAck>
- implements Listener<AutomationCompositionAck> {
+public class AutomationCompositionStateChangeAckListener extends ScoListener<AutomationCompositionDeployAck>
+ implements Listener<AutomationCompositionDeployAck> {
private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionStateChangeAckListener.class);
private final SupervisionHandler supervisionHandler;
@@ -46,20 +46,20 @@ public class AutomationCompositionStateChangeAckListener extends ScoListener<Aut
* Constructs the object.
*/
public AutomationCompositionStateChangeAckListener(SupervisionHandler supervisionHandler) {
- super(AutomationCompositionAck.class);
+ super(AutomationCompositionDeployAck.class);
this.supervisionHandler = supervisionHandler;
}
@Override
public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
- final AutomationCompositionAck automationCompositionStateChangeAckMessage) {
+ final AutomationCompositionDeployAck automationCompositionStateChangeAckMessage) {
LOGGER.debug("AutomationCompositionStateChangeAck received from participant - {}",
automationCompositionStateChangeAckMessage);
supervisionHandler.handleAutomationCompositionStateChangeAckMessage(automationCompositionStateChangeAckMessage);
}
@Override
- public ScoListener<AutomationCompositionAck> getScoListener() {
+ public ScoListener<AutomationCompositionDeployAck> getScoListener() {
return this;
}
diff --git a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
index 7a1d5294c..64d1fbef1 100644
--- a/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
+++ b/runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/comm/AutomationCompositionUpdateAckListener.java
@@ -23,7 +23,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.AutomationCompositionAck;
+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.common.endpoints.event.comm.Topic.CommInfrastructure;
import org.onap.policy.common.endpoints.listeners.ScoListener;
@@ -36,8 +36,8 @@ import org.springframework.stereotype.Component;
* Listener for AutomationCompositionUpdateAck messages sent by participants.
*/
@Component
-public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionAck>
- implements Listener<AutomationCompositionAck> {
+public class AutomationCompositionUpdateAckListener extends ScoListener<AutomationCompositionDeployAck>
+ implements Listener<AutomationCompositionDeployAck> {
private static final Logger LOGGER = LoggerFactory.getLogger(AutomationCompositionUpdateAckListener.class);
private final SupervisionHandler supervisionHandler;
@@ -46,25 +46,25 @@ public class AutomationCompositionUpdateAckListener extends ScoListener<Automati
* Constructs the object.
*/
public AutomationCompositionUpdateAckListener(SupervisionHandler supervisionHandler) {
- super(AutomationCompositionAck.class);
+ super(AutomationCompositionDeployAck.class);
this.supervisionHandler = supervisionHandler;
}
@Override
public void onTopicEvent(final CommInfrastructure infra, final String topic, final StandardCoderObject sco,
- final AutomationCompositionAck automationCompositionUpdateAckMessage) {
+ final AutomationCompositionDeployAck automationCompositionUpdateAckMessage) {
LOGGER.debug("AutomationCompositionUpdateAck message received from participant - {}",
automationCompositionUpdateAckMessage);
supervisionHandler.handleAutomationCompositionUpdateAckMessage(automationCompositionUpdateAckMessage);
}
@Override
- public ScoListener<AutomationCompositionAck> getScoListener() {
+ public ScoListener<AutomationCompositionDeployAck> getScoListener() {
return this;
}
@Override
public String getType() {
- return ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK.name();
+ return ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK.name();
}
}
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 c6535702b..8ae21ca75 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
@@ -36,8 +36,8 @@ import java.util.UUID;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
-import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
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;
@@ -46,7 +46,7 @@ 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.ParticipantState;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+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.persistence.provider.AcDefinitionProvider;
@@ -59,8 +59,8 @@ class SupervisionHandlerTest {
@Test
void testTriggerAutomationCompositionSupervision() throws AutomationCompositionException {
- var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
- var handler = createSupervisionHandlerForTrigger(automationCompositionUpdatePublisher);
+ var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
+ var handler = createSupervisionHandlerForTrigger(automationCompositionDeployPublisher);
var automationComposition =
InstantiationUtils.getAutomationCompositionFromResource(AC_INSTANTIATION_CREATE_JSON, "Crud");
@@ -68,7 +68,7 @@ class SupervisionHandlerTest {
automationComposition.setState(AutomationCompositionState.UNINITIALISED);
handler.triggerAutomationCompositionSupervision(automationComposition);
- verify(automationCompositionUpdatePublisher).send(automationComposition);
+ verify(automationCompositionDeployPublisher).send(automationComposition);
}
@Test
@@ -101,7 +101,7 @@ class SupervisionHandlerTest {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var handler = new SupervisionHandler(automationCompositionProvider, acDefinitionProvider,
- mock(AutomationCompositionUpdatePublisher.class), automationCompositionStateChangePublisher);
+ mock(AutomationCompositionDeployPublisher.class), automationCompositionStateChangePublisher);
handler.triggerAutomationCompositionSupervision(automationComposition);
@@ -149,7 +149,7 @@ class SupervisionHandlerTest {
void testAcRunningToPassive() throws AutomationCompositionException {
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class),
- mock(AutomationCompositionUpdatePublisher.class), automationCompositionStateChangePublisher,
+ mock(AutomationCompositionDeployPublisher.class), automationCompositionStateChangePublisher,
AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED);
var automationComposition =
@@ -193,7 +193,7 @@ class SupervisionHandlerTest {
void testAcPassiveToRunning() throws AutomationCompositionException {
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var handler = createSupervisionHandler(mock(AutomationCompositionProvider.class),
- mock(AutomationCompositionUpdatePublisher.class), automationCompositionStateChangePublisher,
+ mock(AutomationCompositionDeployPublisher.class), automationCompositionStateChangePublisher,
AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED);
var automationComposition =
@@ -210,10 +210,10 @@ class SupervisionHandlerTest {
void testHandleAutomationCompositionStateChangeAckMessage() {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var handler = createSupervisionHandler(automationCompositionProvider,
- mock(AutomationCompositionUpdatePublisher.class), mock(AutomationCompositionStateChangePublisher.class),
+ mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class),
AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED);
var automationCompositionAckMessage =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATECHANGE_ACK);
automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of());
automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER);
@@ -225,13 +225,13 @@ class SupervisionHandlerTest {
@Test
void testHandleAutomationCompositionUpdateAckMessage() {
var automationCompositionAckMessage =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE_ACK);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY_ACK);
automationCompositionAckMessage.setParticipantId(CommonTestData.getParticipantId());
automationCompositionAckMessage.setAutomationCompositionResultMap(Map.of());
automationCompositionAckMessage.setAutomationCompositionId(IDENTIFIER);
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var handler = createSupervisionHandler(automationCompositionProvider,
- mock(AutomationCompositionUpdatePublisher.class), mock(AutomationCompositionStateChangePublisher.class),
+ mock(AutomationCompositionDeployPublisher.class), mock(AutomationCompositionStateChangePublisher.class),
AutomationCompositionOrderedState.PASSIVE, AutomationCompositionState.UNINITIALISED);
handler.handleAutomationCompositionUpdateAckMessage(automationCompositionAckMessage);
@@ -246,7 +246,7 @@ class SupervisionHandlerTest {
participantUpdateAckMessage.setState(ParticipantState.ON_LINE);
var acDefinitionProvider = mock(AcDefinitionProvider.class);
var handler = new SupervisionHandler(mock(AutomationCompositionProvider.class), acDefinitionProvider,
- mock(AutomationCompositionUpdatePublisher.class),
+ mock(AutomationCompositionDeployPublisher.class),
mock(AutomationCompositionStateChangePublisher.class));
handler.handleParticipantMessage(participantUpdateAckMessage);
@@ -268,7 +268,7 @@ class SupervisionHandlerTest {
.thenReturn(Optional.of(acDefinition));
var handler = new SupervisionHandler(mock(AutomationCompositionProvider.class), acDefinitionProvider,
- mock(AutomationCompositionUpdatePublisher.class),
+ mock(AutomationCompositionDeployPublisher.class),
mock(AutomationCompositionStateChangePublisher.class));
handler.handleParticipantMessage(participantUpdateAckMessage);
@@ -290,7 +290,7 @@ class SupervisionHandlerTest {
.thenReturn(Optional.of(acDefinition));
var handler = new SupervisionHandler(mock(AutomationCompositionProvider.class), acDefinitionProvider,
- mock(AutomationCompositionUpdatePublisher.class),
+ mock(AutomationCompositionDeployPublisher.class),
mock(AutomationCompositionStateChangePublisher.class));
handler.handleParticipantMessage(participantUpdateAckMessage);
@@ -299,7 +299,7 @@ class SupervisionHandlerTest {
}
private SupervisionHandler createSupervisionHandler(AutomationCompositionProvider automationCompositionProvider,
- AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher,
+ AutomationCompositionDeployPublisher automationCompositionDeployPublisher,
AutomationCompositionStateChangePublisher automationCompositionStateChangePublisher,
AutomationCompositionOrderedState orderedState, AutomationCompositionState state) {
var automationComposition =
@@ -320,19 +320,19 @@ class SupervisionHandlerTest {
when(acDefinitionProvider.getAcDefinition(automationComposition.getCompositionId())).thenReturn(acDefinition);
return new SupervisionHandler(automationCompositionProvider, acDefinitionProvider,
- automationCompositionUpdatePublisher, automationCompositionStateChangePublisher);
+ automationCompositionDeployPublisher, automationCompositionStateChangePublisher);
}
private SupervisionHandler createSupervisionHandlerForTrigger() {
return new SupervisionHandler(mock(AutomationCompositionProvider.class), mock(AcDefinitionProvider.class),
- mock(AutomationCompositionUpdatePublisher.class),
+ mock(AutomationCompositionDeployPublisher.class),
mock(AutomationCompositionStateChangePublisher.class));
}
private SupervisionHandler createSupervisionHandlerForTrigger(
- AutomationCompositionUpdatePublisher automationCompositionUpdatePublisher) {
+ AutomationCompositionDeployPublisher automationCompositionDeployPublisher) {
return new SupervisionHandler(mock(AutomationCompositionProvider.class), mock(AcDefinitionProvider.class),
- automationCompositionUpdatePublisher, mock(AutomationCompositionStateChangePublisher.class));
+ automationCompositionDeployPublisher, mock(AutomationCompositionStateChangePublisher.class));
}
}
diff --git a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
index 936555aa3..5917a435c 100644
--- a/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
+++ b/runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionScannerTest.java
@@ -34,8 +34,8 @@ import java.util.UUID;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.onap.policy.clamp.acm.runtime.instantiation.InstantiationUtils;
+import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionDeployPublisher;
import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionStateChangePublisher;
-import org.onap.policy.clamp.acm.runtime.supervision.comm.AutomationCompositionUpdatePublisher;
import org.onap.policy.clamp.acm.runtime.util.CommonTestData;
import org.onap.policy.clamp.models.acm.concepts.AutomationComposition;
import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionDefinition;
@@ -73,7 +73,7 @@ class SupervisionScannerTest {
void testScannerOrderedStateEqualsToState() {
var automationCompositionProvider = mock(AutomationCompositionProvider.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
- var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var participantProvider = mock(ParticipantProvider.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
@@ -82,7 +82,7 @@ class SupervisionScannerTest {
.thenReturn(List.of(automationComposition));
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
acRuntimeParameterGroup);
supervisionScanner.run(false);
@@ -98,13 +98,13 @@ class SupervisionScannerTest {
when(automationCompositionProvider.getAcInstancesByCompositionId(compositionId))
.thenReturn(List.of(automationComposition));
- var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var participantProvider = mock(ParticipantProvider.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
acRuntimeParameterGroup);
supervisionScanner.run(false);
@@ -122,12 +122,12 @@ class SupervisionScannerTest {
var participant = CommonTestData.createParticipant(CommonTestData.getParticipantId());
when(participantProvider.getParticipants()).thenReturn(List.of(participant));
- var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
acRuntimeParameterGroup);
supervisionScanner.handleParticipantStatus(participant.getParticipantId());
@@ -156,17 +156,17 @@ class SupervisionScannerTest {
.thenReturn(List.of(automationComposition));
var participantProvider = mock(ParticipantProvider.class);
- var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var acRuntimeParameterGroup = CommonTestData.geParameterGroup("dbScanner");
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
acRuntimeParameterGroup);
supervisionScanner.run(false);
- verify(automationCompositionUpdatePublisher).send(any(AutomationComposition.class), anyInt());
+ verify(automationCompositionDeployPublisher).send(any(AutomationComposition.class), anyInt());
}
@Test
@@ -185,11 +185,11 @@ class SupervisionScannerTest {
var participantProvider = mock(ParticipantProvider.class);
when(participantProvider.getParticipants()).thenReturn(List.of(participant));
- var automationCompositionUpdatePublisher = mock(AutomationCompositionUpdatePublisher.class);
+ var automationCompositionDeployPublisher = mock(AutomationCompositionDeployPublisher.class);
var automationCompositionStateChangePublisher = mock(AutomationCompositionStateChangePublisher.class);
var supervisionScanner = new SupervisionScanner(automationCompositionProvider, acDefinitionProvider,
- automationCompositionStateChangePublisher, automationCompositionUpdatePublisher, participantProvider,
+ automationCompositionStateChangePublisher, automationCompositionDeployPublisher, participantProvider,
acRuntimeParameterGroup);
supervisionScanner.handleParticipantStatus(participant.getParticipantId());
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 d558deae3..010e8ba38 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
@@ -42,7 +42,7 @@ 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.AutomationCompositionState;
-import org.onap.policy.clamp.models.acm.messages.dmaap.participant.AutomationCompositionAck;
+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.ParticipantDeregisterAck;
import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageType;
@@ -224,7 +224,7 @@ class SupervisionMessagesTest {
@Test
void testAutomationCompositionUpdateAckListener() {
final var automationCompositionAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_UPDATE);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY);
var supervisionHandler = mock(SupervisionHandler.class);
var acUpdateAckListener = new AutomationCompositionUpdateAckListener(supervisionHandler);
acUpdateAckListener.onTopicEvent(INFRA, TOPIC, null, automationCompositionAck);
@@ -234,7 +234,7 @@ class SupervisionMessagesTest {
@Test
void testAutomationCompositionStateChangeAckListener() {
final var automationCompositionAck =
- new AutomationCompositionAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
+ new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE);
var supervisionHandler = mock(SupervisionHandler.class);
var acStateChangeAckListener = new AutomationCompositionStateChangeAckListener(supervisionHandler);
acStateChangeAckListener.onTopicEvent(INFRA, TOPIC, null, automationCompositionAck);