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
8 changes: 7 additions & 1 deletion .github/workflows/nightlybuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ jobs:
run: docker build . --file FileProcessor/Dockerfile --tag fileprocessor:latest

- name: Run Integration Tests
run: dotnet test "FileProcessor.IntegrationTests\FileProcessor.IntegrationTests.csproj"
run: dotnet test "FileProcessor.IntegrationTests\FileProcessor.IntegrationTests.csproj" --filter Category=Nightly

- name: Run Integration Tests 1
run: dotnet test "FileProcessor.IntegrationTests\FileProcessor.IntegrationTests.csproj" --filter Category=Nightly1

- name: Run Integration Tests 2
run: dotnet test "FileProcessor.IntegrationTests\FileProcessor.IntegrationTests.csproj" --filter Category=Nightly2

- uses: actions/[email protected]
if: ${{ failure() }}
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/pullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ jobs:
- name: Run Integration Tests
run: dotnet test "FileProcessor.IntegrationTests\FileProcessor.IntegrationTests.csproj" --filter Category=PRTest

- name: Run Integration Tests 1
run: dotnet test "FileProcessor.IntegrationTests\FileProcessor.IntegrationTests.csproj" --filter Category=PRTest1

- name: Run Integration Tests 2
run: dotnet test "FileProcessor.IntegrationTests\FileProcessor.IntegrationTests.csproj" --filter Category=PRTest2

- uses: actions/[email protected]
if: ${{ failure() }}
with:
Expand Down
10 changes: 5 additions & 5 deletions FileProcessor.Client/FileProcessorClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,12 @@ public async Task<Result<Guid>> UploadFile(String accessToken,
ByteArrayContent fileContent = new ByteArrayContent(fileData);
fileContent.Headers.ContentType = MediaTypeHeaderValue.Parse("multipart/form-data");
formData.Add(fileContent, "file", fileName);
formData.Add(new StringContent(uploadFileRequest.EstateId.ToString()), "request.EstateId");
formData.Add(new StringContent(uploadFileRequest.MerchantId.ToString()), "request.MerchantId");
formData.Add(new StringContent(uploadFileRequest.FileProfileId.ToString()), "request.FileProfileId");
formData.Add(new StringContent(uploadFileRequest.UserId.ToString()), "request.UserId");
formData.Add(new StringContent(uploadFileRequest.EstateId.ToString()), "EstateId");
formData.Add(new StringContent(uploadFileRequest.MerchantId.ToString()), "MerchantId");
formData.Add(new StringContent(uploadFileRequest.FileProfileId.ToString()), "FileProfileId");
formData.Add(new StringContent(uploadFileRequest.UserId.ToString()), "UserId");
formData.Add(new StringContent(uploadFileRequest.UploadDateTime.ToString("yyyy-MM-dd HH:mm:ss")),
"request.UploadDateTime");
"UploadDateTime");

httpRequest.Content = formData;
httpRequest.Headers.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
Expand Down
2 changes: 1 addition & 1 deletion FileProcessor.IntegrationTests/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
// The following GUID is for the ID of the typelib if this project is exposed to COM.

[assembly: Guid("25d4d6fc-b809-4acc-a910-249a03e5f07a")]
[assembly: LevelOfParallelism(2)]
[assembly: LevelOfParallelism(1)]
[assembly: Parallelizable(ParallelScope.Fixtures)]
17 changes: 11 additions & 6 deletions FileProcessor.IntegrationTests/Common/Setup.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
namespace FileProcessor.IntegrationTests.Common
{
using System;
using System.Data;
using System.Data.SqlClient;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Ductus.FluentDocker.Builders;
using Ductus.FluentDocker.Services;
using Ductus.FluentDocker.Services.Extensions;
Expand All @@ -15,6 +9,13 @@
using Shared.IntegrationTesting;
using Shared.Logger;
using Shouldly;
using System;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using ILogger = Microsoft.Extensions.Logging.ILogger;

[Binding]
Expand All @@ -29,6 +30,10 @@ public class Setup

public static async Task GlobalSetup(DockerHelper dockerHelper)
{
Environment.SetEnvironmentVariable("FLUENTDOCKER_LOGLEVEL", "trace");
Environment.SetEnvironmentVariable("FLUENTDOCKER_NOSUDO", "true");
Environment.SetEnvironmentVariable("FLUENTDOCKER_PATH", "/usr/bin/docker");

ShouldlyConfiguration.DefaultTaskTimeout = TimeSpan.FromMinutes(1);
dockerHelper.SqlCredentials = Setup.SqlCredentials;
dockerHelper.DockerCredentials = Setup.DockerCredentials;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ Background:
| Deposit1 | 300.00 | Today | Test Merchant 1 | Test Estate 1 |
| Deposit1 | 300.00 | Today | Test Merchant 2 | Test Estate 1 |

@PRTest
@PRTest1
@Nightly1
Scenario: Get File Import Log Details
Given I have a file named 'SafarcomTopup1.txt' with the following contents
| Column1 | Column2 | Column3 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ Background:
Given I make the following manual merchant deposits
| Reference | Amount | DateTime | MerchantName | EstateName |
| Deposit1 | 300.00 | Today | Test Merchant 1 | Test Estate 1 |


@Nightly
Scenario: Process Safaricom Topup File with 1 detail row
Given I have a file named 'SafarcomTopup.txt' with the following contents
| Column1 | Column2 | Column3 |
Expand All @@ -86,6 +87,7 @@ Scenario: Process Safaricom Topup File with 1 detail row

#When As merchant "Test Merchant 1" on Estate "Test Estate 1" I get my transactions 1 transaction should be returned

@Nightly
Scenario: Process Safaricom Topup File with 2 detail rows
Given I have a file named 'SafarcomTopup.txt' with the following contents
| Column1 | Column2 | Column3 |
Expand All @@ -99,6 +101,7 @@ Scenario: Process Safaricom Topup File with 2 detail rows

#When As merchant "Test Merchant 1" on Estate "Test Estate 1" I get my transactions 2 transaction should be returned

@Nightly
Scenario: Process 2 Safaricom Topup Files
Given I have a file named 'SafarcomTopup1.txt' with the following contents
| Column1 | Column2 | Column3 |
Expand All @@ -122,6 +125,7 @@ Scenario: Process 2 Safaricom Topup Files
#When As merchant "Test Merchant 1" on Estate "Test Estate 1" I get my transactions 3 transaction should be returned

@PRTest
@Nightly
Scenario: Process Duplicate Safaricom Topup File with 1 detail row
Given I have a file named 'SafarcomTopup1.txt' with the following contents
| Column1 | Column2 | Column3 |
Expand All @@ -146,7 +150,7 @@ Scenario: Process Duplicate Safaricom Topup File with 1 detail row
| Test Estate 1 | Test Merchant 1 | B2A59ABF-293D-4A6B-B81B-7007503C3476 | ABA59ABF-293D-4A6B-B81B-7007503C3476 |

# Wrong Format??

@Nightly
Scenario: Process Safaricom Topup File with Upload Date Time
Given I have a file named 'SafarcomTopup.txt' with the following contents
| Column1 | Column2 | Column3 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Background:
Given I make the following manual merchant deposits
| Reference | Amount | DateTime | MerchantName | EstateName |
| Deposit1 | 300.00 | Today | Test Merchant 1 | Test Estate 1 |


@Nightly2
Scenario: Process Voucher File with 1 detail row for recipient email
Given I have a file named 'VoucherIssue.txt' with the following contents
| Column1 | Column2 | Column3 | Column4 |
Expand All @@ -87,6 +88,7 @@ Scenario: Process Voucher File with 1 detail row for recipient email

#When As merchant "Test Merchant 1" on Estate "Test Estate 1" I get my transactions 1 transaction should be returned

@Nightly2
Scenario: Process Voucher File with 1 detail row for recipient mobile
Given I have a file named 'VoucherIssue.txt' with the following contents
| Column1 | Column2 | Column3 | Column4 |
Expand All @@ -99,6 +101,7 @@ Scenario: Process Voucher File with 1 detail row for recipient mobile

#When As merchant "Test Merchant 1" on Estate "Test Estate 1" I get my transactions 1 transaction should be returned

@Nightly2
Scenario: Process Voucher File with 2 detail rows
Given I have a file named 'VoucherIssue.txt' with the following contents
| Column1 | Column2 | Column3 | Column4 |
Expand All @@ -112,6 +115,7 @@ Scenario: Process Voucher File with 2 detail rows

#When As merchant "Test Merchant 1" on Estate "Test Estate 1" I get my transactions 2 transaction should be returned

@Nightly2
Scenario: Process 2 Voucher Files
Given I have a file named 'VoucherIssue1.txt' with the following contents
| Column1 | Column2 | Column3 | Column4 |
Expand All @@ -135,7 +139,8 @@ Scenario: Process 2 Voucher Files

#When As merchant "Test Merchant 1" on Estate "Test Estate 1" I get my transactions 4 transaction should be returned

@PRTest
@PRTest2
@Nightly2
Scenario: Process Duplicate Voucher Topup File with 1 detail row
Given I have a file named 'VoucherIssue1.txt' with the following contents
| Column1 | Column2 | Column3 | Column4 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@
<None Update="projections\continuous\TransactionProcessorSubscriptionStreamBuilder.js">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="xunit.runner.json">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
3 changes: 0 additions & 3 deletions FileProcessor.IntegrationTests/xunit.runner.json

This file was deleted.

19 changes: 5 additions & 14 deletions FileProcessor.Tests/ModelFactoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ public void ModelFactory_ConvertFrom_FileImportLogList_IsConverted()
{
List<FileProcessor.Models.FileImportLog> importLogs = TestData.FileImportLogModels;

ModelFactory modelFactory = new ModelFactory();

FileImportLogList result = modelFactory.ConvertFrom(importLogs);
FileImportLogList result = ModelFactory.ConvertFrom(importLogs);

this.VerifyFileImportLogList(importLogs, result);
}
Expand All @@ -41,9 +39,7 @@ public void ModelFactory_ConvertFrom_FileImportLogList_WithNoFiles_IsConverted()
fileImportLog.Files = new List<ImportLogFile>();
}

ModelFactory modelFactory = new ModelFactory();

FileImportLogList result = modelFactory.ConvertFrom(importLogs);
FileImportLogList result = ModelFactory.ConvertFrom(importLogs);

this.VerifyFileImportLogList(importLogs, result);
}
Expand All @@ -53,9 +49,7 @@ public void ModelFactory_ConvertFrom_FileImportLog_IsConverted()
{
FileProcessor.Models.FileImportLog importLog = TestData.FileImportLogModel1;

ModelFactory modelFactory = new ModelFactory();

var result = modelFactory.ConvertFrom(importLog);
DataTransferObjects.Responses.FileImportLog result = ModelFactory.ConvertFrom(importLog);

this.VerifyFileImportLog(importLog, result);
}
Expand All @@ -66,20 +60,17 @@ public void ModelFactory_ConvertFrom_FileImportLog_WithNoFiles_IsConverted()
FileProcessor.Models.FileImportLog importLog = TestData.FileImportLogModel1;
importLog.Files = new List<ImportLogFile>();

ModelFactory modelFactory = new ModelFactory();

var result = modelFactory.ConvertFrom(importLog);
DataTransferObjects.Responses.FileImportLog result = ModelFactory.ConvertFrom(importLog);

this.VerifyFileImportLog(importLog, result);
}

[Fact]
public void ModelFactory_ConvertFrom_FileDetails_IsConverted()
{
ModelFactory modelFactory = new ModelFactory();
FileDetails fileDetails = TestData.FileDetailsModel;

var result = modelFactory.ConvertFrom(fileDetails);
DataTransferObjects.Responses.FileDetails result = ModelFactory.ConvertFrom(fileDetails);

this.VerifyFileDetails(fileDetails, result);
}
Expand Down
9 changes: 9 additions & 0 deletions FileProcessor/Bootstrapper/MiddlewareRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using EventStore.Client;
using Lamar;
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Http.Features;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Diagnostics.HealthChecks;
using Microsoft.IdentityModel.Tokens;
Expand Down Expand Up @@ -118,6 +119,14 @@ public MiddlewareRegistry()
options.SerializerOptions.PropertyNamingPolicy = new SnakeCaseNamingPolicy();
options.SerializerOptions.PropertyNameCaseInsensitive = true; // optional, but safer
});

this.Configure<FormOptions>(options =>
{
// Allow very large values (adjust to what you need)
options.ValueLengthLimit = int.MaxValue; // form value length
options.MultipartBodyLengthLimit = long.MaxValue; // multipart body length
options.MemoryBufferThreshold = int.MaxValue; // buffer threshold
});
}

#endregion
Expand Down
1 change: 0 additions & 1 deletion FileProcessor/Bootstrapper/MiscRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class MiscRegistry : ServiceRegistry
public MiscRegistry()
{
this.AddSingleton<IModelFactory, ModelFactory>();
this.AddSingleton<Common.IModelFactory, Common.ModelFactory>();
this.AddSingleton<IFileProcessorDomainService, FileProcessorDomainService>();

bool logRequests = ConfigurationReader.GetValueOrDefault<Boolean>("MiddlewareLogging", "LogRequests", true);
Expand Down
38 changes: 0 additions & 38 deletions FileProcessor/Common/IModelFactory.cs

This file was deleted.

Loading
Loading