You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2010/09/03 17:32:50 UTC

svn commit: r992328 - /activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs

Author: tabish
Date: Fri Sep  3 15:32:50 2010
New Revision: 992328

URL: http://svn.apache.org/viewvc?rev=992328&view=rev
Log:
Handle exceptions from the DeleteDestination call, when caught we make an attempt to clear the destination so the tests start in a clean state.

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

Modified: activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs?rev=992328&r1=992327&r2=992328&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS/trunk/src/test/csharp/NMSTestSupport.cs Fri Sep  3 15:32:50 2010
@@ -379,8 +379,24 @@ namespace Apache.NMS.Test
         /// <returns></returns>
         public virtual IDestination CreateDestination(ISession session, string destinationName)
         {
-            SessionUtil.DeleteDestination(session, destinationName);
-            return SessionUtil.GetDestination(session, destinationName);
+			try
+			{
+            	SessionUtil.DeleteDestination(session, destinationName);
+			}
+			catch(Exception)
+			{
+				// Can't delete it, so lets try and purse it.
+				IDestination destination = SessionUtil.GetDestination(session, destinationName);
+				
+				using(IMessageConsumer consumer = session.CreateConsumer(destination))
+				{
+					while(consumer.Receive(TimeSpan.FromMilliseconds(2000)) != null)
+					{
+					}	
+				}
+			}
+
+			return SessionUtil.GetDestination(session, destinationName);
         }
 
         /// <summary>