activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r779609 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs
Date Thu, 28 May 2009 14:38:11 GMT
Author: tabish
Date: Thu May 28 14:38:11 2009
New Revision: 779609

URL: http://svn.apache.org/viewvc?rev=779609&view=rev
Log:
Clean up test: http://issues.apache.org/activemq/browse/AMQNET-153

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

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs?rev=779609&r1=779608&r2=779609&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/VirtualTopicTest.cs
Thu May 28 14:38:11 2009
@@ -30,7 +30,7 @@
 		protected static string CONSUMER_B_DESTINATION_NAME = "queue://Consumer.B.VirtualTopic.TestDestination";
 		protected static string TEST_CLIENT_ID = "VirtualTopicClientId";
 
-		protected const int totalMsgs = 100;
+		protected const int totalMsgs = 1;
 		protected AcknowledgementMode currentAckMode;
 		protected int receivedA;
 		protected int receivedB;
@@ -38,11 +38,11 @@
 #if !NET_1_1
 		[RowTest]
 		[Row(AcknowledgementMode.AutoAcknowledge, false)]
-		[Row(AcknowledgementMode.ClientAcknowledge, false)]
-		[Row(AcknowledgementMode.Transactional, false)]
+        [Row(AcknowledgementMode.ClientAcknowledge, false)]
+        [Row(AcknowledgementMode.Transactional, false)]
 
-		[Row(AcknowledgementMode.AutoAcknowledge, true)]
-		[Row(AcknowledgementMode.ClientAcknowledge, true)]
+        [Row(AcknowledgementMode.AutoAcknowledge, true)]
+        [Row(AcknowledgementMode.ClientAcknowledge, true)]
 		// Do not use listeners with transactional processing.
 #endif
 		public void SendReceiveVirtualTopicMessage(AcknowledgementMode ackMode, bool useListeners)
@@ -67,46 +67,57 @@
 							consumerB.Listener += MessageListenerB;
 						}
 
-						for(int index = 0; index < totalMsgs; index++)
-						{
-							producer.Send(session.CreateTextMessage("Message #" + index));
-							if(AcknowledgementMode.Transactional == currentAckMode)
-							{
-								session.Commit();
-							}
-
-							if(!useListeners)
-							{
-								IMessage messageA = consumerA.Receive(receiveTimeout);
-								IMessage messageB = consumerB.Receive(receiveTimeout);
-
-								Assert.IsNotNull(messageA, "Did not receive message for consumer A.");
-								Assert.IsNotNull(messageB, "Did not receive message for consumer B.");
-
-								if(AcknowledgementMode.Transactional == currentAckMode)
-								{
-									session.Commit();
-								}
-								else if(AcknowledgementMode.ClientAcknowledge == currentAckMode)
-								{
-									messageA.Acknowledge();
-									messageB.Acknowledge();
-								}
-							}
-						}
+                        for (int index = 0; index < totalMsgs; index++)
+                        {
+                            producer.Send(session.CreateTextMessage("Message #" + index));
+                        }
+
+                        if (AcknowledgementMode.Transactional == currentAckMode)
+                        {
+                            session.Commit();
+                        }
+
+                        if (!useListeners)
+                        {
+                            for (int index = 0; index < totalMsgs; index++)
+                            {
+                                IMessage messageA = consumerA.Receive(receiveTimeout);
+                                IMessage messageB = consumerB.Receive(receiveTimeout);
+
+                                Assert.IsNotNull(messageA, "Did not receive message for consumer
A.");
+                                Assert.IsNotNull(messageB, "Did not receive message for consumer
B.");
+
+                                if (AcknowledgementMode.ClientAcknowledge == currentAckMode)
+                                {
+                                    messageA.Acknowledge();
+                                    messageB.Acknowledge();
+                                }
+                            }
+                        }
+                        else
+                        {
+                            int waitCount = 0;
+                            while (receivedA < totalMsgs && receivedB < totalMsgs)
+                            {
+                                if (waitCount++ > 50)
+                                {
+                                    Assert.Fail("Timed out waiting for message consumers.
 A = " + receivedA + ", B = " + receivedB);
+                                }
+
+                                Thread.Sleep(250);
+                            }
+                        }
+					}
 
-						int waitCount = 0;
-						while(receivedA < totalMsgs && receivedB < totalMsgs)
-						{
-							if(waitCount++ > 50)
-							{
-								Assert.Fail("Timed out waiting for message consumers.  A = " + receivedA + ", B =
" + receivedB);
-							}
+                    if (AcknowledgementMode.Transactional == currentAckMode)
+                    {
+                        session.Commit();
+                    }
 
-							Thread.Sleep(250);
-						}
-					}
+                    session.Close();
 				}
+
+                connection.Close();
 			}
 		}
 



Mime
View raw message