summaryrefslogtreecommitdiff
path: root/dotnet
diff options
context:
space:
mode:
authorRupert Smith <rupertlssmith@apache.org>2008-01-28 17:22:09 +0000
committerRupert Smith <rupertlssmith@apache.org>2008-01-28 17:22:09 +0000
commite6d9d9b869c81af27a031ec9ab88b2143a9d20d2 (patch)
tree06dbaa8ca889dfc8bc8eac75c5d75e849a8c0a54 /dotnet
parent5b060554268c763cb883a102b04be21741551161 (diff)
downloadqpid-python-e6d9d9b869c81af27a031ec9ab88b2143a9d20d2.tar.gz
QPID-763 : Client was not setting prefetch count and size the wrong way around. Also, size was too small to let messages through, as was set to 1. Messages now getting through.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2.1@615960 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet')
-rw-r--r--dotnet/Qpid.Client/Client/AMQConnection.cs5
-rw-r--r--dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs4
-rw-r--r--dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs3
-rw-r--r--dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs50
4 files changed, 23 insertions, 39 deletions
diff --git a/dotnet/Qpid.Client/Client/AMQConnection.cs b/dotnet/Qpid.Client/Client/AMQConnection.cs
index d74cf6b5e4..d0bebf1170 100644
--- a/dotnet/Qpid.Client/Client/AMQConnection.cs
+++ b/dotnet/Qpid.Client/Client/AMQConnection.cs
@@ -816,10 +816,7 @@ namespace Apache.Qpid.Client
if (ProtocolInitiation.CURRENT_PROTOCOL_VERSION_MAJOR != 7)
{
// Basic.Qos frame appears to not be supported by OpenAMQ 1.0d.
- _protocolWriter.SyncWrite(
- BasicQosBody.CreateAMQFrame(
- channelId, (uint)prefetchHigh, 0, false),
- typeof (BasicQosOkBody));
+ _protocolWriter.SyncWrite(BasicQosBody.CreateAMQFrame(channelId, 0, (ushort)prefetchHigh, false), typeof (BasicQosOkBody));
}
if (transacted)
diff --git a/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs b/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs
index aac0d7f780..f6d511034f 100644
--- a/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs
+++ b/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs
@@ -44,7 +44,7 @@ namespace Apache.Qpid.Integration.Tests.testcases
private const long RECEIVE_WAIT = 500;
/// <summary> The default AMQ connection URL to use for tests. </summary>
- const string connectionUri = "amqp://guest:guest@test/test?brokerlist='tcp://localhost:5672'";
+ public const string connectionUri = "amqp://guest:guest@test/test?brokerlist='tcp://localhost:5672'";
/// <summary> The default AMQ connection URL parsed as a connection info. </summary>
protected IConnectionInfo connectionInfo;
@@ -112,7 +112,7 @@ namespace Apache.Qpid.Integration.Tests.testcases
testConnection[n] = new AMQConnection(connectionInfo);
testConnection[n].Start();
- testChannel[n] = testConnection[n].CreateChannel(transacted, ackMode, 1);
+ testChannel[n] = testConnection[n].CreateChannel(transacted, ackMode);
if (producer)
{
diff --git a/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs b/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs
index 83a9267fc2..1ab8d79250 100644
--- a/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs
+++ b/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs
@@ -82,7 +82,8 @@ namespace Apache.Qpid.Integration.Tests.testcases
{
// Ensure that the base init method is called. It establishes a connection with the broker.
base.Init();
-
+
+ connectionInfo = QpidConnectionInfo.FromUrl(connectionUri);
_connection = new AMQConnection(connectionInfo);
_channel = _connection.CreateChannel(false, AcknowledgeMode.AutoAcknowledge, 500, 300);
diff --git a/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs b/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs
index a35ee7bb02..6cfdad1f94 100644
--- a/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs
+++ b/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs
@@ -49,6 +49,9 @@ namespace Apache.Qpid.Integration.Tests.testcases
/// <summary>Defines the maximum time in milliseconds, to wait for redelivery to occurr.</summary>
public const int TIMEOUT = 1000;
+ /// <summary>Defines the name of the routing key to use with the tests.</summary>
+ public const string TEST_ROUTING_KEY = "unboundkey";
+
/// <summary>Condition used to coordinate receipt of redelivery exception to the sending thread.</summary>
private ManualResetEvent errorEvent;
@@ -66,29 +69,14 @@ namespace Apache.Qpid.Integration.Tests.testcases
{
base.Init();
- _connection = new AMQConnection(connectionInfo);
- _channel = _connection.CreateChannel(false, AcknowledgeMode.AutoAcknowledge, 500, 300);
-
errorEvent = new ManualResetEvent(false);
lastErrorException = null;
- _connection.ExceptionListener = new ExceptionListenerDelegate(OnException);
-
- _connection.Start();
}
[TearDown]
public override void Shutdown()
{
- try
- {
- _connection.Stop();
- _connection.Close();
- _connection.Dispose();
- }
- finally
- {
- base.Shutdown();
- }
+ base.Shutdown();
}
/// <summary>
@@ -103,12 +91,6 @@ namespace Apache.Qpid.Integration.Tests.testcases
}
[Test]
- public void SendUndeliverableMessageOnDefaultExchange()
- {
- SendOne(null);
- }
-
- [Test]
public void SendUndeliverableMessageOnDirectExchange()
{
SendOne(ExchangeNameDefaults.DIRECT);
@@ -135,19 +117,21 @@ namespace Apache.Qpid.Integration.Tests.testcases
private void SendOne(string exchangeName)
{
log.Debug("private void SendOne(string exchangeName = " + exchangeName + "): called");
-
+
// Send a test message to a unbound key on the specified exchange.
- MessagePublisherBuilder builder = _channel.CreatePublisherBuilder()
- .WithRoutingKey("unboundkey")
- .WithMandatory(true);
+ SetUpEndPoint(0, false, false, TEST_ROUTING_KEY + testId, AcknowledgeMode.AutoAcknowledge, false, exchangeName,
+ true, false, null);
+ testProducer[0] = testChannel[0].CreatePublisherBuilder()
+ .WithRoutingKey(TEST_ROUTING_KEY + testId)
+ .WithMandatory(true)
+ .WithExchangeName(exchangeName)
+ .Create();
- if ( exchangeName != null )
- {
- builder.WithExchangeName(exchangeName);
- }
+ // Set up the exception listener on the connection.
+ testConnection[0].ExceptionListener = new ExceptionListenerDelegate(OnException);
- IMessagePublisher publisher = builder.Create();
- publisher.Send(_channel.CreateTextMessage("Test Message"));
+ // Send message that should fail.
+ testProducer[0].Send(testChannel[0].CreateTextMessage("Test Message"));
// Wait for up to the timeout for a redelivery exception to be returned.
errorEvent.WaitOne(TIMEOUT, true);
@@ -158,6 +142,8 @@ namespace Apache.Qpid.Integration.Tests.testcases
Assert.IsNotNull(ex, "No exception was thrown by the test. Expected " + expectedException);
Assert.IsInstanceOfType(expectedException, ex.InnerException);
+
+ CloseEndPoint(0);
}
}
}