You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/01/21 16:38:14 UTC
svn commit: r901744 -
/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
Author: tabish
Date: Thu Jan 21 15:38:14 2010
New Revision: 901744
URL: http://svn.apache.org/viewvc?rev=901744&view=rev
Log:
https://issues.apache.org/activemq/browse/AMQNET-228
New test to ensure these values are set.
Modified:
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs?rev=901744&r1=901743&r2=901744&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/NMSConnectionFactoryTest.cs Thu Jan 21 15:38:14 2010
@@ -16,8 +16,12 @@
*/
using System;
+using System.Threading;
using System.Net.Sockets;
using Apache.NMS.Test;
+using Apache.NMS.ActiveMQ.Commands;
+using Apache.NMS.ActiveMQ.Transport;
+using Apache.NMS.ActiveMQ.Transport.Mock;
using NUnit.Framework;
using NUnit.Framework.Extensions;
@@ -26,6 +30,10 @@
[TestFixture]
public class NMSConnectionFactoryTest
{
+ private static String username = "guest";
+ private static String password = "guest";
+ private ConnectionInfo info = null;
+
[RowTest]
[Row("tcp://${activemqhost}:61616")]
[Row("activemq:tcp://${activemqhost}:61616")]
@@ -72,6 +80,38 @@
}
[Test]
+ public void TestConnectionSendsAuthenticationData()
+ {
+ NMSConnectionFactory factory = new NMSConnectionFactory("activemq:mock://localhost:61616");
+ Assert.IsNotNull(factory);
+ Assert.IsNotNull(factory.ConnectionFactory);
+ using(Connection connection = factory.CreateConnection(username, password) as Connection)
+ {
+ Assert.IsNotNull(connection);
+
+ MockTransport transport = (MockTransport) connection.ITransport.Narrow(typeof(MockTransport));
+
+ transport.OutgoingCommand = new CommandHandler(OnOutgoingCommand);
+
+ connection.Start();
+
+ Thread.Sleep(1000);
+
+ Assert.IsNotNull(this.info);
+ Assert.AreEqual(username, info.UserName);
+ Assert.AreEqual(password, info.Password);
+ }
+ }
+
+ public void OnOutgoingCommand(ITransport transport, Command command)
+ {
+ if(command.IsConnectionInfo)
+ {
+ this.info = command as ConnectionInfo;
+ }
+ }
+
+ [Test]
public void TestURIForPrefetchHandling()
{
string uri1 = "activemq:tcp://${activemqhost}:61616" +