Skip to content
Closed
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
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using Obvs.Configuration;
using System;
using Obvs.Configuration;

namespace Obvs.Serialization.MessagePack.Configuration
{
public static class FluentConfigExtensions
{
[Obsolete("MsgPack.Cli is no longer maintained; use SerializedAsMessagePackCSharp() from Obvs.Serialization.MessagePack-CSharp instead")]
public static ICanCreateEndpointAsClientOrServer<TMessage, TCommand, TEvent, TRequest, TResponse> SerializedAsMsgPack<TMessage, TCommand, TEvent, TRequest, TResponse>(this ICanSpecifyEndpointSerializers<TMessage, TCommand, TEvent, TRequest, TResponse> config)
where TMessage : class
where TCommand : class, TMessage
Expand Down
2 changes: 2 additions & 0 deletions Obvs.Serialization.MessagePack/MsgPackMessageDeserializer.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System;
using System.IO;
using MsgPack.Serialization;

namespace Obvs.Serialization.MessagePack
{
[Obsolete("MsgPack.Cli is no longer maintained; use Obvs.Serialization.MessagePack-CSharp instead")]
public class MsgPackMessageDeserializer<TMessage> : MessageDeserializerBase<TMessage>
where TMessage : class
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace Obvs.Serialization.MessagePack
{
[Obsolete("MsgPack.Cli is no longer maintained; use Obvs.Serialization.MessagePack-CSharp instead")]
public class MsgPackMessageDeserializerFactory : IMessageDeserializerFactory
{
public IEnumerable<IMessageDeserializer<TMessage>> Create<TMessage, TServiceMessage>(Func<Assembly, bool> assemblyFilter = null, Func<Type, bool> typeFilter = null)
Expand Down
4 changes: 3 additions & 1 deletion Obvs.Serialization.MessagePack/MsgPackMessageSerializer.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.IO;
using System;
using System.IO;
using MsgPack.Serialization;

namespace Obvs.Serialization.MessagePack
{
[Obsolete("MsgPack.Cli is no longer maintained; use Obvs.Serialization.MessagePack-CSharp instead")]
public class MsgPackMessageSerializer : IMessageSerializer
{
public void Serialize(Stream destination, object message)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Version>1.0.0</Version>
<Authors />
<PackageProjectUrl>http://christopherread.github.io/Obvs</PackageProjectUrl>
<PackageReleaseNotes>Minor dependency update</PackageReleaseNotes>
<Description>MessagePack serialization for Obvs</Description>
<PackageReleaseNotes>Deprecated: MsgPack.Cli is no longer maintained. Use Obvs.Serialization.MessagePack-CSharp instead.</PackageReleaseNotes>
<Description>Deprecated: use Obvs.Serialization.MessagePack-CSharp. MessagePack serialization for Obvs using MsgPack.Cli, which is no longer maintained.</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
28 changes: 28 additions & 0 deletions Obvs.Serialization.Tests/TestMsgPackSerialization.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// These tests exercise the deprecated MsgPack.Cli serializer on purpose
#pragma warning disable CS0618

using System;
using System.Reflection;
using FakeItEasy;
using Xunit;
using Obvs.Configuration;
Expand All @@ -11,6 +15,30 @@ namespace Obvs.Serialization.Tests

public class TestMsgPackSerialization
{
[Theory]
[InlineData(typeof(MsgPackMessageSerializer))]
[InlineData(typeof(MsgPackMessageDeserializer<>))]
[InlineData(typeof(MsgPackMessageDeserializerFactory))]
public void ShouldBeObsoleteInFavourOfMessagePackCSharp(Type type)
{
var obsolete = type.GetCustomAttribute<ObsoleteAttribute>();

Assert.NotNull(obsolete);
Assert.False(obsolete.IsError);
Assert.Contains("Obvs.Serialization.MessagePack-CSharp", obsolete.Message);
}

[Fact]
public void FluentConfigShouldBeObsoleteInFavourOfMessagePackCSharp()
{
// Obvs.Serialization.MessagePack-CSharp has a class with the same full name, so look it up in this package's assembly
var extensions = typeof(MsgPackMessageSerializer).Assembly.GetType("Obvs.Serialization.MessagePack.Configuration.FluentConfigExtensions");
var obsolete = extensions.GetMethod("SerializedAsMsgPack").GetCustomAttribute<ObsoleteAttribute>();

Assert.NotNull(obsolete);
Assert.Contains("SerializedAsMessagePackCSharp", obsolete.Message);
}

[Fact]
public void ShouldSerializeToMsgPack()
{
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
### Extensions

* Transports: ActiveMQ / RabbitMQ / NetMQ / AzureServiceBus / Kafka / EventStore
* Serialization: XML / JSON.Net / NetJson / ProtoBuf / MsgPack
* Serialization: XML / JSON.Net / NetJson / ProtoBuf / MessagePack (via MessagePack-CSharp; the MsgPack.Cli-based package is deprecated)
* Logging: NLog / log4net
* Monitoring: Performance Counters / ElasticSearch

Expand Down
Loading