Skip to content
Snippets Groups Projects
Commit a07ffcd8 authored by Sanjeev-SLB's avatar Sanjeev-SLB
Browse files

Fixed exception errors

parent a5d3fdf7
No related branches found
No related tags found
3 merge requests!232Update os-core-lib-azure,!231initial commit,!201Fixed exceptions
Pipeline #101375 failed
...@@ -81,13 +81,8 @@ public class ProcessNotification { ...@@ -81,13 +81,8 @@ public class ProcessNotification {
requestTelemetry.setId(message.getMessageId()); requestTelemetry.setId(message.getMessageId());
if (!response.isSuccessCode()) { if (!response.isSuccessCode()) {
telemetryClient.trackRequest(requestTelemetry); telemetryClient.trackRequest(requestTelemetry);
if(message.getDeliveryCount()>8){ LOGGER.error(NOT_ACKNOWLEDGE);
LOGGER.info("Message delivery status is 'Abandon' with notificationId: {}, Count: {}", notificationContent.getNotificationId(), message.getDeliveryCount());
} else {
LOGGER.error(NOT_ACKNOWLEDGE);
throw new Exception(NOT_ACKNOWLEDGE);
}
}else{ }else{
requestTelemetry.setResponseCode("200"); requestTelemetry.setResponseCode("200");
requestTelemetry.setSuccess(true); requestTelemetry.setSuccess(true);
......
...@@ -93,14 +93,9 @@ public class ProcessNotificationTest { ...@@ -93,14 +93,9 @@ public class ProcessNotificationTest {
response.setResponseCode(400); response.setResponseCode(400);
when(requestBodyAdapter.extractNotificationContent(message, subscriptionName)).thenReturn(notificationContent); when(requestBodyAdapter.extractNotificationContent(message, subscriptionName)).thenReturn(notificationContent);
when(notificationHandler.notifySubscriber(notificationId, notificationData, requestAttributes)).thenReturn(response); when(notificationHandler.notifySubscriber(notificationId, notificationData, requestAttributes)).thenReturn(response);
try { processNotification.performNotification(message, subscriptionName);
processNotification.performNotification(message, subscriptionName); verify(notificationHandler, times(1)).notifySubscriber(notificationId, notificationData, requestAttributes);
fail(EXCEPTION_NOT_THROWN); verify(requestBodyAdapter, times(1)).extractNotificationContent(message, subscriptionName);
} catch (Exception e) {
verify(notificationHandler, times(1)).notifySubscriber(notificationId, notificationData, requestAttributes);
verify(requestBodyAdapter, times(1)).extractNotificationContent(message, subscriptionName);
Assert.assertEquals(NOT_ACKNOWLEDGE, e.getMessage());
}
} }
@Test @Test
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment