diff --git a/src/Akka.Persistence.PostgreSql.Tests/Json/PostgreSqlJournalJsonSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Json/PostgreSqlJournalJsonSpec.cs
deleted file mode 100644
index 74dc7d0..0000000
--- a/src/Akka.Persistence.PostgreSql.Tests/Json/PostgreSqlJournalJsonSpec.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (C) 2009-2016 Lightbend Inc.
-// Copyright (C) 2013-2016 Akka.NET project
-//
-//-----------------------------------------------------------------------
-
-using Akka.Configuration;
-using Akka.Persistence.TCK.Journal;
-using Xunit;
-using Xunit.Abstractions;
-
-namespace Akka.Persistence.PostgreSql.Tests.Json
-{
- [Collection("PostgreSqlSpec")]
- public class PostgreSqlJournalJsonSpec : JournalSpec
- {
- private static Config Initialize(PostgresFixture fixture)
- {
- //need to make sure db is created before the tests start
- DbUtils.Initialize(fixture);
-
- return ConfigurationFactory.ParseString(@"
- akka.persistence {
- publish-plugin-commands = on
- journal {
- plugin = ""akka.persistence.journal.postgresql""
- postgresql {
- class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
- plugin-dispatcher = ""akka.actor.default-dispatcher""
- table-name = event_journal
- schema-name = public
- auto-initialize = on
- connection-string = """ + DbUtils.ConnectionString + @"""
- stored-as = ""jsonb""
- }
- }
- }
- akka.test.single-expect-default = 10s");
- }
-
- // TODO: hack. Replace when https://github.com/akkadotnet/akka.net/issues/3811
- protected override bool SupportsSerialization => false;
-
- public PostgreSqlJournalJsonSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), "PostgreSqlJournalJsonSpec", output: output)
- {
- Initialize();
- }
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose(disposing);
- DbUtils.Clean();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Json/PostgreSqlSnapshotStoreJsonSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Json/PostgreSqlSnapshotStoreJsonSpec.cs
deleted file mode 100644
index b32a02c..0000000
--- a/src/Akka.Persistence.PostgreSql.Tests/Json/PostgreSqlSnapshotStoreJsonSpec.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-//-----------------------------------------------------------------------
-//
-// Copyright (C) 2009-2016 Lightbend Inc.
-// Copyright (C) 2013-2016 Akka.NET project
-//
-//-----------------------------------------------------------------------
-
-using Akka.Configuration;
-using Akka.Persistence.TCK.Snapshot;
-using Xunit;
-using Xunit.Abstractions;
-
-namespace Akka.Persistence.PostgreSql.Tests.Json
-{
- [Collection("PostgreSqlSpec")]
- public class PostgreSqlSnapshotStoreJsonSpec : SnapshotStoreSpec
- {
- private static Config Initialize(PostgresFixture fixture)
- {
- //need to make sure db is created before the tests start
- DbUtils.Initialize(fixture);
-
- return ConfigurationFactory.ParseString(@"
- akka.persistence {
- publish-plugin-commands = on
- snapshot-store {
- plugin = ""akka.persistence.snapshot-store.postgresql""
- postgresql {
- class = ""Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql""
- plugin-dispatcher = ""akka.actor.default-dispatcher""
- table-name = snapshot_store
- schema-name = public
- auto-initialize = on
- connection-string = """ + DbUtils.ConnectionString + @"""
- stored-as = ""JSONB""
- }
- }
- }
- akka.test.single-expect-default = 10s");
- }
-
-
- public PostgreSqlSnapshotStoreJsonSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), "PostgreSqlSnapshotStoreJsonSpec", output: output)
- {
- Initialize();
- }
-
- // TODO: hack. Replace when https://github.com/akkadotnet/akka.net/issues/3811
- protected override bool SupportsSerialization => false;
-
- protected override void Dispose(bool disposing)
- {
- base.Dispose(disposing);
- DbUtils.Clean();
- }
- }
-}
\ No newline at end of file
diff --git a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlConfigSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlConfigSpec.cs
index 29c7a8e..defb50e 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlConfigSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlConfigSpec.cs
@@ -13,6 +13,7 @@
using Akka.Persistence.PostgreSql.Snapshot;
using Akka.Persistence.Sql.Common.Extensions;
using Akka.Persistence.Sql.Common.Journal;
+using Akka.Serialization;
using FluentAssertions;
using FluentAssertions.Extensions;
using Xunit;
diff --git a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlJournalBigIntSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlJournalBigIntSpec.cs
index 8ed846b..7157d51 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlJournalBigIntSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlJournalBigIntSpec.cs
@@ -20,29 +20,53 @@
namespace Akka.Persistence.PostgreSql.Tests
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlJournalBigIntSpec : JournalSpec
+ public sealed class PostgreSqlByteAJournalBigIntSpec : PostgreSqlJournalBigIntSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteAJournalBigIntSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBJournalBigIntSpec : PostgreSqlJournalBigIntSpec
+ {
+ public PostgreSqlJsonBJournalBigIntSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonJournalBigIntSpec : PostgreSqlJournalBigIntSpec
+ {
+ public PostgreSqlJsonJournalBigIntSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlJournalBigIntSpec : JournalSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
- var config = @"
- akka.persistence {
+ var config = $@"
+ akka.persistence {{
publish-plugin-commands = on
- journal {
+ journal {{
plugin = ""akka.persistence.journal.postgresql""
- postgresql {
+ postgresql {{
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
plugin-dispatcher = ""akka.actor.default-dispatcher""
table-name = event_journal
schema-name = public
auto-initialize = on
- connection-string = """ + DbUtils.ConnectionString + @"""
+ connection-string = ""{DbUtils.ConnectionString}""
use-bigint-identity-for-ordering-column = on
- }
- }
- }
+ stored-as = {storedAs}
+ }}
+ }}
+ }}
akka.test.single-expect-default = 10s";
return ConfigurationFactory.ParseString(config);
@@ -51,8 +75,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
// TODO: hack. Replace when https://github.com/akkadotnet/akka.net/issues/3811
protected override bool SupportsSerialization => false;
- public PostgreSqlJournalBigIntSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), "PostgreSqlJournalBigIntSpec", output)
+ protected PostgreSqlJournalBigIntSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), "PostgreSqlJournalBigIntSpec", output)
{
Initialize();
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlJournalSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlJournalSpec.cs
index 1c979b3..c39b275 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlJournalSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlJournalSpec.cs
@@ -20,28 +20,55 @@
namespace Akka.Persistence.PostgreSql.Tests
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlJournalSpec : JournalSpec
+ public sealed class PostgreSqlByteAJournalSpec : PostgreSqlJournalSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteAJournalSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ {
+ }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBJournalSpec : PostgreSqlJournalSpec
+ {
+ public PostgreSqlJsonBJournalSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ {
+ }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonJournalSpec : PostgreSqlJournalSpec
+ {
+ public PostgreSqlJsonJournalSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ {
+ }
+ }
+
+ public abstract class PostgreSqlJournalSpec : JournalSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
- var config = @"
- akka.persistence {
+ var config = @$"
+ akka.persistence {{
publish-plugin-commands = on
- journal {
+ journal {{
plugin = ""akka.persistence.journal.postgresql""
- postgresql {
+ postgresql {{
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
plugin-dispatcher = ""akka.actor.default-dispatcher""
table-name = event_journal
schema-name = public
auto-initialize = on
- connection-string = """ + DbUtils.ConnectionString + @"""
- }
- }
- }
+ connection-string = ""{DbUtils.ConnectionString}""
+ stored-as = {storedAs}
+ }}
+ }}
+ }}
akka.test.single-expect-default = 10s";
return ConfigurationFactory.ParseString(config);
@@ -50,8 +77,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
// TODO: hack. Replace when https://github.com/akkadotnet/akka.net/issues/3811
protected override bool SupportsSerialization => false;
- public PostgreSqlJournalSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), "PostgreSqlJournalSpec", output: output)
+ protected PostgreSqlJournalSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), "PostgreSqlJournalSpec", output: output)
{
Initialize();
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSequentialAccessSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSequentialAccessSpec.cs
index 42e6fb7..943fcf4 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSequentialAccessSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSequentialAccessSpec.cs
@@ -5,7 +5,9 @@
//
//-----------------------------------------------------------------------
+using System;
using Akka.Configuration;
+using Akka.Persistence.TCK.Serialization;
using Akka.Persistence.TCK.Snapshot;
using Akka.TestKit;
using Xunit;
@@ -14,36 +16,68 @@
namespace Akka.Persistence.PostgreSql.Tests
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlSnapshotStoreSequentialAccessSpec : SnapshotStoreSpec
+ public sealed class PostgreSqlByteASnapshotStoreSequentialAccessSpec : PostgreSqlSnapshotStoreSequentialAccessSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteASnapshotStoreSequentialAccessSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBSnapshotStoreSequentialAccessSpec : PostgreSqlSnapshotStoreSequentialAccessSpec
+ {
+ public PostgreSqlJsonBSnapshotStoreSequentialAccessSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+
+ [Fact(Skip = "Akka.Persistence.PostgreSql in JsonB mode does not support ISurrogate serialization")]
+ public override void ShouldSerializeSnapshots()
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonSnapshotStoreSequentialAccessSpec : PostgreSqlSnapshotStoreSequentialAccessSpec
+ {
+ public PostgreSqlJsonSnapshotStoreSequentialAccessSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+
+ [Fact(Skip = "Akka.Persistence.PostgreSql in Json mode does not support ISurrogate serialization")]
+ public override void ShouldSerializeSnapshots()
+ { }
+ }
+
+ public abstract class PostgreSqlSnapshotStoreSequentialAccessSpec : SnapshotStoreSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
- var config = @"
- akka.persistence {
+ var config = $@"
+ akka.persistence {{
publish-plugin-commands = on
- snapshot-store {
+ snapshot-store {{
plugin = ""akka.persistence.snapshot-store.postgresql""
- postgresql {
+ postgresql {{
class = ""Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql""
plugin-dispatcher = ""akka.actor.default-dispatcher""
table-name = snapshot_store
schema-name = public
auto-initialize = on
- connection-string = """ + DbUtils.ConnectionString + @"""
+ connection-string = ""{DbUtils.ConnectionString}""
sequential-access = on
- }
- }
- }
+ stored-as = {storedAs}
+ }}
+ }}
+ }}
akka.test.single-expect-default = 10s";
return ConfigurationFactory.ParseString(config);
}
- public PostgreSqlSnapshotStoreSequentialAccessSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), "PostgreSqlSnapshotStoreSpec", output: output)
+ protected PostgreSqlSnapshotStoreSequentialAccessSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), "PostgreSqlSnapshotStoreSpec", output: output)
{
Initialize();
}
@@ -68,5 +102,9 @@ public void SnapshotStore_should_save_and_overwrite_snapshot_with_same_sequence_
Assert.Equal(md.SequenceNr, result.Snapshot.Metadata.SequenceNr);
// metadata timestamp may have been changed
}
+
+ [Fact(Skip = "Akka.Persistence.PostgreSql in JsonB mode does not support ISurrogate serialization")]
+ public override void ShouldSerializeSnapshots()
+ { }
}
}
\ No newline at end of file
diff --git a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSpec.cs
index 995cebf..ffff0b6 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/PostgreSqlSnapshotStoreSpec.cs
@@ -14,35 +14,67 @@
namespace Akka.Persistence.PostgreSql.Tests
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlSnapshotStoreSpec : SnapshotStoreSpec
+ public sealed class PostgreSqlByteASnapshotStoreSpec : PostgreSqlSnapshotStoreSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteASnapshotStoreSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBSnapshotStoreSpec : PostgreSqlSnapshotStoreSpec
+ {
+ public PostgreSqlJsonBSnapshotStoreSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+
+ [Fact(Skip = "Akka.Persistence.PostgreSql in JsonB mode does not support ISurrogate serialization")]
+ public override void ShouldSerializeSnapshots()
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonSnapshotStoreSpec : PostgreSqlSnapshotStoreSpec
+ {
+ public PostgreSqlJsonSnapshotStoreSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+
+ [Fact(Skip = "Akka.Persistence.PostgreSql in Json mode does not support ISurrogate serialization")]
+ public override void ShouldSerializeSnapshots()
+ { }
+ }
+
+ public abstract class PostgreSqlSnapshotStoreSpec : SnapshotStoreSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
- var config = @"
- akka.persistence {
+ var config = @$"
+ akka.persistence {{
publish-plugin-commands = on
- snapshot-store {
+ snapshot-store {{
plugin = ""akka.persistence.snapshot-store.postgresql""
- postgresql {
+ postgresql {{
class = ""Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql""
plugin-dispatcher = ""akka.actor.default-dispatcher""
table-name = snapshot_store
schema-name = public
auto-initialize = on
- connection-string = """ + DbUtils.ConnectionString + @"""
- }
- }
- }
+ connection-string = ""{DbUtils.ConnectionString}""
+ stored-as = {storedAs}
+ }}
+ }}
+ }}
akka.test.single-expect-default = 10s";
return ConfigurationFactory.ParseString(config);
}
- public PostgreSqlSnapshotStoreSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), "PostgreSqlSnapshotStoreSpec", output: output)
+ protected PostgreSqlSnapshotStoreSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), "PostgreSqlSnapshotStoreSpec", output: output)
{
Initialize();
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlAllEventsSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlAllEventsSpec.cs
index f8b6795..212efd2 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlAllEventsSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlAllEventsSpec.cs
@@ -15,9 +15,32 @@
namespace Akka.Persistence.PostgreSql.Tests.Query
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlAllEventsSpec : AllEventsSpec
+ public sealed class PostgreSqlByteAAllEventsSpec : PostgreSqlAllEventsSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteAAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBAllEventsSpec : PostgreSqlAllEventsSpec
+ {
+ public PostgreSqlJsonBAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonAllEventsSpec : PostgreSqlAllEventsSpec
+ {
+ public PostgreSqlJsonAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlAllEventsSpec : AllEventsSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
@@ -31,6 +54,7 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
auto-initialize = on
connection-string = ""{DbUtils.ConnectionString}""
refresh-interval = 1s
+ stored-as = {storedAs}
}}
akka.test.single-expect-default = 10s")
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
@@ -38,8 +62,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
.WithFallback(Persistence.DefaultConfig());
}
- public PostgreSqlAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), nameof(PostgreSqlAllEventsSpec), output)
+ protected PostgreSqlAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), nameof(PostgreSqlAllEventsSpec), output)
{
ReadJournal = Sys.ReadJournalFor(SqlReadJournal.Identifier);
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentAllEventsSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentAllEventsSpec.cs
index 4845fa5..4ab4291 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentAllEventsSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentAllEventsSpec.cs
@@ -15,9 +15,32 @@
namespace Akka.Persistence.PostgreSql.Tests.Query
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlCurrentAllEventsSpec : CurrentAllEventsSpec
+ public sealed class PostgreSqlByteACurrentAllEventsSpec : PostgreSqlCurrentAllEventsSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteACurrentAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBCurrentAllEventsSpec : PostgreSqlCurrentAllEventsSpec
+ {
+ public PostgreSqlJsonBCurrentAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonCurrentAllEventsSpec : PostgreSqlCurrentAllEventsSpec
+ {
+ public PostgreSqlJsonCurrentAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlCurrentAllEventsSpec : CurrentAllEventsSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
@@ -31,6 +54,7 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
auto-initialize = on
connection-string = ""{DbUtils.ConnectionString}""
refresh-interval = 1s
+ stored-as = {storedAs}
}}
akka.test.single-expect-default = 10s")
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
@@ -38,8 +62,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
.WithFallback(Persistence.DefaultConfig());
}
- public PostgreSqlCurrentAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), nameof(PostgreSqlCurrentAllEventsSpec), output)
+ protected PostgreSqlCurrentAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), nameof(PostgreSqlCurrentAllEventsSpec), output)
{
ReadJournal = Sys.ReadJournalFor(SqlReadJournal.Identifier);
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentEventsByPersistenceIdSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentEventsByPersistenceIdSpec.cs
index 7713c44..f9f782f 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentEventsByPersistenceIdSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentEventsByPersistenceIdSpec.cs
@@ -15,9 +15,32 @@
namespace Akka.Persistence.PostgreSql.Tests.Query
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlCurrentEventsByPersistenceIdSpec : CurrentEventsByPersistenceIdSpec
+ public sealed class PostgreSqlByteACurrentEventsByPersistenceIdSpec : PostgreSqlCurrentEventsByPersistenceIdSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteACurrentEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBCurrentEventsByPersistenceIdSpec : PostgreSqlCurrentEventsByPersistenceIdSpec
+ {
+ public PostgreSqlJsonBCurrentEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonCurrentEventsByPersistenceIdSpec : PostgreSqlCurrentEventsByPersistenceIdSpec
+ {
+ public PostgreSqlJsonCurrentEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlCurrentEventsByPersistenceIdSpec : CurrentEventsByPersistenceIdSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
@@ -31,6 +54,7 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
auto-initialize = on
connection-string = ""{DbUtils.ConnectionString}""
refresh-interval = 1s
+ stored-as = {storedAs}
}}
akka.test.single-expect-default = 10s")
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
@@ -38,8 +62,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
.WithFallback(Persistence.DefaultConfig());
}
- public PostgreSqlCurrentEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), nameof(PostgreSqlCurrentEventsByPersistenceIdSpec), output)
+ protected PostgreSqlCurrentEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), nameof(PostgreSqlCurrentEventsByPersistenceIdSpec), output)
{
ReadJournal = Sys.ReadJournalFor(SqlReadJournal.Identifier);
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentEventsByTagSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentEventsByTagSpec.cs
index 1d436df..27f6f30 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentEventsByTagSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentEventsByTagSpec.cs
@@ -17,9 +17,32 @@
namespace Akka.Persistence.PostgreSql.Tests.Query
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlCurrentEventsByTagSpec : CurrentEventsByTagSpec
+ public sealed class PostgreSqlByteACurrentEventsByTagSpec : PostgreSqlCurrentEventsByTagSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteACurrentEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBCurrentEventsByTagSpec : PostgreSqlCurrentEventsByTagSpec
+ {
+ public PostgreSqlJsonBCurrentEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonCurrentEventsByTagSpec : PostgreSqlCurrentEventsByTagSpec
+ {
+ public PostgreSqlJsonCurrentEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlCurrentEventsByTagSpec : CurrentEventsByTagSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
@@ -39,6 +62,7 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
auto-initialize = on
connection-string = ""{DbUtils.ConnectionString}""
refresh-interval = 1s
+ stored-as = {storedAs}
}}
akka.test.single-expect-default = 10s")
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
@@ -46,8 +70,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
.WithFallback(Persistence.DefaultConfig());
}
- public PostgreSqlCurrentEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), nameof(PostgreSqlCurrentEventsByTagSpec), output)
+ protected PostgreSqlCurrentEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), nameof(PostgreSqlCurrentEventsByTagSpec), output)
{
ReadJournal = Sys.ReadJournalFor(SqlReadJournal.Identifier);
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentPersistenceIdsSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentPersistenceIdsSpec.cs
index 14468b1..1ce4dab 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentPersistenceIdsSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlCurrentPersistenceIdsSpec.cs
@@ -15,9 +15,35 @@
namespace Akka.Persistence.PostgreSql.Tests.Query
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlCurrentPersistenceIdsSpec : CurrentPersistenceIdsSpec
+ public sealed class PostgreSqlByteACurrentPersistenceIdsSpec : PostgreSqlCurrentPersistenceIdsSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteACurrentPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ {
+ }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBCurrentPersistenceIdsSpec : PostgreSqlCurrentPersistenceIdsSpec
+ {
+ public PostgreSqlJsonBCurrentPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ {
+ }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonCurrentPersistenceIdsSpec : PostgreSqlCurrentPersistenceIdsSpec
+ {
+ public PostgreSqlJsonCurrentPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ {
+ }
+ }
+
+ public abstract class PostgreSqlCurrentPersistenceIdsSpec : CurrentPersistenceIdsSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
@@ -31,6 +57,7 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
auto-initialize = on
connection-string = ""{DbUtils.ConnectionString}""
refresh-interval = 1s
+ stored-as = {storedAs}
}}
akka.test.single-expect-default = 10s")
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
@@ -38,8 +65,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
.WithFallback(Persistence.DefaultConfig());
}
- public PostgreSqlCurrentPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), nameof(PostgreSqlCurrentPersistenceIdsSpec), output)
+ protected PostgreSqlCurrentPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), nameof(PostgreSqlCurrentPersistenceIdsSpec), output)
{
ReadJournal = Sys.ReadJournalFor(SqlReadJournal.Identifier);
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlEventsByPersistenceIdSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlEventsByPersistenceIdSpec.cs
index e510cbf..3df18f9 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlEventsByPersistenceIdSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlEventsByPersistenceIdSpec.cs
@@ -15,9 +15,32 @@
namespace Akka.Persistence.PostgreSql.Tests.Query
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlEventsByPersistenceIdSpec : EventsByPersistenceIdSpec
+ public sealed class PostgreSqlByteAEventsByPersistenceIdSpec : PostgreSqlEventsByPersistenceIdSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteAEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBEventsByPersistenceIdSpec : PostgreSqlEventsByPersistenceIdSpec
+ {
+ public PostgreSqlJsonBEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonEventsByPersistenceIdSpec : PostgreSqlEventsByPersistenceIdSpec
+ {
+ public PostgreSqlJsonEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlEventsByPersistenceIdSpec : EventsByPersistenceIdSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
@@ -31,6 +54,7 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
auto-initialize = on
connection-string = ""{DbUtils.ConnectionString}""
refresh-interval = 1s
+ stored-as = {storedAs}
}}
akka.test.single-expect-default = 10s")
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
@@ -38,8 +62,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
.WithFallback(Persistence.DefaultConfig());
}
- public PostgreSqlEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), nameof(PostgreSqlEventsByPersistenceIdSpec), output)
+ protected PostgreSqlEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), nameof(PostgreSqlEventsByPersistenceIdSpec), output)
{
ReadJournal = Sys.ReadJournalFor(SqlReadJournal.Identifier);
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlEventsByTagSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlEventsByTagSpec.cs
index e0c0ac1..2b84a67 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlEventsByTagSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlEventsByTagSpec.cs
@@ -15,9 +15,32 @@
namespace Akka.Persistence.PostgreSql.Tests.Query
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlEventsByTagSpec : EventsByTagSpec
+ public sealed class PostgreSqlByteAEventsByTagSpec : PostgreSqlEventsByTagSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteAEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBEventsByTagSpec : PostgreSqlEventsByTagSpec
+ {
+ public PostgreSqlJsonBEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonEventsByTagSpec : PostgreSqlEventsByTagSpec
+ {
+ public PostgreSqlJsonEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlEventsByTagSpec : EventsByTagSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
@@ -36,6 +59,7 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
auto-initialize = on
connection-string = ""{DbUtils.ConnectionString}""
refresh-interval = 1s
+ stored-as = {storedAs}
}}
akka.test.single-expect-default = 10s")
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
@@ -44,8 +68,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
}
- public PostgreSqlEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), nameof(PostgreSqlEventsByTagSpec), output)
+ protected PostgreSqlEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), nameof(PostgreSqlEventsByTagSpec), output)
{
ReadJournal = Sys.ReadJournalFor(SqlReadJournal.Identifier);
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlPersistenceIdsSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlPersistenceIdsSpec.cs
index 6d20ad0..c9f4980 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlPersistenceIdsSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlPersistenceIdsSpec.cs
@@ -15,9 +15,32 @@
namespace Akka.Persistence.PostgreSql.Tests.Query
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlPersistenceIdsSpec : PersistenceIdsSpec
+ public sealed class PostgreSqlByteAPersistenceIdsSpec : PostgreSqlPersistenceIdsSpec
{
- private static Config Initialize(PostgresFixture fixture)
+ public PostgreSqlByteAPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBPersistenceIdsSpec : PostgreSqlPersistenceIdsSpec
+ {
+ public PostgreSqlJsonBPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonPersistenceIdsSpec : PostgreSqlPersistenceIdsSpec
+ {
+ public PostgreSqlJsonPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlPersistenceIdsSpec : PersistenceIdsSpec
+ {
+ private static Config Initialize(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
@@ -31,6 +54,7 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
auto-initialize = on
connection-string = ""{DbUtils.ConnectionString}""
refresh-interval = 1s
+ stored-as = {storedAs}
}}
akka.test.single-expect-default = 10s")
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
@@ -38,8 +62,8 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
.WithFallback(Persistence.DefaultConfig());
}
- public PostgreSqlPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(Initialize(fixture), nameof(PostgreSqlPersistenceIdsSpec), output)
+ protected PostgreSqlPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(Initialize(fixture, storedAs), nameof(PostgreSqlPersistenceIdsSpec), output)
{
ReadJournal = Sys.ReadJournalFor(SqlReadJournal.Identifier);
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Serialization/PostgreSqlJournalSerializationSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Serialization/PostgreSqlJournalSerializationSpec.cs
index 478e4e8..cf91dc7 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Serialization/PostgreSqlJournalSerializationSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Serialization/PostgreSqlJournalSerializationSpec.cs
@@ -5,41 +5,135 @@
//
//-----------------------------------------------------------------------
+using System.Collections.Generic;
using Akka.Configuration;
using Akka.Persistence.TCK.Serialization;
+using Akka.Util.Internal;
using Xunit;
using Xunit.Abstractions;
namespace Akka.Persistence.PostgreSql.Tests.Serialization
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlJournalSerializationSpec : JournalSerializationSpec
+ public sealed class PostgreSqlByteAJournalSerializationSpec : PostgreSqlJournalSerializationSpec
{
- public PostgreSqlJournalSerializationSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(CreateSpecConfig(fixture), "PostgreSqlJournalSerializationSpec", output)
+ public PostgreSqlByteAJournalSerializationSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonBJournalSerializationSpec : PostgreSqlJsonBasedJournalSerializationSpec
+ {
+ public PostgreSqlJsonBJournalSerializationSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public sealed class PostgreSqlJsonJournalSerializationSpec : PostgreSqlJsonBasedJournalSerializationSpec
+ {
+ public PostgreSqlJsonJournalSerializationSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlJsonBasedJournalSerializationSpec : PostgreSqlJournalSerializationSpec
+ {
+ protected PostgreSqlJsonBasedJournalSerializationSpec(
+ ITestOutputHelper output,
+ PostgresFixture fixture,
+ string storedAs)
+ : base(output, fixture, storedAs)
+ {
+ }
+
+ [Fact]
+ public override void Journal_should_serialize_Persistent()
+ {
+ var probe = CreateTestProbe();
+ var persistentEvent = new Persistent(new JsonTestJournal.MyPayload("a"), 1L, Pid, null, false, null, WriterGuid);
+
+ var messages = new List
+ {
+ new(persistentEvent)
+ };
+
+ Journal.Tell(new WriteMessages(messages, probe.Ref, ActorInstanceId), TestActor);
+ probe.ExpectMsg();
+ probe.ExpectMsg(m => m.ActorInstanceId == ActorInstanceId && m.Persistent.PersistenceId == Pid);
+
+ Journal.Tell(new ReplayMessages(0, long.MaxValue, long.MaxValue, Pid, probe.Ref), TestActor);
+ probe.ExpectMsg(s => s.Persistent.PersistenceId == Pid
+ && s.Persistent.SequenceNr == persistentEvent.SequenceNr
+ && s.Persistent.Payload.AsInstanceOf().Data.Equals("a"));
+ probe.ExpectMsg();
+ }
+
+ [Fact(Skip = "Json based persistence does not support string manifest")]
+ public override void Journal_should_serialize_Persistent_with_string_manifest()
+ {
+ }
+ }
+
+ internal static class JsonTestJournal
+ {
+ public class MyPayload
+ {
+ public MyPayload(string data) => Data = data;
+
+ public string Data { get; }
+ }
+
+ public class MyPayload2
+ {
+ public MyPayload2(string data, int n)
+ {
+ Data = data;
+ N = n;
+ }
+
+ public string Data { get; }
+ public int N { get; }
+ }
+
+ public class MyPayload3
+ {
+ public MyPayload3(string data) => Data = data;
+
+ public string Data { get; }
+ }
+ }
+
+
+ public abstract class PostgreSqlJournalSerializationSpec : JournalSerializationSpec
+ {
+ protected PostgreSqlJournalSerializationSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(CreateSpecConfig(fixture, storedAs), "PostgreSqlJournalSerializationSpec", output)
{
}
- private static Config CreateSpecConfig(PostgresFixture fixture)
+ private static Config CreateSpecConfig(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
- return ConfigurationFactory.ParseString(@"
- akka.persistence {
+ return ConfigurationFactory.ParseString($@"
+ akka.persistence {{
publish-plugin-commands = on
- journal {
+ journal {{
plugin = ""akka.persistence.journal.postgresql""
- postgresql {
+ postgresql {{
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
plugin-dispatcher = ""akka.actor.default-dispatcher""
table-name = event_journal
schema-name = public
auto-initialize = on
- connection-string = """ + DbUtils.ConnectionString + @"""
- }
- }
- }
+ connection-string = ""{DbUtils.ConnectionString}""
+ stored-as = {storedAs}
+ }}
+ }}
+ }}
akka.test.single-expect-default = 10s");
}
diff --git a/src/Akka.Persistence.PostgreSql.Tests/Serialization/PostgreSqlSnapshotStoreSerializationSpec.cs b/src/Akka.Persistence.PostgreSql.Tests/Serialization/PostgreSqlSnapshotStoreSerializationSpec.cs
index b7d03b5..894e795 100644
--- a/src/Akka.Persistence.PostgreSql.Tests/Serialization/PostgreSqlSnapshotStoreSerializationSpec.cs
+++ b/src/Akka.Persistence.PostgreSql.Tests/Serialization/PostgreSqlSnapshotStoreSerializationSpec.cs
@@ -13,33 +13,57 @@
namespace Akka.Persistence.PostgreSql.Tests.Serialization
{
[Collection("PostgreSqlSpec")]
- public class PostgreSqlSnapshotStoreSerializationSpec : SnapshotStoreSerializationSpec
+ public abstract class PostgreSqlByteASnapshotStoreSerializationSpec : PostgreSqlSnapshotStoreSerializationSpec
{
- public PostgreSqlSnapshotStoreSerializationSpec(ITestOutputHelper output, PostgresFixture fixture)
- : base(CreateSpecConfig(fixture), "PostgreSqlSnapshotStoreSerializationSpec", output)
+ protected PostgreSqlByteASnapshotStoreSerializationSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "bytea")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public abstract class PostgreSqlJsonBSnapshotStoreSerializationSpec : PostgreSqlSnapshotStoreSerializationSpec
+ {
+ protected PostgreSqlJsonBSnapshotStoreSerializationSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "jsonb")
+ { }
+ }
+
+ [Collection("PostgreSqlSpec")]
+ public abstract class PostgreSqlJsonSnapshotStoreSerializationSpec : PostgreSqlSnapshotStoreSerializationSpec
+ {
+ protected PostgreSqlJsonSnapshotStoreSerializationSpec(ITestOutputHelper output, PostgresFixture fixture)
+ : base(output, fixture, "json")
+ { }
+ }
+
+ public abstract class PostgreSqlSnapshotStoreSerializationSpec : SnapshotStoreSerializationSpec
+ {
+ protected PostgreSqlSnapshotStoreSerializationSpec(ITestOutputHelper output, PostgresFixture fixture, string storedAs)
+ : base(CreateSpecConfig(fixture, storedAs), "PostgreSqlSnapshotStoreSerializationSpec", output)
{
}
- private static Config CreateSpecConfig(PostgresFixture fixture)
+ private static Config CreateSpecConfig(PostgresFixture fixture, string storedAs)
{
//need to make sure db is created before the tests start
DbUtils.Initialize(fixture);
- return ConfigurationFactory.ParseString(@"
- akka.persistence {
+ return ConfigurationFactory.ParseString($@"
+ akka.persistence {{
publish-plugin-commands = on
- journal {
+ journal {{
plugin = ""akka.persistence.journal.postgresql""
- postgresql {
+ postgresql {{
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
plugin-dispatcher = ""akka.actor.default-dispatcher""
table-name = event_journal
schema-name = public
auto-initialize = on
- connection-string = """ + DbUtils.ConnectionString + @"""
- }
- }
- }
+ connection-string = ""{DbUtils.ConnectionString}""
+ stored-as = {storedAs}
+ }}
+ }}
+ }}
akka.test.single-expect-default = 10s");
}
}