-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
810 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Akka.Persistence.Sql.Tests/MySql/Compatibility/MySqlCommonJournalCompatibilitySpec.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="PostgreSqlCommonJournalCompatibilitySpec.cs" company="Akka.NET Project"> | ||
This comment has been minimized.
Sorry, something went wrong. |
||
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System; | ||
using Akka.Persistence.Sql.Tests.Common.Containers; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
#if !DEBUG | ||
using Akka.Persistence.Sql.Tests.Common.Internal.Xunit; | ||
#endif | ||
|
||
namespace Akka.Persistence.Sql.Tests.MySql.Compatibility | ||
{ | ||
#if !DEBUG | ||
[SkipWindows] | ||
#endif | ||
[Collection(nameof(MySqlPersistenceSpec))] | ||
public class MySqlCommonJournalCompatibilitySpec : SqlCommonJournalCompatibilitySpec<MySqlContainer> | ||
{ | ||
public MySqlCommonJournalCompatibilitySpec(ITestOutputHelper output, MySqlContainer fixture) | ||
: base(fixture, output) | ||
{ | ||
} | ||
|
||
protected override Func<MySqlContainer, Configuration.Config> Config => fixture | ||
=> MySqlCompatibilitySpecConfig.InitJournalConfig(fixture, "event_journal", "metadata"); | ||
|
||
protected override string OldJournal => "akka.persistence.journal.mysql"; | ||
|
||
protected override string NewJournal => "akka.persistence.journal.sql"; | ||
} | ||
} |
35 changes: 35 additions & 0 deletions
35
src/Akka.Persistence.Sql.Tests/MySql/Compatibility/MySqlCommonSnapshotCompatibilitySpec.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="PostgreSqlCommonSnapshotCompatibilitySpec.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System; | ||
using Akka.Persistence.Sql.Tests.Common.Containers; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
#if !DEBUG | ||
using Akka.Persistence.Sql.Tests.Common.Internal.Xunit; | ||
#endif | ||
|
||
namespace Akka.Persistence.Sql.Tests.MySql.Compatibility | ||
{ | ||
#if !DEBUG | ||
[SkipWindows] | ||
#endif | ||
[Collection(nameof(MySqlPersistenceSpec))] | ||
public class MySqlCommonSnapshotCompatibilitySpec : SqlCommonSnapshotCompatibilitySpec<MySqlContainer> | ||
{ | ||
public MySqlCommonSnapshotCompatibilitySpec(ITestOutputHelper output, MySqlContainer fixture) | ||
: base(fixture, output) | ||
{ | ||
} | ||
|
||
protected override string OldSnapshot => "akka.persistence.snapshot-store.mysql"; | ||
|
||
protected override string NewSnapshot => "akka.persistence.snapshot-store.sql"; | ||
|
||
protected override Func<MySqlContainer, Configuration.Config> Config => fixture | ||
=> MySqlCompatibilitySpecConfig.InitSnapshotConfig(fixture, "snapshot_store"); | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
src/Akka.Persistence.Sql.Tests/MySql/Compatibility/MySqlCompatibilitySpecConfig.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="PostgreSqlCompatibilitySpecConfig.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using Akka.Persistence.MySql.Journal; | ||
using Akka.Persistence.MySql.Snapshot; | ||
using Akka.Persistence.Sql.Journal; | ||
using Akka.Persistence.Sql.Snapshot; | ||
using Akka.Persistence.Sql.Tests.Common.Containers; | ||
|
||
namespace Akka.Persistence.Sql.Tests.MySql.Compatibility | ||
{ | ||
public static class MySqlCompatibilitySpecConfig | ||
{ | ||
public static Configuration.Config InitSnapshotConfig( | ||
MySqlContainer fixture, | ||
string tableName) | ||
=> $@" | ||
akka.persistence {{ | ||
publish-plugin-commands = on | ||
snapshot-store {{ | ||
mysql {{ | ||
class = ""{typeof(MySqlSnapshotStore).AssemblyQualifiedName}"" | ||
plugin-dispatcher = ""akka.actor.default-dispatcher"" | ||
connection-string = ""{fixture.ConnectionString}"" | ||
connection-timeout = 30s | ||
table-name = {tableName} | ||
auto-initialize = on | ||
sequential-access = on | ||
}} | ||
sql {{ | ||
class = ""{typeof(SqlSnapshotStore).AssemblyQualifiedName}"" | ||
plugin-dispatcher = ""akka.actor.default-dispatcher"" | ||
connection-string = ""{fixture.ConnectionString}"" | ||
provider-name = {fixture.ProviderName} | ||
table-mapping = mysql | ||
auto-initialize = true | ||
postgresql {{ | ||
snapshot {{ | ||
table-name = ""{tableName}"" | ||
}} | ||
}} | ||
}} | ||
}} | ||
}}"; | ||
|
||
public static Configuration.Config InitJournalConfig( | ||
MySqlContainer fixture, | ||
string tableName, | ||
string metadataTableName) | ||
=> $@" | ||
akka.persistence {{ | ||
publish-plugin-commands = on | ||
journal {{ | ||
mysql {{ | ||
class = ""{typeof(MySqlJournal).AssemblyQualifiedName}"" | ||
plugin-dispatcher = ""akka.actor.default-dispatcher"" | ||
connection-string = ""{fixture.ConnectionString}"" | ||
connection-timeout = 30s | ||
table-name = ""{tableName}"" | ||
metadata-table-name = ""{metadataTableName}"" | ||
auto-initialize = on | ||
}} | ||
sql {{ | ||
class = ""{typeof(SqlWriteJournal).AssemblyQualifiedName}"" | ||
plugin-dispatcher = ""akka.persistence.dispatchers.default-plugin-dispatcher"" | ||
connection-string = ""{fixture.ConnectionString}"" | ||
provider-name = ""{fixture.ProviderName}"" | ||
parallelism = 3 | ||
table-mapping = mysql | ||
auto-initialize = true | ||
tag-write-mode = Csv | ||
delete-compatibility-mode = true | ||
postgresql {{ | ||
journal {{ | ||
table-name = ""{tableName}"" | ||
}} | ||
metadata {{ | ||
table-name = ""{metadataTableName}"" | ||
}} | ||
}} | ||
}} | ||
}} | ||
}}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="PostgreSqlJournalSpec.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System; | ||
using Akka.Configuration; | ||
using Akka.Persistence.Sql.Tests.Common.Containers; | ||
using Akka.Persistence.TCK.Journal; | ||
using FluentAssertions.Extensions; | ||
using Xunit; | ||
using Xunit.Abstractions; | ||
#if !DEBUG | ||
using Akka.Persistence.Sql.Tests.Common.Internal.Xunit; | ||
#endif | ||
|
||
namespace Akka.Persistence.Sql.Tests.MySql | ||
{ | ||
#if !DEBUG | ||
[SkipWindows] | ||
#endif | ||
[Collection(nameof(MySqlPersistenceSpec))] | ||
public class MySqlJournalSpec : JournalSpec | ||
{ | ||
public MySqlJournalSpec(ITestOutputHelper output, MySqlContainer fixture) | ||
: base(Configuration(fixture), nameof(MySqlJournalSpec), output) | ||
{ | ||
Initialize(); | ||
} | ||
|
||
protected override bool SupportsSerialization => false; | ||
|
||
public static Configuration.Config Configuration(MySqlContainer fixture) | ||
{ | ||
if (!fixture.InitializeDbAsync().Wait(10.Seconds())) | ||
throw new Exception("Failed to clean up database in 10 seconds"); | ||
|
||
return ConfigurationFactory.ParseString(@$" | ||
akka.persistence {{ | ||
publish-plugin-commands = on | ||
journal {{ | ||
plugin = ""akka.persistence.journal.sql"" | ||
sql {{ | ||
connection-string = ""{fixture.ConnectionString}"" | ||
provider-name = ""{fixture.ProviderName}"" | ||
}} | ||
}} | ||
snapshot-store {{ | ||
plugin = ""akka.persistence.snapshot-store.sql"" | ||
sql {{ | ||
connection-string = ""{fixture.ConnectionString}"" | ||
provider-name = ""{fixture.ProviderName}"" | ||
}} | ||
}} | ||
}}") | ||
.WithFallback(SqlPersistence.DefaultConfiguration); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Akka.Persistence.Sql.Tests/MySql/MySqlPersistenceSpec.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="PostgreSqlPersistenceSpec.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2013-2023 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using Akka.Persistence.Sql.Tests.Common.Containers; | ||
using Xunit; | ||
|
||
namespace Akka.Persistence.Sql.Tests.MySql | ||
{ | ||
[CollectionDefinition(nameof(MySqlPersistenceSpec), DisableParallelization = true)] | ||
public sealed class MySqlPersistenceSpec : ICollectionFixture<MySqlContainer> { } | ||
} |
Oops, something went wrong.
cough MySqlCommonJournalCompatibilitySpec cough