activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1324986 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/TempDestinationTest.cs
Date Wed, 11 Apr 2012 20:19:36 GMT
Author: tabish
Date: Wed Apr 11 20:19:36 2012
New Revision: 1324986

URL: http://svn.apache.org/viewvc?rev=1324986&view=rev
Log:
Update the test to ensure that producer sends are done sync, and ensure that stale messages
are read from the queue in the TestConsumeAfterPublishFailsForDestroyedTempDestination test
case

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/TempDestinationTest.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/TempDestinationTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/TempDestinationTest.cs?rev=1324986&r1=1324985&r2=1324986&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/TempDestinationTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/TempDestinationTest.cs
Wed Apr 11 20:19:36 2012
@@ -61,6 +61,7 @@ namespace Apache.NMS.ActiveMQ.Test
 		private Connection GetNewConnection()
 		{
 			Connection newConnection = CreateConnection() as Connection;
+			newConnection.AlwaysSyncSend = true;
 			connections.Add(newConnection);
 			return newConnection;
 		}
@@ -286,6 +287,11 @@ namespace Apache.NMS.ActiveMQ.Test
 			IMessageConsumer consumer = consumerSession.CreateConsumer(consumerDestination);
 
 			consumerConnection.Start();
+			
+			// Purge the destination before starting.
+			while (consumer.Receive(TimeSpan.FromMilliseconds(3000)) != null)
+			{
+			}			
 
 			// The real test is whether sending a message to a deleted temp queue messes up
 			// the consumers on the same connection.
@@ -297,7 +303,7 @@ namespace Apache.NMS.ActiveMQ.Test
 				IMessageProducer producer = producerSession.CreateProducer(producerDestination);
 				IDestination replyDestination = producerSession.CreateTemporaryQueue();
 				IMessageConsumer replyConsumer = producerSession.CreateConsumer(replyDestination);
-
+				
 				producerConnection.Start();
 
 				IMessage sendMsg = producer.CreateTextMessage("Consumer check.");
@@ -308,10 +314,11 @@ namespace Apache.NMS.ActiveMQ.Test
 				// Will the following Receive() call fail on the second or subsequent calls?
 				IMessage receiveMsg = consumer.Receive();
 				IMessageProducer replyProducer = consumerSession.CreateProducer(receiveMsg.NMSReplyTo);
-
+				
+				replyConsumer.Close();
 				connections.Remove(producerConnection);
 				producerConnection.Close();
-				Thread.Sleep(1000); // Wait a little bit to let the delete take effect.
+				Thread.Sleep(2000); // Wait a little bit to let the delete take effect.
 
 				// This message delivery NOT should work since the temp destination was removed by closing
the connection.
 				try



Mime
View raw message