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>