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)
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);
- }
}
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
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));
var participant = participantOpt.get();
participant.setParticipantState(ParticipantState.OFF_LINE);
participantProvider.updateParticipant(participant);
- participantProvider.resetParticipantAcElementState(participant.getParticipantId());
}
participantDeregisterAckPublisher.send(participantDeregisterMsg.getMessageId());
handler.handleParticipantMessage(participantDeregisterMessage);
verify(participantProvider).updateParticipant(any());
- verify(participantProvider).resetParticipantAcElementState(any());
verify(participantDeregisterAckPublisher).send(participantDeregisterMessage.getMessageId());
}