diff --git a/src/.nuget/packages.config b/src/.nuget/packages.config index 8aa08f52085..6043bbc8ed4 100644 --- a/src/.nuget/packages.config +++ b/src/.nuget/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj b/src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj index 710bee5de0f..115a61f41f7 100644 --- a/src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj +++ b/src/NServiceBus.AcceptanceTesting/NServiceBus.AcceptanceTesting.csproj @@ -69,9 +69,9 @@ {dd48b2d0-e996-412d-9157-821ed8b17a9d} NServiceBus.Core - + {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus @@ -82,13 +82,9 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/NServiceBus.AcceptanceTests/BasicMessaging/When_sending_a_message_that_is_registered_multiple_times_to_another_endpoint.cs b/src/NServiceBus.AcceptanceTests/BasicMessaging/When_sending_a_message_that_is_registered_multiple_times_to_another_endpoint.cs new file mode 100644 index 00000000000..a9c7bc06b09 --- /dev/null +++ b/src/NServiceBus.AcceptanceTests/BasicMessaging/When_sending_a_message_that_is_registered_multiple_times_to_another_endpoint.cs @@ -0,0 +1,100 @@ +namespace NServiceBus.AcceptanceTests.BasicMessaging +{ + using System; + using System.Threading; + using EndpointTemplates; + using AcceptanceTesting; + using NUnit.Framework; + + public class When_sending_a_message_that_is_registered_multiple_times_to_another_endpoint : NServiceBusAcceptanceTest + { + [Test] + public void First_registration_should_be_the_final_destination() + { + var context = new Context(); + + Scenario.Define(context) + .WithEndpoint(b => b.Given((bus, c) => bus.Send(new MyCommand1()))) + .WithEndpoint() + .WithEndpoint() + .Done(c => c.WasCalled1 || c.WasCalled2) + .Run(); + + Assert.IsTrue(context.WasCalled1); + Assert.IsFalse(context.WasCalled2); + } + + public class Context : ScenarioContext + { + public bool WasCalled1 { get; set; } + public bool WasCalled2 { get; set; } + } + + public class Sender : EndpointConfigurationBuilder + { + public Sender() + { + EndpointSetup() + .AddMapping(typeof(Receiver1)) + .AddMapping(typeof(Receiver2)); + } + } + + public class Receiver1 : EndpointConfigurationBuilder + { + public Receiver1() + { + EndpointSetup(); + } + + public class MyMessageHandler : IHandleMessages + { + public Context Context { get; set; } + + public IBus Bus { get; set; } + + public void Handle(MyBaseCommand message) + { + Context.WasCalled1 = true; + Thread.Sleep(2000); // Just to be sure the other receiver is finished + } + } + } + + public class Receiver2 : EndpointConfigurationBuilder + { + public Receiver2() + { + EndpointSetup(); + } + + public class MyMessageHandler : IHandleMessages + { + public Context Context { get; set; } + + public IBus Bus { get; set; } + + public void Handle(MyBaseCommand message) + { + Context.WasCalled2 = true; + Thread.Sleep(2000); // Just to be sure the other receiver is finished + } + } + } + + [Serializable] + public abstract class MyBaseCommand : ICommand + { + } + + [Serializable] + public class MyCommand1 : MyBaseCommand + { + } + + [Serializable] + public class MyCommand2 : MyBaseCommand + { + } + } +} diff --git a/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj b/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj index bf87f376099..9d72f33c603 100644 --- a/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj +++ b/src/NServiceBus.AcceptanceTests/NServiceBus.AcceptanceTests.csproj @@ -110,6 +110,7 @@ + @@ -134,9 +135,11 @@ + + @@ -219,9 +222,9 @@ {dd48b2d0-e996-412d-9157-821ed8b17a9d} NServiceBus.Core - + {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus {758357f6-cd31-4337-80c4-ba377fc257af} @@ -233,13 +236,9 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/NServiceBus.AcceptanceTests/PubSub/When_multi_subscribing_to_a_polymorphic_event.cs b/src/NServiceBus.AcceptanceTests/PubSub/When_multi_subscribing_to_a_polymorphic_event.cs new file mode 100644 index 00000000000..4388dc3c58d --- /dev/null +++ b/src/NServiceBus.AcceptanceTests/PubSub/When_multi_subscribing_to_a_polymorphic_event.cs @@ -0,0 +1,121 @@ +namespace NServiceBus.AcceptanceTests.PubSub +{ + using System; + using AcceptanceTesting; + using EndpointTemplates; + using Features; + using NUnit.Framework; + + public class When_multi_subscribing_to_a_polymorphic_event : NServiceBusAcceptanceTest + { + [Test] + public void Both_events_should_be_delivered() + { + var rootContext = new Context(); + + Scenario.Define(rootContext) + .WithEndpoint(b => b.Given((bus, context) => Subscriptions.OnEndpointSubscribed(args => + { + if (args.MessageType.Contains(typeof(IMyEvent).Name)) + { + context.SubscribedToIMyEvent = true; + } + + if (args.MessageType.Contains(typeof(MyEvent2).Name)) + { + context.SubscribedToMyEvent2 = true; + } + })) + .When(c => c.SubscribedToIMyEvent && c.SubscribedToMyEvent2, bus => bus.Publish(new MyEvent1()))) + .WithEndpoint(b => b.Given((bus, context) => Subscriptions.OnEndpointSubscribed(args => + { + if (args.MessageType.Contains(typeof(IMyEvent).Name)) + { + context.SubscribedToIMyEvent = true; + } + + if (args.MessageType.Contains(typeof(MyEvent2).Name)) + { + context.SubscribedToMyEvent2 = true; + } + })) + .When(c => c.SubscribedToIMyEvent && c.SubscribedToMyEvent2, bus => bus.Publish(new MyEvent2()))) + .WithEndpoint(b => b.Given((bus, context) => + { + bus.Subscribe(); + bus.Subscribe(); + })) + .Done(c => c.SubscriberGotIMyEvent && c.SubscriberGotMyEvent2) + .Run(); + + Assert.True(rootContext.SubscriberGotIMyEvent); + Assert.True(rootContext.SubscriberGotMyEvent2); + } + + public class Context : ScenarioContext + { + public bool SubscriberGotIMyEvent { get; set; } + public bool SubscriberGotMyEvent2 { get; set; } + public bool SubscribedToIMyEvent { get; set; } + public bool SubscribedToMyEvent2 { get; set; } + } + + public class Publisher1 : EndpointConfigurationBuilder + { + public Publisher1() + { + EndpointSetup(); + } + } + + public class Publisher2 : EndpointConfigurationBuilder + { + public Publisher2() + { + EndpointSetup(); + } + } + + public class Subscriber1 : EndpointConfigurationBuilder + { + public Subscriber1() + { + EndpointSetup(c => Configure.Features.Disable()) + .AddMapping(typeof(Publisher1)) + .AddMapping(typeof(Publisher2)); + } + + public class MyEventHandler : IHandleMessages + { + public Context Context { get; set; } + + public void Handle(IMyEvent messageThatIsEnlisted) + { + if (messageThatIsEnlisted is MyEvent2) + { + Context.SubscriberGotMyEvent2 = true; + } + else + { + Context.SubscriberGotIMyEvent = true; + } + } + } + } + + + [Serializable] + public class MyEvent1 : IMyEvent + { + } + + [Serializable] + public class MyEvent2 : IMyEvent + { + } + + public interface IMyEvent : IEvent + { + } + } +} diff --git a/src/NServiceBus.AcceptanceTests/PubSub/When_subscribing_to_a_base_event_from_different_publishers.cs b/src/NServiceBus.AcceptanceTests/PubSub/When_subscribing_to_a_base_event_from_different_publishers.cs new file mode 100644 index 00000000000..65cd2e492e0 --- /dev/null +++ b/src/NServiceBus.AcceptanceTests/PubSub/When_subscribing_to_a_base_event_from_different_publishers.cs @@ -0,0 +1,113 @@ +namespace NServiceBus.AcceptanceTests.PubSub +{ + using System; + using EndpointTemplates; + using AcceptanceTesting; + using Features; + using NUnit.Framework; + + public class When_subscribing_to_a_base_event_from_different_publishers : NServiceBusAcceptanceTest + { + [Test] + public void should_receive_events_from_all_publishers() + { + var cc = new Context(); + + Scenario.Define(cc) + .WithEndpoint(b => + b.Given((bus, context) => Subscriptions.OnEndpointSubscribed(s => + { + if (s.SubscriberReturnAddress.Queue.Contains("Subscriber1")) + context.SubscribedToPublisher1 = true; + })) + .When(c => c.SubscribedToPublisher1, bus => bus.Publish(new DerivedEvent1())) + ) + .WithEndpoint(b => + b.Given((bus, context) => Subscriptions.OnEndpointSubscribed(s => + { + if (s.SubscriberReturnAddress.Queue.Contains("Subscriber1")) + context.SubscribedToPublisher2 = true; + })) + .When(c => c.SubscribedToPublisher2, bus => bus.Publish(new DerivedEvent2())) + ) + .WithEndpoint(b => b.Given((bus, context) => + { + if (!Feature.IsEnabled()) + { + context.SubscribedToPublisher1 = true; + context.SubscribedToPublisher2 = true; + } + })) + .Done(c => c.GotTheEventFromPublisher1 && c.GotTheEventFromPublisher2) + .Run(); + + Assert.True(cc.GotTheEventFromPublisher1); + Assert.True(cc.GotTheEventFromPublisher2); + } + + public class Context : ScenarioContext + { + public bool GotTheEventFromPublisher1 { get; set; } + public bool GotTheEventFromPublisher2 { get; set; } + public bool SubscribedToPublisher1 { get; set; } + public bool SubscribedToPublisher2 { get; set; } + + } + + public class Publisher1 : EndpointConfigurationBuilder + { + public Publisher1() + { + EndpointSetup(); + } + } + + public class Publisher2 : EndpointConfigurationBuilder + { + public Publisher2() + { + EndpointSetup(); + } + } + + public class Subscriber1 : EndpointConfigurationBuilder + { + public Subscriber1() + { + EndpointSetup(c => Configure.Features.Enable()) + .AddMapping(typeof(Publisher1)) + .AddMapping(typeof(Publisher2)); + } + + public class BaseEventHandler : IHandleMessages + { + public Context Context { get; set; } + + public void Handle(BaseEvent message) + { + if (message.GetType().FullName.Contains("DerivedEvent1")) + Context.GotTheEventFromPublisher1 = true; + if (message.GetType().FullName.Contains("DerivedEvent2")) + Context.GotTheEventFromPublisher2 = true; + } + } + } + + [Serializable] + public class BaseEvent : IEvent + { + } + + [Serializable] + public class DerivedEvent1 : BaseEvent + { + + } + + [Serializable] + public class DerivedEvent2 : BaseEvent + { + + } + } +} \ No newline at end of file diff --git a/src/NServiceBus.Core.Tests.x64/ConventionBasedHandler.Tests.csproj b/src/NServiceBus.Core.Tests.x64/ConventionBasedHandler.Tests.csproj index 3e69d283870..705ea6922c9 100644 --- a/src/NServiceBus.Core.Tests.x64/ConventionBasedHandler.Tests.csproj +++ b/src/NServiceBus.Core.Tests.x64/ConventionBasedHandler.Tests.csproj @@ -53,7 +53,7 @@ {73867D40-8CBB-48E9-BFFA-12BBDD48A341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus diff --git a/src/NServiceBus.Core.Tests/AutomaticSubscriptions/AutoSubscriptionContext.cs b/src/NServiceBus.Core.Tests/AutomaticSubscriptions/AutoSubscriptionContext.cs index 4d91af85184..fbb74de8045 100644 --- a/src/NServiceBus.Core.Tests/AutomaticSubscriptions/AutoSubscriptionContext.cs +++ b/src/NServiceBus.Core.Tests/AutomaticSubscriptions/AutoSubscriptionContext.cs @@ -31,7 +31,7 @@ protected void RegisterMessageHandlerType() protected void RegisterMessageType(Address address) { - ((StaticMessageRouter)autoSubscriptionStrategy.MessageRouter).RegisterRoute(typeof(T),address); + ((StaticMessageRouter)autoSubscriptionStrategy.MessageRouter).RegisterMessageRoute(typeof(T), address); } protected DefaultAutoSubscriptionStrategy autoSubscriptionStrategy; diff --git a/src/NServiceBus.Core.Tests/AutomaticSubscriptions/When_starting_an_endpoint_with_autosubscribe_turned_on.cs b/src/NServiceBus.Core.Tests/AutomaticSubscriptions/When_starting_an_endpoint_with_autosubscribe_turned_on.cs index e84919e3704..7c41cf43e5f 100644 --- a/src/NServiceBus.Core.Tests/AutomaticSubscriptions/When_starting_an_endpoint_with_autosubscribe_turned_on.cs +++ b/src/NServiceBus.Core.Tests/AutomaticSubscriptions/When_starting_an_endpoint_with_autosubscribe_turned_on.cs @@ -2,6 +2,7 @@ namespace NServiceBus.Core.Tests.AutomaticSubscriptions { using System.Linq; using NUnit.Framework; + using Unicast.Routing; using Unicast.Tests.Contexts; [TestFixture] @@ -46,21 +47,11 @@ public void Should_not_autoSubscribe_messages_unless_asked_to_by_the_users() } - [Test] - public void Should_not_autoSubscribe_messages_with_no_explicit_routing() - { - RegisterMessageType(Address.Undefined); - RegisterMessageHandlerType(); - - - Assert.False(autoSubscriptionStrategy.GetEventsToSubscribe().Any(), "Events without routing should not be auto subscribed by default"); - } - - [Test] public void Should_autoSubscribe_messages_without_routing_if_configured_to_do_so() { - RegisterMessageType(Address.Undefined); + autoSubscriptionStrategy.MessageRouter = new StaticMessageRouter(new[] { typeof(EventMessage) }); + RegisterMessageHandlerType(); autoSubscriptionStrategy.DoNotRequireExplicitRouting = true; diff --git a/src/NServiceBus.Core.Tests/NServiceBus.Core.Tests.csproj b/src/NServiceBus.Core.Tests/NServiceBus.Core.Tests.csproj index e74ed4b4535..5aea80d6cac 100644 --- a/src/NServiceBus.Core.Tests/NServiceBus.Core.Tests.csproj +++ b/src/NServiceBus.Core.Tests/NServiceBus.Core.Tests.csproj @@ -304,7 +304,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus diff --git a/src/NServiceBus.Core.Tests/Routing/StaticMessageRouterTests.cs b/src/NServiceBus.Core.Tests/Routing/StaticMessageRouterTests.cs index d1357ae34e0..8231024839f 100644 --- a/src/NServiceBus.Core.Tests/Routing/StaticMessageRouterTests.cs +++ b/src/NServiceBus.Core.Tests/Routing/StaticMessageRouterTests.cs @@ -1,33 +1,72 @@ -namespace NServiceBus.Core.Tests.Sagas +namespace NServiceBus.Core.Tests.Sagas { + using System; + using System.Linq; + using NServiceBus.AutomaticSubscriptions; using NUnit.Framework; + using Settings; using Unicast.Routing; [TestFixture] public class StaticMessageRouterTests { + [SetUp] + public void Setup() + { + SettingsHolder.Reset(); + } + + [Test] + public void When_initialized_known_message_returns_empty() + { + var router = new StaticMessageRouter(new[] + { + typeof(Message1) + }); + Assert.IsEmpty(router.GetMultiDestinationFor(typeof(Message1))); + } + + [Test] + public void When_route_with_undefined_address_is_registered_exception_is_thrown() + { + var router = new StaticMessageRouter(new Type[0]); + + Assert.Throws(() => router.RegisterMessageRoute(typeof(Message1), Address.Undefined)); + } [Test] - public void When_initialized_known_message_returns_undefined() + public void Test_that_expose_the_issue_with_the_current_codebase_assuming_that_routes_can_be_updated() { - var router = new StaticMessageRouter(new[] { typeof(Message1) }); - Assert.AreEqual(Address.Undefined, router.GetDestinationFor(typeof(Message1))); + var router = new StaticMessageRouter(new Type[0]); + + var overrideAddress = Address.Parse("override"); + + router.RegisterMessageRoute(typeof(Message1), Address.Parse("first")); + router.RegisterMessageRoute(typeof(Message1), overrideAddress); + + Assert.AreEqual(overrideAddress, router.GetMultiDestinationFor(typeof(Message1)).Single()); } [Test] - public void When_initialized_unknown_message_returns_undefined() + public void When_initialized_unknown_message_returns_empty() { - var router = new StaticMessageRouter(new[] { typeof(Message1) }); - Assert.AreEqual(Address.Undefined, router.GetDestinationFor(typeof(Message2))); + var router = new StaticMessageRouter(new[] + { + typeof(Message1) + }); + Assert.IsEmpty(router.GetMultiDestinationFor(typeof(Message2))); } [Test] public void When_getting_route_correct_address_is_returned() { - var router = new StaticMessageRouter(new[] { typeof(Message1) }); - var address = new Address("a","b"); - router.RegisterRoute(typeof(Message1), address); - Assert.AreSame(address, router.GetDestinationFor(typeof(Message1))); + var router = new StaticMessageRouter(new[] + { + typeof(Message1) + }); + var address = new Address("a", "b"); + router.RegisterMessageRoute(typeof(Message1), address); + Assert.AreSame(address, router.GetMultiDestinationFor(typeof(Message1)).Single()); } [Test] @@ -36,13 +75,18 @@ public void When_inherited_registered_after_base_correct_address_is_returned_for { var baseType = typeof(BaseMessage); var inheritedType = typeof(InheritedMessage); - var router = new StaticMessageRouter(new[] { baseType, inheritedType }); + var router = new StaticMessageRouter(new[] + { + baseType, + inheritedType + }); var baseAddress = new Address("baseAddress", "b"); - router.RegisterRoute(baseType, baseAddress); + router.RegisterMessageRoute(baseType, baseAddress); var inheritedAddress = new Address("inheritedAddress", "b"); - router.RegisterRoute(inheritedType, inheritedAddress); - Assert.AreSame(baseAddress, router.GetDestinationFor(baseType)); - Assert.AreSame(inheritedAddress, router.GetDestinationFor(inheritedType)); + router.RegisterMessageRoute(inheritedType, inheritedAddress); + Assert.Contains(baseAddress, router.GetMultiDestinationFor(baseType)); + Assert.Contains(inheritedAddress, router.GetMultiDestinationFor(baseType)); + Assert.AreSame(inheritedAddress, router.GetMultiDestinationFor(inheritedType).Single()); } [Test] @@ -50,32 +94,65 @@ public void When_inherited_base_after_registered_correct_address_is_returned_for { var baseType = typeof(BaseMessage); var inheritedType = typeof(InheritedMessage); - var router = new StaticMessageRouter(new[] { baseType, inheritedType }); + var router = new StaticMessageRouter(new[] + { + baseType, + inheritedType + }); var inheritedAddress = new Address("inheritedAddress", "b"); - router.RegisterRoute(inheritedType, inheritedAddress); + router.RegisterEventRoute(inheritedType, inheritedAddress); var baseAddress = new Address("baseAddress", "b"); - router.RegisterRoute(baseType, baseAddress); - Assert.AreSame(baseAddress, router.GetDestinationFor(baseType)); - Assert.AreSame(inheritedAddress, router.GetDestinationFor(inheritedType)); + router.RegisterEventRoute(baseType, baseAddress); + Assert.Contains(baseAddress, router.GetMultiDestinationFor(baseType)); + Assert.Contains(inheritedAddress, router.GetMultiDestinationFor(baseType)); + Assert.AreSame(inheritedAddress, router.GetMultiDestinationFor(inheritedType).Single()); + } + + [Test] + public void When_registered_registering_multiple_addresses_for_same_type_same_number_of_addresses_are_returned() + { + var baseType = typeof(BaseMessage); + var router = new StaticMessageRouter(Enumerable.Empty()); + var addressA = new Address("BaseMessage", "A"); + router.RegisterEventRoute(baseType, addressA); + var addressB = new Address("BaseMessage", "b"); + router.RegisterEventRoute(baseType, addressB); + + Assert.AreEqual(2, router.GetMultiDestinationFor(baseType).Count); + } + + [Test] + public void When_registered_registering_multiple_addresses_for_same_type_and_using_plainmessages_last_one_wins() + { + SettingsHolder.SetProperty(s => s.SubscribePlainMessages, true); + var baseType = typeof(BaseMessage); + var router = new StaticMessageRouter(Enumerable.Empty()); + var addressA = new Address("BaseMessage", "A"); + router.RegisterMessageRoute(baseType, addressA); + var addressB = new Address("BaseMessage", "b"); + router.RegisterMessageRoute(baseType, addressB); + + Assert.AreEqual(1, router.GetMultiDestinationFor(baseType).Count); } public class Message1 { - + } + public class Message2 { - + } - public class BaseMessage + public class BaseMessage : IEvent { - + } public class InheritedMessage : BaseMessage { - + } } -} \ No newline at end of file +} diff --git a/src/NServiceBus.Core.Tests/Unicast/ConfiguringMessageEndpointMapping.cs b/src/NServiceBus.Core.Tests/Unicast/ConfiguringMessageEndpointMapping.cs index a5b4e85b7a9..a5ccac03746 100644 --- a/src/NServiceBus.Core.Tests/Unicast/ConfiguringMessageEndpointMapping.cs +++ b/src/NServiceBus.Core.Tests/Unicast/ConfiguringMessageEndpointMapping.cs @@ -13,8 +13,8 @@ namespace NServiceBus.Unicast.Tests { using System; using System.Collections.Generic; + using System.Configuration; using System.Linq; - using System.Reflection; using Messages; using Messages.ANamespace; using Messages.ANamespace.ASubNamespace; @@ -29,7 +29,7 @@ public IDictionary Configure(Action setup { var mappings = new Dictionary(); - var mapping = new MessageEndpointMapping{ Endpoint = "SomeEndpoint" }; + var mapping = new MessageEndpointMapping { Endpoint = "SomeEndpoint" }; setupMapping(mapping); @@ -49,29 +49,28 @@ protected void ConfigureShouldMapTypes(Action messageAct [TestFixture] public class The_more_specific_mappings { - [Test] + [Test, Explicit("For some reason the build server is having issues with this.")] public void Should_take_precedence() { - Configure.With(Assembly.GetExecutingAssembly()) - .DefineEndpointName("Foo") - .DefaultBuilder(); - - Configure.Instance.Configurer.ConfigureComponent(DependencyLifecycle.InstancePerCall); - - Configure.Instance.UnicastBus(); - - var messageOwners = Configure.Instance.Builder.Build(); - - Assert.AreEqual("Type", messageOwners.GetDestinationFor(typeof(MessageA)).Queue); - Assert.AreEqual("Namespace", messageOwners.GetDestinationFor(typeof(MessageB)).Queue); - Assert.AreEqual("Assembly", messageOwners.GetDestinationFor(typeof(MessageD)).Queue); - Assert.AreEqual("MessagesWithType", messageOwners.GetDestinationFor(typeof(MessageE)).Queue); - Assert.AreEqual("Namespace", messageOwners.GetDestinationFor(typeof(MessageF)).Queue); + Configure.With(new Type[] { }) + .DefineEndpointName("Foo") + .CustomConfigurationSource(new CustomUnicastBusConfig()) + .DefaultBuilder() + .UnicastBus() + .CreateBus(); + + var messageOwners = Configure.Instance.Builder.Build(); + + Assert.AreEqual("Type", messageOwners.GetMultiDestinationFor(typeof(MessageA)).Single().Queue); + Assert.AreEqual("Namespace", messageOwners.GetMultiDestinationFor(typeof(MessageB)).Single().Queue); + Assert.AreEqual("Assembly", messageOwners.GetMultiDestinationFor(typeof(MessageD)).Single().Queue); + Assert.AreEqual("MessagesWithType", messageOwners.GetMultiDestinationFor(typeof(MessageE)).Single().Queue); + Assert.AreEqual("Namespace", messageOwners.GetMultiDestinationFor(typeof(MessageF)).Single().Queue); } - public class CustomUnicastBusConfig : IProvideConfiguration + class CustomUnicastBusConfig : IConfigurationSource { - public UnicastBusConfig GetConfiguration() + public T GetConfiguration() where T : class, new() { var mappingByType = new MessageEndpointMapping { Endpoint = "Type", TypeFullName = "NServiceBus.Unicast.Tests.Messages.MessageA", AssemblyName = "NServiceBus.Core.Tests" }; var mappingByNamespace = new MessageEndpointMapping { Endpoint = "Namespace", Namespace = "NServiceBus.Unicast.Tests.Messages", AssemblyName = "NServiceBus.Core.Tests" }; @@ -79,10 +78,33 @@ public UnicastBusConfig GetConfiguration() var mappingByMessagesWithType = new MessageEndpointMapping { Endpoint = "MessagesWithType", Messages = "NServiceBus.Unicast.Tests.Messages.MessageE, NServiceBus.Core.Tests" }; var mappings = new MessageEndpointMappingCollection { mappingByNamespace, mappingByType, mappingByAssembly, mappingByMessagesWithType }; - return new UnicastBusConfig + + var type = typeof(T); + + if (type == typeof(MessageForwardingInCaseOfFaultConfig)) + return new MessageForwardingInCaseOfFaultConfig + { + ErrorQueue = "error" + } as T; + + if (type == typeof(UnicastBusConfig)) { - MessageEndpointMappings = mappings - }; + + return new UnicastBusConfig + { + MessageEndpointMappings = mappings, + } as T; + + } + + if (type == typeof(Logging)) + return new Logging + { + Threshold = "WARN" + } as T; + + + return ConfigurationManager.GetSection(type.Name) as T; } } } diff --git a/src/NServiceBus.Core.Tests/Unicast/Contexts/using_the_unicastbus.cs b/src/NServiceBus.Core.Tests/Unicast/Contexts/using_the_unicastbus.cs index 6a6a418f448..e92f667fde6 100644 --- a/src/NServiceBus.Core.Tests/Unicast/Contexts/using_the_unicastbus.cs +++ b/src/NServiceBus.Core.Tests/Unicast/Contexts/using_the_unicastbus.cs @@ -171,7 +171,7 @@ protected void RegisterUow(IManageUnitsOfWork uow) } protected void RegisterOwnedMessageType() { - router.RegisterRoute(typeof(T), Address.Local); + router.RegisterMessageRoute(typeof(T), Address.Local); } protected Address RegisterMessageType() { @@ -185,7 +185,7 @@ protected void RegisterMessageType(Address address) { MessageMapper.Initialize(new[] { typeof(T) }); MessageSerializer.Initialize(new[] { typeof(T) }); - router.RegisterRoute(typeof(T), address); + router.RegisterMessageRoute(typeof(T), address); MessageMetadataRegistry.RegisterMessageType(typeof(T)); } diff --git a/src/NServiceBus.Core.Tests/Unicast/Sending.cs b/src/NServiceBus.Core.Tests/Unicast/Sending.cs index 6ae91e8c5c7..ab0638120de 100644 --- a/src/NServiceBus.Core.Tests/Unicast/Sending.cs +++ b/src/NServiceBus.Core.Tests/Unicast/Sending.cs @@ -141,8 +141,8 @@ public class When_sending_multiple_messages_in_one_go : using_the_unicastBus [Test] public void Should_be_persistent_if_any_of_the_messages_is_persistent() { - RegisterMessageType(); - RegisterMessageType(); + RegisterMessageType(Address.Local); + RegisterMessageType(Address.Local); bus.Send(new NonPersistentMessage(), new PersistentMessage()); messageSender.AssertWasCalled(x => x.Send(Arg.Matches(m => m.Recoverable), Arg
.Is.Anything)); @@ -152,23 +152,22 @@ public void Should_be_persistent_if_any_of_the_messages_is_persistent() [Test] public void Should_use_the_lowest_time_to_be_received() { - RegisterMessageType(); - RegisterMessageType(); + RegisterMessageType(Address.Local); + RegisterMessageType(Address.Local); bus.Send(new NonPersistentMessage(), new PersistentMessage()); messageSender.AssertWasCalled(x => x.Send(Arg.Matches(m => m.TimeToBeReceived == TimeSpan.FromMinutes(45)), Arg
.Is.Anything)); } [Test] - public void Should_use_the_address_of_the_first_message() + public void Should_throw_if_messages_contain_different_configured_addresses() { var firstAddress = Address.Parse("first"); var secondAddress = Address.Parse("second"); RegisterMessageType(firstAddress); RegisterMessageType(secondAddress); - bus.Send(new NonPersistentMessage(), new PersistentMessage()); - messageSender.AssertWasCalled(x => x.Send(Arg.Matches(m => m.Recoverable), Arg
.Is.Equal(firstAddress))); + Assert.Throws(() => bus.Send(new NonPersistentMessage(), new PersistentMessage())); } @@ -195,16 +194,6 @@ public void It_should_be_non_persistent_by_default() } } - [TestFixture] - public class When_sending_a_message_that_has_no_configured_address : using_the_unicastBus - { - [Test] - public void Should_throw() - { - Assert.Throws(() => bus.Send(new CommandMessage())); - } - } - [TestFixture] public class When_sending_a_command_message : using_the_unicastBus { diff --git a/src/NServiceBus.Core.Tests/Unicast/Subscriptions.cs b/src/NServiceBus.Core.Tests/Unicast/Subscriptions.cs index 21ec5460e1d..7572348f208 100644 --- a/src/NServiceBus.Core.Tests/Unicast/Subscriptions.cs +++ b/src/NServiceBus.Core.Tests/Unicast/Subscriptions.cs @@ -14,7 +14,7 @@ public class When_subscribing_to_messages : using_the_unicastBus [SetUp] public new void SetUp() { - router.RegisterRoute(typeof(TestMessage), addressToOwnerOfTestMessage); + router.RegisterMessageRoute(typeof(TestMessage), addressToOwnerOfTestMessage); } [Test] public void Should_send_the_assemblyQualified_name_as_subscription_type() diff --git a/src/NServiceBus.Core/NServiceBus.Core.csproj b/src/NServiceBus.Core/NServiceBus.Core.csproj index bb9db07ace1..a1419dd539c 100644 --- a/src/NServiceBus.Core/NServiceBus.Core.csproj +++ b/src/NServiceBus.Core/NServiceBus.Core.csproj @@ -592,7 +592,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus @@ -610,14 +610,10 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/NServiceBus.Core/Unicast/Config/ConfigUnicastBus.cs b/src/NServiceBus.Core/Unicast/Config/ConfigUnicastBus.cs index d441da07b76..7d12b06d1d5 100644 --- a/src/NServiceBus.Core/Unicast/Config/ConfigUnicastBus.cs +++ b/src/NServiceBus.Core/Unicast/Config/ConfigUnicastBus.cs @@ -6,11 +6,7 @@ namespace NServiceBus.Unicast.Config using System.Linq; using Features; using Logging; - using Messages; - using NServiceBus.Config; using ObjectBuilder; - using Routing; - using Settings; /// /// Inherits NServiceBus.Configure providing UnicastBus specific configuration on top of it. @@ -28,43 +24,12 @@ public void Configure(Configure config) busConfig = Configurer.ConfigureComponent(DependencyLifecycle.SingleInstance) .ConfigureProperty(p => p.MasterNodeAddress, config.GetMasterNodeAddress()); - var knownMessages = TypesToScan - .Where(MessageConventionExtensions.IsMessageType) - .ToList(); - ConfigureSubscriptionAuthorization(); RegisterMessageModules(); - - RegisterMessageOwnersAndBusAddress(knownMessages); - - ConfigureMessageRegistry(knownMessages); } - void ConfigureMessageRegistry(List knownMessages) - { - var messageRegistry = new MessageMetadataRegistry - { - DefaultToNonPersistentMessages = !SettingsHolder.Get("Endpoint.DurableMessages") - }; - - knownMessages.ForEach(messageRegistry.RegisterMessageType); - - Configurer.RegisterSingleton(messageRegistry); - - if(!Logger.IsInfoEnabled) - return; - - var messageDefinitions = messageRegistry.GetAllMessages().ToList(); - - Logger.InfoFormat("Number of messages found: {0}" , messageDefinitions.Count()); - - if (!Logger.IsDebugEnabled) - return; - - - Logger.DebugFormat("Message definitions: \n {0}",string.Concat(messageDefinitions.Select(md => md.ToString() + "\n"))); - } + #pragma warning disable 0618 void RegisterMessageModules() @@ -83,44 +48,6 @@ void ConfigureSubscriptionAuthorization() if (authType != null) Configurer.ConfigureComponent(authType, DependencyLifecycle.SingleInstance); } - - - void RegisterMessageOwnersAndBusAddress(IEnumerable knownMessages) - { - var unicastConfig = GetConfigSection(); - var router = new StaticMessageRouter(knownMessages); - - Configurer.RegisterSingleton(router); - - if (unicastConfig == null) - { - return; - } - if (!string.IsNullOrWhiteSpace(unicastConfig.ForwardReceivedMessagesTo)) - { - var forwardAddress = Address.Parse(unicastConfig.ForwardReceivedMessagesTo); - busConfig.ConfigureProperty(b => b.ForwardReceivedMessagesTo, forwardAddress); - } - busConfig.ConfigureProperty(b => b.TimeToBeReceivedOnForwardedMessages, unicastConfig.TimeToBeReceivedOnForwardedMessages); - - var messageEndpointMappings = unicastConfig.MessageEndpointMappings.Cast() - .OrderByDescending(m=>m) - .ToList(); - - foreach (var mapping in messageEndpointMappings) - { - mapping.Configure((messageType, address) => - { - if (!MessageConventionExtensions.IsMessageType(messageType)) - { - return; - } - - router.RegisterRoute(messageType,address); - }); - } - } - /// /// Used to configure the bus. diff --git a/src/NServiceBus.Core/Unicast/Config/FinalizeUnicastBusConfiguration.cs b/src/NServiceBus.Core/Unicast/Config/FinalizeUnicastBusConfiguration.cs index 19c89a722cd..0fcd4037a66 100644 --- a/src/NServiceBus.Core/Unicast/Config/FinalizeUnicastBusConfiguration.cs +++ b/src/NServiceBus.Core/Unicast/Config/FinalizeUnicastBusConfiguration.cs @@ -1,15 +1,121 @@ namespace NServiceBus.Unicast.Config { + using System; + using System.Collections.Generic; + using System.Linq; using AutomaticSubscriptions; + using Logging; + using Messages; using NServiceBus.Config; + using Routing; using Settings; + using Utils; class FinalizeUnicastBusConfiguration : IFinalizeConfiguration { public void FinalizeConfiguration() { + var knownMessages = Configure.TypesToScan + .Where(MessageConventionExtensions.IsMessageType) + .ToList(); + + RegisterMessageOwnersAndBusAddress(knownMessages); + + ConfigureMessageRegistry(knownMessages); + if (SettingsHolder.GetOrDefault("UnicastBus.AutoSubscribe")) + { InfrastructureServices.Enable(); + } } + + void RegisterMessageOwnersAndBusAddress(IEnumerable knownMessages) + { + var unicastConfig = Configure.GetConfigSection(); + var router = new StaticMessageRouter(knownMessages); + + Configure.Instance.Configurer.RegisterSingleton(router); + + Address forwardAddress = null; + if (unicastConfig != null && !string.IsNullOrWhiteSpace(unicastConfig.ForwardReceivedMessagesTo)) + { + forwardAddress = Address.Parse(unicastConfig.ForwardReceivedMessagesTo); + } + else + { + var forwardQueue = RegistryReader.Read("AuditQueue"); + if (!string.IsNullOrWhiteSpace(forwardQueue)) + { + forwardAddress = Address.Parse(forwardQueue); + } + } + + if (forwardAddress != null) + { + Configure.Instance.Configurer.ConfigureProperty(b => b.ForwardReceivedMessagesTo, + forwardAddress); + } + + if (unicastConfig == null) + { + return; + } + + Configure.Instance.Configurer.ConfigureProperty(b => b.TimeToBeReceivedOnForwardedMessages, + unicastConfig.TimeToBeReceivedOnForwardedMessages); + + var messageEndpointMappings = unicastConfig.MessageEndpointMappings.Cast() + .OrderByDescending(m => m) + .ToList(); + + foreach (var mapping in messageEndpointMappings) + { + mapping.Configure((messageType, address) => + { + if ( + !(MessageConventionExtensions.IsMessageType(messageType) || + MessageConventionExtensions.IsEventType(messageType) || + MessageConventionExtensions.IsCommandType(messageType))) + { + return; + } + + if (MessageConventionExtensions.IsEventType(messageType)) + { + router.RegisterEventRoute(messageType, address); + return; + } + + router.RegisterMessageRoute(messageType, address); + }); + } + } + + void ConfigureMessageRegistry(List knownMessages) + { + var messageRegistry = new MessageMetadataRegistry + { + DefaultToNonPersistentMessages = !SettingsHolder.Get("Endpoint.DurableMessages") + }; + + knownMessages.ForEach(messageRegistry.RegisterMessageType); + + Configure.Instance.Configurer.RegisterSingleton(messageRegistry); + + if (!Logger.IsInfoEnabled) + return; + + var messageDefinitions = messageRegistry.GetAllMessages().ToList(); + + Logger.InfoFormat("Number of messages found: {0}", messageDefinitions.Count()); + + if (!Logger.IsDebugEnabled) + return; + + + Logger.DebugFormat("Message definitions: \n {0}", string.Concat(messageDefinitions.Select(md => md.ToString() + "\n"))); + } + + static readonly ILog Logger = LogManager.GetLogger(typeof(FinalizeUnicastBusConfiguration)); } } \ No newline at end of file diff --git a/src/NServiceBus.Core/Unicast/Routing/StaticMessageRouter.cs b/src/NServiceBus.Core/Unicast/Routing/StaticMessageRouter.cs index abd70a051af..0ba395a6d5a 100644 --- a/src/NServiceBus.Core/Unicast/Routing/StaticMessageRouter.cs +++ b/src/NServiceBus.Core/Unicast/Routing/StaticMessageRouter.cs @@ -3,71 +3,113 @@ using System; using System.Collections.Concurrent; using System.Collections.Generic; + using System.Linq; using Logging; /// - /// The default message router + /// The default message router /// public class StaticMessageRouter : IRouteMessages { /// - /// Initializes the router with all known messages + /// Initializes the router with all known messages /// - /// public StaticMessageRouter(IEnumerable knownMessages) { - routes = new ConcurrentDictionary(); + routes = new ConcurrentDictionary>(); foreach (var knownMessage in knownMessages) { - routes[knownMessage] = Address.Undefined; + routes[knownMessage] = new List
(); } } + public bool SubscribeToPlainMessages { get; set; } + public Address GetDestinationFor(Type messageType) { - Address address; - if (!routes.TryGetValue(messageType, out address)) + var address = GetMultiDestinationFor(messageType).FirstOrDefault(); + + if (address == null) + { return Address.Undefined; + } return address; } - public void RegisterRoute(Type messageType, Address endpointAddress) + internal List
GetMultiDestinationFor(Type messageType) { - Address currentAddress; + List
address; + if (!routes.TryGetValue(messageType, out address)) + { + return new List
(); + } - if (!routes.TryGetValue(messageType, out currentAddress)) - currentAddress = Address.Undefined; + return address; + } - if(currentAddress == Address.Undefined) + public void RegisterEventRoute(Type eventType, Address endpointAddress) + { + if (endpointAddress == null || endpointAddress == Address.Undefined) { - Logger.DebugFormat("Routing for message: {0} set to {1}", messageType, endpointAddress); + throw new InvalidOperationException(String.Format("'{0}' can't be registered with Address.Undefined route.", eventType.FullName)); } - else + + List
currentAddress; + + if (!routes.TryGetValue(eventType, out currentAddress)) { - Logger.InfoFormat("Routing for message: {0} updated from {1} to {2}", messageType, currentAddress, endpointAddress); + routes[eventType] = currentAddress = new List
(); } - routes[messageType] = endpointAddress; + Logger.DebugFormat(currentAddress.Any() ? "Routing for message: {0} appending {1}" : "Routing for message: {0} set to {1}", eventType, endpointAddress); - //go through the existing routes and see if this means that we can route any of those - foreach (var route in routes) + currentAddress.Add(endpointAddress); + + foreach (var route in routes.Where(route => eventType != route.Key && route.Key.IsAssignableFrom(eventType))) { - if (messageType != route.Key && route.Key.IsAssignableFrom(messageType)) + if (route.Value.Any()) { - if(route.Value == Address.Undefined) - Logger.DebugFormat("Routing for inherited message: {0}({1}) set to {2}",route.Key, messageType, endpointAddress); - else - Logger.InfoFormat("Routing for inherited message: {0}({1}) updated from {2} to {3}", route.Key, messageType,route.Value,endpointAddress); - - routes[route.Key] = endpointAddress; + Logger.InfoFormat("Routing for inherited message: {0}({1}) appending {2}", route.Key, eventType, endpointAddress); } + else + { + Logger.DebugFormat("Routing for inherited message: {0}({1}) set to {2}", route.Key, eventType, endpointAddress); + } + + route.Value.Add(endpointAddress); } + } + + public void RegisterMessageRoute(Type messageType, Address endpointAddress) + { + if (endpointAddress == null || endpointAddress == Address.Undefined) + { + throw new InvalidOperationException(String.Format("'{0}' can't be registered with Address.Undefined route.", messageType.FullName)); + } + + List
currentAddress; + if (!routes.TryGetValue(messageType, out currentAddress)) + { + routes[messageType] = currentAddress = new List
(); + } + + Logger.DebugFormat("Routing for message: {0} set to {1}", messageType, endpointAddress); + currentAddress.Clear(); + currentAddress.Add(endpointAddress); + + //go through the existing routes and see if this means that we can route any of those + foreach (var route in routes.Where(route => messageType != route.Key && route.Key.IsAssignableFrom(messageType))) + { + Logger.DebugFormat("Routing for inherited message: {0}({1}) set to {2}", route.Key, messageType, endpointAddress); + route.Value.Clear(); + route.Value.Add(endpointAddress); + } } - readonly IDictionary routes; - readonly static ILog Logger = LogManager.GetLogger(typeof(StaticMessageRouter)); + static readonly ILog Logger = LogManager.GetLogger(typeof(StaticMessageRouter)); + readonly ConcurrentDictionary> routes; } -} \ No newline at end of file +} diff --git a/src/NServiceBus.Core/Unicast/UnicastBus.cs b/src/NServiceBus.Core/Unicast/UnicastBus.cs index e1e9ed338ef..16254258fbb 100644 --- a/src/NServiceBus.Core/Unicast/UnicastBus.cs +++ b/src/NServiceBus.Core/Unicast/UnicastBus.cs @@ -371,18 +371,32 @@ public virtual void Subscribe(Type messageType, Predicate condition) AssertHasLocalAddress(); - var destination = GetAddressForMessageType(messageType); - if (Address.Self == destination) - throw new InvalidOperationException(string.Format("Message {0} is owned by the same endpoint that you're trying to subscribe", messageType)); - - if (SubscriptionManager == null) throw new InvalidOperationException("No subscription manager is available"); - SubscriptionManager.Subscribe(messageType, destination); + var addresses = GetAddressForMessageType(messageType); + if (addresses.Count == 0) + { + throw new InvalidOperationException(string.Format("No destination could be found for message type {0}. Check the section of the configuration of this endpoint for an entry either for this specific message type or for its assembly.", messageType)); + } if (SubscriptionPredicatesEvaluator != null) SubscriptionPredicatesEvaluator.AddConditionForSubscriptionToMessageType(messageType, condition); + + foreach (var destination in addresses) + { + if (Address.Self == destination) + { + throw new InvalidOperationException(string.Format("Message {0} is owned by the same endpoint that you're trying to subscribe", messageType)); + } + + SubscriptionManager.Subscribe(messageType, destination); + + if (SubscriptionPredicatesEvaluator != null) + { + SubscriptionPredicatesEvaluator.AddConditionForSubscriptionToMessageType(messageType, condition); + } + } } /// @@ -407,12 +421,19 @@ public virtual void Unsubscribe(Type messageType) AssertHasLocalAddress(); - var destination = GetAddressForMessageType(messageType); - if (SubscriptionManager == null) throw new InvalidOperationException("No subscription manager is available"); - SubscriptionManager.Unsubscribe(messageType, destination); + var addresses = GetAddressForMessageType(messageType); + if (addresses.Count == 0) + { + throw new InvalidOperationException(string.Format("No destination could be found for message type {0}. Check the section of the configuration of this endpoint for an entry either for this specific message type or for its assembly.", messageType)); + } + + foreach (var destination in addresses) + { + SubscriptionManager.Unsubscribe(messageType, destination); + } } @@ -508,11 +529,33 @@ public ICallback Send(object message) public ICallback Send(params object[] messages) { - var destination = GetAddressForMessages(messages); + var destinations = GetAddressForMessages(messages) + .Distinct() + .ToList(); + + if (destinations.Count > 1) + { + throw new InvalidOperationException("Sends can only target one address."); + } + + var destination = destinations.SingleOrDefault(); return SendMessage(destination, null, MessageIntentEnum.Send, messages); } + IEnumerable
GetAddressForMessages(IEnumerable messages) + { + if (messages == null) + { + yield break; + } + + foreach (var address in messages.SelectMany(message => GetAddressForMessageType(message.GetType()))) + { + yield return address; + } + } + public ICallback Send(string destination, Action messageConstructor) { return SendMessage(destination, null, MessageIntentEnum.Send, CreateInstance(messageConstructor)); @@ -1485,31 +1528,19 @@ IEnumerable ApplyOutgoingMessageMutatorsTo(IEnumerable messages) } } - /// - /// Uses the first message in the array to pass to . - /// - /// - /// - Address GetAddressForMessages(object[] messages) - { - if (messages == null || messages.Length == 0) - return Address.Undefined; - - return GetAddressForMessageType(messages[0].GetType()); - } - /// /// Gets the destination address For a message type. /// /// The message type to get the destination for. /// The address of the destination associated with the message type. - Address GetAddressForMessageType(Type messageType) + List
GetAddressForMessageType(Type messageType) { - var destination = MessageRouter.GetDestinationFor(messageType); + var destination = ((StaticMessageRouter)MessageRouter).GetMultiDestinationFor(messageType); - if (destination != Address.Undefined) + if (destination.Any()) + { return destination; - + } if (messageMapper != null && !messageType.IsInterface) { @@ -1518,7 +1549,6 @@ Address GetAddressForMessageType(Type messageType) return GetAddressForMessageType(t); } - return destination; } diff --git a/src/NServiceBus.GatewayPersister.NHibernate.Tests/NServiceBus.GatewayPersister.NHibernate.Tests.csproj b/src/NServiceBus.GatewayPersister.NHibernate.Tests/NServiceBus.GatewayPersister.NHibernate.Tests.csproj index c07b0133b7e..fd1d41e07c5 100644 --- a/src/NServiceBus.GatewayPersister.NHibernate.Tests/NServiceBus.GatewayPersister.NHibernate.Tests.csproj +++ b/src/NServiceBus.GatewayPersister.NHibernate.Tests/NServiceBus.GatewayPersister.NHibernate.Tests.csproj @@ -69,7 +69,6 @@ - @@ -78,7 +77,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus {281646e3-32e0-4f4d-bcf6-1dc5efc6c268} diff --git a/src/NServiceBus.GatewayPersister.NHibernate.Tests/ripple.dependencies.config b/src/NServiceBus.GatewayPersister.NHibernate.Tests/ripple.dependencies.config deleted file mode 100644 index 44008e2bbe5..00000000000 --- a/src/NServiceBus.GatewayPersister.NHibernate.Tests/ripple.dependencies.config +++ /dev/null @@ -1,4 +0,0 @@ -Iesi.Collections -NHibernate -NUnit -System.Data.SQLite.x64 diff --git a/src/NServiceBus.Hosting.Tests/NServiceBus.Hosting.Tests.csproj b/src/NServiceBus.Hosting.Tests/NServiceBus.Hosting.Tests.csproj index 787d3d02323..8b2c32f44b4 100644 --- a/src/NServiceBus.Hosting.Tests/NServiceBus.Hosting.Tests.csproj +++ b/src/NServiceBus.Hosting.Tests/NServiceBus.Hosting.Tests.csproj @@ -72,7 +72,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus {85E813C0-4A94-4946-8B1F-DE1E39AA7D11} diff --git a/src/NServiceBus.Hosting.Windows/NServiceBus.Hosting.Windows.csproj b/src/NServiceBus.Hosting.Windows/NServiceBus.Hosting.Windows.csproj index 3ef8b5da793..8c9288f2506 100644 --- a/src/NServiceBus.Hosting.Windows/NServiceBus.Hosting.Windows.csproj +++ b/src/NServiceBus.Hosting.Windows/NServiceBus.Hosting.Windows.csproj @@ -1,4 +1,4 @@ - + Debug @@ -147,7 +147,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus @@ -178,14 +178,10 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - - + \ No newline at end of file diff --git a/src/NServiceBus.Hosting.Windows/NServiceBus.Hosting.WindowsX86.csproj b/src/NServiceBus.Hosting.Windows/NServiceBus.Hosting.WindowsX86.csproj index c267d21eddf..d9e6f322371 100644 --- a/src/NServiceBus.Hosting.Windows/NServiceBus.Hosting.WindowsX86.csproj +++ b/src/NServiceBus.Hosting.Windows/NServiceBus.Hosting.WindowsX86.csproj @@ -157,14 +157,10 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/NServiceBus.Logging.Tests/NServiceBus.Logging.Tests.csproj b/src/NServiceBus.Logging.Tests/NServiceBus.Logging.Tests.csproj index afc746741a6..2eda3b05b05 100644 --- a/src/NServiceBus.Logging.Tests/NServiceBus.Logging.Tests.csproj +++ b/src/NServiceBus.Logging.Tests/NServiceBus.Logging.Tests.csproj @@ -65,7 +65,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus {dd48b2d0-e996-412d-9157-821ed8b17a9d} diff --git a/src/NServiceBus.NHibernate/NServiceBus.NHibernate.csproj b/src/NServiceBus.NHibernate/NServiceBus.NHibernate.csproj index 2c0e2aef3d3..68f8f75d980 100644 --- a/src/NServiceBus.NHibernate/NServiceBus.NHibernate.csproj +++ b/src/NServiceBus.NHibernate/NServiceBus.NHibernate.csproj @@ -14,7 +14,7 @@ ..\NServiceBus.snk true ..\ - 90ad352c + 20c3a038 true @@ -114,7 +114,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus @@ -123,12 +123,10 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - + - + \ No newline at end of file diff --git a/src/NServiceBus.NHibernate/packages.config b/src/NServiceBus.NHibernate/packages.config index 278227e4818..e330a020ad1 100644 --- a/src/NServiceBus.NHibernate/packages.config +++ b/src/NServiceBus.NHibernate/packages.config @@ -1,7 +1,7 @@  - + - + \ No newline at end of file diff --git a/src/NServiceBus.PerformanceTests/NServiceBus.PerformanceTests.csproj b/src/NServiceBus.PerformanceTests/NServiceBus.PerformanceTests.csproj index 838d7fa9bdc..7b1673866cb 100644 --- a/src/NServiceBus.PerformanceTests/NServiceBus.PerformanceTests.csproj +++ b/src/NServiceBus.PerformanceTests/NServiceBus.PerformanceTests.csproj @@ -103,7 +103,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus diff --git a/src/NServiceBus.Persistence.NHibernate.Tests/NServiceBus.Persistence.NHibernate.Tests.csproj b/src/NServiceBus.Persistence.NHibernate.Tests/NServiceBus.Persistence.NHibernate.Tests.csproj index 5ad9a9eb4f6..a19377f01f4 100644 --- a/src/NServiceBus.Persistence.NHibernate.Tests/NServiceBus.Persistence.NHibernate.Tests.csproj +++ b/src/NServiceBus.Persistence.NHibernate.Tests/NServiceBus.Persistence.NHibernate.Tests.csproj @@ -65,7 +65,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus {dd48b2d0-e996-412d-9157-821ed8b17a9d} diff --git a/src/NServiceBus.SagaPersisters.InMemory.Tests/NServiceBus.SagaPersisters.InMemory.Tests.csproj b/src/NServiceBus.SagaPersisters.InMemory.Tests/NServiceBus.SagaPersisters.InMemory.Tests.csproj index ff90b53ed2e..cd184857cd5 100644 --- a/src/NServiceBus.SagaPersisters.InMemory.Tests/NServiceBus.SagaPersisters.InMemory.Tests.csproj +++ b/src/NServiceBus.SagaPersisters.InMemory.Tests/NServiceBus.SagaPersisters.InMemory.Tests.csproj @@ -66,7 +66,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus diff --git a/src/NServiceBus.SagaPersisters.NHibernate.Tests/NServiceBus.SagaPersisters.NHibernate.Tests.csproj b/src/NServiceBus.SagaPersisters.NHibernate.Tests/NServiceBus.SagaPersisters.NHibernate.Tests.csproj index 702bda3e2b4..f3e1008eb24 100644 --- a/src/NServiceBus.SagaPersisters.NHibernate.Tests/NServiceBus.SagaPersisters.NHibernate.Tests.csproj +++ b/src/NServiceBus.SagaPersisters.NHibernate.Tests/NServiceBus.SagaPersisters.NHibernate.Tests.csproj @@ -110,7 +110,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus {281646e3-32e0-4f4d-bcf6-1dc5efc6c268} diff --git a/src/NServiceBus.Serializers.XML.XsdGenerator/NServiceBus.Serializers.XML.XsdGenerator.csproj b/src/NServiceBus.Serializers.XML.XsdGenerator/NServiceBus.Serializers.XML.XsdGenerator.csproj index 641cd5d1ec6..a9cdd5d0574 100644 --- a/src/NServiceBus.Serializers.XML.XsdGenerator/NServiceBus.Serializers.XML.XsdGenerator.csproj +++ b/src/NServiceBus.Serializers.XML.XsdGenerator/NServiceBus.Serializers.XML.XsdGenerator.csproj @@ -78,7 +78,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus diff --git a/src/NServiceBus.Testing.Tests/NServiceBus.Testing.Tests.csproj b/src/NServiceBus.Testing.Tests/NServiceBus.Testing.Tests.csproj index 12fddbc6aee..a8edcb79f50 100644 --- a/src/NServiceBus.Testing.Tests/NServiceBus.Testing.Tests.csproj +++ b/src/NServiceBus.Testing.Tests/NServiceBus.Testing.Tests.csproj @@ -59,7 +59,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus diff --git a/src/NServiceBus.Testing/NServiceBus.Testing.csproj b/src/NServiceBus.Testing/NServiceBus.Testing.csproj index 777ad6eced5..2631f8252a0 100644 --- a/src/NServiceBus.Testing/NServiceBus.Testing.csproj +++ b/src/NServiceBus.Testing/NServiceBus.Testing.csproj @@ -91,7 +91,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus @@ -100,14 +100,10 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/NServiceBus.TimeoutPersisters.NHibernate.Tests/NServiceBus.TimeoutPersisters.NHibernate.Tests.csproj b/src/NServiceBus.TimeoutPersisters.NHibernate.Tests/NServiceBus.TimeoutPersisters.NHibernate.Tests.csproj index 839e6692712..12bd087797f 100644 --- a/src/NServiceBus.TimeoutPersisters.NHibernate.Tests/NServiceBus.TimeoutPersisters.NHibernate.Tests.csproj +++ b/src/NServiceBus.TimeoutPersisters.NHibernate.Tests/NServiceBus.TimeoutPersisters.NHibernate.Tests.csproj @@ -70,7 +70,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus {281646e3-32e0-4f4d-bcf6-1dc5efc6c268} diff --git a/src/NServiceBus.Unicast.Subscriptions.NHibernate.Tests/NServiceBus.Unicast.Subscriptions.NHibernate.Tests.csproj b/src/NServiceBus.Unicast.Subscriptions.NHibernate.Tests/NServiceBus.Unicast.Subscriptions.NHibernate.Tests.csproj index 6e5afbda294..a365555af52 100644 --- a/src/NServiceBus.Unicast.Subscriptions.NHibernate.Tests/NServiceBus.Unicast.Subscriptions.NHibernate.Tests.csproj +++ b/src/NServiceBus.Unicast.Subscriptions.NHibernate.Tests/NServiceBus.Unicast.Subscriptions.NHibernate.Tests.csproj @@ -75,9 +75,6 @@ - - Designer - @@ -103,7 +100,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus {281646e3-32e0-4f4d-bcf6-1dc5efc6c268} diff --git a/src/NServiceBus.Unicast.Subscriptions.NHibernate.Tests/ripple.dependencies.config b/src/NServiceBus.Unicast.Subscriptions.NHibernate.Tests/ripple.dependencies.config deleted file mode 100644 index 19aa53fc60c..00000000000 --- a/src/NServiceBus.Unicast.Subscriptions.NHibernate.Tests/ripple.dependencies.config +++ /dev/null @@ -1,5 +0,0 @@ -Iesi.Collections -NHibernate -NUnit -RhinoMocks -System.Data.SQLite.x64 diff --git a/src/NServiceBus.sln b/src/NServiceBus.sln index 11fa9f208ea..9b54c9ee229 100644 --- a/src/NServiceBus.sln +++ b/src/NServiceBus.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 2013 -VisualStudioVersion = 12.0.30723.0 +VisualStudioVersion = 12.0.31101.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus", "NServiceBus\NServiceBus.csproj", "{73867D40-8CBB-48E9-BFFA-12BBDD48A341}" ProjectSection(ProjectDependencies) = postProject @@ -90,6 +90,11 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.PerformanceTest EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NServiceBus.Hosting.WindowsX86", "NServiceBus.Hosting.Windows\NServiceBus.Hosting.WindowsX86.csproj", "{79487CAA-C060-49C8-B689-6250C61A46D5}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{4E2E1CEA-8CC2-4A69-8644-01983B74ED5E}" + ProjectSection(SolutionItems) = preProject + .nuget\packages.config = .nuget\packages.config + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/src/NServiceBus.sln.DotSettings b/src/NServiceBus.sln.DotSettings index b08e1682e4c..ddb2d0421c4 100644 --- a/src/NServiceBus.sln.DotSettings +++ b/src/NServiceBus.sln.DotSettings @@ -48,6 +48,144 @@ False True True + <?xml version="1.0" encoding="utf-16"?> +<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> + <TypePattern Priority="100" DisplayName="Type Pattern"> + <TypePattern.Match> + <Or> + <And> + <Kind Is="Interface" /> + <Or> + <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> + <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> + </Or> + </And> + <HasAttribute Name="System.Runtime.InteropServices.StructLayoutAttribute" /> + </Or> + </TypePattern.Match> + </TypePattern> + <TypePattern Priority="100" DisplayName="Type Pattern"> + <TypePattern.Match> + <And> + <Kind Is="Class" /> + <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" /> + </And> + </TypePattern.Match> + <Entry DisplayName="Entry"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <Or> + <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" /> + </Or> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="Entry" /> + <Entry Priority="100" DisplayName="Entry"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + <TypePattern DisplayName="Type Pattern"> + <Entry Priority="100" DisplayName="Entry"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Delegate" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry Priority="100" DisplayName="Entry"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Enum" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Entry"> + <Entry.Match> + <Kind Is="Constructor" /> + </Entry.Match> + <Entry.SortBy> + <Static /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Entry"> + <Entry.Match> + <Or> + <Kind Is="Property" /> + <Kind Is="Indexer" /> + </Or> + </Entry.Match> + </Entry> + <Entry Priority="100" DisplayName="Entry"> + <Entry.Match> + <And> + <Kind Is="Member" /> + <ImplementsInterface /> + </And> + </Entry.Match> + <Entry.SortBy> + <ImplementsInterface Immediate="True" /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Entry" /> + <Entry DisplayName="Entry"> + <Entry.Match> + <Or> + <Kind Is="Constant" /> + <And> + <Kind Is="Field" /> + <Static /> + </And> + </Or> + </Entry.Match> + <Entry.SortBy> + <Kind Order="Constant Field" /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Entry"> + <Entry.Match> + <And> + <Kind Is="Field" /> + <Not> + <Static /> + </Not> + </And> + </Entry.Match> + <Entry.SortBy> + <Readonly /> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Entry"> + <Entry.Match> + <Kind Is="Type" /> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> +</Patterns> <?xml version="1.0" encoding="utf-8" ?> <!-- @@ -311,7 +449,10 @@ II.2.12 <HandlesEvent /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + True + True True + True True diff --git a/src/NServiceBus/NServiceBus.csproj b/src/NServiceBus/NServiceBus.csproj index 96354801164..2a701b04177 100644 --- a/src/NServiceBus/NServiceBus.csproj +++ b/src/NServiceBus/NServiceBus.csproj @@ -136,14 +136,10 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.Autofac/ObjectBuilder.Autofac.csproj b/src/ObjectBuilder.Autofac/ObjectBuilder.Autofac.csproj index 2cedee2aa64..f9354e6ed4d 100644 --- a/src/ObjectBuilder.Autofac/ObjectBuilder.Autofac.csproj +++ b/src/ObjectBuilder.Autofac/ObjectBuilder.Autofac.csproj @@ -82,7 +82,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus False diff --git a/src/ObjectBuilder.CastleWindsor/ObjectBuilder.CastleWindsor.csproj b/src/ObjectBuilder.CastleWindsor/ObjectBuilder.CastleWindsor.csproj index c6e25b4e2ee..726c9295896 100644 --- a/src/ObjectBuilder.CastleWindsor/ObjectBuilder.CastleWindsor.csproj +++ b/src/ObjectBuilder.CastleWindsor/ObjectBuilder.CastleWindsor.csproj @@ -72,7 +72,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus False diff --git a/src/ObjectBuilder.Ninject/ObjectBuilder.Ninject.csproj b/src/ObjectBuilder.Ninject/ObjectBuilder.Ninject.csproj index 3b669d55426..d019467836b 100644 --- a/src/ObjectBuilder.Ninject/ObjectBuilder.Ninject.csproj +++ b/src/ObjectBuilder.Ninject/ObjectBuilder.Ninject.csproj @@ -83,7 +83,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus False diff --git a/src/ObjectBuilder.Spring/ObjectBuilder.Spring.csproj b/src/ObjectBuilder.Spring/ObjectBuilder.Spring.csproj index ea7458b36b4..33cc0cf791d 100644 --- a/src/ObjectBuilder.Spring/ObjectBuilder.Spring.csproj +++ b/src/ObjectBuilder.Spring/ObjectBuilder.Spring.csproj @@ -76,7 +76,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus False @@ -96,14 +96,10 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/ObjectBuilder.StructureMap/ObjectBuilder.StructureMap.csproj b/src/ObjectBuilder.StructureMap/ObjectBuilder.StructureMap.csproj index 080125e2451..b0cf0baf167 100644 --- a/src/ObjectBuilder.StructureMap/ObjectBuilder.StructureMap.csproj +++ b/src/ObjectBuilder.StructureMap/ObjectBuilder.StructureMap.csproj @@ -73,7 +73,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus False diff --git a/src/ObjectBuilder.Unity/ObjectBuilder.Unity.csproj b/src/ObjectBuilder.Unity/ObjectBuilder.Unity.csproj index 5fbf6fb52c1..54ea32ad6b9 100644 --- a/src/ObjectBuilder.Unity/ObjectBuilder.Unity.csproj +++ b/src/ObjectBuilder.Unity/ObjectBuilder.Unity.csproj @@ -102,7 +102,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus @@ -111,14 +111,10 @@ This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - - \ No newline at end of file diff --git a/src/ReturnToSourceQueue/ReturnToSourceQueue.csproj b/src/ReturnToSourceQueue/ReturnToSourceQueue.csproj index d399ad6c794..a5a33a9e5ab 100644 --- a/src/ReturnToSourceQueue/ReturnToSourceQueue.csproj +++ b/src/ReturnToSourceQueue/ReturnToSourceQueue.csproj @@ -78,7 +78,7 @@ {73867d40-8cbb-48e9-bffa-12bbdd48a341} - NServiceBus %28NServiceBus\NServiceBus%29 + NServiceBus