From a07ffcd8fc420784b5bb2e34d5b8ea68a710f38b Mon Sep 17 00:00:00 2001 From: Sanjeev Pellikoduku <SPellikoduku@slb.com> Date: Tue, 29 Mar 2022 10:55:51 -0500 Subject: [PATCH] Fixed exception errors --- .../azure/messageBus/ProcessNotification.java | 9 ++------- .../messageBus/ProcessNotificationTest.java | 11 +++-------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java index 5aed003ad..641d9f574 100644 --- a/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java +++ b/provider/notification-azure/src/main/java/org/opengroup/osdu/notification/provider/azure/messageBus/ProcessNotification.java @@ -81,13 +81,8 @@ public class ProcessNotification { requestTelemetry.setId(message.getMessageId()); if (!response.isSuccessCode()) { - telemetryClient.trackRequest(requestTelemetry); - if(message.getDeliveryCount()>8){ - LOGGER.info("Message delivery status is 'Abandon' with notificationId: {}, Count: {}", notificationContent.getNotificationId(), message.getDeliveryCount()); - } else { - LOGGER.error(NOT_ACKNOWLEDGE); - throw new Exception(NOT_ACKNOWLEDGE); - } + telemetryClient.trackRequest(requestTelemetry); + LOGGER.error(NOT_ACKNOWLEDGE); }else{ requestTelemetry.setResponseCode("200"); requestTelemetry.setSuccess(true); diff --git a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/messageBus/ProcessNotificationTest.java b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/messageBus/ProcessNotificationTest.java index 789d76697..3cb298385 100644 --- a/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/messageBus/ProcessNotificationTest.java +++ b/provider/notification-azure/src/test/java/org/opengroup/osdu/notification/messageBus/ProcessNotificationTest.java @@ -93,14 +93,9 @@ public class ProcessNotificationTest { response.setResponseCode(400); when(requestBodyAdapter.extractNotificationContent(message, subscriptionName)).thenReturn(notificationContent); when(notificationHandler.notifySubscriber(notificationId, notificationData, requestAttributes)).thenReturn(response); - try { - processNotification.performNotification(message, subscriptionName); - fail(EXCEPTION_NOT_THROWN); - } catch (Exception e) { - verify(notificationHandler, times(1)).notifySubscriber(notificationId, notificationData, requestAttributes); - verify(requestBodyAdapter, times(1)).extractNotificationContent(message, subscriptionName); - Assert.assertEquals(NOT_ACKNOWLEDGE, e.getMessage()); - } + processNotification.performNotification(message, subscriptionName); + verify(notificationHandler, times(1)).notifySubscriber(notificationId, notificationData, requestAttributes); + verify(requestBodyAdapter, times(1)).extractNotificationContent(message, subscriptionName); } @Test -- GitLab