SPRNET-1288 - auto-start not parsed correctly in TIBCO EMS/ActiveMQ message listener container schema.

SPRNET-1280 - Create integration test project for TIBCO EMS
This commit is contained in:
markpollack
2009-12-04 21:45:50 +00:00
parent e0a750df0b
commit b9dc751d4d
9 changed files with 68 additions and 16 deletions

View File

@@ -239,7 +239,7 @@ namespace Spring.Messaging.Nms.Config
if (containerElement.HasAttribute(AUTO_STARTUP))
{
string autoStartup = containerElement.GetAttribute(AUTO_STARTUP);
if (!StringUtils.HasText(autoStartup))
if (StringUtils.HasText(autoStartup))
{
containerDef.AddPropertyValue("AutoStartup", autoStartup);
}

View File

@@ -22,9 +22,9 @@
using System.Collections;
using NUnit.Framework;
using Rhino.Mocks;
using Spring.Context;
using Spring.Context.Support;
using Spring.Messaging.Ems.Common;
using Spring.Messaging.Ems.Listener;
using Spring.Objects.Factory.Xml;
using TIBCO.EMS;
@@ -48,14 +48,12 @@ namespace Spring.Messaging.Ems.Config
private IApplicationContext ctx;
private MockRepository mocks;
[SetUp]
public void Setup()
{
NamespaceParserRegistry.RegisterParser(typeof(EmsNamespaceParser));
ctx = new XmlApplicationContext(ReadOnlyXmlTestResource.GetFilePath("EmsNamespaceHandlerTests.xml", GetType()));
mocks = new MockRepository();
}
[Test]
@@ -75,8 +73,9 @@ namespace Spring.Messaging.Ems.Config
public void ContainerConfiguration()
{
IDictionary containers = ctx.GetObjectsOfType(typeof (SimpleMessageListenerContainer));
ConnectionFactory defaultConnectionFactory = (ConnectionFactory) ctx.GetObject(DEFAULT_CONNECTION_FACTORY);
ConnectionFactory explicitConnectionFactory = (ConnectionFactory) ctx.GetObject(EXPLICIT_CONNECTION_FACTORY);
EmsConnectionFactory defaultConnectionFactory = (EmsConnectionFactory)ctx.GetObject(DEFAULT_CONNECTION_FACTORY);
defaultConnectionFactory = (EmsConnectionFactory)ctx.GetObject(DEFAULT_CONNECTION_FACTORY);
EmsConnectionFactory explicitConnectionFactory = (EmsConnectionFactory)ctx.GetObject(EXPLICIT_CONNECTION_FACTORY);
int defaultConnectionFactoryCount = 0;

View File

@@ -11,13 +11,13 @@
response-destination="responseDestination"/>
</nms:listener-container>
<nms:listener-container>
<nms:listener-container auto-startup="false">
<nms:listener destination="testDestination" ref="testObject3"/>
</nms:listener-container>
<!-- the default ConnectionFactory -->
<object id="connectionFactory" type="Spring.Messaging.Ems.Common.EmsConnectionFactory, Spring.Messaging.Ems">
<object id="ConnectionFactory" type="Spring.Messaging.Ems.Common.EmsConnectionFactory, Spring.Messaging.Ems">
<constructor-arg index="0" value="tcp://localhost:7222"/>
</object>
@@ -38,7 +38,7 @@
<object id="testObject2" type="Spring.Objects.TestObject, Spring.Core.Tests"/>
<object id="testObject3" type="Spring.Messaging.Ems.Connections.TestMessageListener, Spring.Messaging.Ems.Tests"/>
<object id="testObject3" type="Spring.Messaging.Ems.Connections.TestMessageListener, Spring.Messaging.Ems.Integration.Tests"/>
<object type="Spring.Objects.Factory.Config.VariablePlaceholderConfigurer, Spring.Core">
<property name="VariableSources">

View File

@@ -0,0 +1,52 @@
#region License
/*
* Copyright 2002-2008 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
using TIBCO.EMS;
namespace Spring.Messaging.Ems.Connections
{
/// <summary>
///
/// </summary>
/// <remarks>
///
/// </remarks>
/// <author>Mark Pollack</author>
public class TestMessageListener : IMessageListener
{
private string message;
public string Message
{
get { return message; }
set { message = value; }
}
#region IMessageListener Members
public void OnMessage(Message message)
{
this.message = "Test1";
}
#endregion
}
}

View File

@@ -24,7 +24,7 @@ namespace Spring.Messaging.Ems.Core
LOG.Info("Message Text = " + textMessage.Text);
} else
{
LOG.Warn("Can not process message of type " message.GetType());
LOG.Warn("Can not process message of type " + message.GetType());
}
}
}

View File

@@ -54,6 +54,8 @@
<Link>CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Messaging\Ems\Config\EmsNamespaceHandlerTests.cs" />
<Compile Include="Messaging\Ems\Connections\TestMessageListener.cs" />
<Compile Include="Messaging\Ems\Core\EmsTemplateTests.cs" />
<Compile Include="Messaging\Ems\Core\SimpleGateway.cs" />
<Compile Include="Messaging\Ems\Core\SimpleMessageListener.cs" />
@@ -91,6 +93,9 @@
<ItemGroup>
<EmbeddedResource Include="Messaging\Ems\Core\EmsTemplateTests.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Messaging\Ems\Config\EmsNamespaceHandlerTests.xml" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

View File

@@ -37,8 +37,8 @@ namespace Spring.Messaging.Ems.Integration
/// This class contains integration tests for the SimpleMessageListenerContainer
/// </summary>
/// <author>Mark Pollack</author>
/// <version>$Id:$</version>
[TestFixture]
[Ignore]
public class SimpleMessageListenerContainerTests : AbstractDependencyInjectionSpringContextTests
{

View File

@@ -35,7 +35,7 @@ namespace Spring.Messaging.Ems.Jndi
public class JndiLookupFactoryObjectTests
{
[Test]
[ExpectedException(typeof(ArgumentException))]
[ExpectedException(typeof(ConfigurationException))]
public void NoJndiName()
{
JndiLookupFactoryObject jfo = new JndiLookupFactoryObject();

View File

@@ -102,7 +102,6 @@
<Link>CommonAssemblyInfo.cs</Link>
</Compile>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="Messaging\Ems\Config\EmsNamespaceHandlerTests.cs" />
<Compile Include="Messaging\Ems\Connections\CachingConnectionFactoryTests.cs" />
<Compile Include="Messaging\Ems\Connections\MessageTransactionManagerTests.cs" />
<Compile Include="Messaging\Ems\Connections\SingleConnectionFactoryTests.cs" />
@@ -125,9 +124,6 @@
<ItemGroup>
<EmbeddedResource Include="Messaging\Ems\Integration\SimpleMessageListenerContainerTests.xml" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Messaging\Ems\Config\EmsNamespaceHandlerTests.xml" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
<Visible>False</Visible>