Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add default constructor to Akka.Remote.Ack #4787

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/core/Akka.Remote.Tests/Serialization/BugFix4399Spec.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Akka.Actor;
using Akka.Serialization;
using Akka.TestKit;
using Xunit;

namespace Akka.Remote.Tests.Serialization
{
public class BugFix4399Spec : AkkaSpec
{
[Fact]
public void JsonSerializer_should_be_able_to_serialize_Ack()
{
var serializer = new NewtonSoftJsonSerializer((ExtendedActorSystem) Sys);

var nacks = new List<SeqNo>();
for (var i = 100; i < 200; ++i)
{
nacks.Add(new SeqNo(i));
}

var message = new Ack(new SeqNo(666), nacks);
var serializedBytes = serializer.ToBinary(message);
var deserialized = (Ack)serializer.FromBinary(serializedBytes, typeof(Ack));

deserialized.CumulativeAck.RawValue.ShouldBe(666);
deserialized.Nacks.Count.ShouldBe(100);
var seqNos = deserialized.Nacks.Select(ack => (int)ack.RawValue);
seqNos.ShouldOnlyContainInOrder(Enumerable.Range(100, 100).ToArray());
}
}
}
4 changes: 4 additions & 0 deletions src/core/Akka.Remote/AckedDelivery.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ internal interface IHasSequenceNumber
/// </summary>
internal sealed class Ack
{
[Obsolete("Only used for serialization", true)]
public Ack()
{ }

/// <summary>
/// Class representing an acknowledgement with select negative acknowledgements.
/// </summary>
Expand Down