activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r383072 [2/2] - in /incubator/activemq/trunk/openwire-dotnet: ./ src/ tests/ tests/ActiveMQ/ tests/ActiveMQ/OpenWire/
Date Sat, 04 Mar 2006 08:19:10 GMT
Modified: incubator/activemq/trunk/openwire-dotnet/tests/ActiveMQ/TransactionTest.cs
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-dotnet/tests/ActiveMQ/TransactionTest.cs?rev=383072&r1=383071&r2=383072&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-dotnet/tests/ActiveMQ/TransactionTest.cs (original)
+++ incubator/activemq/trunk/openwire-dotnet/tests/ActiveMQ/TransactionTest.cs Sat Mar  4
00:19:09 2006
@@ -1,290 +1,287 @@
-/*
- * Copyright 2006 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-using System;
-using System.IO;
-
-using NUnit.Framework;
-
-using OpenWire.Client;
-using OpenWire.Client.Core;
-using System.Collections;
-
-namespace OpenWire.Client
-{
-    [TestFixture]
-    public class TransactionTest : TestSupport
-    {
-        private static int destinationCounter;
-        
-        IDestination destination;
-        IConnection connection;
-        ISession session;
-        IMessageProducer producer;
-        IMessageConsumer consumer;
-        
-        [SetUp]
-        public void SetUp()
-        {
-            Connect();
-            
-            // lets consume any outstanding messages from previous test runs
-            while (consumer.Receive(1000) != null)
-            {
-            }
-            session.Commit();
-        }
-        
-        
-        
-        [TearDown]
-        public void TearDown()
-        {
-            Disconnect();
-        }
-        
-        [Test]
-        public void TestSendRollback()
-        {
-            IMessage[] outbound = new IMessage[]{
-                session.CreateTextMessage("First Message"),
-                session.CreateTextMessage("Second Message")
-            };
-            
-            //sends a message
-            producer.Send(outbound[0]);
-            session.Commit();
-            
-            //sends a message that gets rollbacked
-            producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
-            session.Rollback();
-            
-            //sends a message
-            producer.Send(outbound[1]);
-            session.Commit();
-            
-            //receives the first message
-            ArrayList messages = new ArrayList();
-            Console.WriteLine("About to consume message 1");
-            IMessage message = consumer.Receive(1000);
-            messages.Add(message);
-            Console.WriteLine("Received: " + message);
-            
-            //receives the second message
-            Console.WriteLine("About to consume message 2");
-            message = consumer.Receive(4000);
-            messages.Add(message);
-            Console.WriteLine("Received: " + message);
-            
-            //validates that the rollbacked was not consumed
-            session.Commit();
-            IMessage[] inbound = new IMessage[messages.Count];
-            messages.CopyTo(inbound);
-            AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
-        }
-        
-        [Test]
-        public void TestSendSessionClose()
-        {
-            IMessage[] outbound = new IMessage[]{
-                session.CreateTextMessage("First Message"),
-                session.CreateTextMessage("Second Message")
-            };
-            
-            //sends a message
-            producer.Send(outbound[0]);
-            session.Commit();
-            
-            //sends a message that gets rollbacked
-            producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
-            consumer.Dispose();
-            session.Dispose();
-            
-            Reconnect();
-            
-            //sends a message
-            producer.Send(outbound[1]);
-            session.Commit();
-            
-            //receives the first message
-            ArrayList messages = new ArrayList();
-            Console.WriteLine("About to consume message 1");
-            IMessage message = consumer.Receive(1000);
-            messages.Add(message);
-            Console.WriteLine("Received: " + message);
-            
-            //receives the second message
-            Console.WriteLine("About to consume message 2");
-            message = consumer.Receive(4000);
-            messages.Add(message);
-            Console.WriteLine("Received: " + message);
-            
-            //validates that the rollbacked was not consumed
-            session.Commit();
-            IMessage[] inbound = new IMessage[messages.Count];
-            messages.CopyTo(inbound);
-            AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
-        }
-        
-        [Test]
-        public void TestReceiveRollback()
-        {
-            IMessage[] outbound = new IMessage[]{
-                session.CreateTextMessage("First Message"),
-                session.CreateTextMessage("Second Message")
-            };
-            
-            //sent both messages
-            producer.Send(outbound[0]);
-            producer.Send(outbound[1]);
-            session.Commit();
-            
-            Console.WriteLine("Sent 0: " + outbound[0]);
-            Console.WriteLine("Sent 1: " + outbound[1]);
-            
-            ArrayList messages = new ArrayList();
-            IMessage message = consumer.Receive(1000);
-            messages.Add(message);
-            Assert.AreEqual(outbound[0], message);
-            session.Commit();
-            
-            // rollback so we can get that last message again.
-            message = consumer.Receive(1000);
-            Assert.IsNotNull(message);
-            Assert.AreEqual(outbound[1], message);
-            session.Rollback();
-            
-            // Consume again.. the previous message should
-            // get redelivered.
-            message = consumer.Receive(5000);
-            Assert.IsNotNull(message, "Should have re-received the message again!");
-            messages.Add(message);
-            session.Commit();
-            
-            IMessage[] inbound = new IMessage[messages.Count];
-            messages.CopyTo(inbound);
-            AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
-        }
-        
-        
-        [Test]
-        public void TestReceiveTwoThenRollback()
-        {
-            IMessage[] outbound = new IMessage[]{
-                session.CreateTextMessage("First Message"),
-                session.CreateTextMessage("Second Message")
-            };
-            
-            producer.Send(outbound[0]);
-            producer.Send(outbound[1]);
-            session.Commit();
-            
-            Console.WriteLine("Sent 0: " + outbound[0]);
-            Console.WriteLine("Sent 1: " + outbound[1]);
-            
-            ArrayList messages = new ArrayList();
-            IMessage message = consumer.Receive(1000);
-            AssertTextMessageEqual("first mesage received before rollback", outbound[0],
message);
-            
-            message = consumer.Receive(1000);
-            Assert.IsNotNull(message);
-            AssertTextMessageEqual("second message received before rollback", outbound[1],
message);
-            session.Rollback();
-            
-            // Consume again.. the previous message should
-            // get redelivered.
-            message = consumer.Receive(5000);
-            Assert.IsNotNull(message, "Should have re-received the first message again!");
-            messages.Add(message);
-            AssertTextMessageEqual("first message received after rollback", outbound[0],
message);
-            
-            message = consumer.Receive(5000);
-            Assert.IsNotNull(message, "Should have re-received the second message again!");
-            messages.Add(message);
-            AssertTextMessageEqual("second message received after rollback", outbound[1],
message);
-            
-            Assert.IsNull(consumer.ReceiveNoWait());
-            session.Commit();
-            
-            IMessage[] inbound = new IMessage[messages.Count];
-            messages.CopyTo(inbound);
-            AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
-        }
-        
-        protected override string CreateDestinationName()
-        {
-            // TODO - how can we get the test name?
-            return base.CreateDestinationName() + (++destinationCounter);
-        }
-        
-        protected void AssertTextMessagesEqual(String message, IMessage[] expected, IMessage[]
actual)
-        {
-            Assert.AreEqual(expected.Length, actual.Length, "Incorrect number of messages
received");
-            
-            for (int i = 0; i < expected.Length; i++)
-            {
-                AssertTextMessageEqual(message + ". Index: " + i, expected[i], actual[i]);
-            }
-        }
-        
-        protected void AssertTextMessageEqual(String message, IMessage expected, IMessage
actual)
-        {
-            Assert.IsTrue(expected is ITextMessage, "expected object not a text message");
-            Assert.IsTrue(actual is ITextMessage, "actual object not a text message");
-            
-            String expectedText = ((ITextMessage) expected).Text;
-            String actualText = ((ITextMessage) actual).Text;
-            
-            Assert.AreEqual(expectedText, actualText, message);
-        }
-        
-        protected void Connect()
-        {
-            IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
-            
-            connection = factory.CreateConnection();
-            
-            session = connection.CreateSession(AcknowledgementMode.Transactional);
-            
-            // reuse the same destination if we reconnect
-            if (destination == null)
-            {
-                destination = CreateDestination(session);
-            }
-            
-            consumer = session.CreateConsumer(destination);
-            
-            producer = session.CreateProducer(destination);
-        }
-        
-        
-        protected void Disconnect()
-        {
-            if (connection != null)
-            {
-                connection.Dispose();
-                connection = null;
-            }
-        }
-        
-        protected void Reconnect()
-        {
-            Disconnect();
-            Connect();
-        }
-        
-    }
-}
+/*
+ * Copyright 2006 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+using System;
+using System.IO;
+
+using NUnit.Framework;
+using System.Collections;
+
+namespace ActiveMQ
+{
+    [TestFixture]
+    public class TransactionTest : TestSupport
+    {
+        private static int destinationCounter;
+        
+        IDestination destination;
+        IConnection connection;
+        ISession session;
+        IMessageProducer producer;
+        IMessageConsumer consumer;
+        
+        [SetUp]
+        public void SetUp()
+        {
+            Connect();
+            
+            // lets consume any outstanding messages from previous test runs
+            while (consumer.Receive(1000) != null)
+            {
+            }
+            session.Commit();
+        }
+        
+        
+        
+        [TearDown]
+        public void TearDown()
+        {
+            Disconnect();
+        }
+        
+        [Test]
+        public void TestSendRollback()
+        {
+            IMessage[] outbound = new IMessage[]{
+                session.CreateTextMessage("First Message"),
+                session.CreateTextMessage("Second Message")
+            };
+            
+            //sends a message
+            producer.Send(outbound[0]);
+            session.Commit();
+            
+            //sends a message that gets rollbacked
+            producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
+            session.Rollback();
+            
+            //sends a message
+            producer.Send(outbound[1]);
+            session.Commit();
+            
+            //receives the first message
+            ArrayList messages = new ArrayList();
+            Console.WriteLine("About to consume message 1");
+            IMessage message = consumer.Receive(1000);
+            messages.Add(message);
+            Console.WriteLine("Received: " + message);
+            
+            //receives the second message
+            Console.WriteLine("About to consume message 2");
+            message = consumer.Receive(4000);
+            messages.Add(message);
+            Console.WriteLine("Received: " + message);
+            
+            //validates that the rollbacked was not consumed
+            session.Commit();
+            IMessage[] inbound = new IMessage[messages.Count];
+            messages.CopyTo(inbound);
+            AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
+        }
+        
+        [Test]
+        public void TestSendSessionClose()
+        {
+            IMessage[] outbound = new IMessage[]{
+                session.CreateTextMessage("First Message"),
+                session.CreateTextMessage("Second Message")
+            };
+            
+            //sends a message
+            producer.Send(outbound[0]);
+            session.Commit();
+            
+            //sends a message that gets rollbacked
+            producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
+            consumer.Dispose();
+            session.Dispose();
+            
+            Reconnect();
+            
+            //sends a message
+            producer.Send(outbound[1]);
+            session.Commit();
+            
+            //receives the first message
+            ArrayList messages = new ArrayList();
+            Console.WriteLine("About to consume message 1");
+            IMessage message = consumer.Receive(1000);
+            messages.Add(message);
+            Console.WriteLine("Received: " + message);
+            
+            //receives the second message
+            Console.WriteLine("About to consume message 2");
+            message = consumer.Receive(4000);
+            messages.Add(message);
+            Console.WriteLine("Received: " + message);
+            
+            //validates that the rollbacked was not consumed
+            session.Commit();
+            IMessage[] inbound = new IMessage[messages.Count];
+            messages.CopyTo(inbound);
+            AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
+        }
+        
+        [Test]
+        public void TestReceiveRollback()
+        {
+            IMessage[] outbound = new IMessage[]{
+                session.CreateTextMessage("First Message"),
+                session.CreateTextMessage("Second Message")
+            };
+            
+            //sent both messages
+            producer.Send(outbound[0]);
+            producer.Send(outbound[1]);
+            session.Commit();
+            
+            Console.WriteLine("Sent 0: " + outbound[0]);
+            Console.WriteLine("Sent 1: " + outbound[1]);
+            
+            ArrayList messages = new ArrayList();
+            IMessage message = consumer.Receive(1000);
+            messages.Add(message);
+            Assert.AreEqual(outbound[0], message);
+            session.Commit();
+            
+            // rollback so we can get that last message again.
+            message = consumer.Receive(1000);
+            Assert.IsNotNull(message);
+            Assert.AreEqual(outbound[1], message);
+            session.Rollback();
+            
+            // Consume again.. the previous message should
+            // get redelivered.
+            message = consumer.Receive(5000);
+            Assert.IsNotNull(message, "Should have re-received the message again!");
+            messages.Add(message);
+            session.Commit();
+            
+            IMessage[] inbound = new IMessage[messages.Count];
+            messages.CopyTo(inbound);
+            AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
+        }
+        
+        
+        [Test]
+        public void TestReceiveTwoThenRollback()
+        {
+            IMessage[] outbound = new IMessage[]{
+                session.CreateTextMessage("First Message"),
+                session.CreateTextMessage("Second Message")
+            };
+            
+            producer.Send(outbound[0]);
+            producer.Send(outbound[1]);
+            session.Commit();
+            
+            Console.WriteLine("Sent 0: " + outbound[0]);
+            Console.WriteLine("Sent 1: " + outbound[1]);
+            
+            ArrayList messages = new ArrayList();
+            IMessage message = consumer.Receive(1000);
+            AssertTextMessageEqual("first mesage received before rollback", outbound[0],
message);
+            
+            message = consumer.Receive(1000);
+            Assert.IsNotNull(message);
+            AssertTextMessageEqual("second message received before rollback", outbound[1],
message);
+            session.Rollback();
+            
+            // Consume again.. the previous message should
+            // get redelivered.
+            message = consumer.Receive(5000);
+            Assert.IsNotNull(message, "Should have re-received the first message again!");
+            messages.Add(message);
+            AssertTextMessageEqual("first message received after rollback", outbound[0],
message);
+            
+            message = consumer.Receive(5000);
+            Assert.IsNotNull(message, "Should have re-received the second message again!");
+            messages.Add(message);
+            AssertTextMessageEqual("second message received after rollback", outbound[1],
message);
+            
+            Assert.IsNull(consumer.ReceiveNoWait());
+            session.Commit();
+            
+            IMessage[] inbound = new IMessage[messages.Count];
+            messages.CopyTo(inbound);
+            AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
+        }
+        
+        protected override string CreateDestinationName()
+        {
+            // TODO - how can we get the test name?
+            return base.CreateDestinationName() + (++destinationCounter);
+        }
+        
+        protected void AssertTextMessagesEqual(String message, IMessage[] expected, IMessage[]
actual)
+        {
+            Assert.AreEqual(expected.Length, actual.Length, "Incorrect number of messages
received");
+            
+            for (int i = 0; i < expected.Length; i++)
+            {
+                AssertTextMessageEqual(message + ". Index: " + i, expected[i], actual[i]);
+            }
+        }
+        
+        protected void AssertTextMessageEqual(String message, IMessage expected, IMessage
actual)
+        {
+            Assert.IsTrue(expected is ITextMessage, "expected object not a text message");
+            Assert.IsTrue(actual is ITextMessage, "actual object not a text message");
+            
+            String expectedText = ((ITextMessage) expected).Text;
+            String actualText = ((ITextMessage) actual).Text;
+            
+            Assert.AreEqual(expectedText, actualText, message);
+        }
+        
+        protected void Connect()
+        {
+            IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
+            
+            connection = factory.CreateConnection();
+            
+            session = connection.CreateSession(AcknowledgementMode.Transactional);
+            
+            // reuse the same destination if we reconnect
+            if (destination == null)
+            {
+                destination = CreateDestination(session);
+            }
+            
+            consumer = session.CreateConsumer(destination);
+            
+            producer = session.CreateProducer(destination);
+        }
+        
+        
+        protected void Disconnect()
+        {
+            if (connection != null)
+            {
+                connection.Dispose();
+                connection = null;
+            }
+        }
+        
+        protected void Reconnect()
+        {
+            Disconnect();
+            Connect();
+        }
+        
+    }
+}

Modified: incubator/activemq/trunk/openwire-dotnet/tests/tests.csproj
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/openwire-dotnet/tests/tests.csproj?rev=383072&r1=383071&r2=383072&view=diff
==============================================================================
--- incubator/activemq/trunk/openwire-dotnet/tests/tests.csproj (original)
+++ incubator/activemq/trunk/openwire-dotnet/tests/tests.csproj Sat Mar  4 00:19:09 2006
@@ -35,24 +35,24 @@
     </ItemGroup>
     <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets"/>
     <ItemGroup>
-        <Compile Include="OpenWire.Client\AsyncConsumeTest.cs"/>
-        <Compile Include="OpenWire.Client\BadConsumeTest.cs"/>
-        <Compile Include="OpenWire.Client\BytesMessageTest.cs"/>
-        <Compile Include="OpenWire.Client\ClientTest.cs"/>
-        <Compile Include="OpenWire.Client\CommandTest.cs"/>
-        <Compile Include="OpenWire.Client\ConsumerTest.cs"/>
-        <Compile Include="OpenWire.Client\Core\BooleanStreamTest.cs"/>
-        <Compile Include="OpenWire.Client\EndianTest.cs"/>
-        <Compile Include="OpenWire.Client\JMSPropertyTest.cs"/>
-        <Compile Include="OpenWire.Client\MapMessageTest.cs"/>
-        <Compile Include="OpenWire.Client\TestMain.cs"/>
-        <Compile Include="OpenWire.Client\TestSupport.cs"/>
-        <Compile Include="OpenWire.Client\TransactionTest.cs"/>
-    </ItemGroup>
-    <ItemGroup>
         <ProjectReference Include="../src/src.csproj">
             <Name>src</Name>
             <Project>{F7BA9EF7-ADF7-40EF-9A9E-206649DBB10C}</Project>
         </ProjectReference>
+    </ItemGroup>
+    <ItemGroup>
+        <Compile Include="ActiveMQ\AsyncConsumeTest.cs"/>
+        <Compile Include="ActiveMQ\BadConsumeTest.cs"/>
+        <Compile Include="ActiveMQ\BytesMessageTest.cs"/>
+        <Compile Include="ActiveMQ\ClientTest.cs"/>
+        <Compile Include="ActiveMQ\CommandTest.cs"/>
+        <Compile Include="ActiveMQ\ConsumerTest.cs"/>
+        <Compile Include="ActiveMQ\EndianTest.cs"/>
+        <Compile Include="ActiveMQ\JMSPropertyTest.cs"/>
+        <Compile Include="ActiveMQ\MapMessageTest.cs"/>
+        <Compile Include="ActiveMQ\OpenWire\BooleanStreamTest.cs"/>
+        <Compile Include="ActiveMQ\TestMain.cs"/>
+        <Compile Include="ActiveMQ\TestSupport.cs"/>
+        <Compile Include="ActiveMQ\TransactionTest.cs"/>
     </ItemGroup>
 </Project>



Mime
View raw message