You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2014/01/03 23:53:56 UTC

svn commit: r1555273 - in /activemq/activemq-dotnet/Apache.NMS.MQTT/trunk: src/main/csharp/Commands/PUBCOMP.cs src/test/csharp/MQTTSessionTest.cs vs2008-mqtt-tests.csproj

Author: tabish
Date: Fri Jan  3 22:53:56 2014
New Revision: 1555273

URL: http://svn.apache.org/r1555273
Log:
https://issues.apache.org/jira/browse/AMQNET-458


Added:
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/MQTTSessionTest.cs   (with props)
Modified:
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/PUBCOMP.cs
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt-tests.csproj

Modified: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/PUBCOMP.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/PUBCOMP.cs?rev=1555273&r1=1555272&r2=1555273&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/PUBCOMP.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/PUBCOMP.cs Fri Jan  3 22:53:56 2014
@@ -21,7 +21,7 @@ using Apache.NMS.MQTT.Protocol;
 
 namespace Apache.NMS.MQTT.Commands
 {
-	public class PUBCOMP : BaseCommand
+	public class PUBCOMP : Response
 	{
 		public const byte TYPE = 7;
 		public const byte DEFAULT_HEADER = 0x70;
@@ -43,6 +43,16 @@ namespace Apache.NMS.MQTT.Commands
 		{
 			get { return true; }
 		}
+
+        public override void Encode(BinaryWriter writer)
+        {
+            writer.Write(CommandId);
+        }
+
+        public override void Decode(BinaryReader reader)
+        {
+            CorrelationId = reader.ReadInt16();
+        }
 	}
 }
 

Added: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/MQTTSessionTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/MQTTSessionTest.cs?rev=1555273&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/MQTTSessionTest.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/MQTTSessionTest.cs Fri Jan  3 22:53:56 2014
@@ -0,0 +1,70 @@
+//
+// 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.Test;
+using Apache.NMS.MQTT;
+using NUnit.Framework;
+
+namespace Apache.NMS.MQTT.Test
+{
+    [TestFixture]
+    public class MQTTSessionTest : NMSTestSupport
+    {
+        private IConnection connection;
+
+        [SetUp]
+        public void SetUp()
+        {
+            Apache.NMS.Tracer.Trace = new NmsConsoleTracer();
+            base.SetUp();
+            connection = CreateConnection();
+        }
+
+        [TearDown]
+        public override void TearDown()
+        {
+            base.TearDown();
+
+            if (connection != null)
+            {
+                connection.Close();
+            }
+        }
+
+        [Test]
+        public void TestCanCreateAutoAckSession()
+        {
+            ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
+            Assert.AreEqual(AcknowledgementMode.AutoAcknowledge, session.AcknowledgementMode);
+        }
+
+        [Test]
+        public void TestCanCreateClientAckSession()
+        {
+            ISession session = connection.CreateSession(AcknowledgementMode.ClientAcknowledge);
+            Assert.AreEqual(AcknowledgementMode.ClientAcknowledge, session.AcknowledgementMode);
+        }
+
+        [Test]
+        [TestCase(ExpectedException = typeof(NotSupportedException))]
+        public void TestCannotCreateTransactedAckSession()
+        {
+            connection.CreateSession(AcknowledgementMode.Transactional);
+        }
+    }
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/MQTTSessionTest.cs
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt-tests.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt-tests.csproj?rev=1555273&r1=1555272&r2=1555273&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt-tests.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt-tests.csproj Fri Jan  3 22:53:56 2014
@@ -49,6 +49,7 @@
     <Compile Include="src\test\csharp\NMSConnectionFactoryTest.cs" />
     <Compile Include="src\test\csharp\NmsConsoleTracer.cs" />
     <Compile Include="src\test\csharp\ConnectionFactoryTest.cs" />
+    <Compile Include="src\test\csharp\MQTTSessionTest.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="LICENSE.txt" />