mirror of https://github.com/apache/activemq.git
added compiling (but not working) unit test case
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@367748 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
da77d2c649
commit
3ed3dd46dd
|
@ -163,7 +163,7 @@
|
|||
<buildfiles refid="tas.win32" />
|
||||
</nant>
|
||||
<!-- build OpenWire.Client.Tests assembly -->
|
||||
<nant buildfile="tests/OpenWire.Client/OpenWire.Client.build" target="build" />
|
||||
<nant buildfile="tests/OpenWire.Client/OpenWire.Client.build" target="test" />
|
||||
<!-- build tests for task assemblies -->
|
||||
<nant target="build">
|
||||
<buildfiles refid="tas.core.tests"/>
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
//
|
||||
// Marshalling code for Open Wire Format for ActiveMQBytesMessage
|
||||
//
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-openwire module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
//
|
||||
// Marshalling code for Open Wire Format for ActiveMQMapMessage
|
||||
//
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-openwire module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
//
|
||||
// Marshalling code for Open Wire Format for ActiveMQMessage
|
||||
//
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-openwire module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
//
|
||||
// Marshalling code for Open Wire Format for ActiveMQObjectMessage
|
||||
//
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-openwire module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
//
|
||||
// Marshalling code for Open Wire Format for ActiveMQStreamMessage
|
||||
//
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-openwire module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
//
|
||||
// Marshalling code for Open Wire Format for ActiveMQTextMessage
|
||||
//
|
||||
//
|
||||
// NOTE!: This file is autogenerated - do not modify!
|
||||
// if you need to make a change, please see the Groovy scripts in the
|
||||
// activemq-openwire module
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
|
@ -17,9 +8,14 @@ namespace OpenWire.Client.Commands {
|
|||
public class ActiveMQTextMessage : ActiveMQMessage, ITextMessage {
|
||||
public const byte ID_ActiveMQTextMessage = 28;
|
||||
|
||||
|
||||
private String text;
|
||||
|
||||
public ActiveMQTextMessage() {
|
||||
}
|
||||
|
||||
public ActiveMQTextMessage(String text) {
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
// TODO generate Equals method
|
||||
// TODO generate GetHashCode method
|
||||
|
|
|
@ -14,6 +14,14 @@ namespace OpenWire.Client {
|
|||
private string password;
|
||||
private string clientId;
|
||||
|
||||
public ConnectionFactory() {
|
||||
}
|
||||
|
||||
public ConnectionFactory(string host, int port) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public IConnection CreateConnection() {
|
||||
return CreateConnection(userName, password);
|
||||
}
|
||||
|
|
|
@ -40,5 +40,19 @@ namespace OpenWire.Client {
|
|||
ITopic GetTopic(string name);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new message with an empty body
|
||||
/// </summary>
|
||||
IMessage CreateMessage();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new text message with an empty body
|
||||
/// </summary>
|
||||
ITextMessage CreateTextMessage();
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new text message with the given body
|
||||
/// </summary>
|
||||
ITextMessage CreateTextMessage(string text);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,6 +57,18 @@ namespace OpenWire.Client {
|
|||
return new ActiveMQTopic(name);
|
||||
}
|
||||
|
||||
public IMessage CreateMessage() {
|
||||
return new ActiveMQMessage();
|
||||
}
|
||||
|
||||
public ITextMessage CreateTextMessage() {
|
||||
return new ActiveMQTextMessage();
|
||||
}
|
||||
|
||||
public ITextMessage CreateTextMessage(string text) {
|
||||
return new ActiveMQTextMessage(text);
|
||||
}
|
||||
|
||||
// Implementation methods
|
||||
public void DoSend(IDestination destination, IMessage message) {
|
||||
ActiveMQMessage command = ActiveMQMessage.Transform(message);
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
|
||||
namespace OpenWire.Client {
|
||||
|
||||
[ TestFixture ]
|
||||
public class ClientTest : TestSupport {
|
||||
|
||||
[ Test ]
|
||||
public void SendAndSyncReceive() {
|
||||
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
|
||||
|
||||
using (IConnection connection = factory.CreateConnection()) {
|
||||
ISession session = connection.CreateSession();
|
||||
IDestination destination = session.GetQueue("FOO.BAR");
|
||||
IMessageConsumer consumer = session.CreateConsumer(destination);
|
||||
|
||||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
string expected = "Hello World!";
|
||||
ITextMessage request = session.CreateTextMessage(expected);
|
||||
producer.Send(request);
|
||||
|
||||
ITextMessage message = (ITextMessage) consumer.Receive();
|
||||
|
||||
Assert.AreEqual(expected, message.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0"?>
|
||||
<project name="OpenWire.Core" default="build">
|
||||
<project name="OpenWire.Core" default="test">
|
||||
<!--
|
||||
Required properties:
|
||||
* build.dir - (path) root level to build to, assemblies will go in ${build.dir}/bin
|
||||
|
@ -7,8 +7,8 @@
|
|||
* current.build.defines - framework-specific build defines
|
||||
-->
|
||||
<target name="build">
|
||||
<!-- build OpenWire.Core -->
|
||||
<csc target="library" define="${current.build.defines}" warnaserror="true" debug="${build.debug}" output="${build.dir}/bin/${project.name}.dll" doc="${build.dir}/bin/${project.name}.xml">
|
||||
<!-- build test assembly -->
|
||||
<csc target="library" define="${current.build.defines}" warnaserror="true" debug="${build.debug}" output="${build.dir}/bin/${project.name}.Tests.dll">
|
||||
<nowarn>
|
||||
<!-- do not report warnings for missing XML comments -->
|
||||
<warning number="1591" />
|
||||
|
@ -18,15 +18,23 @@
|
|||
<sources failonempty="true">
|
||||
<include name="**/*.cs" />
|
||||
<!-- common assembly-level attributes -->
|
||||
<include name="../CommonAssemblyInfo.cs" />
|
||||
<include name="../../src/CommonAssemblyInfo.cs" />
|
||||
</sources>
|
||||
<resources basedir="Resources">
|
||||
<include name="**/*" />
|
||||
</resources>
|
||||
<references>
|
||||
<include name="${build.dir}/bin/log4net.dll"/>
|
||||
<include name="System.Web.dll"/>
|
||||
<include name="${lib.framework.dir}/log4net.dll" />
|
||||
<include name="${build.dir}/bin/openwire.dll" />
|
||||
<include name="${lib.framework.dir}/nunit.framework.dll" />
|
||||
</references>
|
||||
<resources failonempty="false" basedir="Resources" dynamicprefix="true" prefix="XML:">
|
||||
<include name="**/*.xml"/>
|
||||
</resources>
|
||||
</csc>
|
||||
</target>
|
||||
<target name="test" depends="build">
|
||||
<nunit2>
|
||||
<formatter type="Plain" />
|
||||
<test assemblyname="${build.dir}/bin/${project.name}.Tests.dll" appconfig="${path::combine(nant.location, 'nant.tests.config')}">
|
||||
</test>
|
||||
</nunit2>
|
||||
</target>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
using OpenWire.Client;
|
||||
|
||||
namespace OpenWire.Client {
|
||||
|
||||
/// <summary>
|
||||
/// useful base class for test cases
|
||||
/// </summary>
|
||||
public abstract class TestSupport {
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue