diff options
| author | Tomas Restrepo <tomasr@apache.org> | 2007-05-18 00:51:12 +0000 |
|---|---|---|
| committer | Tomas Restrepo <tomasr@apache.org> | 2007-05-18 00:51:12 +0000 |
| commit | dbe349500e458cdf38cd4e561d27c9fa24dff7ca (patch) | |
| tree | 2390c50d9a0d31506b6e9007ab7dfed5bb51ad16 /dotnet/Qpid.Client.Tests/requestreply1/ServiceRequestingClient.cs | |
| parent | ee94c939a9d77f0de6ae0cb33c782a9015bb8452 (diff) | |
| download | qpid-python-dbe349500e458cdf38cd4e561d27c9fa24dff7ca.tar.gz | |
Merged revisions 537954-538078,538080-538083,538085-538097,538099-538108,538110-538239,538241-538881,538883-538906,538908-538911,538913-538921,538923-539191 via svnmerge from
https://svn.apache.org/repos/asf/incubator/qpid/branches/M2
........
r537954 | tomasr | 2007-05-14 14:10:59 -0500 (Mon, 14 May 2007) | 4 lines
* QPID-487 (Contributed by Carlos Medina) Fix QpidConnectionInfo.ToString()
* QPID-485 (Contributed by Carlos Medina) Fix AmqBrokerInfo.Equals()
* QPID-456 Enforce virtual host names start with '/'
........
r538035 | tomasr | 2007-05-14 20:33:00 -0500 (Mon, 14 May 2007) | 6 lines
* QPID-452 Improve message classes API
* Add XML documentation to IChannel and IMessage
* Add missing BrokerDetailTests
* Add new tests for message creation and message factories
* Fix wrong default encoding for text messages
........
r539178 | tomasr | 2007-05-17 18:50:50 -0500 (Thu, 17 May 2007) | 6 lines
* QPID-492 Fix Race condition in message decoding
* QPID-249 Make ServiceRequestingClient and ServiceProvidingClient a single, self contained test
* Fix incorrect exception message in Qpid.Buffers, improve tests
* Make ContentBody use an sliced buffer to avoid extra data copy
* Remove useless tests in Qpid.Client (Blocking IO tests)
........
r539191 | tomasr | 2007-05-17 19:18:26 -0500 (Thu, 17 May 2007) | 1 line
QPID-490 (Contributed by Carlos Medina) Implement PurgeQueue and DeleteQueue
........
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@539198 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/Qpid.Client.Tests/requestreply1/ServiceRequestingClient.cs')
| -rw-r--r-- | dotnet/Qpid.Client.Tests/requestreply1/ServiceRequestingClient.cs | 64 |
1 files changed, 12 insertions, 52 deletions
diff --git a/dotnet/Qpid.Client.Tests/requestreply1/ServiceRequestingClient.cs b/dotnet/Qpid.Client.Tests/requestreply1/ServiceRequestingClient.cs index 4479d767ea..8264879c1f 100644 --- a/dotnet/Qpid.Client.Tests/requestreply1/ServiceRequestingClient.cs +++ b/dotnet/Qpid.Client.Tests/requestreply1/ServiceRequestingClient.cs @@ -26,18 +26,18 @@ using Qpid.Messaging; namespace Qpid.Client.Tests { - [TestFixture] public class ServiceRequestingClient : BaseMessagingTestFixture { private const int MESSAGE_SIZE = 1024; private static string MESSAGE_DATA = new string('x', MESSAGE_SIZE); - private const int NUM_MESSAGES = 10000; + private const int PACK = 100; + private const int NUM_MESSAGES = PACK*10; // increase when in standalone private static ILog _log = LogManager.GetLogger(typeof(ServiceRequestingClient)); - AutoResetEvent _finishedEvent = new AutoResetEvent(false); - + ManualResetEvent _finishedEvent = new ManualResetEvent(false); + private int _expectedMessageCount = NUM_MESSAGES; private long _startTime = 0; @@ -54,9 +54,9 @@ namespace Qpid.Client.Tests { _publisher = _channel.CreatePublisherBuilder() .WithRoutingKey(_commandQueueName) + .WithDeliveryMode(DeliveryMode.NonPersistent) .Create(); _publisher.DisableMessageTimestamp = true; // XXX: need a "with" for this in builder? - _publisher.DeliveryMode = DeliveryMode.NonPersistent; // XXX: need a "with" for this in builder? } catch (QpidException e) { @@ -64,7 +64,7 @@ namespace Qpid.Client.Tests } } - /*[Test] + [Test] public void SendMessages() { InitialiseProducer(); @@ -100,47 +100,18 @@ namespace Qpid.Client.Tests // Added timestamp. long timeNow = DateTime.Now.Ticks; string timeSentString = String.Format("{0:G}", timeNow); -// _log.Info(String.Format("timeSent={0} timeSentString={1}", timeNow, timeSentString)); - msg.Headers.SetString("timeSent", timeSentString); - //msg.Headers.SetLong("sentAt", timeNow); + msg.Headers.SetLong("timeSent", timeNow); - try - { - _publisher.Send(msg); - } - catch (Exception e) - { - _log.Error("Error sending message: " + e, e); - //base._port = 5673; - _log.Info("Reconnecting but on port 5673"); - try - { - base.Init(); - InitialiseProducer(); - // cheesy but a quick test - _log.Info("Calling SendMessages again"); - SendMessages(); - } - catch (Exception ex) - { - _log.Error("Totally busted: failed to reconnect: " + ex, ex); - } - } + _publisher.Send(msg); } // Assert that the test finishes within a reasonable amount of time. - const int waitSeconds = 10; + const int waitSeconds = 40; const int waitMilliseconds = waitSeconds * 1000; _log.Info("Finished sending " + _expectedMessageCount + " messages"); _log.Info(String.Format("Waiting {0} seconds to receive last message...", waitSeconds)); Assert.IsTrue(_finishedEvent.WaitOne(waitMilliseconds, false), String.Format("Expected to finish in {0} seconds", waitSeconds)); - }*/ - - [Test] - public void TestFail() - { - Assert.Fail("Tests in this class do not run on autopilot, but hang forever, so commented out until can be fixed."); } public void OnMessage(IMessage m) @@ -150,23 +121,19 @@ namespace Qpid.Client.Tests _log.Debug("Message received: " + m); } - //if (m.Headers.Contains("sentAt")) if (!m.Headers.Contains("timeSent")) { throw new Exception("Set timeSent!"); } - //long sentAt = m.Headers.GetLong("sentAt"); - long sentAt = Int64.Parse(m.Headers.GetString("timeSent")); + + long sentAt = m.Headers.GetLong("timeSent"); long now = DateTime.Now.Ticks; long latencyTicks = now - sentAt; -// _log.Info(String.Format("latency = {0} ticks ", latencyTicks)); long latencyMilliseconds = latencyTicks / TimeSpan.TicksPerMillisecond; -// _log.Info(String.Format("latency = {0} ms", latencyMilliseconds)); averager.Add(latencyMilliseconds); - // Output average every 1000 messages. - if (averager.Num % 1000 == 0) + if (averager.Num % PACK == 0) { _log.Info("Ticks per millisecond = " + TimeSpan.TicksPerMillisecond); _log.Info(String.Format("Average latency (ms) = {0}", averager)); @@ -185,13 +152,6 @@ namespace Qpid.Client.Tests _finishedEvent.Set(); // Notify main thread to quit. } } - - /*public static void Main(String[] args) - { - ServiceRequestingClient c = new ServiceRequestingClient(); - c.Init(); - c.SendMessages(); - }*/ } class Avergager |
