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 2013/11/26 17:53:42 UTC

svn commit: r1545724 - in /activemq/activemq-dotnet/Apache.NMS.MQTT/trunk: ./ src/main/csharp/ src/main/csharp/Commands/ src/test/csharp/ src/test/csharp/Protocol/

Author: tabish
Date: Tue Nov 26 16:53:42 2013
New Revision: 1545724

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

Implementation

Added:
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/Protocol/
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/Protocol/HeaderTest.cs   (with props)
Modified:
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/Apache.NMS.MQTT.Test.nunit
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/Header.cs
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/CommonAssemblyInfo.cs
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/CommonAssemblyInfo.cs
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt-tests.csproj
    activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt.csproj

Modified: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/Apache.NMS.MQTT.Test.nunit
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/Apache.NMS.MQTT.Test.nunit?rev=1545724&r1=1545723&r2=1545724&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/Apache.NMS.MQTT.Test.nunit (original)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/Apache.NMS.MQTT.Test.nunit Tue Nov 26 16:53:42 2013
@@ -1,7 +1,6 @@
 <NUnitProject>
   <Settings activeconfig="Default" />
   <Config name="Default" binpathtype="Auto">
-    <assembly path="Apache.NMS.Test.dll" />
     <assembly path="Apache.NMS.MQTT.Test.dll" />
   </Config>
 </NUnitProject>
\ No newline at end of file

Modified: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/Header.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/Header.cs?rev=1545724&r1=1545723&r2=1545724&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/Header.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/Commands/Header.cs Tue Nov 26 16:53:42 2013
@@ -16,23 +16,38 @@
 //
 using System;
 
-namespace vs2008mqtt
+namespace Apache.NMS.MQTT.Commands
 {
 	public class Header
 	{
 		private byte value;
 
+		public Header(int commandType, int qos, bool dup, bool retain)
+		{
+			Type = commandType;
+			QoS = qos;
+			Dup = dup;
+			Retain = retain;
+		}
+
 		public Header(byte value)
 		{
+			this.value = value;
+		}
+
+		public byte RawValue
+		{
+			get { return this.value; }
+			set { this.value = value; }
 		}
 
 		public int Type
 		{
-			get { return (this.value & 0x0F) >> 4; }
+			get { return (this.value & 0xF0) >> 4; }
 			set
 			{
-				this.value &= 0xF0;
-				this.value |= (byte)((value << 4) & 0x0F);
+				this.value &= 0x0F;
+				this.value |= (byte)((value << 4) & 0xF0);
 			}
 		}
 
@@ -41,14 +56,14 @@ namespace vs2008mqtt
 			get { return (this.value & 0x06) >> 1; }
 			set
 			{
-				this.value &= 0x06;
+				this.value &= 0xF9;
 				this.value |= (byte)((value << 1) & 0x06);
 			}
 		}
 
 		public bool Dup
 		{
-			get { return (this.value & 0x80) > 0; }
+			get { return (this.value & 0x08) > 0; }
 			set
 			{
 				if (value)

Modified: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/CommonAssemblyInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/CommonAssemblyInfo.cs?rev=1545724&r1=1545723&r2=1545724&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/CommonAssemblyInfo.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/main/csharp/CommonAssemblyInfo.cs Tue Nov 26 16:53:42 2013
@@ -22,6 +22,6 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2013 Apache Software Foundation")]
 [assembly: AssemblyTrademarkAttribute("")]
 [assembly: AssemblyCultureAttribute("")]
-[assembly: AssemblyVersionAttribute("1.7.0.3250")]
+[assembly: AssemblyVersionAttribute("1.7.0.3251")]
 [assembly: AssemblyInformationalVersionAttribute("1.7.0")]
 

Modified: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/CommonAssemblyInfo.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/CommonAssemblyInfo.cs?rev=1545724&r1=1545723&r2=1545724&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/CommonAssemblyInfo.cs (original)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/CommonAssemblyInfo.cs Tue Nov 26 16:53:42 2013
@@ -22,6 +22,6 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyCopyrightAttribute("Copyright (C) 2005-2013 Apache Software Foundation")]
 [assembly: AssemblyTrademarkAttribute("")]
 [assembly: AssemblyCultureAttribute("")]
-[assembly: AssemblyVersionAttribute("1.7.0.3250")]
+[assembly: AssemblyVersionAttribute("1.7.0.3251")]
 [assembly: AssemblyInformationalVersionAttribute("1.7.0")]
 

Added: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/Protocol/HeaderTest.cs
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/Protocol/HeaderTest.cs?rev=1545724&view=auto
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/Protocol/HeaderTest.cs (added)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/Protocol/HeaderTest.cs Tue Nov 26 16:53:42 2013
@@ -0,0 +1,53 @@
+//
+// 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.Commands;
+using NUnit.Framework;
+
+namespace Apache.NMS.MQTT.Test.Protocol
+{
+	[TestFixture]
+	public class HeaderTest
+	{
+		public HeaderTest()
+		{
+		}
+
+        [Test]
+		public void TestHeaderProperties()
+		{
+			Header header = new Header(1, 0, false, false);
+
+			Assert.AreEqual(1, header.Type, "Wrong Type returned");
+			Assert.AreEqual(0, header.QoS, "Wrong QoS returned");
+			Assert.AreEqual(false, header.Dup, "Wrong Dup flag returned");
+			Assert.AreEqual(false, header.Retain, "Wrong Retain flag returned");
+
+			header.Type = 2;
+			header.QoS = 1;
+			header.Retain = true;
+			header.Dup = true;
+
+			Assert.AreEqual(2, header.Type, "Wrong Type returned");
+			Assert.AreEqual(1, header.QoS, "Wrong QoS returned");
+			Assert.AreEqual(true, header.Dup, "Wrong Dup flag returned");
+			Assert.AreEqual(true, header.Retain, "Wrong Retain flag returned");
+		}
+	}
+}
+

Propchange: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/src/test/csharp/Protocol/HeaderTest.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=1545724&r1=1545723&r2=1545724&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 Tue Nov 26 16:53:42 2013
@@ -32,6 +32,30 @@
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="System" />
+    <Reference Include="Apache.NMS">
+      <HintPath>build\mono-2.0\debug\Apache.NMS.dll</HintPath>
+    </Reference>
+    <Reference Include="Apache.NMS.Test">
+      <HintPath>build\mono-2.0\debug\Apache.NMS.Test.dll</HintPath>
+    </Reference>
+    <Reference Include="nunit.framework">
+      <HintPath>build\mono-2.0\debug\nunit.framework.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <ItemGroup>
+    <Compile Include="src\test\csharp\CommonAssemblyInfo.cs" />
+    <Compile Include="src\test\csharp\Protocol\HeaderTest.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="LICENSE.txt" />
+    <None Include="Apache.NMS.MQTT.Test.nunit" />
+    <None Include="nmsprovider-test.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="vs2008-mqtt.csproj">
+      <Project>{AEBC857B-D693-4833-9F1E-F6A22787D0C9}</Project>
+      <Name>vs2008-mqtt</Name>
+    </ProjectReference>
+  </ItemGroup>
 </Project>
\ No newline at end of file

Modified: activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt.csproj
URL: http://svn.apache.org/viewvc/activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt.csproj?rev=1545724&r1=1545723&r2=1545724&view=diff
==============================================================================
--- activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt.csproj (original)
+++ activemq/activemq-dotnet/Apache.NMS.MQTT/trunk/vs2008-mqtt.csproj Tue Nov 26 16:53:42 2013
@@ -104,6 +104,9 @@
     <Compile Include="src\main\csharp\Transport\LoggingTransport.cs" />
     <Compile Include="src\main\csharp\Transport\MutexTransport.cs" />
     <Compile Include="src\main\csharp\Transport\ResponseCorrelator.cs" />
+    <Compile Include="src\main\csharp\Transport\ErrorResponse.cs" />
+    <Compile Include="src\main\csharp\Protocol\MQTTExceptionFactory.cs" />
+    <Compile Include="src\main\csharp\Commands\Header.cs" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="keyfile\" />