From 002acafff4686aecbcf0a2c516d3eb9a8e83f36a Mon Sep 17 00:00:00 2001 From: Zeeshaun Date: Wed, 22 Apr 2026 15:01:09 +0000 Subject: [PATCH] Adding --- LCU.API.Internal.CoreSoapApiWrapper/.codex | 0 LCU.API.Internal.Dispatcher/.codex | 0 .../JobFailureService.cs | 2 +- .../JobErrorRecipientRepository.cs | 4 +- .../JobFailureServiceTest.cs | 90 +++++++++++++++++++ LCU.WebApps.Collections.RepoClient/.codex | 0 LCU.WebApps.External.OnlineLoanApp/.codex | 0 .../.codex | 0 LCU.Webapps.Marketing.SPIT/.codex | 0 9 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 LCU.API.Internal.CoreSoapApiWrapper/.codex create mode 100644 LCU.API.Internal.Dispatcher/.codex create mode 100644 LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherTests/ServiceTests/DispatcherOperationServices/JobFailureServiceTest.cs create mode 100644 LCU.WebApps.Collections.RepoClient/.codex create mode 100644 LCU.WebApps.External.OnlineLoanApp/.codex create mode 100644 LCU.WebApps.Indirect.ReserveManagementSystem/.codex create mode 100644 LCU.Webapps.Marketing.SPIT/.codex diff --git a/LCU.API.Internal.CoreSoapApiWrapper/.codex b/LCU.API.Internal.CoreSoapApiWrapper/.codex new file mode 100644 index 0000000..e69de29 diff --git a/LCU.API.Internal.Dispatcher/.codex b/LCU.API.Internal.Dispatcher/.codex new file mode 100644 index 0000000..e69de29 diff --git a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.Dispatcher/Services/DispatcherOperationServices/JobFailureService.cs b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.Dispatcher/Services/DispatcherOperationServices/JobFailureService.cs index 8f66913..8df2c33 100644 --- a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.Dispatcher/Services/DispatcherOperationServices/JobFailureService.cs +++ b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.Dispatcher/Services/DispatcherOperationServices/JobFailureService.cs @@ -72,7 +72,7 @@ namespace LCU.Api.Internal.Dispatcher.Services.DispatcherOperationServices } else { - await _queueSendErroredJobAlertService.QueueSendErroredJobAlert(updatedJob, workItem); + await _queueSendErroredJobAlertService.QueueSendErroredJobAlert(job, workItem); } } catch (ServiceException serviceException) diff --git a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherLib/Repositories/JobErrorRecipientRepository.cs b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherLib/Repositories/JobErrorRecipientRepository.cs index f5c46f6..0c11f5a 100644 --- a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherLib/Repositories/JobErrorRecipientRepository.cs +++ b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherLib/Repositories/JobErrorRecipientRepository.cs @@ -9,11 +9,11 @@ public class JobErrorRecipientRepository : BaseRepository, IJobErrorRecipientRep public void AddList(ICollection jobErrorRecipients) { - _context.JobErrorRecipients.AddRangeAsync(jobErrorRecipients); + _context.JobErrorRecipients.AddRange(jobErrorRecipients); } public void RemoveList(ICollection jobErrorRecipients) { _context.JobErrorRecipients.RemoveRange(jobErrorRecipients); } -} \ No newline at end of file +} diff --git a/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherTests/ServiceTests/DispatcherOperationServices/JobFailureServiceTest.cs b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherTests/ServiceTests/DispatcherOperationServices/JobFailureServiceTest.cs new file mode 100644 index 0000000..2091ab8 --- /dev/null +++ b/LCU.API.Internal.Dispatcher/LCU.Api.Internal.DispatcherTests/ServiceTests/DispatcherOperationServices/JobFailureServiceTest.cs @@ -0,0 +1,90 @@ +using System.Collections.Generic; +using LCU.Api.Internal.Dispatcher.Services; +using LCU.Api.Internal.Dispatcher.Services.DispatcherOperationServices; +using LCU.Api.Internal.Dispatcher.Services.QueueServices; +using LCU.Library.Internal.DispatcherModels.Enums; +using LCU.Library.Internal.DispatcherModels.Models.Requests; + +namespace LCU.Api.Internal.DispatcherTests.ServiceTests.DispatcherOperationServices; + +public class JobFailureServiceTest +{ + private readonly JobFailureService _jobFailureService; + private readonly Mock _mockWorkItemService; + private readonly Mock _mockWorkItemExecutionService; + private readonly Mock _mockJobService; + private readonly Mock _mockExecutionMessageService; + private readonly Mock _mockQueueDetermineOperationService; + private readonly Mock _mockQueueSendErroredJobAlertService; + + public JobFailureServiceTest() + { + _mockWorkItemService = new Mock(); + _mockWorkItemExecutionService = new Mock(); + _mockJobService = new Mock(); + _mockExecutionMessageService = new Mock(); + _mockQueueDetermineOperationService = new Mock(); + _mockQueueSendErroredJobAlertService = new Mock(); + + _jobFailureService = new JobFailureService(_mockWorkItemService.Object, + _mockWorkItemExecutionService.Object, + _mockJobService.Object, + _mockExecutionMessageService.Object, + _mockQueueDetermineOperationService.Object, + _mockQueueSendErroredJobAlertService.Object); + } + + [Fact] + public async Task HandleJobFailureRequest_QueuesErroredJobAlert_WithOriginalJobErrorRecipients() + { + var workItemExecution = new WorkItemExecution + { + WorkItemExecutionId = 10, + WorkItemId = 7 + }; + var workItem = new WorkItem + { + WorkItemId = 7, + CurrentWorkItemExecution = workItemExecution, + CancelJobOnFailure = false, + RequiresJobCancellation = false + }; + var job = new Job + { + JobId = 22, + JobStatus = JobStatus.Processing, + JobErrorRecipients = new List + { + new JobErrorRecipient { Recipient = "ops@landmarkcu.com" } + } + }; + var updatedJob = new Job + { + JobId = 22, + JobStatus = JobStatus.Failed, + JobErrorRecipients = new List() + }; + var request = new JobFailureRequest + { + WorkItemId = 7, + ExecutionMessages = new List() + }; + + _mockWorkItemService.Setup(x => x.GetByIdAsync(request.WorkItemId)).ReturnsAsync(workItem); + _mockWorkItemExecutionService.Setup(x => x.UpdateFailedWorkItemExecution(workItemExecution)).ReturnsAsync(workItemExecution); + _mockJobService.Setup(x => x.GetByWorkItemIdExcludingWorkItemsIncludeErrorRecipientsAsync(request.WorkItemId)).ReturnsAsync(job); + _mockExecutionMessageService.Setup(x => x.SaveExecutionMessages(workItemExecution.WorkItemExecutionId, request.ExecutionMessages)).Returns(Task.CompletedTask); + _mockJobService.Setup(x => x.UpdateAsync(job)).ReturnsAsync(updatedJob); + + await _jobFailureService.HandleJobFailureRequest(request); + + _mockQueueSendErroredJobAlertService.Verify(x => x.QueueSendErroredJobAlert( + It.Is(queuedJob => + queuedJob.JobId == job.JobId && + queuedJob.JobStatus == JobStatus.Failed && + queuedJob.JobErrorRecipients.Count == 1 && + queuedJob.JobErrorRecipients.First().Recipient == "ops@landmarkcu.com"), + workItem), Times.Once); + _mockQueueDetermineOperationService.Verify(x => x.QueueDetermineOperation(It.IsAny(), It.IsAny(), It.IsAny()), Times.Never); + } +} diff --git a/LCU.WebApps.Collections.RepoClient/.codex b/LCU.WebApps.Collections.RepoClient/.codex new file mode 100644 index 0000000..e69de29 diff --git a/LCU.WebApps.External.OnlineLoanApp/.codex b/LCU.WebApps.External.OnlineLoanApp/.codex new file mode 100644 index 0000000..e69de29 diff --git a/LCU.WebApps.Indirect.ReserveManagementSystem/.codex b/LCU.WebApps.Indirect.ReserveManagementSystem/.codex new file mode 100644 index 0000000..e69de29 diff --git a/LCU.Webapps.Marketing.SPIT/.codex b/LCU.Webapps.Marketing.SPIT/.codex new file mode 100644 index 0000000..e69de29