Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions FileProcessor.BusinessLogic/FileProcessor.BusinessLogic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EstateManagement.Database" Version="2023.12.2-build66" />
<PackageReference Include="EstateManagement.Database" Version="2024.3.5-build77" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.7" />
<PackageReference Include="EstateManagement.Client" Version="2023.12.2-build66" />
<PackageReference Include="SecurityService.Client" Version="2023.12.1" />
<PackageReference Include="Shared" Version="2023.12.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2023.12.2" />
<PackageReference Include="EstateManagement.Client" Version="2024.3.5-build77" />
<PackageReference Include="SecurityService.Client" Version="2023.12.2-build58" />
<PackageReference Include="Shared" Version="2024.3.3" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2024.3.3" />
<PackageReference Include="MediatR" Version="12.0.1" />
<PackageReference Include="Shared.EventStore" Version="2023.12.2" />
<PackageReference Include="Shared.EventStore" Version="2024.3.3" />
<PackageReference Include="System.IO.Abstractions" Version="19.2.29" />
<PackageReference Include="TransactionProcessor.Client" Version="2023.12.3-build79" />
<PackageReference Include="TransactionProcessor.Client" Version="2024.3.3-build95" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.7" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,7 @@ public interface IFileProcessorDomainService

Task ProcessUploadedFile(ProcessUploadedFileRequest request,
CancellationToken cancellationToken);

//Task ProcessSafaricomTopup(SafaricomTopupRequest request,
// CancellationToken cancellationToken);

//Task ProcessVoucher(VoucherRequest request, CancellationToken cancellationToken);


Task ProcessTransactionForFileLine(ProcessTransactionForFileLineRequest request,
CancellationToken cancellationToken);
}
Expand Down
2 changes: 1 addition & 1 deletion FileProcessor.Client/FileProcessor.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ClientProxyBase" Version="2023.12.2" />
<PackageReference Include="ClientProxyBase" Version="2024.3.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Shared.DomainDrivenDesign" Version="2023.12.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2024.3.3" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.53.0" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2023.12.2" />
<PackageReference Include="Shared.EventStore" Version="2023.12.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2024.3.3" />
<PackageReference Include="Shared.EventStore" Version="2024.3.3" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Shared.DomainDrivenDesign" Version="2023.12.2" />
<PackageReference Include="Shared.DomainDrivenDesign" Version="2024.3.3" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<ItemGroup>
<PackageReference Include="Grpc.Net.Client" Version="2.53.0" />
<PackageReference Include="Shared.EventStore" Version="2023.12.2" />
<PackageReference Include="Shared.EventStore" Version="2024.3.3" />
</ItemGroup>

<ItemGroup>
Expand Down
12 changes: 12 additions & 0 deletions FileProcessor.IntegrationTesting.Helpers/Class1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,16 @@ public Guid GetFileId(String originalFileName)
return this.FileImportLogFiles.Single(o => o.OriginalFileName == originalFileName).FileId;
}
}

public static class SubscriptionsHelper
{
public static List<(String streamName, String groupName, Int32 maxRetries)> GetSubscriptions()
{
List<(String streamName, String groupName, Int32 maxRetries)> subscriptions = new(){
("$ce-FileImportLogAggregate", "File Processor", 0),
("$ce-FileAggregate", "File Processor", 0)
};
return subscriptions;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EstateManagement.IntegrationTesting.Helpers" Version="2023.12.2-build66" />
<PackageReference Include="Shared.IntegrationTesting" Version="2023.12.2" />
<PackageReference Include="EstateManagement.IntegrationTesting.Helpers" Version="2024.3.5-build77" />
<PackageReference Include="Shared.IntegrationTesting" Version="2024.3.3" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions FileProcessor.IntegrationTesting.Helpers/FileProcessorSteps.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ await this.FileProcessorClient.UploadFile(accessToken,

public async Task WhenIGetTheImportLogsBetweenAndTheFollowingDataIsReturned(String accessToken, String startDateString, String endDateString, String estateName, List<EstateDetails1> estateDetailsList, List<(DateTime, Int32)> expectedImportLogs)
{
DateTime queryStartDate = SpecflowTableHelper.GetDateForDateString(startDateString, DateTime.Now);
DateTime queryEndDate = SpecflowTableHelper.GetDateForDateString(endDateString, DateTime.Now);
DateTime queryStartDate = ReqnrollTableHelper.GetDateForDateString(startDateString, DateTime.Now);
DateTime queryEndDate = ReqnrollTableHelper.GetDateForDateString(endDateString, DateTime.Now);
EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName);
estate.ShouldNotBeNull();

Expand Down Expand Up @@ -94,7 +94,7 @@ public async Task WhenIGetTheImportLogForTheFollowingFileInformationIsReturned(S
EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName);
estate.ShouldNotBeNull();

DateTime queryStartDate = SpecflowTableHelper.GetDateForDateString(startDate, DateTime.Now);
DateTime queryStartDate = ReqnrollTableHelper.GetDateForDateString(startDate, DateTime.Now);
FileImportLogList importLogList = await this.FileProcessorClient.GetFileImportLogs(accessToken,
estate.EstateDetails.EstateId,
queryStartDate,
Expand Down Expand Up @@ -129,7 +129,7 @@ public async Task WhenIGetTheImportLogForEstateTheDateOnTheImportLogIs(String ac
EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName);
estate.ShouldNotBeNull();

DateTime expectedDate = SpecflowTableHelper.GetDateForDateString(expectedDateString, DateTime.Now);
DateTime expectedDate = ReqnrollTableHelper.GetDateForDateString(expectedDateString, DateTime.Now);

FileImportLogList? importLogs = await this.FileProcessorClient.GetFileImportLogs(accessToken,
estate.EstateDetails.EstateId,
Expand All @@ -142,7 +142,7 @@ public async Task WhenIGetTheImportLogForEstateTheDateOnTheImportLogIs(String ac
i.ShouldNotBeNull();
}

public async Task WhenIGetTheFileForEstateTheFollowingFileInformationIsReturned(String accessToken, String fileName, String estateName, List<EstateDetails1> estateDetailsList, SpecflowExtensions.FileProcessingSummary fileSummary){
public async Task WhenIGetTheFileForEstateTheFollowingFileInformationIsReturned(String accessToken, String fileName, String estateName, List<EstateDetails1> estateDetailsList, ReqnrollExtensions.FileProcessingSummary fileSummary){
EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName);
estate.ShouldNotBeNull();

Expand All @@ -163,7 +163,7 @@ await Retry.For(async () =>
}, TimeSpan.FromMinutes(4), TimeSpan.FromSeconds(30));
}

public async Task WhenIGetTheFileForEstateTheFollowingFileLinesAreReturned(String accessToken, String fileName, String estateName, List<EstateDetails1> estateDetailsList, List<SpecflowExtensions.FileLineDetails> fileLineDetails){
public async Task WhenIGetTheFileForEstateTheFollowingFileLinesAreReturned(String accessToken, String fileName, String estateName, List<EstateDetails1> estateDetailsList, List<ReqnrollExtensions.FileLineDetails> fileLineDetails){
EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName);
estate.ShouldNotBeNull();

Expand All @@ -173,7 +173,7 @@ await Retry.For(async () => {
FileDetails fileDetails = await this.FileProcessorClient.GetFile(accessToken, estate.EstateDetails.EstateId, fileId, CancellationToken.None);
fileDetails.ShouldNotBeNull();

foreach (SpecflowExtensions.FileLineDetails fileLineDetail in fileLineDetails){
foreach (ReqnrollExtensions.FileLineDetails fileLineDetail in fileLineDetails){

FileLine? lineToVerify = fileDetails.FileLines.SingleOrDefault(fl => fl.LineNumber == fileLineDetail.LineNumber);
lineToVerify.ShouldNotBeNull();
Expand Down
66 changes: 33 additions & 33 deletions FileProcessor.IntegrationTesting.Helpers/SpecflowExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
using DataTransferObjects;
using DataTransferObjects.Responses;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using Reqnroll;
using Shared.IntegrationTesting;
using Shouldly;
using TechTalk.SpecFlow;

public static class SpecflowExtensions
public static class ReqnrollExtensions
{
public static List<(DateTime, Int32)> ToExpectedImportLogData(this TableRows tableRows)
public static List<(DateTime, Int32)> ToExpectedImportLogData(this DataTableRows tableRows)
{
List<(DateTime, Int32)> results = new List<(DateTime, Int32)>();
foreach (TableRow tableRow in tableRows)
foreach (DataTableRow tableRow in tableRows)
{
DateTime importLogDateTime = SpecflowTableHelper.GetDateForDateString(SpecflowTableHelper.GetStringRowValue(tableRow, "ImportLogDate"), DateTime.Now);
Int32 fileCount = SpecflowTableHelper.GetIntValue(tableRow, "FileCount");
DateTime importLogDateTime = ReqnrollTableHelper.GetDateForDateString(ReqnrollTableHelper.GetStringRowValue(tableRow, "ImportLogDate"), DateTime.Now);
Int32 fileCount = ReqnrollTableHelper.GetIntValue(tableRow, "FileCount");
results.Add((importLogDateTime, fileCount));
}

return results;
}

public static String ToFileData(this TableRows tableRows)
public static String ToFileData(this DataTableRows tableRows)
{
StringBuilder fileBuilder = new StringBuilder();

Int32 currentRow = 1;
foreach (var row in tableRows)
foreach (DataTableRow row in tableRows)
{
StringBuilder rowBuilder = new StringBuilder();
foreach (String rowValue in row.Values)
Expand All @@ -48,15 +48,15 @@ public static String ToFileData(this TableRows tableRows)
return fileBuilder.ToString();
}

public static (EstateDetails1, UploadFileRequest) ToUploadFileRequest(this TableRows tableRows, List<EstateDetails1> estateDetailsList, Byte[] fileData)
public static (EstateDetails1, UploadFileRequest) ToUploadFileRequest(this DataTableRows tableRows, List<EstateDetails1> estateDetailsList, Byte[] fileData)
{
tableRows.Count.ShouldBe(1); // We can only handle 1 row here
var row = tableRows.First();
string estateName = SpecflowTableHelper.GetStringRowValue(row, "EstateName");
string merchantName = SpecflowTableHelper.GetStringRowValue(row, "MerchantName");
string fileProfileId = SpecflowTableHelper.GetStringRowValue(row, "FileProfileId");
string userId = SpecflowTableHelper.GetStringRowValue(row, "UserId");
string uploadDateTime = SpecflowTableHelper.GetStringRowValue(row, "UploadDateTime");
string estateName = ReqnrollTableHelper.GetStringRowValue(row, "EstateName");
string merchantName = ReqnrollTableHelper.GetStringRowValue(row, "MerchantName");
string fileProfileId = ReqnrollTableHelper.GetStringRowValue(row, "FileProfileId");
string userId = ReqnrollTableHelper.GetStringRowValue(row, "UserId");
string uploadDateTime = ReqnrollTableHelper.GetStringRowValue(row, "UploadDateTime");

EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName);
estate.ShouldNotBeNull();
Expand All @@ -73,20 +73,20 @@ public static (EstateDetails1, UploadFileRequest) ToUploadFileRequest(this Table

if (string.IsNullOrEmpty(uploadDateTime) == false)
{
uploadFileRequest.UploadDateTime = SpecflowTableHelper.GetDateForDateString(uploadDateTime, DateTime.Now);
uploadFileRequest.UploadDateTime = ReqnrollTableHelper.GetDateForDateString(uploadDateTime, DateTime.Now);
}

return (estate, uploadFileRequest);
}

public static List<(String, Guid)> ToFileDetails(this TableRows tableRows, String estateName, List<EstateDetails1> estateDetailsList)
public static List<(String, Guid)> ToFileDetails(this DataTableRows tableRows, String estateName, List<EstateDetails1> estateDetailsList)
{
List<(String, Guid)> results = new List<(String, Guid)>();
foreach (TableRow tableRow in tableRows)
foreach (DataTableRow tableRow in tableRows)
{
//| MerchantName | OriginalFileName | NumberOfLines |
String merchantName = SpecflowTableHelper.GetStringRowValue(tableRow, "MerchantName");
String originalFileName = SpecflowTableHelper.GetStringRowValue(tableRow, "OriginalFileName");
String merchantName = ReqnrollTableHelper.GetStringRowValue(tableRow, "MerchantName");
String originalFileName = ReqnrollTableHelper.GetStringRowValue(tableRow, "OriginalFileName");

EstateDetails1 estate = estateDetailsList.SingleOrDefault(e => e.EstateDetails.EstateName == estateName);
Guid merchantId = estate.EstateDetails.GetMerchantId(merchantName);
Expand All @@ -95,29 +95,29 @@ public static (EstateDetails1, UploadFileRequest) ToUploadFileRequest(this Table
return results;
}

public static FileProcessingSummary ToFileProcessingSummary(this TableRows tableRows)
public static FileProcessingSummary ToFileProcessingSummary(this DataTableRows tableRows)
{
tableRows.Count.ShouldBe(1);
TableRow tableRow = tableRows.First();
DataTableRow tableRow = tableRows.First();
FileProcessingSummary summary = new FileProcessingSummary{
ProcessingCompleted = SpecflowTableHelper.GetBooleanValue(tableRow, "ProcessingCompleted"),
NumberOfLines = SpecflowTableHelper.GetIntValue(tableRow, "NumberOfLines"),
TotaLines = SpecflowTableHelper.GetIntValue(tableRow, "TotaLines"),
SuccessfulLines = SpecflowTableHelper.GetIntValue(tableRow, "SuccessfulLines"),
IgnoredLines = SpecflowTableHelper.GetIntValue(tableRow, "IgnoredLines"),
FailedLines = SpecflowTableHelper.GetIntValue(tableRow, "FailedLines"),
NotProcessedLines = SpecflowTableHelper.GetIntValue(tableRow, "NotProcessedLines")
ProcessingCompleted = ReqnrollTableHelper.GetBooleanValue(tableRow, "ProcessingCompleted"),
NumberOfLines = ReqnrollTableHelper.GetIntValue(tableRow, "NumberOfLines"),
TotaLines = ReqnrollTableHelper.GetIntValue(tableRow, "TotaLines"),
SuccessfulLines = ReqnrollTableHelper.GetIntValue(tableRow, "SuccessfulLines"),
IgnoredLines = ReqnrollTableHelper.GetIntValue(tableRow, "IgnoredLines"),
FailedLines = ReqnrollTableHelper.GetIntValue(tableRow, "FailedLines"),
NotProcessedLines = ReqnrollTableHelper.GetIntValue(tableRow, "NotProcessedLines")
};
return summary;
}

public static List<FileLineDetails> ToFileLineDetails(this TableRows tableRows){
public static List<FileLineDetails> ToFileLineDetails(this DataTableRows tableRows){
List< FileLineDetails > results = new List< FileLineDetails >();
foreach (TableRow tableRow in tableRows){
foreach (DataTableRow tableRow in tableRows){
FileLineDetails fileLineDetails = new FileLineDetails();
fileLineDetails.LineNumber = SpecflowTableHelper.GetIntValue(tableRow, "LineNumber");
fileLineDetails.LineData = SpecflowTableHelper.GetStringRowValue(tableRow, "Data");
String processingResultString = SpecflowTableHelper.GetStringRowValue(tableRow, "Result");
fileLineDetails.LineNumber = ReqnrollTableHelper.GetIntValue(tableRow, "LineNumber");
fileLineDetails.LineData = ReqnrollTableHelper.GetStringRowValue(tableRow, "Data");
String processingResultString = ReqnrollTableHelper.GetStringRowValue(tableRow, "Result");
fileLineDetails.ProcessingResult = Enum.Parse<FileLineProcessingResult>(processingResultString, true);
results.Add(fileLineDetails);
}
Expand Down
18 changes: 18 additions & 0 deletions FileProcessor.IntegrationTests/Common/DockerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,24 @@ public DockerHelper(){

#region Methods

public override async Task CreateSubscriptions(){
List<(String streamName, String groupName, Int32 maxRetries)> subscriptions = new();
subscriptions.AddRange(MessagingService.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions());
subscriptions.AddRange(EstateManagement.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions());
subscriptions.AddRange(TransactionProcessor.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions());
subscriptions.AddRange(FileProcessor.IntegrationTesting.Helpers.SubscriptionsHelper.GetSubscriptions());

// TODO: this needs moved to Estate Management nuget
subscriptions.Add(("$ce-FileImportLogAggregate", "Estate Management", 0));

foreach ((String streamName, String groupName, Int32 maxRetries) subscription in subscriptions)
{
var x = subscription;
x.maxRetries = 2;
await this.CreatePersistentSubscription(x);
}
}

public override async Task StartContainersForScenarioRun(String scenarioName, DockerServices dockerServices){
await base.StartContainersForScenarioRun(scenarioName, dockerServices);

Expand Down
Loading