summaryrefslogtreecommitdiff
path: root/qpid/dotnet/Qpid.Client.Tests
diff options
context:
space:
mode:
authorTomas Restrepo <tomasr@apache.org>2007-05-13 23:08:40 +0000
committerTomas Restrepo <tomasr@apache.org>2007-05-13 23:08:40 +0000
commitc50149d860f90d40b391d26110b35e101d80c808 (patch)
tree87ab822032524ebe1c20315fe84577d8f8e531e2 /qpid/dotnet/Qpid.Client.Tests
parente9a6d2e94a849b83b4a49b9d92392c382962d42e (diff)
downloadqpid-python-c50149d860f90d40b391d26110b35e101d80c808.tar.gz
Merged revisions 537673 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2 ........ r537673 | tomasr | 2007-05-13 18:03:30 -0500 (Sun, 13 May 2007) | 3 lines * QPID-486 Choose strongest SASL Mechanism first * Remove unnecessary wrapping of AMQExceptions on connection failure ........ git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@537676 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet/Qpid.Client.Tests')
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/Security/CallbackHandlerRegistryTests.cs11
-rw-r--r--qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs72
2 files changed, 32 insertions, 51 deletions
diff --git a/qpid/dotnet/Qpid.Client.Tests/Security/CallbackHandlerRegistryTests.cs b/qpid/dotnet/Qpid.Client.Tests/Security/CallbackHandlerRegistryTests.cs
index e18fa15c20..9dac69a483 100644
--- a/qpid/dotnet/Qpid.Client.Tests/Security/CallbackHandlerRegistryTests.cs
+++ b/qpid/dotnet/Qpid.Client.Tests/Security/CallbackHandlerRegistryTests.cs
@@ -39,6 +39,17 @@ namespace Qpid.Client.Tests.Security
Assert.IsNotNull(handlerType);
Assert.AreEqual(typeof(TestCallbackHandler), handlerType);
}
+
+ [Test]
+ public void MechanimsInOrder()
+ {
+ CallbackHandlerRegistry registry = CallbackHandlerRegistry.Instance;
+ Assert.AreEqual(4, registry.Mechanisms.Length);
+ Assert.AreEqual("TEST", registry.Mechanisms[0]);
+ Assert.AreEqual("EXTERNAL", registry.Mechanisms[1]);
+ Assert.AreEqual("CRAM-MD5", registry.Mechanisms[2]);
+ Assert.AreEqual("PLAIN", registry.Mechanisms[3]);
+ }
} // class CallbackRegistryHandlerTests
public class TestCallbackHandler : IAMQCallbackHandler
diff --git a/qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs b/qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs
index bcfbb3da20..d597b013bb 100644
--- a/qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs
+++ b/qpid/dotnet/Qpid.Client.Tests/connection/ConnectionTest.cs
@@ -28,12 +28,15 @@ namespace Qpid.Client.Tests.Connection
[TestFixture]
public class ConnectionTest
{
+ private AmqBrokerInfo _broker =
+ new AmqBrokerInfo("amqp", "localhost", 5672, false);
+
[Test]
public void SimpleConnection()
{
IConnectionInfo connectionInfo = new QpidConnectionInfo();
connectionInfo.VirtualHost = "test";
- connectionInfo.AddBrokerInfo(new AmqBrokerInfo("amqp", "localhost", 5672, false));
+ connectionInfo.AddBrokerInfo(_broker);
using (IConnection connection = new AMQConnection(connectionInfo))
{
Console.WriteLine("connection = " + connection);
@@ -41,62 +44,29 @@ namespace Qpid.Client.Tests.Connection
}
[Test]
+ [ExpectedException(typeof(AMQAuthenticationException))]
public void PasswordFailureConnection()
{
IConnectionInfo connectionInfo = new QpidConnectionInfo();
connectionInfo.VirtualHost = "test";
connectionInfo.Password = "rubbish";
- connectionInfo.AddBrokerInfo(new AmqBrokerInfo());
- try
- {
- using (IConnection connection = new AMQConnection(connectionInfo))
- {
- Console.WriteLine("connection = " + connection);
- // wrong
- Assert.Fail("Authentication succeeded but should've failed");
- }
- }
- catch (AMQException e)
+ connectionInfo.AddBrokerInfo(_broker);
+
+ using (IConnection connection = new AMQConnection(connectionInfo))
{
- if (!(e.InnerException is AMQAuthenticationException))
- {
- Assert.Fail("Expected AMQAuthenticationException!");
- }
- }
+ Console.WriteLine("connection = " + connection);
+ // wrong
+ Assert.Fail("Authentication succeeded but should've failed");
+ }
+ }
+
+ [Test]
+ [ExpectedException(typeof(AMQConnectionException))]
+ public void connectionFailure()
+ {
+ string url = "amqp://guest:guest@clientid/testpath?brokerlist='tcp://localhost:5673?retries='0''";
+ new AMQConnection(QpidConnectionInfo.FromUrl(url));
+ Assert.Fail("Connection should not be established");
}
-//
-// [Test]
-// public void connectionFailure()
-// {
-// try
-// {
-// new AMQConnection("amqp://guest:guest@clientid/testpath?brokerlist='tcp://localhost:5673?retries='0''");
-// Assert.fail("Connection should not be established");
-// }
-// catch (AMQException amqe)
-// {
-// if (!(amqe instanceof AMQConnectionException))
-// {
-// Assert.fail("Correct exception not thrown");
-// }
-// }
-// }
-//
-// [Test]
-// public void unresolvedHostFailure()
-// {
-// try
-// {
-// new AMQConnection("amqp://guest:guest@clientid/testpath?brokerlist='tcp://rubbishhost:5672?retries='0''");
-// Assert.fail("Connection should not be established");
-// }
-// catch (AMQException amqe)
-// {
-// if (!(amqe instanceof AMQUnresolvedAddressException))
-// {
-// Assert.fail("Correct exception not thrown");
-// }
-// }
-// }
}
}