Skip to content

Commit

Permalink
Merge branch 'release-5.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
SeanFeldman committed Feb 10, 2015
2 parents 287b53d + 01985d8 commit faa27b0
Show file tree
Hide file tree
Showing 166 changed files with 9,125 additions and 2,133 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ _UpgradeReport.*
*.resharper
*.suo
*.cache
*.sln.ide
*~
*.swp
*.user
Expand Down
2 changes: 1 addition & 1 deletion GitVersionConfig.yaml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assemblyVersioningScheme: Major
assembly-versioning-scheme: Major
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<TargetFrameworkProfile />
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\NServiceBus.snk</AssemblyOriginatorKeyFile>
<NuGetPackageImportStamp>74966e7d</NuGetPackageImportStamp>
<NuGetPackageImportStamp>ba4aa232</NuGetPackageImportStamp>
<CreateDeploymentPackage>False</CreateDeploymentPackage>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -88,9 +88,9 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\GitVersionTask.1.3.3\Build\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.1.3.3\Build\GitVersionTask.targets'))" />
<Error Condition="!Exists('..\packages\NuGetPackager.0.4.10\build\NuGetPackager.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NuGetPackager.0.4.10\build\NuGetPackager.targets'))" />
<Error Condition="!Exists('..\packages\GitVersionTask.2.0.1\Build\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.2.0.1\Build\GitVersionTask.targets'))" />
</Target>
<Import Project="..\packages\GitVersionTask.1.3.3\Build\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.1.3.3\Build\GitVersionTask.targets')" />
<Import Project="..\packages\NuGetPackager.0.4.10\build\NuGetPackager.targets" Condition="Exists('..\packages\NuGetPackager.0.4.10\build\NuGetPackager.targets')" />
<Import Project="..\packages\GitVersionTask.2.0.1\Build\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.2.0.1\Build\GitVersionTask.targets')" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,13 @@ public EndpointBehaviorBuilder<TContext> CustomConfig(Action<BusConfiguration> a
return this;
}

public EndpointBehaviorBuilder<TContext> AppConfig(string appConfig)
{
behavior.AppConfig = appConfig;

return this;
}

public EndpointBehavior Build()
{
return behavior;
Expand Down
27 changes: 14 additions & 13 deletions src/NServiceBus.AcceptanceTesting/Support/IBusAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ public IBusAdapter(ISendOnlyBus sendOnlyBus)

public void Dispose()
{
throw new NotImplementedException();
sendOnlyBus.Dispose();
}

public void Publish<T>(T message)
{
throw new NotImplementedException();
sendOnlyBus.Publish(message);
}

public void Publish<T>()
{
throw new NotImplementedException();
sendOnlyBus.Publish<T>();
}

public void Publish<T>(Action<T> messageConstructor)
{
throw new NotImplementedException();
sendOnlyBus.Publish(messageConstructor);
}

public ICallback Send(object message)
Expand All @@ -39,50 +39,51 @@ public ICallback Send(object message)

public ICallback Send<T>(Action<T> messageConstructor)
{
throw new NotImplementedException();
return sendOnlyBus.Send(messageConstructor);
}

public ICallback Send(string destination, object message)
{
throw new NotImplementedException();
return sendOnlyBus.Send(destination, message);
}

public ICallback Send(Address address, object message)
{
throw new NotImplementedException();
return sendOnlyBus.Send(address, message);
}

public ICallback Send<T>(string destination, Action<T> messageConstructor)
{
throw new NotImplementedException();
return sendOnlyBus.Send(destination, messageConstructor);
}

public ICallback Send<T>(Address address, Action<T> messageConstructor)
{
throw new NotImplementedException();
return sendOnlyBus.Send(address, messageConstructor);
}

public ICallback Send(string destination, string correlationId, object message)
{
throw new NotImplementedException();
return sendOnlyBus.Send(destination, correlationId, message);
}

public ICallback Send(Address address, string correlationId, object message)
{
throw new NotImplementedException();
return sendOnlyBus.Send(address, correlationId, message);
}

public ICallback Send<T>(string destination, string correlationId, Action<T> messageConstructor)
{
throw new NotImplementedException();
return sendOnlyBus.Send(destination, correlationId, messageConstructor);
}

public ICallback Send<T>(Address address, string correlationId, Action<T> messageConstructor)
{
throw new NotImplementedException();
return sendOnlyBus.Send(address, correlationId, messageConstructor);
}

public IDictionary<string, string> OutgoingHeaders { get; private set; }

public void Subscribe(Type messageType)
{
throw new NotImplementedException();
Expand Down
10 changes: 3 additions & 7 deletions src/NServiceBus.AcceptanceTesting/Support/ScenarioRunner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ static void DisplayRunResult(RunSummary summary, int totalRuns)
Console.Out.WriteLine("Result: Successful - Duration: {0}", runResult.TotalTime);
}

//dump trace and context regardless since asserts outside the should could stoll fail the test
//dump trace and context regardless since asserts outside the should could still fail the test
Console.WriteLine("");
Console.Out.WriteLine("Context:");

Expand Down Expand Up @@ -369,14 +369,10 @@ static ActiveRunner PrepareRunner(string endpointName, string appConfigPath, boo
var domainSetup = new AppDomainSetup
{
ApplicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
LoaderOptimization = LoaderOptimization.SingleDomain
LoaderOptimization = LoaderOptimization.SingleDomain,
ConfigurationFile = appConfigPath ?? AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
};

if (appConfigPath != null)
{
domainSetup.ConfigurationFile = appConfigPath;
}

var appDomain = AppDomain.CreateDomain(endpointName, AppDomain.CurrentDomain.Evidence, domainSetup);

return new ActiveRunner
Expand Down
2 changes: 1 addition & 1 deletion src/NServiceBus.AcceptanceTesting/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GitVersionTask" version="1.3.3" targetFramework="net45" developmentDependency="true" />
<package id="GitVersionTask" version="2.0.1" targetFramework="net45" developmentDependency="true" />
<package id="NuGetPackager" version="0.4.10" targetFramework="net45" developmentDependency="true" />
</packages>
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
namespace NServiceBus.AcceptanceTests.Audit
{
using System;
using EndpointTemplates;
using AcceptanceTesting;
using NServiceBus.Config;
using NUnit.Framework;

public class When_ForwardReceivedMessagesTo_is_set : NServiceBusAcceptanceTest
{
[Test]
public void Should_forward_message()
{
var context = new Context();

Scenario.Define(context)
.WithEndpoint<EndpointThatForwards>(b => b.Given((bus, c) =>
{
bus.SendLocal(new MessageToForward());
}))
.WithEndpoint<ForwardReceiver>()
.Done(c => c.GotForwardedMessage)
.Run();

Assert.IsTrue(context.GotForwardedMessage);
}

public class Context : ScenarioContext
{
public bool GotForwardedMessage { get; set; }
}

public class ForwardReceiver : EndpointConfigurationBuilder
{
public ForwardReceiver()
{
EndpointSetup<DefaultServer>(c => c.EndpointName("forward_receiver"));
}

public class MessageToForwardHandler : IHandleMessages<MessageToForward>
{
public Context Context { get; set; }

public void Handle(MessageToForward message)
{
Context.GotForwardedMessage = true;
}
}
}

public class EndpointThatForwards : EndpointConfigurationBuilder
{
public EndpointThatForwards()
{
EndpointSetup<DefaultServer>()
.WithConfig<UnicastBusConfig>(c => c.ForwardReceivedMessagesTo = "forward_receiver");
}

public class MessageToForwardHandler : IHandleMessages<MessageToForward>
{
public void Handle(MessageToForward message)
{
}
}
}

[Serializable]
public class MessageToForward : IMessage
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
namespace NServiceBus.AcceptanceTests.Basic
{
using System;
using NServiceBus.AcceptanceTesting;
using NServiceBus.AcceptanceTests.EndpointTemplates;
using NUnit.Framework;

public class When_callback_from_a_send_only : NServiceBusAcceptanceTest
{
[Test]
public void Should_throw()
{
Scenario.Define<Context>()
.WithEndpoint<SendOnlyEndpoint>(b => b.Given((bus, c) =>
{
var exception = Assert.Throws<Exception>(() => bus.Send(new MyMessage()).Register(result => { }));
Assert.AreEqual("Callbacks are invalid in a sendonly endpoint.", exception.Message);
}))
.WithEndpoint<Receiver>()
.Run();
}

public class Context : ScenarioContext
{
}

public class SendOnlyEndpoint : EndpointConfigurationBuilder
{
public SendOnlyEndpoint()
{
EndpointSetup<DefaultServer>()
.SendOnly()
.AddMapping<MyMessage>(typeof(Receiver));
}

}
public class Receiver : EndpointConfigurationBuilder
{
public Receiver()
{
EndpointSetup<DefaultServer>();
}
}

[Serializable]
public class MyMessage : ICommand
{
}

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
namespace NServiceBus.AcceptanceTests.Basic
{
using System;
using NServiceBus.AcceptanceTesting;
using NServiceBus.AcceptanceTests.EndpointTemplates;
using NUnit.Framework;

public class When_injecting_handler_props : NServiceBusAcceptanceTest
{
[Test]
public void Run()
{
var context = new Context();

Scenario.Define(context)
.WithEndpoint<Receiver>(c=>c.When(b=>b.SendLocal(new MyMessage())))
.Done(c => c.WasCalled)
.Run();

Assert.AreEqual(10, context.Number);
Assert.AreEqual("Foo", context.Name);
}

public class Context : ScenarioContext
{
public bool WasCalled { get; set; }
public string Name { get; set; }
public int Number { get; set; }
}

public class Receiver : EndpointConfigurationBuilder
{
public Receiver()
{
EndpointSetup<DefaultServer>(c =>
{
c.InitializeHandlerProperty<MyMessageHandler>("Number", 10);
c.InitializeHandlerProperty<MyMessageHandler>("Name", "Foo");
});

}

public class MyMessageHandler : IHandleMessages<MyMessage>
{
public Context Context { get; set; }

public IBus Bus { get; set; }

public string Name { get; set; }

public int Number { get; set; }

public void Handle(MyMessage message)
{
Context.Number = Number;
Context.Name = Name;
Context.WasCalled = true;
}
}
}

[Serializable]
public class MyMessage : ICommand
{
}
}
}
Loading

0 comments on commit faa27b0

Please sign in to comment.