Skip to content

Commit

Permalink
Adding v1.3.14-style serialization (#71)
Browse files Browse the repository at this point in the history
* added proper IActorRef serialization for MongoDb binary format

* added all Akka.Persistence.TCK.Serialization specs

* added v1.4.0 release notes

* close #72
  • Loading branch information
Aaronontheweb authored Oct 30, 2019
1 parent 57faceb commit 3802e52
Show file tree
Hide file tree
Showing 12 changed files with 211 additions and 202 deletions.
8 changes: 2 additions & 6 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
#### 1.3.14 October 04 2019 ####
You can see [the full set of changes for Akka.Persistence.MongoDb v1.3.14 here](https://github.com/akkadotnet/Akka.Persistence.MongoDB/milestone/2).

This PR fixes a number of problems stemming from implementations of Akka.Persistence.Query implementations that were incorrect.

**Note: we're working on [adding support for future versions of Akka.Persistence.MongoDB and you should read them here if you plan on continuing to use the plugin](https://github.com/akkadotnet/Akka.Persistence.MongoDB/issues/72).**
#### 1.4.0-beta1 October 30 2019 ####
Beta release of Akka.Persistence.MongoDB which implements the [new standardized Akka.Persistence serialization paradigm](https://github.com/akkadotnet/Akka.Persistence.MongoDB/issues/72) going forward. Has full backwards compatibility for reading events which were written in 1.3.[0-14] style serialization.
2 changes: 1 addition & 1 deletion src/Akka.Persistence.MongoDb.Tests/Bug61FixSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,4 +206,4 @@ class = ""Akka.Persistence.MongoDb.Query.MongoDbReadJournalProvider, Akka.Persis
return ConfigurationFactory.ParseString(specString);
}
}
}
}
32 changes: 0 additions & 32 deletions src/Akka.Persistence.MongoDb.Tests/MongoDbJournalSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,4 @@ class = ""Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.Mong
return ConfigurationFactory.ParseString(specString);
}
}

[Collection("MongoDbSpec")]
public class MongoDbBinaryJournalSpec : JournalSpec, IClassFixture<DatabaseFixture>
{
protected override bool SupportsRejectingNonSerializableObjects { get; } = false;

public MongoDbBinaryJournalSpec(DatabaseFixture databaseFixture) : base(CreateSpecConfig(databaseFixture), "MongoDbJournalSpec")
{
Initialize();
}

private static Config CreateSpecConfig(DatabaseFixture databaseFixture)
{
var specString = @"
akka.test.single-expect-default = 3s
akka.persistence {
publish-plugin-commands = on
journal {
plugin = ""akka.persistence.journal.mongodb""
mongodb {
class = ""Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb""
connection-string = """ + databaseFixture.ConnectionString + @"""
auto-initialize = on
collection = ""EventJournal""
stored-as = binary
}
}
}";

return ConfigurationFactory.ParseString(specString);
}
}
}
2 changes: 0 additions & 2 deletions src/Akka.Persistence.MongoDb.Tests/MongoDbSettingsSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public void Mongo_JournalSettings_must_have_default_values()
mongoPersistence.JournalSettings.AutoInitialize.Should().BeFalse();
mongoPersistence.JournalSettings.Collection.Should().Be("EventJournal");
mongoPersistence.JournalSettings.MetadataCollection.Should().Be("Metadata");
mongoPersistence.JournalSettings.StoredAs.Should().BeOfType<StoredAsType>();
}

[Fact]
Expand All @@ -33,7 +32,6 @@ public void Mongo_SnapshotStoreSettingsSettings_must_have_default_values()
mongoPersistence.SnapshotStoreSettings.ConnectionString.Should().Be(string.Empty);
mongoPersistence.SnapshotStoreSettings.AutoInitialize.Should().BeFalse();
mongoPersistence.SnapshotStoreSettings.Collection.Should().Be("SnapshotStore");
mongoPersistence.SnapshotStoreSettings.StoredAs.Should().BeOfType<StoredAsType>();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
using System.Collections.Generic;
using Akka.Configuration;
using Akka.Persistence.TCK.Serialization;
using Akka.Util.Internal;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Persistence.MongoDb.Tests.Serialization
{
[Collection("MongoDbSpec")]
public class MongoDbJournalSerializationSpec : JournalSerializationSpec, IClassFixture<DatabaseFixture>
{
public static readonly AtomicCounter Counter = new AtomicCounter(0);
private readonly ITestOutputHelper _output;

public MongoDbJournalSerializationSpec(ITestOutputHelper output, DatabaseFixture databaseFixture)
: base(CreateSpecConfig(databaseFixture, Counter.GetAndIncrement()), nameof(MongoDbJournalSerializationSpec), output)
{
_output = output;
output.WriteLine(databaseFixture.ConnectionString + Counter.Current);
}

private static Config CreateSpecConfig(DatabaseFixture databaseFixture, int id)
{
var specString = @"
akka.test.single-expect-default = 3s
akka.persistence {
publish-plugin-commands = on
journal {
plugin = ""akka.persistence.journal.mongodb""
mongodb {
class = ""Akka.Persistence.MongoDb.Journal.MongoDbJournal, Akka.Persistence.MongoDb""
connection-string = """ + databaseFixture.ConnectionString + @"""
auto-initialize = on
collection = ""EventJournal""
stored-as = object
}
}
}";

return ConfigurationFactory.ParseString(specString);
}


[Fact(Skip = "Waiting on better error messages")]
public override void Journal_should_serialize_Persistent_with_EventAdapter_manifest()
{
base.Journal_should_serialize_Persistent_with_EventAdapter_manifest();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Akka.Configuration;
using Akka.Persistence.TCK.Serialization;
using Akka.Util.Internal;
using Xunit;
using Xunit.Abstractions;

namespace Akka.Persistence.MongoDb.Tests.Serialization
{
[Collection("MongoDbSpec")]
public class MongoDbSnapshotStoreSerializationSpec : SnapshotStoreSerializationSpec, IClassFixture<DatabaseFixture>
{
public static readonly AtomicCounter Counter = new AtomicCounter(0);
private readonly ITestOutputHelper _output;

public MongoDbSnapshotStoreSerializationSpec(ITestOutputHelper output, DatabaseFixture databaseFixture)
: base(CreateSpecConfig(databaseFixture, Counter.GetAndIncrement()), nameof(MongoDbSnapshotStoreSerializationSpec), output)
{
_output = output;
output.WriteLine(databaseFixture.ConnectionString + Counter.Current);
}

private static Config CreateSpecConfig(DatabaseFixture databaseFixture, int id)
{
var specString = @"
akka.test.single-expect-default = 3s
akka.persistence {
publish-plugin-commands = on
snapshot-store {
plugin = ""akka.persistence.snapshot-store.mongodb""
mongodb {
class = ""Akka.Persistence.MongoDb.Snapshot.MongoDbSnapshotStore, Akka.Persistence.MongoDb""
connection-string = """ + databaseFixture.ConnectionString + id + @"""
auto-initialize = on
collection = ""SnapshotStore""
}
}
}";

return ConfigurationFactory.ParseString(specString);
}
}
}
Loading

0 comments on commit 3802e52

Please sign in to comment.