Skip to content
This repository was archived by the owner on Mar 20, 2025. It is now read-only.

Commit 09fc3fd

Browse files
committed
Add all missing query specs
1 parent af092ab commit 09fc3fd

12 files changed

+538
-30
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="PostgreSqlJournalPerfSpec.cs" company="Akka.NET Project">
3+
// Copyright (C) 2009-2021 Lightbend Inc. <http://www.lightbend.com>
4+
// Copyright (C) 2013-2021 .NET Foundation <https://github.com/akkadotnet/akka.net>
5+
// </copyright>
6+
//-----------------------------------------------------------------------
7+
8+
using System;
9+
using Akka.Configuration;
10+
using Akka.Persistence.TestKit.Performance;
11+
using Xunit;
12+
using Xunit.Abstractions;
13+
14+
namespace Akka.Persistence.PostgreSql.Tests.Performance
15+
{
16+
[Collection("PostgreSqlSpec")]
17+
public class PostgreSqlJournalPerfSpec : JournalPerfSpec
18+
{
19+
public PostgreSqlJournalPerfSpec(ITestOutputHelper output, PostgresFixture fixture)
20+
: base(CreateSpecConfig(fixture), "PostgreSqlJournalPerfSpec", output)
21+
{
22+
EventsCount = 5 * 1000;
23+
ExpectDuration = TimeSpan.FromSeconds(60);
24+
}
25+
26+
private static Config CreateSpecConfig(PostgresFixture fixture)
27+
{
28+
//need to make sure db is created before the tests start
29+
DbUtils.Initialize(fixture);
30+
31+
return ConfigurationFactory.ParseString(@"
32+
akka.loglevel = INFO
33+
akka.persistence.journal.plugin = ""akka.persistence.journal.postgresql""
34+
akka.persistence.journal.postgresql {
35+
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
36+
auto-initialize = on
37+
connection-string = """ + DbUtils.ConnectionString + @"""
38+
}
39+
akka.test.single-expect-default = 3s")
40+
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
41+
.WithFallback(Persistence.DefaultConfig());
42+
}
43+
44+
protected override void Dispose(bool disposing)
45+
{
46+
base.Dispose(disposing);
47+
DbUtils.Clean();
48+
}
49+
}
50+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="PostgreSqlJournalSpec.cs" company="Akka.NET Project">
3+
// Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
4+
// Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
5+
// </copyright>
6+
//-----------------------------------------------------------------------
7+
8+
using Akka.Configuration;
9+
using Akka.Persistence.Sql.TestKit;
10+
using Akka.Persistence.TCK.Journal;
11+
using Xunit;
12+
using Xunit.Abstractions;
13+
14+
namespace Akka.Persistence.PostgreSql.Tests
15+
{
16+
[Collection("PostgreSqlSpec")]
17+
public class PostgreSqlJournalConnectionFailureSpec : SqlJournalConnectionFailureSpec
18+
{
19+
private static Config Initialize(PostgresFixture fixture, string connectionString)
20+
{
21+
//need to make sure db is created before the tests start
22+
DbUtils.Initialize(fixture);
23+
24+
var config = @"
25+
akka.persistence {
26+
publish-plugin-commands = on
27+
journal {
28+
plugin = ""akka.persistence.journal.postgresql""
29+
postgresql {
30+
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
31+
plugin-dispatcher = ""akka.actor.default-dispatcher""
32+
table-name = event_journal
33+
schema-name = public
34+
auto-initialize = on
35+
connection-string = """ + connectionString + @"""
36+
}
37+
}
38+
}";
39+
40+
return ConfigurationFactory.ParseString(config);
41+
}
42+
43+
public PostgreSqlJournalConnectionFailureSpec(ITestOutputHelper output, PostgresFixture fixture)
44+
: base(Initialize(fixture, DefaultInvalidConnectionString), output: output)
45+
{
46+
}
47+
48+
protected override void Dispose(bool disposing)
49+
{
50+
base.Dispose(disposing);
51+
DbUtils.Clean();
52+
}
53+
}
54+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="PostgreSqlSnapshotStoreSpec.cs" company="Akka.NET Project">
3+
// Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
4+
// Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
5+
// </copyright>
6+
//-----------------------------------------------------------------------
7+
8+
using Akka.Configuration;
9+
using Akka.Persistence.Snapshot;
10+
using Akka.Persistence.Sql.TestKit;
11+
using Akka.Persistence.TCK.Snapshot;
12+
using Akka.TestKit;
13+
using Xunit;
14+
using Xunit.Abstractions;
15+
16+
namespace Akka.Persistence.PostgreSql.Tests
17+
{
18+
[Collection("PostgreSqlSpec")]
19+
public class PostgreSqlSnapshotStoreConnectionFailureSpec : SqlSnapshotConnectionFailureSpec
20+
{
21+
private static Config Initialize(PostgresFixture fixture, string connectionString)
22+
{
23+
//need to make sure db is created before the tests start
24+
DbUtils.Initialize(fixture);
25+
26+
var config = @"
27+
akka.persistence {
28+
publish-plugin-commands = on
29+
snapshot-store {
30+
plugin = ""akka.persistence.snapshot-store.postgresql""
31+
postgresql {
32+
class = ""Akka.Persistence.PostgreSql.Snapshot.PostgreSqlSnapshotStore, Akka.Persistence.PostgreSql""
33+
plugin-dispatcher = ""akka.actor.default-dispatcher""
34+
table-name = snapshot_store
35+
schema-name = public
36+
auto-initialize = on
37+
connection-string = """ + connectionString + @"""
38+
}
39+
}
40+
}";
41+
42+
return ConfigurationFactory.ParseString(config);
43+
}
44+
45+
public PostgreSqlSnapshotStoreConnectionFailureSpec(ITestOutputHelper output, PostgresFixture fixture)
46+
: base(Initialize(fixture, DefaultInvalidConnectionString), output: output)
47+
{
48+
}
49+
50+
protected override void Dispose(bool disposing)
51+
{
52+
base.Dispose(disposing);
53+
DbUtils.Clean();
54+
}
55+
}
56+
}

src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlAllPersistenceIdsSpec.cs renamed to src/Akka.Persistence.PostgreSql.Tests/Query/PostgreSqlAllEventsSpec.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//-----------------------------------------------------------------------
2-
// <copyright file="PostgreSqlAllPersistenceIdsSpec.cs" company="Akka.NET Project">
2+
// <copyright file="PostgreSqlPersistenceIdsSpec.cs" company="Akka.NET Project">
33
// Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
44
// Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
55
// </copyright>
@@ -15,7 +15,7 @@
1515
namespace Akka.Persistence.PostgreSql.Tests.Query
1616
{
1717
[Collection("PostgreSqlSpec")]
18-
public class PostgreSqlAllPersistenceIdsSpec : PersistenceIdsSpec
18+
public class PostgreSqlAllEventsSpec : AllEventsSpec
1919
{
2020
private static Config Initialize(PostgresFixture fixture)
2121
{
@@ -34,11 +34,13 @@ class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistenc
3434
connection-string = ""{DbUtils.ConnectionString}""
3535
refresh-interval = 1s
3636
}}")
37-
.WithFallback(SqlReadJournal.DefaultConfiguration());
37+
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
38+
.WithFallback(SqlReadJournal.DefaultConfiguration())
39+
.WithFallback(Persistence.DefaultConfig());
3840
}
3941

40-
public PostgreSqlAllPersistenceIdsSpec(ITestOutputHelper output, PostgresFixture fixture)
41-
: base(Initialize(fixture), nameof(PostgreSqlAllPersistenceIdsSpec), output)
42+
public PostgreSqlAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
43+
: base(Initialize(fixture), nameof(PostgreSqlAllEventsSpec), output)
4244
{
4345
ReadJournal = Sys.ReadJournalFor<SqlReadJournal>(SqlReadJournal.Identifier);
4446
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="PostgreSqlPersistenceIdsSpec.cs" company="Akka.NET Project">
3+
// Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
4+
// Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
5+
// </copyright>
6+
//-----------------------------------------------------------------------
7+
8+
using Akka.Configuration;
9+
using Akka.Persistence.Query;
10+
using Akka.Persistence.Query.Sql;
11+
using Akka.Persistence.TCK.Query;
12+
using Xunit;
13+
using Xunit.Abstractions;
14+
15+
namespace Akka.Persistence.PostgreSql.Tests.Query
16+
{
17+
[Collection("PostgreSqlSpec")]
18+
public class PostgreSqlCurrentAllEventsSpec : AllEventsSpec
19+
{
20+
private static Config Initialize(PostgresFixture fixture)
21+
{
22+
//need to make sure db is created before the tests start
23+
DbUtils.Initialize(fixture);
24+
25+
return ConfigurationFactory.ParseString($@"
26+
akka.loglevel = INFO
27+
akka.test.single-expect-default = 10s
28+
akka.persistence.journal.plugin = ""akka.persistence.journal.postgresql""
29+
akka.persistence.journal.postgresql {{
30+
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
31+
plugin-dispatcher = ""akka.actor.default-dispatcher""
32+
table-name = event_journal
33+
auto-initialize = on
34+
connection-string = ""{DbUtils.ConnectionString}""
35+
refresh-interval = 1s
36+
}}")
37+
.WithFallback(PostgreSqlPersistence.DefaultConfiguration())
38+
.WithFallback(SqlReadJournal.DefaultConfiguration())
39+
.WithFallback(Persistence.DefaultConfig());
40+
}
41+
42+
public PostgreSqlCurrentAllEventsSpec(ITestOutputHelper output, PostgresFixture fixture)
43+
: base(Initialize(fixture), nameof(PostgreSqlCurrentAllEventsSpec), output)
44+
{
45+
ReadJournal = Sys.ReadJournalFor<SqlReadJournal>(SqlReadJournal.Identifier);
46+
}
47+
48+
protected override void Dispose(bool disposing)
49+
{
50+
base.Dispose(disposing);
51+
DbUtils.Clean();
52+
}
53+
}
54+
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="PostgreSqlEventsByPersistenceIdSpec.cs" company="Akka.NET Project">
3+
// Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
4+
// Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
5+
// </copyright>
6+
//-----------------------------------------------------------------------
7+
8+
using Akka.Configuration;
9+
using Akka.Persistence.Query;
10+
using Akka.Persistence.Query.Sql;
11+
using Akka.Persistence.TCK.Query;
12+
using Xunit;
13+
using Xunit.Abstractions;
14+
15+
namespace Akka.Persistence.PostgreSql.Tests.Query
16+
{
17+
[Collection("PostgreSqlSpec")]
18+
public class PostgreSqlCurrentEventsByPersistenceIdSpec : CurrentEventsByPersistenceIdSpec
19+
{
20+
private static Config Initialize(PostgresFixture fixture)
21+
{
22+
//need to make sure db is created before the tests start
23+
DbUtils.Initialize(fixture);
24+
25+
return ConfigurationFactory.ParseString($@"
26+
akka.loglevel = INFO
27+
akka.persistence.journal.plugin = ""akka.persistence.journal.postgresql""
28+
akka.persistence.journal.postgresql {{
29+
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
30+
plugin-dispatcher = ""akka.actor.default-dispatcher""
31+
table-name = event_journal
32+
auto-initialize = on
33+
connection-string = """ + DbUtils.ConnectionString + @"""
34+
refresh-interval = 1s
35+
}}
36+
akka.test.single-expect-default = 10s");
37+
}
38+
39+
public PostgreSqlCurrentEventsByPersistenceIdSpec(ITestOutputHelper output, PostgresFixture fixture)
40+
: base(Initialize(fixture), nameof(PostgreSqlCurrentEventsByPersistenceIdSpec), output)
41+
{
42+
ReadJournal = Sys.ReadJournalFor<SqlReadJournal>(SqlReadJournal.Identifier);
43+
}
44+
45+
protected override void Dispose(bool disposing)
46+
{
47+
base.Dispose(disposing);
48+
DbUtils.Clean();
49+
}
50+
}
51+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
//-----------------------------------------------------------------------
2+
// <copyright file="PostgreSqlEventsByTagSpec.cs" company="Akka.NET Project">
3+
// Copyright (C) 2009-2016 Lightbend Inc. <http://www.lightbend.com>
4+
// Copyright (C) 2013-2016 Akka.NET project <https://github.com/akkadotnet/akka.net>
5+
// </copyright>
6+
//-----------------------------------------------------------------------
7+
8+
using Akka.Configuration;
9+
using Akka.Persistence.Journal;
10+
using Akka.Persistence.Query;
11+
using Akka.Persistence.Query.Sql;
12+
using Akka.Persistence.TCK.Query;
13+
using System.Collections.Immutable;
14+
using System.Linq;
15+
using Xunit;
16+
using Xunit.Abstractions;
17+
18+
namespace Akka.Persistence.PostgreSql.Tests.Query
19+
{
20+
[Collection("PostgreSqlSpec")]
21+
public class PostgreSqlCurrentEventsByTagSpec : CurrentEventsByTagSpec
22+
{
23+
private static Config Initialize(PostgresFixture fixture)
24+
{
25+
//need to make sure db is created before the tests start
26+
DbUtils.Initialize(fixture);
27+
28+
return ConfigurationFactory.ParseString($@"
29+
akka.loglevel = INFO
30+
akka.persistence.journal.plugin = ""akka.persistence.journal.postgresql""
31+
akka.persistence.journal.postgresql {{
32+
event-adapters {{
33+
color-tagger = ""Akka.Persistence.TCK.Query.ColorFruitTagger, Akka.Persistence.TCK""
34+
}}
35+
event-adapter-bindings = {{
36+
""System.String"" = color-tagger
37+
}}
38+
class = ""Akka.Persistence.PostgreSql.Journal.PostgreSqlJournal, Akka.Persistence.PostgreSql""
39+
plugin-dispatcher = ""akka.actor.default-dispatcher""
40+
table-name = event_journal
41+
auto-initialize = on
42+
connection-string = """ + DbUtils.ConnectionString + @"""
43+
refresh-interval = 1s
44+
}}
45+
akka.test.single-expect-default = 10s")
46+
.WithFallback(SqlReadJournal.DefaultConfiguration());
47+
}
48+
49+
public PostgreSqlCurrentEventsByTagSpec(ITestOutputHelper output, PostgresFixture fixture)
50+
: base(Initialize(fixture), nameof(PostgreSqlCurrentEventsByTagSpec), output)
51+
{
52+
ReadJournal = Sys.ReadJournalFor<SqlReadJournal>(SqlReadJournal.Identifier);
53+
}
54+
55+
protected override void Dispose(bool disposing)
56+
{
57+
base.Dispose(disposing);
58+
DbUtils.Clean();
59+
}
60+
}
61+
}

0 commit comments

Comments
 (0)