diff --git a/README.md b/README.md index 7378a46f..3078e235 100644 --- a/README.md +++ b/README.md @@ -7,22 +7,23 @@ Core delivery C# ASP.NET backend template. * [Testing](#testing) * [Running](#running) * [Dependabot](#dependabot) +* [Test Data](#test-data) -### Install MongoDB +# Install MongoDB - Install [MongoDB](https://www.mongodb.com/docs/manual/tutorial/#installation) on your local machine - Start MongoDB: ```bash sudo mongod --dbpath ~/mongodb-cdp ``` -### Inspect MongoDB +# Inspect MongoDB To inspect the Database and Collections locally: ```bash mongosh ``` -### Testing +# Testing Run the tests with: @@ -33,18 +34,126 @@ Tests do not use mocking of any sort and read and write from the in-memory datab dotnet test ```` -### Running +# Running Run CDP-Deployments application: ```bash -dotnet run --project Btms.Backend --launch-profile Development +dotnet run --project Btms.Backend --launch-profile Btms.Backend ``` -### SonarCloud +# SonarCloud Example SonarCloud configuration are available in the GitHub Action workflows. -### Dependabot +# Dependabot We have added an example dependabot configuration file to the repository. You can enable it by renaming the [.github/example.dependabot.yml](.github/example.dependabot.yml) to `.github/dependabot.yml` + +# Test data +We are able to obtain test data to use in our tests a few ways. + +## Canned test data +This is data that we created by hand based on examples of messages that we had obtained. Canned test data can be found in [`Btms.Backend.IntegrationTests/Fixtures/SmokeTest`](Btms.Backend.IntegrationTests/Fixtures/SmokeTest). In there you will find relevant folders for the messages that you want to simulate: +* ALVS - Custom Record notifications from CDS +* DECISIONS - Decision that is made by BTMS. +* GVMSAPIRESPONSE - ?? +* IPAFFS - CHED notifications from IPAFFS + * CHEDA + * CHEDD + * CHEDP + * CHEDPP + +## Using the Test Data Generator +The Test Data Generator can be found in the `tools` project ([`tools/TestDataGenerator`](TestDataGenerator/TestDataGenerator.csproj)). The test data is generated based on specifications provided in a scenario e.g. [`ChedASimpleMatchScenarioGenerator.cs`](TestDataGenerator/Scenarios/ChedASimpleMatchScenarioGenerator.cs). A scenario should container at least a `GetNotificationBuilder` or `GetClearanceRequestBuilder`. + +Example usage of `GetNotificationBuilder` +```csharp +var notification = GetNotificationBuilder("cheda-one-commodity") + .WithCreationDate(entryDate) + .WithRandomArrivalDateTime(config.ArrivalDateRange) + .WithReferenceNumber(ImportNotificationTypeEnum.Cveda, scenario, entryDate, item) + .ValidateAndBuild(); +``` + +Example usage of `GetClearanceRequestBuilder` +```csharp +var clearanceRequest = GetClearanceRequestBuilder("cr-one-item") + .WithCreationDate(entryDate) + .WithArrivalDateTimeOffset(notification.PartOne!.ArrivalDate, notification.PartOne!.ArrivalTime) + .WithReferenceNumber(notification.ReferenceNumber!) + .ValidateAndBuild(); +``` +Note: +* Both the Notification Builder and Clearance Request Builder both take a sample file which it uses as a basis to create the test data. The sample file is located in [`Scenarios/Samples`](TestDataGenerator/Scenarios/Samples). + +After creating your scenario your will need to add it to `ConfigureTestGenerationServices` in [`BuilderExtensions.cs`](TestDataGenerator/Helpers/BuilderExtensions.cs). + +Next, you will need to create a dataset that's specified in [`Program.cs`](TestDataGenerator/Program.cs). +Example dataset: +```csharp + var datasets = new[] + { + new + { + Dataset = "All-CHED-No-Match", + RootPath = "GENERATED-ALL-CHED-NO-MATCH", + Scenarios = new[] { app.CreateScenarioConfig(1, 1) } + }, + ... + } +``` + +* Dataset - Name of the dataset +* RootPath - Folder where the data will be created in. The folder will be in [`TestDataGenerator/.test-data-generator`](TestDataGenerator/.test-data-generator). +* Scenarios - List of scenarios to create test data for. The CreateScenarioConfig generates scenarios based on the Scenario types from the [`Scenarios`](TestDataGenerator/Scenarios) folder. + +And finally, in order to trigger the data creation you will need to add some configuration to [`Properties/launchSettings.json`](TestDataGenerator/Properties/launchSettings.json): +```json +{ + "profiles": { + "Generate All CHED no match": { + "commandName": "Project", + "commandLineArgs": "All-CHED-No-Match", + "environmentVariables": { + "DMP_ENVIRONMENT": "dev", + "DMP_SERVICE_BUS_NAME": "DEVTREINFSB1001", + "DMP_BLOB_STORAGE_NAME": "devdmpinfdl1001", + "DMP_SLOT": "1003", + "AZURE_TENANT_ID": "c9d74090-b4e6-4b04-981d-e6757a160812" + } + } + } +} +``` + +* Give the profile a name. This can be free text. +* commandLineArgs - The name of the new dataset. +* The rest of the configuration can be copied from the other profiles. + +### Creating new sample file +You may want to a new sample if you are creating data for a new scenario. To do this: +* Place the new sample file with the relevant JSON in the [`Samples`](TestDataGenerator/Scenarios/Samples) folder. +* Change the Properties of the file in Rider: + * Build action: **Content** + * Copy to output directory: **Copy if newer** + +## Using data from Blob Storage +We have imported redacted production data that is stored in a Blob Storage. We can use BTMS Backend to import this data. + +* Update [`local.env`](Btms.Backend/Properties/local.env): + * For one day dataset - `BusinessOptions:DmpBlobRootFolder=PRODREDACTED-20241204` + * For one month dataset - `BusinessOptions:DmpBlobRootFolder=PRODREDACTED-202411` + * When importing the data set the following: + ```dotenv + BlobServiceOptions:CacheWriteEnabled=true + # BlobServiceOptions:CacheReadEnabled=true + ``` + * After importing update the config to be the following so the data doesn't get imported again when you call the `initialise` API (http://0.0.0.0:5002/mgmt/initialise?syncPeriod=All) + ```dotenv + # BlobServiceOptions:CacheWriteEnabled=true + BlobServiceOptions:CacheReadEnabled=true + ``` + * Once the config has been updated, start BTMS Backend and call the `initialise` API (http://0.0.0.0:5002/mgmt/initialise?syncPeriod=All). Note that a large amount of data will be loaded, particularly the full month dataset. It is also advisable to run Backend from a standalone terminal rather than from Rider as it struggles running this task. + + diff --git a/TestDataGenerator/Config/Datasets.cs b/TestDataGenerator/Config/Datasets.cs index 08137eb9..db5df629 100644 --- a/TestDataGenerator/Config/Datasets.cs +++ b/TestDataGenerator/Config/Datasets.cs @@ -25,7 +25,8 @@ public static Dataset[] GetDatasets(IHost app) ds.LoadTest, ds.LoadTest90Dx1, ds.LoadTestCondensed, - ds.LoadTest90Dx10k + ds.LoadTest90Dx10k, + ds.AllChedNoMatch ]; } @@ -118,6 +119,14 @@ public static Dataset[] GetDatasets(IHost app) } }; + public readonly Dataset AllChedNoMatch = new() + { + Name = "All-CHED-No-Match", + Description = "LIM TODO", + RootPath = "GENERATED-ALL-CHED-NO-MATCH", + Scenarios = new[] { app.CreateScenarioConfig(1, 1) } + }; + // public readonly Dataset Pha = new() // { // Name = "PHA", diff --git a/TestDataGenerator/Extensions/BuilderExtensions.cs b/TestDataGenerator/Extensions/BuilderExtensions.cs index 0dca405e..e9c708ea 100644 --- a/TestDataGenerator/Extensions/BuilderExtensions.cs +++ b/TestDataGenerator/Extensions/BuilderExtensions.cs @@ -23,6 +23,7 @@ public static IServiceCollection ConfigureTestGenerationServices(this IServiceCo services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); var blobOptionsValidatorDescriptor = services.Where(d => d.ServiceType == typeof(IValidateOptions)); diff --git a/TestDataGenerator/Properties/launchSettings.json b/TestDataGenerator/Properties/launchSettings.json index a01300cb..22aa045c 100644 --- a/TestDataGenerator/Properties/launchSettings.json +++ b/TestDataGenerator/Properties/launchSettings.json @@ -1,6 +1,17 @@ { "$schema": "https://json.schemastore.org/launchsettings.json", "profiles": { + "Generate All CHED no match": { + "commandName": "Project", + "commandLineArgs": "All-CHED-No-Match", + "environmentVariables": { + "DMP_ENVIRONMENT": "dev", + "DMP_SERVICE_BUS_NAME": "DEVTREINFSB1001", + "DMP_BLOB_STORAGE_NAME": "devdmpinfdl1001", + "DMP_SLOT": "1003", + "AZURE_TENANT_ID": "c9d74090-b4e6-4b04-981d-e6757a160812" + } + }, "Generate EndToEnd-IBM": { "commandName": "Project", "commandLineArgs": "EndToEnd-IBM", diff --git a/TestDataGenerator/Scenarios/AllChedsNoMatchScenarioGenerator.cs b/TestDataGenerator/Scenarios/AllChedsNoMatchScenarioGenerator.cs new file mode 100644 index 00000000..9c006886 --- /dev/null +++ b/TestDataGenerator/Scenarios/AllChedsNoMatchScenarioGenerator.cs @@ -0,0 +1,48 @@ +using Btms.Types.Ipaffs; +using Microsoft.Extensions.Logging; + +namespace TestDataGenerator.Scenarios; + +public class AllChedsNoMatchScenarioGenerator(ILogger logger) : ScenarioGenerator +{ + public override GeneratorResult Generate(int scenario, int item, DateTime entryDate, ScenarioConfig config) + { + var chedANotification = GetNotificationBuilder("cheda-one-commodity") + .WithCreationDate(entryDate) + .WithRandomArrivalDateTime(config.ArrivalDateRange) + .WithReferenceNumber(ImportNotificationTypeEnum.Cveda, scenario, entryDate, item) + .ValidateAndBuild(); + + logger.LogInformation("Created {NotificationReferenceNumber}", + chedANotification.ReferenceNumber); + + var chedPNotification = GetNotificationBuilder("chedp-one-commodity") + .WithCreationDate(entryDate) + .WithRandomArrivalDateTime(config.ArrivalDateRange) + .WithReferenceNumber(ImportNotificationTypeEnum.Cvedp, scenario, entryDate, item) + .ValidateAndBuild(); + + logger.LogInformation("Created {NotificationReferenceNumber}", + chedPNotification.ReferenceNumber); + + var chedDNotification = GetNotificationBuilder("chedd-one-commodity") + .WithCreationDate(entryDate) + .WithRandomArrivalDateTime(config.ArrivalDateRange) + .WithReferenceNumber(ImportNotificationTypeEnum.Ced, scenario, entryDate, item) + .ValidateAndBuild(); + + logger.LogInformation("Created {NotificationReferenceNumber}", + chedDNotification.ReferenceNumber); + + var chedPPNotification = GetNotificationBuilder("chedpp-multiple-commodity") + .WithCreationDate(entryDate) + .WithRandomArrivalDateTime(config.ArrivalDateRange) + .WithReferenceNumber(ImportNotificationTypeEnum.Chedpp, scenario, entryDate, item) + .ValidateAndBuild(); + + logger.LogInformation("Created {NotificationReferenceNumber}", + chedPPNotification.ReferenceNumber); + + return new GeneratorResult([chedANotification, chedPNotification, chedDNotification, chedPPNotification]); + } +} \ No newline at end of file diff --git a/TestDataGenerator/Scenarios/ChedANoMatchScenarioGenerator.cs b/TestDataGenerator/Scenarios/ChedANoMatchScenarioGenerator.cs index 8036b0f6..17246a80 100644 --- a/TestDataGenerator/Scenarios/ChedANoMatchScenarioGenerator.cs +++ b/TestDataGenerator/Scenarios/ChedANoMatchScenarioGenerator.cs @@ -13,7 +13,7 @@ public override GeneratorResult Generate(int scenario, int item, DateTime entryD .WithReferenceNumber(ImportNotificationTypeEnum.Cveda, scenario, entryDate, item) .WithVersionNumber() .ValidateAndBuild(); - + logger.LogInformation("Created {NotificationReferenceNumber}", notification.ReferenceNumber); diff --git a/TestDataGenerator/Scenarios/Samples/chedd-one-commodity.json b/TestDataGenerator/Scenarios/Samples/chedd-one-commodity.json new file mode 100644 index 00000000..6bc64054 --- /dev/null +++ b/TestDataGenerator/Scenarios/Samples/chedd-one-commodity.json @@ -0,0 +1,200 @@ +{ + "id": 3989, + "referenceNumber": "CHEDD.GB.2024.1003989", + "version": 1, + "lastUpdated": "2024-08-19T08:45:36.18Z", + "lastUpdatedBy": { + "displayName": "Percy Inspector-Tester", + "userId": "79f6dc68-2144-e911-a96a-000d3a29ba60" + }, + "type": "CED", + "status": "SUBMITTED", + "partOne": { + "personResponsible": { + "name": "Percy Inspector-Tester", + "companyId": "767ceb6a-2144-e911-a96c-000d3a29b5de", + "companyName": "Defra Test BIP", + "address": [ + "Animal and Plant Health Agency", + "Woodham Lane", + "New Haw", + "Addlestone", + "Surrey", + "KT15 3NB" + ], + "country": "GB", + "tracesID": 1001, + "phone": "020 8225 7295", + "email": "DefraTestBIP@anthunt3.33mail.com", + "contactId": "79f6dc68-2144-e911-a96a-000d3a29ba60" + }, + "consignor": { + "id": "c7ca28db-e7b5-45e5-b2b6-5a94111950b9", + "type": "exporter", + "status": "nonapproved", + "companyName": "Paul Dedectivu", + "address": { + "addressLine1": "Address Line 1", + "city": "Birmingham", + "postalZipCode": "B6 Y2R", + "countryISOCode": "BD", + "telephone": "0756623125", + "email": "kainos@kainos.com" + }, + "tracesId": 10000008 + }, + "consignee": { + "id": "dd41956e-214f-4884-95ed-afc5086d9ec5", + "type": "organisation branch address", + "status": "approved", + "companyName": "Nikolaus, Nikolaus and Nikolaus DgxgH", + "individualName": "Fred Botsford", + "approvalNumber": "OOZXYH-936156", + "otherIdentifier": "ABP", + "address": { + "addressLine1": "6696 HKNn0", + "addressLine2": "140 Treutel Cape Ug5mN", + "city": "Sanfordhaven", + "postalZipCode": "34657", + "countryISOCode": "GD", + "ukTelephone": "2611185201", + "internationalTelephone": { + "countryCode": "8", + "subscriberNumber": "114" + }, + "telephone": "2611185201", + "email": "some@email.com" + }, + "tracesId": 10000006 + }, + "importer": { + "id": "dd41956e-214f-4884-95ed-afc5086d9ec5", + "type": "organisation branch address", + "status": "approved", + "companyName": "Nikolaus, Nikolaus and Nikolaus DgxgH", + "individualName": "Fred Botsford", + "approvalNumber": "OOZXYH-936156", + "otherIdentifier": "ABP", + "address": { + "addressLine1": "6696 HKNn0", + "addressLine2": "140 Treutel Cape Ug5mN", + "city": "Sanfordhaven", + "postalZipCode": "34657", + "countryISOCode": "GD", + "ukTelephone": "2611185201", + "internationalTelephone": { + "countryCode": "8", + "subscriberNumber": "114" + }, + "telephone": "2611185201", + "email": "some@email.com" + }, + "tracesId": 10000006 + }, + "placeOfDestination": { + "id": "dd41956e-214f-4884-95ed-afc5086d9ec5", + "type": "organisation branch address", + "status": "approved", + "companyName": "Nikolaus, Nikolaus and Nikolaus DgxgH", + "individualName": "Fred Botsford", + "approvalNumber": "OOZXYH-936156", + "otherIdentifier": "ABP", + "address": { + "addressLine1": "6696 HKNn0", + "addressLine2": "140 Treutel Cape Ug5mN", + "city": "Sanfordhaven", + "postalZipCode": "34657", + "countryISOCode": "GD", + "ukTelephone": "2611185201", + "internationalTelephone": { + "countryCode": "8", + "subscriberNumber": "114" + }, + "telephone": "2611185201", + "email": "some@email.com" + }, + "tracesId": 10000006 + }, + "commodities": { + "totalGrossWeight": 10, + "totalNetWeight": 1, + "numberOfPackages": 1, + "temperature": "Ambient", + "commodityComplement": [ + { + "commodityID": "07020000", + "commodityDescription": "Tomatoes, fresh or chilled", + "complementID": 33004, + "speciesType": "2", + "speciesClass": "33004" + } + ], + "complementParameterSet": [ + { + "complementID": 33004, + "keyDataPair": [ + { + "key": "netweight", + "data": "1" + }, + { + "key": "number_package", + "data": "1" + }, + { + "key": "type_package", + "data": "Bag" + } + ] + } + ], + "includeNonAblactedAnimals": false, + "countryOfOrigin": "AF", + "consignedCountry": "AF", + "commodityIntendedFor": "human" + }, + "purpose": { + "purposeGroup": "For Import" + }, + "arrivalDate": "2022-01-01", + "arrivalTime": "09:00:00", + "transporterDetailsRequired": false, + "meansOfTransport": {}, + "meansOfTransportFromEntryPoint": { + "id": "AB123", + "type": "Aeroplane", + "document": "Document" + }, + "veterinaryInformation": { + "accompanyingDocuments": [ + { + "documentType": "veterinaryHealthCertificate", + "documentReference": "1234", + "documentIssueDate": "2021-01-01" + } + ] + }, + "submissionDate": "2021-02-08T15:08:06.470487Z", + "consignmentValidation": [ + { + "field": "uk/gov/defra/tracesx/notificationschema/representation/partone/providectcmrn", + "message": "Select if using the Common Transit Convention (CTC)" + }, + { + "field": "uk/gov/defra/tracesx/notificationschema/representation/partone/contactdetails", + "message": "Enter your contact details" + }, + { + "field": "uk/gov/defra/tracesx/notificationschema/representation/partone/isgvmsroute", + "message": "Select if using the Goods Vehicle Movement Service (GVMS)" + } + ], + "submittedBy": { + "displayName": "Percy Inspector-Tester", + "userId": "79f6dc68-2144-e911-a96a-000d3a29ba60" + }, + "complexCommoditySelected": true + }, + "etag": "0000000000028471", + "chedTypeVersion": 2 +} \ No newline at end of file diff --git a/TestDataGenerator/Scenarios/Samples/chedpp-multiple-commodity.json b/TestDataGenerator/Scenarios/Samples/chedpp-multiple-commodity.json new file mode 100644 index 00000000..7b57b706 --- /dev/null +++ b/TestDataGenerator/Scenarios/Samples/chedpp-multiple-commodity.json @@ -0,0 +1,334 @@ +{ + "id": 3991, + "referenceNumber": "CHEDPP.GB.2024.1003991", + "version": 1, + "lastUpdated": "2024-08-19T08:50:00.193Z", + "lastUpdatedBy": { + "displayName": "Percy Inspector-Tester", + "userId": "79f6dc68-2144-e911-a96a-000d3a29ba60" + }, + "type": "CHEDPP", + "status": "VALIDATED", + "riskAssessment": { + "commodityResults": [ + { + "phsiDecision": "REQUIRED", + "phsiClassification": "Reduced", + "uniqueId": "fd8a422b-4371-44a2-9693-6f6dbe26cc4b" + }, + { + "phsiDecision": "REQUIRED", + "phsiClassification": "Reduced", + "uniqueId": "aff9422c-f5ee-4785-b34a-588edb089940" + } + ], + "assessmentDateTime": "2021-04-16T10:45:01.455922" + }, + "partOne": { + "personResponsible": { + "name": "Percy Inspector-Tester", + "companyId": "767ceb6a-2144-e911-a96c-000d3a29b5de", + "companyName": "Defra Test BIP", + "address": [ + "Animal and Plant Health Agency", + "Woodham Lane", + "New Haw", + "Addlestone", + "Surrey", + "KT15 3NB" + ], + "country": "GB", + "tracesID": 1001, + "phone": "020 8225 7295", + "email": "DefraTestBIP@anthunt3.33mail.com", + "contactId": "79f6dc68-2144-e911-a96a-000d3a29ba60" + }, + "customsReferenceNumber": "1234", + "containsWoodPackaging": false, + "consignor": { + "id": "c7ca28db-e7b5-45e5-b2b6-5a94111950b9", + "type": "exporter", + "status": "nonapproved", + "companyName": "Paul Dedectivu", + "address": { + "addressLine1": "Address Line 1", + "city": "Birmingham", + "postalZipCode": "B6 Y2R", + "countryISOCode": "BD", + "telephone": "0756623125", + "email": "kainos@kainos.com" + }, + "tracesId": 10000008 + }, + "consignee": { + "id": "4d3ddb80-2a7d-4416-bc74-27ac3b17b258", + "type": "organisation branch address", + "status": "approved", + "companyName": "Herzog Inc 6c92D", + "individualName": "Kristina Larson", + "approvalNumber": "FBEFYT-594273", + "otherIdentifier": "ABP", + "address": { + "addressLine1": "21793 43Aq3", + "addressLine2": "0108 Desmond Radial Q7B1x", + "addressLine3": "Suite 455 K91s4", + "city": "North Gustavetown", + "postalZipCode": "14248", + "countryISOCode": "TK", + "ukTelephone": "442087521", + "internationalTelephone": { + "countryCode": "5", + "subscriberNumber": "185433" + }, + "email": "some@email.com" + }, + "tracesId": 10000135 + }, + "importer": { + "id": "4d3ddb80-2a7d-4416-bc74-27ac3b17b258", + "type": "organisation branch address", + "status": "approved", + "companyName": "Herzog Inc 6c92D", + "individualName": "Kristina Larson", + "approvalNumber": "FBEFYT-594273", + "otherIdentifier": "ABP", + "address": { + "addressLine1": "21793 43Aq3", + "addressLine2": "0108 Desmond Radial Q7B1x", + "addressLine3": "Suite 455 K91s4", + "city": "North Gustavetown", + "postalZipCode": "14248", + "countryISOCode": "TK", + "ukTelephone": "442087521", + "internationalTelephone": { + "countryCode": "5", + "subscriberNumber": "185433" + }, + "email": "some@email.com" + }, + "tracesId": 10000135 + }, + "placeOfDestination": { + "id": "4d3ddb80-2a7d-4416-bc74-27ac3b17b258", + "type": "organisation branch address", + "status": "approved", + "companyName": "Herzog Inc 6c92D", + "individualName": "Kristina Larson", + "approvalNumber": "FBEFYT-594273", + "otherIdentifier": "ABP", + "address": { + "addressLine1": "21793 43Aq3", + "addressLine2": "0108 Desmond Radial Q7B1x", + "addressLine3": "Suite 455 K91s4", + "city": "North Gustavetown", + "postalZipCode": "14248", + "countryISOCode": "TK", + "ukTelephone": "442087521", + "internationalTelephone": { + "countryCode": "5", + "subscriberNumber": "185433" + }, + "email": "some@email.com" + }, + "tracesId": 10000135 + }, + "commodities": { + "totalGrossWeight": 10, + "totalNetWeight": 2, + "numberOfPackages": 2, + "commodityComplement": [ + { + "commodityID": "08081080", + "commodityDescription": "Other", + "complementID": 62685, + "complementName": "Malus angustifolia", + "eppoCode": "MABAN", + "speciesID": "62685", + "speciesName": "Malus angustifolia", + "speciesClass": "62685", + "speciesNomination": "Malus angustifolia" + } + ], + "complementParameterSet": [ + { + "uniqueComplementID": "fd8a422b-4371-44a2-9693-6f6dbe26cc4b", + "complementID": 62685, + "speciesID": "62685", + "keyDataPair": [ + { + "key": "regulatory_authority", + "data": "PHSI" + }, + { + "key": "variety", + "data": "Golden Delicious" + }, + { + "key": "class", + "data": "CLASSI" + }, + { + "key": "type_product", + "data": "Budwood/scions" + }, + { + "key": "type_package", + "data": "Bag" + }, + { + "key": "netweight", + "data": "1" + }, + { + "key": "number_package", + "data": "1" + } + ] + }, + { + "uniqueComplementID": "aff9422c-f5ee-4785-b34a-588edb089940", + "complementID": 62685, + "speciesID": "62685", + "keyDataPair": [ + { + "key": "variety", + "data": "Coxes Orange Pippin" + }, + { + "key": "class", + "data": "CLASSI" + }, + { + "key": "regulatory_authority", + "data": "PHSI" + }, + { + "key": "type_product", + "data": "Budwood/scions" + }, + { + "key": "type_package", + "data": "Bag" + }, + { + "key": "netweight", + "data": "1" + }, + { + "key": "number_package", + "data": "1" + } + ] + } + ], + "includeNonAblactedAnimals": false, + "countryOfOrigin": "AF", + "consignedCountry": "AF" + }, + "purpose": { + "purposeGroup": "For Import" + }, + "pointOfEntry": "GBBXH4", + "pointOfEntryControlPoint": "INSPBHX2", + "arrivalDate": "2022-01-01", + "arrivalTime": "09:00:00", + "transporterDetailsRequired": false, + "meansOfTransport": {}, + "meansOfTransportFromEntryPoint": { + "id": "AB123", + "type": "Aeroplane", + "document": "Document" + }, + "submissionDate": "2021-02-17T10:58:51.464308Z", + "consignmentValidation": [ + { + "field": "uk/gov/defra/tracesx/notificationschema/representation/partone/", + "message": "ACCOMPANYING_DOCUMENTS:Add a phytosanitary certificate" + }, + { + "field": "uk/gov/defra/tracesx/notificationschema/representation/partone/commodities/", + "message": "Add the quantity" + }, + { + "field": "uk/gov/defra/tracesx/notificationschema/representation/partone/commodities/", + "message": "Add the quantity type" + }, + { + "field": "uk/gov/defra/tracesx/notificationschema/representation/partone/providectcmrn", + "message": "Select if using the Common Transit Convention (CTC)" + }, + { + "field": "uk/gov/defra/tracesx/notificationschema/representation/partone/isgvmsroute", + "message": "Select if using the Goods Vehicle Movement Service (GVMS)" + } + ], + "submittedBy": { + "displayName": "Percy Inspector-Tester", + "userId": "79f6dc68-2144-e911-a96a-000d3a29ba60" + }, + "complexCommoditySelected": true, + "contactDetails": { + "name": "Full Name", + "telephone": "0123456789", + "email": "name@example.com", + "agent": "Agent Name" + } + }, + "partTwo": { + "controlAuthority": { + "officialVeterinarian": { + "firstName": "Auto", + "lastName": "Cleared", + "email": "PlantHealth.Info@apha.gov.uk", + "phone": "0300 1000 313", + "signed": "2024-08-19T08:50:00.180947343" + } + }, + "commodityChecks": [ + { + "uniqueComplementId": "fd8a422b-4371-44a2-9693-6f6dbe26cc4b", + "checks": [ + { + "type": "PHSI_DOCUMENT", + "status": "Auto cleared", + "hasChecksComplete": true + }, + { + "type": "PHSI_IDENTITY", + "status": "Auto cleared", + "hasChecksComplete": true + }, + { + "type": "PHSI_PHYSICAL", + "status": "Auto cleared", + "hasChecksComplete": true + } + ] + }, + { + "uniqueComplementId": "aff9422c-f5ee-4785-b34a-588edb089940", + "checks": [ + { + "type": "PHSI_DOCUMENT", + "status": "Auto cleared", + "hasChecksComplete": true + }, + { + "type": "PHSI_IDENTITY", + "status": "Auto cleared", + "hasChecksComplete": true + }, + { + "type": "PHSI_PHYSICAL", + "status": "Auto cleared", + "hasChecksComplete": true + } + ] + } + ], + "phsiAutoCleared": true, + "hmiAutoCleared": true + }, + "etag": "0000000000028476", + "chedTypeVersion": 1 +} \ No newline at end of file diff --git a/TestDataGenerator/Scenarios/ScenarioFactory.cs b/TestDataGenerator/Scenarios/ScenarioFactory.cs index a8c0dd22..80981bca 100644 --- a/TestDataGenerator/Scenarios/ScenarioFactory.cs +++ b/TestDataGenerator/Scenarios/ScenarioFactory.cs @@ -17,7 +17,7 @@ public static class ScenarioFactory public static ScenarioConfig CreateScenarioConfig(this IHost app, int count, int creationDateRange, int arrivalDateRange = 30) where T : ScenarioGenerator { - if (count > 999999) + if (count > 100000) throw new ArgumentException( "Currently only deals with max 100,000 items. Check ImportNotificationBuilder WithReferenceNumber."); @@ -31,7 +31,7 @@ public static ScenarioConfig CreateScenarioConfig(this IHost app, int count, public static ScenarioConfig CreateScenarioConfig(T scenario, int count, int creationDateRange, int arrivalDateRange = 30) where T : ScenarioGenerator { - if (count > 999999) + if (count > 100000) throw new ArgumentException( "Currently only deals with max 100,000 items. Check ImportNotificationBuilder WithReferenceNumber."); diff --git a/TestDataGenerator/TestDataGenerator.csproj b/TestDataGenerator/TestDataGenerator.csproj index 255f4e82..247e9252 100644 --- a/TestDataGenerator/TestDataGenerator.csproj +++ b/TestDataGenerator/TestDataGenerator.csproj @@ -39,6 +39,8 @@ + + PreserveNewest @@ -54,6 +56,14 @@ PreserveNewest + + + PreserveNewest + + + + PreserveNewest +