summaryrefslogtreecommitdiff
path: root/qpid/dotnet/client-010/test
diff options
context:
space:
mode:
authorRajith Muditha Attapattu <rajith@apache.org>2011-05-27 15:44:23 +0000
committerRajith Muditha Attapattu <rajith@apache.org>2011-05-27 15:44:23 +0000
commit66765100f4257159622cefe57bed50125a5ad017 (patch)
treea88ee23bb194eb91f0ebb2d9b23ff423e3ea8e37 /qpid/dotnet/client-010/test
parent1aeaa7b16e5ce54f10c901d75c4d40f9f88b9db6 (diff)
parent88b98b2f4152ef59a671fad55a0d08338b6b78ca (diff)
downloadqpid-python-66765100f4257159622cefe57bed50125a5ad017.tar.gz
Creating a branch for experimenting with some ideas for JMS client.rajith_jms_client
git-svn-id: https://svn.apache.org/repos/asf/qpid/branches/rajith_jms_client@1128369 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/dotnet/client-010/test')
-rw-r--r--qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs65
-rw-r--r--qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs56
-rw-r--r--qpid/dotnet/client-010/test/Qpid Test.dll.config31
-rw-r--r--qpid/dotnet/client-010/test/Test.csproj102
-rw-r--r--qpid/dotnet/client-010/test/default.build55
-rw-r--r--qpid/dotnet/client-010/test/interop/Admin.cs90
-rw-r--r--qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs83
-rw-r--r--qpid/dotnet/client-010/test/interop/ConnectionTests.cs80
-rw-r--r--qpid/dotnet/client-010/test/interop/Message.cs180
-rw-r--r--qpid/dotnet/client-010/test/interop/TestCase.cs96
-rw-r--r--qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs106
-rw-r--r--qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs89
-rw-r--r--qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs103
-rw-r--r--qpid/dotnet/client-010/test/transport/util/SerialTest.cs75
-rw-r--r--qpid/dotnet/client-010/test/transport/util/UUIDTest.cs64
15 files changed, 1275 insertions, 0 deletions
diff --git a/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs b/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs
new file mode 100644
index 0000000000..883e52c264
--- /dev/null
+++ b/qpid/dotnet/client-010/test/Helpers/ConfigHelpers.cs
@@ -0,0 +1,65 @@
+/*
+ *
+ * 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 System.Collections.Generic;
+using System.IO;
+using System.Text;
+using System.Xml;
+using log4net.Config;
+
+namespace test.Helpers
+{
+ class ConfigHelpers
+ {
+ public static Dictionary<string, string> LoadConfig()
+ {
+ Dictionary<string, string> properties = new Dictionary<string, string>();
+
+ XmlConfigurator.Configure(new FileInfo("/log.xml"));
+ // populate default properties
+ properties.Add("Username", "guest");
+ properties.Add("Password", "guest");
+ properties.Add("Host", "localhost");
+ properties.Add("Port", "5672");
+ properties.Add("VirtualHost", "test");
+ //Read the test config file
+ XmlTextReader reader = new XmlTextReader(Environment.CurrentDirectory + "/Qpid Test.dll.config");
+ while (reader.Read())
+ {
+ // if node type is an element
+ if (reader.NodeType == XmlNodeType.Element && reader.Name.Equals("add"))
+ {
+ if (properties.ContainsKey(reader.GetAttribute("key")))
+ {
+ properties[reader.GetAttribute("key")] = reader.GetAttribute("value");
+ }
+ else
+ {
+ properties.Add(reader.GetAttribute("key"), reader.GetAttribute("value"));
+ }
+ }
+ }
+
+ return properties;
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000000..871d450240
--- /dev/null
+++ b/qpid/dotnet/client-010/test/Properties/AssemblyInfo.cs
@@ -0,0 +1,56 @@
+/*
+ *
+ * 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.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Qpid Test")]
+[assembly: AssemblyDescription("Built from svn revision number: ")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache Software Foundation")]
+[assembly: AssemblyProduct("Qpid Test")]
+[assembly: AssemblyCopyright("Apache Software Foundation")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("3d62cb4f-4353-4eed-9669-3e1bc902081d")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("0.5.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/qpid/dotnet/client-010/test/Qpid Test.dll.config b/qpid/dotnet/client-010/test/Qpid Test.dll.config
new file mode 100644
index 0000000000..2a2fb72b61
--- /dev/null
+++ b/qpid/dotnet/client-010/test/Qpid Test.dll.config
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!--
+
+ 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.
+
+-->
+
+<configuration>
+ <appSettings>
+ <add key="UserMame" value="guest"/>
+ <add key="Password" value="guest"/>
+ <add key="Host" value="localhost"/>
+ <add key="Port" value="5672"/>
+ <add key="VirtualHost" value="test"/>
+ </appSettings>
+</configuration>
diff --git a/qpid/dotnet/client-010/test/Test.csproj b/qpid/dotnet/client-010/test/Test.csproj
new file mode 100644
index 0000000000..a9cd7c18af
--- /dev/null
+++ b/qpid/dotnet/client-010/test/Test.csproj
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ -
+ - 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.
+ -
+ -->
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>9.0.30729</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{95CB4C90-7C53-44A9-B11C-96235F158ACA}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>test</RootNamespace>
+ <AssemblyName>Qpid Test</AssemblyName>
+ <FileUpgradeFlags>
+ </FileUpgradeFlags>
+ <OldToolsVersion>2.0</OldToolsVersion>
+ <UpgradeBackupLocation>
+ </UpgradeBackupLocation>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\log4net\log4net.dll</HintPath>
+ </Reference>
+ <Reference Include="nunit.framework, Version=2.2.8.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\lib\nunit\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="interop\ConnectionTests.cs" />
+ <Compile Include="Helpers\ConfigHelpers.cs" />
+ <Compile Include="interop\Admin.cs" />
+ <Compile Include="interop\ApplicationHeaders.cs" />
+ <Compile Include="interop\Message.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="interop\TestCase.cs" />
+ <Compile Include="transport\util\ByteEncoderTest.cs" />
+ <Compile Include="transport\util\CircularBufferTest.cs" />
+ <Compile Include="transport\util\ResultFutureTest.cs" />
+ <Compile Include="transport\util\SerialTest.cs" />
+ <Compile Include="transport\util\UUIDTest.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\client\Client.csproj">
+ <Project>{B911FFD7-754F-4735-A188-218D5065BE79}</Project>
+ <Name>Client</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="..\App.config">
+ <Link>App.config</Link>
+ </None>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/qpid/dotnet/client-010/test/default.build b/qpid/dotnet/client-010/test/default.build
new file mode 100644
index 0000000000..f9dadb174b
--- /dev/null
+++ b/qpid/dotnet/client-010/test/default.build
@@ -0,0 +1,55 @@
+<?xml version="1.0"?>
+<!--
+
+ 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.
+
+-->
+
+<project name="qpid.client.tests" default="build">
+ <!--
+ Properties that come from master build file
+ - build.dir: root directory for build
+ - build.debug: true if building debug release
+ - build.defines: variables to define during build
+ -->
+
+ <target name="build">
+ <csc target="library"
+ define="${build.defines}"
+ debug="${build.debug}"
+ output="${build.dir}/${project::get-name()}.dll">
+
+ <sources>
+ <include name="**/*.cs" />
+ </sources>
+ <references>
+ <include name="${build.dir}/log4net.dll" />
+ <include name="${build.dir}/nunit.framework.dll" />
+ <include name="${build.dir}/qpid.client.dll" />
+ </references>
+ </csc>
+ </target>
+
+ <target name="test" depends="build">
+ <nunit2>
+ <formatter type="${nant.formatter}" usefile="false" />
+ <test assemblyname="${build.dir}/qpid.client.tests.dll" />
+ </nunit2>
+ </target>
+</project>
+
diff --git a/qpid/dotnet/client-010/test/interop/Admin.cs b/qpid/dotnet/client-010/test/interop/Admin.cs
new file mode 100644
index 0000000000..163e4cf49a
--- /dev/null
+++ b/qpid/dotnet/client-010/test/interop/Admin.cs
@@ -0,0 +1,90 @@
+/*
+*
+* 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 NUnit.Framework;
+using org.apache.qpid.client;
+using org.apache.qpid.transport;
+using org.apache.qpid.transport.util;
+
+namespace test.interop
+{
+ public class Admin : TestCase
+ {
+ private static readonly Logger _log = Logger.Get(typeof(Admin));
+
+ [Test]
+ public void createSession()
+ {
+ _log.Debug("Running: CreateSession");
+ IClientSession ssn = Client.CreateSession(0);
+ ssn.Close();
+ // This test fails if an exception is thrown
+ }
+
+ [Test]
+ public void queueLifecycle()
+ {
+ _log.Debug("Running: queueLifecycle");
+ IClientSession ssn = Client.CreateSession(0);
+ ssn.QueueDeclare("queue1", null, null);
+ ssn.Sync();
+ ssn.QueueDelete("queue1");
+ ssn.Sync();
+ try
+ {
+ ssn.ExchangeBind("queue1", "amq.direct", "queue1", null);
+ ssn.Sync();
+ }
+ catch (SessionException)
+ {
+ // as expected
+ }
+ // This test fails if an exception is thrown
+ }
+
+ [Test]
+ public void exchangeCheck()
+ {
+ _log.Debug("Running: exchangeCheck");
+ IClientSession ssn = Client.CreateSession(0);
+ ExchangeQueryResult query = (ExchangeQueryResult) ssn.ExchangeQuery("amq.direct").Result;
+ Assert.IsFalse(query.GetNotFound());
+ Assert.IsTrue(query.GetDurable());
+ query = (ExchangeQueryResult)ssn.ExchangeQuery("amq.topic").Result;
+ Assert.IsFalse(query.GetNotFound());
+ Assert.IsTrue(query.GetDurable());
+ query = (ExchangeQueryResult) ssn.ExchangeQuery("foo").Result;
+ Assert.IsTrue(query.GetNotFound());
+ }
+
+ [Test]
+ public void exchangeBind()
+ {
+ _log.Debug("Running: ExchangeBind");
+ IClientSession ssn = Client.CreateSession(0);
+ ssn.QueueDeclare("queue1", null, null);
+ ssn.ExchangeBind("queue1", "amq.direct", "queue1", null);
+ // This test fails if an exception is thrown
+ }
+
+
+ }
+}
diff --git a/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs b/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs
new file mode 100644
index 0000000000..d932057fd2
--- /dev/null
+++ b/qpid/dotnet/client-010/test/interop/ApplicationHeaders.cs
@@ -0,0 +1,83 @@
+/*
+*
+* 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 common.org.apache.qpid.transport.util;
+using NUnit.Framework;
+using org.apache.qpid.client;
+using org.apache.qpid.transport.util;
+
+namespace test.interop
+{
+ public class ApplicationHeaders:TestCase
+ {
+ private static readonly Logger _log = Logger.Get(typeof(ApplicationHeaders));
+
+ [Test]
+ public void setHeaders()
+ {
+ _log.Debug("Running: setHeaders");
+ IClientSession ssn = Client.CreateSession(0);
+ ssn.QueueDeclare("queue1");
+ ssn.ExchangeBind("queue1", "amq.direct", "queue1");
+ ssn.Sync();
+ CircularBuffer<IMessage> buff = new CircularBuffer<IMessage>(10);
+ SyncListener listener = new SyncListener(ssn, buff);
+ ssn.AttachMessageListener(listener, "queue1");
+ ssn.MessageSubscribe("queue1");
+
+ IMessage message = new org.apache.qpid.client.Message();
+ message.DeliveryProperties.SetRoutingKey("queue1");
+ const long someLong = 14444444;
+ message.ApplicationHeaders.Add("someLong", someLong);
+ const int someInt = 14;
+ message.ApplicationHeaders.Add("soneInt", someInt);
+ const float someFloat = 14.001F;
+ message.ApplicationHeaders.Add("soneFloat", someFloat);
+ const double someDouble = 14.5555555;
+ message.ApplicationHeaders.Add("someDouble", someDouble);
+ const byte someByte = 2;
+ message.ApplicationHeaders.Add("someByte", someByte);
+ const string someString = "someString";
+ message.ApplicationHeaders.Add("someString", someString);
+ const char someChar = 'a';
+ message.ApplicationHeaders.Add("someChar", someChar);
+ const Boolean someBoolean = true;
+ message.ApplicationHeaders.Add("someBoolean", someBoolean);
+
+ // transfer the message
+ ssn.MessageTransfer("amq.direct", message);
+
+ // get the message and check the headers
+ IMessage messageBack = buff.Dequeue();
+ Assert.IsTrue(((string) messageBack.ApplicationHeaders["someString"]).Equals(someString));
+ Assert.IsTrue(((char)messageBack.ApplicationHeaders["someChar"]).Equals(someChar));
+ Assert.IsTrue((long)messageBack.ApplicationHeaders["someLong"] == someLong);
+ Assert.IsTrue((int)messageBack.ApplicationHeaders["soneInt"] == someInt);
+ Assert.IsTrue((double)messageBack.ApplicationHeaders["someDouble"] == someDouble);
+ Assert.IsTrue((byte) messageBack.ApplicationHeaders["someByte"] == someByte);
+ Assert.IsTrue((Boolean)messageBack.ApplicationHeaders["someBoolean"]);
+ // c# has an conversion precision issue with decimal
+ Assert.IsTrue((float) messageBack.ApplicationHeaders["soneFloat"] <= someFloat);
+ float b = (float) messageBack.ApplicationHeaders["soneFloat"];
+ Assert.IsTrue(Convert.ToInt32(b) == Convert.ToInt32(someFloat));
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/test/interop/ConnectionTests.cs b/qpid/dotnet/client-010/test/interop/ConnectionTests.cs
new file mode 100644
index 0000000000..37fd0e7933
--- /dev/null
+++ b/qpid/dotnet/client-010/test/interop/ConnectionTests.cs
@@ -0,0 +1,80 @@
+/*
+ *
+ * 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 System.Net.Sockets;
+using NUnit.Framework;
+using org.apache.qpid.client;
+using test.Helpers;
+
+namespace test
+{
+ [TestFixture]
+ public class ConnectionTests
+ {
+ [SetUp]
+ public void Setup()
+ {
+
+ }
+
+ [Test]
+ [ExpectedException(typeof(Exception))]
+ public void should_raise_exception_in_calling_thread_on_authentification_failure()
+ {
+ var properties = ConfigHelpers.LoadConfig();
+
+ var client = new Client();
+ client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"],
+ properties["Username"], "some silly password to make sure the authentification fail");
+ }
+
+ [Test]
+ [ExpectedException(typeof(Exception))]
+ public void should_raise_exception_in_calling_thread_on_authentification_failure_with_clodedListener()
+ {
+ var properties = ConfigHelpers.LoadConfig();
+
+ var client = new Client();
+ client.ClosedListener = new FakeListener();
+ client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"],
+ properties["Username"], "some silly password to make sure the authentification fail");
+ }
+
+ [Test]
+ public void should_not_block_on_close()
+ {
+ var properties = ConfigHelpers.LoadConfig();
+
+ var client = new Client();
+ client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"],
+ properties["Username"], properties["Password"]);
+ client.Close();
+ }
+ }
+
+ public class FakeListener : IClosedListener
+ {
+ public void OnClosed(ErrorCode errorCode, string reason, Exception t)
+ {
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/test/interop/Message.cs b/qpid/dotnet/client-010/test/interop/Message.cs
new file mode 100644
index 0000000000..107e69c287
--- /dev/null
+++ b/qpid/dotnet/client-010/test/interop/Message.cs
@@ -0,0 +1,180 @@
+/*
+*
+* 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 System.Text;
+using System.Threading;
+using NUnit.Framework;
+using org.apache.qpid.client;
+using org.apache.qpid.transport;
+using org.apache.qpid.transport.util;
+
+namespace test.interop
+{
+ public class Message : TestCase
+ {
+ private static readonly Logger _log = Logger.Get(typeof (Message));
+
+ [Test]
+ public void sendAndPurge()
+ {
+ _log.Debug("Running: ExchangeBind");
+ IClientSession ssn = Client.CreateSession(0);
+ ssn.QueueDelete("queue1");
+ QueueQueryResult result = (QueueQueryResult) ssn.QueueQuery("queue1").Result;
+ Assert.IsNull(result.GetQueue());
+ ssn.QueueDeclare("queue1", null, null);
+ ssn.ExchangeBind("queue1", "amq.direct", "queue1", null);
+
+ for (int i = 0; i < 10; i++)
+ {
+ ssn.MessageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
+ new Header(new DeliveryProperties().SetRoutingKey("queue1"),
+ new MessageProperties().SetMessageId(UUID.RandomUuid())),
+ Encoding.UTF8.GetBytes("test: " + i));
+ }
+ ssn.Sync();
+ result = (QueueQueryResult) ssn.QueueQuery("queue1").Result;
+ Assert.IsTrue(result.GetMessageCount() == 10);
+ ssn.QueuePurge("queue1");
+ ssn.Sync();
+ result = (QueueQueryResult) ssn.QueueQuery("queue1").Result;
+ Assert.IsTrue(result.GetMessageCount() == 0);
+ }
+
+ [Test]
+ public void sendAndReceiveSmallMessages()
+ {
+ _log.Debug("Running: sendAndReceiveSmallMessages");
+ byte[] smallMessage = Encoding.UTF8.GetBytes("test");
+ sendAndReceive(smallMessage, 100);
+ }
+
+ [Test]
+ public void sendAndReceiveLargeMessages()
+ {
+ _log.Debug("Running: sendAndReceiveSmallMessages");
+ byte[] largeMessage = new byte[100 * 1024];
+ Random random = new Random();
+ random.NextBytes(largeMessage);
+ sendAndReceive(largeMessage, 10);
+ }
+
+ [Test]
+ public void sendAndReceiveVeryLargeMessages()
+ {
+ _log.Debug("Running: sendAndReceiveSmallMessages");
+ byte[] verylargeMessage = new byte[1000 * 1024];
+ Random random = new Random();
+ random.NextBytes(verylargeMessage);
+ sendAndReceive(verylargeMessage, 2);
+ }
+
+ private void sendAndReceive(byte[] messageBody, int count)
+ {
+ IClientSession ssn = Client.CreateSession(0);
+ ssn.Sync();
+ ssn.QueueDeclare("queue1", null, null);
+ ssn.QueueDelete("queue1");
+ QueueQueryResult result = (QueueQueryResult) ssn.QueueQuery("queue1").Result;
+ Assert.IsNull(result.GetQueue());
+ ssn.QueueDeclare("queue1", null, null);
+ ssn.ExchangeBind("queue1", "amq.direct", "queue1", null);
+ Object myLock = new Object();
+ MyListener myListener = new MyListener(myLock, count);
+ ssn.AttachMessageListener(myListener, "myDest");
+
+ ssn.MessageSubscribe("queue1", "myDest", MessageAcceptMode.EXPLICIT, MessageAcquireMode.PRE_ACQUIRED, null,
+ 0, null);
+
+
+ // issue credits
+ ssn.MessageSetFlowMode("myDest", MessageFlowMode.WINDOW);
+ ssn.MessageFlow("myDest", MessageCreditUnit.BYTE, ClientSession.MESSAGE_FLOW_MAX_BYTES);
+ ssn.MessageFlow("myDest", MessageCreditUnit.MESSAGE, 10000);
+ ssn.Sync();
+
+ for (int i = 0; i < count; i++)
+ {
+ ssn.MessageTransfer("amq.direct", MessageAcceptMode.NONE, MessageAcquireMode.PRE_ACQUIRED,
+ new Header(new DeliveryProperties().SetRoutingKey("queue1"),
+ new MessageProperties().SetMessageId(UUID.RandomUuid())),
+ messageBody);
+ }
+ ssn.Sync();
+
+ lock (myLock)
+ {
+ if (myListener.Count != 0)
+ {
+ Monitor.Wait(myLock, 10000000);
+ }
+ }
+ Assert.IsTrue(myListener.Count == 0);
+ ssn.MessageAccept(myListener.UnAck);
+ ssn.Sync();
+ // the queue should be empty
+ result = (QueueQueryResult)ssn.QueueQuery("queue1").Result;
+ Assert.IsTrue(result.GetMessageCount() == 0);
+ ssn.Close();
+ }
+
+
+
+ private class MyListener : IMessageListener
+ {
+ private static readonly Logger _log = Logger.Get(typeof (MyListener));
+ private readonly Object _wl;
+ private int _count;
+ private RangeSet _rs = new RangeSet();
+
+ public MyListener(Object wl, int count)
+ {
+ _wl = wl;
+ _count = count;
+ }
+
+ public void MessageTransfer(IMessage m)
+ {
+ byte[] body = new byte[m.Body.Length - m.Body.Position];
+ _log.Debug("Got a message of size: " + body.Length + " count = " + _count);
+ _rs.Add(m.Id);
+ lock (_wl)
+ {
+ _count--;
+ if (_count == 0)
+ {
+ Monitor.PulseAll(_wl);
+ }
+ }
+ }
+
+ public int Count
+ {
+ get { return _count; }
+ }
+
+ public RangeSet UnAck
+ {
+ get { return _rs; }
+ }
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/test/interop/TestCase.cs b/qpid/dotnet/client-010/test/interop/TestCase.cs
new file mode 100644
index 0000000000..867f082000
--- /dev/null
+++ b/qpid/dotnet/client-010/test/interop/TestCase.cs
@@ -0,0 +1,96 @@
+/*
+*
+* 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 System.Collections.Generic;
+using System.IO;
+using System.Threading;
+using System.Xml;
+using common.org.apache.qpid.transport.util;
+using log4net.Config;
+using NUnit.Framework;
+using org.apache.qpid.client;
+using org.apache.qpid.transport;
+using org.apache.qpid.transport.util;
+using test.Helpers;
+
+namespace test.interop
+{
+ [TestFixture]
+
+ public class TestCase
+ {
+ private readonly Dictionary<string,string> _properties = new Dictionary<string, string>();
+ private Client _client;
+
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ var properties = ConfigHelpers.LoadConfig();
+ // create a client and connect to the broker
+ _client = new Client();
+ _client.Connect(properties["Host"], Convert.ToInt16(properties["Port"]), properties["VirtualHost"],
+ properties["Username"], properties["Password"]);
+
+ }
+
+ [TestFixtureTearDown]
+ public void Cleanup()
+ {
+ // Note : breaks the Resharper nunit test runner. It blocks on the Monitor.WaitAll()
+ // Certainly a problem with the threading context..
+ //_client.Close();
+ }
+
+ public Client Client
+ {
+ get{ return _client;}
+ }
+
+ public Dictionary<string,string> Properties
+ {
+ get { return _properties; }
+ }
+
+
+ public class SyncListener : IMessageListener
+ {
+ private static readonly Logger _log = Logger.Get(typeof(SyncListener));
+ private readonly CircularBuffer<IMessage> _buffer;
+ private readonly RangeSet _range = new RangeSet();
+ private readonly IClientSession _session;
+
+ public SyncListener(IClientSession session, CircularBuffer<IMessage> buffer)
+ {
+ _buffer = buffer;
+ _session = session;
+ }
+
+ public void MessageTransfer(IMessage m)
+ {
+ _range.Clear();
+ _range.Add(m.Id);
+ _session.MessageAccept(_range);
+ _buffer.Enqueue(m);
+ }
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs b/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs
new file mode 100644
index 0000000000..f3a05f1c3c
--- /dev/null
+++ b/qpid/dotnet/client-010/test/transport/util/ByteEncoderTest.cs
@@ -0,0 +1,106 @@
+/*
+*
+* 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 NUnit.Framework;
+using org.apache.qpid.transport.util;
+
+
+namespace test.transport.util
+{
+ [TestFixture]
+
+ public class ByteEncoderTest
+ {
+ private static readonly Logger _log = Logger.Get(typeof(ByteEncoderTest));
+
+ [Test]
+ public void GetBigEndianInt32()
+ {
+ _log.Debug("Running: GetBigEndianInt32");
+ const int anInt = -12345;
+ Int32 aNewInt = ByteEncoder.GetBigEndian(anInt);
+ Assert.IsTrue( anInt == ByteEncoder.GetBigEndian(aNewInt) );
+ }
+
+ [Test]
+ public void GetBigEndianUInt16()
+ {
+ _log.Debug("Running: GetBigEndianUInt16");
+ const UInt16 anInt = 123;
+ UInt16 aNewInt = ByteEncoder.GetBigEndian(anInt);
+ Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt));
+ }
+
+ [Test]
+ public void GetBigEndianUInt32()
+ {
+ _log.Debug("Running: GetBigEndianUInt32");
+ const UInt32 anInt = 12345;
+ UInt32 aNewInt = ByteEncoder.GetBigEndian(anInt);
+ Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt));
+ }
+
+ [Test]
+ public void GetBigEndianlong()
+ {
+ _log.Debug("Running: GetBigEndianlong");
+ const long anInt = 123456660700770;
+ long aNewInt = ByteEncoder.GetBigEndian(anInt);
+ Assert.IsTrue(anInt == ByteEncoder.GetBigEndian(aNewInt));
+ }
+
+ [Test]
+ public void GetLittleEndianInt32()
+ {
+ _log.Debug("Running: GetBigEndianInt32");
+ const int anInt = -12345;
+ Int32 aNewInt = ByteEncoder.GetLittleEndian(anInt);
+ Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt));
+ }
+
+ [Test]
+ public void GetLittleEndianUInt16()
+ {
+ _log.Debug("Running: GetLittleEndianUInt16");
+ const UInt16 anInt = 123;
+ UInt16 aNewInt = ByteEncoder.GetLittleEndian(anInt);
+ Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt));
+ }
+
+ [Test]
+ public void GetLittleEndianUInt32()
+ {
+ _log.Debug("Running: GetLittleEndianUInt32");
+ const UInt32 anInt = 12345;
+ UInt32 aNewInt = ByteEncoder.GetLittleEndian(anInt);
+ Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt));
+ }
+
+ [Test]
+ public void GetLittleEndianlong()
+ {
+ _log.Debug("Running: GetLittleEndianlong");
+ const long anInt = 123456660700770;
+ long aNewInt = ByteEncoder.GetLittleEndian(anInt);
+ Assert.IsTrue(anInt == ByteEncoder.GetLittleEndian(aNewInt));
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs b/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs
new file mode 100644
index 0000000000..5e39569cf8
--- /dev/null
+++ b/qpid/dotnet/client-010/test/transport/util/CircularBufferTest.cs
@@ -0,0 +1,89 @@
+/*
+*
+* 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 System.Threading;
+using common.org.apache.qpid.transport.util;
+using NUnit.Framework;
+using org.apache.qpid.transport.util;
+
+namespace test.transport.util
+{
+ [TestFixture]
+
+ public class CircularBufferTest
+ {
+ private CircularBuffer<Object> _buf;
+ private static readonly Logger _log = Logger.Get(typeof(CircularBufferTest));
+
+ [Test]
+ public void BlockingEnqueue()
+ {
+ _log.Debug("Running: BlockingEnqueue");
+ const int size = 10;
+ _buf = new CircularBuffer<Object>(size);
+ // add size element anc check that the size +1 add blocks
+ for (int i = 1; i < size; i++ )
+ {
+ _buf.Enqueue(new object());
+ }
+ // check tha the buffer is now full
+ Thread t = new Thread(Go);
+ t.Start();
+ Thread.Sleep(100);
+ // the trhead t should block until an element is dequeued
+ Assert.IsTrue(t.ThreadState == ThreadState.WaitSleepJoin);
+ _buf.Dequeue();
+ // t should now be stopped
+ Thread.Sleep(100);
+ Assert.IsTrue(t.ThreadState == ThreadState.Stopped);
+ }
+
+ [Test]
+ public void Close()
+ {
+ _log.Debug("Running: BlockingEnqueue");
+ const int size = 10;
+ _buf = new CircularBuffer<Object>(size);
+ // add size element anc check that the size +1 add blocks
+ for (int i = 1; i < size; i++)
+ {
+ _buf.Enqueue(new object());
+ }
+ // check tha the buffer is now full
+ Thread t = new Thread(Go);
+ t.Start();
+ Thread.Sleep(1000);
+ // the trhead t should block until the buffer is closed
+ Assert.IsTrue(t.ThreadState == ThreadState.WaitSleepJoin);
+ _buf.Close();
+ Thread.Sleep(100);
+ // t should now be stopped
+ Assert.IsTrue(t.ThreadState == ThreadState.Stopped);
+ }
+
+ void Go()
+ {
+ _buf.Enqueue(new object());
+ }
+
+ }
+}
diff --git a/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs b/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs
new file mode 100644
index 0000000000..e8e011a1e9
--- /dev/null
+++ b/qpid/dotnet/client-010/test/transport/util/ResultFutureTest.cs
@@ -0,0 +1,103 @@
+/*
+*
+* 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 System.Collections.Generic;
+using System.Threading;
+using common.org.apache.qpid.transport.util;
+using NUnit.Framework;
+using org.apache.qpid.transport;
+using org.apache.qpid.transport.codec;
+using org.apache.qpid.transport.util;
+
+
+namespace test.transport.util
+{
+ [TestFixture]
+ public class ResultFutureTest
+ {
+ private static readonly Logger _log = Logger.Get(typeof (ByteEncoderTest));
+ private static ResultFuture _future;
+
+ [Test]
+ public void getFutureTimeout()
+ {
+ _log.Debug("Running: getFutureTimeout");
+ _future = new ResultFuture();
+ _future.Session = new Session(new byte[1]);
+ DateTime start = DateTime.Now;
+ Struct result = _future.Get(1000);
+ Assert.IsTrue(DateTime.Now.Subtract(start).TotalMilliseconds >= 1000);
+ Assert.IsNull(result);
+ }
+
+ [Test]
+ public void getFuture()
+ {
+ _log.Debug("Running: getFuture");
+ _future = new ResultFuture();
+ _future.Session = new Session(new byte[1]);
+ Thread t = new Thread(Go);
+ t.Start();
+ Struct result = _future.Get(2000);
+ Assert.IsNotNull(result);
+ }
+
+
+ void Go()
+ {
+ Thread.Sleep(500);
+ _future.Result = new myStruct();
+ }
+ }
+
+ public class myStruct:Struct
+ {
+ public override int GetStructType()
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public override int GetSizeWidth()
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public override int GetPackWidth()
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public override void Read(IDecoder dec)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public override void Write(IEncoder enc)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public override Dictionary<string, object> Fields
+ {
+ get { throw new System.NotImplementedException(); }
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/test/transport/util/SerialTest.cs b/qpid/dotnet/client-010/test/transport/util/SerialTest.cs
new file mode 100644
index 0000000000..772327c3b0
--- /dev/null
+++ b/qpid/dotnet/client-010/test/transport/util/SerialTest.cs
@@ -0,0 +1,75 @@
+/*
+*
+* 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 NUnit.Framework;
+using org.apache.qpid.transport.util;
+
+namespace test.transport.util
+{
+ [TestFixture]
+ public class SerialTest
+ {
+ private static readonly Logger _log = Logger.Get(typeof (SerialTest));
+
+ [Test]
+ ///
+ /// Test the key boundaries where wraparound occurs.
+ ///
+ public void testBoundaries()
+ {
+ Assert.IsTrue(Serial.Gt(1, 0));
+ Assert.IsTrue(Serial.Lt(0, 1));
+
+ Assert.IsTrue(Serial.Gt(int.MaxValue, int.MaxValue - 1));
+ Assert.IsTrue(Serial.Lt(int.MaxValue - 1, int.MaxValue));
+ }
+
+ ///
+ /// Test the first Corollary of RFC 1982
+ /// For any sequence number s and any integer n such that addition of n
+ /// to s is well defined, (s + n) >= s. Further (s + n) == s only when
+ /// n == 0, in all other defined cases, (s + n) > s.
+ ///
+ public void testCorollary1()
+ {
+ int wrapcount = 0;
+
+ int s = 0;
+
+ for (int i = 0; i < 67108664; i++)
+ {
+ for (int n = 1; n < 4096; n += 512)
+ {
+ Assert.IsTrue(Serial.Gt(s + n, s));
+ Assert.IsTrue(Serial.Lt(s, s + n));
+ }
+
+ s += 1024;
+
+ if (s == 0)
+ {
+ wrapcount += 1;
+ }
+ }
+
+ Assert.IsTrue(wrapcount > 0);
+ }
+ }
+}
diff --git a/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs
new file mode 100644
index 0000000000..41104f8873
--- /dev/null
+++ b/qpid/dotnet/client-010/test/transport/util/UUIDTest.cs
@@ -0,0 +1,64 @@
+/*
+*
+* 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 NUnit.Framework;
+using org.apache.qpid.transport.util;
+
+namespace test.transport.util
+{
+ [TestFixture]
+
+ public class UUIDTest
+ {
+
+
+ [Test]
+ public void createUUID()
+ {
+ UUID uuid = UUID.RandomUuid();
+ String uuidStr = uuid.ToString();
+ Assert.IsNotNull(uuid);
+ UUID uuid2 = UUID.RandomUuid();
+ Assert.AreNotSame(uuid, uuid2);
+ }
+
+ [Test]
+ public void ToString_should_override_and_not_hide_base()
+ {
+ UUID uuid = UUID.RandomUuid();
+
+ string uuidStr = uuid.ToString();
+ string uuidConcat = "Test." + uuid;
+
+ Assert.AreEqual("Test." + uuidStr, uuidConcat);
+ }
+
+ [Test]
+ public void two_uuid_with_same_value_should_have_same_hash_code()
+ {
+ UUID uuid = UUID.RandomUuid();
+ UUID uuid2 = new UUID(uuid.MostSignificantBits, uuid.LeastSignificantBits);
+
+ Assert.AreEqual(uuid, uuid2);
+ Assert.AreEqual(uuid.GetHashCode(), uuid2.GetHashCode());
+ }
+ }
+}