Skip to content

Commit

Permalink
added configurations to get tests to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Sky Morey committed Aug 26, 2012
1 parent 4c6a858 commit 755f854
Show file tree
Hide file tree
Showing 24 changed files with 155 additions and 100 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ public void Configure(AbstractRhinoServiceBusConfiguration config, IBusContainer
var messageOwners = new List<MessageOwner>();
var messageOwnersReader = new MessageOwnersConfigReader(config.ConfigurationSection, messageOwners);
messageOwnersReader.ReadMessageOwners();
oneWayConfig.MessageOwners = messageOwners.ToArray();
if (messageOwnersReader.EndpointScheme.Equals("rhino.queues", StringComparison.InvariantCultureIgnoreCase) == false)

if (!messageOwnersReader.EndpointScheme.Equals("rhino.queues", StringComparison.InvariantCultureIgnoreCase))
return;

oneWayConfig.MessageOwners = messageOwners.ToArray();
containerBuilder.RegisterRhinoQueuesOneWay();
}
}
Expand Down
3 changes: 0 additions & 3 deletions Rhino.ServiceBus.Spring/Rhino.ServiceBus.Spring.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
</PropertyGroup>
<ItemGroup>
<Reference Include="Common.Logging">
<HintPath>..\SharedLibs\3.5\Common.Logging.dll</HintPath>
</Reference>
<Reference Include="Rhino.Queues, Version=1.2.0.0, Culture=neutral, PublicKeyToken=0b3305902db7183f, processorArchitecture=MSIL">
<HintPath>$(LibDir)Rhino.Queues.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<bus threadCount="1"
numberOfRetries="5"
endpoint="msmq://localhost/test_queue"
Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/BusOnTransactionalQueue.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<bus threadCount="1"
numberOfRetries="5"
endpoint="msmq://localhost/transactional_test_queue"
Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/BusWithLogging.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<bus threadCount="1"
numberOfRetries="5"
logEndpoint="msmq://localhost/test_queue2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,12 @@ public void CanRunTwoOneWayBusesOnSameMachine()
bus.Start();

var config1 = new HostConfiguration()
.AddAssembly(typeof(RhinoQueuesTransport).Assembly)
.Receive("System.Int", "rhino.queues://localhost/test_queue");

//Must specify an alternate storage path since we are running both out of same base directory.
var config2 = new HostConfiguration()
.AddAssembly(typeof(RhinoQueuesTransport).Assembly)
.StoragePath(Path.Combine(Path.GetFullPath(AppDomain.CurrentDomain.BaseDirectory), "one_way2.esent"))
.Receive("System.Int", "rhino.queues://localhost/test_queue");

Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/InitBus.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<bus threadCount="1"
numberOfRetries="5"
endpoint="msmq://localhost/init_test"
Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/LoadBalancer.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<loadBalancer threadCount="1"
endpoint="msmq://localhost/test.balancer"
readyForWorkEndpoint="msmq://localhost/test.balancer.acceptingwork" />
Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/OneWayBus.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<messages>
<add name="System.String"
endpoint="msmq://localhost/test_queue"/>
Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/OneWayBusRhinoQueues.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<messages>
<add name="System.String"
endpoint="rhino.queues://localhost/test_queue"/>
Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/ReceiveOneWayBusRhinoQueues.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<bus name="test_queue"
threadCount="1"
numberOfRetries="5"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Xunit;
using Rhino.Queues.Monitoring;
using Xunit.Sdk;
using Rhino.ServiceBus.RhinoQueues;

namespace Rhino.ServiceBus.Tests.RhinoQueues
{
Expand All @@ -30,6 +31,7 @@ public void Enabling_performance_counters_should_result_in_performance_counters_
Assert.Empty(inboundIntances);

var hostConfiguration = new HostConfiguration()
.AddAssembly(typeof(RhinoQueuesTransport).Assembly)
.EnablePerformanceCounters()
.Bus("rhino.queues://localhost/test_queue2", "test");

Expand Down
3 changes: 3 additions & 0 deletions Rhino.ServiceBus.Tests/RhinoQueues/RhinoQueues.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
<section name="rhino.esb" type="Rhino.ServiceBus.Config.BusConfigurationSection, Rhino.ServiceBus"/>
</configSections>
<rhino.esb>
<assemblies>
<add assembly="Rhino.ServiceBus.RhinoQueues" />
</assemblies>
<bus threadCount="1"
numberOfRetries="5"
endpoint="rhino.queues://localhost/test_queue2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Rhino.ServiceBus.Hosting;
using Rhino.ServiceBus.Impl;
using Xunit;
using Rhino.ServiceBus.RhinoQueues;

namespace Rhino.ServiceBus.Tests.RhinoQueues
{
Expand All @@ -27,6 +28,7 @@ public UsingOneWayBusWithAlternateStorageLocation()
Directory.Delete(defaultOneWayDirectory, true);

var hostConfiguration = new HostConfiguration()
.AddAssembly(typeof(RhinoQueuesTransport).Assembly)
.StoragePath(alternateStorageLocation)
.Receive("System.string", "rhino.queues://nowhere/no_queue");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Rhino.ServiceBus.Hosting;
using Rhino.ServiceBus.Impl;
using Xunit;
using Rhino.ServiceBus.RhinoQueues;

namespace Rhino.ServiceBus.Tests.RhinoQueues
{
Expand Down Expand Up @@ -31,6 +32,7 @@ public UsingOneWayBusWithBusNameSpecified()
Directory.Delete(alternateOneWayDirectory, true);

var hostConfiguration = new HostConfiguration()
.AddAssembly(typeof(RhinoQueuesTransport).Assembly)
.Bus(null, ALTERNATE_BUS_NAME)
.Receive("System.string", "rhino.queues://nowhere/no_queue");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Rhino.ServiceBus.Hosting;
using Rhino.ServiceBus.Impl;
using Xunit;
using Rhino.ServiceBus.RhinoQueues;

namespace Rhino.ServiceBus.Tests.RhinoQueues
{
Expand Down Expand Up @@ -33,6 +34,7 @@ public UsingRhinoQueuesBusWithAlternateStorageLocation()
}

var hostConfiguration = new HostConfiguration()
.AddAssembly(typeof(RhinoQueuesTransport).Assembly)
.StoragePath(alternateStorageLocation)
.Bus("rhino.queues://localhost/test_queue2", "test")
.Receive("Rhino.ServiceBus.Tests", "rhino.queues://localhost/test_queue");
Expand Down
5 changes: 3 additions & 2 deletions Rhino.ServiceBus/Config/OneWayBusConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ public void Configure(AbstractRhinoServiceBusConfiguration config, IBusContainer
var messageOwners = new List<MessageOwner>();
var messageOwnersReader = new MessageOwnersConfigReader(config.ConfigurationSection, messageOwners);
messageOwnersReader.ReadMessageOwners();
oneWayConfig.MessageOwners = messageOwners.ToArray();
if (messageOwnersReader.EndpointScheme.Equals("msmq", StringComparison.InvariantCultureIgnoreCase) == false)

if (!messageOwnersReader.EndpointScheme.Equals("msmq", StringComparison.InvariantCultureIgnoreCase))
return;

oneWayConfig.MessageOwners = messageOwners.ToArray();
builder.RegisterMsmqOneWay();
}
}
Expand Down
19 changes: 15 additions & 4 deletions Rhino.ServiceBus/Hosting/HostConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Rhino.ServiceBus.Config;
using Rhino.ServiceBus.Config;
using System.Reflection;

namespace Rhino.ServiceBus.Hosting
{
Expand All @@ -15,13 +16,15 @@ public class HostConfiguration
protected string LogEndpoint { get; set; }
private string Path { get; set; }
private bool EnablePerformanceCounter { get; set; }
private IDictionary<string, HostConfigMessageEndpoint> Messages { get; set; }
private IDictionary<string, HostConfigMessageEndpoint> Messages { get; set; }
private IList<Assembly> ScanAssemblies { get; set; }

public HostConfiguration()
{
ThreadCount = 1;
NumberOfRetries = 5;
Messages = new Dictionary<string, HostConfigMessageEndpoint>();
Messages = new Dictionary<string, HostConfigMessageEndpoint>();
ScanAssemblies = new List<Assembly>();
}

public HostConfiguration Bus(string endpoint)
Expand All @@ -40,6 +43,12 @@ public HostConfiguration Bus(string endpoint, string name, bool transactional)
Name = name;
Transactional = transactional;
return this;
}

public HostConfiguration AddAssembly(Assembly assembly)
{
ScanAssemblies.Add(assembly);
return this;
}

public HostConfiguration Threads(int threadCount)
Expand Down Expand Up @@ -111,7 +120,9 @@ public virtual BusConfigurationSection ToBusConfiguration()
config.Bus.Transactional = Transactional.ToString();
config.Bus.Path = Path;
config.Bus.EnablePerformanceCounters = EnablePerformanceCounter;
config.Security.Key = SecurityKey;
config.Security.Key = SecurityKey;
foreach (var assembly in ScanAssemblies)
config.Assemblies.Add(new AssemblyElement { Assembly = assembly });
foreach (var message in Messages)
{
config.MessageOwners.Add(new MessageOwnerElement
Expand Down
12 changes: 3 additions & 9 deletions Rhino.ServiceBus/Impl/AbstractRhinoServiceBusConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public abstract class AbstractRhinoServiceBusConfiguration
private BusConfigurationSection configurationSection;
private Action readConfiguration;
private IBusContainerBuilder busContainerBuilder;
protected List<Assembly> scanAssemblies = new List<Assembly>(new[] { typeof(IServiceBus).Assembly });


protected AbstractRhinoServiceBusConfiguration()
Expand All @@ -33,16 +34,9 @@ protected AbstractRhinoServiceBusConfiguration()
Transactional = TransactionalOptions.FigureItOut;
}

public virtual IEnumerable<Assembly> Assemblies
public IEnumerable<Assembly> Assemblies
{
get
{
yield return typeof(IServiceBus).Assembly;
AssemblyElementCollection assemblies;
if (ConfigurationSection != null && (assemblies = ConfigurationSection.Assemblies) != null)
foreach (AssemblyElement assembly in assemblies)
yield return assembly.Assembly;
}
get { return scanAssemblies; }
}

public Uri Endpoint { get; set; }
Expand Down
7 changes: 6 additions & 1 deletion Rhino.ServiceBus/Impl/OnewayRhinoServiceBusConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
using Rhino.ServiceBus.Config;
namespace Rhino.ServiceBus.Impl
{
public class OnewayRhinoServiceBusConfiguration : AbstractRhinoServiceBusConfiguration
{
protected override void ApplyConfiguration()
{
{
var assemblies = ConfigurationSection.Assemblies;
if (assemblies != null)
foreach (AssemblyElement assembly in assemblies)
scanAssemblies.Add(assembly.Assembly);
}

public MessageOwner[] MessageOwners { get; set; }
Expand Down
Loading

0 comments on commit 755f854

Please sign in to comment.