diff --git a/.gitignore b/.gitignore
index 3ecfdb073..81e89fb6c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,9 @@
-build
+nugets
build32
binaries
obj
bin
+*.vshost.*
.nu
_ReSharper.*
_UpgradeReport.*
@@ -14,7 +15,6 @@ _UpgradeReport.*
*~
*.swp
*.user
-logs
TestResults
TestResult.xml
results
@@ -30,6 +30,9 @@ Artifacts
LogFiles
csx
*.ncrunchproject
-run-git.cmd
*.ncrunchsolution
_NCrunch_NServiceBus/*
+logs
+run-git.cmd
+src/Chocolatey/Build/*
+App_Packages
diff --git a/buildsupport/FubuCore.dll b/buildsupport/FubuCore.dll
index bc83892c3..de611bc01 100644
Binary files a/buildsupport/FubuCore.dll and b/buildsupport/FubuCore.dll differ
diff --git a/buildsupport/FubuCore.pdb b/buildsupport/FubuCore.pdb
deleted file mode 100644
index 2c861d0a3..000000000
Binary files a/buildsupport/FubuCore.pdb and /dev/null differ
diff --git a/buildsupport/GitFlowVersion/Build/GitFlowVersionTask.targets b/buildsupport/GitFlowVersion/Build/GitFlowVersionTask.targets
index a86a24af6..842a319eb 100644
--- a/buildsupport/GitFlowVersion/Build/GitFlowVersionTask.targets
+++ b/buildsupport/GitFlowVersion/Build/GitFlowVersionTask.targets
@@ -7,31 +7,39 @@
+
-
+
-
-
+
-
-
+
+
+
+
diff --git a/buildsupport/GitFlowVersion/GitFlowVersion.exe b/buildsupport/GitFlowVersion/GitFlowVersion.exe
index e6ac23338..7bef59da5 100644
Binary files a/buildsupport/GitFlowVersion/GitFlowVersion.exe and b/buildsupport/GitFlowVersion/GitFlowVersion.exe differ
diff --git a/buildsupport/GitFlowVersion/GitFlowVersion.pdb b/buildsupport/GitFlowVersion/GitFlowVersion.pdb
index a7222ce8e..3812304ae 100644
Binary files a/buildsupport/GitFlowVersion/GitFlowVersion.pdb and b/buildsupport/GitFlowVersion/GitFlowVersion.pdb differ
diff --git a/buildsupport/GitFlowVersion/GitFlowVersionTask.dll b/buildsupport/GitFlowVersion/GitFlowVersionTask.dll
index 7acba0866..f01dd30a0 100644
Binary files a/buildsupport/GitFlowVersion/GitFlowVersionTask.dll and b/buildsupport/GitFlowVersion/GitFlowVersionTask.dll differ
diff --git a/buildsupport/GitFlowVersion/GitFlowVersionTask.pdb b/buildsupport/GitFlowVersion/GitFlowVersionTask.pdb
index 4b71b1a03..660391984 100644
Binary files a/buildsupport/GitFlowVersion/GitFlowVersionTask.pdb and b/buildsupport/GitFlowVersion/GitFlowVersionTask.pdb differ
diff --git a/buildsupport/GitFlowVersion/LibGit2Sharp.dll b/buildsupport/GitFlowVersion/LibGit2Sharp.dll
index 93d322ed5..a8e940c4b 100644
Binary files a/buildsupport/GitFlowVersion/LibGit2Sharp.dll and b/buildsupport/GitFlowVersion/LibGit2Sharp.dll differ
diff --git a/buildsupport/GitFlowVersion/NativeBinaries/amd64/git2-11f8336.dll b/buildsupport/GitFlowVersion/NativeBinaries/amd64/git2-11f8336.dll
deleted file mode 100644
index d06ebea12..000000000
Binary files a/buildsupport/GitFlowVersion/NativeBinaries/amd64/git2-11f8336.dll and /dev/null differ
diff --git a/buildsupport/GitFlowVersion/NativeBinaries/amd64/git2-65e9dc6.dll b/buildsupport/GitFlowVersion/NativeBinaries/amd64/git2-65e9dc6.dll
new file mode 100644
index 000000000..d548c861e
Binary files /dev/null and b/buildsupport/GitFlowVersion/NativeBinaries/amd64/git2-65e9dc6.dll differ
diff --git a/buildsupport/GitFlowVersion/NativeBinaries/x86/git2-11f8336.dll b/buildsupport/GitFlowVersion/NativeBinaries/x86/git2-11f8336.dll
deleted file mode 100644
index 7d66ec112..000000000
Binary files a/buildsupport/GitFlowVersion/NativeBinaries/x86/git2-11f8336.dll and /dev/null differ
diff --git a/buildsupport/GitFlowVersion/NativeBinaries/x86/git2-65e9dc6.dll b/buildsupport/GitFlowVersion/NativeBinaries/x86/git2-65e9dc6.dll
new file mode 100644
index 000000000..040f87c75
Binary files /dev/null and b/buildsupport/GitFlowVersion/NativeBinaries/x86/git2-65e9dc6.dll differ
diff --git a/buildsupport/MSBuild.Community.Tasks.dll b/buildsupport/MSBuild.Community.Tasks.dll
new file mode 100644
index 000000000..6d43c0e5b
Binary files /dev/null and b/buildsupport/MSBuild.Community.Tasks.dll differ
diff --git a/buildsupport/NuGet.Core.dll b/buildsupport/NuGet.Core.dll
index 390e4e025..a5787205f 100644
Binary files a/buildsupport/NuGet.Core.dll and b/buildsupport/NuGet.Core.dll differ
diff --git a/buildsupport/PepitaPackage.dll b/buildsupport/PepitaPackage.dll
new file mode 100644
index 000000000..d1509d1b2
Binary files /dev/null and b/buildsupport/PepitaPackage.dll differ
diff --git a/buildsupport/RippleRestoreTask.dll b/buildsupport/RippleRestoreTask.dll
index bb438ef2a..e443473c5 100644
Binary files a/buildsupport/RippleRestoreTask.dll and b/buildsupport/RippleRestoreTask.dll differ
diff --git a/buildsupport/RippleRestoreTask.pdb b/buildsupport/RippleRestoreTask.pdb
deleted file mode 100644
index ef5ffaf6e..000000000
Binary files a/buildsupport/RippleRestoreTask.pdb and /dev/null differ
diff --git a/buildsupport/RippleRestoreTask.targets b/buildsupport/RippleRestoreTask.targets
index 9f45f0113..cb3f1b839 100644
--- a/buildsupport/RippleRestoreTask.targets
+++ b/buildsupport/RippleRestoreTask.targets
@@ -2,7 +2,7 @@
$(MSBuildProjectDirectory)\..\
-
+
RippleRestoreTarget;
$(BuildDependsOn);
diff --git a/buildsupport/Timestamp/Timestamp.dll b/buildsupport/Timestamp/Timestamp.dll
deleted file mode 100644
index 4d0be4e1c..000000000
Binary files a/buildsupport/Timestamp/Timestamp.dll and /dev/null differ
diff --git a/buildsupport/Timestamp/Timestamp.pdb b/buildsupport/Timestamp/Timestamp.pdb
deleted file mode 100644
index b34f48cac..000000000
Binary files a/buildsupport/Timestamp/Timestamp.pdb and /dev/null differ
diff --git a/buildsupport/ripple.exe b/buildsupport/ripple.exe
index 6daed2576..f2b3de268 100644
Binary files a/buildsupport/ripple.exe and b/buildsupport/ripple.exe differ
diff --git a/buildsupport/ripple.pdb b/buildsupport/ripple.pdb
deleted file mode 100644
index 25d4f108c..000000000
Binary files a/buildsupport/ripple.pdb and /dev/null differ
diff --git a/ripple.cmd b/ripple.cmd
new file mode 100644
index 000000000..74b6af73f
--- /dev/null
+++ b/ripple.cmd
@@ -0,0 +1 @@
+buildsupport\ripple.exe %*
\ No newline at end of file
diff --git a/ripple.config b/ripple.config
index 8e8b61f15..5f482d90b 100644
--- a/ripple.config
+++ b/ripple.config
@@ -1,5 +1,5 @@
-
+
NServiceBus.SqlServer
packaging/nuget
src
@@ -8,56 +8,19 @@
CurrentMajor,NextMajor
Current,NextMajor
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Audit/When_a_message_is_audited.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Audit/When_a_message_is_audited.cs
deleted file mode 100644
index c17f3a0cc..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Audit/When_a_message_is_audited.cs
+++ /dev/null
@@ -1,119 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Audit
-{
- using System;
- using System.Linq;
- using EndpointTemplates;
- using AcceptanceTesting;
- using MessageMutator;
- using NUnit.Framework;
-
-#pragma warning disable 612, 618
-
- public class When_a_message_is_audited : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_preserve_the_original_body()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new MessageToBeAudited())))
- .WithEndpoint()
- .Done(c => c.AuditChecksum != default(byte))
- .Run();
-
- Assert.AreEqual(context.OriginalBodyChecksum, context.AuditChecksum, "The body of the message sent to audit should be the same as the original message coming off the queue");
- }
-
-
- public class Context : ScenarioContext
- {
- public byte OriginalBodyChecksum { get; set; }
-
- public byte AuditChecksum { get; set; }
- }
-
- public class EndpointWithAuditOn : EndpointConfigurationBuilder
- {
- public EndpointWithAuditOn()
- {
- EndpointSetup()
- .AuditTo();
- }
-
- class BodyMutator : IMutateTransportMessages, NServiceBus.INeedInitialization
- {
- public Context Context { get; set; }
-
- public void MutateIncoming(TransportMessage transportMessage)
- {
-
- var originalBody = transportMessage.Body;
-
- Context.OriginalBodyChecksum = Checksum(originalBody);
-
- var decryptedBody = new byte[originalBody.Length];
-
- Buffer.BlockCopy(originalBody,0,decryptedBody,0,originalBody.Length);
-
- //decrypt
- decryptedBody[0]++;
-
- transportMessage.Body = decryptedBody;
- }
-
-
- public void MutateOutgoing(object[] messages, TransportMessage transportMessage)
- {
- //not the way to do it for real but good enough for this test
- transportMessage.Body[0]--;
- }
-
- public void Init()
- {
- Configure.Component(DependencyLifecycle.InstancePerCall);
- }
- }
-
-
- class MessageToBeAuditedHandler : IHandleMessages{ public void Handle(MessageToBeAudited message) {}}
- }
-
- class AuditSpyEndpoint : EndpointConfigurationBuilder
- {
- public AuditSpyEndpoint()
- {
- EndpointSetup();
- }
-
- class BodySpy : IMutateIncomingTransportMessages, NServiceBus.INeedInitialization
- {
- public Context Context { get; set; }
-
- public void MutateIncoming(TransportMessage transportMessage)
- {
- Context.AuditChecksum = Checksum(transportMessage.Body);
- }
-
- public void Init()
- {
- Configure.Component(DependencyLifecycle.InstancePerCall);
- }
- }
- }
-
- public static byte Checksum(byte[] data)
- {
- var longSum = data.Sum(x => (long)x);
- return unchecked((byte)longSum);
- }
-
- [Serializable]
- public class MessageToBeAudited : IMessage
- {
- }
- }
-
-#pragma warning restore 612, 618
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Audit/When_using_auditing_as_a_feature.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Audit/When_using_auditing_as_a_feature.cs
deleted file mode 100644
index 1df939607..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Audit/When_using_auditing_as_a_feature.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-
-namespace NServiceBus.AcceptanceTests.Audit
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
-
- public class When_using_auditing_as_a_feature : NServiceBusAcceptanceTest
- {
- [Test]
- public void Message_should_not_be_forwarded_to_auditQueue_when_auditing_is_disabled()
- {
- var context = new Context();
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new MessageToBeAudited())))
- .WithEndpoint()
- .Done(c => c.IsMessageHandlingComplete)
- .Run();
-
- Assert.IsFalse(context.IsMessageHandledByTheAuditEndpoint);
- }
-
- [Test]
- public void Message_should_be_forwarded_to_auditQueue_when_auditing_is_enabled()
- {
- var context = new Context();
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new MessageToBeAudited())))
- .WithEndpoint()
- .Done(c => c.IsMessageHandlingComplete)
- .Run();
-
- Assert.IsTrue(context.IsMessageHandledByTheAuditEndpoint);
- }
-
- public class Context : ScenarioContext
- {
- public bool IsMessageHandlingComplete { get; set; }
- public bool IsMessageHandledByTheAuditEndpoint { get; set; }
- }
-
- public class EndpointWithAuditOff : EndpointConfigurationBuilder
- {
-
- public EndpointWithAuditOff()
- {
- // Although the AuditTo seems strange here, this test tries to fake the scenario where
- // even though the user has specified audit config, because auditing is explicitly turned
- // off, no messages should be audited.
- EndpointSetup(c => Configure.Features.Disable())
- .AuditTo();
-
- }
-
- class MessageToBeAuditedHandler : IHandleMessages
- {
- public Context MyContext { get; set; }
-
- public void Handle(MessageToBeAudited message)
- {
- MyContext.IsMessageHandlingComplete = true;
- }
- }
- }
-
- public class EndpointWithAuditOn : EndpointConfigurationBuilder
- {
-
- public EndpointWithAuditOn()
- {
- EndpointSetup()
- .AuditTo();
- }
-
- class MessageToBeAuditedHandler : IHandleMessages
- {
- public Context MyContext { get; set; }
-
- public void Handle(MessageToBeAudited message)
- {
- MyContext.IsMessageHandlingComplete = true;
- }
- }
- }
-
- public class EndpointThatHandlesAuditMessages : EndpointConfigurationBuilder
- {
-
- public EndpointThatHandlesAuditMessages()
- {
- EndpointSetup();
- }
-
- class AuditMessageHandler : IHandleMessages
- {
- public Context MyContext { get; set; }
-
- public void Handle(MessageToBeAudited message)
- {
- MyContext.IsMessageHandledByTheAuditEndpoint = true;
- }
- }
- }
-
- [Serializable]
- public class MessageToBeAudited : IMessage
- {
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/MessingAround.cs b/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/MessingAround.cs
deleted file mode 100644
index b9348f5c2..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/MessingAround.cs
+++ /dev/null
@@ -1,83 +0,0 @@
-namespace NServiceBus.AcceptanceTests.BasicMessaging
-{
- using System;
- using System.Collections.Generic;
- using AcceptanceTesting;
- using EndpointTemplates;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class MessingAround : NServiceBusAcceptanceTest
- {
- [Test, Ignore("Just added for convenience")]
- public void CanExecuteEntirePipelineInRealisticScenario()
- {
- Scenario.Define(() => new Context { Id = Guid.NewGuid() })
- .WithEndpoint(b => b.Given((bus, context) => bus.Send(new MyMessage { Id = context.Id })))
- .WithEndpoint()
- .Done(c => c.WasCalled)
- .Repeat(r => r.For(Serializers.Xml)
- .For(Builders.Windsor))
- .Should(c =>
- {
- Assert.True(c.WasCalled, "The message handler should be called");
- Assert.AreEqual(1, c.TimesCalled, "The message handler should only be invoked once");
- Assert.AreEqual(Environment.MachineName, c.ReceivedHeaders[Headers.OriginatingMachine], "The sender should attach the machine name as a header");
- Assert.True(c.ReceivedHeaders[Headers.OriginatingEndpoint].Contains("Sender"), "The sender should attach its endpoint name as a header");
- Assert.AreEqual(Environment.MachineName, c.ReceivedHeaders[Headers.ProcessingMachine], "The receiver should attach the machine name as a header");
- Assert.True(c.ReceivedHeaders[Headers.ProcessingEndpoint].Contains("Receiver"), "The receiver should attach its endpoint name as a header");
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool WasCalled { get; set; }
- public int TimesCalled { get; set; }
- public IDictionary ReceivedHeaders { get; set; }
- public Guid Id { get; set; }
- }
-
- public class Sender : EndpointConfigurationBuilder
- {
- public Sender()
- {
- EndpointSetup()
- .AddMapping(typeof(Receiver));
- }
- }
-
- public class Receiver : EndpointConfigurationBuilder
- {
- public Receiver()
- {
- EndpointSetup();
- }
- }
-
- public class MyMessageHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MyMessage message)
- {
- if (Context.Id != message.Id)
- return;
-
- Context.TimesCalled++;
-
- Context.ReceivedHeaders = Bus.CurrentMessageContext.Headers;
-
- Context.WasCalled = true;
- }
- }
-
- [Serializable]
- public class MyMessage : ICommand
- {
- public Guid Id { get; set; }
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_aborting_the_behavior_chain.cs b/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_aborting_the_behavior_chain.cs
deleted file mode 100644
index dcb50ea51..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_aborting_the_behavior_chain.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-namespace NServiceBus.AcceptanceTests.BasicMessaging
-{
- using System;
- using AcceptanceTesting;
- using EndpointTemplates;
- using NUnit.Framework;
-
- public class When_aborting_the_behavior_chain : NServiceBusAcceptanceTest
- {
- [Test]
- public void Subsequent_handlers_will_not_be_invoked()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.Send(Address.Local, new SomeMessage())))
- .Done(c => c.FirstHandlerInvoked)
- .Run();
-
- Assert.That(context.FirstHandlerInvoked, Is.True);
- Assert.That(context.SecondHandlerInvoked, Is.False);
- }
-
- public class Context : ScenarioContext
- {
- public bool FirstHandlerInvoked { get; set; }
- public bool SecondHandlerInvoked { get; set; }
- }
-
- [Serializable]
- public class SomeMessage : IMessage { }
-
- public class MyEndpoint : EndpointConfigurationBuilder
- {
- public MyEndpoint()
- {
- EndpointSetup();
- }
-
- class EnsureOrdering : ISpecifyMessageHandlerOrdering
- {
- public void SpecifyOrder(Order order)
- {
- order.Specify(First.Then());
- }
- }
-
- class FirstHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(SomeMessage message)
- {
- Context.FirstHandlerInvoked = true;
-
- Bus.DoNotContinueDispatchingCurrentMessageToHandlers();
- }
- }
-
- class SecondHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(SomeMessage message)
- {
- Context.SecondHandlerInvoked = true;
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_handling_current_message_later.cs b/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_handling_current_message_later.cs
deleted file mode 100644
index 00420aed9..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_handling_current_message_later.cs
+++ /dev/null
@@ -1,157 +0,0 @@
-namespace NServiceBus.AcceptanceTests.BasicMessaging
-{
- using System;
- using System.Linq;
- using AcceptanceTesting;
- using EndpointTemplates;
- using NUnit.Framework;
-
- public class When_handling_current_message_later : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_commit_unit_of_work()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.Send(Address.Local, new SomeMessage())))
- .Done(c => c.Done)
- .Run();
-
- Assert.That(context.AnotherMessageReceivedCount, Is.EqualTo(2),
- "First handler sends a message to self, which should result in AnotherMessage being dispatched twice");
- }
-
- [Test, Description("NOTE the double negation - we should probably modify this behavior somehow")]
- public void Should_not_not_execute_subsequent_handlers()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.Send(Address.Local, new SomeMessage())))
- .Done(c => c.Done)
- .Run();
-
- Assert.That(context.ThirdHandlerInvocationCount, Is.EqualTo(2),
- "Since calling HandleCurrentMessageLater does not discontinue message dispatch, the third handler should be called twice as well");
- }
-
- [Test]
- public void Handlers_are_executed_in_the_right_order()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.Send(Address.Local, new SomeMessage())))
- .Done(c => c.Done)
- .Run();
-
- var events = context.Events;
- CollectionAssert
- .AreEquivalent(new[]
- {
- "FirstHandler:Executed",
- "SecondHandler:Sending message to the back of the queue",
- "ThirdHandler:Executed",
- "FirstHandler:Executed",
- "SecondHandler:Handling the message this time",
- "ThirdHandler:Executed",
- },
- events);
- }
-
- public class Context : ScenarioContext
- {
- public string[] Events { get; set; }
-
- public bool SomeMessageHasBeenRequeued { get; set; }
-
- public bool Done
- {
- get { return ThirdHandlerInvocationCount >= 2 && AnotherMessageReceivedCount == 2; }
- }
-
- public int AnotherMessageReceivedCount { get; set; }
-
- public int ThirdHandlerInvocationCount { get; set; }
- }
-
- [Serializable]
- public class SomeMessage : IMessage { }
-
- [Serializable]
- public class AnotherMessage : IMessage { }
-
- public class MyEndpoint : EndpointConfigurationBuilder
- {
- public MyEndpoint()
- {
- EndpointSetup();
- }
-
- class EnsureOrdering : ISpecifyMessageHandlerOrdering
- {
- public void SpecifyOrder(Order order)
- {
- order.Specify(First.Then().AndThen());
- }
- }
-
- class FirstHandler : IHandleMessages, IHandleMessages
- {
- public Context Context { get; set; }
- public IBus Bus { get; set; }
-
- public void Handle(SomeMessage message)
- {
- Context.RegisterEvent("FirstHandler:Executed");
- Bus.SendLocal(new AnotherMessage());
- }
-
- public void Handle(AnotherMessage message)
- {
- Context.AnotherMessageReceivedCount++;
- }
- }
-
- class SecondHandler : IHandleMessages
- {
- public Context Context { get; set; }
- public IBus Bus { get; set; }
- public void Handle(SomeMessage message)
- {
- if (!Context.SomeMessageHasBeenRequeued)
- {
- Context.RegisterEvent("SecondHandler:Sending message to the back of the queue");
- Bus.HandleCurrentMessageLater();
- Context.SomeMessageHasBeenRequeued = true;
- }
- else
- {
- Context.RegisterEvent("SecondHandler:Handling the message this time");
- }
- }
- }
-
- class ThirdHandler : IHandleMessages
- {
- public Context Context { get; set; }
- public void Handle(SomeMessage message)
- {
- Context.RegisterEvent("ThirdHandler:Executed");
- Context.ThirdHandlerInvocationCount++;
- }
- }
- }
- }
-
- static class ContextEx
- {
- public static void RegisterEvent(this When_handling_current_message_later.Context context, string description)
- {
- context.Events = context.Events
- .Concat(new[] {description})
- .ToArray();
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_registering_a_callback_for_a_local_message.cs b/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_registering_a_callback_for_a_local_message.cs
deleted file mode 100644
index d00d0102b..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_registering_a_callback_for_a_local_message.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-namespace NServiceBus.AcceptanceTests.BasicMessaging
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_registering_a_callback_for_a_local_message : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_trigger_the_callback_when_the_response_comes_back()
- {
- Scenario.Define()
- .WithEndpoint(b=>b.Given(
- (bus,context)=>bus.SendLocal(new MyRequest()).Register(r =>
- {
- Assert.True(context.HandlerGotTheRequest);
- context.CallbackFired = true;
- })))
- .Done(c => c.CallbackFired)
- .Repeat(r =>r.For(Transports.Default))
- .Should(c =>
- {
- Assert.True(c.CallbackFired);
- Assert.True(c.HandlerGotTheRequest);
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool HandlerGotTheRequest { get; set; }
-
- public bool CallbackFired { get; set; }
- }
-
- public class EndpointWithLocalCallback : EndpointConfigurationBuilder
- {
- public EndpointWithLocalCallback()
- {
- EndpointSetup();
- }
-
- public class MyRequestHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MyRequest request)
- {
- Assert.False(Context.CallbackFired);
- Context.HandlerGotTheRequest = true;
-
- Bus.Return(1);
- }
- }
- }
-
- [Serializable]
- public class MyRequest : IMessage{}
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_sending_a_message_to_another_endpoint.cs b/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_sending_a_message_to_another_endpoint.cs
deleted file mode 100644
index 44e5b2bc6..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_sending_a_message_to_another_endpoint.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace NServiceBus.AcceptanceTests.BasicMessaging
-{
- using System;
- using System.Collections.Generic;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_sending_a_message_to_another_endpoint : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_receive_the_message()
- {
- Scenario.Define(() => new Context { Id = Guid.NewGuid() })
- .WithEndpoint(b => b.Given((bus, context) => bus.Send(new MyMessage { Id = context.Id })))
- .WithEndpoint()
- .Done(c => c.WasCalled)
- .Repeat(r =>r.For(Serializers.Binary)
- .For()
- )
- .Should(c =>
- {
- Assert.True(c.WasCalled, "The message handler should be called");
- Assert.AreEqual(1, c.TimesCalled, "The message handler should only be invoked once");
- Assert.AreEqual(Environment.MachineName, c.ReceivedHeaders[Headers.OriginatingMachine], "The sender should attach the machine name as a header");
- Assert.True(c.ReceivedHeaders[Headers.OriginatingEndpoint].Contains("Sender"), "The sender should attach its endpoint name as a header");
- Assert.AreEqual(Environment.MachineName, c.ReceivedHeaders[Headers.ProcessingMachine], "The receiver should attach the machine name as a header");
- Assert.True(c.ReceivedHeaders[Headers.ProcessingEndpoint].Contains("Receiver"), "The receiver should attach its endpoint name as a header");
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool WasCalled { get; set; }
-
- public int TimesCalled { get; set; }
-
- public IDictionary ReceivedHeaders { get; set; }
-
- public Guid Id { get; set; }
- }
-
- public class Sender : EndpointConfigurationBuilder
- {
- public Sender()
- {
- EndpointSetup()
- .AddMapping(typeof(Receiver));
- }
- }
-
- public class Receiver : EndpointConfigurationBuilder
- {
- public Receiver()
- {
- EndpointSetup();
- }
- }
-
- [Serializable]
- public class MyMessage : ICommand
- {
- public Guid Id { get; set; }
- }
-
- public class MyMessageHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MyMessage message)
- {
- if (Context.Id != message.Id)
- return;
-
- Context.TimesCalled++;
-
- Context.ReceivedHeaders = Bus.CurrentMessageContext.Headers;
-
- Context.WasCalled = true;
- }
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_using_a_custom_correlation_id.cs b/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_using_a_custom_correlation_id.cs
deleted file mode 100644
index f1221c4e1..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_using_a_custom_correlation_id.cs
+++ /dev/null
@@ -1,74 +0,0 @@
-namespace NServiceBus.AcceptanceTests.BasicMessaging
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using MessageMutator;
- using NUnit.Framework;
-
- public class When_using_a_custom_correlation_id : NServiceBusAcceptanceTest
- {
- static string CorrelationId = "my_custom_correlation_id";
-
- [Test]
- public void Should_use_the_given_id_as_the_transport_level_correlation_id()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.Send(Address.Local, CorrelationId, new MyRequest())))
- .Done(c => c.GotRequest)
- .Run();
-
- Assert.AreEqual(CorrelationId, context.CorrelationIdReceived, "Correlation ids should match");
- }
-
- public class Context : ScenarioContext
- {
- public bool GotRequest { get; set; }
-
- public string CorrelationIdReceived { get; set; }
- }
-
- public class CorrelationEndpoint : EndpointConfigurationBuilder
- {
- public CorrelationEndpoint()
- {
- EndpointSetup();
- }
-
- class GetValueOfIncomingCorrelationId:IMutateIncomingTransportMessages,INeedInitialization
- {
- public Context Context { get; set; }
-
- public void MutateIncoming(TransportMessage transportMessage)
- {
- Context.CorrelationIdReceived = transportMessage.CorrelationId;
- }
-
- public void Init()
- {
- Configure.Component(DependencyLifecycle.InstancePerCall);
- }
- }
-
- public class MyResponseHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MyRequest response)
- {
- Context.GotRequest = true;
- }
- }
- }
-
-
- [Serializable]
- public class MyRequest : IMessage
- {
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_using_callbacks_in_a_scaleout_scenario.cs b/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_using_callbacks_in_a_scaleout_scenario.cs
deleted file mode 100644
index db1df8120..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/BasicMessaging/When_using_callbacks_in_a_scaleout_scenario.cs
+++ /dev/null
@@ -1,125 +0,0 @@
-namespace NServiceBus.AcceptanceTests.BasicMessaging
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
- using Support;
-
- public class When_using_callbacks_in_a_scaleout_scenario : NServiceBusAcceptanceTest
- {
- [Test]
- public void Each_client_should_have_a_unique_input_queue_to_avoid_processing_each_others_callbacks()
- {
- Scenario.Define(() => new Context{Id = Guid.NewGuid()})
- .WithEndpoint(b => b.CustomConfig(c=>RuntimeEnvironment.MachineNameAction = () => "ClientA")
- .Given((bus, context) => bus.Send(new MyRequest { Id = context.Id, Client = RuntimeEnvironment.MachineName })
- .Register(r => context.CallbackAFired = true)))
- .WithEndpoint(b => b.CustomConfig(c=>RuntimeEnvironment.MachineNameAction = () => "ClientB")
- .Given((bus, context) => bus.Send(new MyRequest { Id = context.Id, Client = RuntimeEnvironment.MachineName })
- .Register(r => context.CallbackBFired = true)))
- .WithEndpoint()
- .Done(c => c.ClientAGotResponse && c.ClientBGotResponse)
- .Repeat(r =>r.For()
- )
- .Should(c =>
- {
- Assert.True(c.CallbackAFired, "Callback on ClientA should fire");
- Assert.True(c.CallbackBFired, "Callback on ClientB should fire");
- Assert.False(c.ResponseEndedUpAtTheWrongClient, "One of the responses ended up at the wrong client");
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public Guid Id { get; set; }
-
- public bool ClientAGotResponse { get; set; }
-
- public bool ClientBGotResponse { get; set; }
-
- public bool ResponseEndedUpAtTheWrongClient { get; set; }
-
- public bool CallbackAFired { get; set; }
-
- public bool CallbackBFired { get; set; }
- }
-
- public class Client : EndpointConfigurationBuilder
- {
- public Client()
- {
- EndpointSetup(c => Configure.ScaleOut(s => s.UseUniqueBrokerQueuePerMachine()))
- .AddMapping(typeof(Server));
- }
-
- public class MyResponseHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MyResponse response)
- {
- if (Context.Id != response.Id)
- return;
-
- if (RuntimeEnvironment.MachineName == "ClientA")
- Context.ClientAGotResponse = true;
- else
- {
- Context.ClientBGotResponse = true;
- }
-
- if (RuntimeEnvironment.MachineName != response.Client)
- Context.ResponseEndedUpAtTheWrongClient = true;
- }
- }
- }
-
- public class Server : EndpointConfigurationBuilder
- {
- public Server()
- {
- EndpointSetup();
- }
-
- public class MyMessageHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MyRequest request)
- {
- if (Context.Id != request.Id)
- return;
-
-
- Bus.Reply(new MyResponse { Id = request.Id,Client = request.Client });
- }
- }
- }
-
- [Serializable]
- public class MyRequest : IMessage
- {
- public Guid Id { get; set; }
-
- public string Client { get; set; }
- }
-
- [Serializable]
- public class MyResponse : IMessage
- {
- public Guid Id { get; set; }
-
- public string Client { get; set; }
- }
-
-
-
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/BusStartStop/When_bus_start_and_stops_with_a_pending_message.cs b/src/NServiceBus.SqlServer.AcceptanceTests/BusStartStop/When_bus_start_and_stops_with_a_pending_message.cs
deleted file mode 100644
index 8b252ea7e..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/BusStartStop/When_bus_start_and_stops_with_a_pending_message.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-namespace NServiceBus.AcceptanceTests.BusStartStop
-{
- using System;
- using System.Threading;
- using AcceptanceTesting.Support;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
-
- public class When_bus_start_and_stops_with_a_pending_message : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_not_throw()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => SendMessages(b))
- .Run(TimeSpan.FromMilliseconds(100));
-
- Thread.Sleep(100);
- }
-
-
- EndpointBehaviorBuilder SendMessages(EndpointBehaviorBuilder b)
- {
- return b.Given((bus, context) => bus.SendLocal(new Message()));
- }
-
- public class Context : ScenarioContext
- {
- }
-
- public class Endpoint : EndpointConfigurationBuilder
- {
- public Endpoint()
- {
- EndpointSetup();
- }
-
- class MessageHandler : IHandleMessages
- {
- public void Handle(Message message)
- {
- Thread.Sleep(100);
- }
- }
- }
-
- [Serializable]
- public class Message : IMessage
- {
- }
-
- }
-
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Configuration/When_a_config_override_is_found.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Configuration/When_a_config_override_is_found.cs
deleted file mode 100644
index 3e130676c..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Configuration/When_a_config_override_is_found.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Configuration
-{
- using Config;
- using Config.ConfigurationSource;
- using EndpointTemplates;
- using AcceptanceTesting;
- using Faults.Forwarder;
- using NUnit.Framework;
- using Unicast;
- using Unicast.Transport;
-
- public class When_a_config_override_is_found : NServiceBusAcceptanceTest
- {
- static Address CustomErrorQ = Address.Parse("MyErrorQ");
-
- [Test]
- public void Should_be_used_instead_of_pulling_the_settings_from_appconfig()
- {
- var context = Scenario.Define()
- .WithEndpoint(b => b.When(c => c.EndpointsStarted, (bus, cc) =>
- {
- var unicastBus = (UnicastBus)bus;
- var transport = (TransportReceiver)unicastBus.Transport;
- var fm = (FaultManager)transport.FailureManager;
-
- cc.ErrorQueueUsedByTheEndpoint = fm.ErrorQueue;
- cc.IsDone = true;
- }))
- .Done(c => c.IsDone)
- .Run();
-
- Assert.AreEqual(CustomErrorQ, context.ErrorQueueUsedByTheEndpoint, "The error queue should have been changed");
-
- }
-
- public class Context : ScenarioContext
- {
- public bool IsDone { get; set; }
-
- public Address ErrorQueueUsedByTheEndpoint { get; set; }
- }
-
- public class ConfigOverrideEndpoint : EndpointConfigurationBuilder
- {
- public ConfigOverrideEndpoint()
- {
- EndpointSetup(c => c.MessageForwardingInCaseOfFault());
- }
-
- public class ConfigErrorQueue : IProvideConfiguration
- {
- public MessageForwardingInCaseOfFaultConfig GetConfiguration()
- {
-
- return new MessageForwardingInCaseOfFaultConfig
- {
- ErrorQueue = CustomErrorQ.ToString()
- };
- }
- }
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/DataBus/When_sending_databus_properties.cs b/src/NServiceBus.SqlServer.AcceptanceTests/DataBus/When_sending_databus_properties.cs
deleted file mode 100644
index db691ccc6..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/DataBus/When_sending_databus_properties.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-namespace NServiceBus.AcceptanceTests.DataBus
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_sending_databus_properties:NServiceBusAcceptanceTest
- {
- static byte[] PayloadToSend = new byte[1024 * 1024 * 10];
-
- [Test]
- public void Should_receive_the_message_the_largeproperty_correctly()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus=> bus.Send(new MyMessageWithLargePayload
- {
- Payload = new DataBusProperty(PayloadToSend)
- })))
- .WithEndpoint()
- .Done(context => context.ReceivedPayload != null)
- .Repeat(r => r.For())
- .Should(c => Assert.AreEqual(PayloadToSend, c.ReceivedPayload, "The large payload should be marshalled correctly using the databus"))
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public byte[] ReceivedPayload { get; set; }
- }
-
-
- public class Sender : EndpointConfigurationBuilder
- {
- public Sender()
- {
- EndpointSetup(c => c.FileShareDataBus(@".\databus\sender"))
- .AddMapping(typeof (Receiver));
- }
- }
-
- public class Receiver : EndpointConfigurationBuilder
- {
- public Receiver()
- {
- EndpointSetup(c => c.FileShareDataBus(@".\databus\sender"));
- }
-
- public class MyMessageHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyMessageWithLargePayload messageWithLargePayload)
- {
- Context.ReceivedPayload = messageWithLargePayload.Payload.Value;
- }
- }
- }
-
- [Serializable]
- public class MyMessageWithLargePayload : ICommand
- {
- public DataBusProperty Payload { get; set; }
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Encryption/When_using_encryption.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Encryption/When_using_encryption.cs
deleted file mode 100644
index 6c982f323..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Encryption/When_using_encryption.cs
+++ /dev/null
@@ -1,117 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Encryption
-{
- using System;
- using System.Collections.Generic;
- using Config;
- using Config.ConfigurationSource;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_using_encryption : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_receive_decrypted_message()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given((bus, context) => bus.SendLocal(new MessageWithSecretData
- {
- Secret = "betcha can't guess my secret",
- SubProperty = new MySecretSubProperty {Secret = "My sub secret"},
- CreditCards = new List
- {
- new CreditCardDetails
- {
- ValidTo = DateTime.UtcNow.AddYears(1),
- Number = "312312312312312"
- },
- new CreditCardDetails
- {
- ValidTo = DateTime.UtcNow.AddYears(2),
- Number = "543645546546456"
- }
- }
- })))
- .Done(c => c.Done)
- .Repeat(r => r.For())
- .Should(c =>
- {
- Assert.AreEqual("betcha can't guess my secret", c.Secret);
- Assert.AreEqual("My sub secret", c.SubPropertySecret);
- CollectionAssert.AreEquivalent(new List { "312312312312312", "543645546546456" }, c.CreditCards);
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool Done { get; set; }
-
- public string Secret { get; set; }
-
- public string SubPropertySecret { get; set; }
-
- public List CreditCards { get; set; }
- }
-
- public class Endpoint : EndpointConfigurationBuilder
- {
- public Endpoint()
- {
- EndpointSetup(c => c.RijndaelEncryptionService());
- }
-
- public class Handler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MessageWithSecretData message)
- {
- Context.Secret = message.Secret.Value;
-
- Context.SubPropertySecret = message.SubProperty.Secret.Value;
-
- Context.CreditCards = new List
- {
- message.CreditCards[0].Number.Value,
- message.CreditCards[1].Number.Value
- };
-
- Context.Done = true;
- }
- }
- }
-
- [Serializable]
- public class MessageWithSecretData : IMessage
- {
- public WireEncryptedString Secret { get; set; }
- public MySecretSubProperty SubProperty { get; set; }
- public List CreditCards { get; set; }
- }
-
- [Serializable]
- public class CreditCardDetails
- {
- public DateTime ValidTo { get; set; }
- public WireEncryptedString Number { get; set; }
- }
-
- [Serializable]
- public class MySecretSubProperty
- {
- public WireEncryptedString Secret { get; set; }
- }
-
- public class ConfigureEncryption: IProvideConfiguration
- {
- RijndaelEncryptionServiceConfig rijndaelEncryptionServiceConfig = new RijndaelEncryptionServiceConfig { Key = "gdDbqRpqdRbTs3mhdZh9qCaDaxJXl+e6" };
-
- public RijndaelEncryptionServiceConfig GetConfiguration()
- {
- return rijndaelEncryptionServiceConfig;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/BusExtensions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/BusExtensions.cs
deleted file mode 100644
index 6c087c009..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/BusExtensions.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace NServiceBus.AcceptanceTests.EndpointTemplates
-{
- using AcceptanceTesting;
-
- public static class BusExtensions
- {
- public static void EnsureSubscriptionMessagesHaveArrived(this IBus bus)
- {
- Configure.Instance.Builder.Build()
- .Wait();
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/ConfigureExtensions.cs b/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/ConfigureExtensions.cs
deleted file mode 100644
index 1b85ade99..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/ConfigureExtensions.cs
+++ /dev/null
@@ -1,187 +0,0 @@
-namespace NServiceBus.AcceptanceTests.EndpointTemplates
-{
- using System;
- using System.Collections.Generic;
- using System.Configuration;
- using AcceptanceTesting;
- using NServiceBus.ObjectBuilder.Autofac;
- using NServiceBus.ObjectBuilder.CastleWindsor;
- using NServiceBus.ObjectBuilder.Common.Config;
- using NServiceBus.ObjectBuilder.Ninject;
- using NServiceBus.ObjectBuilder.Spring;
- using NServiceBus.ObjectBuilder.StructureMap;
- using NServiceBus.ObjectBuilder.Unity;
- using NServiceBus.Serializers.Binary;
- using NServiceBus.Serializers.Json;
- using NServiceBus.Serializers.XML;
- using Persistence.InMemory.SagaPersister;
- using Persistence.InMemory.SubscriptionStorage;
- using Persistence.Msmq.SubscriptionStorage;
- using Persistence.NHibernate;
- using Persistence.Raven.SagaPersister;
- using Persistence.Raven.SubscriptionStorage;
- using SagaPersisters.NHibernate;
- using Unicast.Subscriptions.NHibernate;
-
- public static class ConfigureExtensions
- {
- static string NHibernateConnectionString = @"Server=localhost\sqlexpress;Database=nservicebus;Trusted_Connection=True;";
-
- public static string GetOrNull(this IDictionary dictionary, string key)
- {
- if (!dictionary.ContainsKey(key))
- {
- return null;
- }
-
- return dictionary[key];
- }
-
- public static Configure DefineHowManySubscriptionMessagesToWaitFor(this Configure config, int numberOfSubscriptionsToWaitFor)
- {
- config.Configurer.ConfigureProperty(
- spy => spy.NumberOfSubscriptionsToWaitFor, numberOfSubscriptionsToWaitFor);
-
- return config;
- }
-
- public static Configure DefineTransport(this Configure config, IDictionary settings)
- {
- if (!settings.ContainsKey("Transport"))
- settings = ScenarioDescriptors.Transports.Default.Settings;
-
- var transportType = Type.GetType(settings["Transport"]);
-
- return config.UseTransport(transportType, () => settings["Transport.ConnectionString"]);
-
- }
-
- public static Configure DefineSerializer(this Configure config, string serializer)
- {
- if (string.IsNullOrEmpty(serializer))
- return config;//xml is the default
-
- var type = Type.GetType(serializer);
-
- if (type == typeof (XmlMessageSerializer))
- {
- Configure.Serialization.Xml();
- return config;
- }
-
-
- if (type == typeof (JsonMessageSerializer))
- {
- Configure.Serialization.Json();
- return config;
- }
-
- if (type == typeof(BsonMessageSerializer))
- {
- Configure.Serialization.Bson();
- return config;
- }
-
- if (type == typeof (BinaryMessageSerializer))
- {
- Configure.Serialization.Binary();
- return config;
- }
-
- throw new InvalidOperationException("Unknown serializer:" + serializer);
- }
-
-
- public static Configure DefineSagaPersister(this Configure config, string persister)
- {
- if (string.IsNullOrEmpty(persister))
- return config.InMemorySagaPersister();
-
- var type = Type.GetType(persister);
-
- if (type == typeof(InMemorySagaPersister))
- return config.InMemorySagaPersister();
-
- if (type == typeof(RavenSagaPersister))
- {
- config.RavenPersistence(() => "url=http://localhost:8080");
- return config.RavenSagaPersister();
-
- }
-
- if (type == typeof(SagaPersister))
- {
- NHibernateSettingRetriever.ConnectionStrings = () => new ConnectionStringSettingsCollection {new ConnectionStringSettings("NServiceBus/Persistence", NHibernateConnectionString)};
- return config.UseNHibernateSagaPersister();
- }
-
- throw new InvalidOperationException("Unknown persister:" + persister);
- }
-
-
- public static Configure DefineSubscriptionStorage(this Configure config, string persister)
- {
- if (string.IsNullOrEmpty(persister))
- return config.InMemorySubscriptionStorage();
-
- var type = Type.GetType(persister);
-
- if (type == typeof(InMemorySubscriptionStorage))
- return config.InMemorySubscriptionStorage();
-
- if (type == typeof(RavenSubscriptionStorage))
- {
- config.RavenPersistence(() => "url=http://localhost:8080");
- return config.RavenSubscriptionStorage();
-
- }
-
- if (type == typeof(SubscriptionStorage))
- {
- NHibernateSettingRetriever.ConnectionStrings = () => new ConnectionStringSettingsCollection {new ConnectionStringSettings("NServiceBus/Persistence", NHibernateConnectionString)};
- return config.UseNHibernateSubscriptionPersister();
- }
-
-
- if (type == typeof(MsmqSubscriptionStorage))
- {
- return config.MsmqSubscriptionStorage();
- }
-
- throw new InvalidOperationException("Unknown persister:" + persister);
- }
-
- public static Configure DefineBuilder(this Configure config, string builder)
- {
- if (string.IsNullOrEmpty(builder))
- return config.DefaultBuilder();
-
- var type = Type.GetType(builder);
-
- if (type == typeof(AutofacObjectBuilder))
- {
- ConfigureCommon.With(config, new AutofacObjectBuilder(null));
-
- return config;
- }
-
- if (type == typeof(WindsorObjectBuilder))
- return config.CastleWindsorBuilder();
-
- if (type == typeof(NinjectObjectBuilder))
- return config.NinjectBuilder();
-
- if (type == typeof(SpringObjectBuilder))
- return config.SpringFrameworkBuilder();
-
- if (type == typeof(StructureMapObjectBuilder))
- return config.StructureMapBuilder();
-
- if (type == typeof(UnityObjectBuilder))
- return config.StructureMapBuilder();
-
-
- throw new InvalidOperationException("Unknown builder:" + builder);
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/DefaultServer.cs b/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/DefaultServer.cs
deleted file mode 100644
index 18859f18d..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/EndpointTemplates/DefaultServer.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-namespace NServiceBus.AcceptanceTests.EndpointTemplates
-{
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Reflection;
- using AcceptanceTesting.Support;
- using Config.ConfigurationSource;
- using Hosting.Helpers;
- using NServiceBus;
- using Settings;
-
- public class DefaultServer : IEndpointSetupTemplate
- {
- public Configure GetConfiguration(RunDescriptor runDescriptor, EndpointConfiguration endpointConfiguration, IConfigurationSource configSource)
- {
- var settings = runDescriptor.Settings;
-
- SetupLogging(endpointConfiguration);
-
- var types = GetTypesToUse(endpointConfiguration);
-
- var transportToUse = settings.GetOrNull("Transport");
-
- Configure.Features.Enable();
-
- SettingsHolder.SetDefault("ScaleOut.UseSingleBrokerQueue", true);
-
- var config = Configure.With(types)
- .DefineEndpointName(endpointConfiguration.EndpointName)
- .CustomConfigurationSource(configSource)
- .DefineBuilder(settings.GetOrNull("Builder"))
- .DefineSerializer(settings.GetOrNull("Serializer"))
- .DefineTransport(settings)
- .DefineSagaPersister(settings.GetOrNull("SagaPersister"));
-
- if (transportToUse == null ||
- transportToUse.Contains("Msmq") ||
- transportToUse.Contains("SqlServer") ||
- transportToUse.Contains("RabbitMq"))
- config.UseInMemoryTimeoutPersister();
-
- if (transportToUse == null || transportToUse.Contains("Msmq") || transportToUse.Contains("SqlServer"))
- config.DefineSubscriptionStorage(settings.GetOrNull("SubscriptionStorage"));
-
- return config.UnicastBus();
- }
-
- static IEnumerable GetTypesToUse(EndpointConfiguration endpointConfiguration)
- {
- var assemblies = new AssemblyScanner().GetScannableAssemblies();
-
- var types = assemblies.Assemblies
- //exclude all test types by default
- .Where(a => a != Assembly.GetExecutingAssembly())
- .SelectMany(a => a.GetTypes());
-
-
- types = types.Union(GetNestedTypeRecursive(endpointConfiguration.BuilderType.DeclaringType, endpointConfiguration.BuilderType));
-
- types = types.Union(endpointConfiguration.TypesToInclude);
-
- return types.Where(t => !endpointConfiguration.TypesToExclude.Contains(t)).ToList();
- }
-
- static IEnumerable GetNestedTypeRecursive(Type rootType,Type builderType)
- {
- yield return rootType;
-
- if (typeof(IEndpointConfigurationFactory).IsAssignableFrom(rootType) && rootType != builderType)
- yield break;
-
- foreach (var nestedType in rootType.GetNestedTypes(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).SelectMany(t => GetNestedTypeRecursive(t, builderType)))
- {
- yield return nestedType;
- }
- }
-
- static void SetupLogging(EndpointConfiguration endpointConfiguration)
- {
- var logDir = ".\\logfiles\\";
-
- if (!Directory.Exists(logDir))
- Directory.CreateDirectory(logDir);
-
- var logFile = Path.Combine(logDir, endpointConfiguration.EndpointName + ".txt");
-
- if (File.Exists(logFile))
- File.Delete(logFile);
-
- var logLevel = "WARN";
- var logLevelOverride = Environment.GetEnvironmentVariable("tests_loglevel");
-
- if (!string.IsNullOrEmpty(logLevelOverride))
- logLevel = logLevelOverride;
-
- SetLoggingLibrary.Log4Net(null,
- Logging.Loggers.Log4NetAdapter.Log4NetAppenderFactory.CreateRollingFileAppender(logLevel, logFile));
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_doing_request_response_between_sites.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_doing_request_response_between_sites.cs
deleted file mode 100644
index e868615a6..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_doing_request_response_between_sites.cs
+++ /dev/null
@@ -1,143 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Gateway
-{
- using System;
- using Config;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_doing_request_response_between_sites : NServiceBusAcceptanceTest
- {
- static readonly byte[] PayloadToSend = new byte[1024 * 1024 * 10];
-
- [Test]
- public void Should_be_able_to_reply_to_the_message_using_databus()
- {
- Scenario.Define()
- .WithEndpoint(
- b => b.Given((bus, context) =>
- bus.SendToSites(new[] { "SiteB" }, new MyRequest { Payload = new DataBusProperty(PayloadToSend) })
- .Register(result => context.GotCallback = true)))
- .WithEndpoint()
- .Done(c => c.GotResponseBack && c.GotCallback)
- .Repeat(r => r.For(Transports.Default))
- .Should(c =>
- {
- Assert.AreEqual(PayloadToSend, c.SiteBReceivedPayload,
- "The large payload should be marshalled correctly using the databus");
- Assert.AreEqual(PayloadToSend, c.SiteAReceivedPayloadInResponse,
- "The large payload should be marshalled correctly using the databus");
- Assert.AreEqual(@"http,http://localhost:25899/SiteA/NumberOfWorkerThreads=1Default=True", c.OriginatingSiteForRequest);
- Assert.AreEqual(@"http,http://localhost:25899/SiteB/NumberOfWorkerThreads=1Default=True", c.OriginatingSiteForResponse);
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool GotResponseBack { get; set; }
- public bool GotCallback { get; set; }
- public byte[] SiteBReceivedPayload { get; set; }
- public byte[] SiteAReceivedPayloadInResponse { get; set; }
- public string OriginatingSiteForRequest { get; set; }
- public string OriginatingSiteForResponse { get; set; }
- }
-
- public class SiteA : EndpointConfigurationBuilder
- {
- public SiteA()
- {
- EndpointSetup(c => c.RunGateway()
- .UseInMemoryGatewayPersister()
- .FileShareDataBus(@".\databus\siteA"))
- .WithConfig(c =>
- {
- c.Sites = new SiteCollection
- {
- new SiteConfig
- {
- Key = "SiteB",
- Address = "http://localhost:25899/SiteB/",
- ChannelType = "http"
- }
- };
-
- c.Channels = new ChannelCollection
- {
- new ChannelConfig
- {
- Address = "http://localhost:25899/SiteA/",
- ChannelType = "http",
- Default = true
- }
- };
- });
- }
-
- public class MyResponseHandler : IHandleMessages
- {
- public Context Context { get; set; }
- public IBus Bus { get; set; }
-
- public void Handle(MyResponse response)
- {
- Context.GotResponseBack = true;
- Context.SiteAReceivedPayloadInResponse = response.OriginalPayload.Value;
-
- // Inspect the headers to find the originating site address
- Context.OriginatingSiteForResponse = Bus.CurrentMessageContext.Headers[Headers.OriginatingSite];
- }
- }
- }
-
- public class SiteB : EndpointConfigurationBuilder
- {
- public SiteB()
- {
- EndpointSetup(c => c.RunGateway().UseInMemoryGatewayPersister()
- .FileShareDataBus(@".\databus\siteB"))
- .WithConfig(c =>
- {
- c.Channels = new ChannelCollection
- {
- new ChannelConfig
- {
- Address = "http://localhost:25899/SiteB/",
- ChannelType = "http",
- Default = true
- }
- };
- });
-
- }
-
- public class MyRequestHandler : IHandleMessages
- {
- public IBus Bus { get; set; }
- public Context Context { get; set; }
-
- public void Handle(MyRequest request)
- {
- Context.SiteBReceivedPayload = request.Payload.Value;
- Bus.Reply(new MyResponse {OriginalPayload = request.Payload});
-
- // Inspect the headers to find the originating site address
- Context.OriginatingSiteForRequest = Bus.CurrentMessageContext.Headers[Headers.OriginatingSite];
- }
- }
- }
-
- [Serializable]
- public class MyRequest : ICommand
- {
- public DataBusProperty Payload { get; set; }
- }
-
- [Serializable]
- public class MyResponse : IMessage
- {
- public DataBusProperty OriginalPayload { get; set; }
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_sending_a_message_via_the_gateway.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_sending_a_message_via_the_gateway.cs
deleted file mode 100644
index 16126fca9..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_sending_a_message_via_the_gateway.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Gateway
-{
- using System;
- using System.IO;
- using System.Net;
- using System.Web;
- using Config;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NServiceBus.Gateway.Utils;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_sending_a_message_via_the_gateway : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_process_message()
- {
- Scenario.Define()
- .WithEndpoint(b => b.When(bus =>
- {
- var webRequest = (HttpWebRequest)WebRequest.Create("http://localhost:25898/Headquarters/");
- webRequest.Method = "POST";
- webRequest.ContentType = "text/xml; charset=utf-8";
- webRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)";
-
- webRequest.Headers.Add("Content-Encoding", "utf-8");
- webRequest.Headers.Add("NServiceBus.CallType", "Submit");
- webRequest.Headers.Add("NServiceBus.AutoAck", "true");
- webRequest.Headers.Add("MySpecialHeader", "MySpecialValue");
- webRequest.Headers.Add("NServiceBus.Id", Guid.NewGuid().ToString("N"));
-
- const string message = "";
-
- using (var messagePayload = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(message)))
- {
- webRequest.Headers.Add(HttpRequestHeader.ContentMd5, HttpUtility.UrlEncode(Hasher.Hash(messagePayload)));
- webRequest.ContentLength = messagePayload.Length;
-
- using (var requestStream = webRequest.GetRequestStream())
- {
- messagePayload.CopyTo(requestStream);
- }
- }
-
- while (true)
- {
- try
- {
- using (var myWebResponse = (HttpWebResponse) webRequest.GetResponse())
- {
- if (myWebResponse.StatusCode == HttpStatusCode.OK)
- {
- break;
- }
- }
- }
- catch (WebException)
- {
- }
- }
- }))
- .Done(c => c.GotMessage)
- .Repeat(r => r.For(Transports.Default))
- .Should(c =>
- {
- Assert.IsTrue(c.GotMessage);
- Assert.AreEqual("MySpecialValue", c.MySpecialHeader);
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool GotMessage { get; set; }
-
- public string MySpecialHeader { get; set; }
- }
-
- public class Headquarters : EndpointConfigurationBuilder
- {
- public Headquarters()
- {
- EndpointSetup(c => c.RunGateway().UseInMemoryGatewayPersister())
- .IncludeType()
- .WithConfig(c =>
- {
- c.Channels = new ChannelCollection
- {
- new ChannelConfig
- {
- Address = "http://localhost:25898/Headquarters/",
- ChannelType = "http"
- }
- };
- });
- }
-
- public class MyResponseHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MyRequest response)
- {
- Context.GotMessage = true;
- Context.MySpecialHeader = Bus.GetMessageHeader(response, "MySpecialHeader");
- }
- }
- }
- }
-
- [Serializable]
- public class MyRequest : IMessage
- {
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_using_a_custom_correlation_id.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_using_a_custom_correlation_id.cs
deleted file mode 100644
index d24576325..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Gateway/When_using_a_custom_correlation_id.cs
+++ /dev/null
@@ -1,113 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Gateway
-{
- using System;
- using Config;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_sending_a_message_to_another_site : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_be_able_to_reply_to_the_message()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendToSites(new[] { "SiteA" }, new MyRequest())))
- .WithEndpoint()
- .Done(c => c.GotResponseBack)
- .Repeat(r => r.For(Transports.Default)
- )
- .Should(c =>
- {
- Assert.IsTrue(c.GotResponseBack);
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool GotResponseBack { get; set; }
- }
-
- public class Headquarters : EndpointConfigurationBuilder
- {
- public Headquarters()
- {
- EndpointSetup(c => c.RunGateway().UseInMemoryGatewayPersister())
- .WithConfig(c =>
- {
- c.Sites = new SiteCollection
- {
- new SiteConfig
- {
- Key = "SiteA",
- Address = "http://localhost:25899/SiteA/",
- ChannelType = "http"
- }
- };
-
- c.Channels = new ChannelCollection
- {
- new ChannelConfig
- {
- Address = "http://localhost:25899/Headquarters/",
- ChannelType = "http"
- }
- };
-
-
- });
- }
-
- public class MyResponseHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyResponse response)
- {
- Context.GotResponseBack = true;
- }
- }
- }
-
- public class SiteA : EndpointConfigurationBuilder
- {
- public SiteA()
- {
- EndpointSetup(c => c.RunGateway().UseInMemoryGatewayPersister())
- .WithConfig(c =>
- {
- c.Channels = new ChannelCollection
- {
- new ChannelConfig
- {
- Address = "http://localhost:25899/SiteA/",
- ChannelType = "http"
- }
- };
- });
- }
-
- public class MyRequestHandler : IHandleMessages
- {
- public IBus Bus { get; set; }
-
- public void Handle(MyRequest request)
- {
- Bus.Reply(new MyResponse());
- }
- }
- }
-
- [Serializable]
- public class MyRequest : IMessage
- {
- }
-
- [Serializable]
- public class MyResponse : IMessage
- {
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/InMemory/When_calling_DoNotContinueDispatchingCurrentMessageToHandlers_from_inmemory.cs b/src/NServiceBus.SqlServer.AcceptanceTests/InMemory/When_calling_DoNotContinueDispatchingCurrentMessageToHandlers_from_inmemory.cs
deleted file mode 100644
index 357a94f06..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/InMemory/When_calling_DoNotContinueDispatchingCurrentMessageToHandlers_from_inmemory.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-namespace NServiceBus.AcceptanceTests.InMemory
-{
- using System;
- using AcceptanceTesting;
- using EndpointTemplates;
- using NUnit.Framework;
-
- public class When_calling_DoNotContinueDispatchingCurrentMessageToHandlers_from_inmemory : NServiceBusAcceptanceTest
- {
- [Test]
- public void Subsequent_inmemory_handlers_will_not_be_invoked()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new SomeMessage())))
- .Done(c => c.SecondHandlerInvoked)
- .Run();
-
- Assert.IsTrue(context.FirstHandlerInvoked);
- Assert.IsTrue(context.SecondHandlerInvoked);
- Assert.IsTrue(context.InMemoryEventReceivedByHandler1);
- Assert.IsFalse(context.InMemoryEventReceivedByHandler2);
- }
-
- public class Context : ScenarioContext
- {
- public bool FirstHandlerInvoked { get; set; }
- public bool SecondHandlerInvoked { get; set; }
-
- public bool InMemoryEventReceivedByHandler1 { get; set; }
- public bool InMemoryEventReceivedByHandler2 { get; set; }
-
- }
-
- [Serializable]
- public class SomeMessage : IMessage { }
-
- [Serializable]
- public class InMemoryEvent : IEvent
- {
- }
-
- public class MyEndpoint : EndpointConfigurationBuilder
- {
- public MyEndpoint()
- {
- EndpointSetup();
- }
-
- class EnsureOrdering : ISpecifyMessageHandlerOrdering
- {
- public void SpecifyOrder(Order order)
- {
- order.Specify(First.Then().AndThen().AndThen());
- }
- }
-
- class FirstHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(SomeMessage message)
- {
- Context.FirstHandlerInvoked = true;
-
- Bus.InMemory.Raise(m => { });
-
- }
- }
-
- class SecondHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(SomeMessage message)
- {
- Context.SecondHandlerInvoked = true;
- }
- }
-
- class MyEventHandler1 : IHandleMessages
- {
- public Context Context { get; set; }
- public IBus Bus { get; set; }
-
- public void Handle(InMemoryEvent messageThatIsEnlisted)
- {
- Bus.DoNotContinueDispatchingCurrentMessageToHandlers();
-
- Context.InMemoryEventReceivedByHandler1 = true;
- }
- }
-
- class MyEventHandler2 : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(InMemoryEvent messageThatIsEnlisted)
- {
- Context.InMemoryEventReceivedByHandler2 = true;
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/InMemory/When_raising_an_in_memory_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/InMemory/When_raising_an_in_memory_event.cs
deleted file mode 100644
index a31ca184e..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/InMemory/When_raising_an_in_memory_event.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-namespace NServiceBus.AcceptanceTests.InMemory
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
-
- public class When_raising_an_in_memory_event : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_be_delivered_to_handlers()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given((bus, c) => bus.SendLocal(m => { })))
- .Done(c => c.WasInMemoryEventReceivedByHandler1 && c.WasInMemoryEventReceivedByHandler2)
- .Run();
-
- Assert.True(context.WasInMemoryEventReceivedByHandler1, "class MyEventHandler1 did not receive the in-memory event");
- Assert.True(context.WasInMemoryEventReceivedByHandler2, "class MyEventHandler2 did not receive the in-memory event");
- }
-
- public class Context : ScenarioContext
- {
- public bool WasInMemoryEventReceivedByHandler1 { get; set; }
- public bool WasInMemoryEventReceivedByHandler2 { get; set; }
-
- }
-
- public class InMemoryEndpoint : EndpointConfigurationBuilder
- {
- public InMemoryEndpoint()
- {
- EndpointSetup();
- }
-
- public class CommandHandler : IHandleMessages
- {
- public IBus Bus { get; set; }
- public void Handle(SomeCommand messageThatIsEnlisted)
- {
- Bus.InMemory.Raise(m => { });
- }
- }
-
- public class MyEventHandler1 : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyInMemoryEvent messageThatIsEnlisted)
- {
- Context.WasInMemoryEventReceivedByHandler1 = true;
- }
- }
-
- public class MyEventHandler2 : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyInMemoryEvent messageThatIsEnlisted)
- {
- Context.WasInMemoryEventReceivedByHandler2 = true;
- }
- }
- }
-
-
- [Serializable]
- public class SomeCommand : ICommand
- {
- }
-
- [Serializable]
- public class MyInMemoryEvent : IEvent
- {
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBus.SqlServer.AcceptanceTests.csproj b/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBus.SqlServer.AcceptanceTests.csproj
index 40915a754..782d904a3 100644
--- a/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBus.SqlServer.AcceptanceTests.csproj
+++ b/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBus.SqlServer.AcceptanceTests.csproj
@@ -32,52 +32,10 @@
true
-
- ..\packages\Autofac\lib\net40\Autofac.dll
-
-
- ..\packages\Castle.Core\lib\net40-client\Castle.Core.dll
-
-
- ..\packages\Castle.Windsor\lib\net40\Castle.Windsor.dll
-
-
- ..\packages\Common.Logging\lib\1.0\Common.Logging.dll
-
-
- ..\packages\Iesi.Collections\lib\Net35\Iesi.Collections.dll
-
..\packages\log4net\lib\2.0\log4net.dll
-
- ..\packages\CommonServiceLocator\lib\NET35\Microsoft.Practices.ServiceLocation.dll
-
-
- ..\packages\Unity\lib\NET35\Microsoft.Practices.Unity.dll
-
-
- ..\packages\Unity\lib\NET35\Microsoft.Practices.Unity.Configuration.dll
-
-
- ..\packages\Unity.Interception\lib\NET35\Microsoft.Practices.Unity.Interception.dll
-
-
- ..\packages\Unity.Interception\lib\NET35\Microsoft.Practices.Unity.Interception.Configuration.dll
-
-
- ..\packages\NHibernate\lib\Net35\NHibernate.dll
-
-
- ..\packages\Ninject\lib\net40\Ninject.dll
-
-
- ..\packages\Ninject.Extensions.ContextPreservation\lib\net40\Ninject.Extensions.ContextPreservation.dll
-
-
- ..\packages\Ninject.Extensions.NamedScope\lib\net40\Ninject.Extensions.NamedScope.dll
-
..\packages\NServiceBus.Interfaces\lib\net40\NServiceBus.dll
@@ -87,122 +45,16 @@
..\packages\NServiceBus\lib\net40\NServiceBus.Core.dll
-
- ..\packages\NServiceBus.NHibernate\lib\net40\NServiceBus.NHibernate.dll
-
-
- ..\packages\NServiceBus.Autofac\lib\net40\NServiceBus.ObjectBuilder.Autofac.dll
-
-
- ..\packages\NServiceBus.CastleWindsor\lib\net40\NServiceBus.ObjectBuilder.CastleWindsor.dll
-
-
- ..\packages\NServiceBus.Ninject\lib\net40\NServiceBus.ObjectBuilder.Ninject.dll
-
-
- ..\packages\NServiceBus.Spring\lib\net40\NServiceBus.ObjectBuilder.Spring.dll
-
-
- ..\packages\NServiceBus.StructureMap\lib\net40\NServiceBus.ObjectBuilder.StructureMap.dll
-
-
- ..\packages\NServiceBus.Unity\lib\net40\NServiceBus.ObjectBuilder.Unity.dll
-
..\packages\NUnit\lib\nunit.framework.dll
-
- ..\packages\RavenDB.Client\lib\net40\Raven.Abstractions.dll
-
-
- ..\packages\RavenDB.Client\lib\net40\Raven.Client.Lightweight.dll
-
-
- ..\packages\Spring.Core\lib\net40\Spring.Core.dll
-
-
- ..\packages\structuremap\lib\net40\StructureMap.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -213,6 +65,18 @@
NServiceBus.SqlServer
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBusAcceptanceTest.cs b/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBusAcceptanceTest.cs
deleted file mode 100644
index 7a6e7957c..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/NServiceBusAcceptanceTest.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-namespace NServiceBus.AcceptanceTests
-{
- using System;
- using AcceptanceTesting.Customization;
- using NUnit.Framework;
-
- ///
- /// Base class for all the NSB test that sets up our conventions
- ///
- [TestFixture]
- public abstract class NServiceBusAcceptanceTest
- {
- [SetUp]
- public void SetUp()
- {
- Environment.SetEnvironmentVariable("Transport.UseSpecific", "SqlServer", EnvironmentVariableTarget.Process);
-
- Conventions.EndpointNamingConvention= t =>
- {
- var baseNs = typeof (NServiceBusAcceptanceTest).Namespace;
- var testName = GetType().Name;
- return t.FullName.Replace(baseNs + ".", "").Replace(testName + "+", "");
- };
-
- Conventions.DefaultRunDescriptor = () => ScenarioDescriptors.Transports.Default;
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Performance/NServiceBusPerformanceTest.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Performance/NServiceBusPerformanceTest.cs
deleted file mode 100644
index 160dde110..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Performance/NServiceBusPerformanceTest.cs
+++ /dev/null
@@ -1,79 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Performance
-{
- using System;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using AcceptanceTesting;
- using AcceptanceTesting.Support;
-
- public abstract class NServiceBusPerformanceTest : NServiceBusAcceptanceTest
- {
- protected static int NumberOfTestMessages
- {
- get
- {
- int nr;
-
- if (!int.TryParse(Environment.GetEnvironmentVariable("NServiceBus.MaxMessagesForPerformanceTests"), out nr))
- {
- return 3000;
- }
-
- return nr;
- }
- }
-
- protected static int MaxConcurrencyLevel
- {
- get
- {
- int nr;
-
- if (!int.TryParse(Environment.GetEnvironmentVariable("NServiceBus.MaxConcurrencyLevel"), out nr))
- {
- return 15;
- }
-
- return nr;
- }
- }
-
- protected static void DisplayTestResults(RunSummary summary)
- {
- var caller =
- new StackTrace().GetFrames()
- .First(f => typeof(NServiceBusPerformanceTest).IsAssignableFrom(f.GetMethod().DeclaringType.BaseType));
-
- var testCategory =
- caller.GetMethod()
- .DeclaringType.Namespace.Replace(typeof(NServiceBusPerformanceTest).Namespace + ".", "");
- var testCase = caller.GetMethod().Name;
-
- var c = summary.RunDescriptor.ScenarioContext as PerformanceTestContext;
-
- var messagesPerSecondsProcessed = c.NumberOfTestMessages/
- (c.LastMessageProcessedAt - c.FirstMessageProcessedAt).TotalSeconds;
-
- Console.Out.WriteLine("Results: {0} messages, {1} msg/s", c.NumberOfTestMessages,
- messagesPerSecondsProcessed);
-
- using (var file = new StreamWriter(".\\PerformanceTestResults.txt", true))
- {
- file.WriteLine(string.Join(";", summary.RunDescriptor.Key, testCategory, testCase,
- c.NumberOfTestMessages, messagesPerSecondsProcessed));
- }
-
- Console.Out.WriteLine("##teamcity[buildStatisticValue key='{0}' value='{1:0}']",
- summary.RunDescriptor.Key + "." + testCategory + "." + testCase, messagesPerSecondsProcessed);
- }
- }
-
- public class PerformanceTestContext : ScenarioContext
- {
- public DateTime FirstMessageProcessedAt { get; set; }
-
- public DateTime LastMessageProcessedAt { get; set; }
- public int NumberOfTestMessages;
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Performance/Receive/Receive_performance.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Performance/Receive/Receive_performance.cs
deleted file mode 100644
index feb0096f9..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Performance/Receive/Receive_performance.cs
+++ /dev/null
@@ -1,132 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Performance.Receive
-{
- using System;
- using System.Threading;
- using System.Threading.Tasks;
- using AcceptanceTesting;
- using AcceptanceTesting.Support;
- using Config;
- using EndpointTemplates;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class Receive_performance : NServiceBusPerformanceTest
- {
- [Test]
- public void With_dtc_enabled()
- {
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(SendTestMessages)
- .Done(c => c.Complete)
- .Repeat(r => r.For(Transports.Default))
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- [Test]
- public void With_dtc_suppressed()
- {
-
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Advanced(a => a.DisableDistributedTransactions()));
- SendTestMessages(b);
- })
- .Done(c => c.Complete)
- .Repeat(r => r.For(Transports.Default))
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- [Test]
- public void With_no_transactions()
- {
-
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Disable());
- SendTestMessages(b);
- })
- .Done(c => c.Complete)
- .Repeat(r => r.For(Transports.Default))
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- [Test]
- public void With_ambient_tx_suppressed()
- {
-
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Advanced(a => a.DoNotWrapHandlersExecutionInATransactionScope()));
- SendTestMessages(b);
- })
- .Done(c => c.Complete)
- .Repeat(r => r.For(Transports.Default))
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
-
- public class Context : PerformanceTestContext
- {
-
-
- public bool Complete { get; set; }
- }
-
- public class ReceiveEndpoint : EndpointConfigurationBuilder
- {
- public ReceiveEndpoint()
- {
- EndpointSetup()
- .WithConfig(c => c.MaximumConcurrencyLevel = MaxConcurrencyLevel);
- }
-
- public class MyMessageHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- static int numberOfMessagesProcessed;
-
-
- public void Handle(MyMessage messageThatIsEnlisted)
- {
- var current = Interlocked.Increment(ref numberOfMessagesProcessed);
-
- if (current == 1)
- {
- Context.FirstMessageProcessedAt = DateTime.UtcNow;
- }
-
- if (current == Context.NumberOfTestMessages)
- {
- Context.LastMessageProcessedAt = DateTime.UtcNow;
- Context.Complete = true;
- }
-
- }
- }
- }
-
- [Serializable]
- public class MyMessage : ICommand
- {
- }
-
-
-
- protected static void SendTestMessages(EndpointBehaviorBuilder b)
- {
- b.Given((bus, context) => Parallel.For(0, context.NumberOfTestMessages, (s, c) => bus.SendLocal(new MyMessage())));
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Performance/RequestResponse/Request_response_performance.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Performance/RequestResponse/Request_response_performance.cs
deleted file mode 100644
index d3c94d586..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Performance/RequestResponse/Request_response_performance.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Performance.RequestResponse
-{
- using System;
- using System.Threading;
- using System.Threading.Tasks;
- using AcceptanceTesting;
- using Config;
- using EndpointTemplates;
- using AcceptanceTesting.Support;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class Request_response_performance : NServiceBusPerformanceTest
- {
- [Test]
- public void With_dtc_enabled()
- {
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(b => SendMessages(b))
- .WithEndpoint()
- .Done(c => c.Complete)
- .Repeat(r => r.For(Transports.Default))
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- [Test]
- public void With_dtc_supressed()
- {
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Advanced(a => a.DisableDistributedTransactions()));
- SendMessages(b);
- })
- .WithEndpoint(b => b.CustomConfig(c => Configure.Transactions.Advanced(a => a.DisableDistributedTransactions())))
- .Done(c => c.Complete)
- .Repeat(r => r.For(Transports.Default))
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- [Test]
- public void With_no_transactions()
- {
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Disable());
- SendMessages(b);
- })
- .WithEndpoint(b => b.CustomConfig(c => Configure.Transactions.Disable()))
- .Done(c => c.Complete)
- .Repeat(r => r.For(Transports.Default))
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- [Test]
- public void With_ambient_tx_suppressed()
- {
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Advanced(a => a.DoNotWrapHandlersExecutionInATransactionScope()));
- SendMessages(b);
- })
- .WithEndpoint(b => b.CustomConfig(c => Configure.Transactions.Advanced(a => a.DoNotWrapHandlersExecutionInATransactionScope())))
- .Done(c => c.Complete)
- .Repeat(r => r.For(Transports.Default))
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- private static EndpointBehaviorBuilder SendMessages(EndpointBehaviorBuilder b)
- {
- return b.Given((bus, context) => Parallel.For(0, context.NumberOfTestMessages, (s, c) => bus.Send(new MyMessage())));
- }
-
- public class Context : PerformanceTestContext
- {
- public bool Complete { get; set; }
- }
-
- public class ClientEndpoint : EndpointConfigurationBuilder
- {
- public ClientEndpoint()
- {
- EndpointSetup()
- .WithConfig(c => c.MaximumConcurrencyLevel = MaxConcurrencyLevel)
- .AddMapping(typeof(ServerEndpoint));
- }
-
- public class MyMessageHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- static int numberOfMessagesProcessed;
-
-
- public void Handle(MyResponse messageThatIsEnlisted)
- {
- var current = Interlocked.Increment(ref numberOfMessagesProcessed);
-
- if (current == 1)
- {
- Context.FirstMessageProcessedAt = DateTime.UtcNow;
- }
-
- if (current == Context.NumberOfTestMessages)
- {
- Context.LastMessageProcessedAt = DateTime.UtcNow;
- Context.Complete = true;
- }
-
- }
- }
- }
-
- public class ServerEndpoint : EndpointConfigurationBuilder
- {
- public ServerEndpoint()
- {
- EndpointSetup()
- .WithConfig(c => c.MaximumConcurrencyLevel = MaxConcurrencyLevel);
- }
-
- public class MyMessageHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MyMessage message)
- {
- Bus.Reply(new MyResponse());
- }
- }
- }
-
- [Serializable]
- public class MyMessage : ICommand
- {
- }
-
- [Serializable]
- public class MyResponse : IMessage
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Performance/Sagas/Saga_performance.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Performance/Sagas/Saga_performance.cs
deleted file mode 100644
index 5bea7b4d3..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Performance/Sagas/Saga_performance.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Performance.Sagas
-{
- using System;
- using System.Threading;
- using System.Threading.Tasks;
- using AcceptanceTesting;
- using AcceptanceTesting.Support;
- using Config;
- using EndpointTemplates;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- public class Saga_performance : NServiceBusPerformanceTest
- {
- [Test, Ignore("Fails in build server! Not reliable")]
- public void With_dtc_enabled()
- {
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(SendTestMessages)
- .Done(c => c.Complete)
- .Repeat(r => r.For())
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- [Test, Ignore("Fails in build server! Not reliable")]
- public void With_dtc_supressed()
- {
- Scenario.Define(() => new Context { NumberOfTestMessages = NumberOfTestMessages })
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Advanced(a => a.DisableDistributedTransactions()));
- SendTestMessages(b);
- })
- .Done(c => c.Complete)
- .Repeat(r => r.For())
- .Report(DisplayTestResults)
- .MaxTestParallelism(1)
- .Run();
- }
-
- public class Context : PerformanceTestContext
- {
-
- public bool Complete { get; set; }
- }
-
- public class SagaEndpoint : EndpointConfigurationBuilder
- {
- public SagaEndpoint()
- {
- EndpointSetup()
- .WithConfig(c => c.MaximumConcurrencyLevel = MaxConcurrencyLevel);
- }
-
- public class MySaga : Saga,IAmStartedByMessages
- {
- public Context Context { get; set; }
-
- static int numberOfMessagesProcessed;
-
-
- public void Handle(MyMessage message)
- {
- Data.SomeId = message.SomeId;
-
- var current = Interlocked.Increment(ref numberOfMessagesProcessed);
-
- if (current == 1)
- {
- Context.FirstMessageProcessedAt = DateTime.UtcNow;
- }
-
- if (current == Context.NumberOfTestMessages)
- {
- Context.LastMessageProcessedAt = DateTime.UtcNow;
- Context.Complete = true;
- }
-
- }
-
- public override void ConfigureHowToFindSaga()
- {
- ConfigureMapping(m=>m.SomeId)
- .ToSaga(s=>s.SomeId);
-
- }
-
-
- public class MySagaData : IContainSagaData
- {
- public virtual Guid Id { get; set; }
- public virtual string Originator { get; set; }
- public virtual string OriginalMessageId { get; set; }
-
- [Unique]
- public virtual Guid SomeId { get; set; }
- }
-
- }
-
-
- }
-
- [Serializable]
- public class MyMessage : ICommand
- {
- public Guid SomeId { get; set; }
- }
-
-
-
- protected static void SendTestMessages(EndpointBehaviorBuilder b)
- {
- b.Given((bus, context) => Parallel.For(0, context.NumberOfTestMessages, (s, c) => bus.SendLocal(new MyMessage
- {
- SomeId = Guid.NewGuid()
- })));
- }
- }
-
-
-
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Properties/AssemblyInfo.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Properties/AssemblyInfo.cs
deleted file mode 100644
index a8d1cb232..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// General Information about an assembly is controlled through the following
-// set of attributes. Change these attribute values to modify the information
-// associated with an assembly.
-[assembly: AssemblyTitle("NServiceBus.IntegrationTests.Automated")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("NServiceBus.IntegrationTests.Automated")]
-[assembly: AssemblyCopyright("Copyright © 2013")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Setting ComVisible to false makes the types in this assembly not visible
-// to COM components. If you need to access a type in this assembly from
-// COM, set the ComVisible attribute to true on that type.
-[assembly: ComVisible(false)]
-
-// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("eebba921-499c-46ab-ac43-56aaf1af7947")]
-
-// Version information for an assembly consists of the following four values:
-//
-// Major Version
-// Minor Version
-// Build Number
-// Revision
-//
-// You can specify all the values or you can default the Build and Revision Numbers
-// by using the '*' as shown below:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/PubSubAcceptanceTest.cs b/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/PubSubAcceptanceTest.cs
deleted file mode 100644
index d14b480ec..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/PubSubAcceptanceTest.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-namespace NServiceBus.AcceptanceTests.PubSub
-{
- using System;
- using Features;
- using Unicast.Subscriptions;
- using Unicast.Subscriptions.MessageDrivenSubscriptions;
-
- [Serializable]
- public class Subscriptions
- {
- public static Action> OnEndpointSubscribed = actionToPerform =>
- {
- if (Feature.IsEnabled())
- {
- Configure.Instance.Builder.Build().ClientSubscribed +=
- (sender, args) =>
- {
- actionToPerform(args);
- };
- }
- };
-
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event.cs
deleted file mode 100644
index 0f701abe0..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event.cs
+++ /dev/null
@@ -1,115 +0,0 @@
-namespace NServiceBus.AcceptanceTests.PubSub
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using Features;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_publishing_an_event : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_be_delivered_to_allsubscribers()
- {
- Scenario.Define()
- .WithEndpoint(b =>
- b.Given((bus, context) => Subscriptions.OnEndpointSubscribed(s =>
- {
- if (s.SubscriberReturnAddress.Queue.Contains("Subscriber1"))
- context.Subscriber1Subscribed = true;
-
- if (s.SubscriberReturnAddress.Queue.Contains("Subscriber2"))
- context.Subscriber2Subscribed = true;
- }))
- .When(c => c.Subscriber1Subscribed && c.Subscriber2Subscribed, bus => bus.Publish(new MyEvent()))
- )
- .WithEndpoint(b => b.Given((bus, context) =>
- {
- bus.Subscribe();
-
- if (!Feature.IsEnabled())
- context.Subscriber1Subscribed = true;
- }))
- .WithEndpoint(b => b.Given((bus, context) =>
- {
- bus.Subscribe();
-
- if (!Feature.IsEnabled())
- context.Subscriber2Subscribed = true;
- }))
- .Done(c => c.Subscriber1GotTheEvent && c.Subscriber2GotTheEvent)
- .Repeat(r => r.For(Transports.Msmq))
- .Should(c =>
- {
- Assert.True(c.Subscriber1GotTheEvent);
- Assert.True(c.Subscriber2GotTheEvent);
- })
-
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool Subscriber1GotTheEvent { get; set; }
-
- public bool Subscriber2GotTheEvent { get; set; }
-
-
- public bool Subscriber1Subscribed { get; set; }
-
- public bool Subscriber2Subscribed { get; set; }
- }
-
- public class Publisher : EndpointConfigurationBuilder
- {
- public Publisher()
- {
- EndpointSetup();
- }
- }
-
- public class Subscriber1 : EndpointConfigurationBuilder
- {
- public Subscriber1()
- {
- EndpointSetup(c => Configure.Features.Disable())
- .AddMapping(typeof(Publisher));
- }
-
- public class MyEventHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyEvent messageThatIsEnlisted)
- {
- Context.Subscriber1GotTheEvent = true;
- }
- }
- }
-
- public class Subscriber2 : EndpointConfigurationBuilder
- {
- public Subscriber2()
- {
- EndpointSetup(c => Configure.Features.Disable())
- .AddMapping(typeof(Publisher));
- }
-
- public class MyEventHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyEvent messageThatIsEnlisted)
- {
- Context.Subscriber2GotTheEvent = true;
- }
- }
- }
-
- [Serializable]
- public class MyEvent : IEvent
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_using_a_broker_transport_with_centralized_routing.cs b/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_using_a_broker_transport_with_centralized_routing.cs
deleted file mode 100644
index 192486017..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_using_a_broker_transport_with_centralized_routing.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-namespace NServiceBus.AcceptanceTests.PubSub
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_publishing_an_event_using_a_broker_transport_with_centralized_routing : NServiceBusAcceptanceTest
- {
- [Test, Ignore("Not reliable!")]
- public void Should_be_delivered_to_allsubscribers_without_the_need_for_config()
- {
- Scenario.Define()
- .WithEndpoint(b => b.When(c => c.EndpointsStarted, (bus, context) =>
- {
- bus.Publish(new MyEvent());
- }))
- .WithEndpoint()
- .WithEndpoint()
- .Done(c => c.Subscriber1GotTheEvent && c.Subscriber2GotTheEvent)
- .Repeat(r => r.For())
- .Should(c =>
- {
- Assert.True(c.Subscriber1GotTheEvent);
- Assert.True(c.Subscriber2GotTheEvent);
- })
-
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool Subscriber1GotTheEvent { get; set; }
-
- public bool Subscriber2GotTheEvent { get; set; }
- }
-
- public class CentralizedPublisher : EndpointConfigurationBuilder
- {
- public CentralizedPublisher()
- {
- EndpointSetup();
- }
- }
-
- public class CentralizedSubscriber1 : EndpointConfigurationBuilder
- {
- public CentralizedSubscriber1()
- {
- EndpointSetup();
- }
-
- public class MyEventHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyEvent messageThatIsEnlisted)
- {
- Context.Subscriber1GotTheEvent = true;
- }
- }
- }
-
- public class CentralizedSubscriber2 : EndpointConfigurationBuilder
- {
- public CentralizedSubscriber2()
- {
- EndpointSetup();
- }
-
- public class MyEventHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyEvent messageThatIsEnlisted)
- {
- Context.Subscriber2GotTheEvent = true;
- }
- }
- }
-
- [Serializable]
- public class MyEvent : IEvent
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_with_only_local_messagehandlers.cs b/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_with_only_local_messagehandlers.cs
deleted file mode 100644
index 1f1801745..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_with_only_local_messagehandlers.cs
+++ /dev/null
@@ -1,102 +0,0 @@
-namespace NServiceBus.AcceptanceTests.PubSub
-{
- using System;
- using AcceptanceTesting;
- using EndpointTemplates;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_publishing_an_event_with_only_local_messagehandlers : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_trigger_the_catch_all_handler_for_message_driven_subscriptions()
- {
- Scenario.Define()
- .WithEndpoint(b =>
- b.Given((bus, context) => Subscriptions.OnEndpointSubscribed(s =>
- {
- context.LocalEndpointSubscribed = true;
- }))
- .When(c => c.LocalEndpointSubscribed, bus => bus.Publish(new EventHandledByLocalEndpoint()))
- )
- .Done(c => c.CatchAllHandlerGotTheMessage)
- .Repeat(r => r.For())
- .Should(c =>
- {
- Assert.True(c.CatchAllHandlerGotTheMessage);
- })
-
- .Run();
- }
-
- [Test]
- public void Should_trigger_the_catch_all_handler_for_publishers_with_centralized_pubsub()
- {
- Scenario.Define()
- .WithEndpoint(b => b.When(c => c.EndpointsStarted, (bus, context) => bus.Publish(new EventHandledByLocalEndpoint())))
- .Done(c => c.CatchAllHandlerGotTheMessage)
- .Repeat(r => r.For(Transports.ActiveMQ)) //exclude active since the support for polymorphic routing is not implemented
- .Should(c =>
- {
- Assert.True(c.CatchAllHandlerGotTheMessage);
- })
-
- .Run();
- }
-
- public class Context : ScenarioContext
- {
-
- public bool CatchAllHandlerGotTheMessage { get; set; }
-
- public bool LocalEndpointSubscribed { get; set; }
- }
-
- public class MessageDrivenPublisher : EndpointConfigurationBuilder
- {
- public MessageDrivenPublisher()
- {
- EndpointSetup()
- .AddMapping(typeof(MessageDrivenPublisher)); //an explicit mapping is needed
- }
-
- class CatchAllHandler:IHandleMessages //not enough for auto subscribe to work
- {
- public Context Context { get; set; }
- public void Handle(IEvent message)
- {
- Context.CatchAllHandlerGotTheMessage = true;
- }
- }
-
- class DummyHandler : IHandleMessages //explicit handler for the event is needed
- {
- public Context Context { get; set; }
- public void Handle(EventHandledByLocalEndpoint message)
- {
- }
- }
- }
-
- public class CentralizedStoragePublisher : EndpointConfigurationBuilder
- {
- public CentralizedStoragePublisher()
- {
- EndpointSetup(c => Configure.Features.AutoSubscribe(s => s.DoNotRequireExplicitRouting()));
- }
-
- class CatchAllHandler : IHandleMessages
- {
- public Context Context { get; set; }
- public void Handle(IEvent message)
- {
- Context.CatchAllHandlerGotTheMessage = true;
- }
- }
- }
- [Serializable]
- public class EventHandledByLocalEndpoint : IEvent
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_with_the_subscriber_scaled_out.cs b/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_with_the_subscriber_scaled_out.cs
deleted file mode 100644
index b0ce7e90b..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_publishing_an_event_with_the_subscriber_scaled_out.cs
+++ /dev/null
@@ -1,122 +0,0 @@
-namespace NServiceBus.AcceptanceTests.PubSub
-{
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using EndpointTemplates;
- using AcceptanceTesting;
- using Features;
- using NUnit.Framework;
- using ScenarioDescriptors;
- using Unicast.Subscriptions;
- using Unicast.Subscriptions.MessageDrivenSubscriptions;
-
- public class When_publishing_an_event_with_the_subscriber_scaled_out : NServiceBusAcceptanceTest
- {
- static string Server1 = "Server1";
- static string Server2 = "Server2";
-
- [Test]//https://github.com/NServiceBus/NServiceBus/issues/1101
- public void Should_only_publish_one_event()
- {
- Scenario.Define()
- .WithEndpoint(b =>
- b.Given((bus, context) => Subscriptions.OnEndpointSubscribed(s =>
- {
- if (s.SubscriberReturnAddress.Queue != "MyEndpoint")
- return;
-
- context.NumberOfSubcriptionsReceived++;
- }))
- .When(c => c.NumberOfSubcriptionsReceived >= 2, (bus, c) =>
- {
- c.SubcribersOfTheEvent = Configure.Instance.Builder.Build()
- .GetSubscriberAddressesForMessage(new[] { new MessageType(typeof(MyEvent)) }).Select(a => a.ToString()).ToList();
- })
- )
- .WithEndpoint(b => b.Given((bus, context) =>
- {
- bus.Subscribe();
-
- if (!Feature.IsEnabled())
- context.NumberOfSubcriptionsReceived++;
- }))
- .WithEndpoint(b => b.Given((bus, context) =>
- {
- bus.Subscribe();
-
- if (!Feature.IsEnabled())
- context.NumberOfSubcriptionsReceived++;
- }))
- .Done(c => c.SubcribersOfTheEvent != null)
- .Repeat(r => r.For(Transports.SqlServer)
- .For(SubscriptionStorages.Msmq))
- .Should(c =>
- {
- Assert.AreEqual(1, c.SubcribersOfTheEvent.Count(), "There should only be one logical subscriber");
- })
- .MaxTestParallelism(1)//we force the endpoint names so we can't run this is parallell
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public int NumberOfSubcriptionsReceived { get; set; }
-
- public IEnumerable SubcribersOfTheEvent { get; set; }
- }
-
- public class Publisher : EndpointConfigurationBuilder
- {
- public Publisher()
- {
- EndpointSetup();
- }
- }
-
- public class Subscriber1 : EndpointConfigurationBuilder
- {
- public Subscriber1()
- {
- EndpointSetup(c => Configure.Features.Disable())
- .AddMapping(typeof (Publisher))
- .CustomMachineName(Server1)
- .CustomEndpointName("MyEndpoint");
- }
-
- public class MyEventHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyEvent messageThatIsEnlisted)
- {
- }
- }
- }
-
- public class Subscriber2 : EndpointConfigurationBuilder
- {
- public Subscriber2()
- {
- EndpointSetup(c => Configure.Features.Disable())
- .AddMapping(typeof(Publisher))
- .CustomMachineName(Server2)
- .CustomEndpointName("MyEndpoint");
- }
-
- public class MyEventHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyEvent messageThatIsEnlisted)
- {
- }
- }
- }
-
- [Serializable]
- public class MyEvent : IEvent
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_subscribing_to_a_polymorphic_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_subscribing_to_a_polymorphic_event.cs
deleted file mode 100644
index 2d9cf6f54..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/PubSub/When_subscribing_to_a_polymorphic_event.cs
+++ /dev/null
@@ -1,124 +0,0 @@
-namespace NServiceBus.AcceptanceTests.PubSub
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using Features;
- using NUnit.Framework;
- using Unicast.Subscriptions.MessageDrivenSubscriptions;
-
- public class When_subscribing_to_a_polymorphic_event : NServiceBusAcceptanceTest
- {
- [Test]
- public void Event_should_be_delivered()
- {
- var cc = new Context();
-
- Scenario.Define(cc)
- .WithEndpoint(b => b.Given((bus, context) => EnableNotificationsOnSubscribe(context))
- .When(c => c.Subscriber1Subscribed && c.Subscriber2Subscribed, bus => bus.Publish(new MyEvent())))
- .WithEndpoint(b => b.Given((bus, context) =>
- {
- bus.Subscribe();
-
- if (!Feature.IsEnabled())
- context.Subscriber1Subscribed = true;
- }))
- .WithEndpoint(b => b.Given((bus, context) =>
- {
- bus.Subscribe();
-
- if (!Feature.IsEnabled())
- context.Subscriber2Subscribed = true;
- }))
- .Done(c => c.Subscriber1GotTheEvent && c.Subscriber2GotTheEvent)
- .Run();
-
- Assert.True(cc.Subscriber1GotTheEvent);
- Assert.True(cc.Subscriber2GotTheEvent);
- }
-
- public class Context : ScenarioContext
- {
- public bool Subscriber1GotTheEvent { get; set; }
-
- public bool Subscriber2GotTheEvent { get; set; }
-
- public int NumberOfSubscribers { get; set; }
-
- public bool Subscriber1Subscribed { get; set; }
-
- public bool Subscriber2Subscribed { get; set; }
- }
-
- public class Publisher : EndpointConfigurationBuilder
- {
- public Publisher()
- {
- EndpointSetup();
- }
- }
-
- public class Subscriber1 : EndpointConfigurationBuilder
- {
- public Subscriber1()
- {
- EndpointSetup(c=>Configure.Features.Disable())
- .AddMapping(typeof(Publisher));
- }
-
- public class MyEventHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(IMyEvent messageThatIsEnlisted)
- {
- Context.Subscriber1GotTheEvent = true;
- }
- }
- }
-
- public class Subscriber2 : EndpointConfigurationBuilder
- {
- public Subscriber2()
- {
- EndpointSetup(c => Configure.Features.Disable())
- .AddMapping(typeof(Publisher));
- }
-
- public class MyEventHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MyEvent messageThatIsEnlisted)
- {
- Context.Subscriber2GotTheEvent = true;
- }
- }
- }
- static void EnableNotificationsOnSubscribe(Context context)
- {
- if (Feature.IsEnabled())
- {
- Configure.Instance.Builder.Build().ClientSubscribed +=
- (sender, args) =>
- {
- if (args.SubscriberReturnAddress.Queue.Contains("Subscriber1"))
- context.Subscriber1Subscribed = true;
-
- if (args.SubscriberReturnAddress.Queue.Contains("Subscriber2"))
- context.Subscriber2Subscribed = true;
- };
- }
- }
-
- [Serializable]
- public class MyEvent : IMyEvent
- {
- }
-
- public interface IMyEvent : IEvent
- {
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_doing_flr_with_default_settings.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_doing_flr_with_default_settings.cs
deleted file mode 100644
index 2748a128a..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_doing_flr_with_default_settings.cs
+++ /dev/null
@@ -1,126 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Retries
-{
- using System;
- using Config;
- using Faults;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_doing_flr_with_default_settings : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_do_5_retries_by_default_with_dtc_on()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new MessageToBeRetried())))
- .Done(c => c.HandedOverToSlr || c.NumberOfTimesInvoked > 5)
- .Repeat(r => r.For())
- .Should(c => Assert.AreEqual(5, c.NumberOfTimesInvoked, "The FLR should by default retry 5 times"))
- .Run();
-
- }
-
- [Test]
- public void Should_do_5_retries_by_default_with_native_transactions()
- {
- Scenario.Define()
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Advanced(a => a.DisableDistributedTransactions()));
- b.Given(bus => bus.SendLocal(new MessageToBeRetried()));
- })
- .Done(c => c.HandedOverToSlr || c.NumberOfTimesInvoked > 5)
- .Repeat(r => r.For(Transports.Default))
- .Should(c => Assert.AreEqual(5, c.NumberOfTimesInvoked, "The FLR should by default retry 5 times"))
- .Run();
-
- }
-
- [Test]
- public void Should_not_do_any_retries_if_transactions_are_off()
- {
- Scenario.Define()
- .WithEndpoint(b =>
- {
- b.CustomConfig(c => Configure.Transactions.Disable());
- b.Given((bus, context) =>
- {
- bus.SendLocal(new MessageToBeRetried());
- bus.SendLocal(new MessageToBeRetried { SecondMessage = true });
- });
- })
- .Done(c => c.SecondMessageReceived || c.NumberOfTimesInvoked > 1)
- .Repeat(r => r.For(Transports.Default))
- .Should(c => Assert.AreEqual(1, c.NumberOfTimesInvoked, "No retries should be in use if transactions are off"))
- .Run();
-
- }
-
- public class Context : ScenarioContext
- {
- public int NumberOfTimesInvoked { get; set; }
-
- public bool HandedOverToSlr { get; set; }
-
- public bool SecondMessageReceived { get; set; }
- }
-
- public class RetryEndpoint : EndpointConfigurationBuilder
- {
- public RetryEndpoint()
- {
- EndpointSetup(
- c => c.Configurer.ConfigureComponent(DependencyLifecycle.SingleInstance))
- .WithConfig(c => c.MaximumConcurrencyLevel = 1);
- }
-
- class CustomFaultManager : IManageMessageFailures
- {
- public Context Context { get; set; }
-
- public void SerializationFailedForMessage(TransportMessage message, Exception e)
- {
-
- }
-
- public void ProcessingAlwaysFailsForMessage(TransportMessage message, Exception e)
- {
- Context.HandedOverToSlr = true;
- }
-
- public void Init(Address address)
- {
-
- }
- }
-
- class MessageToBeRetriedHandler : IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(MessageToBeRetried message)
- {
- if (message.SecondMessage)
- {
- Context.SecondMessageReceived = true;
- return;
- }
-
- Context.NumberOfTimesInvoked++;
-
- throw new Exception("Simulated exception");
- }
- }
- }
-
- [Serializable]
- public class MessageToBeRetried : IMessage
- {
- public bool SecondMessage { get; set; }
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_message_fails_with_retries_set_to_0.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_message_fails_with_retries_set_to_0.cs
deleted file mode 100644
index af1a81736..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_message_fails_with_retries_set_to_0.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Retries
-{
- using System;
- using System.Collections.Generic;
- using Config;
- using Faults;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
-
- public class When_message_fails_with_retries_set_to_0 : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_not_retry_the_message()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new MessageToBeRetried())))
- .Done(c => c.HandedOverToSlr)
- .Run();
-
- Assert.AreEqual(1, context.NumberOfTimesInvoked,"No FLR should be in use if MaxRetries is set to 0");
- Assert.AreEqual(Environment.MachineName, context.HeadersOfTheFailedMessage[Headers.ProcessingMachine], "The receiver should attach the machine name as a header");
- Assert.True(context.HeadersOfTheFailedMessage[Headers.ProcessingEndpoint].Contains("RetryEndpoint"), "The receiver should attach its endpoint name as a header");
- }
-
- public class Context : ScenarioContext
- {
- public int NumberOfTimesInvoked { get; set; }
-
- public bool HandedOverToSlr { get; set; }
-
- public Dictionary HeadersOfTheFailedMessage { get; set; }
- }
-
- public class RetryEndpoint : EndpointConfigurationBuilder
- {
- public RetryEndpoint()
- {
- EndpointSetup(c => c.Configurer.ConfigureComponent(DependencyLifecycle.SingleInstance))
- .WithConfig(c =>
- {
- c.MaxRetries = 0;
- });
- }
-
- class CustomFaultManager: IManageMessageFailures
- {
- public Context Context { get; set; }
-
- public void SerializationFailedForMessage(TransportMessage message, Exception e)
- {
-
- }
-
- public void ProcessingAlwaysFailsForMessage(TransportMessage message, Exception e)
- {
- Context.HandedOverToSlr = true;
- Context.HeadersOfTheFailedMessage = message.Headers;
- }
-
- public void Init(Address address)
- {
-
- }
- }
-
- class MessageToBeRetriedHandler:IHandleMessages
- {
- public Context Context { get; set; }
- public void Handle(MessageToBeRetried message)
- {
- Context.NumberOfTimesInvoked++;
- throw new Exception("Simulated exception");
- }
- }
- }
-
- [Serializable]
- public class MessageToBeRetried : IMessage
- {
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_messages_fails_flr.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_messages_fails_flr.cs
deleted file mode 100644
index cad977568..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_messages_fails_flr.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Retries
-{
- using System;
- using Config;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using ScenarioDescriptors;
-
- public class When_messages_fails_flr : NServiceBusAcceptanceTest
- {
- static TimeSpan SlrDelay = TimeSpan.FromSeconds(5);
-
- [Test]
- public void Should_be_moved_to_slr()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new MessageToBeRetried())))
- .Done(c => c.NumberOfTimesInvoked >= 2)
- .Repeat(r => r.For(Transports.Default))
- .Should(context =>
- {
- Assert.GreaterOrEqual(1,context.NumberOfSlrRetriesPerformed, "The SLR should only do one retry");
- Assert.GreaterOrEqual(context.TimeOfSecondAttempt - context.TimeOfFirstAttempt,SlrDelay , "The SLR should delay the retry");
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public int NumberOfTimesInvoked { get; set; }
-
- public DateTime TimeOfFirstAttempt { get; set; }
- public DateTime TimeOfSecondAttempt { get; set; }
-
- public int NumberOfSlrRetriesPerformed { get; set; }
- }
-
- public class SLREndpoint : EndpointConfigurationBuilder
- {
- public SLREndpoint()
- {
- EndpointSetup()
- .WithConfig(c =>
- {
- c.MaxRetries = 0; //to skip the FLR
- })
- .WithConfig(c =>
- {
- c.NumberOfRetries = 1;
- c.TimeIncrease = SlrDelay;
- });
- }
-
-
- class MessageToBeRetriedHandler:IHandleMessages
- {
- public Context Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(MessageToBeRetried message)
- {
- Context.NumberOfTimesInvoked++;
-
- if (Context.NumberOfTimesInvoked == 1)
- Context.TimeOfFirstAttempt = DateTime.UtcNow;
-
- if (Context.NumberOfTimesInvoked == 2)
- {
- Context.TimeOfSecondAttempt = DateTime.UtcNow;
- }
-
- Context.NumberOfSlrRetriesPerformed = int.Parse(Bus.CurrentMessageContext.Headers[Headers.Retries]);
-
- throw new Exception("Simulated exception");
- }
- }
- }
-
- [Serializable]
- public class MessageToBeRetried : IMessage
- {
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_sending_a_message_off_to_slr.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_sending_a_message_off_to_slr.cs
deleted file mode 100644
index dd8cb31e0..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Retries/When_sending_a_message_off_to_slr.cs
+++ /dev/null
@@ -1,145 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Retries
-{
- using System;
- using System.Linq;
- using Config;
- using Faults;
- using EndpointTemplates;
- using AcceptanceTesting;
- using MessageMutator;
- using NUnit.Framework;
-
-#pragma warning disable 612, 618
-
- public class When_sending_a_message_off_to_slr : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_preserve_the_original_body_for_regular_exceptions()
- {
- var context = new Context();
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new MessageToBeRetried())))
- .Done(c => c.SlrChecksum != default(byte))
- .Run();
-
- Assert.AreEqual(context.OriginalBodyChecksum, context.SlrChecksum, "The body of the message sent to slr should be the same as the original message coming off the queue");
-
- }
- [Test]
- public void Should_preserve_the_original_body_for_serialization_exceptions()
- {
- var context = new Context
- {
- SimulateSerializationException = true
- };
-
- Scenario.Define(context)
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new MessageToBeRetried())))
- .Done(c => c.SlrChecksum != default(byte))
- .Run();
-
- Assert.AreEqual(context.OriginalBodyChecksum, context.SlrChecksum, "The body of the message sent to slr should be the same as the original message coming off the queue");
-
- }
-
- public class Context : ScenarioContext
- {
- public byte OriginalBodyChecksum { get; set; }
-
- public byte SlrChecksum { get; set; }
-
- public bool SimulateSerializationException { get; set; }
- }
-
- public class RetryEndpoint : EndpointConfigurationBuilder
- {
- public RetryEndpoint()
- {
- EndpointSetup(c => c.Configurer.ConfigureComponent(DependencyLifecycle.SingleInstance))
- .WithConfig(c =>
- {
- c.MaxRetries = 0;
- });
- }
-
- class BodyMutator : IMutateTransportMessages, NServiceBus.INeedInitialization
- {
- public Context Context { get; set; }
-
- public void MutateIncoming(TransportMessage transportMessage)
- {
-
- var originalBody = transportMessage.Body;
-
- Context.OriginalBodyChecksum = Checksum(originalBody);
-
- var decryptedBody = new byte[originalBody.Length];
-
- Buffer.BlockCopy(originalBody,0,decryptedBody,0,originalBody.Length);
-
- //decrypt
- decryptedBody[0]++;
-
- if (Context.SimulateSerializationException)
- decryptedBody[1]++;
-
- transportMessage.Body = decryptedBody;
- }
-
-
- public void MutateOutgoing(object[] messages, TransportMessage transportMessage)
- {
- transportMessage.Body[0]--;
- }
-
- public void Init()
- {
- Configure.Component(DependencyLifecycle.InstancePerCall);
- }
- }
-
- class CustomFaultManager : IManageMessageFailures
- {
- public Context Context { get; set; }
-
- public void SerializationFailedForMessage(TransportMessage message, Exception e)
- {
- Context.SlrChecksum = RetryEndpoint.Checksum(message.Body);
- }
-
- public void ProcessingAlwaysFailsForMessage(TransportMessage message, Exception e)
- {
- Context.SlrChecksum = RetryEndpoint.Checksum(message.Body);
- }
-
- public void Init(Address address)
- {
-
- }
- }
-
- class MessageToBeRetriedHandler : IHandleMessages
- {
- public void Handle(MessageToBeRetried message)
- {
- throw new Exception("Simulated exception");
- }
- }
-
- public static byte Checksum(byte[] data)
- {
- var longSum = data.Sum(x => (long)x);
- return unchecked((byte)longSum);
- }
- }
-
- [Serializable]
- public class MessageToBeRetried : IMessage
- {
- }
- }
-
-#pragma warning restore 612, 618
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_a_saga_is_started_by_an_event_published_by_another_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_a_saga_is_started_by_an_event_published_by_another_saga.cs
deleted file mode 100644
index 8a602e61f..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_a_saga_is_started_by_an_event_published_by_another_saga.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using Features;
- using NUnit.Framework;
- using PubSub;
- using Saga;
- using ScenarioDescriptors;
-
- //Repro for #1323
- public class When_a_saga_is_started_by_an_event_published_by_another_saga : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_start_the_saga_and_request_a_timeout()
- {
- Scenario.Define()
- .WithEndpoint(b =>
- b.Given(
- (bus, context) =>
- Subscriptions.OnEndpointSubscribed(s =>
- {
- if (s.SubscriberReturnAddress.Queue.Contains("SagaThatIsStartedByTheEvent"))
- {
- context.IsEventSubscriptionReceived = true;
- }
- }))
- .When(c => c.IsEventSubscriptionReceived,
- bus =>
- bus.SendLocal(new StartSaga {DataId = Guid.NewGuid()}))
- )
- .WithEndpoint(
- b => b.Given((bus, context) => bus.Subscribe()))
-
- .Done(c => c.DidSaga1Complete && c.DidSaga2Complete)
- .Repeat(r => r.For(Transports.Default))
- .Should(c => Assert.True(c.DidSaga1Complete && c.DidSaga2Complete))
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool DidSaga1Complete { get; set; }
- public bool DidSaga2Complete { get; set; }
- public bool IsEventSubscriptionReceived { get; set; }
- }
-
- public class SagaThatPublishesAnEvent : EndpointConfigurationBuilder
- {
- public SagaThatPublishesAnEvent()
- {
- EndpointSetup(c => Configure.Features.Disable());
- }
-
- public class Saga1 : Saga, IAmStartedByMessages, IHandleTimeouts
- {
- public Context Context { get; set; }
-
- public void Handle(StartSaga message)
- {
- Data.DataId = message.DataId;
-
- //Publish the event, which will start the second saga
- Bus.Publish(m => { m.DataId = message.DataId; });
-
- //Request a timeout
- RequestTimeout(TimeSpan.FromSeconds(5));
- }
-
- public void Timeout(Timeout1 state)
- {
- MarkAsComplete();
- Context.DidSaga1Complete = true;
- }
-
- public class Saga1Data : ContainSagaData
- {
- [Unique]
- public Guid DataId { get; set; }
- }
-
- public class Timeout1
- {
- }
- }
- }
-
- public class SagaThatIsStartedByTheEvent : EndpointConfigurationBuilder
- {
- public SagaThatIsStartedByTheEvent()
- {
- EndpointSetup(c => Configure.Features.Disable())
- .AddMapping(typeof(SagaThatPublishesAnEvent));
-
- }
-
- public class Saga2 : Saga, IAmStartedByMessages, IHandleTimeouts
- {
- public Context Context { get; set; }
-
- public void Handle(SomethingHappenedEvent message)
- {
- Data.DataId = message.DataId;
-
- //Request a timeout
- RequestTimeout(TimeSpan.FromSeconds(5));
- }
-
- public void Timeout(Saga2Timeout state)
- {
- MarkAsComplete();
- Context.DidSaga2Complete = true;
- }
-
- public class Saga2Data : ContainSagaData
- {
- [Unique]
- public Guid DataId { get; set; }
- }
-
- public class Saga2Timeout
- {
- }
- }
- }
-
- [Serializable]
- public class StartSaga : ICommand
- {
- public Guid DataId { get; set; }
- }
-
- public interface SomethingHappenedEvent : IEvent
- {
- Guid DataId { get; set; }
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_a_saga_message_goes_through_the_slr.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_a_saga_message_goes_through_the_slr.cs
deleted file mode 100644
index 3246e79c5..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_a_saga_message_goes_through_the_slr.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- //repro for issue: https://github.com/NServiceBus/NServiceBus/issues/1020
- public class When_a_saga_message_goes_through_the_slr : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_invoke_the_correct_handle_methods_on_the_saga()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new StartSagaMessage { SomeId = Guid.NewGuid() })))
- .Done(c => c.SecondMessageProcessed)
- .Repeat(r => r.For(Transports.Default))
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool SecondMessageProcessed { get; set; }
-
-
- public int NumberOfTimesInvoked { get; set; }
- }
-
- public class SagaEndpoint : EndpointConfigurationBuilder
- {
- public SagaEndpoint()
- {
- EndpointSetup();
- }
-
- public class TestSaga : Saga, IAmStartedByMessages,IHandleMessages
- {
- public Context Context { get; set; }
- public void Handle(StartSagaMessage message)
- {
- Data.SomeId = message.SomeId;
-
- Bus.SendLocal(new SecondSagaMessage
- {
- SomeId = Data.SomeId
- });
- }
-
- public override void ConfigureHowToFindSaga()
- {
- ConfigureMapping(m=>m.SomeId)
- .ToSaga(s=>s.SomeId);
- ConfigureMapping(m => m.SomeId)
- .ToSaga(s => s.SomeId);
- }
-
- public void Handle(SecondSagaMessage message)
- {
- Context.NumberOfTimesInvoked++;
- var shouldFail = Context.NumberOfTimesInvoked < 2; //1 FLR and 1 SLR
-
- if(shouldFail)
- throw new Exception("Simulated exception");
-
- Context.SecondMessageProcessed = true;
- }
- }
-
- public class TestSagaData : IContainSagaData
- {
- public Guid Id { get; set; }
- public string Originator { get; set; }
- public string OriginalMessageId { get; set; }
- public Guid SomeId { get; set; }
- }
- }
-
- [Serializable]
- public class StartSagaMessage : ICommand
- {
- public Guid SomeId { get; set; }
- }
- public class SecondSagaMessage : ICommand
- {
- public Guid SomeId { get; set; }
- }
-
- public class SomeTimeout
- {
- }
- }
-
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_an_endpoint_replies_to_a_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_an_endpoint_replies_to_a_saga.cs
deleted file mode 100644
index 7a3fef8d5..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_an_endpoint_replies_to_a_saga.cs
+++ /dev/null
@@ -1,111 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- // Repro for issue https://github.com/NServiceBus/NServiceBus/issues/1277 to test the fix
- // making sure that the saga correlation still works.
- public class When_an_endpoint_replies_to_a_saga : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_correlate_all_saga_messages_properly()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new StartSaga { DataId = Guid.NewGuid() })))
- .WithEndpoint()
- .Done(c => c.DidSagaReplyMessageGetCorrelated)
- .Repeat(r => r.For(Transports.Default))
- .Should(c =>
- {
- Assert.True(c.DidSagaReplyMessageGetCorrelated);
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool DidSagaReplyMessageGetCorrelated { get; set; }
- }
-
- public class EndpointThatHandlesAMessageFromSagaAndReplies : EndpointConfigurationBuilder
- {
- public EndpointThatHandlesAMessageFromSagaAndReplies()
- {
- EndpointSetup();
- }
-
- class DoSomethingHandler : IHandleMessages
- {
- public IBus Bus { get; set; }
-
- public void Handle(DoSomething message)
- {
- Console.WriteLine("Received DoSomething command for DataId:{0} ... and responding with a reply", message.DataId);
- Bus.Reply(new DoSomethingResponse { DataId = message.DataId });
- }
- }
- }
-
- public class EndpointThatHostsASaga : EndpointConfigurationBuilder
- {
- public EndpointThatHostsASaga()
- {
- EndpointSetup()
- .AddMapping(typeof (EndpointThatHandlesAMessageFromSagaAndReplies));
-
- }
-
- public class Saga2 : Saga, IAmStartedByMessages, IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(StartSaga message)
- {
- var dataId = Guid.NewGuid();
- Console.Out.WriteLine("Saga2 sending DoSomething for DataId: {0}", dataId);
- Data.DataId = dataId;
- Bus.Send(new DoSomething { DataId = dataId });
- }
-
- public void Handle(DoSomethingResponse message)
- {
- Context.DidSagaReplyMessageGetCorrelated = message.DataId == Data.DataId;
- Console.Out.WriteLine("Saga received DoSomethingResponse for DataId: {0} and MarkAsComplete", message.DataId);
- MarkAsComplete();
- }
-
- public override void ConfigureHowToFindSaga()
- {
- ConfigureMapping(m => m.DataId).ToSaga(s => s.DataId);
- }
-
- public class MySaga2Data : ContainSagaData
- {
- [Unique]
- public Guid DataId { get; set; }
- }
- }
- }
-
-
- [Serializable]
- public class StartSaga : ICommand
- {
- public Guid DataId { get; set; }
- }
-
- public class DoSomething : ICommand
- {
- public Guid DataId { get; set; }
- }
-
- public class DoSomethingResponse : IMessage
- {
- public Guid DataId { get; set; }
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_doing_request_response_between_sagas.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_doing_request_response_between_sagas.cs
deleted file mode 100644
index 8dea767a4..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_doing_request_response_between_sagas.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- public class When_doing_request_response_between_sagas : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_autocorrelate_the_response_back_to_the_requesting_saga()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new InitiateRequestingSaga { DataId = Guid.NewGuid() })))
- .Done(c => c.DidRequestingSagaGetTheResponse)
- .Repeat(r => r.For(Transports.Default))
- .Should(c => Assert.True(c.DidRequestingSagaGetTheResponse))
- .Run(TimeSpan.FromSeconds(20));
- }
-
- public class Context : ScenarioContext
- {
- public bool DidRequestingSagaGetTheResponse { get; set; }
- }
-
- public class Endpoint : EndpointConfigurationBuilder
- {
-
- public Endpoint()
- {
- EndpointSetup();
- }
-
- public class RequestingSaga : Saga,
- IAmStartedByMessages,
- IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(InitiateRequestingSaga message)
- {
- Data.DataId = message.DataId;
- Bus.SendLocal(new RequestToRespondingSaga());
- }
-
- public void Handle(ResponseFromOtherSaga message)
- {
- Context.DidRequestingSagaGetTheResponse = true;
- MarkAsComplete();
- }
-
- public override void ConfigureHowToFindSaga()
- {
- ConfigureMapping(m => m.DataId).ToSaga(s => s.DataId);
- }
- public class RequestingSagaData : ContainSagaData
- {
- [Unique]
- public Guid DataId { get; set; }
- }
- }
-
-
-
-
- public class RespondingSaga : Saga,
- IAmStartedByMessages
- {
- public Context Context { get; set; }
-
- public void Handle(RequestToRespondingSaga message)
- {
- Bus.Reply(new ResponseFromOtherSaga());
- }
-
- public override void ConfigureHowToFindSaga()
- {
- }
-
- public class RespondingSagaData : ContainSagaData
- {
- [Unique]
- public Guid DataId { get; set; }
- }
- }
- }
-
- [Serializable]
- public class InitiateRequestingSaga : ICommand
- {
- public Guid DataId { get; set; }
- }
-
-
- [Serializable]
- public class RequestToRespondingSaga : ICommand
- {
- }
-
- [Serializable]
- public class ResponseFromOtherSaga : IMessage
- {
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_is_mapped_to_an_existing_saga_instance.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_is_mapped_to_an_existing_saga_instance.cs
deleted file mode 100644
index 5e2ee84df..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_is_mapped_to_an_existing_saga_instance.cs
+++ /dev/null
@@ -1,97 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using SagaPersisters.NHibernate.AutoPersistence.Attributes;
- using ScenarioDescriptors;
-
- public class When_receiving_a_message_that_is_mapped_to_an_existing_saga_instance : NServiceBusAcceptanceTest
- {
- static Guid IdThatSagaIsCorrelatedOn = Guid.NewGuid();
-
- [Test]
- public void Should_hydrate_and_invoke_the_existing_instance()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus =>
- {
- bus.SendLocal(new StartSagaMessage { SomeId = IdThatSagaIsCorrelatedOn });
- bus.SendLocal(new StartSagaMessage { SomeId = IdThatSagaIsCorrelatedOn, SecondMessage = true });
- }))
- .Done(c => c.SecondMessageReceived)
- .Repeat(r => r.For())
- .Should(c =>
- {
- Assert.AreEqual(c.FirstSagaInstance, c.SecondSagaInstance, "The same saga instance should be invoked invoked for both messages");
- })
-
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool SecondMessageReceived { get; set; }
-
- public Guid FirstSagaInstance { get; set; }
- public Guid SecondSagaInstance { get; set; }
- }
-
- public class SagaEndpoint : EndpointConfigurationBuilder
- {
- public SagaEndpoint()
- {
- EndpointSetup(c=>Configure.Transactions.Advanced(a =>
- {
- a.DoNotWrapHandlersExecutionInATransactionScope();
- }));
- }
-
- public class TestSaga : Saga, IAmStartedByMessages
- {
- public Context Context { get; set; }
- public void Handle(StartSagaMessage message)
- {
- Data.SomeId = message.SomeId;
-
- if (message.SecondMessage)
- {
- Context.SecondSagaInstance = Data.Id;
- Context.SecondMessageReceived = true;
- }
- else
- {
- Context.FirstSagaInstance = Data.Id;
- }
- }
-
- public override void ConfigureHowToFindSaga()
- {
- ConfigureMapping(m=>m.SomeId)
- .ToSaga(s=>s.SomeId);
- }
- }
-
- [TableName("SagaEndpointTestSagaData")]
- public class TestSagaData : IContainSagaData
- {
- public virtual Guid Id { get; set; }
- public virtual string Originator { get; set; }
- public virtual string OriginalMessageId { get; set; }
-
- [Unique]
- public virtual Guid SomeId { get; set; }
- }
- }
-
- [Serializable]
- public class StartSagaMessage : ICommand
- {
- public Guid SomeId { get; set; }
-
- public bool SecondMessage { get; set; }
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_should_complete_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_should_complete_saga.cs
deleted file mode 100644
index 88fa76a1f..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_should_complete_saga.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- public class When_receiving_a_message_that_completes_the_saga : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_hydrate_and_complete_the_existing_instance()
- {
- Scenario.Define(() => new Context { Id = Guid.NewGuid() })
- .WithEndpoint(b =>
- {
- b.Given((bus, context) => bus.SendLocal(new StartSagaMessage {SomeId = context.Id}));
- b.When(context => context.StartSagaMessageReceived, (bus, context) => bus.SendLocal(new CompleteSagaMessage { SomeId = context.Id }));
- })
- .Done(c => c.SagaCompleted)
- .Repeat(r => r.For(Transports.Default))
- .Should(c =>
- {
- Assert.IsNull(c.UnhandledException);
- })
-
- .Run();
- }
-
- [Test]
- public void Should_ignore_messages_afterwards()
- {
- Scenario.Define(() => new Context {Id = Guid.NewGuid()})
- .WithEndpoint(b =>
- {
- b.Given((bus, context) => bus.SendLocal(new StartSagaMessage { SomeId = context.Id }));
- b.When(context => context.StartSagaMessageReceived, (bus, context) => bus.SendLocal(new CompleteSagaMessage { SomeId = context.Id }));
- b.When(context => context.SagaCompleted, (bus, context) => bus.SendLocal(new AnotherMessage { SomeId = context.Id }));
- })
- .Done(c => c.AnotherMessageReceived)
- .Repeat(r => r.For(Transports.Default))
- .Should(c =>
- {
- Assert.IsNull(c.UnhandledException);
- Assert.False(c.SagaReceivedAnotherMessage,"AnotherMessage should not be delivered to the saga after completion");
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public Exception UnhandledException { get; set; }
- public Guid Id { get; set; }
-
- public bool StartSagaMessageReceived { get; set; }
-
- public bool SagaCompleted { get; set; }
-
- public bool AnotherMessageReceived { get; set; }
- public bool SagaReceivedAnotherMessage { get; set; }
- }
-
- public class SagaEndpoint : EndpointConfigurationBuilder
- {
- public SagaEndpoint()
- {
- EndpointSetup(
- c => c.RavenSagaPersister().UnicastBus().LoadMessageHandlers>());
- }
-
-
-
- public class TestSaga : Saga, IAmStartedByMessages, IHandleMessages, IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(StartSagaMessage message)
- {
- Data.SomeId = message.SomeId;
-
- Context.StartSagaMessageReceived = true;
- }
-
- public override void ConfigureHowToFindSaga()
- {
- ConfigureMapping(m=>m.SomeId)
- .ToSaga(s=>s.SomeId);
- ConfigureMapping(m => m.SomeId)
- .ToSaga(s => s.SomeId);
- ConfigureMapping(m => m.SomeId)
- .ToSaga(s => s.SomeId);
- }
-
- public void Handle(CompleteSagaMessage message)
- {
- MarkAsComplete();
- Context.SagaCompleted = true;
- }
-
- public void Handle(AnotherMessage message)
- {
- Context.SagaReceivedAnotherMessage = true;
- }
- }
-
- public class TestSagaData : IContainSagaData
- {
- public Guid Id { get; set; }
- public string Originator { get; set; }
- public string OriginalMessageId { get; set; }
- [Unique]
- public Guid SomeId { get; set; }
- }
- }
-
- public class CompletionHandler : IHandleMessages
- {
- public Context Context { get; set; }
- public void Handle(AnotherMessage message)
- {
- Context.AnotherMessageReceived = true;
- }
- }
-
- [Serializable]
- public class StartSagaMessage : ICommand
- {
- public Guid SomeId { get; set; }
- }
-
- [Serializable]
- public class CompleteSagaMessage : ICommand
- {
- public Guid SomeId { get; set; }
- }
-
- [Serializable]
- public class AnotherMessage : ICommand
- {
- public Guid SomeId { get; set; }
- }
- }
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_should_start_a_saga.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_should_start_a_saga.cs
deleted file mode 100644
index fb43ab762..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_receiving_a_message_that_should_start_a_saga.cs
+++ /dev/null
@@ -1,101 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- public class When_receiving_a_message_that_should_start_a_saga : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_start_the_saga_and_call_all_messagehandlers_for_the_given_message()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new StartSagaMessage())))
- .Done(context => context.InterceptingHandlerCalled && context.SagaStarted)
- .Repeat(r => r.For())
- .Should(c =>
- {
- Assert.True(c.InterceptingHandlerCalled, "The message handler should be called");
- Assert.True(c.SagaStarted, "The saga should have been started");
- })
- .Run();
- }
-
-
- [Test]
- public void Should_not_start_saga_if_a_interception_handler_has_been_invoked()
- {
- Scenario.Define(() => new SagaEndpointContext{InterceptSaga = true})
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new StartSagaMessage())))
- .Done(context => context.InterceptingHandlerCalled)
- .Repeat(r => r.For())
- .Should(c =>
- {
- Assert.True(c.InterceptingHandlerCalled, "The intercepting handler should be called");
- Assert.False(c.SagaStarted, "The saga should not have been started since the intercepting handler stops the pipeline");
- })
- .Run();
- }
-
-
- public class SagaEndpointContext : ScenarioContext
- {
- public bool InterceptingHandlerCalled { get; set; }
-
- public bool SagaStarted { get; set; }
-
- public bool InterceptSaga { get; set; }
- }
-
-
- public class SagaEndpoint : EndpointConfigurationBuilder
- {
- public SagaEndpoint()
- {
- EndpointSetup(c =>c.UnicastBus().LoadMessageHandlers>());
- }
-
- public class TestSaga : Saga, IAmStartedByMessages
- {
- public SagaEndpointContext Context { get; set; }
- public void Handle(StartSagaMessage message)
- {
- Context.SagaStarted = true;
- }
- }
-
- public class TestSagaData : IContainSagaData
- {
- public Guid Id { get; set; }
- public string Originator { get; set; }
- public string OriginalMessageId { get; set; }
- }
-
- public class InterceptingHandler : IHandleMessages
- {
- public SagaEndpointContext Context { get; set; }
-
- public IBus Bus { get; set; }
-
- public void Handle(StartSagaMessage message)
- {
- Context.InterceptingHandlerCalled = true;
-
- if(Context.InterceptSaga)
- Bus.DoNotContinueDispatchingCurrentMessageToHandlers();
- }
- }
- }
-
- [Serializable]
- public class StartSagaMessage : ICommand
- {
- }
-
-
- }
-
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_sending_from_a_saga_handle.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_sending_from_a_saga_handle.cs
deleted file mode 100644
index ae27b2646..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_sending_from_a_saga_handle.cs
+++ /dev/null
@@ -1,105 +0,0 @@
-
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- public class When_sending_from_a_saga_handle : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_match_different_saga()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new StartSaga1 { DataId = Guid.NewGuid() })))
- .Done(c => c.DidSaga2ReceiveMessage)
- .Repeat(r => r.For(Transports.Default))
- .Should(c => Assert.True(c.DidSaga2ReceiveMessage))
- .Run(TimeSpan.FromSeconds(20));
- }
-
- public class Context : ScenarioContext
- {
- public bool DidSaga2ReceiveMessage { get; set; }
- }
-
- public class Endpoint : EndpointConfigurationBuilder
- {
-
- public Endpoint()
- {
- EndpointSetup();
- }
-
- public class Saga1 : Saga, IAmStartedByMessages, IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(StartSaga1 message)
- {
- var dataId = Guid.NewGuid();
- Data.DataId = dataId;
- Bus.SendLocal(new MessageSaga1WillHandle
- {
- DataId = dataId
- });
- }
-
- public void Handle(MessageSaga1WillHandle message)
- {
- Bus.SendLocal(new StartSaga2());
- MarkAsComplete();
- }
-
- public override void ConfigureHowToFindSaga()
- {
- ConfigureMapping(m => m.DataId).ToSaga(s => s.DataId);
- ConfigureMapping(m => m.DataId).ToSaga(s => s.DataId);
- }
-
- }
-
- public class Saga1Data : ContainSagaData
- {
- [Unique]
- public Guid DataId { get; set; }
- }
-
-
- public class Saga2 : Saga, IAmStartedByMessages
- {
- public Context Context { get; set; }
-
- public void Handle(StartSaga2 message)
- {
- Context.DidSaga2ReceiveMessage = true;
- }
-
- }
-
- public class Saga2Data : ContainSagaData
- {
- }
- }
-
-
- [Serializable]
- public class StartSaga1 : ICommand
- {
- public Guid DataId { get; set; }
- }
-
-
- [Serializable]
- public class StartSaga2 : ICommand
- {
- }
- public class MessageSaga1WillHandle : IMessage
- {
- public Guid DataId { get; set; }
- }
- }
-}
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_sending_from_a_saga_timeout.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_sending_from_a_saga_timeout.cs
deleted file mode 100644
index e701e76df..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_sending_from_a_saga_timeout.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- public class When_sending_from_a_saga_timeout : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_match_different_saga()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new StartSaga1())))
- .Done(c => c.DidSaga2ReceiveMessage)
- .Repeat(r => r.For(Transports.Default))
- .Should(c => Assert.True(c.DidSaga2ReceiveMessage))
- .Run(TimeSpan.FromSeconds(20));
- }
-
- public class Context : ScenarioContext
- {
- public bool DidSaga2ReceiveMessage { get; set; }
- }
-
- public class Endpoint : EndpointConfigurationBuilder
- {
-
- public Endpoint()
- {
- EndpointSetup();
- }
-
- public class Saga1 : Saga, IAmStartedByMessages, IHandleTimeouts
- {
- public Context Context { get; set; }
-
- public void Handle(StartSaga1 message)
- {
- RequestTimeout(TimeSpan.FromSeconds(1), new Saga1Timeout());
- }
-
- public void Timeout(Saga1Timeout state)
- {
- Bus.SendLocal(new StartSaga2());
- MarkAsComplete();
- }
- }
-
- public class Saga1Data : ContainSagaData
- {
- }
- public class Saga2 : Saga, IAmStartedByMessages
- {
- public Context Context { get; set; }
-
- public void Handle(StartSaga2 message)
- {
- Context.DidSaga2ReceiveMessage = true;
- }
-
- }
-
- public class Saga2Data : ContainSagaData
- {
- }
- }
-
-
- [Serializable]
- public class StartSaga1 : ICommand
- {
- }
-
- [Serializable]
- public class StartSaga2 : ICommand
- {
- }
-
- public class Saga1Timeout : IMessage
- {
- }
- }
-
-}
\ No newline at end of file
diff --git a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_two_sagas_subscribe_to_the_same_event.cs b/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_two_sagas_subscribe_to_the_same_event.cs
deleted file mode 100644
index 2e8b28a70..000000000
--- a/src/NServiceBus.SqlServer.AcceptanceTests/Sagas/When_two_sagas_subscribe_to_the_same_event.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-
-namespace NServiceBus.AcceptanceTests.Sagas
-{
- using System;
- using EndpointTemplates;
- using AcceptanceTesting;
- using NUnit.Framework;
- using Saga;
- using ScenarioDescriptors;
-
- // Repro for issue https://github.com/NServiceBus/NServiceBus/issues/1277
- public class When_two_sagas_subscribe_to_the_same_event : NServiceBusAcceptanceTest
- {
- [Test]
- public void Should_invoke_all_handlers_on_all_sagas()
- {
- Scenario.Define()
- .WithEndpoint(b => b.Given(bus => bus.SendLocal(new StartSaga2 { DataId = Guid.NewGuid() })))
- .WithEndpoint()
- .Done(c => c.DidSaga1EventHandlerGetInvoked && c.DidSaga2EventHandlerGetInvoked)
- .Repeat(r => r.For(Transports.Default))
- .Should(c =>
- {
- Assert.True(c.DidSaga1EventHandlerGetInvoked && c.DidSaga2EventHandlerGetInvoked);
- })
- .Run();
- }
-
- public class Context : ScenarioContext
- {
- public bool DidSaga1EventHandlerGetInvoked { get; set; }
- public bool DidSaga2EventHandlerGetInvoked { get; set; }
- }
-
- public class EndpointThatHandlesAMessageAndPublishesEvent : EndpointConfigurationBuilder
- {
- public EndpointThatHandlesAMessageAndPublishesEvent()
- {
- EndpointSetup();
- }
-
- class OpenGroupCommandHandler : IHandleMessages
- {
- public IBus Bus { get; set; }
-
- public void Handle(OpenGroupCommand message)
- {
- Console.WriteLine("Received OpenGroupCommand for DataId:{0} ... and publishing GroupPendingEvent", message.DataId);
- Bus.Publish(new GroupPendingEvent { DataId = message.DataId });
- }
- }
- }
-
- public class EndpointThatHostsTwoSagas : EndpointConfigurationBuilder
- {
- public EndpointThatHostsTwoSagas()
- {
- EndpointSetup()
- .AddMapping(typeof(EndpointThatHandlesAMessageAndPublishesEvent))
- .AddMapping(typeof(EndpointThatHandlesAMessageAndPublishesEvent));
- }
-
- public class Saga1 : Saga, IAmStartedByMessages, IHandleMessages
- {
- public Context Context { get; set; }
-
- public void Handle(GroupPendingEvent message)
- {
- Data.DataId = message.DataId;
- Console.Out.WriteLine("Saga1 received GroupPendingEvent for DataId: {0}", message.DataId);
- Context.DidSaga1EventHandlerGetInvoked = true;
- Bus.SendLocal(new CompleteSaga1Start { DataId = message.DataId });
- }
-
- public void Handle(CompleteSaga1Now message)
- {
- Console.Out.WriteLine("Saga1 received CompleteSaga1Now for DataId:{0} and MarkAsComplete", message.DataId);
-
- MarkAsComplete();
- }
-
- public override void ConfigureHowToFindSaga()
- {
- ConfigureMapping(m => m.DataId).ToSaga(s => s.DataId);
- ConfigureMapping(m => m.DataId).ToSaga(s => s.DataId);
- }
-
- public class MySaga1Data : ContainSagaData
- {
- [Unique]
- public Guid DataId { get; set; }
- }
- }
-
- public class Saga2 : Saga, IAmStartedByMessages, IHandleMessages