various misc build fixes/.csproj maintenance
This commit is contained in:
@@ -47,6 +47,7 @@ namespace Spring.Data.NHibernate
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class SessionFactoryUtilsTests
|
public class SessionFactoryUtilsTests
|
||||||
{
|
{
|
||||||
|
#if !NET_1_1
|
||||||
[Test]
|
[Test]
|
||||||
public void SessionFactoryUtilsWithGetDbProvider()
|
public void SessionFactoryUtilsWithGetDbProvider()
|
||||||
{
|
{
|
||||||
@@ -68,7 +69,7 @@ namespace Spring.Data.NHibernate
|
|||||||
|
|
||||||
mockery.VerifyAll();
|
mockery.VerifyAll();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace Spring.Messaging.Core
|
|||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class MessageQueueTemplateTests : AbstractDependencyInjectionSpringContextTests
|
public class MessageQueueTemplateTests : AbstractDependencyInjectionSpringContextTests
|
||||||
{
|
{
|
||||||
|
#if NET_2_0 || NET_3_0
|
||||||
[Test]
|
[Test]
|
||||||
public void MessageCreator()
|
public void MessageCreator()
|
||||||
{
|
{
|
||||||
@@ -72,7 +72,7 @@ namespace Spring.Messaging.Core
|
|||||||
mqt.MessageQueueFactory.RegisterMessageQueue("fooQueueDefinition", sc.CreateQueue );
|
mqt.MessageQueueFactory.RegisterMessageQueue("fooQueueDefinition", sc.CreateQueue );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
public class SimpleCreator
|
public class SimpleCreator
|
||||||
{
|
{
|
||||||
public MessageQueue CreateQueue()
|
public MessageQueue CreateQueue()
|
||||||
|
|||||||
@@ -1,106 +0,0 @@
|
|||||||
#region License
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright <20> 2002-2007 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Imports
|
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Messaging;
|
|
||||||
using System.Threading;
|
|
||||||
using NUnit.Framework;
|
|
||||||
using Spring.Messaging.Core;
|
|
||||||
using Spring.Testing.NUnit;
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
namespace Spring.Messaging.Listener
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This class contains tests for SimpleMessageListenerContainer
|
|
||||||
/// </summary>
|
|
||||||
/// <author>Mark Pollack</author>
|
|
||||||
/// <version>$Id:$</version>
|
|
||||||
[TestFixture]
|
|
||||||
public class SimpleMessageListenerContainerTests : AbstractDependencyInjectionSpringContextTests
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
[Test, ExpectedException(typeof(ArgumentException), ExpectedMessage = "Property 'DefaultMessageQueue' is required")]
|
|
||||||
public void EnsureMessageQueuePropertyIsSet()
|
|
||||||
{
|
|
||||||
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
|
|
||||||
container.AfterPropertiesSet();
|
|
||||||
container.Start();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
|
||||||
public void SendAndAsyncReceive()
|
|
||||||
{
|
|
||||||
|
|
||||||
SimpleMessageListenerContainer container =
|
|
||||||
applicationContext["simpleMessageListenerContainer"] as SimpleMessageListenerContainer;
|
|
||||||
SimpleMessageListener listener = applicationContext["simpleMessageListener"] as SimpleMessageListener;
|
|
||||||
Assert.IsNotNull(container);
|
|
||||||
Assert.IsNotNull(listener);
|
|
||||||
|
|
||||||
MessageQueueTemplate q = applicationContext["queue"] as MessageQueueTemplate;
|
|
||||||
Assert.IsNotNull(q);
|
|
||||||
q.ConvertAndSend("Hello World 1");
|
|
||||||
|
|
||||||
int waitInMillis = 2000;
|
|
||||||
Thread.Sleep(waitInMillis);
|
|
||||||
Assert.AreEqual(0, listener.MessageCount);
|
|
||||||
|
|
||||||
container.Start();
|
|
||||||
//pick up the message that is already in the queue
|
|
||||||
Thread.Sleep(waitInMillis);
|
|
||||||
Assert.AreEqual(1, listener.MessageCount);
|
|
||||||
|
|
||||||
container.Stop();
|
|
||||||
q.ConvertAndSend("Hello World 2");
|
|
||||||
|
|
||||||
//what happens to this message, we stopped, so no new event is fired.
|
|
||||||
Thread.Sleep(waitInMillis);
|
|
||||||
Assert.AreEqual(1, listener.MessageCount);
|
|
||||||
|
|
||||||
container.Start();
|
|
||||||
Thread.Sleep(waitInMillis);
|
|
||||||
//did we get hello world 2?
|
|
||||||
Assert.AreEqual(2, listener.MessageCount);
|
|
||||||
|
|
||||||
/*
|
|
||||||
q.ConvertAndSend("Hello World");
|
|
||||||
|
|
||||||
Thread.Sleep(waitInMillis);
|
|
||||||
Assert.AreEqual(2, listener.MessageCount);
|
|
||||||
*/
|
|
||||||
container.Stop();
|
|
||||||
container.Shutdown();
|
|
||||||
Thread.Sleep(waitInMillis);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
protected override string[] ConfigLocations
|
|
||||||
{
|
|
||||||
get { return new string[] { "assembly://Spring.Messaging.Tests/Spring.Messaging.Listener/SimpleMessageListenerContainerTests.xml" }; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<objects xmlns="http://www.springframework.net">
|
|
||||||
|
|
||||||
|
|
||||||
<object id='msqueue' type='Spring.Messaging.Support.MessageQueueFactoryObject, Spring.Messaging'>
|
|
||||||
<property name='Path' value='.\Private$\testqueue'/>
|
|
||||||
<property name='ProductTemplate'>
|
|
||||||
<object>
|
|
||||||
<property name='Label' value='MyLabel'/>
|
|
||||||
</object>
|
|
||||||
</property>
|
|
||||||
</object>
|
|
||||||
|
|
||||||
<object id="queue" type="Spring.Messaging.Core.MessageQueueTemplate, Spring.Messaging">
|
|
||||||
<property name="MessageQueueName" value="msqueue"/>
|
|
||||||
<property name="MessageConverter" ref="messageConverter"/>
|
|
||||||
</object>
|
|
||||||
|
|
||||||
<object id="messageConverter" type="Spring.Messaging.Support.Converters.XmlMessageConverter, Spring.Messaging">
|
|
||||||
<property name="TargetTypes" value="System.String"/>
|
|
||||||
</object>
|
|
||||||
|
|
||||||
<object id="simpleMessageListenerContainer" type="Spring.Messaging.Listener.SimpleMessageListenerContainer, Spring.Messaging">
|
|
||||||
<property name="MessageQueue" ref="msqueue"/>
|
|
||||||
<property name="MessageListener" ref="simpleMessageListener"/>
|
|
||||||
<property name="ExceptionHandler">
|
|
||||||
<object type="Spring.Messaging.Listener.LoggingExceptionHandler, Spring.Messaging.Tests"/>
|
|
||||||
</property>
|
|
||||||
<property name="AutoStartup" value="false"/>
|
|
||||||
</object>
|
|
||||||
|
|
||||||
<object id="simpleMessageListener" type="Spring.Messaging.Listener.SimpleMessageListener, Spring.Messaging.Tests"/>
|
|
||||||
|
|
||||||
</objects>
|
|
||||||
@@ -83,7 +83,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Messaging\Listener\NonTransactionalMessageListenerContainerTests.xml" />
|
<EmbeddedResource Include="Messaging\Listener\NonTransactionalMessageListenerContainerTests.xml" />
|
||||||
<EmbeddedResource Include="Messaging\Listener\SimpleMessageListenerContainerTests.xml" />
|
|
||||||
<EmbeddedResource Include="Messaging\Listener\TransactionalMessageListenerContainerTests.xml" />
|
<EmbeddedResource Include="Messaging\Listener\TransactionalMessageListenerContainerTests.xml" />
|
||||||
<EmbeddedResource Include="Messaging\queue-context.xml" />
|
<EmbeddedResource Include="Messaging\queue-context.xml" />
|
||||||
<EmbeddedResource Include="Messaging\Core\MessageQueueTemplateTests.xml" />
|
<EmbeddedResource Include="Messaging\Core\MessageQueueTemplateTests.xml" />
|
||||||
@@ -106,9 +105,6 @@
|
|||||||
<Compile Include="Messaging\Listener\SimpleMessageListener.cs">
|
<Compile Include="Messaging\Listener\SimpleMessageListener.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Messaging\Listener\SimpleMessageListenerContainerTests.cs">
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Messaging\Listener\TransactionalMessageListenerContainerTests.cs">
|
<Compile Include="Messaging\Listener\TransactionalMessageListenerContainerTests.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
@@ -84,7 +84,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="Messaging\Listener\NonTransactionalMessageListenerContainerTests.xml" />
|
<EmbeddedResource Include="Messaging\Listener\NonTransactionalMessageListenerContainerTests.xml" />
|
||||||
<EmbeddedResource Include="Messaging\Listener\SimpleMessageListenerContainerTests.xml" />
|
|
||||||
<EmbeddedResource Include="Messaging\Listener\TransactionalMessageListenerContainerTests.xml" />
|
<EmbeddedResource Include="Messaging\Listener\TransactionalMessageListenerContainerTests.xml" />
|
||||||
<EmbeddedResource Include="Messaging\queue-context.xml" />
|
<EmbeddedResource Include="Messaging\queue-context.xml" />
|
||||||
<EmbeddedResource Include="Messaging\Core\MessageQueueTemplateTests.xml" />
|
<EmbeddedResource Include="Messaging\Core\MessageQueueTemplateTests.xml" />
|
||||||
@@ -107,9 +106,6 @@
|
|||||||
<Compile Include="Messaging\Listener\SimpleMessageListener.cs">
|
<Compile Include="Messaging\Listener\SimpleMessageListener.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="Messaging\Listener\SimpleMessageListenerContainerTests.cs">
|
|
||||||
<SubType>Code</SubType>
|
|
||||||
</Compile>
|
|
||||||
<Compile Include="Messaging\Listener\TransactionalMessageListenerContainerTests.cs">
|
<Compile Include="Messaging\Listener\TransactionalMessageListenerContainerTests.cs">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
|||||||
Reference in New Issue
Block a user