Author: rupertlssmith
Date: Mon Jan 28 09:22:09 2008
New Revision: 615960
URL: http://svn.apache.org/viewvc?rev=615960&view=rev
Log:
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.
Modified:
incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/AMQConnection.cs
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs
Modified:
incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/AMQConnection.cs
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/AMQConnection.cs?rev=615960&r1=615959&r2=615960&view=diff
==============================================================================
--- incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/AMQConnection.cs
(original)
+++ incubator/qpid/branches/M2.1/dotnet/Qpid.Client/Client/AMQConnection.cs Mon
Jan 28 09:22:09 2008
@@ -816,10 +816,7 @@
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)
Modified:
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs?rev=615960&r1=615959&r2=615960&view=diff
==============================================================================
---
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs
(original)
+++
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/BaseMessagingTestFixture.cs
Mon Jan 28 09:22:09 2008
@@ -44,7 +44,7 @@
private const long RECEIVE_WAIT = 500;
/// <summary> The default AMQ connection URL to use for tests.
</summary>
- const string connectionUri = "amqp://guest:[EMAIL
PROTECTED]/test?brokerlist='tcp://localhost:5672'";
+ public const string connectionUri = "amqp://guest:[EMAIL
PROTECTED]/test?brokerlist='tcp://localhost:5672'";
/// <summary> The default AMQ connection URL parsed as a connection
info. </summary>
protected IConnectionInfo connectionInfo;
@@ -112,7 +112,7 @@
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)
{
Modified:
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs?rev=615960&r1=615959&r2=615960&view=diff
==============================================================================
---
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs
(original)
+++
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/HeadersExchangeTest.cs
Mon Jan 28 09:22:09 2008
@@ -82,7 +82,8 @@
{
// 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);
Modified:
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs
URL:
http://svn.apache.org/viewvc/incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs?rev=615960&r1=615959&r2=615960&view=diff
==============================================================================
---
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs
(original)
+++
incubator/qpid/branches/M2.1/dotnet/Qpid.Integration.Tests/testcases/MandatoryMessageTest.cs
Mon Jan 28 09:22:09 2008
@@ -49,6 +49,9 @@
/// <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 @@
{
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 @@
}
[Test]
- public void SendUndeliverableMessageOnDefaultExchange()
- {
- SendOne(null);
- }
-
- [Test]
public void SendUndeliverableMessageOnDirectExchange()
{
SendOne(ExchangeNameDefaults.DIRECT);
@@ -135,19 +117,21 @@
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);
-
- if ( exchangeName != null )
- {
- builder.WithExchangeName(exchangeName);
- }
+ 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();
- IMessagePublisher publisher = builder.Create();
- publisher.Send(_channel.CreateTextMessage("Test Message"));
+ // Set up the exception listener on the connection.
+ testConnection[0].ExceptionListener = new
ExceptionListenerDelegate(OnException);
+
+ // 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 @@
Assert.IsNotNull(ex, "No exception was thrown by the test.
Expected " + expectedException);
Assert.IsInstanceOfType(expectedException, ex.InnerException);
+
+ CloseEndPoint(0);
}
}
}