-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from Particular/update-to-nsb-beta7
Update NServiceBus to 6.0.0-Beta7
- Loading branch information
Showing
256 changed files
with
1,758 additions
and
587 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 0 additions & 103 deletions
103
...ts/App_Packages/NSB.AcceptanceTests.6.0.0-beta0006/Routing/When_broadcasting_a_command.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
65 changes: 65 additions & 0 deletions
65
...cceptanceTests.6.0.0-beta0007/Basic/When_receiving_unobtrusive_message_without_handler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
namespace NServiceBus.AcceptanceTests.Basic | ||
{ | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting; | ||
using EndpointTemplates; | ||
using Logging; | ||
using NUnit.Framework; | ||
|
||
public class When_receiving_unobtrusive_message_without_handler : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public async Task Message_should_be_moved_to_error_cause_handler_not_found() | ||
{ | ||
var context = await Scenario.Define<Context>() | ||
.WithEndpoint<Sender>(c => c.When(s => s.Send(new MyCommand()))) | ||
.WithEndpoint<Receiver>(c => c.DoNotFailOnErrorMessages()) | ||
.Done(c => c.FailedMessages.Any()) | ||
.Run(); | ||
|
||
Assert.True(context.Logs.Any(l => l.Level == LogLevel.Error && l.Message.Contains($"No handlers could be found for message type: { typeof(MyCommand).FullName}")), "No handlers could be found was not logged."); | ||
Assert.False(context.Logs.Any(l => l.Level == LogLevel.Warn && l.Message.Contains($"Message header '{ typeof(MyCommand).FullName }' was mapped to type '{ typeof(MyCommand).FullName }' but that type was not found in the message registry, ensure the same message registration conventions are used in all endpoints, especially if using unobtrusive mode.")), "Message type could not be mapped."); | ||
Assert.False(context.Logs.Any(l => l.Level == LogLevel.Warn && l.Message.Contains($"Could not determine message type from message header '{ typeof(MyCommand).FullName}'")), "Message type could not be mapped."); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool WasCalled { get; set; } | ||
} | ||
|
||
public class Sender : EndpointConfigurationBuilder | ||
{ | ||
public Sender() | ||
{ | ||
EndpointSetup<DefaultServer>(c => | ||
{ | ||
c.Conventions() | ||
.DefiningCommandsAs(t => t.Namespace != null && t.FullName == typeof(MyCommand).FullName); | ||
|
||
c.UseSerialization<JsonSerializer>(); | ||
}).AddMapping<MyCommand>(typeof(Receiver)) | ||
.ExcludeType<MyCommand>(); // remove that type from assembly scanning to simulate what would happen with true unobtrusive mode | ||
} | ||
} | ||
|
||
|
||
public class Receiver : EndpointConfigurationBuilder | ||
{ | ||
public Receiver() | ||
{ | ||
EndpointSetup<DefaultServer>(c => | ||
{ | ||
c.Conventions().DefiningCommandsAs(t => t.Namespace != null && t.FullName == typeof(MyCommand).FullName); | ||
|
||
c.UseSerialization<JsonSerializer>(); | ||
}) | ||
.ExcludeType<MyCommand>(); // remove that type from assembly scanning to simulate what would happen with true unobtrusive mode | ||
} | ||
} | ||
|
||
public class MyCommand | ||
{ | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
76 changes: 76 additions & 0 deletions
76
...B.AcceptanceTests.6.0.0-beta0007/Basic/When_sending_interface_message_with_conventions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
namespace NServiceBus.AcceptanceTests.Basic | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting; | ||
using EndpointTemplates; | ||
using NUnit.Framework; | ||
|
||
public class When_sending_interface_message_with_conventions : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public async Task Should_receive_the_message() | ||
{ | ||
var context = await Scenario.Define<Context>(c => { c.Id = Guid.NewGuid(); }) | ||
.WithEndpoint<Sender>(b => b.When(async (session, c) => | ||
{ | ||
await session.Send<IMyInterfaceMessage>(m => m.Id = c.Id); | ||
})) | ||
.WithEndpoint<Receiver>() | ||
.Done(c => c.MessageInterfaceReceived) | ||
.Run(); | ||
|
||
Assert.True(context.MessageInterfaceReceived); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool MessageInterfaceReceived { get; set; } | ||
public Guid Id { get; set; } | ||
} | ||
|
||
public class Sender : EndpointConfigurationBuilder | ||
{ | ||
public Sender() | ||
{ | ||
EndpointSetup<DefaultServer>(b => b.Conventions().DefiningMessagesAs(type => type.Name.EndsWith("Message"))) | ||
.AddMapping<IMyInterfaceMessage>(typeof(Receiver)) | ||
.ExcludeType<IMyInterfaceMessage>(); // remove that type from assembly scanning to simulate what would happen with true unobtrusive mode | ||
} | ||
} | ||
|
||
public class Receiver : EndpointConfigurationBuilder | ||
{ | ||
public Receiver() | ||
{ | ||
EndpointSetup<DefaultServer>(builder => | ||
{ | ||
builder.Conventions() | ||
.DefiningMessagesAs(type => type.Name.EndsWith("Message")); | ||
}); | ||
} | ||
|
||
public class MyMessageInterfaceHandler : IHandleMessages<IMyInterfaceMessage> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public Task Handle(IMyInterfaceMessage interfaceMessage, IMessageHandlerContext context) | ||
{ | ||
if (Context.Id != interfaceMessage.Id) | ||
{ | ||
return Task.FromResult(0); | ||
} | ||
|
||
Context.MessageInterfaceReceived = true; | ||
|
||
return Task.FromResult(0); | ||
} | ||
} | ||
} | ||
|
||
public interface IMyInterfaceMessage | ||
{ | ||
Guid Id { get; set; } | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
84 changes: 84 additions & 0 deletions
84
...cceptanceTests.6.0.0-beta0007/DataBus/When_sending_databus_properties_with_unobtrusive.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
namespace NServiceBus.AcceptanceTests.DataBus | ||
{ | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting; | ||
using EndpointTemplates; | ||
using NUnit.Framework; | ||
|
||
public class When_sending_databus_properties_with_unobtrusive : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public async Task Should_receive_messages_with_largepayload_correctly() | ||
{ | ||
var payloadToSend = new byte[PayloadSize]; | ||
|
||
var context = await Scenario.Define<Context>() | ||
.WithEndpoint<Sender>(b => b.When(session => session.Send(new MyMessageWithLargePayload | ||
{ | ||
Payload = payloadToSend | ||
}))) | ||
.WithEndpoint<Receiver>() | ||
.Done(c => c.ReceivedPayload != null) | ||
.Run(); | ||
|
||
Assert.AreEqual(payloadToSend, context.ReceivedPayload, "The large payload should be marshalled correctly using the databus"); | ||
} | ||
|
||
const int PayloadSize = 100; | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public byte[] ReceivedPayload { get; set; } | ||
} | ||
|
||
public class Sender : EndpointConfigurationBuilder | ||
{ | ||
public Sender() | ||
{ | ||
EndpointSetup<DefaultServer>(builder => | ||
{ | ||
builder.Conventions() | ||
.DefiningCommandsAs(t => t.Namespace != null && t.FullName == typeof(MyMessageWithLargePayload).FullName) | ||
.DefiningDataBusPropertiesAs(t => t.Name.Contains("Payload")); | ||
builder.UseDataBus<FileShareDataBus>().BasePath(@".\databus\sender"); | ||
builder.UseSerialization<JsonSerializer>(); | ||
}) | ||
.AddMapping<MyMessageWithLargePayload>(typeof(Receiver)) | ||
.ExcludeType<MyMessageWithLargePayload>(); // remove that type from assembly scanning to simulate what would happen with true unobtrusive mode | ||
} | ||
} | ||
|
||
public class Receiver : EndpointConfigurationBuilder | ||
{ | ||
public Receiver() | ||
{ | ||
EndpointSetup<DefaultServer>(builder => | ||
{ | ||
builder.Conventions() | ||
.DefiningCommandsAs(t => t.Namespace != null && t.FullName == typeof(MyMessageWithLargePayload).FullName) | ||
.DefiningDataBusPropertiesAs(t => t.Name.Contains("Payload")); | ||
|
||
builder.UseDataBus<FileShareDataBus>().BasePath(@".\databus\sender"); | ||
builder.UseSerialization<JsonSerializer>(); | ||
}); | ||
} | ||
|
||
public class MyMessageHandler : IHandleMessages<MyMessageWithLargePayload> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public Task Handle(MyMessageWithLargePayload messageWithLargePayload, IMessageHandlerContext context) | ||
{ | ||
Context.ReceivedPayload = messageWithLargePayload.Payload; | ||
|
||
return Task.FromResult(0); | ||
} | ||
} | ||
} | ||
|
||
public class MyMessageWithLargePayload | ||
{ | ||
public byte[] Payload { get; set; } | ||
} | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.