activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1476371 - /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs
Date Fri, 26 Apr 2013 20:05:15 GMT
Author: tabish
Date: Fri Apr 26 20:05:15 2013
New Revision: 1476371

URL: http://svn.apache.org/r1476371
Log:
test for: https://issues.apache.org/jira/browse/AMQNET-424

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

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs?rev=1476371&r1=1476370&r2=1476371&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/MessageConsumerTest.cs
Fri Apr 26 20:05:15 2013
@@ -52,6 +52,42 @@ namespace Apache.NMS.ActiveMQ.Test
         }
 
         [Test]
+        public void TestBadSelectorDoesNotCloseConnection()
+        {
+            using (IConnection connection = CreateConnection(TEST_CLIENT_ID))
+            {
+                using (ISession sender = connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
+                using (ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
+                {
+					IDestination destination = sender.CreateTemporaryQueue();
+
+					IMessageProducer producer = sender.CreateProducer(destination);
+            		ITextMessage goodMsg = sender.CreateTextMessage("testGood");
+            		producer.Send(goodMsg);
+
+            		IMessageConsumer consumer = session.CreateConsumer(destination);
+            		connection.Start();            
+					Assert.NotNull(consumer.Receive(TimeSpan.FromMilliseconds(5000)));
+
+		            try
+		            {
+		                ISession badListenerSession = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
+		                badListenerSession.CreateConsumer(destination, "badSelector;too");
+		                Assert.Fail("Exception expected.");
+		            }
+		            catch(Exception e)
+		            {
+						Tracer.DebugFormat("Caught Ex: {0}", e);
+		            }
+
+		            ITextMessage failMsg = sender.CreateTextMessage("testFail");
+		            producer.Send(failMsg);
+					Assert.NotNull(consumer.Receive(TimeSpan.FromMilliseconds(5000)));
+	        	}
+			}
+		}
+
+        [Test]
         public void TestAsyncDispatchExceptionRedelivers()
         {
             using (IConnection connection = CreateConnection(TEST_CLIENT_ID))



Mime
View raw message