summaryrefslogtreecommitdiff
path: root/dotnet/client-010/test
diff options
context:
space:
mode:
authorArnaud Simon <arnaudsimon@apache.org>2008-09-11 11:39:47 +0000
committerArnaud Simon <arnaudsimon@apache.org>2008-09-11 11:39:47 +0000
commitb55c7f2d8fa39b358b8a7fbf400db5fbc71335dd (patch)
tree503cfbaf111739a8127c233fe4913cac50b227b2 /dotnet/client-010/test
parent2e05b7082f5e387fc686925e5ac006485e4686db (diff)
downloadqpid-python-b55c7f2d8fa39b358b8a7fbf400db5fbc71335dd.tar.gz
qpid-1277: added tests and fixed rangeSet + future issue because of the nonvariant nature of C# generics
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@694220 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'dotnet/client-010/test')
-rw-r--r--dotnet/client-010/test/interop/Admin.cs90
-rw-r--r--dotnet/client-010/test/interop/TestCase.cs93
-rw-r--r--dotnet/client-010/test/test.config10
-rw-r--r--dotnet/client-010/test/transport/util/UUIDTest.cs21
4 files changed, 213 insertions, 1 deletions
diff --git a/dotnet/client-010/test/interop/Admin.cs b/dotnet/client-010/test/interop/Admin.cs
new file mode 100644
index 0000000000..93b24ea505
--- /dev/null
+++ b/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");
+ ClientSession ssn = Client.createSession(0);
+ ssn.close();
+ // This test fails if an exception is thrown
+ }
+
+ [Test]
+ public void queueLifecycle()
+ {
+ _log.debug("Running: queueLifecycle");
+ ClientSession 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 e)
+ {
+ // as expected
+ }
+ // This test fails if an exception is thrown
+ }
+
+ [Test]
+ public void exchangeCheck()
+ {
+ _log.debug("Running: exchangeCheck");
+ ClientSession 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");
+ ClientSession 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/dotnet/client-010/test/interop/TestCase.cs b/dotnet/client-010/test/interop/TestCase.cs
new file mode 100644
index 0000000000..02f5a327f6
--- /dev/null
+++ b/dotnet/client-010/test/interop/TestCase.cs
@@ -0,0 +1,93 @@
+/*
+*
+* 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.Xml;
+using log4net.Config;
+using NUnit.Framework;
+using org.apache.qpid.client;
+
+namespace test.interop
+{
+ [TestFixture]
+
+ public class TestCase
+ {
+ private readonly Dictionary<string,string> _properties = new Dictionary<string, string>();
+ private Client _client;
+
+ [TestFixtureSetUp]
+ public void Init()
+ {
+ XmlConfigurator.Configure(new FileInfo(".\\log.xml"));
+ // populate default properties
+ _properties.Add("UserName", "guest");
+ _properties.Add("Password", "guest");
+ _properties.Add("Host", "192.168.1.14");
+ _properties.Add("Port", "5673");
+ _properties.Add("VirtualHost", "test");
+ //Read the test config file
+ XmlTextReader reader = new XmlTextReader(Environment.CurrentDirectory + ".\\test.config");
+ while (reader.Read())
+ {
+ XmlNodeType nType = reader.NodeType;
+ // if node type is an element
+ if (reader.NodeType == XmlNodeType.Element && reader.Name.Equals("add"))
+ {
+ Console.WriteLine("Element:" + reader.Name.ToString());
+ if (_properties.ContainsKey(reader.GetAttribute("key")))
+ {
+ _properties[reader.GetAttribute("key")] = reader.GetAttribute("value");
+ }
+ else
+ {
+ _properties.Add(reader.GetAttribute("key"), reader.GetAttribute("value"));
+ }
+
+ }
+ }
+ // 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()
+ {
+ _client.close();
+ }
+
+ public Client Client
+ {
+ get{ return _client;}
+ }
+
+ public Dictionary<string,string> Properties
+ {
+ get { return _properties; }
+ }
+
+ }
+}
diff --git a/dotnet/client-010/test/test.config b/dotnet/client-010/test/test.config
new file mode 100644
index 0000000000..dc284f25f1
--- /dev/null
+++ b/dotnet/client-010/test/test.config
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <appSettings>
+ <add key="UserMame" value="guest"/>
+ <add key="Password" value="password"/>
+ <add key="Host" value="192.168.1.14"/>
+ <add key="Port" value="5673"/>
+ <add key="VirtualHost" value="test"/>
+ </appSettings>
+</configuration> \ No newline at end of file
diff --git a/dotnet/client-010/test/transport/util/UUIDTest.cs b/dotnet/client-010/test/transport/util/UUIDTest.cs
index 6ece267e07..c073f1139a 100644
--- a/dotnet/client-010/test/transport/util/UUIDTest.cs
+++ b/dotnet/client-010/test/transport/util/UUIDTest.cs
@@ -1,4 +1,23 @@
-
+/*
+*
+* 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;