Skip to content

Commit

Permalink
Merge branch '3.3.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasohlund committed Nov 5, 2012
2 parents 02a7fdf + a0ae5c8 commit 36f7ca1
Show file tree
Hide file tree
Showing 16 changed files with 258 additions and 182 deletions.
3 changes: 2 additions & 1 deletion Samples/Gateway/Headquarter/UpdatePriceMessageHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ public void Handle(UpdatePrice message)
{
ProductId = message.ProductId,
NewPrice = message.NewPrice,
ValidFrom = message.ValidFrom
ValidFrom = message.ValidFrom,
SomeLargeString = new DataBusProperty<string>("A large string to demonstrate that the gateway supports databus properties")
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ namespace NServiceBus.DataBus.Tests
public class MessageWithDataBusProperty : IMessage
{
public DataBusProperty<string> DataBusProperty { get; set; }
}

public class MessageWithNullDataBusProperty : IMessage
{
public DataBusProperty<string> DataBusProperty { get; set; }
}
}
277 changes: 139 additions & 138 deletions src/databus/NServiceBus.Databus.Tests/NServiceBus.DataBus.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,145 +1,146 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DC1AC444-4F80-41D6-A320-99D37F5EA644}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NServiceBus.DataBus.Tests</RootNamespace>
<AssemblyName>NServiceBus.DataBus.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\..\lib\log4net.dll</HintPath>
</Reference>
<Reference Include="NServiceBus">
<HintPath>..\..\..\build\output\NServiceBus.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.Config, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.Config.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MessageHeaders">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.MessageHeaders.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MessageInterfaces">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.MessageInterfaces.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MessageInterfaces.MessageMapper.Reflection">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.MessageInterfaces.MessageMapper.Reflection.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MessageMutator">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.MessageMutator.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.ObjectBuilder, Version=3.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.ObjectBuilder.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.ObjectBuilder.DefaultBuilder">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.ObjectBuilder.DefaultBuilder.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\..\..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="nunit.mocks">
<HintPath>..\..\..\packages\NUnit.2.5.10.11092\lib\nunit.mocks.dll</HintPath>
</Reference>
<Reference Include="pnunit.framework">
<HintPath>..\..\..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\RhinoMocks.3.6\lib\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="InMemoryDataBus.cs" />
<Compile Include="MessageWithDataBusProperty.cs" />
<Compile Include="MessageWithExplicitTimeToLive.cs" />
<Compile Include="MessageWithNonSerializableDataBusProperty.cs" />
<Compile Include="MessageWithoutDataBusProperty.cs" />
<Compile Include="on_the_bus.cs" />
<Compile Include="When_applying_the_databus_message_mutator_to_incoming_messages.cs" />
<Compile Include="When_applying_the_databus_message_mutator_to_outgoing_messages.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="When_nservicebus_is_initalizing.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NServiceBus.Databus\NServiceBus.DataBus.csproj">
<Project>{EDFCAFE5-9C1D-4339-9DC5-2CD899E9E605}</Project>
<Name>NServiceBus.DataBus</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DC1AC444-4F80-41D6-A320-99D37F5EA644}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>NServiceBus.DataBus.Tests</RootNamespace>
<AssemblyName>NServiceBus.DataBus.Tests</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="log4net">
<HintPath>..\..\..\lib\log4net.dll</HintPath>
</Reference>
<Reference Include="NServiceBus">
<HintPath>..\..\..\build\output\NServiceBus.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.Config, Version=3.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.Config.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MessageHeaders">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.MessageHeaders.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MessageInterfaces">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.MessageInterfaces.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MessageInterfaces.MessageMapper.Reflection">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.MessageInterfaces.MessageMapper.Reflection.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.MessageMutator">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.MessageMutator.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.ObjectBuilder, Version=3.0.0.0, Culture=neutral, PublicKeyToken=9fc386479f8a226c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.ObjectBuilder.dll</HintPath>
</Reference>
<Reference Include="NServiceBus.ObjectBuilder.DefaultBuilder">
<HintPath>..\..\..\build\nservicebus.core\NServiceBus.ObjectBuilder.DefaultBuilder.dll</HintPath>
</Reference>
<Reference Include="nunit.framework">
<HintPath>..\..\..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
</Reference>
<Reference Include="nunit.mocks">
<HintPath>..\..\..\packages\NUnit.2.5.10.11092\lib\nunit.mocks.dll</HintPath>
</Reference>
<Reference Include="pnunit.framework">
<HintPath>..\..\..\packages\NUnit.2.5.10.11092\lib\pnunit.framework.dll</HintPath>
</Reference>
<Reference Include="Rhino.Mocks, Version=3.6.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\RhinoMocks.3.6\lib\Rhino.Mocks.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core">
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="InMemoryDataBus.cs" />
<Compile Include="MessageWithDataBusProperty.cs" />
<Compile Include="MessageWithExplicitTimeToLive.cs" />
<Compile Include="MessageWithNonSerializableDataBusProperty.cs" />
<Compile Include="MessageWithoutDataBusProperty.cs" />
<Compile Include="on_the_bus.cs" />
<Compile Include="When_applying_the_databus_message_mutator_to_incoming_messages.cs" />
<Compile Include="When_applying_the_databus_message_mutator_to_null_properties.cs" />
<Compile Include="When_applying_the_databus_message_mutator_to_outgoing_messages.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="When_nservicebus_is_initalizing.cs" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\NServiceBus.Databus\NServiceBus.DataBus.csproj">
<Project>{EDFCAFE5-9C1D-4339-9DC5-2CD899E9E605}</Project>
<Name>NServiceBus.DataBus</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
-->
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
namespace NServiceBus.DataBus.Tests
{
{
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using NUnit.Framework;
Expand All @@ -14,19 +15,24 @@ public void Incoming_databus_properties_should_be_hydrated()
var message = new MessageWithDataBusProperty
{
DataBusProperty = new DataBusProperty<string>("not used in this test")
};

};
message.DataBusProperty.Key = Guid.NewGuid().ToString();

var databusKey = Guid.NewGuid().ToString();

message.SetHeader("NServiceBus.DataBus." + message.DataBusProperty.Key, databusKey);

using (var stream = new MemoryStream())
{
new BinaryFormatter().Serialize(stream, "test");
stream.Position = 0;

dataBus.Stub(s => s.Get(message.DataBusProperty.Key)).Return(stream);
stream.Position = 0;

dataBus.Stub(s => s.Get(databusKey)).Return(stream);

message = (MessageWithDataBusProperty) incomingMutator.MutateIncoming(message);
}
Assert.AreEqual(message.DataBusProperty.Value, "test");
}

}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
namespace NServiceBus.DataBus.Tests
{
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using NUnit.Framework;

[TestFixture]
public class When_applying_the_databus_message_mutator_to_null_properties : on_the_bus
{
[Test]
public void Should_not_blow_up()
{
var message = new MessageWithNullDataBusProperty();

outgoingMutator.MutateOutgoing(message);

using (var stream = new MemoryStream())
{
new BinaryFormatter().Serialize(stream, "test");
stream.Position = 0;

incomingMutator.MutateIncoming(message);
}


}

}
}
5 changes: 4 additions & 1 deletion src/databus/NServiceBus.Databus/DataBusMessageMutator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ object IMutateIncomingMessages.MutateIncoming(object message)
headerKey = String.Format("{0}.{1}", message.GetType().FullName, property.Name);
}

var dataBusKey = message.GetHeader(DATABUS_PREFIX + headerKey);
var dataBusKey = message.GetHeader(DATABUS_PREFIX + headerKey);

if (string.IsNullOrEmpty(dataBusKey))
continue;

using (var stream = dataBus.Get(dataBusKey))
{
Expand Down
Loading

0 comments on commit 36f7ca1

Please sign in to comment.