michaelandrepearce commented on a change in pull request #4: AMQNET-589: 
Failover implementation
URL: https://github.com/apache/activemq-nms-amqp/pull/4#discussion_r303258377
 
 

 ##########
 File path: test/Apache-NMS-AMQP-Test/Integration/ConnectionIntegrationTest.cs
 ##########
 @@ -0,0 +1,248 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 Apache.NMS;
+using Apache.NMS.AMQP;
+using Apache.NMS.Util;
+using NMS.AMQP.Test.TestAmqp;
+using NUnit.Framework;
+
+namespace NMS.AMQP.Test.Integration
+{
+    [TestFixture]
+    public class ConnectionIntegrationTest
+    {
+        private static readonly string User = "USER";
+        private static readonly string Password = "PASSWORD";
+        private static readonly string Address = "amqp://127.0.0.1:5672";
+
+        [Test, Timeout(2000)]
+        public void TestCreateAndCloseConnection()
+        {
+            using (TestAmqpPeer testAmqpPeer = new TestAmqpPeer(Address, User, 
Password))
+            {
+                testAmqpPeer.Open();
+                NmsConnectionFactory factory = new 
NmsConnectionFactory(Address);
+                IConnection connection = factory.CreateConnection(User, 
Password);
+                connection.Start();
+                connection.Close();
+            }
+        }
+
+        [Test, Timeout(2000)]
+        public void TestCreateAutoAckSession()
+        {
+            using (TestAmqpPeer testAmqpPeer = new TestAmqpPeer(Address, User, 
Password))
+            {
+                testAmqpPeer.Open();
+                NmsConnectionFactory factory = new 
NmsConnectionFactory(Address);
+                IConnection connection = factory.CreateConnection(User, 
Password);
+                connection.Start();
+                ISession session = 
connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
+                Assert.NotNull(session, "Session should not be null");
+                Assert.AreEqual(AcknowledgementMode.AutoAcknowledge, 
session.AcknowledgementMode);
+                connection.Close();
+            }
+        }
+
+        [Test, Timeout(2000)]
+        public void TestCreateAutoAckSessionByDefault()
+        {
+            using (TestAmqpPeer testAmqpPeer = new TestAmqpPeer(Address, User, 
Password))
+            {
+                testAmqpPeer.Open();
+                NmsConnectionFactory factory = new 
NmsConnectionFactory(Address);
+                IConnection connection = factory.CreateConnection(User, 
Password);
+                connection.Start();
+                ISession session = connection.CreateSession();
+                Assert.NotNull(session, "Session should not be null");
+                Assert.AreEqual(AcknowledgementMode.AutoAcknowledge, 
session.AcknowledgementMode);
+                connection.Close();
+            }
+        }
+
+        [Test, Timeout(2000)]
+        public void TestRemotelyCloseConnectionDuringSessionCreation()
+        {
 
 Review comment:
   This is a classical testing issue we have in artemis. Typically we tune the 
client or broker (by params) for such tests so they should timeout much faster 
thus ensuring test completes fast regardless. Also test timeouts tend to be 
60secs thus avoiding issue of someone having a super fast, or super slow 
machine 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to