From 22a633cd19d236a6e73d849b3198f654ceb0fc48 Mon Sep 17 00:00:00 2001 From: Sirisha_Manchikanti Date: Wed, 21 Jul 2021 16:45:11 +0100 Subject: Rename ParticipantControlLoopUpdate message This commit has no logical changes considered, except renaming ParticipantControlLoopUpdate message to ControlLoopUpdate message. According to following wiki ParticipantControlLoopUpdate message is renamed to ControlLoopUpdate message. https://wiki.onap.org/display/DW/The+CLAMP+Control+Loop+Participant+Protocol Issue-ID: POLICY-3416 Signed-off-by: Sirisha_Manchikanti Change-Id: I73f2b6797393e3352f98db2234ab63b833d7f212 --- .../runtime/supervision/SupervisionHandler.java | 16 +++--- .../comm/ControlLoopUpdatePublisher.java | 61 ++++++++++++++++++++++ .../ParticipantControlLoopUpdatePublisher.java | 61 ---------------------- .../ControlLoopInstantiationProviderTest.java | 4 +- .../supervision/comm/SupervisionMessagesTest.java | 2 +- 5 files changed, 72 insertions(+), 72 deletions(-) create mode 100644 runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java delete mode 100644 runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopUpdatePublisher.java (limited to 'runtime-controlloop/src') diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java index 5e94d293e..baf0b176d 100644 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/SupervisionHandler.java @@ -36,8 +36,8 @@ import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop import org.onap.policy.clamp.controlloop.models.controlloop.concepts.Participant; import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ControlLoopProvider; import org.onap.policy.clamp.controlloop.models.controlloop.persistence.provider.ParticipantProvider; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopStateChange; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregister; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantDeregisterAck; import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantMessageType; @@ -49,8 +49,8 @@ import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.Parti import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider; import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup; import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider; +import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantControlLoopStateChangePublisher; -import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantControlLoopUpdatePublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantDeregisterAckPublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantRegisterAckPublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantStateChangePublisher; @@ -88,7 +88,7 @@ public class SupervisionHandler { private final CommissioningProvider commissioningProvider; // Publishers for participant communication - private final ParticipantControlLoopUpdatePublisher controlLoopUpdatePublisher; + private final ControlLoopUpdatePublisher controlLoopUpdatePublisher; private final ParticipantControlLoopStateChangePublisher controlLoopStateChangePublisher; private final ParticipantRegisterAckPublisher participantRegisterAckPublisher; private final ParticipantDeregisterAckPublisher participantDeregisterAckPublisher; @@ -291,13 +291,13 @@ public class SupervisionHandler { } private void sendControlLoopUpdate(ControlLoop controlLoop) throws PfModelException { - var pclu = new ParticipantControlLoopUpdate(); - pclu.setControlLoopId(controlLoop.getKey().asIdentifier()); - pclu.setControlLoop(controlLoop); + var controlLoopUpdateMsg = new ControlLoopUpdate(); + controlLoopUpdateMsg.setControlLoopId(controlLoop.getKey().asIdentifier()); + controlLoopUpdateMsg.setControlLoop(controlLoop); // TODO: We should look up the correct TOSCA node template here for the control loop // Tiny hack implemented to return the tosca service template entry from the database and be passed onto dmaap - pclu.setControlLoopDefinition(commissioningProvider.getToscaServiceTemplate(null, null)); - controlLoopUpdatePublisher.send(pclu); + controlLoopUpdateMsg.setControlLoopDefinition(commissioningProvider.getToscaServiceTemplate(null, null)); + controlLoopUpdatePublisher.send(controlLoopUpdateMsg); } private void sendControlLoopStateChange(ControlLoop controlLoop) { diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java new file mode 100644 index 000000000..e562343ff --- /dev/null +++ b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ControlLoopUpdatePublisher.java @@ -0,0 +1,61 @@ +/*- + * ============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.controlloop.runtime.supervision.comm; + +import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; +import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ControlLoopUpdate; +import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider; +import org.onap.policy.models.base.PfModelException; +import org.springframework.stereotype.Component; + +/** + * This class is used to send ControlLoopUpdate messages to participants on DMaaP. + */ +@Component +public class ControlLoopUpdatePublisher extends AbstractParticipantPublisher { + + private final CommissioningProvider commissioningProvider; + + /** + * Constructor. + * + * @param commissioningProvider the CommissioningProvider + */ + public ControlLoopUpdatePublisher(CommissioningProvider commissioningProvider) { + this.commissioningProvider = commissioningProvider; + } + + /** + * Send ControlLoopUpdate to Participant. + * + * @param controlLoop the ControlLoop + * @throws PfModelException on errors getting the Control Loop Definition + */ + public void send(ControlLoop controlLoop) throws PfModelException { + var pclu = new ControlLoopUpdate(); + pclu.setControlLoopId(controlLoop.getKey().asIdentifier()); + pclu.setControlLoop(controlLoop); + // TODO: We should look up the correct TOSCA node template here for the control loop + // Tiny hack implemented to return the tosca service template entry from the database and be passed onto dmaap + pclu.setControlLoopDefinition(commissioningProvider.getToscaServiceTemplate(null, null)); + super.send(pclu); + } +} diff --git a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopUpdatePublisher.java b/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopUpdatePublisher.java deleted file mode 100644 index 8d40c5e69..000000000 --- a/runtime-controlloop/src/main/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/ParticipantControlLoopUpdatePublisher.java +++ /dev/null @@ -1,61 +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.controlloop.runtime.supervision.comm; - -import org.onap.policy.clamp.controlloop.models.controlloop.concepts.ControlLoop; -import org.onap.policy.clamp.controlloop.models.messages.dmaap.participant.ParticipantControlLoopUpdate; -import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProvider; -import org.onap.policy.models.base.PfModelException; -import org.springframework.stereotype.Component; - -/** - * This class is used to send ParticipantControlLoopUpdate messages to participants on DMaaP. - */ -@Component -public class ParticipantControlLoopUpdatePublisher extends AbstractParticipantPublisher { - - private final CommissioningProvider commissioningProvider; - - /** - * Constructor. - * - * @param commissioningProvider the CommissioningProvider - */ - public ParticipantControlLoopUpdatePublisher(CommissioningProvider commissioningProvider) { - this.commissioningProvider = commissioningProvider; - } - - /** - * Send ControlLoopUpdate to Participant. - * - * @param controlLoop the ControlLoop - * @throws PfModelException on errors getting the Control Loop Definition - */ - public void send(ControlLoop controlLoop) throws PfModelException { - var pclu = new ParticipantControlLoopUpdate(); - pclu.setControlLoopId(controlLoop.getKey().asIdentifier()); - pclu.setControlLoop(controlLoop); - // TODO: We should look up the correct TOSCA node template here for the control loop - // Tiny hack implemented to return the tosca service template entry from the database and be passed onto dmaap - pclu.setControlLoopDefinition(commissioningProvider.getToscaServiceTemplate(null, null)); - super.send(pclu); - } -} diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java index b474b0cdf..9fd1ea35f 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/instantiation/ControlLoopInstantiationProviderTest.java @@ -43,8 +43,8 @@ import org.onap.policy.clamp.controlloop.runtime.commissioning.CommissioningProv import org.onap.policy.clamp.controlloop.runtime.main.parameters.ClRuntimeParameterGroup; import org.onap.policy.clamp.controlloop.runtime.monitoring.MonitoringProvider; import org.onap.policy.clamp.controlloop.runtime.supervision.SupervisionHandler; +import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ControlLoopUpdatePublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantControlLoopStateChangePublisher; -import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantControlLoopUpdatePublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantDeregisterAckPublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantRegisterAckPublisher; import org.onap.policy.clamp.controlloop.runtime.supervision.comm.ParticipantUpdatePublisher; @@ -113,7 +113,7 @@ class ControlLoopInstantiationProviderTest { var monitoringProvider = new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider); var participantProvider = new ParticipantProvider(controlLoopParameters.getDatabaseProviderParameters()); - var controlLoopUpdatePublisher = Mockito.mock(ParticipantControlLoopUpdatePublisher.class); + var controlLoopUpdatePublisher = Mockito.mock(ControlLoopUpdatePublisher.class); var controlLoopStateChangePublisher = Mockito.mock(ParticipantControlLoopStateChangePublisher.class); var participantRegisterAckPublisher = Mockito.mock(ParticipantRegisterAckPublisher.class); var participantDeregisterAckPublisher = Mockito.mock(ParticipantDeregisterAckPublisher.class); diff --git a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java index 305850cbd..ad6d7ccd6 100644 --- a/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java +++ b/runtime-controlloop/src/test/java/org/onap/policy/clamp/controlloop/runtime/supervision/comm/SupervisionMessagesTest.java @@ -90,7 +90,7 @@ class SupervisionMessagesTest extends CommonRestController { var monitoringProvider = new MonitoringProvider(participantStatisticsProvider, clElementStatisticsProvider, clProvider); var participantProvider = new ParticipantProvider(controlLoopParameters.getDatabaseProviderParameters()); - var controlLoopUpdatePublisher = Mockito.mock(ParticipantControlLoopUpdatePublisher.class); + var controlLoopUpdatePublisher = Mockito.mock(ControlLoopUpdatePublisher.class); var controlLoopStateChangePublisher = Mockito.mock(ParticipantControlLoopStateChangePublisher.class); var participantRegisterAckPublisher = Mockito.mock(ParticipantRegisterAckPublisher.class); var participantDeregisterAckPublisher = Mockito.mock(ParticipantDeregisterAckPublisher.class); -- cgit 1.2.3-korg