Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/merge to release #96

Open
wants to merge 61 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
6a169c9
Update CODEOWNERS
MirelaGeorgiou Sep 24, 2021
1b64bc2
WIP: Consume Nuget package
humulla Oct 20, 2021
7ce34b1
Consume NuGet package
humulla Oct 20, 2021
ac704d1
Solved issue with tests
humulla Oct 20, 2021
15e41e0
Updated package
humulla Oct 21, 2021
6c33c4f
Merge pull request #61 from LBHackney-IT/TL-260
humulla Oct 22, 2021
1307e09
added CW dashboard (#62)
charnjitsohal1 Oct 27, 2021
eade5c2
Fix error (#64)
charnjitsohal1 Oct 27, 2021
a44201b
increase node count to fix yellow status (#66)
charnjitsohal1 Oct 29, 2021
7a7f3b5
increased instance count for staging (#67)
charnjitsohal1 Nov 4, 2021
f205a0b
Updated package
evak6979 Nov 8, 2021
a8de997
Merge pull request #69 from LBHackney-IT/TL_340
evak6979 Nov 8, 2021
a3fc25b
change to use regional API gateway endpoint (#70)
charnjitsohal1 Nov 8, 2021
ca19dfe
revert change to regional api (#71)
charnjitsohal1 Nov 8, 2021
69f433b
Account Elastic Search
HHjolany Nov 8, 2021
cf0159b
rebase from master
HHjolany Nov 9, 2021
339d301
Merge branch 'master' of https://github.com/LBHackney-IT/housing-sear…
HHjolany Nov 9, 2021
1944dac
Revert "Merge branch 'master' of https://github.com/LBHackney-IT/hous…
HHjolany Nov 9, 2021
f3590dc
Revert "rebase from master"
HHjolany Nov 9, 2021
2dc851d
Revert "Account Elastic Search"
HHjolany Nov 9, 2021
9b5e795
revert to edge endpoint (#72)
charnjitsohal1 Nov 9, 2021
7e784ec
Account handler for elastic search added
HHjolany Nov 9, 2021
4fd3547
shared library changes affects
HHjolany Nov 10, 2021
a70a003
added Terraform Compliance checks (#75)
charnjitsohal1 Nov 11, 2021
e7b0894
Fix test (#76)
charnjitsohal1 Nov 11, 2021
5152024
comment out all tests except 1 (#77)
charnjitsohal1 Nov 11, 2021
ee61eea
Localhost url changed to net url
HHjolany Nov 12, 2021
aa60704
fixed error (#78)
charnjitsohal1 Nov 12, 2021
9714712
fixing format
HHjolany Nov 12, 2021
85c609a
net url replaced with localhost
HHjolany Nov 13, 2021
5a92b76
some file located to correct places
HHjolany Nov 13, 2021
7379a03
fixing format
HHjolany Nov 13, 2021
f58964c
Capitalization the namespaces and fixing format
HHjolany Nov 16, 2021
96bd137
Finance domain asset search sets page by page
Nov 19, 2021
48009a1
Handle Out Range Page Number
Nov 19, 2021
d7e1ba0
Making HousingSearchRequest as abstract
HHjolany Nov 22, 2021
69db486
Fixed Code Formatting
Nov 23, 2021
3847455
Merge pull request #79 from LBHackney-IT/account-api-gsi-reversal
HHjolany Nov 23, 2021
dbd4f62
Format fixing
HHjolany Nov 24, 2021
0dcd552
vpc changed in terraform
HHjolany Nov 24, 2021
f35052d
Terraform changes
HHjolany Nov 24, 2021
55cbf6e
Merge pull request #82 from LBHackney-IT/account-api-gsi-reversal
HHjolany Nov 24, 2021
c962d3b
Bug fixed
HHjolany Nov 24, 2021
e20cd82
Fluent validator added
HHjolany Nov 24, 2021
778e157
Format Fixing
HHjolany Nov 24, 2021
f0a4775
Some local configuration removed
HHjolany Nov 24, 2021
2f228d5
Merge pull request #83 from LBHackney-IT/account-api-gsi-reversal-v2
HHjolany Nov 25, 2021
0273689
updating the package version
Nov 26, 2021
8be7adf
Merge pull request #84 from LBHackney-IT/feature/MTTL-2071
amidomichael Nov 26, 2021
ebe9e48
Merge pull request #51 from LBHackney-IT/update-codeowners
MirelaGeorgiou Nov 26, 2021
dd38dfa
Added LastHitId in AllAssets Response and Request
Nov 26, 2021
52b1e83
Removed commented line
Nov 26, 2021
0360fbf
Fixed Code Formatting
Nov 26, 2021
07515c7
Add transactions search (#74)
AnnaGolosova Nov 27, 2021
cf4c90b
Merge branch 'master' into HousingFinanceSearch
sandipchandra Nov 29, 2021
545dbdd
Merge pull request #81 from LBHackney-IT/HousingFinanceSearch
sandipchandra Nov 29, 2021
418c0d0
Rename Person model to Sender (#88)
AnnaGolosova Nov 30, 2021
962514c
FIxed Housing Finance Transaction Search (#92)
sandipchandra Dec 1, 2021
4689f19
Add start and end dates to transactions (#94)
AnnaGolosova Dec 3, 2021
d468023
merging from master to release
Dec 3, 2021
a21a879
merging master
Dec 3, 2021
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
10 changes: 7 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,10 @@ jobs:
workflows:
check-and-deploy-development:
jobs:
- check-code-formatting
- build-and-test
- check-code-formatting:
context: api-nuget-token-context
- build-and-test:
context: api-nuget-token-context
- assume-role-development:
context: api-assume-role-housing-development-context
requires:
Expand Down Expand Up @@ -266,8 +268,10 @@ workflows:
only: master
check-and-deploy-staging-and-production:
jobs:
- check-code-formatting
- check-code-formatting:
context: api-nuget-token-context
- build-and-test:
context: api-nuget-token-context
filters:
branches:
only: release
Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
# @global-owner1 and @global-owner2 will be requested for
# review when someone opens a pull request.

* @LBHMGeorgieva @LBHMKeyworth @LBHSPreston @LBHRShetty @mtfh-manage-my-home
* @LBHMGeorgieva @LBHMKeyworth @LBHSPreston @LBHRShetty @LBHackney-IT/mtfh-manage-my-home
6 changes: 1 addition & 5 deletions HousingSearchApi.Tests/HousingSearchApi.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,18 @@
<ItemGroup>
<Compile Remove="TestResults\**" />
<Compile Remove="V1\Domain\**" />
<Compile Remove="V1\Factories\**" />
<Compile Remove="V1\Gateways\**" />
<Compile Remove="V1\UseCase\**" />
<Content Remove="TestResults\**" />
<Content Remove="V1\Domain\**" />
<Content Remove="V1\Factories\**" />
<Content Remove="V1\Gateways\**" />
<Content Remove="V1\UseCase\**" />
<EmbeddedResource Remove="TestResults\**" />
<EmbeddedResource Remove="V1\Domain\**" />
<EmbeddedResource Remove="V1\Factories\**" />
<EmbeddedResource Remove="V1\Gateways\**" />
<EmbeddedResource Remove="V1\UseCase\**" />
<None Remove="TestResults\**" />
<None Remove="V1\Domain\**" />
<None Remove="V1\Factories\**" />
<None Remove="V1\Gateways\**" />
<None Remove="V1\UseCase\**" />
</ItemGroup>
Expand All @@ -49,7 +45,7 @@
<PackageReference Include="Docker.DotNet" Version="3.125.4" />
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Hackney.Core.ElasticSearch" Version="1.45.0" />
<PackageReference Include="Hackney.Shared.HousingSearch" Version="0.6.0" />
<PackageReference Include="Hackney.Shared.HousingSearch" Version="0.19.0" />
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="3.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="3.1.4" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.1.3" />
Expand Down
2 changes: 1 addition & 1 deletion HousingSearchApi.Tests/MockWebApplicationFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using HousingSearchApi.V1.Infrastructure;
using HousingSearchApi.V1.Infrastructure.Extensions;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;
using Microsoft.Extensions.Configuration;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ public GetPersonListRequestValidatorTests()
_sut = new HousingSearchRequestValidator();
}

private static HousingSearchRequest CreateValidRequest()
private static GetPersonListRequest CreateValidRequest()
{
return new HousingSearchRequest()
return new GetPersonListRequest()
{
SearchText = "Some search text"
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@
namespace HousingSearchApi.Tests.V1.Controllers
{
[Collection("LogCall collection")]
public class GetTenureListControllerTests
public class GetAssetListControllerTests
{
private readonly Mock<IGetAssetListUseCase> _mockGetAssetListUseCase;
private readonly Mock<IGetAssetListSetsUseCase> _mockGetAssetListSetsUseCase;
private readonly GetAssetListController _classUnderTest;

public GetTenureListControllerTests()
public GetAssetListControllerTests()
{
new LogCallAspectFixture().RunBeforeTests();

_mockGetAssetListUseCase = new Mock<IGetAssetListUseCase>();
_classUnderTest = new GetAssetListController(_mockGetAssetListUseCase.Object);
_mockGetAssetListSetsUseCase = new Mock<IGetAssetListSetsUseCase>();
_classUnderTest = new GetAssetListController(_mockGetAssetListUseCase.Object, _mockGetAssetListSetsUseCase.Object);
}

[Fact]
public async Task GetTenureListShouldCallGetTenureListUseCase()
public async Task GetAssetListShouldCallGetAssetListUseCase()
{
// given
var request = new HousingSearchRequest();
var request = new GetAssetListRequest();
var response = new GetAssetListResponse();
_mockGetAssetListUseCase.Setup(x => x.ExecuteAsync(request)).ReturnsAsync(response);

Expand All @@ -36,5 +38,19 @@ public async Task GetTenureListShouldCallGetTenureListUseCase()
// then
_mockGetAssetListUseCase.Verify(x => x.ExecuteAsync(request), Times.Once);
}
[Fact]
public async Task GetAssetListSetsShouldCallGetAssetListSetsUseCase()
{
// given
var request = new GetAllAssetListRequest();
var response = new GetAllAssetListResponse();
_mockGetAssetListSetsUseCase.Setup(x => x.ExecuteAsync(request)).ReturnsAsync(response);

// when
await _classUnderTest.GetAllAssetList(request).ConfigureAwait(false);

// then
_mockGetAssetListSetsUseCase.Verify(x => x.ExecuteAsync(request), Times.Once);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@
namespace HousingSearchApi.Tests.V1.Controllers
{
[Collection("LogCall collection")]
public class GetAssetListControllerTests
public class GetTenureListControllerTests
{
private readonly Mock<IGetAssetListUseCase> _mockGetAssetListUseCase;
private readonly GetAssetListController _classUnderTest;
private readonly Mock<IGetTenureListUseCase> _mockGetTenureListUseCase;
private readonly GetTenureListController _classUnderTest;


public GetAssetListControllerTests()
public GetTenureListControllerTests()
{
new LogCallAspectFixture().RunBeforeTests();

_mockGetAssetListUseCase = new Mock<IGetAssetListUseCase>();
_classUnderTest = new GetAssetListController(_mockGetAssetListUseCase.Object);
_mockGetTenureListUseCase = new Mock<IGetTenureListUseCase>();
_classUnderTest = new GetTenureListController(_mockGetTenureListUseCase.Object);
}

[Fact]
public async Task GetAssetListShouldCallGetAssetListUseCase()
public async Task GetTenureListShouldCallGetTenureListUseCase()
{
// given
var request = new HousingSearchRequest();
var response = new GetAssetListResponse();
_mockGetAssetListUseCase.Setup(x => x.ExecuteAsync(request)).ReturnsAsync(response);
var request = new GetTenureListRequest();
var response = new GetTenureListResponse();
_mockGetTenureListUseCase.Setup(x => x.ExecuteAsync(request)).ReturnsAsync(response);

// when
await _classUnderTest.GetAssetList(request).ConfigureAwait(false);
await _classUnderTest.GetTenureList(request).ConfigureAwait(false);

// then
_mockGetAssetListUseCase.Verify(x => x.ExecuteAsync(request), Times.Once);
_mockGetTenureListUseCase.Verify(x => x.ExecuteAsync(request), Times.Once);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
using FluentAssertions;
using HousingSearchApi.V1.Boundary.Requests;
using HousingSearchApi.V1.Boundary.Responses.Metadata;
using HousingSearchApi.V1.Boundary.Responses.Transactions;
using HousingSearchApi.V1.Controllers;
using HousingSearchApi.V1.UseCase.Interfaces;
using Microsoft.AspNetCore.Mvc;
using Moq;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;

namespace HousingSearchApi.Tests.V1.Controllers
{
[Collection("LogCall collection")]
public class GetTransactionListControllerTests
{
private readonly Mock<IGetTransactionListUseCase> _mockGetTransactionListUseCase;
private readonly GetTransactionListController _classUnderTest;

public GetTransactionListControllerTests()
{
new LogCallAspectFixture().RunBeforeTests();

_mockGetTransactionListUseCase = new Mock<IGetTransactionListUseCase>();
_classUnderTest = new GetTransactionListController(_mockGetTransactionListUseCase.Object);
}

[Fact]
public async Task GetTransactionListReturnsOk()
{
const int transactionsCount = 10;
var request = new GetTransactionListRequest();
var response = GetTransactionListResponse.Create(transactionsCount, new List<TransactionResponse>());

_mockGetTransactionListUseCase
.Setup(x => x.ExecuteAsync(request))
.ReturnsAsync(response);

var controllerResponse = await _classUnderTest.GetTransactionList(request).ConfigureAwait(false);

_mockGetTransactionListUseCase.Verify(x => x.ExecuteAsync(request), Times.Once);

var okObjectResult = controllerResponse as OkObjectResult;
okObjectResult.Should().NotBeNull();
okObjectResult.Value.Should().NotBeNull();

var apiResponse = okObjectResult.Value as APIResponse<GetTransactionListResponse>;
apiResponse.Should().NotBeNull();

apiResponse.Results.Should().BeEquivalentTo(response);
apiResponse.Total.Should().Be(transactionsCount);
}

[Fact]
public async Task GetTransactionListThrowsIfUseCaseReturnsNull()
{
var request = new GetTransactionListRequest();

_mockGetTransactionListUseCase
.Setup(x => x.ExecuteAsync(request))
.Throws(new Exception("Some error"));

var controllerResponse = await _classUnderTest.GetTransactionList(request).ConfigureAwait(false);

_mockGetTransactionListUseCase.Verify(x => x.ExecuteAsync(request), Times.Once);

var objectResult = controllerResponse as BadRequestObjectResult;
objectResult.Should().NotBeNull();
objectResult.Value.Should().Be("Some error");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@ protected void EnsureEnvVarConfigured(string name, string defaultValue)
_elasticSearchAddress = default;
}
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace HousingSearchApi.Tests.V1.E2ETests.Fixtures
{
public class PersonsFixture : BaseFixture
{
public List<QueryablePerson> Persons { get; private set; }
private const string INDEX = "persons";
public static string[] Alphabet = { "aa", "bb", "cc", "dd", "ee", "vv", "ww", "xx", "yy", "zz" };

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Nest;
using System.Net.Http;
using System.Threading;
using AutoFixture;
using Elasticsearch.Net;
using Hackney.Shared.HousingSearch.Gateways.Models.Transactions;

namespace HousingSearchApi.Tests.V1.E2ETests.Fixtures
{
public class TransactionsFixture : BaseFixture
{
private const string IndexName = "transactions";
private const int SendersCount = 5;

private static readonly Fixture _fixture = new Fixture();

public static List<QueryableSender> Senders { get; } = CreateSendersData(SendersCount);

public TransactionsFixture(IElasticClient elasticClient, HttpClient httpHttpClient) : base(elasticClient, httpHttpClient)
{
WaitForESInstance();
}

private static List<QueryableSender> CreateSendersData(int personsCount)
{
return _fixture.CreateMany<QueryableSender>(personsCount).ToList();
}

public void GivenAnAssetIndexExists()
{
ElasticSearchClient.Indices.Delete(IndexName);

if (ElasticSearchClient.Indices.Exists(Indices.Index(IndexName)).Exists)
{
return;
}

// ToDo: add transactionsIndex to the folder
var assetSettingsDoc = File.ReadAllTextAsync("./data/elasticsearch/transactionsIndex.json").Result;
ElasticSearchClient.LowLevel.Indices.CreateAsync<BytesResponse>(IndexName, assetSettingsDoc)
.ConfigureAwait(true);

var transactions = CreateTransactionsData(20);
var awaitable = ElasticSearchClient.IndexManyAsync(transactions, IndexName).ConfigureAwait(true);

while (!awaitable.GetAwaiter().IsCompleted) { }

Thread.Sleep(5000);
}

private List<QueryableTransaction> CreateTransactionsData(int transactionsCount)
{
var listOfTransactions = new List<QueryableTransaction>(transactionsCount);
var random = new Random();

for (var i = 0; i < transactionsCount; i++)
{
var personIndex = random.Next(SendersCount);

var transaction = _fixture.Create<QueryableTransaction>();
transaction.Sender = Senders[personIndex];

listOfTransactions.Add(transaction);
}

return listOfTransactions;
}
}
}
29 changes: 29 additions & 0 deletions HousingSearchApi.Tests/V1/E2ETests/Steps/Base/BaseSteps.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
using System;
using System.Net;
using System.Net.Http;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using FluentAssertions;

namespace HousingSearchApi.Tests.V1.E2ETests.Steps.Base
{
Expand All @@ -27,5 +31,30 @@ protected JsonSerializerOptions CreateJsonOptions()
options.Converters.Add(new JsonStringEnumConverter());
return options;
}

public async Task ThenTheLastRequestShouldBeBadRequestResult(string expectedErrorMessage = null)
{
_lastResponse.StatusCode.Should().Be(HttpStatusCode.BadRequest);

if (expectedErrorMessage != null)
{
var resultBody = await _lastResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

resultBody.Should().NotBeNull();
resultBody.Should().Contain(expectedErrorMessage);
}
}

public async Task ThenTheLastRequestShouldBe200()
{
if (_lastResponse.StatusCode != HttpStatusCode.OK)
{
var resultBody = await _lastResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

resultBody.Should().NotBeNull();
throw new Exception(resultBody);
}
_lastResponse.StatusCode.Should().Be(HttpStatusCode.OK);
}
}
}
Loading