From 14d6bfebdd4a8873084e4f1fcbdeb6453fdd4bca Mon Sep 17 00:00:00 2001 From: rameshiyer27 Date: Mon, 22 Jan 2024 18:54:28 +0000 Subject: Remove Dmaap references from CLAMP Issue-ID:POLICY-4881 Signed-off-by: zrrmmua Change-Id: Id305f7538ebc9822f121a868126e188d426c18f6 --- README.md | 8 +- .../acm/messages/dmaap/element/ElementMessage.java | 59 ----------- .../messages/dmaap/element/ElementMessageType.java | 25 ----- .../acm/messages/dmaap/element/ElementStatus.java | 36 ------- .../participant/AutomationCompositionDeploy.java | 66 ------------ .../AutomationCompositionDeployAck.java | 70 ------------- .../AutomationCompositionMigration.java | 43 -------- .../AutomationCompositionStateChange.java | 62 ----------- .../dmaap/participant/ParticipantAckMessage.java | 104 ------------------- .../dmaap/participant/ParticipantDeregister.java | 51 --------- .../participant/ParticipantDeregisterAck.java | 51 --------- .../dmaap/participant/ParticipantMessage.java | 97 ------------------ .../dmaap/participant/ParticipantMessageType.java | 114 --------------------- .../dmaap/participant/ParticipantPrime.java | 63 ------------ .../dmaap/participant/ParticipantPrimeAck.java | 56 ---------- .../dmaap/participant/ParticipantRegister.java | 56 ---------- .../dmaap/participant/ParticipantRegisterAck.java | 51 --------- .../dmaap/participant/ParticipantRestart.java | 65 ------------ .../dmaap/participant/ParticipantStatus.java | 76 -------------- .../dmaap/participant/ParticipantStatusReq.java | 51 --------- .../dmaap/participant/PropertiesUpdate.java | 61 ----------- .../acm/messages/kafka/element/ElementMessage.java | 59 +++++++++++ .../messages/kafka/element/ElementMessageType.java | 25 +++++ .../acm/messages/kafka/element/ElementStatus.java | 36 +++++++ .../participant/AutomationCompositionDeploy.java | 66 ++++++++++++ .../AutomationCompositionDeployAck.java | 70 +++++++++++++ .../AutomationCompositionMigration.java | 43 ++++++++ .../AutomationCompositionStateChange.java | 62 +++++++++++ .../kafka/participant/ParticipantAckMessage.java | 104 +++++++++++++++++++ .../kafka/participant/ParticipantDeregister.java | 51 +++++++++ .../participant/ParticipantDeregisterAck.java | 51 +++++++++ .../kafka/participant/ParticipantMessage.java | 97 ++++++++++++++++++ .../kafka/participant/ParticipantMessageType.java | 114 +++++++++++++++++++++ .../kafka/participant/ParticipantPrime.java | 63 ++++++++++++ .../kafka/participant/ParticipantPrimeAck.java | 56 ++++++++++ .../kafka/participant/ParticipantRegister.java | 56 ++++++++++ .../kafka/participant/ParticipantRegisterAck.java | 51 +++++++++ .../kafka/participant/ParticipantRestart.java | 65 ++++++++++++ .../kafka/participant/ParticipantStatus.java | 76 ++++++++++++++ .../kafka/participant/ParticipantStatusReq.java | 51 +++++++++ .../kafka/participant/PropertiesUpdate.java | 61 +++++++++++ .../acm/messages/rest/element/DmaapConfig.java | 39 ------- .../acm/messages/rest/element/ElementConfig.java | 4 +- .../acm/messages/rest/element/KafkaConfig.java | 39 +++++++ .../AutomationCompositionDeployAckTest.java | 67 ------------ .../AutomationCompositionDeployTest.java | 79 -------------- .../AutomationCompositionStateChangeTest.java | 64 ------------ .../participant/ParticipantAckMessageTest.java | 91 ---------------- .../participant/ParticipantDeregisterAckTest.java | 59 ----------- .../participant/ParticipantDeregisterTest.java | 61 ----------- .../dmaap/participant/ParticipantMessageTest.java | 92 ----------------- .../dmaap/participant/ParticipantMessageUtils.java | 55 ---------- .../dmaap/participant/ParticipantPojosTest.java | 62 ----------- .../dmaap/participant/ParticipantPrimeAckTest.java | 59 ----------- .../dmaap/participant/ParticipantPrimeTest.java | 64 ------------ .../participant/ParticipantRegisterAckTest.java | 59 ----------- .../dmaap/participant/ParticipantRegisterTest.java | 61 ----------- .../dmaap/participant/ParticipantRestartTest.java | 86 ---------------- .../participant/ParticipantStatusReqTest.java | 54 ---------- .../dmaap/participant/ParticipantStatusTest.java | 110 -------------------- .../AutomationCompositionDeployAckTest.java | 67 ++++++++++++ .../AutomationCompositionDeployTest.java | 79 ++++++++++++++ .../AutomationCompositionStateChangeTest.java | 64 ++++++++++++ .../participant/ParticipantAckMessageTest.java | 91 ++++++++++++++++ .../participant/ParticipantDeregisterAckTest.java | 59 +++++++++++ .../participant/ParticipantDeregisterTest.java | 61 +++++++++++ .../kafka/participant/ParticipantMessageTest.java | 92 +++++++++++++++++ .../kafka/participant/ParticipantMessageUtils.java | 55 ++++++++++ .../kafka/participant/ParticipantPojosTest.java | 62 +++++++++++ .../kafka/participant/ParticipantPrimeAckTest.java | 59 +++++++++++ .../kafka/participant/ParticipantPrimeTest.java | 64 ++++++++++++ .../participant/ParticipantRegisterAckTest.java | 59 +++++++++++ .../kafka/participant/ParticipantRegisterTest.java | 61 +++++++++++ .../kafka/participant/ParticipantRestartTest.java | 86 ++++++++++++++++ .../participant/ParticipantStatusReqTest.java | 54 ++++++++++ .../kafka/participant/ParticipantStatusTest.java | 110 ++++++++++++++++++++ .../resources/etc/A1pmsParticipantParameters.yaml | 12 +-- .../main/resources/etc/AcRuntimeParameters.yaml | 12 +-- .../resources/etc/HttpParticipantParameters.yaml | 12 +-- .../resources/etc/KserveParticipantParameters.yaml | 12 +-- .../etc/KubernetesParticipantParameters.yaml | 12 +-- .../resources/etc/PolicyParticipantParameters.yaml | 12 +-- .../etc/SimulatorParticipantParameters.yaml | 12 +-- .../src/main/resources/config/application.yaml | 12 +-- .../src/test/resources/application-test.yaml | 10 +- .../acm/element/handler/MessageActivator.java | 4 +- .../clamp/acm/element/handler/MessageHandler.java | 4 +- .../clamp/acm/element/handler/MessageListener.java | 4 +- .../acm/element/handler/MessagePublisher.java | 4 +- .../main/parameters/ElementTopicParameters.java | 8 +- .../element/service/AbstractElementService.java | 4 +- .../clamp/acm/element/service/BridgeService.java | 6 +- .../clamp/acm/element/service/ElementService.java | 4 +- .../clamp/acm/element/service/SinkService.java | 4 +- .../clamp/acm/element/service/StarterService.java | 4 +- .../acm/element/handler/MessageActivatorTest.java | 4 +- .../acm/element/handler/MessageHandlerTest.java | 4 +- .../acm/element/service/BridgeServiceTest.java | 6 +- .../acm/element/service/ConfigServiceTest.java | 8 +- .../acm/element/service/StarterServiceTest.java | 4 +- .../src/test/resources/config.json | 6 +- .../src/main/resources/config/application.yaml | 12 +-- .../src/test/resources/application-test.yaml | 12 +-- .../src/main/resources/config/application.yaml | 12 +-- .../src/test/resources/application-test.yaml | 12 +-- .../src/main/resources/config/application.yaml | 12 +-- .../kubernetes/parameters/CommonTestData.java | 4 +- .../src/test/resources/application-test.yaml | 12 +-- .../src/main/resources/config/application.yaml | 12 +-- .../policy/endtoend/ParticipantMessagesTest.java | 12 +-- .../policy/main/parameters/CommonTestData.java | 4 +- .../policy/main/utils/TestListenerUtils.java | 4 +- .../src/test/resources/application-test.yaml | 12 +-- .../src/main/resources/config/application.yaml | 12 +-- .../acm/participant/sim/comm/CommonTestData.java | 6 +- .../src/test/resources/application-test.yaml | 12 +-- participant/participant-intermediary/pom.xml | 4 +- .../comm/AcPropertyUpdateListener.java | 6 +- .../comm/AutomationCompositionDeployListener.java | 6 +- .../AutomationCompositionMigrationListener.java | 6 +- .../AutomationCompositionStateChangeListener.java | 6 +- .../intermediary/comm/ParticipantAckListener.java | 4 +- .../comm/ParticipantDeregisterAckListener.java | 6 +- .../intermediary/comm/ParticipantListener.java | 4 +- .../comm/ParticipantMessagePublisher.java | 12 +-- .../comm/ParticipantPrimeListener.java | 6 +- .../comm/ParticipantRegisterAckListener.java | 6 +- .../comm/ParticipantRestartListener.java | 6 +- .../comm/ParticipantStatusReqListener.java | 6 +- .../handler/AutomationCompositionHandler.java | 15 ++- .../handler/AutomationCompositionOutHandler.java | 10 +- .../intermediary/handler/ParticipantHandler.java | 30 +++--- .../intermediary/comm/ParticipantCommTest.java | 18 ++-- .../handler/AutomationCompositionHandlerTest.java | 13 ++- .../AutomationCompositionOutHandlerTest.java | 8 +- .../handler/IntermediaryActivatorTest.java | 4 +- .../handler/ParticipantHandlerTest.java | 32 +++--- .../main/parameters/CommonTestData.java | 6 +- pom.xml | 18 +++- .../runtime/supervision/SupervisionAcHandler.java | 4 +- .../acm/runtime/supervision/SupervisionAspect.java | 4 +- .../runtime/supervision/SupervisionHandler.java | 4 +- .../supervision/SupervisionParticipantHandler.java | 8 +- .../comm/AbstractParticipantAckPublisher.java | 4 +- .../comm/AbstractParticipantPublisher.java | 4 +- .../comm/AcElementPropertiesPublisher.java | 4 +- .../comm/AutomationCompositionDeployPublisher.java | 6 +- .../AutomationCompositionMigrationPublisher.java | 4 +- ...utomationCompositionStateChangeAckListener.java | 6 +- .../AutomationCompositionStateChangePublisher.java | 6 +- .../AutomationCompositionUpdateAckListener.java | 6 +- .../comm/ParticipantDeregisterAckPublisher.java | 6 +- .../comm/ParticipantDeregisterListener.java | 6 +- .../comm/ParticipantPrimeAckListener.java | 6 +- .../comm/ParticipantPrimePublisher.java | 6 +- .../comm/ParticipantRegisterAckPublisher.java | 6 +- .../comm/ParticipantRegisterListener.java | 6 +- .../comm/ParticipantRestartPublisher.java | 4 +- .../comm/ParticipantStatusListener.java | 6 +- .../comm/ParticipantStatusReqPublisher.java | 4 +- runtime-acm/src/main/resources/application.yaml | 12 +-- .../messaging/MessageDispatcherActivatorTest.java | 4 +- .../supervision/SupervisionAcHandlerTest.java | 6 +- .../runtime/supervision/SupervisionAspectTest.java | 4 +- .../supervision/SupervisionHandlerTest.java | 4 +- .../SupervisionParticipantHandlerTest.java | 8 +- .../supervision/comm/SupervisionMessagesTest.java | 18 ++-- .../src/test/resources/application-test.yaml | 12 +-- .../test/resources/parameters/TestParameters.json | 4 +- 169 files changed, 2805 insertions(+), 2793 deletions(-) delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementMessage.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementMessageType.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementStatus.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeploy.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAck.java delete mode 100755 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionMigration.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java delete mode 100755 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrime.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAck.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestart.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/PropertiesUpdate.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessage.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessageType.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementStatus.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeploy.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java create mode 100755 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionMigration.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionStateChange.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessage.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregister.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterAck.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessage.java create mode 100755 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrime.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeAck.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegister.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterAck.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestart.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatus.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusReq.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/PropertiesUpdate.java delete mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/DmaapConfig.java create mode 100644 models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/KafkaConfig.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java delete mode 100755 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAckTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java delete mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAckTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionStateChangeTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterAckTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java create mode 100755 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageUtils.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPojosTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeAckTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterAckTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestartTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusReqTest.java create mode 100644 models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusTest.java diff --git a/README.md b/README.md index 5134d9cbd..1bc8e66cb 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ This file is a JSON that must be specified to Spring config, here is an example: "activateServerTLSAuth":"false", "keyStorePassword":"", "keyStorePath":"", - "messageBusAddresses":["dmaaphost.com"] + "messageBusAddresses":["Kafkahost.com"] }, "sdc-controller2":{ "user": "clamp", @@ -87,15 +87,15 @@ This file is a JSON that must be specified to Spring config, here is an example: "activateServerTLSAuth":"false", "keyStorePassword":"", "keyStorePath":"", - "messageBusAddresses":["dmaaphost.com"] + "messageBusAddresses":["kafkahost.com"] } } } ``` Multiple controllers can be configured so that Clamp is able to receive the notifications from different SDC servers. Each Clamp existing in a cluster should have different consumerGroup and consumerId so that they can each consume the SDC notification. -The environmentName is normally the Dmaap Topic used by SDC. -If the sdcAddress is not specified or not available (connection failure) the messageBusAddresses will be used (Dmaap servers) +The environmentName is normally the Kafka Topic used by SDC. +If the sdcAddress is not specified or not available (connection failure) the messageBusAddresses will be used (Kafka servers) ### Docker-compose diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementMessage.java deleted file mode 100644 index f14b2c4ad..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementMessage.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.messages.dmaap.element; - -import java.time.Instant; -import java.util.UUID; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; - -@Getter -@Setter -@ToString -public class ElementMessage { - - @Setter(AccessLevel.NONE) - private ElementMessageType messageType; - - private ToscaConceptIdentifier elementId; - - private String message; - - private UUID messageId = UUID.randomUUID(); - - /** - * Time-stamp, in milliseconds, when the message was created. Defaults to the - * current time. - */ - private Instant timestamp = Instant.now(); - - /** - * Constructor for instantiating a element message class. - * - * @param messageType the message type - */ - public ElementMessage(ElementMessageType messageType) { - this.messageType = messageType; - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementMessageType.java deleted file mode 100644 index 9cefaf2fb..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementMessageType.java +++ /dev/null @@ -1,25 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.messages.dmaap.element; - -public enum ElementMessageType { - STATUS, ACK_MSG -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementStatus.java deleted file mode 100644 index 844ec8aaa..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/element/ElementStatus.java +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.messages.dmaap.element; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -@Getter -@Setter -@ToString(callSuper = true) -public class ElementStatus extends ElementMessage { - - public ElementStatus() { - super(ElementMessageType.STATUS); - } - -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeploy.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeploy.java deleted file mode 100644 index 77d0d349e..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeploy.java +++ /dev/null @@ -1,66 +0,0 @@ -/*- - * ============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.messages.dmaap.participant; - -import java.util.ArrayList; -import java.util.List; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; -import org.onap.policy.models.base.PfUtils; - -/** - * 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. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class AutomationCompositionDeploy extends ParticipantMessage { - - // A list of ParticipantUpdates instances which carries details of an updated participant. - private List participantUpdatesList = new ArrayList<>(); - private Integer startPhase = 0; - private boolean firstStartPhase = true; - - /** - * Constructor for instantiating class with message name. - * - */ - public AutomationCompositionDeploy() { - super(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public AutomationCompositionDeploy(AutomationCompositionDeploy source) { - super(source); - this.startPhase = source.startPhase; - this.firstStartPhase = source.firstStartPhase; - this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantDeploy::new); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAck.java deleted file mode 100644 index 8d52955cc..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAck.java +++ /dev/null @@ -1,70 +0,0 @@ -/*- - * ============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.messages.dmaap.participant; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.UUID; -import java.util.function.UnaryOperator; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck; -import org.onap.policy.models.base.PfUtils; - -/** - * Class to represent the AUTOMATION_COMPOSITION_ACK message that a participant sends - * to automation composition runtime as an acknowledgement to either AUTOMATION_COMPOSITION_UPDATE - * or AUTOMATION_COMPOSITION_STATE_CHANGE message. - */ -@Getter -@Setter -@ToString(callSuper = true) -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 automationCompositionResultMap = new LinkedHashMap<>(); - - /** - * Constructor for instantiating ParticipantRegisterAck class with message name. - * - */ - public AutomationCompositionDeployAck(final ParticipantMessageType messageType) { - super(messageType); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - 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/AutomationCompositionMigration.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionMigration.java deleted file mode 100755 index dd5e528c5..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionMigration.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ============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.messages.dmaap.participant; - -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; - -@Getter -@Setter -@ToString(callSuper = true) -public class AutomationCompositionMigration extends ParticipantMessage { - - private UUID compositionTargetId; - // A list of updates to AC element properties - private List participantUpdatesList = new ArrayList<>(); - - public AutomationCompositionMigration() { - super(ParticipantMessageType.AUTOMATION_COMPOSITION_MIGRATION); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java deleted file mode 100644 index 2b4c9f996..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChange.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder; -import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder; - -/** - * Class to represent the AUTOMATION_COMPOSITION_STATE_CHANGE message that the automation composition runtime will send - * to participants to change the state of an automation composition they are running. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class AutomationCompositionStateChange extends ParticipantMessage { - private DeployOrder deployOrderedState = DeployOrder.NONE; - private LockOrder lockOrderedState = LockOrder.NONE; - private Integer startPhase; - private Boolean firstStartPhase = true; - - /** - * Constructor for instantiating class with message name. - * - */ - public AutomationCompositionStateChange() { - super(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public AutomationCompositionStateChange(AutomationCompositionStateChange source) { - super(source); - this.deployOrderedState = source.deployOrderedState; - this.lockOrderedState = source.lockOrderedState; - this.startPhase = source.startPhase; - this.firstStartPhase = source.firstStartPhase; - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java deleted file mode 100644 index 56e506470..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessage.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import java.util.UUID; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.clamp.models.acm.concepts.StateChangeResult; - -/** - * Class to represent participant Ack message. - */ -@Getter -@Setter -@ToString -public class ParticipantAckMessage { - - // The responseTo field should match the original request id in the request. - private UUID responseTo; - - // Intermediary result: Success/Fail. - private Boolean result; - - // Indicating participant failure - private StateChangeResult stateChangeResult; - - // Message indicating reason for failure - private String message; - - private ParticipantMessageType messageType; - - private UUID compositionId; - - /** - * Participant ID, or {@code null} for messages from participants. - */ - private UUID participantId; - - /** - * Participant State, or {@code null} for messages from participants. - */ - private ParticipantState state; - - /** - * Constructor for instantiating a participant ack message class. - * - * @param messageType the message type - */ - public ParticipantAckMessage(final ParticipantMessageType messageType) { - this.messageType = messageType; - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantAckMessage(ParticipantAckMessage source) { - this.responseTo = source.responseTo; - this.result = source.result; - this.stateChangeResult = source.stateChangeResult; - this.message = source.message; - this.messageType = source.messageType; - this.participantId = source.participantId; - this.state = source.state; - } - - /** - * Determines if this message applies to this participant type. - * - * @param participantId id of the participant to match against - * @return {@code true} if this message applies to this participant, {@code false} otherwise - */ - public boolean appliesTo(@NonNull final UUID participantId) { - // Broadcast message to all participants - if (this.participantId == null) { - return true; - } - - // Targeted message at this specific participant - return participantId.equals(this.participantId); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java deleted file mode 100644 index 2e7ed8c52..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregister.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 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.messages.dmaap.participant; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -/** - * Class to represent the PARTICIPANT_DEREGISTER message that all the participants send to the ACM runtime. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantDeregister extends ParticipantMessage { - - /** - * Constructor for instantiating ParticipantDeregister class with message name. - * - */ - public ParticipantDeregister() { - super(ParticipantMessageType.PARTICIPANT_DEREGISTER); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantDeregister(final ParticipantDeregister source) { - super(source); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java deleted file mode 100644 index afa987d65..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAck.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 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.messages.dmaap.participant; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -/** - * Class to represent the PARTICIPANT_DEREGISTER_ACK message that the ACM runtime sends to the participant. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantDeregisterAck extends ParticipantAckMessage { - - /** - * Constructor for instantiating ParticipantDeregisterAck class with message name. - * - */ - public ParticipantDeregisterAck() { - super(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantDeregisterAck(final ParticipantDeregisterAck source) { - super(source); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java deleted file mode 100644 index 81eda8ce2..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessage.java +++ /dev/null @@ -1,97 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import java.time.Instant; -import java.util.UUID; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; -import lombok.ToString; - -/** - * Class to represent the base class for various messages that will be exchanged between the ACM runtime and - * participants. - */ -@Getter -@Setter -@ToString -public class ParticipantMessage { - @Setter(AccessLevel.NONE) - private ParticipantMessageType messageType; - - private UUID messageId = UUID.randomUUID(); - - /** - * Time-stamp, in milliseconds, when the message was created. Defaults to the current time. - */ - private Instant timestamp = Instant.now(); - - /** - * Participant ID, or {@code null} for messages from participants. - */ - private UUID participantId; - - /** - * Automation Composition ID, or {@code null} for messages to participants. - */ - private UUID automationCompositionId; - - private UUID compositionId; - - /** - * Constructor for instantiating a participant message class. - * - * @param messageType the message type - */ - public ParticipantMessage(final ParticipantMessageType messageType) { - this.messageType = messageType; - } - - /** - * Constructs the object, making a deep copy. Does not copy the request id or the time stamp. - * - * @param source source from which to copy - */ - public ParticipantMessage(final ParticipantMessage source) { - this.messageType = source.messageType; - this.participantId = source.participantId; - this.automationCompositionId = source.automationCompositionId; - this.compositionId = source.compositionId; - } - - /** - * Determines if this message applies to this participant type. - * - * @param participantId id of the participant to match against - * @return {@code true} if this message applies to this participant, {@code false} otherwise - */ - public boolean appliesTo(@NonNull final UUID participantId) { - // Broadcast message to all participants - if (this.participantId == null) { - return true; - } - - // Targeted message at this specific participant - return participantId.equals(this.participantId); - } -} 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 deleted file mode 100755 index 7609accee..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageType.java +++ /dev/null @@ -1,114 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -/** - * Class to hold the possible values for the type of participant messages. - */ -public enum ParticipantMessageType { - - /** - * Used by participants to report status to the automation composition runtime. - */ - PARTICIPANT_STATUS, - - /** - * Used by the acm runtime to change the state of participants, triggers a - * PARTICIPANT_STATUS message with the result of the PARTICIPANT_STATE_CHANGE operation. - */ - PARTICIPANT_STATE_CHANGE, - - /** - * 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_DEPLOY, - - /** - * Used by acm runtime to change the state of automation compositions in participants, triggers a - * PARTICIPANT_STATUS message with result of AUTOMATION_COMPOSITION_STATE_CHANGE operation. - */ - AUTOMATION_COMPOSITION_STATE_CHANGE, - - /** - * Used by participant to register itself with automation composition runtime. - */ - PARTICIPANT_REGISTER, - - /** - * Used by automation composition runtime to respond to participant registration. - */ - PARTICIPANT_REGISTER_ACK, - - /** - * Used by participant to deregister itself with automation composition runtime. - */ - PARTICIPANT_DEREGISTER, - - /** - * Used by automation composition runtime to respond to participant deregistration. - */ - PARTICIPANT_DEREGISTER_ACK, - - /** - * Used by automation composition runtime to send ToscaServiceTemplate to participant. - */ - PARTICIPANT_PRIME, - - /** - * Used by participant to acknowledge the receipt of PARTICIPANT_UPDATE message - * from automation composition runtime. - */ - PARTICIPANT_PRIME_ACK, - - /** - * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_DEPLOY message - * from automation composition runtime. - */ - AUTOMATION_COMPOSITION_DEPLOY_ACK, - - /** - * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_STATE_CHANGE message - * from automation composition runtime. - */ - AUTOMATION_COMPOSITION_STATECHANGE_ACK, - - /** - * Used by automation composition runtime to request for PARTICIPANT_STATUS message immediately. - */ - PARTICIPANT_STATUS_REQ, - - /** - * Used by automation composition runtime to send the element properties update to participant. - */ - PROPERTIES_UPDATE, - - /** - * Used by runtime to send composition and instances to a restarted participant. - */ - PARTICIPANT_RESTART, - - /** - * Used by acm runtime to migrate from a composition to another one in participants, triggers a - * AUTOMATION_COMPOSITION_MIGRATION message with result of AUTOMATION_COMPOSITION_STATE_CHANGE operation. - */ - AUTOMATION_COMPOSITION_MIGRATION -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrime.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrime.java deleted file mode 100644 index b9d82a5c8..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrime.java +++ /dev/null @@ -1,63 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021-2023 Nordix Foundation. - * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * 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.messages.dmaap.participant; - -import java.util.ArrayList; -import java.util.List; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; -import org.onap.policy.models.base.PfUtils; - -/** - * Class to represent the PARTICIPANT_PRIME message that the ACM runtime sends to a participant. - * the ACM Runtime sends automation composition element Definitions and Common Parameter Values to Participants. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantPrime extends ParticipantMessage { - - // A list of updates to ParticipantDefinitions - private List participantDefinitionUpdates = new ArrayList<>(); - - /** - * Constructor for instantiating ParticipantPrime class with message name. - * - */ - public ParticipantPrime() { - super(ParticipantMessageType.PARTICIPANT_PRIME); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantPrime(ParticipantPrime source) { - super(source); - - this.participantDefinitionUpdates = PfUtils.mapList(source.participantDefinitionUpdates, - ParticipantDefinition::new); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAck.java deleted file mode 100644 index 55424632b..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAck.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021-2023 Nordix Foundation. - * ================================================================================ - * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * 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.messages.dmaap.participant; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.AcTypeState; - -/** - * Class to represent the PARTICIPANT_PRIME_ACK message that registered participant sends to the ACM runtime. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantPrimeAck extends ParticipantAckMessage { - - private AcTypeState compositionState; - - /** - * Constructor for instantiating ParticipantPrimeAck class with message name. - * - */ - public ParticipantPrimeAck() { - super(ParticipantMessageType.PARTICIPANT_PRIME_ACK); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantPrimeAck(final ParticipantPrimeAck source) { - super(source); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java deleted file mode 100644 index d8f9a4caf..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegister.java +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import java.util.List; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType; - -/** - * Class to represent the PARTICIPANT_REGISTER message that all the participants send to the ACM runtime. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantRegister extends ParticipantMessage { - - private List participantSupportedElementType; - - /** - * Constructor for instantiating ParticipantRegister class with message name. - * - */ - public ParticipantRegister() { - super(ParticipantMessageType.PARTICIPANT_REGISTER); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantRegister(final ParticipantRegister source) { - super(source); - this.participantSupportedElementType = source.getParticipantSupportedElementType(); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java deleted file mode 100644 index 60858be4c..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAck.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 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.messages.dmaap.participant; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -/** - * Class to represent the PARTICIPANT_REGISTER_ACK message that the ACM runtime sends to a registered participant. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantRegisterAck extends ParticipantAckMessage { - - /** - * Constructor for instantiating ParticipantRegisterAck class with message name. - * - */ - public ParticipantRegisterAck() { - super(ParticipantMessageType.PARTICIPANT_REGISTER_ACK); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantRegisterAck(final ParticipantRegisterAck source) { - super(source); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestart.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestart.java deleted file mode 100644 index c86a3e460..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestart.java +++ /dev/null @@ -1,65 +0,0 @@ -/*- - * ============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.messages.dmaap.participant; - -import java.util.ArrayList; -import java.util.List; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.AcTypeState; -import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; -import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc; -import org.onap.policy.models.base.PfUtils; - -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantRestart extends ParticipantMessage { - - // composition state - AcTypeState state; - - // element definition - private List participantDefinitionUpdates = new ArrayList<>(); - - // automationcomposition instances list - private List automationcompositionList = new ArrayList<>(); - - /** - * Constructor. - */ - public ParticipantRestart() { - super(ParticipantMessageType.PARTICIPANT_RESTART); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantRestart(ParticipantRestart source) { - super(source); - this.participantDefinitionUpdates = - PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new); - this.automationcompositionList = PfUtils.mapList(source.automationcompositionList, ParticipantRestartAc::new); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java deleted file mode 100644 index 2412bddcb..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatus.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import java.util.ArrayList; -import java.util.List; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -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.models.base.PfUtils; - -/** - * Class to represent the PARTICIPANT_STATUS message that all the participants send to the ACM runtime. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantStatus extends ParticipantMessage { - - // State and health status of the participant - private ParticipantState state; - - // A list of ParticipantDefinition updates, returned in response to ParticipantStatusReq only - private List participantDefinitionUpdates = new ArrayList<>(); - - // List of AutomationCompositionInfo types with AutomationCompositionId and its state - private List automationCompositionInfoList = new ArrayList<>(); - - private List participantSupportedElementType; - /** - * Constructor for instantiating ParticipantStatus class with message name. - * - */ - - public ParticipantStatus() { - super(ParticipantMessageType.PARTICIPANT_STATUS); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantStatus(final ParticipantStatus source) { - super(source); - - this.state = source.state; - this.participantDefinitionUpdates = - PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new); - this.automationCompositionInfoList = - PfUtils.mapList(source.automationCompositionInfoList, AutomationCompositionInfo::new); - this.participantSupportedElementType = source.getParticipantSupportedElementType(); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java deleted file mode 100644 index 82260ee67..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReq.java +++ /dev/null @@ -1,51 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021 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.messages.dmaap.participant; - -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; - -/** - * Class to represent the PARTICIPANT_STATUS_REQ message that the ACM runtime - * sends to participants for an immediate ParticipantStatus from participants. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class ParticipantStatusReq extends ParticipantMessage { - - /** - * Constructor for instantiating a participant status request class. - */ - public ParticipantStatusReq() { - super(ParticipantMessageType.PARTICIPANT_STATUS_REQ); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public ParticipantStatusReq(final ParticipantStatusReq source) { - super(source); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/PropertiesUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/PropertiesUpdate.java deleted file mode 100644 index 43573cc08..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/PropertiesUpdate.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============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.messages.dmaap.participant; - -import java.util.ArrayList; -import java.util.List; -import lombok.Getter; -import lombok.Setter; -import lombok.ToString; -import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; -import org.onap.policy.models.base.PfUtils; - - -/** - * Class to represent the PROPERTIES_UPDATE message that the ACM runtime sends to a participant. - * The ACM Runtime sends updated automation composition element property values to Participants. - */ -@Getter -@Setter -@ToString(callSuper = true) -public class PropertiesUpdate extends ParticipantMessage { - - // A list of updates to AC element properties - private List participantUpdatesList = new ArrayList<>(); - - /** - * Constructor for instantiating properties update class with message name. - * - */ - public PropertiesUpdate() { - super(ParticipantMessageType.PROPERTIES_UPDATE); - } - - /** - * Constructs the object, making a deep copy. - * - * @param source source from which to copy - */ - public PropertiesUpdate(PropertiesUpdate source) { - super(source); - this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantDeploy::new); - } -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessage.java new file mode 100644 index 000000000..13a1b735b --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessage.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2022,2024 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.messages.kafka.element; + +import java.time.Instant; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +@Getter +@Setter +@ToString +public class ElementMessage { + + @Setter(AccessLevel.NONE) + private ElementMessageType messageType; + + private ToscaConceptIdentifier elementId; + + private String message; + + private UUID messageId = UUID.randomUUID(); + + /** + * Time-stamp, in milliseconds, when the message was created. Defaults to the + * current time. + */ + private Instant timestamp = Instant.now(); + + /** + * Constructor for instantiating a element message class. + * + * @param messageType the message type + */ + public ElementMessage(ElementMessageType messageType) { + this.messageType = messageType; + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessageType.java new file mode 100644 index 000000000..cb2eaae95 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementMessageType.java @@ -0,0 +1,25 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2022,2024 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.messages.kafka.element; + +public enum ElementMessageType { + STATUS, ACK_MSG +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementStatus.java new file mode 100644 index 000000000..497dca408 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/element/ElementStatus.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2022,2024 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.messages.kafka.element; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +@Getter +@Setter +@ToString(callSuper = true) +public class ElementStatus extends ElementMessage { + + public ElementStatus() { + super(ElementMessageType.STATUS); + } + +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeploy.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeploy.java new file mode 100644 index 000000000..a657eddde --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeploy.java @@ -0,0 +1,66 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023-2024 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.messages.kafka.participant; + +import java.util.ArrayList; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; +import org.onap.policy.models.base.PfUtils; + +/** + * 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. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class AutomationCompositionDeploy extends ParticipantMessage { + + // A list of ParticipantUpdates instances which carries details of an updated participant. + private List participantUpdatesList = new ArrayList<>(); + private Integer startPhase = 0; + private boolean firstStartPhase = true; + + /** + * Constructor for instantiating class with message name. + * + */ + public AutomationCompositionDeploy() { + super(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public AutomationCompositionDeploy(AutomationCompositionDeploy source) { + super(source); + this.startPhase = source.startPhase; + this.firstStartPhase = source.firstStartPhase; + this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantDeploy::new); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java new file mode 100644 index 000000000..2c7d51fe7 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAck.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023-2024 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.messages.kafka.participant; + +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.UUID; +import java.util.function.UnaryOperator; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck; +import org.onap.policy.models.base.PfUtils; + +/** + * Class to represent the AUTOMATION_COMPOSITION_ACK message that a participant sends + * to automation composition runtime as an acknowledgement to either AUTOMATION_COMPOSITION_UPDATE + * or AUTOMATION_COMPOSITION_STATE_CHANGE message. + */ +@Getter +@Setter +@ToString(callSuper = true) +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 automationCompositionResultMap = new LinkedHashMap<>(); + + /** + * Constructor for instantiating ParticipantRegisterAck class with message name. + * + */ + public AutomationCompositionDeployAck(final ParticipantMessageType messageType) { + super(messageType); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + 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/kafka/participant/AutomationCompositionMigration.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionMigration.java new file mode 100755 index 000000000..fb1f1925c --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionMigration.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023-2024 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.messages.kafka.participant; + +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; + +@Getter +@Setter +@ToString(callSuper = true) +public class AutomationCompositionMigration extends ParticipantMessage { + + private UUID compositionTargetId; + // A list of updates to AC element properties + private List participantUpdatesList = new ArrayList<>(); + + public AutomationCompositionMigration() { + super(ParticipantMessageType.AUTOMATION_COMPOSITION_MIGRATION); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionStateChange.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionStateChange.java new file mode 100644 index 000000000..894c76654 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionStateChange.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021,2023-2024 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.messages.kafka.participant; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder; +import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder; + +/** + * Class to represent the AUTOMATION_COMPOSITION_STATE_CHANGE message that the automation composition runtime will send + * to participants to change the state of an automation composition they are running. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class AutomationCompositionStateChange extends ParticipantMessage { + private DeployOrder deployOrderedState = DeployOrder.NONE; + private LockOrder lockOrderedState = LockOrder.NONE; + private Integer startPhase; + private Boolean firstStartPhase = true; + + /** + * Constructor for instantiating class with message name. + * + */ + public AutomationCompositionStateChange() { + super(ParticipantMessageType.AUTOMATION_COMPOSITION_STATE_CHANGE); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public AutomationCompositionStateChange(AutomationCompositionStateChange source) { + super(source); + this.deployOrderedState = source.deployOrderedState; + this.lockOrderedState = source.lockOrderedState; + this.startPhase = source.startPhase; + this.firstStartPhase = source.firstStartPhase; + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessage.java new file mode 100644 index 000000000..fa3e3d08e --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessage.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import java.util.UUID; +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.ParticipantState; +import org.onap.policy.clamp.models.acm.concepts.StateChangeResult; + +/** + * Class to represent participant Ack message. + */ +@Getter +@Setter +@ToString +public class ParticipantAckMessage { + + // The responseTo field should match the original request id in the request. + private UUID responseTo; + + // Intermediary result: Success/Fail. + private Boolean result; + + // Indicating participant failure + private StateChangeResult stateChangeResult; + + // Message indicating reason for failure + private String message; + + private ParticipantMessageType messageType; + + private UUID compositionId; + + /** + * Participant ID, or {@code null} for messages from participants. + */ + private UUID participantId; + + /** + * Participant State, or {@code null} for messages from participants. + */ + private ParticipantState state; + + /** + * Constructor for instantiating a participant ack message class. + * + * @param messageType the message type + */ + public ParticipantAckMessage(final ParticipantMessageType messageType) { + this.messageType = messageType; + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantAckMessage(ParticipantAckMessage source) { + this.responseTo = source.responseTo; + this.result = source.result; + this.stateChangeResult = source.stateChangeResult; + this.message = source.message; + this.messageType = source.messageType; + this.participantId = source.participantId; + this.state = source.state; + } + + /** + * Determines if this message applies to this participant type. + * + * @param participantId id of the participant to match against + * @return {@code true} if this message applies to this participant, {@code false} otherwise + */ + public boolean appliesTo(@NonNull final UUID participantId) { + // Broadcast message to all participants + if (this.participantId == null) { + return true; + } + + // Targeted message at this specific participant + return participantId.equals(this.participantId); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregister.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregister.java new file mode 100644 index 000000000..c1606d5d9 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregister.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021,2024 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.messages.kafka.participant; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the PARTICIPANT_DEREGISTER message that all the participants send to the ACM runtime. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantDeregister extends ParticipantMessage { + + /** + * Constructor for instantiating ParticipantDeregister class with message name. + * + */ + public ParticipantDeregister() { + super(ParticipantMessageType.PARTICIPANT_DEREGISTER); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantDeregister(final ParticipantDeregister source) { + super(source); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterAck.java new file mode 100644 index 000000000..e4297d9d1 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterAck.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021,2024 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.messages.kafka.participant; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the PARTICIPANT_DEREGISTER_ACK message that the ACM runtime sends to the participant. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantDeregisterAck extends ParticipantAckMessage { + + /** + * Constructor for instantiating ParticipantDeregisterAck class with message name. + * + */ + public ParticipantDeregisterAck() { + super(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantDeregisterAck(final ParticipantDeregisterAck source) { + super(source); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessage.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessage.java new file mode 100644 index 000000000..304db8eb5 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessage.java @@ -0,0 +1,97 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import java.time.Instant; +import java.util.UUID; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the base class for various messages that will be exchanged between the ACM runtime and + * participants. + */ +@Getter +@Setter +@ToString +public class ParticipantMessage { + @Setter(AccessLevel.NONE) + private ParticipantMessageType messageType; + + private UUID messageId = UUID.randomUUID(); + + /** + * Time-stamp, in milliseconds, when the message was created. Defaults to the current time. + */ + private Instant timestamp = Instant.now(); + + /** + * Participant ID, or {@code null} for messages from participants. + */ + private UUID participantId; + + /** + * Automation Composition ID, or {@code null} for messages to participants. + */ + private UUID automationCompositionId; + + private UUID compositionId; + + /** + * Constructor for instantiating a participant message class. + * + * @param messageType the message type + */ + public ParticipantMessage(final ParticipantMessageType messageType) { + this.messageType = messageType; + } + + /** + * Constructs the object, making a deep copy. Does not copy the request id or the time stamp. + * + * @param source source from which to copy + */ + public ParticipantMessage(final ParticipantMessage source) { + this.messageType = source.messageType; + this.participantId = source.participantId; + this.automationCompositionId = source.automationCompositionId; + this.compositionId = source.compositionId; + } + + /** + * Determines if this message applies to this participant type. + * + * @param participantId id of the participant to match against + * @return {@code true} if this message applies to this participant, {@code false} otherwise + */ + public boolean appliesTo(@NonNull final UUID participantId) { + // Broadcast message to all participants + if (this.participantId == null) { + return true; + } + + // Targeted message at this specific participant + return participantId.equals(this.participantId); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java new file mode 100755 index 000000000..29c2c01bd --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageType.java @@ -0,0 +1,114 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +/** + * Class to hold the possible values for the type of participant messages. + */ +public enum ParticipantMessageType { + + /** + * Used by participants to report status to the automation composition runtime. + */ + PARTICIPANT_STATUS, + + /** + * Used by the acm runtime to change the state of participants, triggers a + * PARTICIPANT_STATUS message with the result of the PARTICIPANT_STATE_CHANGE operation. + */ + PARTICIPANT_STATE_CHANGE, + + /** + * 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_DEPLOY, + + /** + * Used by acm runtime to change the state of automation compositions in participants, triggers a + * PARTICIPANT_STATUS message with result of AUTOMATION_COMPOSITION_STATE_CHANGE operation. + */ + AUTOMATION_COMPOSITION_STATE_CHANGE, + + /** + * Used by participant to register itself with automation composition runtime. + */ + PARTICIPANT_REGISTER, + + /** + * Used by automation composition runtime to respond to participant registration. + */ + PARTICIPANT_REGISTER_ACK, + + /** + * Used by participant to deregister itself with automation composition runtime. + */ + PARTICIPANT_DEREGISTER, + + /** + * Used by automation composition runtime to respond to participant deregistration. + */ + PARTICIPANT_DEREGISTER_ACK, + + /** + * Used by automation composition runtime to send ToscaServiceTemplate to participant. + */ + PARTICIPANT_PRIME, + + /** + * Used by participant to acknowledge the receipt of PARTICIPANT_UPDATE message + * from automation composition runtime. + */ + PARTICIPANT_PRIME_ACK, + + /** + * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_DEPLOY message + * from automation composition runtime. + */ + AUTOMATION_COMPOSITION_DEPLOY_ACK, + + /** + * Used by participant to acknowledge the receipt of AUTOMATION_COMPOSITION_STATE_CHANGE message + * from automation composition runtime. + */ + AUTOMATION_COMPOSITION_STATECHANGE_ACK, + + /** + * Used by automation composition runtime to request for PARTICIPANT_STATUS message immediately. + */ + PARTICIPANT_STATUS_REQ, + + /** + * Used by automation composition runtime to send the element properties update to participant. + */ + PROPERTIES_UPDATE, + + /** + * Used by runtime to send composition and instances to a restarted participant. + */ + PARTICIPANT_RESTART, + + /** + * Used by acm runtime to migrate from a composition to another one in participants, triggers a + * AUTOMATION_COMPOSITION_MIGRATION message with result of AUTOMATION_COMPOSITION_STATE_CHANGE operation. + */ + AUTOMATION_COMPOSITION_MIGRATION +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrime.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrime.java new file mode 100644 index 000000000..30fb84f58 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrime.java @@ -0,0 +1,63 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 Nordix Foundation. + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.messages.kafka.participant; + +import java.util.ArrayList; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; +import org.onap.policy.models.base.PfUtils; + +/** + * Class to represent the PARTICIPANT_PRIME message that the ACM runtime sends to a participant. + * the ACM Runtime sends automation composition element Definitions and Common Parameter Values to Participants. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantPrime extends ParticipantMessage { + + // A list of updates to ParticipantDefinitions + private List participantDefinitionUpdates = new ArrayList<>(); + + /** + * Constructor for instantiating ParticipantPrime class with message name. + * + */ + public ParticipantPrime() { + super(ParticipantMessageType.PARTICIPANT_PRIME); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantPrime(ParticipantPrime source) { + super(source); + + this.participantDefinitionUpdates = PfUtils.mapList(source.participantDefinitionUpdates, + ParticipantDefinition::new); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeAck.java new file mode 100644 index 000000000..8fb6d8623 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeAck.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 Nordix Foundation. + * ================================================================================ + * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * 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.messages.kafka.participant; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.AcTypeState; + +/** + * Class to represent the PARTICIPANT_PRIME_ACK message that registered participant sends to the ACM runtime. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantPrimeAck extends ParticipantAckMessage { + + private AcTypeState compositionState; + + /** + * Constructor for instantiating ParticipantPrimeAck class with message name. + * + */ + public ParticipantPrimeAck() { + super(ParticipantMessageType.PARTICIPANT_PRIME_ACK); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantPrimeAck(final ParticipantPrimeAck source) { + super(source); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegister.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegister.java new file mode 100644 index 000000000..e427c4b31 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegister.java @@ -0,0 +1,56 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.ParticipantSupportedElementType; + +/** + * Class to represent the PARTICIPANT_REGISTER message that all the participants send to the ACM runtime. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantRegister extends ParticipantMessage { + + private List participantSupportedElementType; + + /** + * Constructor for instantiating ParticipantRegister class with message name. + * + */ + public ParticipantRegister() { + super(ParticipantMessageType.PARTICIPANT_REGISTER); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantRegister(final ParticipantRegister source) { + super(source); + this.participantSupportedElementType = source.getParticipantSupportedElementType(); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterAck.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterAck.java new file mode 100644 index 000000000..202e854d9 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterAck.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021,2024 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.messages.kafka.participant; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the PARTICIPANT_REGISTER_ACK message that the ACM runtime sends to a registered participant. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantRegisterAck extends ParticipantAckMessage { + + /** + * Constructor for instantiating ParticipantRegisterAck class with message name. + * + */ + public ParticipantRegisterAck() { + super(ParticipantMessageType.PARTICIPANT_REGISTER_ACK); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantRegisterAck(final ParticipantRegisterAck source) { + super(source); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestart.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestart.java new file mode 100644 index 000000000..103be6891 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestart.java @@ -0,0 +1,65 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023,2024 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.messages.kafka.participant; + +import java.util.ArrayList; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.AcTypeState; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; +import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc; +import org.onap.policy.models.base.PfUtils; + +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantRestart extends ParticipantMessage { + + // composition state + AcTypeState state; + + // element definition + private List participantDefinitionUpdates = new ArrayList<>(); + + // automationcomposition instances list + private List automationcompositionList = new ArrayList<>(); + + /** + * Constructor. + */ + public ParticipantRestart() { + super(ParticipantMessageType.PARTICIPANT_RESTART); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantRestart(ParticipantRestart source) { + super(source); + this.participantDefinitionUpdates = + PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new); + this.automationcompositionList = PfUtils.mapList(source.automationcompositionList, ParticipantRestartAc::new); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatus.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatus.java new file mode 100644 index 000000000..2bbd69437 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatus.java @@ -0,0 +1,76 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import java.util.ArrayList; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +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.models.base.PfUtils; + +/** + * Class to represent the PARTICIPANT_STATUS message that all the participants send to the ACM runtime. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantStatus extends ParticipantMessage { + + // State and health status of the participant + private ParticipantState state; + + // A list of ParticipantDefinition updates, returned in response to ParticipantStatusReq only + private List participantDefinitionUpdates = new ArrayList<>(); + + // List of AutomationCompositionInfo types with AutomationCompositionId and its state + private List automationCompositionInfoList = new ArrayList<>(); + + private List participantSupportedElementType; + /** + * Constructor for instantiating ParticipantStatus class with message name. + * + */ + + public ParticipantStatus() { + super(ParticipantMessageType.PARTICIPANT_STATUS); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantStatus(final ParticipantStatus source) { + super(source); + + this.state = source.state; + this.participantDefinitionUpdates = + PfUtils.mapList(source.participantDefinitionUpdates, ParticipantDefinition::new); + this.automationCompositionInfoList = + PfUtils.mapList(source.automationCompositionInfoList, AutomationCompositionInfo::new); + this.participantSupportedElementType = source.getParticipantSupportedElementType(); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusReq.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusReq.java new file mode 100644 index 000000000..fb74ee473 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusReq.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021,2024 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.messages.kafka.participant; + +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * Class to represent the PARTICIPANT_STATUS_REQ message that the ACM runtime + * sends to participants for an immediate ParticipantStatus from participants. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class ParticipantStatusReq extends ParticipantMessage { + + /** + * Constructor for instantiating a participant status request class. + */ + public ParticipantStatusReq() { + super(ParticipantMessageType.PARTICIPANT_STATUS_REQ); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public ParticipantStatusReq(final ParticipantStatusReq source) { + super(source); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/PropertiesUpdate.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/PropertiesUpdate.java new file mode 100644 index 000000000..e76f4aa44 --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/PropertiesUpdate.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023-2024 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.messages.kafka.participant; + +import java.util.ArrayList; +import java.util.List; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDeploy; +import org.onap.policy.models.base.PfUtils; + + +/** + * Class to represent the PROPERTIES_UPDATE message that the ACM runtime sends to a participant. + * The ACM Runtime sends updated automation composition element property values to Participants. + */ +@Getter +@Setter +@ToString(callSuper = true) +public class PropertiesUpdate extends ParticipantMessage { + + // A list of updates to AC element properties + private List participantUpdatesList = new ArrayList<>(); + + /** + * Constructor for instantiating properties update class with message name. + * + */ + public PropertiesUpdate() { + super(ParticipantMessageType.PROPERTIES_UPDATE); + } + + /** + * Constructs the object, making a deep copy. + * + * @param source source from which to copy + */ + public PropertiesUpdate(PropertiesUpdate source) { + super(source); + this.participantUpdatesList = PfUtils.mapList(source.participantUpdatesList, ParticipantDeploy::new); + } +} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/DmaapConfig.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/DmaapConfig.java deleted file mode 100644 index dad92afa9..000000000 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/DmaapConfig.java +++ /dev/null @@ -1,39 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.messages.rest.element; - -import lombok.Data; - -@Data -public class DmaapConfig { - private String server; - - private String listenerTopic; - - private String publisherTopic; - - private Integer fetchTimeout; - - private String topicCommInfrastructure; - - private boolean useHttps; - -} diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementConfig.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementConfig.java index c86f7f225..bb3670cb7 100644 --- a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementConfig.java +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/ElementConfig.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -32,5 +32,5 @@ public class ElementConfig { private Integer timerMs; - private DmaapConfig topicParameterGroup; + private KafkaConfig topicParameterGroup; } diff --git a/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/KafkaConfig.java b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/KafkaConfig.java new file mode 100644 index 000000000..35871fcbf --- /dev/null +++ b/models/src/main/java/org/onap/policy/clamp/models/acm/messages/rest/element/KafkaConfig.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2022,2024 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.messages.rest.element; + +import lombok.Data; + +@Data +public class KafkaConfig { + private String server; + + private String listenerTopic; + + private String publisherTopic; + + private Integer fetchTimeout; + + private String topicCommInfrastructure; + + private boolean useHttps; + +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java deleted file mode 100644 index b74b94932..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployAckTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * ============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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck; -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.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; - -class AutomationCompositionDeployAckTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new AutomationCompositionDeployAck((AutomationCompositionDeployAck) null)) - .isInstanceOf(NullPointerException.class); - - final var orig = new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY); - - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new AutomationCompositionDeployAck(orig).toString())); - - // verify with all values - orig.setAutomationCompositionId(UUID.randomUUID()); - orig.setParticipantId(CommonTestData.getParticipantId()); - var acElementResult = new AcElementDeployAck(DeployState.DEPLOYED, LockState.LOCKED, "", "", Map.of(), - 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 AutomationCompositionDeploy message"); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new AutomationCompositionDeployAck(orig).toString())); - - assertSerializable(orig, AutomationCompositionDeployAck.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java deleted file mode 100644 index 3f64eadd5..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionDeployTest.java +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * ============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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.time.Instant; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy; -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; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty; - -/** - * Test the copy constructor. - */ -class AutomationCompositionDeployTest { - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new AutomationCompositionDeploy(null)).isInstanceOf(NullPointerException.class); - - var orig = new AutomationCompositionDeploy(); - // verify with all values - orig.setAutomationCompositionId(UUID.randomUUID()); - orig.setParticipantId(null); - orig.setMessageId(UUID.randomUUID()); - orig.setTimestamp(Instant.ofEpochMilli(3000)); - - var acElement = new AcElementDeploy(); - acElement.setId(UUID.randomUUID()); - var id = new ToscaConceptIdentifier("id", "1.2.3"); - acElement.setDefinition(id); - - var property = new ToscaProperty(); - property.setName("test"); - property.setType("testType"); - var standardCoder = new StandardCoder(); - var json = standardCoder.encode(property); - var propertiesMap = Map.of("Prop1", (Object) json); - acElement.setProperties(propertiesMap); - - var participantDeploy = new ParticipantDeploy(); - participantDeploy.setParticipantId(CommonTestData.getParticipantId()); - participantDeploy.setAcElementList(List.of(acElement)); - orig.setParticipantUpdatesList(List.of(participantDeploy)); - - var other = new AutomationCompositionDeploy(orig); - - assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString())); - assertSerializable(orig, AutomationCompositionDeploy.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java deleted file mode 100644 index 5585e6896..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/AutomationCompositionStateChangeTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.time.Instant; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder; -import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; - -/** - * Test the copy constructor and other methods. - */ -class AutomationCompositionStateChangeTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new AutomationCompositionStateChange(null)).isInstanceOf(NullPointerException.class); - - AutomationCompositionStateChange orig = new AutomationCompositionStateChange(); - - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new AutomationCompositionStateChange(orig).toString())); - - // verify with all values - orig.setAutomationCompositionId(UUID.randomUUID()); - orig.setParticipantId(CommonTestData.getParticipantId()); - orig.setMessageId(UUID.randomUUID()); - orig.setDeployOrderedState(DeployOrder.DEPLOY); - orig.setLockOrderedState(LockOrder.NONE); - orig.setTimestamp(Instant.ofEpochMilli(3000)); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new AutomationCompositionStateChange(orig).toString())); - - assertSerializable(orig, AutomationCompositionStateChange.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java deleted file mode 100644 index d090d4047..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantAckMessageTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; - -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; - -class ParticipantAckMessageTest { - private ParticipantAckMessage message; - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantAckMessage((ParticipantAckMessage) null)) - .isInstanceOf(NullPointerException.class); - - // verify with null values - message = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); - ParticipantAckMessage newmsg = new ParticipantAckMessage(message); - newmsg.setResponseTo(message.getResponseTo()); - assertEquals(message.toString(), newmsg.toString()); - - // verify with all values - message = makeMessage(); - newmsg = new ParticipantAckMessage(message); - newmsg.setResponseTo(message.getResponseTo()); - assertEquals(message.toString(), newmsg.toString()); - - assertSerializable(message, ParticipantAckMessage.class); - } - - @Test - void testAppliesTo_NullParticipantId() { - message = makeMessage(); - assertThatThrownBy(() -> message.appliesTo(null)).isInstanceOf(NullPointerException.class); - } - - @Test - void testAppliesTo_ParticipantIdMatches() { - message = makeMessage(); - - // ParticipantId matches - assertTrue(message.appliesTo(CommonTestData.getParticipantId())); - assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); - } - - @Test - void testAppliesTo_ParticipantIdNoMatch() { - message = makeMessage(); - - // ParticipantId does not match - assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); - assertTrue(message.appliesTo(CommonTestData.getParticipantId())); - } - - private ParticipantAckMessage makeMessage() { - ParticipantAckMessage msg = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK); - - msg.setParticipantId(CommonTestData.getParticipantId()); - msg.setMessage("Successfull Ack"); - msg.setResult(true); - msg.setResponseTo(UUID.randomUUID()); - - return msg; - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java deleted file mode 100644 index fc8d9a174..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterAckTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; - -class ParticipantDeregisterAckTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantDeregisterAck(null)).isInstanceOf(NullPointerException.class); - - final ParticipantDeregisterAck orig = new ParticipantDeregisterAck(); - - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantDeregisterAck(orig).toString())); - - // verify with all values - ToscaConceptIdentifier id = new ToscaConceptIdentifier(); - id.setName("id"); - id.setVersion("1.2.3"); - orig.setResponseTo(UUID.randomUUID()); - orig.setMessageType(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK); - orig.setResult(true); - orig.setMessage("Successfully processed message"); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantDeregisterAck(orig).toString())); - - assertSerializable(orig, ParticipantDeregisterAck.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java deleted file mode 100644 index 91d3ffacb..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantDeregisterTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.time.Instant; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; - -class ParticipantDeregisterTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantDeregister(null)).isInstanceOf(NullPointerException.class); - - final ParticipantDeregister orig = new ParticipantDeregister(); - - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantDeregister(orig).toString())); - - // verify with all values - ToscaConceptIdentifier id = new ToscaConceptIdentifier(); - id.setName("id"); - id.setVersion("1.2.3"); - orig.setAutomationCompositionId(UUID.randomUUID()); - orig.setParticipantId(CommonTestData.getParticipantId()); - orig.setMessageId(UUID.randomUUID()); - orig.setTimestamp(Instant.ofEpochMilli(3000)); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantDeregister(orig).toString())); - - assertSerializable(orig, ParticipantDeregister.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java deleted file mode 100644 index 59f2d885d..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageTest.java +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertTrue; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; - -import java.time.Instant; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; - -class ParticipantMessageTest { - private ParticipantMessage message; - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantMessage((ParticipantMessage) null)) - .isInstanceOf(NullPointerException.class); - - // verify with null values - message = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); - var newmsg = new ParticipantMessage(message); - newmsg.setMessageId(message.getMessageId()); - newmsg.setTimestamp(message.getTimestamp()); - assertEquals(message.toString(), newmsg.toString()); - - // verify with all values - message = makeMessage(); - newmsg = new ParticipantMessage(message); - newmsg.setMessageId(message.getMessageId()); - newmsg.setTimestamp(message.getTimestamp()); - assertEquals(message.toString(), newmsg.toString()); - - assertSerializable(message, ParticipantMessage.class); - } - - @Test - void testAppliesTo_NullParticipantId() { - message = makeMessage(); - - assertThatThrownBy(() -> message.appliesTo(null)).isInstanceOf(NullPointerException.class); - } - - @Test - void testAppliesTo_ParticipantIdMatches() { - message = makeMessage(); - - // ParticipantId matches - assertTrue(message.appliesTo(CommonTestData.getParticipantId())); - assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); - } - - @Test - void testAppliesTo_ParticipantIdNoMatch() { - message = makeMessage(); - assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); - assertTrue(message.appliesTo(CommonTestData.getParticipantId())); - } - - private ParticipantMessage makeMessage() { - var msg = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); - - msg.setParticipantId(CommonTestData.getParticipantId()); - msg.setMessageId(UUID.randomUUID()); - msg.setTimestamp(Instant.ofEpochMilli(3000)); - - return msg; - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java deleted file mode 100755 index 0f32fe93d..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantMessageUtils.java +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.junit.jupiter.api.Assertions.assertEquals; - -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.common.utils.coder.StandardCoder; - -/** - * Utility class for tests of ParticipantMessage subclasses. - */ -public class ParticipantMessageUtils { - - private ParticipantMessageUtils() { - - } - - public static String removeVariableFields(String text) { - return text.replaceAll("messageId=[^,]*", "messageId=xxx").replaceAll("timestamp=[^,]*", "timestamp=nnn"); - } - - /** - * Check if object is Serializable. - * - * @param object the Object - * @param clazz the class of the Object - * @throws CoderException if object is not Serializable - */ - public static void assertSerializable(Object object, Class clazz) throws CoderException { - var standardCoder = new StandardCoder(); - var json = standardCoder.encode(object); - var other = standardCoder.decode(json, clazz); - - assertEquals(removeVariableFields(object.toString()), removeVariableFields(other.toString())); - } -} 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 deleted file mode 100644 index 4a1a2d9de..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPojosTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import com.openpojo.reflection.impl.PojoClassFactory; -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 org.junit.jupiter.api.Test; -import org.onap.policy.common.utils.test.ToStringTester; - -/** - * Class to perform unit tests of all pojos. - */ -class ParticipantPojosTest { - - @Test - void testPojos() { - 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(AutomationCompositionDeployAck.class)); - pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionDeployAckTest.class)); - - // @formatter:off - final var validator = ValidatorBuilder - .create() - .with(new ToStringTester()) - .with(new SetterMustExistRule()) - .with(new GetterMustExistRule()) - .with(new SetterTester()) - .with(new GetterTester()) - .build(); - - validator.validate(pojoClasses); - // @formatter:on - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAckTest.java deleted file mode 100644 index e4684b8d0..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeAckTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; - -class ParticipantPrimeAckTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantPrimeAck(null)).isInstanceOf(NullPointerException.class); - - final ParticipantPrimeAck orig = new ParticipantPrimeAck(); - - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantPrimeAck(orig).toString())); - - // verify with all values - ToscaConceptIdentifier id = new ToscaConceptIdentifier(); - id.setName("id"); - id.setVersion("1.2.3"); - orig.setResponseTo(UUID.randomUUID()); - orig.setMessageType(ParticipantMessageType.PARTICIPANT_PRIME_ACK); - orig.setResult(true); - orig.setMessage("Successfully processed message"); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantPrimeAck(orig).toString())); - - assertSerializable(orig, ParticipantPrimeAck.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeTest.java deleted file mode 100644 index 859b4224d..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantPrimeTest.java +++ /dev/null @@ -1,64 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.time.Instant; -import java.util.List; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; - -/** - * Test the copy constructor. - */ -class ParticipantPrimeTest { - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantPrime(null)).isInstanceOf(NullPointerException.class); - - var orig = new ParticipantPrime(); - // verify with all values - orig.setAutomationCompositionId(UUID.randomUUID()); - orig.setParticipantId(CommonTestData.getParticipantId()); - orig.setMessageId(UUID.randomUUID()); - orig.setTimestamp(Instant.ofEpochMilli(3000)); - - var participantDefinitionUpdate = new ParticipantDefinition(); - var type = new ToscaConceptIdentifier("id", "1.2.3"); - var acDefinition = CommonTestData.getAcElementDefinition(type); - participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition)); - orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate)); - - var other = new ParticipantPrime(orig); - - assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString())); - - assertSerializable(orig, ParticipantPrime.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java deleted file mode 100644 index e18806e4e..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterAckTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2021-2022 Nordix Foundation. - * ================================================================================ - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; - -class ParticipantRegisterAckTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantRegisterAck(null)).isInstanceOf(NullPointerException.class); - - final ParticipantRegisterAck orig = new ParticipantRegisterAck(); - - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantRegisterAck(orig).toString())); - - // verify with all values - ToscaConceptIdentifier id = new ToscaConceptIdentifier(); - id.setName("id"); - id.setVersion("1.2.3"); - orig.setResponseTo(UUID.randomUUID()); - orig.setMessageType(ParticipantMessageType.PARTICIPANT_REGISTER_ACK); - orig.setResult(true); - orig.setMessage("Successfully processed message"); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantRegisterAck(orig).toString())); - - assertSerializable(orig, ParticipantRegisterAck.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java deleted file mode 100644 index fc73dffd6..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRegisterTest.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.time.Instant; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; - -class ParticipantRegisterTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantRegister(null)).isInstanceOf(NullPointerException.class); - - final ParticipantRegister orig = new ParticipantRegister(); - - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantRegister(orig).toString())); - - // verify with all values - ToscaConceptIdentifier id = new ToscaConceptIdentifier(); - id.setName("id"); - id.setVersion("1.2.3"); - orig.setAutomationCompositionId(UUID.randomUUID()); - orig.setParticipantId(CommonTestData.getParticipantId()); - orig.setMessageId(UUID.randomUUID()); - orig.setTimestamp(Instant.ofEpochMilli(3000)); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantRegister(orig).toString())); - - assertSerializable(orig, ParticipantRegister.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java deleted file mode 100644 index 4a2a958d6..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantRestartTest.java +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * Copyright (C) 2023-2024 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.time.Instant; -import java.util.List; -import java.util.Map; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.concepts.AcElementRestart; -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.ParticipantDefinition; -import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; - -class ParticipantRestartTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantRestart(null)).isInstanceOf(NullPointerException.class); - - final var orig = new ParticipantRestart(); - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantRestart(orig).toString())); - - orig.setMessageId(UUID.randomUUID()); - orig.setCompositionId(UUID.randomUUID()); - orig.setTimestamp(Instant.ofEpochMilli(3000)); - orig.setParticipantId(CommonTestData.getParticipantId()); - - var participantDefinitionUpdate = new ParticipantDefinition(); - var type = new ToscaConceptIdentifier("id", "1.2.3"); - var acDefinition = CommonTestData.getAcElementDefinition(type); - participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition)); - orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate)); - - var acElement = new AcElementRestart(); - acElement.setId(UUID.randomUUID()); - var id = new ToscaConceptIdentifier("id", "1.2.3"); - acElement.setDefinition(id); - acElement.setDeployState(DeployState.DEPLOYED); - acElement.setLockState(LockState.LOCKED); - acElement.setOperationalState("OperationalState"); - acElement.setUseState("UseState"); - acElement.setProperties(Map.of("key", "value")); - acElement.setOutProperties(Map.of("keyOut", "valueOut")); - - var acRestart = new ParticipantRestartAc(); - acRestart.setAcElementList(List.of(acElement)); - acRestart.setAutomationCompositionId(UUID.randomUUID()); - - orig.setAutomationcompositionList(List.of(acRestart)); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantRestart(orig).toString())); - - assertSerializable(orig, ParticipantRestart.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java deleted file mode 100644 index c5687ac19..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusReqTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.time.Instant; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; - -/** - * Test the copy constructor. - */ -class ParticipantStatusReqTest { - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantStatusReq(null)).isInstanceOf(NullPointerException.class); - - var orig = new ParticipantStatusReq(); - // verify with all values - orig.setParticipantId(CommonTestData.getParticipantId()); - orig.setAutomationCompositionId(null); - orig.setMessageId(UUID.randomUUID()); - orig.setTimestamp(Instant.ofEpochMilli(3000)); - - ParticipantStatusReq other = new ParticipantStatusReq(orig); - assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString())); - - assertSerializable(orig, ParticipantStatusReq.class); - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java deleted file mode 100644 index 894d67daf..000000000 --- a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/dmaap/participant/ParticipantStatusTest.java +++ /dev/null @@ -1,110 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * 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. - * 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.messages.dmaap.participant; - -import static org.assertj.core.api.Assertions.assertThatThrownBy; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.assertSerializable; -import static org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantMessageUtils.removeVariableFields; - -import java.time.Instant; -import java.util.List; -import java.util.UUID; -import org.junit.jupiter.api.Test; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementInfo; -import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo; -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.ParticipantDefinition; -import org.onap.policy.clamp.models.acm.concepts.ParticipantState; -import org.onap.policy.clamp.models.acm.utils.CommonTestData; -import org.onap.policy.common.utils.coder.CoderException; -import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; -import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; - -class ParticipantStatusTest { - - @Test - void testCopyConstructor() throws CoderException { - assertThatThrownBy(() -> new ParticipantStatus(null)).isInstanceOf(NullPointerException.class); - - final var orig = new ParticipantStatus(); - - // verify with null values - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantStatus(orig).toString())); - - // verify with all values - var automationCompositionId = UUID.randomUUID(); - var acElementId = UUID.randomUUID(); - orig.setAutomationCompositionId(automationCompositionId); - var participantId = CommonTestData.getParticipantId(); - orig.setParticipantId(participantId); - orig.setMessageId(UUID.randomUUID()); - orig.setState(ParticipantState.ON_LINE); - orig.setTimestamp(Instant.ofEpochMilli(3000)); - - var acInfo = getAutomationCompositionInfo(automationCompositionId, acElementId); - orig.setAutomationCompositionInfoList(List.of(acInfo)); - - var participantDefinitionUpdate = new ParticipantDefinition(); - participantDefinitionUpdate.setParticipantId(participantId); - var acDefinition = getAcElementDefinition(new ToscaConceptIdentifier("id", "1.2.3")); - participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition)); - orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate)); - - assertEquals(removeVariableFields(orig.toString()), - removeVariableFields(new ParticipantStatus(orig).toString())); - - assertSerializable(orig, ParticipantStatus.class); - } - - private AutomationCompositionInfo getAutomationCompositionInfo(UUID id, UUID acElementId) { - var acInfo = new AutomationCompositionInfo(); - acInfo.setDeployState(DeployState.DEPLOYED); - acInfo.setLockState(LockState.LOCKED); - acInfo.setAutomationCompositionId(id); - - var acInfoElement = new AutomationCompositionElementInfo(); - acInfoElement.setAutomationCompositionElementId(acElementId); - acInfoElement.setDeployState(DeployState.DEPLOYED); - acInfoElement.setLockState(LockState.LOCKED); - acInfoElement.setOperationalState("DEFAULT"); - acInfoElement.setUseState("IDLE"); - acInfo.getElements().add(acInfoElement); - return acInfo; - } - - private AutomationCompositionElementDefinition getAcElementDefinition(ToscaConceptIdentifier id) { - var toscaNodeTemplate = new ToscaNodeTemplate(); - toscaNodeTemplate.setName("nodeTemplate"); - toscaNodeTemplate.setDerivedFrom("parentNodeTemplate"); - toscaNodeTemplate.setDescription("Description of nodeTemplate"); - toscaNodeTemplate.setVersion("1.2.3"); - - var acDefinition = new AutomationCompositionElementDefinition(); - acDefinition.setAcElementDefinitionId(id); - acDefinition.setAutomationCompositionElementToscaNodeTemplate(toscaNodeTemplate); - - return acDefinition; - } -} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAckTest.java new file mode 100644 index 000000000..8d0fe5f5e --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployAckTest.java @@ -0,0 +1,67 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.util.Map; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.concepts.AcElementDeployAck; +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.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; + +class AutomationCompositionDeployAckTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new AutomationCompositionDeployAck((AutomationCompositionDeployAck) null)) + .isInstanceOf(NullPointerException.class); + + final var orig = new AutomationCompositionDeployAck(ParticipantMessageType.AUTOMATION_COMPOSITION_DEPLOY); + + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new AutomationCompositionDeployAck(orig).toString())); + + // verify with all values + orig.setAutomationCompositionId(UUID.randomUUID()); + orig.setParticipantId(CommonTestData.getParticipantId()); + var acElementResult = new AcElementDeployAck(DeployState.DEPLOYED, LockState.LOCKED, "", "", Map.of(), + 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 AutomationCompositionDeploy message"); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new AutomationCompositionDeployAck(orig).toString())); + + assertSerializable(orig, AutomationCompositionDeployAck.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployTest.java new file mode 100644 index 000000000..f735c615f --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionDeployTest.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.time.Instant; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.concepts.AcElementDeploy; +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; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaProperty; + +/** + * Test the copy constructor. + */ +class AutomationCompositionDeployTest { + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new AutomationCompositionDeploy(null)).isInstanceOf(NullPointerException.class); + + var orig = new AutomationCompositionDeploy(); + // verify with all values + orig.setAutomationCompositionId(UUID.randomUUID()); + orig.setParticipantId(null); + orig.setMessageId(UUID.randomUUID()); + orig.setTimestamp(Instant.ofEpochMilli(3000)); + + var acElement = new AcElementDeploy(); + acElement.setId(UUID.randomUUID()); + var id = new ToscaConceptIdentifier("id", "1.2.3"); + acElement.setDefinition(id); + + var property = new ToscaProperty(); + property.setName("test"); + property.setType("testType"); + var standardCoder = new StandardCoder(); + var json = standardCoder.encode(property); + var propertiesMap = Map.of("Prop1", (Object) json); + acElement.setProperties(propertiesMap); + + var participantDeploy = new ParticipantDeploy(); + participantDeploy.setParticipantId(CommonTestData.getParticipantId()); + participantDeploy.setAcElementList(List.of(acElement)); + orig.setParticipantUpdatesList(List.of(participantDeploy)); + + var other = new AutomationCompositionDeploy(orig); + + assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString())); + assertSerializable(orig, AutomationCompositionDeploy.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionStateChangeTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionStateChangeTest.java new file mode 100644 index 000000000..c83b54df2 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/AutomationCompositionStateChangeTest.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2022,2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.time.Instant; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.messages.rest.instantiation.DeployOrder; +import org.onap.policy.clamp.models.acm.messages.rest.instantiation.LockOrder; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; + +/** + * Test the copy constructor and other methods. + */ +class AutomationCompositionStateChangeTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new AutomationCompositionStateChange(null)).isInstanceOf(NullPointerException.class); + + AutomationCompositionStateChange orig = new AutomationCompositionStateChange(); + + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new AutomationCompositionStateChange(orig).toString())); + + // verify with all values + orig.setAutomationCompositionId(UUID.randomUUID()); + orig.setParticipantId(CommonTestData.getParticipantId()); + orig.setMessageId(UUID.randomUUID()); + orig.setDeployOrderedState(DeployOrder.DEPLOY); + orig.setLockOrderedState(LockOrder.NONE); + orig.setTimestamp(Instant.ofEpochMilli(3000)); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new AutomationCompositionStateChange(orig).toString())); + + assertSerializable(orig, AutomationCompositionStateChange.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java new file mode 100644 index 000000000..b6af01c44 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantAckMessageTest.java @@ -0,0 +1,91 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; + +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; + +class ParticipantAckMessageTest { + private ParticipantAckMessage message; + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantAckMessage((ParticipantAckMessage) null)) + .isInstanceOf(NullPointerException.class); + + // verify with null values + message = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); + ParticipantAckMessage newmsg = new ParticipantAckMessage(message); + newmsg.setResponseTo(message.getResponseTo()); + assertEquals(message.toString(), newmsg.toString()); + + // verify with all values + message = makeMessage(); + newmsg = new ParticipantAckMessage(message); + newmsg.setResponseTo(message.getResponseTo()); + assertEquals(message.toString(), newmsg.toString()); + + assertSerializable(message, ParticipantAckMessage.class); + } + + @Test + void testAppliesTo_NullParticipantId() { + message = makeMessage(); + assertThatThrownBy(() -> message.appliesTo(null)).isInstanceOf(NullPointerException.class); + } + + @Test + void testAppliesTo_ParticipantIdMatches() { + message = makeMessage(); + + // ParticipantId matches + assertTrue(message.appliesTo(CommonTestData.getParticipantId())); + assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); + } + + @Test + void testAppliesTo_ParticipantIdNoMatch() { + message = makeMessage(); + + // ParticipantId does not match + assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); + assertTrue(message.appliesTo(CommonTestData.getParticipantId())); + } + + private ParticipantAckMessage makeMessage() { + ParticipantAckMessage msg = new ParticipantAckMessage(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK); + + msg.setParticipantId(CommonTestData.getParticipantId()); + msg.setMessage("Successfull Ack"); + msg.setResult(true); + msg.setResponseTo(UUID.randomUUID()); + + return msg; + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterAckTest.java new file mode 100644 index 000000000..d0766134d --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterAckTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2022,2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +class ParticipantDeregisterAckTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantDeregisterAck(null)).isInstanceOf(NullPointerException.class); + + final ParticipantDeregisterAck orig = new ParticipantDeregisterAck(); + + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantDeregisterAck(orig).toString())); + + // verify with all values + ToscaConceptIdentifier id = new ToscaConceptIdentifier(); + id.setName("id"); + id.setVersion("1.2.3"); + orig.setResponseTo(UUID.randomUUID()); + orig.setMessageType(ParticipantMessageType.PARTICIPANT_DEREGISTER_ACK); + orig.setResult(true); + orig.setMessage("Successfully processed message"); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantDeregisterAck(orig).toString())); + + assertSerializable(orig, ParticipantDeregisterAck.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterTest.java new file mode 100644 index 000000000..eb742c79a --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantDeregisterTest.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.time.Instant; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +class ParticipantDeregisterTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantDeregister(null)).isInstanceOf(NullPointerException.class); + + final ParticipantDeregister orig = new ParticipantDeregister(); + + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantDeregister(orig).toString())); + + // verify with all values + ToscaConceptIdentifier id = new ToscaConceptIdentifier(); + id.setName("id"); + id.setVersion("1.2.3"); + orig.setAutomationCompositionId(UUID.randomUUID()); + orig.setParticipantId(CommonTestData.getParticipantId()); + orig.setMessageId(UUID.randomUUID()); + orig.setTimestamp(Instant.ofEpochMilli(3000)); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantDeregister(orig).toString())); + + assertSerializable(orig, ParticipantDeregister.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java new file mode 100644 index 000000000..541d8ef31 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageTest.java @@ -0,0 +1,92 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; + +import java.time.Instant; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; + +class ParticipantMessageTest { + private ParticipantMessage message; + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantMessage((ParticipantMessage) null)) + .isInstanceOf(NullPointerException.class); + + // verify with null values + message = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); + var newmsg = new ParticipantMessage(message); + newmsg.setMessageId(message.getMessageId()); + newmsg.setTimestamp(message.getTimestamp()); + assertEquals(message.toString(), newmsg.toString()); + + // verify with all values + message = makeMessage(); + newmsg = new ParticipantMessage(message); + newmsg.setMessageId(message.getMessageId()); + newmsg.setTimestamp(message.getTimestamp()); + assertEquals(message.toString(), newmsg.toString()); + + assertSerializable(message, ParticipantMessage.class); + } + + @Test + void testAppliesTo_NullParticipantId() { + message = makeMessage(); + + assertThatThrownBy(() -> message.appliesTo(null)).isInstanceOf(NullPointerException.class); + } + + @Test + void testAppliesTo_ParticipantIdMatches() { + message = makeMessage(); + + // ParticipantId matches + assertTrue(message.appliesTo(CommonTestData.getParticipantId())); + assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); + } + + @Test + void testAppliesTo_ParticipantIdNoMatch() { + message = makeMessage(); + assertFalse(message.appliesTo(CommonTestData.getRndParticipantId())); + assertTrue(message.appliesTo(CommonTestData.getParticipantId())); + } + + private ParticipantMessage makeMessage() { + var msg = new ParticipantMessage(ParticipantMessageType.PARTICIPANT_STATE_CHANGE); + + msg.setParticipantId(CommonTestData.getParticipantId()); + msg.setMessageId(UUID.randomUUID()); + msg.setTimestamp(Instant.ofEpochMilli(3000)); + + return msg; + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageUtils.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageUtils.java new file mode 100755 index 000000000..5bb7a67d8 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantMessageUtils.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021,2023-2024 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.messages.kafka.participant; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.common.utils.coder.StandardCoder; + +/** + * Utility class for tests of ParticipantMessage subclasses. + */ +public class ParticipantMessageUtils { + + private ParticipantMessageUtils() { + + } + + public static String removeVariableFields(String text) { + return text.replaceAll("messageId=[^,]*", "messageId=xxx").replaceAll("timestamp=[^,]*", "timestamp=nnn"); + } + + /** + * Check if object is Serializable. + * + * @param object the Object + * @param clazz the class of the Object + * @throws CoderException if object is not Serializable + */ + public static void assertSerializable(Object object, Class clazz) throws CoderException { + var standardCoder = new StandardCoder(); + var json = standardCoder.encode(object); + var other = standardCoder.decode(json, clazz); + + assertEquals(removeVariableFields(object.toString()), removeVariableFields(other.toString())); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPojosTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPojosTest.java new file mode 100644 index 000000000..2683b3fb5 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPojosTest.java @@ -0,0 +1,62 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import com.openpojo.reflection.impl.PojoClassFactory; +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 org.junit.jupiter.api.Test; +import org.onap.policy.common.utils.test.ToStringTester; + +/** + * Class to perform unit tests of all pojos. + */ +class ParticipantPojosTest { + + @Test + void testPojos() { + 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(AutomationCompositionDeployAck.class)); + pojoClasses.remove(PojoClassFactory.getPojoClass(AutomationCompositionDeployAckTest.class)); + + // @formatter:off + final var validator = ValidatorBuilder + .create() + .with(new ToStringTester()) + .with(new SetterMustExistRule()) + .with(new GetterMustExistRule()) + .with(new SetterTester()) + .with(new GetterTester()) + .build(); + + validator.validate(pojoClasses); + // @formatter:on + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeAckTest.java new file mode 100644 index 000000000..1ed8b57ae --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeAckTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +class ParticipantPrimeAckTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantPrimeAck(null)).isInstanceOf(NullPointerException.class); + + final ParticipantPrimeAck orig = new ParticipantPrimeAck(); + + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantPrimeAck(orig).toString())); + + // verify with all values + ToscaConceptIdentifier id = new ToscaConceptIdentifier(); + id.setName("id"); + id.setVersion("1.2.3"); + orig.setResponseTo(UUID.randomUUID()); + orig.setMessageType(ParticipantMessageType.PARTICIPANT_PRIME_ACK); + orig.setResult(true); + orig.setMessage("Successfully processed message"); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantPrimeAck(orig).toString())); + + assertSerializable(orig, ParticipantPrimeAck.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeTest.java new file mode 100644 index 000000000..4b3251361 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantPrimeTest.java @@ -0,0 +1,64 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.time.Instant; +import java.util.List; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.concepts.ParticipantDefinition; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +/** + * Test the copy constructor. + */ +class ParticipantPrimeTest { + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantPrime(null)).isInstanceOf(NullPointerException.class); + + var orig = new ParticipantPrime(); + // verify with all values + orig.setAutomationCompositionId(UUID.randomUUID()); + orig.setParticipantId(CommonTestData.getParticipantId()); + orig.setMessageId(UUID.randomUUID()); + orig.setTimestamp(Instant.ofEpochMilli(3000)); + + var participantDefinitionUpdate = new ParticipantDefinition(); + var type = new ToscaConceptIdentifier("id", "1.2.3"); + var acDefinition = CommonTestData.getAcElementDefinition(type); + participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition)); + orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate)); + + var other = new ParticipantPrime(orig); + + assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString())); + + assertSerializable(orig, ParticipantPrime.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterAckTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterAckTest.java new file mode 100644 index 000000000..49275b8d0 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterAckTest.java @@ -0,0 +1,59 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2022,2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +class ParticipantRegisterAckTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantRegisterAck(null)).isInstanceOf(NullPointerException.class); + + final ParticipantRegisterAck orig = new ParticipantRegisterAck(); + + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantRegisterAck(orig).toString())); + + // verify with all values + ToscaConceptIdentifier id = new ToscaConceptIdentifier(); + id.setName("id"); + id.setVersion("1.2.3"); + orig.setResponseTo(UUID.randomUUID()); + orig.setMessageType(ParticipantMessageType.PARTICIPANT_REGISTER_ACK); + orig.setResult(true); + orig.setMessage("Successfully processed message"); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantRegisterAck(orig).toString())); + + assertSerializable(orig, ParticipantRegisterAck.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterTest.java new file mode 100644 index 000000000..f47ad366f --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRegisterTest.java @@ -0,0 +1,61 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.time.Instant; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +class ParticipantRegisterTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantRegister(null)).isInstanceOf(NullPointerException.class); + + final ParticipantRegister orig = new ParticipantRegister(); + + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantRegister(orig).toString())); + + // verify with all values + ToscaConceptIdentifier id = new ToscaConceptIdentifier(); + id.setName("id"); + id.setVersion("1.2.3"); + orig.setAutomationCompositionId(UUID.randomUUID()); + orig.setParticipantId(CommonTestData.getParticipantId()); + orig.setMessageId(UUID.randomUUID()); + orig.setTimestamp(Instant.ofEpochMilli(3000)); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantRegister(orig).toString())); + + assertSerializable(orig, ParticipantRegister.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestartTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestartTest.java new file mode 100644 index 000000000..3353de600 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantRestartTest.java @@ -0,0 +1,86 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2023-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.time.Instant; +import java.util.List; +import java.util.Map; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.concepts.AcElementRestart; +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.ParticipantDefinition; +import org.onap.policy.clamp.models.acm.concepts.ParticipantRestartAc; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; + +class ParticipantRestartTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantRestart(null)).isInstanceOf(NullPointerException.class); + + final var orig = new ParticipantRestart(); + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantRestart(orig).toString())); + + orig.setMessageId(UUID.randomUUID()); + orig.setCompositionId(UUID.randomUUID()); + orig.setTimestamp(Instant.ofEpochMilli(3000)); + orig.setParticipantId(CommonTestData.getParticipantId()); + + var participantDefinitionUpdate = new ParticipantDefinition(); + var type = new ToscaConceptIdentifier("id", "1.2.3"); + var acDefinition = CommonTestData.getAcElementDefinition(type); + participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition)); + orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate)); + + var acElement = new AcElementRestart(); + acElement.setId(UUID.randomUUID()); + var id = new ToscaConceptIdentifier("id", "1.2.3"); + acElement.setDefinition(id); + acElement.setDeployState(DeployState.DEPLOYED); + acElement.setLockState(LockState.LOCKED); + acElement.setOperationalState("OperationalState"); + acElement.setUseState("UseState"); + acElement.setProperties(Map.of("key", "value")); + acElement.setOutProperties(Map.of("keyOut", "valueOut")); + + var acRestart = new ParticipantRestartAc(); + acRestart.setAcElementList(List.of(acElement)); + acRestart.setAutomationCompositionId(UUID.randomUUID()); + + orig.setAutomationcompositionList(List.of(acRestart)); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantRestart(orig).toString())); + + assertSerializable(orig, ParticipantRestart.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusReqTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusReqTest.java new file mode 100644 index 000000000..e014cd3d1 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusReqTest.java @@ -0,0 +1,54 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.time.Instant; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; + +/** + * Test the copy constructor. + */ +class ParticipantStatusReqTest { + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantStatusReq(null)).isInstanceOf(NullPointerException.class); + + var orig = new ParticipantStatusReq(); + // verify with all values + orig.setParticipantId(CommonTestData.getParticipantId()); + orig.setAutomationCompositionId(null); + orig.setMessageId(UUID.randomUUID()); + orig.setTimestamp(Instant.ofEpochMilli(3000)); + + ParticipantStatusReq other = new ParticipantStatusReq(orig); + assertEquals(removeVariableFields(orig.toString()), removeVariableFields(other.toString())); + + assertSerializable(orig, ParticipantStatusReq.class); + } +} diff --git a/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusTest.java b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusTest.java new file mode 100644 index 000000000..6d1792ef0 --- /dev/null +++ b/models/src/test/java/org/onap/policy/clamp/models/acm/messages/kafka/participant/ParticipantStatusTest.java @@ -0,0 +1,110 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021-2024 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.messages.kafka.participant; + +import static org.assertj.core.api.Assertions.assertThatThrownBy; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.assertSerializable; +import static org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantMessageUtils.removeVariableFields; + +import java.time.Instant; +import java.util.List; +import java.util.UUID; +import org.junit.jupiter.api.Test; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementDefinition; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionElementInfo; +import org.onap.policy.clamp.models.acm.concepts.AutomationCompositionInfo; +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.ParticipantDefinition; +import org.onap.policy.clamp.models.acm.concepts.ParticipantState; +import org.onap.policy.clamp.models.acm.utils.CommonTestData; +import org.onap.policy.common.utils.coder.CoderException; +import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; +import org.onap.policy.models.tosca.authorative.concepts.ToscaNodeTemplate; + +class ParticipantStatusTest { + + @Test + void testCopyConstructor() throws CoderException { + assertThatThrownBy(() -> new ParticipantStatus(null)).isInstanceOf(NullPointerException.class); + + final var orig = new ParticipantStatus(); + + // verify with null values + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantStatus(orig).toString())); + + // verify with all values + var automationCompositionId = UUID.randomUUID(); + var acElementId = UUID.randomUUID(); + orig.setAutomationCompositionId(automationCompositionId); + var participantId = CommonTestData.getParticipantId(); + orig.setParticipantId(participantId); + orig.setMessageId(UUID.randomUUID()); + orig.setState(ParticipantState.ON_LINE); + orig.setTimestamp(Instant.ofEpochMilli(3000)); + + var acInfo = getAutomationCompositionInfo(automationCompositionId, acElementId); + orig.setAutomationCompositionInfoList(List.of(acInfo)); + + var participantDefinitionUpdate = new ParticipantDefinition(); + participantDefinitionUpdate.setParticipantId(participantId); + var acDefinition = getAcElementDefinition(new ToscaConceptIdentifier("id", "1.2.3")); + participantDefinitionUpdate.setAutomationCompositionElementDefinitionList(List.of(acDefinition)); + orig.setParticipantDefinitionUpdates(List.of(participantDefinitionUpdate)); + + assertEquals(removeVariableFields(orig.toString()), + removeVariableFields(new ParticipantStatus(orig).toString())); + + assertSerializable(orig, ParticipantStatus.class); + } + + private AutomationCompositionInfo getAutomationCompositionInfo(UUID id, UUID acElementId) { + var acInfo = new AutomationCompositionInfo(); + acInfo.setDeployState(DeployState.DEPLOYED); + acInfo.setLockState(LockState.LOCKED); + acInfo.setAutomationCompositionId(id); + + var acInfoElement = new AutomationCompositionElementInfo(); + acInfoElement.setAutomationCompositionElementId(acElementId); + acInfoElement.setDeployState(DeployState.DEPLOYED); + acInfoElement.setLockState(LockState.LOCKED); + acInfoElement.setOperationalState("DEFAULT"); + acInfoElement.setUseState("IDLE"); + acInfo.getElements().add(acInfoElement); + return acInfo; + } + + private AutomationCompositionElementDefinition getAcElementDefinition(ToscaConceptIdentifier id) { + var toscaNodeTemplate = new ToscaNodeTemplate(); + toscaNodeTemplate.setName("nodeTemplate"); + toscaNodeTemplate.setDerivedFrom("parentNodeTemplate"); + toscaNodeTemplate.setDescription("Description of nodeTemplate"); + toscaNodeTemplate.setVersion("1.2.3"); + + var acDefinition = new AutomationCompositionElementDefinition(); + acDefinition.setAcElementDefinitionId(id); + acDefinition.setAutomationCompositionElementToscaNodeTemplate(toscaNodeTemplate); + + return acDefinition; + } +} diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml index ddb4b9224..dcb1552c9 100755 --- a/packages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml +++ b/packages/policy-clamp-tarball/src/main/resources/etc/A1pmsParticipantParameters.yaml @@ -28,16 +28,16 @@ participant: participantId: 101c62b3-8918-41b9-a747-d21eb79c6c00 clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.A1PMSAutomationCompositionElement diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml index ea8ae2e74..302fe210a 100755 --- a/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml +++ b/packages/policy-clamp-tarball/src/main/resources/etc/AcRuntimeParameters.yaml @@ -44,18 +44,18 @@ runtime: topicParameterGroup: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 useHttps: true topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP useHttps: true management: diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml index ed5fbbed8..d30140983 100644 --- a/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml +++ b/packages/policy-clamp-tarball/src/main/resources/etc/HttpParticipantParameters.yaml @@ -19,17 +19,17 @@ participant: participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01 clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 useHttps: true topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP useHttps: true participantSupportedElementTypes: - diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/KserveParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/KserveParticipantParameters.yaml index 169217841..6be44c14b 100755 --- a/packages/policy-clamp-tarball/src/main/resources/etc/KserveParticipantParameters.yaml +++ b/packages/policy-clamp-tarball/src/main/resources/etc/KserveParticipantParameters.yaml @@ -26,16 +26,16 @@ participant: participantId: 101c62b3-8918-41b9-a747-d21eb79c6c04 clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP customresourcedefinition: group: serving.kserve.io diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml index 89a42d069..b175873b8 100644 --- a/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml +++ b/packages/policy-clamp-tarball/src/main/resources/etc/KubernetesParticipantParameters.yaml @@ -23,18 +23,18 @@ participant: clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 useHttps: true topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP useHttps: true participantSupportedElementTypes: - diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml index 8b7e5440c..5f7681885 100644 --- a/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml +++ b/packages/policy-clamp-tarball/src/main/resources/etc/PolicyParticipantParameters.yaml @@ -36,18 +36,18 @@ participant: clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 useHttps: true topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP useHttps: true participantSupportedElementTypes: - diff --git a/packages/policy-clamp-tarball/src/main/resources/etc/SimulatorParticipantParameters.yaml b/packages/policy-clamp-tarball/src/main/resources/etc/SimulatorParticipantParameters.yaml index 3959eb789..d1b3cbb3c 100644 --- a/packages/policy-clamp-tarball/src/main/resources/etc/SimulatorParticipantParameters.yaml +++ b/packages/policy-clamp-tarball/src/main/resources/etc/SimulatorParticipantParameters.yaml @@ -19,17 +19,17 @@ participant: participantId: ${participantId:101c62b3-8918-41b9-a747-d21eb79c6c90} clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 useHttps: ${useHttps:true} topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:message-router} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP useHttps: ${useHttps:true} participantSupportedElementTypes: - diff --git a/participant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml index efa2a6e9e..011fafe50 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-a1pms/src/main/resources/config/application.yaml @@ -28,16 +28,16 @@ participant: participantId: 101c62b3-8918-41b9-a747-d21eb79c6c00 clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.A1PMSAutomationCompositionElement diff --git a/participant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml index 4a179d11a..6440b88ca 100755 --- a/participant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml +++ b/participant/participant-impl/participant-impl-a1pms/src/test/resources/application-test.yaml @@ -8,15 +8,15 @@ participant: - topic: POLICY-ACRUNTIME-PARTICIPANT servers: - - localhost - topicCommInfrastructure: dmaap + - kafka:9092 + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topicCommInfrastructure: dmaap + topicCommInfrastructure: NOOP servers: - - localhost - topic: POLICY-ACRUNTIME-PARTICIPANT + - kafka:9092 + topic: policy-acruntime-participant participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.A1PMSAutomationCompositionElement diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java index ef8ceb00f..b3ba26223 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageActivator.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ package org.onap.policy.clamp.acm.element.handler; import java.io.IOException; import java.util.List; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessageType; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessageType; import org.onap.policy.common.endpoints.event.comm.TopicEndpointManager; import org.onap.policy.common.endpoints.event.comm.TopicSource; import org.onap.policy.common.endpoints.listeners.MessageTypeDispatcher; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java index c0ac329e0..bbafa071a 100755 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageHandler.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import lombok.NonNull; import org.onap.policy.clamp.acm.element.main.parameters.AcElement; import org.onap.policy.clamp.acm.element.service.ElementService; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementType; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageListener.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageListener.java index 9fe4f0661..5e3dfa4e1 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageListener.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessageListener.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 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,7 +20,7 @@ package org.onap.policy.clamp.acm.element.handler; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementStatus; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementStatus; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.listeners.ScoListener; import org.onap.policy.common.utils.coder.StandardCoderObject; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java index 09c681d93..bd53cec0f 100755 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/handler/MessagePublisher.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ import io.micrometer.core.annotation.Timed; import jakarta.ws.rs.core.Response; import java.util.List; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.onap.policy.common.endpoints.event.comm.client.TopicSinkClient; import org.slf4j.Logger; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/ElementTopicParameters.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/ElementTopicParameters.java index d42b0d196..ba9fcf327 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/ElementTopicParameters.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/main/parameters/ElementTopicParameters.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,7 +23,7 @@ package org.onap.policy.clamp.acm.element.main.parameters; import java.util.List; import lombok.Data; import lombok.EqualsAndHashCode; -import org.onap.policy.clamp.models.acm.messages.rest.element.DmaapConfig; +import org.onap.policy.clamp.models.acm.messages.rest.element.KafkaConfig; import org.onap.policy.common.endpoints.parameters.TopicParameters; @Data @@ -32,9 +32,9 @@ public class ElementTopicParameters extends TopicParameters { /** * Constructor. - * @param parameters DmaapConfig + * @param parameters KafkaConfig */ - public ElementTopicParameters(DmaapConfig parameters) { + public ElementTopicParameters(KafkaConfig parameters) { super(); this.setTopic(parameters.getListenerTopic()); this.setServers(List.of(parameters.getServer())); diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/AbstractElementService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/AbstractElementService.java index 7c28c4bf9..04449252b 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/AbstractElementService.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/AbstractElementService.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 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,7 +20,7 @@ package org.onap.policy.clamp.acm.element.service; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; public abstract class AbstractElementService implements ElementService { diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/BridgeService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/BridgeService.java index f374f50d1..e21a5cc99 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/BridgeService.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/BridgeService.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,8 +22,8 @@ package org.onap.policy.clamp.acm.element.service; import org.onap.policy.clamp.acm.element.handler.MessagePublisher; import org.onap.policy.clamp.acm.element.main.parameters.AcElement; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementStatus; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementStatus; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementType; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ElementService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ElementService.java index 00b4d8a2c..425def915 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ElementService.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/ElementService.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 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,7 +20,7 @@ package org.onap.policy.clamp.acm.element.service; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementType; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java index c90643f39..3f28f461e 100644 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/SinkService.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 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,7 +20,7 @@ package org.onap.policy.clamp.acm.element.service; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java index 236ba502b..cb1a6ac51 100755 --- a/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java +++ b/participant/participant-impl/participant-impl-acelement/src/main/java/org/onap/policy/clamp/acm/element/service/StarterService.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import java.util.concurrent.ScheduledThreadPoolExecutor; import java.util.concurrent.TimeUnit; import org.onap.policy.clamp.acm.element.handler.MessagePublisher; import org.onap.policy.clamp.acm.element.main.parameters.AcElement; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementStatus; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementStatus; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementType; import org.onap.policy.models.base.PfModelRuntimeException; diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageActivatorTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageActivatorTest.java index 06af3f016..dad2c3134 100644 --- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageActivatorTest.java +++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageActivatorTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,7 +40,7 @@ class MessageActivatorTest { topicParameters.setTopic("topic"); topicParameters.setServers(List.of("localhost")); topicParameters.setFetchTimeout(1000); - topicParameters.setTopicCommInfrastructure("dmaap"); + topicParameters.setTopicCommInfrastructure("NOOP"); var parameters = new TopicParameterGroup(); parameters.setTopicSinks(List.of(topicParameters)); diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageHandlerTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageHandlerTest.java index dd651decc..1b0fe60d9 100644 --- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageHandlerTest.java +++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/handler/MessageHandlerTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.element.main.parameters.AcElement; import org.onap.policy.clamp.acm.element.service.ElementService; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementStatus; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementStatus; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementType; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/BridgeServiceTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/BridgeServiceTest.java index 0180cbba9..386e9e74d 100644 --- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/BridgeServiceTest.java +++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/BridgeServiceTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 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,8 +30,8 @@ import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.element.handler.MessagePublisher; import org.onap.policy.clamp.acm.element.main.parameters.AcElement; import org.onap.policy.clamp.common.acm.exception.AutomationCompositionRuntimeException; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementStatus; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementStatus; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementType; import org.onap.policy.models.tosca.authorative.concepts.ToscaConceptIdentifier; diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/ConfigServiceTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/ConfigServiceTest.java index 156f7d3fc..086676fd4 100644 --- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/ConfigServiceTest.java +++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/ConfigServiceTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 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,8 +28,8 @@ import static org.mockito.Mockito.verify; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.element.handler.MessageActivator; import org.onap.policy.clamp.acm.element.handler.MessageHandler; -import org.onap.policy.clamp.models.acm.messages.rest.element.DmaapConfig; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; +import org.onap.policy.clamp.models.acm.messages.rest.element.KafkaConfig; import org.onap.policy.common.endpoints.parameters.TopicParameterGroup; class ConfigServiceTest { @@ -37,8 +37,8 @@ class ConfigServiceTest { @Test void test() { var elementConfig = new ElementConfig(); - elementConfig.setTopicParameterGroup(new DmaapConfig()); - elementConfig.getTopicParameterGroup().setTopicCommInfrastructure("dmaap"); + elementConfig.setTopicParameterGroup(new KafkaConfig()); + elementConfig.getTopicParameterGroup().setTopicCommInfrastructure("NOOP"); elementConfig.getTopicParameterGroup().setListenerTopic("topic"); elementConfig.getTopicParameterGroup().setPublisherTopic("topic"); elementConfig.getTopicParameterGroup().setServer("localhost"); diff --git a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/StarterServiceTest.java b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/StarterServiceTest.java index 97d808830..71bb4c6b6 100644 --- a/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/StarterServiceTest.java +++ b/participant/participant-impl/participant-impl-acelement/src/test/java/org/onap/policy/clamp/acm/element/service/StarterServiceTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2022 Nordix Foundation. + * Copyright (C) 2022,2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,7 +30,7 @@ import static org.mockito.Mockito.verify; import org.junit.jupiter.api.Test; import org.onap.policy.clamp.acm.element.handler.MessagePublisher; import org.onap.policy.clamp.acm.element.main.parameters.AcElement; -import org.onap.policy.clamp.models.acm.messages.dmaap.element.ElementMessage; +import org.onap.policy.clamp.models.acm.messages.kafka.element.ElementMessage; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementConfig; import org.onap.policy.clamp.models.acm.messages.rest.element.ElementType; import org.onap.policy.models.base.PfModelRuntimeException; diff --git a/participant/participant-impl/participant-impl-acelement/src/test/resources/config.json b/participant/participant-impl/participant-impl-acelement/src/test/resources/config.json index bf4518255..7d80148fd 100644 --- a/participant/participant-impl/participant-impl-acelement/src/test/resources/config.json +++ b/participant/participant-impl/participant-impl-acelement/src/test/resources/config.json @@ -6,9 +6,9 @@ "timerSec":2000, "elementType":"STARTER", "topicParameterGroup":{ - "server":"localhost", - "topic":"POLICY_UPDATE_MSG", + "server":"kafka:9092", + "topic":"policy_update_msg", "fetchTimeout":15000, - "topicCommInfrastructure":"dmaap" + "topicCommInfrastructure":"NOOP" } } \ No newline at end of file diff --git a/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml index 791299545..ed68a4663 100644 --- a/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml @@ -19,16 +19,16 @@ participant: participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01 clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.HttpAutomationCompositionElement diff --git a/participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml index c77c2db23..92912b812 100644 --- a/participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml +++ b/participant/participant-impl/participant-impl-http/src/test/resources/application-test.yaml @@ -6,17 +6,17 @@ participant: clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - localhost - topicCommInfrastructure: dmaap + - kafka:9092 + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topicCommInfrastructure: dmaap + topicCommInfrastructure: NOOP servers: - - localhost - topic: POLICY-ACRUNTIME-PARTICIPANT + - kafka:9092 + topic: policy-acruntime-participant participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.HttpAutomationCompositionElement typeVersion: 1.0.0 diff --git a/participant/participant-impl/participant-impl-kserve/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-kserve/src/main/resources/config/application.yaml index 37fe603e2..aadad18ab 100755 --- a/participant/participant-impl/participant-impl-kserve/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-kserve/src/main/resources/config/application.yaml @@ -27,16 +27,16 @@ participant: participantId: 101c62b3-8918-41b9-a747-d21eb79c6c04 clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.KserveAutomationCompositionElement diff --git a/participant/participant-impl/participant-impl-kserve/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-kserve/src/test/resources/application-test.yaml index 8452ed071..562de49ce 100755 --- a/participant/participant-impl/participant-impl-kserve/src/test/resources/application-test.yaml +++ b/participant/participant-impl/participant-impl-kserve/src/test/resources/application-test.yaml @@ -5,13 +5,13 @@ participant: participantId: 101c62b3-8918-41b9-a747-d21eb79c6c04 clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap \ No newline at end of file + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP \ No newline at end of file diff --git a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml index 45c82b1fe..969d77ab6 100755 --- a/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml @@ -29,17 +29,17 @@ participant: clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:localhost:30227} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:localhost:30227} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java index 8de972bfe..b806cdbfd 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/java/org/onap/policy/clamp/acm/participant/kubernetes/parameters/CommonTestData.java @@ -146,8 +146,8 @@ public class CommonTestData { */ public static TopicParameters getTopicParams() { final TopicParameters topicParams = new TopicParameters(); - topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT"); - topicParams.setTopicCommInfrastructure("dmaap"); + topicParams.setTopic("policy-acruntime-participant"); + topicParams.setTopicCommInfrastructure("NOOP"); topicParams.setServers(List.of("localhost")); return topicParams; } diff --git a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml index 8d27aa93e..79bc5969a 100644 --- a/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml +++ b/participant/participant-impl/participant-impl-kubernetes/src/test/resources/application-test.yaml @@ -12,17 +12,17 @@ participant: clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant fetchTimeout: 15000 servers: - - localhost - topicCommInfrastructure: dmaap + - kafka:9092 + topicCommInfrastructure: NOOP topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - localhost - topicCommInfrastructure: dmaap + - kafka:9092 + topicCommInfrastructure: NOOP name: AutomationComposition Topics participantSupportedElementTypes: - diff --git a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml index 6b0eed116..6a357dd65 100644 --- a/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-policy/src/main/resources/config/application.yaml @@ -36,17 +36,17 @@ participant: clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java index 5ea40927c..a7acbdf4a 100755 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/endtoend/ParticipantMessagesTest.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2023 Nordix Foundation. + * Copyright (C) 2021-2024 Nordix Foundation. * Modifications Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); @@ -36,11 +36,11 @@ import org.onap.policy.clamp.acm.participant.intermediary.comm.ParticipantRegist import org.onap.policy.clamp.acm.participant.intermediary.handler.ParticipantHandler; import org.onap.policy.clamp.acm.participant.policy.main.parameters.CommonTestData; import org.onap.policy.clamp.acm.participant.policy.main.utils.TestListenerUtils; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregister; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantDeregisterAck; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrimeAck; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegister; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantRegisterAck; +import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantDeregister; +import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantDeregisterAck; +import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantPrimeAck; +import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantRegister; +import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantRegisterAck; import org.onap.policy.common.endpoints.event.comm.Topic.CommInfrastructure; import org.onap.policy.common.endpoints.event.comm.TopicSink; import org.springframework.beans.factory.annotation.Autowired; diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java index c99097efa..3b2550db5 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/parameters/CommonTestData.java @@ -151,8 +151,8 @@ public class CommonTestData { */ public static TopicParameters getTopicParams() { final TopicParameters topicParams = new TopicParameters(); - topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT"); - topicParams.setTopicCommInfrastructure("dmaap"); + topicParams.setTopic("policy-acruntime-participant"); + topicParams.setTopicCommInfrastructure("NOOP"); topicParams.setServers(List.of("localhost")); return topicParams; } diff --git a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java index f52806c84..16b2178f9 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java +++ b/participant/participant-impl/participant-impl-policy/src/test/java/org/onap/policy/clamp/acm/participant/policy/main/utils/TestListenerUtils.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2021-2023 Nordix Foundation. + * Copyright (C) 2021-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import java.util.UUID; import lombok.AccessLevel; import lombok.NoArgsConstructor; import org.onap.policy.clamp.acm.participant.policy.main.parameters.CommonTestData; -import org.onap.policy.clamp.models.acm.messages.dmaap.participant.ParticipantPrime; +import org.onap.policy.clamp.models.acm.messages.kafka.participant.ParticipantPrime; import org.onap.policy.common.utils.coder.YamlJsonTranslator; import org.onap.policy.common.utils.resources.ResourceUtils; import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate; diff --git a/participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml index 6c78c07dc..b14cf1f47 100644 --- a/participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml +++ b/participant/participant-impl/participant-impl-policy/src/test/resources/application-test.yaml @@ -6,17 +6,17 @@ participant: clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - localhost - topicCommInfrastructure: dmaap + - kafka:9092 + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topicCommInfrastructure: dmaap + topicCommInfrastructure: NOOP servers: - - localhost - topic: POLICY-ACRUNTIME-PARTICIPANT + - kafka:9092 + topic: policy-acruntime-participant participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.PolicyAutomationCompositionElement diff --git a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml index f2e96f647..f3731d7a8 100644 --- a/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml +++ b/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml @@ -19,16 +19,16 @@ participant: participantId: 101c62b3-8918-41b9-a747-d21eb79c6c90 clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topic: POLICY-ACRUNTIME-PARTICIPANT + - topic: policy-acruntime-participant servers: - - ${topicServer:localhost} - topicCommInfrastructure: dmaap + - ${topicServer:kafka:9092} + topicCommInfrastructure: NOOP participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.SimAutomationCompositionElement diff --git a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/comm/CommonTestData.java b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/comm/CommonTestData.java index ee86b8f88..54f193039 100644 --- a/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/comm/CommonTestData.java +++ b/participant/participant-impl/participant-impl-simulator/src/test/java/org/onap/policy/clamp/acm/participant/sim/comm/CommonTestData.java @@ -1,6 +1,6 @@ /*- * ============LICENSE_START======================================================= - * Copyright (C) 2023 Nordix Foundation. + * Copyright (C) 2023-2024 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -100,8 +100,8 @@ public class CommonTestData { */ private static TopicParameters getTopicParams() { final TopicParameters topicParams = new TopicParameters(); - topicParams.setTopic("POLICY-ACRUNTIME-PARTICIPANT"); - topicParams.setTopicCommInfrastructure("dmaap"); + topicParams.setTopic("policy-acruntime-participant"); + topicParams.setTopicCommInfrastructure("NOOP"); topicParams.setServers(List.of("localhost")); return topicParams; } diff --git a/participant/participant-impl/participant-impl-simulator/src/test/resources/application-test.yaml b/participant/participant-impl/participant-impl-simulator/src/test/resources/application-test.yaml index e83484459..001eced02 100644 --- a/participant/participant-impl/participant-impl-simulator/src/test/resources/application-test.yaml +++ b/participant/participant-impl/participant-impl-simulator/src/test/resources/application-test.yaml @@ -6,17 +6,17 @@ participant: clampAutomationCompositionTopics: topicSources: - - topic: POLICY-ACRUNTIME-PARTICIPANT + topic: policy-acruntime-participant servers: - - localhost - topicCommInfrastructure: dmaap + - kafka:9092 + topicCommInfrastructure: NOOP fetchTimeout: 15000 topicSinks: - - topicCommInfrastructure: dmaap + topicCommInfrastructure: NOOP servers: - - localhost - topic: POLICY-ACRUNTIME-PARTICIPANT + - kafka:9092 + topic: policy-acruntime-participant participantSupportedElementTypes: - typeName: org.onap.policy.clamp.acm.SimAutomationCompositionElement typeVersion: 1.0.0 diff --git a/participant/participant-intermediary/pom.xml b/participant/participant-intermediary/pom.xml index c39c1de69..7d56194dc 100644 --- a/participant/participant-intermediary/pom.xml +++ b/participant/participant-intermediary/pom.xml @@ -1,6 +1,6 @@