diff options
author | Rupert Smith <rupertlssmith@apache.org> | 2007-08-07 09:44:59 +0000 |
---|---|---|
committer | Rupert Smith <rupertlssmith@apache.org> | 2007-08-07 09:44:59 +0000 |
commit | acdc3f1f9b6fd97e5461869a3e869736966bfac7 (patch) | |
tree | 1cadceff547aa00b2f722db38938291a53cf587c | |
parent | a1be116bdebdcda39d11664dff5c08acc7c018a0 (diff) | |
download | qpid-python-acdc3f1f9b6fd97e5461869a3e869736966bfac7.tar.gz |
Interop tests put into a working state.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/M2@563434 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | dotnet/Qpid.Client.Tests/interop/TestCases/TestCase2BasicP2P.cs | 2 | ||||
-rw-r--r-- | dotnet/Qpid.Client.Tests/interop/TestCases/TestCase3BasicPubSub.cs | 8 | ||||
-rw-r--r-- | dotnet/Qpid.Client.Tests/interop/TestClient.cs | 44 | ||||
-rw-r--r-- | dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs | 8 | ||||
-rw-r--r-- | dotnet/Qpid.NET.sln | 2 | ||||
-rw-r--r-- | dotnet/TestClient/Program.cs | 10 | ||||
-rw-r--r-- | dotnet/TestClient/Properties/AssemblyInfo.cs | 33 | ||||
-rw-r--r-- | dotnet/TestClient/TestClient.csproj | 89 | ||||
-rw-r--r-- | dotnet/TestClient/default.build | 26 | ||||
-rw-r--r-- | dotnet/default.build | 1 |
10 files changed, 202 insertions, 21 deletions
diff --git a/dotnet/Qpid.Client.Tests/interop/TestCases/TestCase2BasicP2P.cs b/dotnet/Qpid.Client.Tests/interop/TestCases/TestCase2BasicP2P.cs index bc4501dea4..42fa0c5be9 100644 --- a/dotnet/Qpid.Client.Tests/interop/TestCases/TestCase2BasicP2P.cs +++ b/dotnet/Qpid.Client.Tests/interop/TestCases/TestCase2BasicP2P.cs @@ -163,7 +163,7 @@ namespace Apache.Qpid.Client.Tests.interop.TestCases // Generate a report message containing the count of the number of messages passed.
IMessage report = channel.CreateMessage();
- report.Headers.SetString("CONTROL_TYPE", "REPORT");
+ //report.Headers.SetString("CONTROL_TYPE", "REPORT");
report.Headers.SetInt("MESSAGE_COUNT", messageCount);
return report;
diff --git a/dotnet/Qpid.Client.Tests/interop/TestCases/TestCase3BasicPubSub.cs b/dotnet/Qpid.Client.Tests/interop/TestCases/TestCase3BasicPubSub.cs index 4e3dd6e53e..2f5c63ca9c 100644 --- a/dotnet/Qpid.Client.Tests/interop/TestCases/TestCase3BasicPubSub.cs +++ b/dotnet/Qpid.Client.Tests/interop/TestCases/TestCase3BasicPubSub.cs @@ -185,14 +185,14 @@ namespace Apache.Qpid.Client.Tests.interop.TestCases log.Debug("public IMessage getReport(IChannel channel): called");
// Close the test connections.
- foreach (IConnection con in connection)
+ /*foreach (IConnection con in connection)
{
- con.Stop();
- }
+ con.Close();
+ }*/
// Generate a report message containing the count of the number of messages passed.
IMessage report = channel.CreateMessage();
- report.Headers.SetString("CONTROL_TYPE", "REPORT");
+ //report.Headers.SetString("CONTROL_TYPE", "REPORT");
report.Headers.SetInt("MESSAGE_COUNT", messageCount);
return report;
diff --git a/dotnet/Qpid.Client.Tests/interop/TestClient.cs b/dotnet/Qpid.Client.Tests/interop/TestClient.cs index b15f7fbda9..e8d37ce5b3 100644 --- a/dotnet/Qpid.Client.Tests/interop/TestClient.cs +++ b/dotnet/Qpid.Client.Tests/interop/TestClient.cs @@ -1,6 +1,7 @@ using System;
using System.Collections;
using System.Text;
+using System.Threading;
using Apache.Qpid.Messaging;
using Apache.Qpid.Client.Qms;
using log4net;
@@ -28,7 +29,7 @@ namespace Apache.Qpid.Client.Tests.interop /// <tr><td> Configure and look up test cases by name. <td> {@link InteropClientTestCase}
/// </table>
/// </summary>
- class TestClient
+ public class TestClient
{
private static ILog log = LogManager.GetLogger(typeof(TestClient));
@@ -39,7 +40,7 @@ namespace Apache.Qpid.Client.Tests.interop public static string DEFAULT_VIRTUAL_HOST = "";
/// <summary> Defines the default identifying name of this test client. </summary>
- public static string DEFAULT_CLIENT_NAME = ".net";
+ public static string DEFAULT_CLIENT_NAME = "dotnet";
/// <summary> Holds the URL of the broker to run the tests on. </summary>
public static string brokerUrl;
@@ -59,6 +60,8 @@ namespace Apache.Qpid.Client.Tests.interop private IChannel channel;
+ /// <summary> Monitor to wait for termination events on. </summary>
+ private static object terminationMonitor = new Object();
/// <summary>
/// Creates a new interop test client, listenting to the specified broker and virtual host, with the specified
@@ -70,7 +73,7 @@ namespace Apache.Qpid.Client.Tests.interop /// <param name="clientName"> The client name to use. </param>
public TestClient(string brokerUrl, string virtualHost, string clientName)
{
- log.Debug("public TestClient(string brokerUrl = " + brokerUrl + ", string virtualHost = " + virtualHost
+ log.Info("public TestClient(string brokerUrl = " + brokerUrl + ", string virtualHost = " + virtualHost
+ ", string clientName = " + clientName + "): called");
// Retain the connection parameters.
@@ -127,6 +130,12 @@ namespace Apache.Qpid.Client.Tests.interop log.Error("The test client was unable to start.", e);
System.Environment.Exit(1);
}
+
+ // Wait for a signal on the termination monitor before quitting.
+ lock (terminationMonitor)
+ {
+ Monitor.Wait(terminationMonitor);
+ }
}
/// <summary>
@@ -134,7 +143,7 @@ namespace Apache.Qpid.Client.Tests.interop /// </summary>
private void Start()
{
- log.Debug("private void Start(): called");
+ log.Info("private void Start(): called");
// Use a class path scanner to find all the interop test case implementations.
ArrayList testCaseClasses = new ArrayList();
@@ -150,9 +159,12 @@ namespace Apache.Qpid.Client.Tests.interop {
InteropClientTestCase testCase = (InteropClientTestCase)Activator.CreateInstance(testClass);
testCases.Add(testCase.GetName(), testCase);
+
+ log.Info("Found test case: " + testClass);
}
// Open a connection to communicate with the coordinator on.
+ log.Info("brokerUrl = " + brokerUrl);
IConnection connection = CreateConnection(brokerUrl, virtualHost);
channel = connection.CreateChannel(false, AcknowledgeMode.AutoAcknowledge);
@@ -161,8 +173,8 @@ namespace Apache.Qpid.Client.Tests.interop string responseQueueName = channel.GenerateUniqueName();
channel.DeclareQueue(responseQueueName, false, true, true);
- channel.Bind(responseQueueName, ExchangeNameDefaults.DIRECT, "iop.control." + clientName);
- channel.Bind(responseQueueName, ExchangeNameDefaults.DIRECT, "iop.control");
+ channel.Bind(responseQueueName, ExchangeNameDefaults.TOPIC, "iop.control." + clientName);
+ channel.Bind(responseQueueName, ExchangeNameDefaults.TOPIC, "iop.control");
IMessageConsumer consumer = channel.CreateConsumerBuilder(responseQueueName)
.Create();
@@ -189,7 +201,7 @@ namespace Apache.Qpid.Client.Tests.interop /// <returns> A JMS conneciton. </returns>
public static IConnection CreateConnection(string brokerUrl, string virtualHost)
{
- log.Debug("public static Connection createConnection(string brokerUrl = " + brokerUrl + ", string virtualHost = "
+ log.Info("public static Connection createConnection(string brokerUrl = " + brokerUrl + ", string virtualHost = "
+ virtualHost + "): called");
// Create a connection to the broker.
@@ -207,7 +219,7 @@ namespace Apache.Qpid.Client.Tests.interop /// <param name="message"> The incoming message. </param>
public void OnMessage(IMessage message)
{
- log.Debug("public void OnMessage(IMessage message = " + message + "): called");
+ log.Info("public void OnMessage(IMessage message = " + message + "): called");
try
{
@@ -225,7 +237,7 @@ namespace Apache.Qpid.Client.Tests.interop if (testCaseName != null)
{
- log.Debug("Got an invite to test: " + testCaseName);
+ log.Info("Got an invite to test: " + testCaseName);
// Check if the requested test case is available.
InteropClientTestCase testCase = (InteropClientTestCase)testCases[testCaseName];
@@ -239,11 +251,13 @@ namespace Apache.Qpid.Client.Tests.interop }
else
{
- log.Debug("Got a compulsory invite.");
+ log.Info("Got a compulsory invite.");
enlist = true;
}
+ log.Info("enlist = " + enlist);
+
if (enlist)
{
// Reply with the client name in an Enlist message.
@@ -254,14 +268,14 @@ namespace Apache.Qpid.Client.Tests.interop enlistMessage.CorrelationId = message.CorrelationId;
Send(enlistMessage, message.ReplyToRoutingKey);
- }
+ }
}
else if ("ASSIGN_ROLE" == controlType)
{
// Assign the role to the current test case.
string roleName = message.Headers.GetString("ROLE");
- log.Debug("Got a role assignment to role: " + roleName);
+ log.Info("Got a role assignment to role: " + roleName);
Roles role;
@@ -287,14 +301,14 @@ namespace Apache.Qpid.Client.Tests.interop {
if ("START" == controlType)
{
- log.Debug("Got a start notification.");
+ log.Info("Got a start notification.");
// Start the current test case.
currentTestCase.Start();
}
else
{
- log.Debug("Got a status request.");
+ log.Info("Got a status request.");
}
// Generate the report from the test case and reply with it as a Report message.
@@ -321,7 +335,7 @@ namespace Apache.Qpid.Client.Tests.interop {
// Log a warning about this, but otherwise ignore it.
log.Warn("A QpidException occurred whilst handling a message.");
- log.Debug("Got QpidException whilst handling message: " + message, e);
+ log.Info("Got QpidException whilst handling message: " + message, e);
}
}
diff --git a/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs b/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs index 19f59a4fc1..f8c44261f2 100644 --- a/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs +++ b/dotnet/Qpid.Client/Client/Message/AbstractQmsMessage.cs @@ -30,6 +30,8 @@ namespace Apache.Qpid.Client.Message { public abstract class AbstractQmsMessage : AMQMessage, IMessage { + private static ILog log = LogManager.GetLogger(typeof(AbstractQmsMessage)); + protected bool _redelivered; protected ByteBuffer _data; @@ -452,6 +454,8 @@ namespace Apache.Qpid.Client.Message private Dest ReadReplyToHeader() { string replyToEncoding = ContentHeaderProperties.ReplyTo; + + //log.Info("replyToEncoding = " + replyToEncoding); if ( replyToEncoding == null ) { @@ -469,7 +473,9 @@ namespace Apache.Qpid.Client.Message // Extract the exchange name and routing key from the split replyto field. string exchangeName = split[0]; - string routingKey = split[1]; + + string[] split2 = split[1].Split('/'); + string routingKey = split2[3]; return new Dest(exchangeName, routingKey); } diff --git a/dotnet/Qpid.NET.sln b/dotnet/Qpid.NET.sln index 70ae637b23..8b174db90f 100644 --- a/dotnet/Qpid.NET.sln +++ b/dotnet/Qpid.NET.sln @@ -24,6 +24,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TopicPublisher", "TopicPubl EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TopicListener", "TopicListener\TopicListener.csproj", "{9A112DF2-146F-4CF4-919B-9D3BE7D088E9}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestClient", "TestClient\TestClient.csproj", "{9A112DF2-146F-4CF4-919B-9D3BE7D088E9}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
diff --git a/dotnet/TestClient/Program.cs b/dotnet/TestClient/Program.cs new file mode 100644 index 0000000000..4c39638eb3 --- /dev/null +++ b/dotnet/TestClient/Program.cs @@ -0,0 +1,10 @@ +namespace TopicListener
+{
+ class Program
+ {
+ static void Main(string[] args)
+ {
+ Apache.Qpid.Client.Tests.interop.TestClient.Main(args);
+ }
+ }
+}
diff --git a/dotnet/TestClient/Properties/AssemblyInfo.cs b/dotnet/TestClient/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000..becfda4a69 --- /dev/null +++ b/dotnet/TestClient/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +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("TestClient")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("J.P. Morgan Chase & Co.")]
+[assembly: AssemblyProduct("TestClient")]
+[assembly: AssemblyCopyright("Copyright © J.P. Morgan Chase & Co. 2007")]
+[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("1c2db1cd-239f-495a-b6b4-c815ea534489")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/dotnet/TestClient/TestClient.csproj b/dotnet/TestClient/TestClient.csproj new file mode 100644 index 0000000000..b00994b265 --- /dev/null +++ b/dotnet/TestClient/TestClient.csproj @@ -0,0 +1,89 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{9A112DF2-146F-4CF4-919B-9D3BE7D088E9}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>TestClient</RootNamespace>
+ <AssemblyName>TestClient</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\bin\net-2.0\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\net-2.0\release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\Qpid.Buffer.Tests\Qpid.Buffer.Tests.csproj">
+ <Project>{74640962-99D0-4D06-B57A-9CD66517CF52}</Project>
+ <Name>Qpid.Buffer.Tests</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Buffer\Qpid.Buffer.csproj">
+ <Project>{44384DF2-B0A4-4580-BDBC-EE4BAA87D995}</Project>
+ <Name>Qpid.Buffer</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Client.Tests\Qpid.Client.Tests.csproj">
+ <Project>{BA1B0032-4CE6-40DD-A2DC-119F0FFA0A1D}</Project>
+ <Name>Qpid.Client.Tests</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Client\Qpid.Client.csproj">
+ <Project>{68987C05-3768-452C-A6FC-6BA1D372852F}</Project>
+ <Name>Qpid.Client</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Codec\Qpid.Codec.csproj">
+ <Project>{22D0D0C2-77AF-4DE3-B456-7FF3893F9F88}</Project>
+ <Name>Qpid.Codec</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Common.Tests\Qpid.Common.Tests.csproj">
+ <Project>{F83624B0-762B-4D82-900D-FF4C1B36E36E}</Project>
+ <Name>Qpid.Common.Tests</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Common\Qpid.Common.csproj">
+ <Project>{77064C42-24D2-4CEB-9EA2-0EF481A43205}</Project>
+ <Name>Qpid.Common</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Messaging\Qpid.Messaging.csproj">
+ <Project>{6688F826-C58E-4C1B-AA1F-22AFAB4B7D07}</Project>
+ <Name>Qpid.Messaging</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Sasl.Tests\Qpid.Sasl.Tests.csproj">
+ <Project>{587B3520-EBB9-41ED-B019-E96116B651CE}</Project>
+ <Name>Qpid.Sasl.Tests</Name>
+ </ProjectReference>
+ <ProjectReference Include="..\Qpid.Sasl\Qpid.Sasl.csproj">
+ <Project>{1465B0EE-6452-42A6-AB73-B2F9EABEEE75}</Project>
+ <Name>Qpid.Sasl</Name>
+ </ProjectReference>
+ </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/dotnet/TestClient/default.build b/dotnet/TestClient/default.build new file mode 100644 index 0000000000..dee644c71e --- /dev/null +++ b/dotnet/TestClient/default.build @@ -0,0 +1,26 @@ +<?xml version="1.0"?>
+<project name="TestClient" 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="exe"
+ define="${build.defines}"
+ debug="${build.debug}"
+ unsafe="true"
+ output="${build.dir}/${project::get-name()}.exe">
+
+ <sources>
+ <include name="**/*.cs" />
+ </sources>
+ <references>
+ <include name="${build.dir}\Apache.Qpid.Client.Tests.dll"/>
+ </references>
+ </csc>
+ </target>
+</project>
+
diff --git a/dotnet/default.build b/dotnet/default.build index e042f38c61..f68e3e9cad 100644 --- a/dotnet/default.build +++ b/dotnet/default.build @@ -34,6 +34,7 @@ <fileset id='other.builds'>
<include name="TopicListener/default.build" />
<include name="TopicPublisher/default.build" />
+ <include name="TestClient/default.build" />
</fileset>
<!--
Prepare environment for a debug build
|