Example #1
0
        public void MessageSerializer_when_given_AtLeastOnceDeliverySnapshot_should_handle_empty_unconfirmed()
        {
            var unconfirmed = new UnconfirmedDelivery[0];
            var snap        = new AtLeastOnceDeliverySnapshot(13, unconfirmed);
            var serializer  = _serialization.FindSerializerFor(snap);

            var bytes        = serializer.ToBinary(snap);
            var deserialized = serializer.FromBinary(bytes, typeof(AtLeastOnceDeliverySnapshot));

            deserialized.ShouldBe(snap);
        }
Example #2
0
        public virtual void SnapshotStore_should_serialize_AtLeastOnceDeliverySnapshot_with_empty_unconfirmed()
        {
            var probe = CreateTestProbe();

            var unconfirmed = new UnconfirmedDelivery[0];
            var atLeastOnceDeliverySnapshot = new AtLeastOnceDeliverySnapshot(13, unconfirmed);

            var metadata = new SnapshotMetadata(Pid, 2);

            SnapshotStore.Tell(new SaveSnapshot(metadata, atLeastOnceDeliverySnapshot), probe.Ref);
            probe.ExpectMsg <SaveSnapshotSuccess>();

            SnapshotStore.Tell(new LoadSnapshot(Pid, SnapshotSelectionCriteria.Latest, long.MaxValue), probe.Ref);
            probe.ExpectMsg <LoadSnapshotResult>(s => s.Snapshot.Snapshot.Equals(atLeastOnceDeliverySnapshot));
        }
Example #3
0
        private GuaranteedDeliverySnapshot SnapshotFrom(byte[] bytes)
        {
            var snap = AtLeastOnceDeliverySnapshot.ParseFrom(bytes);
            var unconfirmedDeliveries = new UnconfirmedDelivery[snap.UnconfirmedDeliveriesCount];

            for (int i = 0; i < snap.UnconfirmedDeliveriesCount; i++)
            {
                var unconfirmed         = snap.UnconfirmedDeliveriesList[i];
                var unconfirmedDelivery = new UnconfirmedDelivery(
                    deliveryId: unconfirmed.DeliveryId,
                    destination: ActorPath.Parse(unconfirmed.Destination),
                    message: PayloadFromProto(unconfirmed.Payload));
                unconfirmedDeliveries[i] = unconfirmedDelivery;
            }

            return(new GuaranteedDeliverySnapshot(snap.CurrentDeliveryId, unconfirmedDeliveries));
        }
        private GuaranteedDeliverySnapshot SnapshotFrom(byte[] bytes)
        {
            var snap = AtLeastOnceDeliverySnapshot.ParseFrom(bytes);
            var unconfirmedDeliveries = new UnconfirmedDelivery[snap.UnconfirmedDeliveriesCount];

            for (int i = 0; i < snap.UnconfirmedDeliveriesCount; i++)
            {
                var unconfirmed = snap.UnconfirmedDeliveriesList[i];
                var unconfirmedDelivery = new UnconfirmedDelivery(
                    deliveryId: unconfirmed.DeliveryId,
                    destination: ActorPath.Parse(unconfirmed.Destination),
                    message: PayloadFromProto(unconfirmed.Payload));
                unconfirmedDeliveries[i] = unconfirmedDelivery;
            }

            return new GuaranteedDeliverySnapshot(snap.CurrentDeliveryId, unconfirmedDeliveries);
        }
Example #5
0
        public void MessageSerializer_when_given_AtLeastOnceDeliverySnapshot_should_handle_empty_unconfirmed()
        {
            var unconfirmed = new UnconfirmedDelivery[0];
            var snap = new AtLeastOnceDeliverySnapshot(13, unconfirmed);
            var serializer = _serialization.FindSerializerFor(snap);

            var bytes = serializer.ToBinary(snap);
            var deserialized = serializer.FromBinary(bytes, typeof (AtLeastOnceDeliverySnapshot));

            deserialized.ShouldBe(snap);
        }