From 79db93921f60a7858c7a942080efc3cc62679315 Mon Sep 17 00:00:00 2001 From: Md-Humair-KK Date: Fri, 22 Nov 2024 18:23:13 +0530 Subject: [PATCH] changes done Signed-off-by: Md-Humair-KK --- .../io/mosip/signup/controllers/WebSocketController.java | 1 + .../io/mosip/signup/controllers/WebSocketControllerTest.java | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/signup-service/src/main/java/io/mosip/signup/controllers/WebSocketController.java b/signup-service/src/main/java/io/mosip/signup/controllers/WebSocketController.java index 040c7667..492d26d2 100644 --- a/signup-service/src/main/java/io/mosip/signup/controllers/WebSocketController.java +++ b/signup-service/src/main/java/io/mosip/signup/controllers/WebSocketController.java @@ -84,6 +84,7 @@ public void onDisconnected(SessionDisconnectEvent disconnectEvent) { String slotId = username.split(VALUE_SEPARATOR)[1]; log.info("WebSocket Disconnected >>>>>> {}", username); + log.info("WebSocket Disconnected Status>>>>>> {}", disconnectEvent.getCloseStatus()); if(!CloseStatus.NORMAL.equals(disconnectEvent.getCloseStatus())){ IdentityVerificationTransaction transaction = cacheUtilService.getVerifiedSlotTransaction(slotId); diff --git a/signup-service/src/test/java/io/mosip/signup/controllers/WebSocketControllerTest.java b/signup-service/src/test/java/io/mosip/signup/controllers/WebSocketControllerTest.java index c359da22..f2ac8b02 100644 --- a/signup-service/src/test/java/io/mosip/signup/controllers/WebSocketControllerTest.java +++ b/signup-service/src/test/java/io/mosip/signup/controllers/WebSocketControllerTest.java @@ -125,6 +125,9 @@ public String getName() { return "TID"+VALUE_SEPARATOR+"SID"; } }); + IdentityVerificationTransaction transaction = new IdentityVerificationTransaction(); + transaction.setStatus(VerificationStatus.FAILED); + Mockito.when(cacheUtilService.getVerifiedSlotTransaction(Mockito.anyString())).thenReturn(transaction); webSocketController.onDisconnected(sessionDisconnectEvent); Mockito.verify(cacheUtilService, Mockito.times(1)).removeFromSlotConnected(Mockito.anyString()); Mockito.verify(cacheUtilService, Mockito.times(1)).evictSlotAllottedTransaction(Mockito.anyString(),Mockito.anyString()); @@ -133,7 +136,7 @@ public String getName() { } @Test - public void onDisconnectedAbnormalClosedState_test() { + public void onDisconnected_WithAbnormalClosedState_test() { SessionDisconnectEvent sessionDisconnectEvent = Mockito.mock(SessionDisconnectEvent.class); Mockito.when(sessionDisconnectEvent.getUser()).thenReturn(new java.security.Principal() { @Override