Skip to content

Commit

Permalink
Merge branch 'hotfix-2.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
indualagarsamy committed Sep 29, 2014
2 parents f987ce4 + 123905d commit 9511e7d
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 9 deletions.
1 change: 1 addition & 0 deletions GitVersionConfig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
assemblyVersioningScheme: Major
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
namespace NServiceBus.AcceptanceTests.Audit
{
using System;
using System.Linq;
using EndpointTemplates;
using AcceptanceTesting;
using MessageMutator;
using NServiceBus.Features;
using NUnit.Framework;

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

Scenario.Define(context)
.WithEndpoint<Server>()
.WithEndpoint<EndpointWithAuditOn>(b => b.Given(bus => bus.Send(new Request())))
.WithEndpoint<AuditSpyEndpoint>()
.Done(c => c.MessageAudited)
.Run();

Assert.True(context.MessageAudited);
}


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

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

class RequestHandler : IHandleMessages<Request>
{
public IBus Bus { get; set; }
public void Handle(Request message)
{
Bus.Reply(new ResponseToBeAudited());
}
}
}

public class EndpointWithAuditOn : EndpointConfigurationBuilder
{
public EndpointWithAuditOn()
{
EndpointSetup<DefaultServer>(c=>c.DisableFeature<Outbox>())
.AddMapping<Request>(typeof(Server))
.AuditTo<AuditSpyEndpoint>();
}


public class MessageToBeAuditedHandler : IHandleMessages<ResponseToBeAudited>
{
public void Handle(ResponseToBeAudited message)
{

}
}
}

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

class BodySpy : IMutateIncomingTransportMessages, INeedInitialization
{
public Context Context { get; set; }

public void MutateIncoming(TransportMessage transportMessage)
{
Context.MessageAudited = true;
}

public void Customize(BusConfiguration configuration)
{
configuration.RegisterComponents(c => c.ConfigureComponent<BodySpy>(DependencyLifecycle.InstancePerCall));
}
}

public class MessageToBeAuditedHandler : IHandleMessages<ResponseToBeAudited>
{
public void Handle(ResponseToBeAudited message)
{
}
}
}

public static byte Checksum(byte[] data)
{
var longSum = data.Sum(x => (long)x);
return unchecked((byte)longSum);
}

[Serializable]
public class ResponseToBeAudited : IMessage
{
}


class Request : IMessage
{
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public void Should_receive_the_message_the_correctly()
})))
.WithEndpoint<Receiver>()
.Done(context => context.ReceivedPayload != null)
.Repeat(r => r.For<AllSerializers>())
.Repeat(r => r.For(Transports.Default))
.Should(c => Assert.AreEqual(PayloadToSend, c.ReceivedPayload, "The large payload should be marshalled correctly using the databus"))
.Run();
File.Delete(MyDataBus.GetTempPath());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
</None>
</ItemGroup>
<ItemGroup>
<Compile Include="App_Packages\NSB.AcceptanceTests.5.0.0\Audit\When_a_replymessage_is_audited.cs" />
<Compile Include="When_callback_receiver_is_disabled.cs" />
<Compile Include="App_Packages\NSB.AcceptanceTests.5.0.0\Audit\When_a_message_is_audited.cs" />
<Compile Include="App_Packages\NSB.AcceptanceTests.5.0.0\Audit\When_using_auditing_as_a_feature.cs" />
Expand Down
10 changes: 5 additions & 5 deletions src/NServiceBus.SqlServer/NServiceBus.SqlServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<AssemblyOriginatorKeyFile>$(SolutionDir)NServiceBus.snk</AssemblyOriginatorKeyFile>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\</SolutionDir>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>350a263d</NuGetPackageImportStamp>
<NuGetPackageImportStamp>76193a81</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -94,9 +94,9 @@
<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\Fody.1.24.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.24.0\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\GitVersionTask.1.2.0\Build\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.1.2.0\Build\GitVersionTask.targets'))" />
<Error Condition="!Exists('..\packages\NuGetPackager.0.1.3\build\NuGetPackager.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NuGetPackager.0.1.3\build\NuGetPackager.targets'))" />
<Error Condition="!Exists('..\packages\GitVersionTask.1.3.0\Build\GitVersionTask.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\GitVersionTask.1.3.0\Build\GitVersionTask.targets'))" />
<Error Condition="!Exists('..\packages\NuGetPackager.0.1.6\build\NuGetPackager.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NuGetPackager.0.1.6\build\NuGetPackager.targets'))" />
</Target>
<Import Project="..\packages\GitVersionTask.1.2.0\Build\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.1.2.0\Build\GitVersionTask.targets')" />
<Import Project="..\packages\NuGetPackager.0.1.3\build\NuGetPackager.targets" Condition="Exists('..\packages\NuGetPackager.0.1.3\build\NuGetPackager.targets')" />
<Import Project="..\packages\GitVersionTask.1.3.0\Build\GitVersionTask.targets" Condition="Exists('..\packages\GitVersionTask.1.3.0\Build\GitVersionTask.targets')" />
<Import Project="..\packages\NuGetPackager.0.1.6\build\NuGetPackager.targets" Condition="Exists('..\packages\NuGetPackager.0.1.6\build\NuGetPackager.targets')" />
</Project>
2 changes: 1 addition & 1 deletion src/NServiceBus.SqlServer/SqlServerMessageSender.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void Send(TransportMessage message, SendOptions sendOptions)

string callbackAddress;

if (message.MessageIntent == MessageIntentEnum.Reply &&
if (sendOptions.GetType().FullName.EndsWith("ReplyOptions") &&
message.Headers.TryGetValue(CallbackHeaderKey, out callbackAddress))
{
address = Address.Parse(callbackAddress);
Expand Down
4 changes: 2 additions & 2 deletions src/NServiceBus.SqlServer/packages.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Fody" version="1.24.0" targetFramework="net45" developmentDependency="true" />
<package id="GitVersionTask" version="1.2.0" targetFramework="net45" developmentDependency="true" />
<package id="GitVersionTask" version="1.3.0" targetFramework="net45" developmentDependency="true" />
<package id="Janitor.Fody" version="0.6.1.0" targetFramework="net45" />
<package id="NServiceBus" version="5.0.0" targetFramework="net45" />
<package id="NuGetPackager" version="0.1.3" targetFramework="net45" />
<package id="NuGetPackager" version="0.1.6" targetFramework="net45" />
</packages>

0 comments on commit 9511e7d

Please sign in to comment.