Removing old implementation of participant restart 12/135212/1
authorsaul.gill <saul.gill@est.tech>
Tue, 27 Jun 2023 13:23:26 +0000 (14:23 +0100)
committerLiam Fallon <liam.fallon@est.tech>
Wed, 28 Jun 2023 10:24:25 +0000 (10:24 +0000)
Particpant will be set as offline at deregister
No ac states will be altered at deregister

Issue-ID: POLICY-4742
Change-Id: Ifb297805ed4b97938b7f92855e30f978d474b648
Signed-off-by: saul.gill <saul.gill@est.tech>
(cherry picked from commit 059adbc2c51c79d97aeb19faac81f1128529e4f7)

models/src/main/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProvider.java
models/src/test/java/org/onap/policy/clamp/models/acm/persistence/provider/ParticipantProviderTest.java
runtime-acm/src/main/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandler.java
runtime-acm/src/test/java/org/onap/policy/clamp/acm/runtime/supervision/SupervisionParticipantHandlerTest.java

index 25d72cb..597606e 100644 (file)
@@ -182,19 +182,4 @@ public class ParticipantProvider {
         return ProviderUtils.asEntityList(nodeTemplateStateRepository
             .findByParticipantId(participantId.toString()));
     }
-
-    /**
-     * Reset the Deploy and Lock states of all the ac elements associated with a participant.
-     *
-     * @param participantId the participant id associated with the automation composition elements
-     */
-    public void resetParticipantAcElementState(@NonNull final UUID participantId) {
-        var participantAcElementList = automationCompositionElementRepository
-            .findByParticipantId(participantId.toString());
-        participantAcElementList.forEach(e -> {
-            e.setDeployState(DeployState.UNDEPLOYED);
-            e.setLockState(LockState.NONE);
-        });
-        automationCompositionElementRepository.saveAll(participantAcElementList);
-    }
 }
index 968ad31..22523e2 100644 (file)
@@ -252,7 +252,6 @@ class ParticipantProviderTest {
         assertThrows(NullPointerException.class, () -> participantProvider.deleteParticipant(null));
         assertThrows(NullPointerException.class, () -> participantProvider.getAutomationCompositionElements(null));
         assertThrows(NullPointerException.class, () -> participantProvider.getAcNodeTemplateStates(null));
-        assertThrows(NullPointerException.class, () -> participantProvider.resetParticipantAcElementState(null));
     }
 
     @Test
@@ -287,8 +286,6 @@ class ParticipantProviderTest {
             assertThat(e.getLockState().equals(LockState.LOCKED));
         });
 
-        participantProvider.resetParticipantAcElementState(UUID.randomUUID());
-
         acElementList.get(0).stream().forEach(e -> {
             assertThat(e.getDeployState().equals(DeployState.UNDEPLOYED));
             assertThat(e.getLockState().equals(LockState.NONE));
index 564fa8d..6d43803 100644 (file)
@@ -86,7 +86,6 @@ public class SupervisionParticipantHandler {
             var participant = participantOpt.get();
             participant.setParticipantState(ParticipantState.OFF_LINE);
             participantProvider.updateParticipant(participant);
-            participantProvider.resetParticipantAcElementState(participant.getParticipantId());
         }
 
         participantDeregisterAckPublisher.send(participantDeregisterMsg.getMessageId());
index f00747c..e441bef 100644 (file)
@@ -61,7 +61,6 @@ class SupervisionParticipantHandlerTest {
         handler.handleParticipantMessage(participantDeregisterMessage);
 
         verify(participantProvider).updateParticipant(any());
-        verify(participantProvider).resetParticipantAcElementState(any());
         verify(participantDeregisterAckPublisher).send(participantDeregisterMessage.getMessageId());
     }