Skip to content

Commit

Permalink
v1.0.1 release
Browse files Browse the repository at this point in the history
  • Loading branch information
CDR-AndrewG authored Aug 29, 2022
2 parents 35f26b4 + 8598cba commit bb98baa
Show file tree
Hide file tree
Showing 42 changed files with 821 additions and 801 deletions.
50 changes: 37 additions & 13 deletions .azuredevops/pipelines/build-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ steps:
dockerComposeFile: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source/docker-compose.IntegrationTests.yml
dockerComposeCommand: down

# Surface Integration tests TRX results to Devops
- task: PublishTestResults@2
displayName: 'Surface Integration tests TRX results to Devops'
condition: succeededOrFailed()
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/results.trx'
searchFolder: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source/_temp/mock-data-recipient-integration-tests/testresults
mergeTestResults: true
testRunTitle: 'mock-data-recipient-Integration-tests'
publishRunAttachments: true

# Run e2e tests
- task: DockerCompose@0
displayName: E2E tests - Up
Expand All @@ -171,6 +183,18 @@ steps:
dockerComposeFile: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source/docker-compose.E2ETests.yml
dockerComposeCommand: down

# Surface E2E tests TRX results to Devops
- task: PublishTestResults@2
displayName: 'Surface E2E tests TRX results to Devops'
condition: succeededOrFailed()
inputs:
testResultsFormat: 'VSTest'
testResultsFiles: '**/results.trx'
searchFolder: $(Build.SourcesDirectory)/sb-mock-data-recipient/Source/_temp/mock-data-recipient-e2e-tests/testresults
mergeTestResults: true
testRunTitle: 'mock-data-recipient-E2E-tests'
publishRunAttachments: true

# Save docker image to TAR so it can be published
- task: Docker@2
displayName: Save MockDataRecipient image to TAR
Expand Down Expand Up @@ -265,16 +289,16 @@ steps:
condition: always()
artifact: Database Migration Scripts

- task: PublishTestResults@2
displayName: 'Surface Integration Test TRX results to devops'
condition: succeededOrFailed()
inputs:
testResultsFormat: 'VSTest' # Options: JUnit, NUnit, VSTest, xUnit, cTest
testResultsFiles: '**/results.trx'
#searchFolder: '$(System.DefaultWorkingDirectory)' # Optional
#mergeTestResults: false # Optional
#failTaskOnFailedTests: false # Optional
#testRunTitle: # Optional
#buildPlatform: # Optional
#buildConfiguration: # Optional
#publishRunAttachments: true # Optional
# - task: PublishTestResults@2
# displayName: 'Surface Integration Test TRX results to devops'
# condition: succeededOrFailed()
# inputs:
# testResultsFormat: 'VSTest' # Options: JUnit, NUnit, VSTest, xUnit, cTest
# testResultsFiles: '**/results.trx'
# #searchFolder: '$(System.DefaultWorkingDirectory)' # Optional
# #mergeTestResults: false # Optional
# #failTaskOnFailedTests: false # Optional
# #testRunTitle: # Optional
# #buildPlatform: # Optional
# #buildConfiguration: # Optional
# #publishRunAttachments: true # Optional
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [1.0.0] - 2022-08-02
## [1.0.1] - 2022-08-30
### Changed
- Updated arrangement revocation to match CDS v1.18. Configuration added based on the date to make functionality available or unavailable.
- Updated side menu layout and text on screens.
- Updated package references.

### Fixed
- Fixed issue with Dynamic Client Registration Azure function not retrying for DCR Failed data holders.

## [1.0.0] - 2022-07-22
### Added
- Azure functions to perform Data Holder discovery by polling the Get Data Holder Brands API of the Register.

Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Commonwealth of Australia
Copyright (c) 2021 Commonwealth of Australia

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Consumer Data Right Logo](https://raw.githubusercontent.com/ConsumerDataRight/mock-data-recipient/main/cdr-logo.png)

[![Consumer Data Standards v1.16.0](https://img.shields.io/badge/Consumer%20Data%20Standards-v1.16.0-blue.svg)](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.16.0/#introduction)
[![Consumer Data Standards v1.17.0](https://img.shields.io/badge/Consumer%20Data%20Standards-v1.17.0-blue.svg)](https://consumerdatastandardsaustralia.github.io/standards/#introduction)
[![Conformance Test Suite 3.2](https://img.shields.io/badge/Conformance%20Test%20Suite-v3.2-darkblue.svg)](https://www.cdr.gov.au/for-providers/conformance-test-suite-data-recipients)
[![made-with-dotnet](https://img.shields.io/badge/Made%20with-.NET-1f425Ff.svg)](https://dotnet.microsoft.com/)
[![made-with-csharp](https://img.shields.io/badge/Made%20with-C%23-1f425Ff.svg)](https://docs.microsoft.com/en-us/dotnet/csharp/)
Expand All @@ -13,9 +13,9 @@ This project includes source code, documentation and instructions for a Consumer
This repository contains a mock implementation of a Mock Data Recipient and is offered to help the community in the development and testing of their CDR solutions.

## Mock Data Recipient - Alignment
The Mock Data Recipient aligns to [v1.16.0](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.16.0/#introduction) of the [Consumer Data Standards](https://consumerdatastandardsaustralia.github.io/standards/#introduction).
The Mock Data Recipient aligns to [v1.17.0](https://consumerdatastandardsaustralia.github.io/standards/#introduction) of the [Consumer Data Standards](https://consumerdatastandardsaustralia.github.io/standards/#introduction).
The Mock Data Recipient passed v3.2 of the [Conformance Test Suite for Data Recipients](https://www.cdr.gov.au/for-providers/conformance-test-suite-data-recipients).
The Mock Data Recipient can connect to and complete authentication against both [FAPI 1.0 Migration Phase 1 and Phase 2](https://consumerdatastandardsaustralia.github.io/standards-archives/standards-1.16.0/#authentication-flows) compliant data holders.
The Mock Data Recipient can connect to and complete authentication against both [FAPI 1.0 Migration Phase 1 and Phase 2](https://consumerdatastandardsaustralia.github.io/standards/#authentication-flows) compliant data holders.

## Getting Started
The Mock Data Recipient was built using the [Mock Register](https://github.com/ConsumerDataRight/mock-register), the [Mock Data Holder](https://github.com/ConsumerDataRight/mock-data-holder) and the [Mock Data Holder Energy](https://github.com/ConsumerDataRight/mock-data-holder-energy). You can swap out any of the Mock Data Holders, Mock Data Register and Mock Data Recipient solutions with a solution of your own.
Expand Down
2 changes: 1 addition & 1 deletion Source/CDR.DCR/CDR.DCR.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Azure.Storage.Queues" Version="12.9.0" />
<PackageReference Include="Azure.Storage.Queues" Version="12.11.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="4.0.5" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.0.1" />
Expand Down
33 changes: 24 additions & 9 deletions Source/CDR.DCR/DCR.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ public static class DynamicClientRegistrationFunction
[FunctionName("FunctionDCR")]
public static async Task DCR([QueueTrigger("dynamicclientregistration", Connection = "StorageConnectionString")] CloudQueueMessage myQueueItem, ILogger log, ExecutionContext context)
{
string msg = "";
string infosecBaseUri = "";
string regEndpoint = "";
string msg = string.Empty;
string dataHolderBrandName = string.Empty;
string infosecBaseUri = string.Empty;
string regEndpoint = string.Empty;

DcrQueueMessage myQMsg = JsonConvert.DeserializeObject<DcrQueueMessage>(myQueueItem.AsString);

try
{
var isLocalDev = Environment.GetEnvironmentVariable("AZURE_FUNCTIONS_ENVIRONMENT").Equals("Development");
Expand Down Expand Up @@ -98,9 +99,9 @@ public static async Task DCR([QueueTrigger("dynamicclientregistration", Connecti
{
var ssa = await GetSoftwareStatementAssertion(ssaEndpoint, xv, tokenResponse.Data.AccessToken, clientCertificate, brandId, softwareProductId, log, ignoreServerCertificateErrors);
if (ssa.IsSuccessful)
{
// DOES the Data Holder EXIST in the REPO?
DataHolderBrand dh = await new SqlDataAccess(dbConnString).GetDHBrandById(myQMsg.DataHolderBrandId);
{
//DOES the Data Holder Brand EXIST in the REPO?
DataHolderBrand dh = await new SqlDataAccess(dbConnString).GetDataHolderBrand(myQMsg.DataHolderBrandId);
if (dh == null)
{
// NO - DOES the DcrMessage exist?
Expand All @@ -115,12 +116,13 @@ public static async Task DCR([QueueTrigger("dynamicclientregistration", Connecti
MessageState = MessageEnum.DCRFailed.ToString(),
MessageError = $"{msg} - does not exist in the repo"
};
await new SqlDataAccess(dbConnString).UpdateDcrMsgReplaceMessageId(dcrMsg, myQueueItem.Id);
await new SqlDataAccess(dbConnString).UpdateDcrMsgReplaceMessageIdWithoutBrand(dcrMsg, myQueueItem.Id);
}
await InsertLog(log, dbConnString, $"{msg} - does not exist in the repo", "Error", "DCR");
}
else
{
dataHolderBrandName = dh.BrandName;
// YES - DOES a Registration already exist for the DataHolderBrandId in the local repo?
Guid clientId = await new SqlDataAccess(dbConnString).GetRegByDHBrandId(dh.DataHolderBrandId);
if (clientId == Guid.Empty)
Expand Down Expand Up @@ -164,6 +166,8 @@ public static async Task DCR([QueueTrigger("dynamicclientregistration", Connecti
{
ClientId = regClientId,
DataHolderBrandId = new Guid(dh.DataHolderBrandId),
BrandName = dh.BrandName,
InfosecBaseUri = infosecBaseUri,
MessageState = MessageEnum.DCRComplete.ToString()
};
await new SqlDataAccess(dbConnString).UpdateDcrMsgByDHBrandId(dcrMsg);
Expand All @@ -182,6 +186,8 @@ public static async Task DCR([QueueTrigger("dynamicclientregistration", Connecti
DcrMessage dcrMsg = new()
{
DataHolderBrandId = new Guid(dh.DataHolderBrandId),
BrandName = dh.BrandName,
InfosecBaseUri = infosecBaseUri,
MessageState = MessageEnum.DCRFailed.ToString(),
MessageError = $"StatusCode: {regStatusCode}, {regMessage}"
};
Expand All @@ -195,6 +201,8 @@ public static async Task DCR([QueueTrigger("dynamicclientregistration", Connecti
DcrMessage dcrMsg = new()
{
DataHolderBrandId = new Guid(myQMsg.DataHolderBrandId),
BrandName = dh.BrandName,
InfosecBaseUri = infosecBaseUri,
MessageState = MessageEnum.DCRFailed.ToString(),
MessageError = "OidcDiscovery failed InfosecBaseUri: " + infosecBaseUri
};
Expand Down Expand Up @@ -233,6 +241,8 @@ public static async Task DCR([QueueTrigger("dynamicclientregistration", Connecti
DcrMessage dcrMsg = new()
{
DataHolderBrandId = new Guid(myQMsg.DataHolderBrandId),
BrandName = dataHolderBrandName,
InfosecBaseUri = infosecBaseUri,
MessageState = MessageEnum.DCRFailed.ToString(),
MessageError = ex.Message
};
Expand All @@ -245,7 +255,12 @@ public static async Task DCR([QueueTrigger("dynamicclientregistration", Connecti
if (!string.IsNullOrEmpty(regEndpoint))
extraMsg = " - RegistrationEndpoint: " + regEndpoint;

await InsertLog(log, dbLoggingConnString, $"{msg}, REGISTRATION FAILED{extraMsg}", "Exception", "DCR", ex);
if (ex is JsonReaderException)
{
await InsertLog(log, dbLoggingConnString, $"{msg}, REGISTRATION FAILED: OidcDiscovery can't be desiearlized {extraMsg}", "Exception", "DCR", ex);
}
else
await InsertLog(log, dbLoggingConnString, $"{msg}, REGISTRATION FAILED{extraMsg}", "Exception", "DCR", ex);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public class AATestPlaywrightInstallation : BaseTest_v2, IClassFixture<TestFixtu
[Fact]
public async Task ShouldDisplayGoogleHomePage()
{
await Task.Delay(10000); // FIXME - MJS - This test sometimes just fails in build pipeline with error about google hanging up the connection, maybe just need to give the network a little extra time to get ready?

await TestAsync($"{nameof(AATestPlaywrightInstallation)} - {nameof(ShouldDisplayGoogleHomePage)}", async (page) =>
{
// Act - Goto Google.com
Expand Down
4 changes: 3 additions & 1 deletion Source/CDR.DataRecipient.E2ETests/BaseTest_v2.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// #define TEST_DEBUG_MODE // Run Playwright in non-headless mode for debugging purposes (ie show a browser)
#define TEST_DEBUG_MODE // Run Playwright in non-headless mode for debugging purposes (ie show a browser)

// In docker (Ubuntu container) Playwright will fail if running in non-headless mode, so we ensure TEST_DEBUG_MODE is undef'ed
#if !DEBUG
Expand Down Expand Up @@ -28,6 +28,8 @@ namespace CDR.DataRecipient.E2ETests
[DisplayTestMethodName]
public class BaseTest_v2
{
static public bool RUNNING_IN_CONTAINER => Environment.GetEnvironmentVariable("DOTNET_RUNNING_IN_CONTAINER")?.ToUpper() == "TRUE";

// Customers
public const string CUSTOMERID_BANKING = "jwilson";
public const string CUSTOMERACCOUNTS_BANKING = "Personal Loan xxx-xxx xxxxx987,Transactions and Savings Account xxx-xxx xxxxx988";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
<Version>1.0.0</Version>
<FileVersion>1.0.0</FileVersion>
<AssemblyVersion>1.0.0</AssemblyVersion>
<Version>1.0.1</Version>
<FileVersion>1.0.1</FileVersion>
<AssemblyVersion>1.0.1</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand All @@ -29,13 +29,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.4.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.2" />
<PackageReference Include="FluentAssertions" Version="6.7.0" />
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.7" />
<PackageReference Include="Microsoft.Data.SqlClient" Version="4.1.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="Microsoft.Playwright" Version="1.18.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="Microsoft.Playwright" Version="1.24.1" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
10 changes: 7 additions & 3 deletions Source/CDR.DataRecipient.E2ETests/Fixtures/TestFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ public class TestFixture : IAsyncLifetime
{
public Task InitializeAsync()
{
// Ensure that Playwright has been fully installed.
Microsoft.Playwright.Program.Main(new string[] { "install" });
Microsoft.Playwright.Program.Main(new string[] { "install-deps" });
// Only install Playwright if not running in container, since Dockerfile.e2e-tests already installed Playwright
if (!BaseTest_v2.RUNNING_IN_CONTAINER)
{
// Ensure that Playwright has been fully installed.
Microsoft.Playwright.Program.Main(new string[] { "install" });
Microsoft.Playwright.Program.Main(new string[] { "install-deps" });
}

return Task.CompletedTask;
}
Expand Down
Loading

0 comments on commit bb98baa

Please sign in to comment.