-
Notifications
You must be signed in to change notification settings - Fork 1
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 #148 from Particular/release-1.3.0
Release 1.3.0
- Loading branch information
Showing
169 changed files
with
7,914 additions
and
2,623 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
18 changes: 18 additions & 0 deletions
18
...tanceTests/App_Packages/NSB.AcceptanceTests.6.3.2/ConfigureEndpointInMemoryPersistence.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,18 @@ | ||
using System.Threading.Tasks; | ||
using NServiceBus; | ||
using NServiceBus.AcceptanceTesting.Support; | ||
|
||
public class ConfigureEndpointInMemoryPersistence : IConfigureEndpointTestExecution | ||
{ | ||
public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) | ||
{ | ||
configuration.UsePersistence<InMemoryPersistence>(); | ||
return Task.FromResult(0); | ||
} | ||
|
||
public Task Cleanup() | ||
{ | ||
// Nothing required for in-memory persistence | ||
return Task.FromResult(0); | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
...tanceTests/App_Packages/NSB.AcceptanceTests.6.3.2/ConfigureEndpointLearningPersistence.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,34 @@ | ||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using NServiceBus; | ||
using NServiceBus.AcceptanceTesting.Support; | ||
using NServiceBus.Persistence; | ||
|
||
public class ConfigureEndpointLearningPersistence : IConfigureEndpointTestExecution | ||
{ | ||
public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) | ||
{ | ||
//can't use bindir since that will be to long on the build agents | ||
storageDir = Path.Combine(@"c:\temp", Guid.NewGuid().ToString("N")); | ||
|
||
configuration.UsePersistence<InMemoryPersistence, StorageType.Subscriptions>(); | ||
configuration.UsePersistence<InMemoryPersistence, StorageType.Timeouts>(); | ||
|
||
configuration.UsePersistence<LearningPersistence, StorageType.Sagas>() | ||
.SagaStorageDirectory(storageDir); | ||
|
||
return Task.FromResult(0); | ||
} | ||
|
||
public Task Cleanup() | ||
{ | ||
if (Directory.Exists(storageDir)) | ||
{ | ||
Directory.Delete(storageDir, true); | ||
} | ||
return Task.FromResult(0); | ||
} | ||
|
||
string storageDir; | ||
} |
33 changes: 33 additions & 0 deletions
33
...eptanceTests/App_Packages/NSB.AcceptanceTests.6.3.2/ConfigureEndpointLearningTransport.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,33 @@ | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
using NServiceBus; | ||
using NServiceBus.AcceptanceTesting.Support; | ||
using NServiceBus.Transport; | ||
|
||
public class ConfigureEndpointLearningTransport : IConfigureEndpointTestExecution | ||
{ | ||
public Task Cleanup() | ||
{ | ||
if (Directory.Exists(storageDir)) | ||
{ | ||
Directory.Delete(storageDir, true); | ||
} | ||
|
||
return Task.FromResult(0); | ||
} | ||
|
||
public Task Configure(string endpointName, EndpointConfiguration configuration, RunSettings settings, PublisherMetadata publisherMetadata) | ||
{ | ||
storageDir = Path.Combine(@"c:\temp", "att_tests"); //can't use bindir since that will be to long on the build agents | ||
|
||
//we want the tests to be exposed to concurrency | ||
configuration.LimitMessageProcessingConcurrencyTo(PushRuntimeSettings.Default.MaxConcurrency); | ||
|
||
configuration.UseTransport<LearningTransport>() | ||
.StorageDirectory(storageDir); | ||
|
||
return Task.FromResult(0); | ||
} | ||
|
||
string storageDir; | ||
} |
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
59 changes: 59 additions & 0 deletions
59
...rage.AcceptanceTests/App_Packages/NSB.AcceptanceTests.6.3.2/ConventionEnforcementTests.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,59 @@ | ||
namespace NServiceBus.AcceptanceTests | ||
{ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using NUnit.Framework; | ||
|
||
[TestFixture] | ||
public class ConventionEnforcementTests : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public void Ensure_all_tests_derive_from_a_common_base_class() | ||
{ | ||
var testTypes = Assembly.GetExecutingAssembly().GetTypes() | ||
.Where(HasTestMethod); | ||
|
||
var missingBaseClass = testTypes | ||
.Where(t => t.BaseType == null || !typeof(NServiceBusAcceptanceTest).IsAssignableFrom(t)) | ||
.ToList(); | ||
|
||
CollectionAssert.IsEmpty(missingBaseClass, string.Join(",", missingBaseClass)); | ||
} | ||
|
||
[Test] | ||
public void Ensure_all_messages_are_public() | ||
{ | ||
var testTypes = Assembly.GetExecutingAssembly().GetTypes(); | ||
|
||
var missingBaseClass = testTypes | ||
.Where(t => !t.IsPublic && !t.IsNestedPublic) | ||
.Where(t => | ||
typeof(ICommand).IsAssignableFrom(t) || | ||
typeof(IMessage).IsAssignableFrom(t) || | ||
typeof(IEvent).IsAssignableFrom(t) | ||
) | ||
.ToList(); | ||
|
||
CollectionAssert.IsEmpty(missingBaseClass, string.Join(",", missingBaseClass)); | ||
} | ||
|
||
[Test] | ||
public void Ensure_all_sagadatas_are_public() | ||
{ | ||
var testTypes = Assembly.GetExecutingAssembly().GetTypes(); | ||
|
||
var sagaDatas = testTypes | ||
.Where(t => !t.IsPublic && !t.IsNestedPublic) | ||
.Where(t => typeof(IContainSagaData).IsAssignableFrom(t)) | ||
.ToList(); | ||
|
||
CollectionAssert.IsEmpty(sagaDatas, string.Join(",", sagaDatas)); | ||
} | ||
|
||
static bool HasTestMethod(Type t) | ||
{ | ||
return t.GetMethods().Any(m => m.GetCustomAttributes<TestAttribute>().Any()); | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
...eTests/App_Packages/NSB.AcceptanceTests.6.3.2/DelayedDelivery/When_Deferring_a_message.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,66 @@ | ||
namespace NServiceBus.AcceptanceTests.DelayedDelivery | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting; | ||
using EndpointTemplates; | ||
using Features; | ||
using NUnit.Framework; | ||
|
||
public class When_deferring_a_message : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public async Task Should_delay_delivery() | ||
{ | ||
var delay = TimeSpan.FromSeconds(2); | ||
|
||
var context = await Scenario.Define<Context>() | ||
.WithEndpoint<Endpoint>(b => b.When((session, c) => | ||
{ | ||
var options = new SendOptions(); | ||
|
||
options.DelayDeliveryWith(delay); | ||
options.RouteToThisEndpoint(); | ||
|
||
c.SentAt = DateTime.UtcNow; | ||
|
||
return session.Send(new MyMessage(), options); | ||
})) | ||
.Done(c => c.WasCalled) | ||
.Run(); | ||
|
||
Assert.GreaterOrEqual(context.ReceivedAt - context.SentAt, delay); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool WasCalled { get; set; } | ||
public DateTime SentAt { get; set; } | ||
public DateTime ReceivedAt { get; set; } | ||
} | ||
|
||
public class Endpoint : EndpointConfigurationBuilder | ||
{ | ||
public Endpoint() | ||
{ | ||
EndpointSetup<DefaultServer>(config => config.EnableFeature<TimeoutManager>()); | ||
} | ||
|
||
public class MyMessageHandler : IHandleMessages<MyMessage> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public Task Handle(MyMessage message, IMessageHandlerContext context) | ||
{ | ||
Context.ReceivedAt = DateTime.UtcNow; | ||
Context.WasCalled = true; | ||
return Task.FromResult(0); | ||
} | ||
} | ||
} | ||
|
||
public class MyMessage : IMessage | ||
{ | ||
} | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...ackages/NSB.AcceptanceTests.6.3.2/DelayedDelivery/When_deferring_a_message_to_the_past.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,59 @@ | ||
namespace NServiceBus.AcceptanceTests.DelayedDelivery | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting; | ||
using EndpointTemplates; | ||
using Features; | ||
using NUnit.Framework; | ||
|
||
public class When_deferring_a_message_to_the_past : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public async Task Should_deliver_message() | ||
{ | ||
var context = await Scenario.Define<Context>() | ||
.WithEndpoint<Endpoint>(b => b.When((bus, c) => | ||
{ | ||
var options = new SendOptions(); | ||
|
||
options.DoNotDeliverBefore(DateTime.Now.AddHours(-1)); | ||
options.RouteToThisEndpoint(); | ||
|
||
return bus.Send(new MyMessage(), options); | ||
})) | ||
.Done(c => c.MessageReceived) | ||
.Run(); | ||
|
||
Assert.IsTrue(context.MessageReceived); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool MessageReceived { get; set; } | ||
} | ||
|
||
public class Endpoint : EndpointConfigurationBuilder | ||
{ | ||
public Endpoint() | ||
{ | ||
EndpointSetup<DefaultServer>(config => config.EnableFeature<TimeoutManager>()); | ||
} | ||
|
||
public class MyMessageHandler : IHandleMessages<MyMessage> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public Task Handle(MyMessage message, IMessageHandlerContext context) | ||
{ | ||
Context.MessageReceived = true; | ||
return Task.FromResult(0); | ||
} | ||
} | ||
} | ||
|
||
public class MyMessage : IMessage | ||
{ | ||
} | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
...sts/App_Packages/NSB.AcceptanceTests.6.3.2/DelayedDelivery/When_deferring_to_non_local.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,79 @@ | ||
namespace NServiceBus.AcceptanceTests.DelayedDelivery | ||
{ | ||
using System; | ||
using System.Threading.Tasks; | ||
using AcceptanceTesting; | ||
using AcceptanceTesting.Customization; | ||
using EndpointTemplates; | ||
using Features; | ||
using NUnit.Framework; | ||
|
||
public class When_deferring_to_non_local : NServiceBusAcceptanceTest | ||
{ | ||
[Test] | ||
public async Task Message_should_be_received() | ||
{ | ||
var delay = TimeSpan.FromSeconds(2); | ||
|
||
var context = await Scenario.Define<Context>() | ||
.WithEndpoint<Endpoint>(b => b.When((session, c) => | ||
{ | ||
var options = new SendOptions(); | ||
|
||
options.DelayDeliveryWith(delay); | ||
|
||
c.SentAt = DateTime.UtcNow; | ||
|
||
return session.Send(new MyMessage(), options); | ||
})) | ||
.WithEndpoint<Receiver>() | ||
.Done(c => c.WasCalled) | ||
.Run(); | ||
|
||
Assert.GreaterOrEqual(context.ReceivedAt - context.SentAt, delay); | ||
} | ||
|
||
public class Context : ScenarioContext | ||
{ | ||
public bool WasCalled { get; set; } | ||
public DateTime SentAt { get; set; } | ||
public DateTime ReceivedAt { get; set; } | ||
} | ||
|
||
public class Endpoint : EndpointConfigurationBuilder | ||
{ | ||
public Endpoint() | ||
{ | ||
EndpointSetup<DefaultServer>(config => | ||
{ | ||
config.EnableFeature<TimeoutManager>(); | ||
config.ConfigureTransport().Routing().RouteToEndpoint(typeof(MyMessage), typeof(Receiver)); | ||
}); | ||
} | ||
} | ||
|
||
public class Receiver : EndpointConfigurationBuilder | ||
{ | ||
public Receiver() | ||
{ | ||
EndpointSetup<DefaultServer>(); | ||
} | ||
|
||
public class MyMessageHandler : IHandleMessages<MyMessage> | ||
{ | ||
public Context Context { get; set; } | ||
|
||
public Task Handle(MyMessage message, IMessageHandlerContext context) | ||
{ | ||
Context.ReceivedAt = DateTime.UtcNow; | ||
Context.WasCalled = true; | ||
return Task.FromResult(0); | ||
} | ||
} | ||
} | ||
|
||
public class MyMessage : ICommand | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.