Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
rasmus committed Aug 7, 2018
2 parents c765ba2 + 0171091 commit 6116b56
Show file tree
Hide file tree
Showing 57 changed files with 2,483 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ _TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover

# AxoCover is a Code Coverage Tool
.axoCover/

# NCrunch
_NCrunch_*
.*crunch*.local.xml
Expand Down Expand Up @@ -198,3 +201,6 @@ FakesAssemblies/

# JetBrains Rider
/.idea

# Git commit history
/-la
17 changes: 17 additions & 0 deletions EventFlow.sln
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.AspNetCore", "Sou
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.AspNetCore.Tests", "Source\EventFlow.AspNetCore.Tests\EventFlow.AspNetCore.Tests.csproj", "{C16B0B27-6E6C-439C-8419-488B2D4D798F}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PostgreSql", "PostgreSql", "{8611714D-5901-4D85-ACA3-8B984F591BDD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.PostgreSql", "Source\EventFlow.PostgreSql\EventFlow.PostgreSql.csproj", "{1400DAC5-118E-41D3-A20C-F4F8648BC5BF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.PostgreSql.Tests", "Source\EventFlow.PostgreSql.Tests\EventFlow.PostgreSql.Tests.csproj", "{6C47746E-8F5D-4DA9-BBD1-17ECEE57F8CB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.DependencyInjection", "Source\EventFlow.DependencyInjection\EventFlow.DependencyInjection.csproj", "{7870461F-BA5B-4198-A85E-03BA555198AD}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventFlow.DependencyInjection.Tests", "Source\EventFlow.DependencyInjection.Tests\EventFlow.DependencyInjection.Tests.csproj", "{28CA7AD8-6A73-454C-ABF4-26B24D986C85}"
Expand Down Expand Up @@ -193,6 +199,14 @@ Global
{C16B0B27-6E6C-439C-8419-488B2D4D798F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C16B0B27-6E6C-439C-8419-488B2D4D798F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C16B0B27-6E6C-439C-8419-488B2D4D798F}.Release|Any CPU.Build.0 = Release|Any CPU
{1400DAC5-118E-41D3-A20C-F4F8648BC5BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1400DAC5-118E-41D3-A20C-F4F8648BC5BF}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1400DAC5-118E-41D3-A20C-F4F8648BC5BF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1400DAC5-118E-41D3-A20C-F4F8648BC5BF}.Release|Any CPU.Build.0 = Release|Any CPU
{6C47746E-8F5D-4DA9-BBD1-17ECEE57F8CB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6C47746E-8F5D-4DA9-BBD1-17ECEE57F8CB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6C47746E-8F5D-4DA9-BBD1-17ECEE57F8CB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6C47746E-8F5D-4DA9-BBD1-17ECEE57F8CB}.Release|Any CPU.Build.0 = Release|Any CPU
{7870461F-BA5B-4198-A85E-03BA555198AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7870461F-BA5B-4198-A85E-03BA555198AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7870461F-BA5B-4198-A85E-03BA555198AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -231,6 +245,9 @@ Global
{EFDD4B74-E69A-4F4F-80F4-DC8F32CD76A5} = {980EEDAA-1FEF-4D7C-8811-5EF1D9729773}
{9D57E096-AA8E-40E5-A1CC-32C07B425850} = {3A34F6A2-64B0-4730-A0EB-D324BC755538}
{C16B0B27-6E6C-439C-8419-488B2D4D798F} = {3A34F6A2-64B0-4730-A0EB-D324BC755538}
{8611714D-5901-4D85-ACA3-8B984F591BDD} = {92F3C263-8C0C-4D12-B41A-452E48D2E5E8}
{1400DAC5-118E-41D3-A20C-F4F8648BC5BF} = {8611714D-5901-4D85-ACA3-8B984F591BDD}
{6C47746E-8F5D-4DA9-BBD1-17ECEE57F8CB} = {8611714D-5901-4D85-ACA3-8B984F591BDD}
{7870461F-BA5B-4198-A85E-03BA555198AD} = {E2DD51BC-974B-4526-961B-825913911FFB}
{28CA7AD8-6A73-454C-ABF4-26B24D986C85} = {E2DD51BC-974B-4526-961B-825913911FFB}
EndGlobalSection
Expand Down
6 changes: 5 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
### New in 0.62 (not released yet)
### New in 0.63 (not released yet)

* New: PostgreSQL support in the form of the new `EventFlow.PostgreSql` NuGet package

### New in 0.62.3569 (eleased 2018-07-05)

* New: Created `AggregateReadStoreManager<,,,>` which is a new read store manager
for read models that have a 1-to-1 relation with an aggregate. If read models get
Expand Down
2 changes: 1 addition & 1 deletion Source/EventFlow.MsSql/EventFlow.MsSql.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="dbup-sqlserver" Version="4.0.0" />
<PackageReference Include="dbup-sqlserver" Version="4.1.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EventFlow.Sql\EventFlow.Sql.csproj" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../Common.props" />
<PropertyGroup>
<TargetFramework>net451</TargetFramework>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<GenerateAssemblyInfo>False</GenerateAssemblyInfo>
</PropertyGroup>
<ItemGroup>
<None Remove="IntegrationTests\ReadStores\Scripts\0001 - Create table ReadModel-ThingyAggregate.sql" />
<None Remove="IntegrationTests\ReadStores\Scripts\0002 - Create table ReadModel-ThingyMessage.sql" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="IntegrationTests\ReadStores\Scripts\0001 - Create table ReadModel-ThingyAggregate.sql" />
<EmbeddedResource Include="IntegrationTests\ReadStores\Scripts\0002 - Create table ReadModel-ThingyMessage.sql" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EventFlow.PostgreSql\EventFlow.PostgreSql.csproj" />
<ProjectReference Include="..\EventFlow.TestHelpers\EventFlow.TestHelpers.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.ComponentModel.DataAnnotations" />
</ItemGroup>
<ItemGroup>
<Service Include="{82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// The MIT License (MIT)
//
// Copyright (c) 2015-2018 Rida Messaoudene
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using System.Linq;

using EventFlow.PostgreSql.EventStores;
using EventFlow.TestHelpers;

using FluentAssertions;

using NUnit.Framework;

namespace EventFlow.PostgreSql.Tests.IntegrationTests.EventStores
{
[Category(Categories.Integration)]
public class EventFlowEventStoresPostgreSqlTests
{
[Test]
public void GetSqlScripts()
{
// Act
var sqlScripts = EventFlowEventStoresPostgreSql.GetSqlScripts().ToDictionary(s => s.Name, s => s);

// Assert
sqlScripts.Should().HaveCount(2);
sqlScripts.Should().ContainKey("EventStores.Scripts.0001 - Create table EventFlow.sql");
sqlScripts.Should().ContainKey("EventStores.Scripts.0002 - Create eventdatamodel_list_type.sql");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// The MIT License (MIT)
//
// Copyright (c) 2015-2018 Rida Messaoudene
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using EventFlow.Configuration;
using EventFlow.Extensions;
using EventFlow.PostgreSql.Connections;
using EventFlow.PostgreSql.EventStores;
using EventFlow.PostgreSql.Extensions;
using EventFlow.PostgreSql.TestsHelpers;
using EventFlow.TestHelpers;
using EventFlow.TestHelpers.Suites;

using NUnit.Framework;

namespace EventFlow.PostgreSql.Tests.IntegrationTests.EventStores
{
[Category(Categories.Integration)]
public class PostgreSqlEventStoreTests : TestSuiteForEventStore
{
private IPostgreSqlDatabase _testDatabase;

protected override IRootResolver CreateRootResolver(IEventFlowOptions eventFlowOptions)
{
_testDatabase = PostgreSqlHelpz.CreateDatabase("eventflow");

var resolver = eventFlowOptions
.ConfigurePostgreSql(PostgreSqlConfiguration.New.SetConnectionString(_testDatabase.ConnectionString.Value))
.UseEventStore<PostgreSqlEventPersistence>()
.CreateResolver();

var databaseMigrator = resolver.Resolve<IPostgreSqlDatabaseMigrator>();
EventFlowEventStoresPostgreSql.MigrateDatabase(databaseMigrator);
databaseMigrator.MigrateDatabaseUsingEmbeddedScripts(GetType().Assembly);

return resolver;
}

[TearDown]
public void TearDown()
{
_testDatabase.Dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// The MIT License (MIT)
//
// Copyright (c) 2015-2018 Rida Messaoudene
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using System.Linq;

using EventFlow.Extensions;
using EventFlow.PostgreSql.EventStores;
using EventFlow.PostgreSql.TestsHelpers;
using EventFlow.TestHelpers;

using NUnit.Framework;

namespace EventFlow.PostgreSql.Tests.IntegrationTests.EventStores
{
[Category(Categories.Integration)]
public class PostgreSqlScriptsTests
{
private IPostgreSqlDatabase _postgreSqlDatabase;

[Test]
public void SqlScriptsAreIdempotent()
{
// Arrange
var sqlScripts = EventFlowEventStoresPostgreSql.GetSqlScripts().ToList();

// Act
foreach (var _ in Enumerable.Range(0, 2))
{
foreach (var sqlScript in sqlScripts)
{
_postgreSqlDatabase.Execute(sqlScript.Content);
}
}
}

[SetUp]
public void SetUp()
{
_postgreSqlDatabase = PostgreSqlHelpz.CreateDatabase("eventflow");
}

public void TearDown()
{
_postgreSqlDatabase.DisposeSafe("Postgre database");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// The MIT License (MIT)
//
// Copyright (c) 2015-2018 Rida Messaoudene
// https://github.com/eventflow/EventFlow
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
// the Software, and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

using System;

using EventFlow.Configuration;
using EventFlow.Extensions;
using EventFlow.PostgreSql.Connections;
using EventFlow.PostgreSql.EventStores;
using EventFlow.PostgreSql.Extensions;
using EventFlow.PostgreSql.Tests.IntegrationTests.ReadStores.QueryHandlers;
using EventFlow.PostgreSql.Tests.IntegrationTests.ReadStores.ReadModels;
using EventFlow.PostgreSql.TestsHelpers;
using EventFlow.TestHelpers;
using EventFlow.TestHelpers.Aggregates.Entities;
using EventFlow.TestHelpers.Suites;

using NUnit.Framework;

namespace EventFlow.PostgreSql.Tests.IntegrationTests.ReadStores
{
[Category(Categories.Integration)]
public class PostgreSqlReadModelStoreTests : TestSuiteForReadModelStore
{
protected override Type ReadModelType { get; } = typeof(PostgreSqlThingyReadModel);

private IPostgreSqlDatabase _testDatabase;

protected override IRootResolver CreateRootResolver(IEventFlowOptions eventFlowOptions)
{
_testDatabase = PostgreSqlHelpz.CreateDatabase("eventflow");

var resolver = eventFlowOptions
.RegisterServices(sr => sr.RegisterType(typeof(ThingyMessageLocator)))
.ConfigurePostgreSql(PostgreSqlConfiguration.New.SetConnectionString(_testDatabase.ConnectionString.Value))
.UsePostgreSqlReadModel<PostgreSqlThingyReadModel>()
.UsePostgreSqlReadModel<PostgreSqlThingyMessageReadModel, ThingyMessageLocator>()
.AddQueryHandlers(
typeof(PostgreSqlThingyGetQueryHandler),
typeof(PostgreSqlThingyGetVersionQueryHandler),
typeof(PostgreSqlThingyGetMessagesQueryHandler))
.CreateResolver();

var databaseMigrator = resolver.Resolve<IPostgreSqlDatabaseMigrator>();
EventFlowEventStoresPostgreSql.MigrateDatabase(databaseMigrator);
databaseMigrator.MigrateDatabaseUsingEmbeddedScripts(GetType().Assembly);

return resolver;
}

[TearDown]
public void TearDown()
{
_testDatabase.DisposeSafe("Failed to delete database");
}
}
}
Loading

0 comments on commit 6116b56

Please sign in to comment.