activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tab...@apache.org
Subject svn commit: r1082721 - in /activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp: DtcBasicTransactionsTest.cs DtcConsumerTransactionsTest.cs DtcProducerTransactionsTest.cs DtcTransactionsTestSupport.cs
Date Thu, 17 Mar 2011 22:07:04 GMT
Author: tabish
Date: Thu Mar 17 22:07:04 2011
New Revision: 1082721

URL: http://svn.apache.org/viewvc?rev=1082721&view=rev
Log:
Doing some code cleanups to these test cases.

Modified:
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcBasicTransactionsTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcConsumerTransactionsTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcProducerTransactionsTest.cs
    activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcBasicTransactionsTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcBasicTransactionsTest.cs?rev=1082721&r1=1082720&r2=1082721&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcBasicTransactionsTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcBasicTransactionsTest.cs
Thu Mar 17 22:07:04 2011
@@ -15,12 +15,11 @@
  * limitations under the License.
  */
 
-using System;
 using System.Threading;
 using Apache.NMS.ActiveMQ.Transactions;
 using NUnit.Framework;
 
-namespace Apache.NMS.ActiveMQ.Test.src.test.csharp
+namespace Apache.NMS.ActiveMQ.Test
 {
     [TestFixture]
     [Category("Manual")]

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcConsumerTransactionsTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcConsumerTransactionsTest.cs?rev=1082721&r1=1082720&r2=1082721&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcConsumerTransactionsTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcConsumerTransactionsTest.cs
Thu Mar 17 22:07:04 2011
@@ -25,7 +25,7 @@ using Apache.NMS.ActiveMQ.Transport.Tcp;
 using Apache.NMS.Util;
 using NUnit.Framework;
 
-namespace Apache.NMS.ActiveMQ.Test.src.test.csharp
+namespace Apache.NMS.ActiveMQ.Test
 {
     [TestFixture]
     [Category("Manual")]

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcProducerTransactionsTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcProducerTransactionsTest.cs?rev=1082721&r1=1082720&r2=1082721&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcProducerTransactionsTest.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcProducerTransactionsTest.cs
Thu Mar 17 22:07:04 2011
@@ -22,7 +22,7 @@ using Apache.NMS.ActiveMQ.Transport;
 using Apache.NMS.ActiveMQ.Transport.Tcp;
 using NUnit.Framework;
 
-namespace Apache.NMS.ActiveMQ.Test.src.test.csharp
+namespace Apache.NMS.ActiveMQ.Test
 {
     [TestFixture]
     [Category("Manual")]

Modified: activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs?rev=1082721&r1=1082720&r2=1082721&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs
(original)
+++ activemq/activemq-dotnet/Apache.NMS.ActiveMQ/trunk/src/test/csharp/DtcTransactionsTestSupport.cs
Thu Mar 17 22:07:04 2011
@@ -220,8 +220,8 @@ namespace Apache.NMS.ActiveMQ.Test
                 using (ISession session = connection.CreateSession())
                 using (IMessageConsumer consumer = session.CreateConsumer(session.GetQueue(testQueueName)))
                 {
-                    IMessage recvd = consumer.Receive(TimeSpan.FromMilliseconds(3000));
-                    while (recvd != null)
+                    IMessage recvd;
+                    while ((recvd = consumer.Receive(TimeSpan.FromMilliseconds(3000))) !=
null)
                     {
                         Tracer.Debug("Setup Purged Message: " + recvd);
                     }
@@ -364,6 +364,67 @@ namespace Apache.NMS.ActiveMQ.Test
             VerifyBrokerQueueCount(0);
         }
 
+        protected static void VerifyBrokerStateNoRecover(int expectedNumberOfMessages)
+        {
+            IConnectionFactory factory = new ConnectionFactory(ReplaceEnvVar(connectionURI));
+
+            using (IConnection connection = factory.CreateConnection())
+            {
+                // check messages are present in the queue
+                using (ISession session = connection.CreateSession())
+                {
+                    IDestination queue = session.GetQueue(testQueueName);
+
+                    using (IMessageConsumer consumer = session.CreateConsumer(queue))
+                    {
+                        connection.Start();
+                        IMessage msg;
+
+                        for (int i = 0; i < expectedNumberOfMessages; ++i)
+                        {
+                            msg = consumer.Receive(TimeSpan.FromMilliseconds(2000));
+                            Assert.IsNotNull(msg, "message is not in the queue !");
+                        }
+
+                        // next message should be empty
+                        msg = consumer.Receive(TimeSpan.FromMilliseconds(2000));
+                        Assert.IsNull(msg, "message found but not expected !");
+                        consumer.Close();
+                    }
+                }
+
+                connection.Close();
+            }
+        }
+
+        protected static void VerifyBrokerHasMessagesInQueue(string connectionURI)
+        {
+            INetTxConnectionFactory factory = new NetTxConnectionFactory(ReplaceEnvVar(connectionURI));
+
+            using (INetTxConnection connection = factory.CreateNetTxConnection())
+            {
+                // check messages are present in the queue
+                using (INetTxSession session = connection.CreateNetTxSession())
+                {
+                    IDestination queue = session.GetQueue(testQueueName);
+
+                    using (IMessageConsumer consumer = session.CreateConsumer(queue))
+                    {
+                        connection.Start();
+
+                        for (int i = 0; i < MSG_COUNT; ++i)
+                        {
+                            IMessage msg = consumer.Receive(TimeSpan.FromMilliseconds(2000));
+                            Assert.IsNotNull(msg, "message is not in the queue !");
+                        }
+
+                        consumer.Close();
+                    }
+                }
+            }
+        }
+
+
         #endregion
 
         #region Transport Hools for controlling failure point.



Mime
View raw message