Author: tabish
Date: Fri Jan 23 10:40:21 2009
New Revision: 737139

URL: http://svn.apache.org/viewvc?rev=737139&view=rev
Log:
http://issues.apache.org/activemq/browse/AMQNET-106

Tweaks to the test case to ensure prefetch is set to zero.

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

Modified: 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs
URL: 
http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs?rev=737139&r1=737138&r2=737139&view=diff
==============================================================================
--- 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs
 (original)
+++ 
activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/OpenWire/PrefetchSizeZeroTest.cs
 Fri Jan 23 10:40:21 2009
@@ -14,60 +14,59 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-
-using System;
-using NUnit.Framework;
+
+using System;
+using NUnit.Framework;
 using Apache.NMS.Util;
+using Apache.NMS.ActiveMQ;
 using NUnit.Framework.Extensions;
 using System.Threading;
-
-namespace Apache.NMS.Test
-{
-       [TestFixture]
-       public class PrefetchSizeZeroTest : NMSTestSupport
-       {       
-        protected static string DESTINATION_NAME = 
"TestPrefetchSizeZero?consumer.prefetchSize=0";
-                       
-               [Test, Explicit]
-               public void TestZeroPrefetchSize()
-               {
+
+namespace Apache.NMS.Test
+{
+       [TestFixture]
+       public class PrefetchSizeZeroTest : NMSTestSupport
+       {       
+        protected static string DESTINATION_NAME = "TestPrefetchSizeZero";
+                       
+               [Test, Explicit]
+               public void TestZeroPrefetchSize()
+               {
                        using(IConnection connection = CreateConnection())
                        {
                                connection.Start();
-                               using(ISession session = 
connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
+                               using(Session session = 
(Session)connection.CreateSession(AcknowledgementMode.AutoAcknowledge))
                                {
                                        IDestination destination = 
SessionUtil.GetDestination(session, DESTINATION_NAME);
+                    session.PrefetchSize = 0;
                                        using(IMessageConsumer consumer = 
session.CreateConsumer(destination))
                                        using(IMessageProducer producer = 
session.CreateProducer(destination))
                                        {
                                                SendMessage(producer);
                         SendMessage(producer);
 
-                                               IMessage receivedMsg = 
consumer.Receive(TimeSpan.FromSeconds(5));
-                        Assert.IsNotNull(receivedMsg);
+                                               IMessage receivedMsg = 
consumer.Receive(TimeSpan.FromSeconds(5));
+                        Assert.IsNotNull(receivedMsg);
                         receivedMsg = 
consumer.Receive(TimeSpan.FromSeconds(5));
-                        Assert.IsNotNull(receivedMsg);
-                                               receivedMsg = 
consumer.Receive(TimeSpan.FromSeconds(5));
-                        Assert.IsNull(receivedMsg);
-                        
-                                               // Go inactive...
-                                               
Thread.Sleep(TimeSpan.FromSeconds(10));
+                        Assert.IsNotNull(receivedMsg);
+                                               receivedMsg = 
consumer.Receive(TimeSpan.FromSeconds(5));
+                        Assert.IsNull(receivedMsg);
 
                                                // Send another message.
                                                SendMessage(producer);
-                                               receivedMsg = 
consumer.Receive(TimeSpan.FromSeconds(5));
-                                               Assert.IsNotNull(receivedMsg);
+                        receivedMsg = 
consumer.Receive(TimeSpan.FromSeconds(5));
+                                               Assert.IsNotNull(receivedMsg);
                    
                                        }
                                }
-                       }
-               }
-       
+                       }
+               }
+       
                protected void SendMessage(IMessageProducer producer)
                {
                        IMessage request = producer.CreateMessage();
                        request.NMSType = "Test";
                        producer.Send(request);
-               }
-       }
-}
+               }
+       }
+}


Reply via email to