diff options
Diffstat (limited to 'participant/participant-intermediary/src/test')
2 files changed, 17 insertions, 3 deletions
diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java index e1b0b0891..c45be4e8b 100755 --- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java +++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/AutomationCompositionOutHandlerTest.java @@ -168,14 +168,29 @@ class AutomationCompositionOutHandlerTest { } @Test - void updateCompositionStateTest() { + void updateCompositionStatePrimedTest() { var cacheProvider = mock(CacheProvider.class); when(cacheProvider.getParticipantId()).thenReturn(UUID.randomUUID()); var publisher = mock(ParticipantMessagePublisher.class); var acOutHandler = new AutomationCompositionOutHandler(publisher, cacheProvider); - acOutHandler.updateCompositionState(UUID.randomUUID(), AcTypeState.PRIMED, StateChangeResult.NO_ERROR, + var compositionId = UUID.randomUUID(); + acOutHandler.updateCompositionState(compositionId, AcTypeState.PRIMED, StateChangeResult.NO_ERROR, "Primed"); verify(publisher).sendParticipantPrimeAck(any(ParticipantPrimeAck.class)); + verify(cacheProvider, times(0)).removeElementDefinition(compositionId); + } + + @Test + void updateCompositionStateDeprimingTest() { + var cacheProvider = mock(CacheProvider.class); + when(cacheProvider.getParticipantId()).thenReturn(UUID.randomUUID()); + var publisher = mock(ParticipantMessagePublisher.class); + var acOutHandler = new AutomationCompositionOutHandler(publisher, cacheProvider); + var compositionId = UUID.randomUUID(); + acOutHandler.updateCompositionState(compositionId, AcTypeState.COMMISSIONED, StateChangeResult.NO_ERROR, + "Deprimed"); + verify(publisher).sendParticipantPrimeAck(any(ParticipantPrimeAck.class)); + verify(cacheProvider).removeElementDefinition(compositionId); } @Test diff --git a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java index 4e41d9740..c558e6668 100755 --- a/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java +++ b/participant/participant-intermediary/src/test/java/org/onap/policy/clamp/acm/participant/intermediary/handler/ParticipantHandlerTest.java @@ -208,7 +208,6 @@ class ParticipantHandlerTest { var messageId = UUID.randomUUID(); participantPrime.setMessageId(messageId); participantHandler.handleParticipantPrime(participantPrime); - verify(cacheProvider).removeElementDefinition(compositionId); verify(acHandler).deprime(messageId, compositionId); } |