Get it to compile after refactor

git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@383072 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Hiram R. Chirino 2006-03-04 08:19:09 +00:00
parent fcbb2b22e8
commit bb28820a8e
16 changed files with 1215 additions and 1207 deletions

View File

@ -148,8 +148,8 @@
<exclude name="scvs.exe" /> <exclude name="scvs.exe" />
</fileset> </fileset>
</copy> </copy>
<!-- build OpenWire.Client assembly --> <!-- build ActiveMQ assembly -->
<nant buildfile="src/OpenWire.Client/OpenWire.Client.build" target="build" /> <nant buildfile="src/ActiveMQ/OpenWire.Client.build" target="build" />
<!-- build task assemblies --> <!-- build task assemblies -->
<nant target="build"> <nant target="build">
<buildfiles refid="tas.core"/> <buildfiles refid="tas.core"/>
@ -165,8 +165,8 @@
</target> </target>
<target name="test" depends="build"> <target name="test" depends="build">
<!-- build OpenWire.Client.Tests assembly --> <!-- build ActiveMQ Tests assembly -->
<nant buildfile="tests/OpenWire.Client/OpenWire.Client.build" target="test" /> <nant buildfile="tests/ActiveMQ/OpenWire.Client.build" target="test" />
<!-- build tests for task assemblies --> <!-- build tests for task assemblies -->
<nant target="build"> <nant target="build">
<buildfiles refid="tas.core.tests"/> <buildfiles refid="tas.core.tests"/>

View File

@ -1,186 +1,186 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build"> <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion> <ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion> <SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F7BA9EF7-ADF7-40EF-9A9E-206649DBB10C}</ProjectGuid> <ProjectGuid>{F7BA9EF7-ADF7-40EF-9A9E-206649DBB10C}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<RootNamespace>src</RootNamespace> <RootNamespace>src</RootNamespace>
<AssemblyName>src</AssemblyName> <AssemblyName>src</AssemblyName>
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<StartupObject/> <StartupObject/>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath> <OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants> <DefineConstants>DEBUG;TRACE</DefineConstants>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks> <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols> <DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize> <Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath> <OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants> <DefineConstants>TRACE</DefineConstants>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks> <AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System"/> <Reference Include="System"/>
<Reference Include="System.Data"/> <Reference Include="System.Data"/>
<Reference Include="System.Xml"/> <Reference Include="System.Xml"/>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets"/> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets"/>
<ItemGroup> <ItemGroup>
<Compile Include="OpenWire.Client\BrokerException.cs"/> <Compile Include="ActiveMQ\BrokerException.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQBytesMessage.cs"/> <Compile Include="ActiveMQ\Connection.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQDestination.cs"/> <Compile Include="ActiveMQ\ConnectionClosedException.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQMapMessage.cs"/> <Compile Include="ActiveMQ\ConnectionFactory.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQMessage.cs"/> <Compile Include="ActiveMQ\ConsumerClosedException.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQObjectMessage.cs"/> <Compile Include="ActiveMQ\DestinationFilter.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQQueue.cs"/> <Compile Include="ActiveMQ\IBytesMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQStreamMessage.cs"/> <Compile Include="ActiveMQ\IConnection.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQTempDestination.cs"/> <Compile Include="ActiveMQ\IConnectionFactory.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQTempQueue.cs"/> <Compile Include="ActiveMQ\IDestination.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQTempTopic.cs"/> <Compile Include="ActiveMQ\IMapMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQTextMessage.cs"/> <Compile Include="ActiveMQ\IMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\ActiveMQTopic.cs"/> <Compile Include="ActiveMQ\IMessageConsumer.cs"/>
<Compile Include="OpenWire.Client\Commands\BaseCommand.cs"/> <Compile Include="ActiveMQ\IMessageProducer.cs"/>
<Compile Include="OpenWire.Client\Commands\BrokerId.cs"/> <Compile Include="ActiveMQ\IPrimitiveMap.cs"/>
<Compile Include="OpenWire.Client\Commands\BrokerInfo.cs"/> <Compile Include="ActiveMQ\IQueue.cs"/>
<Compile Include="OpenWire.Client\Commands\ConnectionError.cs"/> <Compile Include="ActiveMQ\ISession.cs"/>
<Compile Include="OpenWire.Client\Commands\ConnectionId.cs"/> <Compile Include="ActiveMQ\IStartable.cs"/>
<Compile Include="OpenWire.Client\Commands\ConnectionInfo.cs"/> <Compile Include="ActiveMQ\ITemporaryQueue.cs"/>
<Compile Include="OpenWire.Client\Commands\ConsumerId.cs"/> <Compile Include="ActiveMQ\ITemporaryTopic.cs"/>
<Compile Include="OpenWire.Client\Commands\ConsumerInfo.cs"/> <Compile Include="ActiveMQ\ITextMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\ControlCommand.cs"/> <Compile Include="ActiveMQ\ITopic.cs"/>
<Compile Include="OpenWire.Client\Commands\DataArrayResponse.cs"/> <Compile Include="ActiveMQ\MessageConsumer.cs"/>
<Compile Include="OpenWire.Client\Commands\DataResponse.cs"/> <Compile Include="ActiveMQ\MessageProducer.cs"/>
<Compile Include="OpenWire.Client\Commands\DestinationInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\AbstractCommand.cs"/>
<Compile Include="OpenWire.Client\Commands\DiscoveryEvent.cs"/> <Compile Include="ActiveMQ\OpenWire\BaseDataStreamMarshaller.cs"/>
<Compile Include="OpenWire.Client\Commands\ExceptionResponse.cs"/> <Compile Include="ActiveMQ\OpenWire\BooleanStream.cs"/>
<Compile Include="OpenWire.Client\Commands\FlushCommand.cs"/> <Compile Include="ActiveMQ\OpenWire\BrokerError.cs"/>
<Compile Include="OpenWire.Client\Commands\IntegerResponse.cs"/> <Compile Include="ActiveMQ\OpenWire\Command.cs"/>
<Compile Include="OpenWire.Client\Commands\JournalQueueAck.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQBytesMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\JournalTopicAck.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQDestination.cs"/>
<Compile Include="OpenWire.Client\Commands\JournalTrace.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQMapMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\JournalTransaction.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\KeepAliveInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQObjectMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\LocalTransactionId.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQQueue.cs"/>
<Compile Include="OpenWire.Client\Commands\Message.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQStreamMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\MessageAck.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTempDestination.cs"/>
<Compile Include="OpenWire.Client\Commands\MessageDispatch.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTempQueue.cs"/>
<Compile Include="OpenWire.Client\Commands\MessageDispatchNotification.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTempTopic.cs"/>
<Compile Include="OpenWire.Client\Commands\MessageId.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTextMessage.cs"/>
<Compile Include="OpenWire.Client\Commands\ProducerId.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTopic.cs"/>
<Compile Include="OpenWire.Client\Commands\ProducerInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\BaseCommand.cs"/>
<Compile Include="OpenWire.Client\Commands\RemoveInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\BrokerId.cs"/>
<Compile Include="OpenWire.Client\Commands\RemoveSubscriptionInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\BrokerInfo.cs"/>
<Compile Include="OpenWire.Client\Commands\Response.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ConnectionError.cs"/>
<Compile Include="OpenWire.Client\Commands\SessionId.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ConnectionId.cs"/>
<Compile Include="OpenWire.Client\Commands\SessionInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ConnectionInfo.cs"/>
<Compile Include="OpenWire.Client\Commands\ShutdownInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ConsumerId.cs"/>
<Compile Include="OpenWire.Client\Commands\SubscriptionInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ConsumerInfo.cs"/>
<Compile Include="OpenWire.Client\Commands\TransactionId.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ControlCommand.cs"/>
<Compile Include="OpenWire.Client\Commands\TransactionInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\DataArrayResponse.cs"/>
<Compile Include="OpenWire.Client\Commands\WireFormatInfo.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\DataResponse.cs"/>
<Compile Include="OpenWire.Client\Commands\XATransactionId.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\DestinationInfo.cs"/>
<Compile Include="OpenWire.Client\Connection.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\DiscoveryEvent.cs"/>
<Compile Include="OpenWire.Client\ConnectionClosedException.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ExceptionResponse.cs"/>
<Compile Include="OpenWire.Client\ConnectionFactory.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\FlushCommand.cs"/>
<Compile Include="OpenWire.Client\ConsumerClosedException.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\IntegerResponse.cs"/>
<Compile Include="OpenWire.Client\Core\AbstractCommand.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\JournalQueueAck.cs"/>
<Compile Include="OpenWire.Client\Core\BaseDataStreamMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\JournalTopicAck.cs"/>
<Compile Include="OpenWire.Client\Core\BooleanStream.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\JournalTrace.cs"/>
<Compile Include="OpenWire.Client\Core\BrokerError.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\JournalTransaction.cs"/>
<Compile Include="OpenWire.Client\Core\Command.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\KeepAliveInfo.cs"/>
<Compile Include="OpenWire.Client\Core\DataStructure.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\LocalTransactionId.cs"/>
<Compile Include="OpenWire.Client\Core\DataStructureSupport.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\Message.cs"/>
<Compile Include="OpenWire.Client\Core\Dispatcher.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\MessageAck.cs"/>
<Compile Include="OpenWire.Client\Core\FutureResponse.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\MessageDispatch.cs"/>
<Compile Include="OpenWire.Client\Core\ISynchronization.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\MessageDispatchNotification.cs"/>
<Compile Include="OpenWire.Client\Core\ITransport.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\MessageId.cs"/>
<Compile Include="OpenWire.Client\Core\MarshallAware.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ProducerId.cs"/>
<Compile Include="OpenWire.Client\Core\MessagePropertyHelper.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ProducerInfo.cs"/>
<Compile Include="OpenWire.Client\Core\OpenWireFormat.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\RemoveInfo.cs"/>
<Compile Include="OpenWire.Client\Core\PrimitiveMap.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\RemoveSubscriptionInfo.cs"/>
<Compile Include="OpenWire.Client\Core\SocketTransport.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\Response.cs"/>
<Compile Include="OpenWire.Client\Core\TransactionContext.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\SessionId.cs"/>
<Compile Include="OpenWire.Client\DestinationFilter.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\SessionInfo.cs"/>
<Compile Include="OpenWire.Client\IBytesMessage.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\ShutdownInfo.cs"/>
<Compile Include="OpenWire.Client\IConnection.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\SubscriptionInfo.cs"/>
<Compile Include="OpenWire.Client\IConnectionFactory.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\TransactionId.cs"/>
<Compile Include="OpenWire.Client\IDestination.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\TransactionInfo.cs"/>
<Compile Include="OpenWire.Client\IMapMessage.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\WireFormatInfo.cs"/>
<Compile Include="OpenWire.Client\IMessage.cs"/> <Compile Include="ActiveMQ\OpenWire\Commands\XATransactionId.cs"/>
<Compile Include="OpenWire.Client\IMessageConsumer.cs"/> <Compile Include="ActiveMQ\OpenWire\DataStructure.cs"/>
<Compile Include="OpenWire.Client\IMessageProducer.cs"/> <Compile Include="ActiveMQ\OpenWire\DataStructureSupport.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQBytesMessageMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\Dispatcher.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQDestinationMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\FutureResponse.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQMapMessageMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\ISynchronization.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQMessageMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\ITransport.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQObjectMessageMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\MarshallAware.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQQueueMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\MessagePropertyHelper.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQStreamMessageMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\OpenWireFormat.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQTempDestinationMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\PrimitiveMap.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQTempQueueMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\SocketTransport.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQTempTopicMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\TransactionContext.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQTextMessageMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQBytesMessageMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ActiveMQTopicMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQDestinationMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\BaseCommandMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQMapMessageMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\BrokerIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQMessageMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\BrokerInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQObjectMessageMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ConnectionErrorMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQQueueMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ConnectionIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQStreamMessageMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ConnectionInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTempDestinationMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ConsumerIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTempQueueMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ConsumerInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTempTopicMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ControlCommandMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTextMessageMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\DataArrayResponseMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTopicMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\DataResponseMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\BaseCommandMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\DataStructureSupportMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\BrokerIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\DestinationInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\BrokerInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\DiscoveryEventMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ConnectionErrorMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ExceptionResponseMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ConnectionIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\FlushCommandMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ConnectionInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\IntegerResponseMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ConsumerIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\JournalQueueAckMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ConsumerInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\JournalTopicAckMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ControlCommandMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\JournalTraceMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\DataArrayResponseMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\JournalTransactionMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\DataResponseMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\KeepAliveInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\DataStructureSupportMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\LocalTransactionIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\DestinationInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\MarshallerFactory.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\DiscoveryEventMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\MessageAckMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ExceptionResponseMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\MessageDispatchMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\FlushCommandMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\MessageDispatchNotificationMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\IntegerResponseMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\MessageIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\JournalQueueAckMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\MessageMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\JournalTopicAckMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ProducerIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\JournalTraceMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ProducerInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\JournalTransactionMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\RemoveInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\KeepAliveInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\RemoveSubscriptionInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\LocalTransactionIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ResponseMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\MarshallerFactory.cs"/>
<Compile Include="OpenWire.Client\IO\SessionIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\MessageAckMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\SessionInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\MessageDispatchMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\ShutdownInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\MessageDispatchNotificationMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\SubscriptionInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\MessageIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\TransactionIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\MessageMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\TransactionInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ProducerIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\WireFormatInfoMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ProducerInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\IO\XATransactionIdMarshaller.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\RemoveInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\IPrimitiveMap.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\RemoveSubscriptionInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\IQueue.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ResponseMarshaller.cs"/>
<Compile Include="OpenWire.Client\ISession.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\SessionIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\IStartable.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\SessionInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\ITemporaryQueue.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\ShutdownInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\ITemporaryTopic.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\SubscriptionInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\ITextMessage.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\TransactionIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\ITopic.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\TransactionInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\MessageConsumer.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\WireFormatInfoMarshaller.cs"/>
<Compile Include="OpenWire.Client\MessageProducer.cs"/> <Compile Include="ActiveMQ\OpenWire\V1\XATransactionIdMarshaller.cs"/>
<Compile Include="OpenWire.Client\OpenWireException.cs"/> <Compile Include="ActiveMQ\OpenWireException.cs"/>
<Compile Include="OpenWire.Client\Session.cs"/> <Compile Include="ActiveMQ\Session.cs"/>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,77 +1,91 @@
using System; /*
using System.IO; * Copyright 2006 The Apache Software Foundation or its licensors, as
using System.Threading; * applicable.
*
using NUnit.Framework; * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
using OpenWire.Client; * You may obtain a copy of the License at
using OpenWire.Client.Core; *
namespace OpenWire.Client * http://www.apache.org/licenses/LICENSE-2.0
{ *
[TestFixture] * Unless required by applicable law or agreed to in writing, software
public class AsyncConsumeTest : TestSupport * distributed under the License is distributed on an "AS IS" BASIS,
{ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
protected Object semaphore = new Object(); * See the License for the specific language governing permissions and
protected bool received; * limitations under the License.
*/
[Test] using System;
public void TestAsynchronousConsume() using System.IO;
{ using System.Threading;
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
Assert.IsTrue(factory != null, "no factory created"); using NUnit.Framework;
using (IConnection connection = factory.CreateConnection()) namespace ActiveMQ
{ {
Assert.IsTrue(connection != null, "no connection created"); [TestFixture]
Console.WriteLine("Connected to ActiveMQ!"); public class AsyncConsumeTest : TestSupport
{
ISession session = connection.CreateSession(); protected Object semaphore = new Object();
IDestination destination = CreateDestination(session); protected bool received;
Assert.IsTrue(destination != null, "No queue available!");
[Test]
// lets create an async consumer public void TestAsynchronousConsume()
// START SNIPPET: demo {
IMessageConsumer consumer = session.CreateConsumer(destination); IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
consumer.Listener += new MessageListener(OnMessage); Assert.IsTrue(factory != null, "no factory created");
// END SNIPPET: demo
using (IConnection connection = factory.CreateConnection())
{
// now lets send a message Assert.IsTrue(connection != null, "no connection created");
session = connection.CreateSession(); Console.WriteLine("Connected to ActiveMQ!");
IMessageProducer producer = session.CreateProducer(destination);
IMessage request = CreateMessage(session); ISession session = connection.CreateSession();
request.JMSCorrelationID = "abc"; IDestination destination = CreateDestination(session);
request.JMSType = "Test"; Assert.IsTrue(destination != null, "No queue available!");
producer.Send(request);
// lets create an async consumer
// START SNIPPET: demo
WaitForMessageToArrive(); IMessageConsumer consumer = session.CreateConsumer(destination);
} consumer.Listener += new MessageListener(OnMessage);
// END SNIPPET: demo
}
protected void OnMessage(IMessage message) // now lets send a message
{ session = connection.CreateSession();
Console.WriteLine("Received message: " + message); IMessageProducer producer = session.CreateProducer(destination);
lock (semaphore) IMessage request = CreateMessage(session);
{ request.JMSCorrelationID = "abc";
received = true; request.JMSType = "Test";
Monitor.PulseAll(semaphore); producer.Send(request);
}
} WaitForMessageToArrive();
}
protected void WaitForMessageToArrive()
{ }
lock (semaphore)
{ protected void OnMessage(IMessage message)
if (!received) {
{ Console.WriteLine("Received message: " + message);
Monitor.Wait(semaphore, 10000); lock (semaphore)
} {
} received = true;
Assert.AreEqual(true, received, "Should have received a message by now!"); Monitor.PulseAll(semaphore);
} }
} }
}
protected void WaitForMessageToArrive()
{
lock (semaphore)
{
if (!received)
{
Monitor.Wait(semaphore, 10000);
}
}
Assert.AreEqual(true, received, "Should have received a message by now!");
}
}
}

View File

@ -1,33 +1,49 @@
using NUnit.Framework; /*
using System; * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable.
namespace OpenWire.Client *
{ * Licensed under the Apache License, Version 2.0 (the "License");
[TestFixture] * you may not use this file except in compliance with the License.
public class BadConsumeTest : TestSupport * You may obtain a copy of the License at
{ *
[Test] * http://www.apache.org/licenses/LICENSE-2.0
public void TestBadConsumeOperationToTestExceptions() *
{ * Unless required by applicable law or agreed to in writing, software
IConnectionFactory factory = new ConnectionFactory("localhost", 61616); * distributed under the License is distributed on an "AS IS" BASIS,
using (IConnection connection = factory.CreateConnection()) * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
{ * See the License for the specific language governing permissions and
ISession session = connection.CreateSession(); * limitations under the License.
*/
try using NUnit.Framework;
{ using System;
IMessageConsumer consumer = session.CreateConsumer(null);
Console.WriteLine("Created consumer: " + consumer); namespace ActiveMQ
{
Assert.Fail("Should have thrown an exception!"); [TestFixture]
} public class BadConsumeTest : TestSupport
catch (BrokerException e) {
{ [Test]
Console.WriteLine("Caught expected exception: " + e); public void TestBadConsumeOperationToTestExceptions()
Console.WriteLine("Stack: " + e.StackTrace); {
Console.WriteLine("Java Stack: " + e.JavaStackTrace); IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
} using (IConnection connection = factory.CreateConnection())
} {
} ISession session = connection.CreateSession();
}
} try
{
IMessageConsumer consumer = session.CreateConsumer(null);
Console.WriteLine("Created consumer: " + consumer);
Assert.Fail("Should have thrown an exception!");
}
catch (BrokerException e)
{
Console.WriteLine("Caught expected exception: " + e);
Console.WriteLine("Stack: " + e.StackTrace);
Console.WriteLine("Java Stack: " + e.JavaStackTrace);
}
}
}
}
}

View File

@ -1,58 +1,55 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
using System; using System;
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client; namespace ActiveMQ
using OpenWire.Client.Core; {
[ TestFixture ]
namespace OpenWire.Client public class BytesMessageTest : TestSupport
{ {
[ TestFixture ] byte[] expected = {1, 2, 3, 4, 5, 6, 7, 8};
public class BytesMessageTest : TestSupport
{ [ Test ]
byte[] expected = {1, 2, 3, 4, 5, 6, 7, 8}; public override void SendAndSyncReceive()
{
[ Test ] base.SendAndSyncReceive();
public override void SendAndSyncReceive() }
{
base.SendAndSyncReceive(); protected override IMessage CreateMessage(ISession session)
} {
IBytesMessage request = session.CreateBytesMessage(expected);
protected override IMessage CreateMessage(ISession session) return request;
{ }
IBytesMessage request = session.CreateBytesMessage(expected);
return request; protected override void AssertValidMessage(IMessage message)
} {
Assert.IsTrue(message is IBytesMessage, "Did not receive a IBytesMessage: " + message);
protected override void AssertValidMessage(IMessage message)
{ Console.WriteLine("Received IBytesMessage: " + message);
Assert.IsTrue(message is IBytesMessage, "Did not receive a IBytesMessage: " + message);
IBytesMessage bytesMessage = (IBytesMessage) message;
Console.WriteLine("Received IBytesMessage: " + message); byte[] actual = bytesMessage.Content;
Console.WriteLine("Received message with content: " + actual);
IBytesMessage bytesMessage = (IBytesMessage) message; Assert.AreEqual(expected, actual, "the message content");
byte[] actual = bytesMessage.Content; }
Console.WriteLine("Received message with content: " + actual);
Assert.AreEqual(expected, actual, "the message content"); }
} }
}
}

View File

@ -19,10 +19,7 @@ using System.IO;
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client; namespace ActiveMQ
using OpenWire.Client.Core;
namespace OpenWire.Client
{ {
[ TestFixture ] [ TestFixture ]
public class ClientTest : TestSupport public class ClientTest : TestSupport

View File

@ -1,61 +1,63 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client.Commands; using System.Collections;
using System.Collections;
using ActiveMQ.OpenWire;
namespace OpenWire.Client using ActiveMQ.OpenWire.Commands;
{
[TestFixture] namespace ActiveMQ
public class CommandTest {
{ [TestFixture]
public class CommandTest
[Test] {
public void TestCommand()
{ [Test]
ConsumerId value1 = new ConsumerId(); public void TestCommand()
value1.ConnectionId = "abc"; {
value1.SessionId = 123; ConsumerId value1 = new ConsumerId();
value1.Value = 456; value1.ConnectionId = "abc";
value1.SessionId = 123;
ConsumerId value2 = new ConsumerId(); value1.Value = 456;
value2.ConnectionId = "abc";
value2.SessionId = 123; ConsumerId value2 = new ConsumerId();
value2.Value = 456; value2.ConnectionId = "abc";
value2.SessionId = 123;
ConsumerId value3 = new ConsumerId(); value2.Value = 456;
value3.ConnectionId = "abc";
value3.SessionId = 123; ConsumerId value3 = new ConsumerId();
value3.Value = 457; value3.ConnectionId = "abc";
value3.SessionId = 123;
Assert.AreEqual(value1, value2, "value1 and value2 should be equal"); value3.Value = 457;
Assert.AreEqual(value1.GetHashCode(), value2.GetHashCode(), "value1 and value2 hash codes should be equal");
Assert.AreEqual(value1, value2, "value1 and value2 should be equal");
Assert.IsTrue(!value1.Equals(value3), "value1 and value3 should not be equal"); Assert.AreEqual(value1.GetHashCode(), value2.GetHashCode(), "value1 and value2 hash codes should be equal");
Assert.IsTrue(!value3.Equals(value2), "value3 and value2 should not be equal");
Assert.IsTrue(!value1.Equals(value3), "value1 and value3 should not be equal");
// now lets test an IDictionary Assert.IsTrue(!value3.Equals(value2), "value3 and value2 should not be equal");
IDictionary dictionary = new Hashtable();
dictionary[value1] = value3; // now lets test an IDictionary
IDictionary dictionary = new Hashtable();
// now lets lookup with a copy dictionary[value1] = value3;
object actual = dictionary[value2];
// now lets lookup with a copy
Assert.AreEqual(value3, actual, "Should have found item in Map using value2 as a key"); object actual = dictionary[value2];
}
} Assert.AreEqual(value3, actual, "Should have found item in Map using value2 as a key");
} }
}
}

View File

@ -1,92 +1,89 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
using System; using System;
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client; namespace ActiveMQ
using OpenWire.Client.Core; {
[TestFixture]
namespace OpenWire.Client public class ConsumerTest : TestSupport
{ {
[TestFixture] IConnectionFactory factory;
public class ConsumerTest : TestSupport IConnection connection;
{ IDestination destination;
IConnectionFactory factory;
IConnection connection; [SetUp]
IDestination destination; protected void SetUp()
{
[SetUp] factory = new ConnectionFactory("localhost", 61616);
protected void SetUp() connection = factory.CreateConnection();
{ }
factory = new ConnectionFactory("localhost", 61616);
connection = factory.CreateConnection(); [TearDown]
} protected void TearDown()
{
[TearDown] connection.Dispose();
protected void TearDown() }
{
connection.Dispose(); [Test]
} [Ignore("Not fully implemented yet.")]
public void testDurableConsumerSelectorChange()
[Test] {
[Ignore("Not fully implemented yet.")]
public void testDurableConsumerSelectorChange() // Receive a message with the JMS API
{ connection.ClientId="test";
connection.Start();
// Receive a message with the JMS API
connection.ClientId="test"; ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
connection.Start(); destination = session.GetTopic("foo");
IMessageProducer producer = session.CreateProducer(destination);
ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge); producer.Persistent = true;
destination = session.GetTopic("foo"); IMessageConsumer consumer = session.CreateDurableConsumer((ITopic)destination, "test", "color='red'", false);
IMessageProducer producer = session.CreateProducer(destination);
producer.Persistent = true; // Send the messages
IMessageConsumer consumer = session.CreateDurableConsumer((ITopic)destination, "test", "color='red'", false); ITextMessage message = session.CreateTextMessage("1st");
//message.SetStringProperty("color", "red");
// Send the messages producer.Send(message);
ITextMessage message = session.CreateTextMessage("1st");
//message.SetStringProperty("color", "red"); IMessage m = consumer.Receive(1000);
producer.Send(message); Assert.IsNotNull(m);
Assert.AreEqual("1st", ((ITextMessage)m).Text );
IMessage m = consumer.Receive(1000);
Assert.IsNotNull(m); // Change the subscription.
Assert.AreEqual("1st", ((ITextMessage)m).Text ); consumer.Dispose();
consumer = session.CreateDurableConsumer((ITopic)destination, "test", "color='blue'", false);
// Change the subscription.
consumer.Dispose(); message = session.CreateTextMessage("2nd");
consumer = session.CreateDurableConsumer((ITopic)destination, "test", "color='blue'", false); // message.setStringProperty("color", "red");
producer.Send(message);
message = session.CreateTextMessage("2nd"); message = session.CreateTextMessage("3rd");
// message.setStringProperty("color", "red"); // message.setStringProperty("color", "blue");
producer.Send(message); producer.Send(message);
message = session.CreateTextMessage("3rd");
// message.setStringProperty("color", "blue"); // Selector should skip the 2nd message.
producer.Send(message); m = consumer.Receive(1000);
Assert.IsNotNull(m);
// Selector should skip the 2nd message. Assert.AreEqual("3rd", ((ITextMessage)m).Text);
m = consumer.Receive(1000);
Assert.IsNotNull(m); Assert.IsNull(consumer.ReceiveNoWait());
Assert.AreEqual("3rd", ((ITextMessage)m).Text); }
Assert.IsNull(consumer.ReceiveNoWait()); }
} }
}
}

View File

@ -1,76 +1,78 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client.Core; using System;
using System;
using ActiveMQ.OpenWire;
namespace openwire_dotnet using ActiveMQ.OpenWire.Commands;
{
[TestFixture] namespace ActiveMQ
public class EndianTest {
{ [TestFixture]
public class EndianTest
[Test] {
public void TestLongEndian()
{ [Test]
long value = 0x0102030405060708L; public void TestLongEndian()
{
long newValue = BaseDataStreamMarshaller.SwitchEndian(value); long value = 0x0102030405060708L;
Console.WriteLine("New value: " + newValue); long newValue = BaseDataStreamMarshaller.SwitchEndian(value);
Assert.AreEqual(0x0807060504030201L, newValue); Console.WriteLine("New value: " + newValue);
long actual = BaseDataStreamMarshaller.SwitchEndian(newValue); Assert.AreEqual(0x0807060504030201L, newValue);
Assert.AreEqual(value, actual); long actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
}
Assert.AreEqual(value, actual);
[Test] }
public void TestIntEndian()
{ [Test]
int value = 0x12345678; public void TestIntEndian()
{
int newValue = BaseDataStreamMarshaller.SwitchEndian(value); int value = 0x12345678;
Console.WriteLine("New value: " + newValue); int newValue = BaseDataStreamMarshaller.SwitchEndian(value);
Assert.AreEqual(0x78563412, newValue); Console.WriteLine("New value: " + newValue);
int actual = BaseDataStreamMarshaller.SwitchEndian(newValue); Assert.AreEqual(0x78563412, newValue);
Assert.AreEqual(value, actual); int actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
}
[Test] Assert.AreEqual(value, actual);
public void TestShortEndian() }
{ [Test]
short value = 0x1234; public void TestShortEndian()
{
short newValue = BaseDataStreamMarshaller.SwitchEndian(value); short value = 0x1234;
Console.WriteLine("New value: " + newValue); short newValue = BaseDataStreamMarshaller.SwitchEndian(value);
Assert.AreEqual(0x3412, newValue); Console.WriteLine("New value: " + newValue);
short actual = BaseDataStreamMarshaller.SwitchEndian(newValue); Assert.AreEqual(0x3412, newValue);
Assert.AreEqual(value, actual); short actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
}
} Assert.AreEqual(value, actual);
} }
}
}

View File

@ -1,127 +1,124 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
using System; using System;
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client; namespace ActiveMQ
using OpenWire.Client.Core; {
[ TestFixture ]
namespace OpenWire.Client public class JMSPropertyTest : TestSupport
{ {
[ TestFixture ] // standard JMS properties
public class JMSPropertyTest : TestSupport string expectedText = "Hey this works!";
{ string correlationID = "abc";
// standard JMS properties ITemporaryQueue replyTo;
string expectedText = "Hey this works!"; bool persistent = true;
string correlationID = "abc"; byte priority = 5;
ITemporaryQueue replyTo; String type = "FooType";
bool persistent = true; String groupID = "MyGroup";
byte priority = 5; int groupSeq = 1;
String type = "FooType";
String groupID = "MyGroup"; // custom properties
int groupSeq = 1; string customText = "Cheese";
bool custom1 = true;
// custom properties byte custom2 = 12;
string customText = "Cheese"; short custom3 = 0x1234;
bool custom1 = true; int custom4 = 0x12345678;
byte custom2 = 12; long custom5 = 0x1234567812345678;
short custom3 = 0x1234; char custom6 = 'J';
int custom4 = 0x12345678;
long custom5 = 0x1234567812345678; [ Test ]
char custom6 = 'J'; public override void SendAndSyncReceive()
{
[ Test ] base.SendAndSyncReceive();
public override void SendAndSyncReceive() }
{
base.SendAndSyncReceive(); protected override IMessage CreateMessage(ISession session)
} {
ITextMessage message = session.CreateTextMessage(expectedText);
protected override IMessage CreateMessage(ISession session) replyTo = session.CreateTemporaryQueue();
{
ITextMessage message = session.CreateTextMessage(expectedText); // lets set the headers
replyTo = session.CreateTemporaryQueue(); message.JMSCorrelationID = correlationID;
message.JMSReplyTo = replyTo;
// lets set the headers message.JMSPersistent = persistent;
message.JMSCorrelationID = correlationID; message.JMSPriority = priority;
message.JMSReplyTo = replyTo; message.JMSType = type;
message.JMSPersistent = persistent; message.JMSXGroupID = groupID;
message.JMSPriority = priority; message.JMSXGroupSeq = groupSeq;
message.JMSType = type;
message.JMSXGroupID = groupID; // lets set the custom headers
message.JMSXGroupSeq = groupSeq; message.Properties["customText"] = customText;
message.Properties["custom1"] = custom1;
// lets set the custom headers message.Properties["custom2"] = custom2;
message.Properties["customText"] = customText; message.Properties["custom3"] = custom3;
message.Properties["custom1"] = custom1; message.Properties["custom4"] = custom4;
message.Properties["custom2"] = custom2; message.Properties["custom5"] = custom5;
message.Properties["custom3"] = custom3; message.Properties["custom6"] = custom6;
message.Properties["custom4"] = custom4;
message.Properties["custom5"] = custom5; return message;
message.Properties["custom6"] = custom6; }
return message; protected override void AssertValidMessage(IMessage message)
} {
Assert.IsTrue(message is ITextMessage, "Did not receive a ITextMessage!");
protected override void AssertValidMessage(IMessage message)
{ Console.WriteLine("Received Message: " + message);
Assert.IsTrue(message is ITextMessage, "Did not receive a ITextMessage!");
ITextMessage textMessage = (ITextMessage) message;
Console.WriteLine("Received Message: " + message); String text = textMessage.Text;
Assert.AreEqual(expectedText, text, "the message text");
ITextMessage textMessage = (ITextMessage) message;
String text = textMessage.Text; // compare standard JMS headers
Assert.AreEqual(expectedText, text, "the message text"); Assert.AreEqual(correlationID, message.JMSCorrelationID, "JMSCorrelationID");
Assert.AreEqual(replyTo, message.JMSReplyTo, "JMSReplyTo");
// compare standard JMS headers Assert.AreEqual(persistent, message.JMSPersistent, "JMSPersistent");
Assert.AreEqual(correlationID, message.JMSCorrelationID, "JMSCorrelationID"); Assert.AreEqual(priority, message.JMSPriority, "JMSPriority");
Assert.AreEqual(replyTo, message.JMSReplyTo, "JMSReplyTo"); Assert.AreEqual(type, message.JMSType, "JMSType");
Assert.AreEqual(persistent, message.JMSPersistent, "JMSPersistent"); Assert.AreEqual(groupID, message.JMSXGroupID, "JMSXGroupID");
Assert.AreEqual(priority, message.JMSPriority, "JMSPriority"); Assert.AreEqual(groupSeq, message.JMSXGroupSeq, "JMSXGroupSeq");
Assert.AreEqual(type, message.JMSType, "JMSType");
Assert.AreEqual(groupID, message.JMSXGroupID, "JMSXGroupID"); // compare custom headers
Assert.AreEqual(groupSeq, message.JMSXGroupSeq, "JMSXGroupSeq"); Assert.AreEqual(customText, message.Properties["customText"], "customText");
Assert.AreEqual(custom1, message.Properties["custom1"], "custom1");
// compare custom headers Assert.AreEqual(custom2, message.Properties["custom2"], "custom2");
Assert.AreEqual(customText, message.Properties["customText"], "customText"); Assert.AreEqual(custom3, message.Properties["custom3"], "custom3");
Assert.AreEqual(custom1, message.Properties["custom1"], "custom1"); Assert.AreEqual(custom4, message.Properties["custom4"], "custom4");
Assert.AreEqual(custom2, message.Properties["custom2"], "custom2"); // TODO
Assert.AreEqual(custom3, message.Properties["custom3"], "custom3"); Assert.AreEqual(custom5, message.Properties["custom5"], "custom5");
Assert.AreEqual(custom4, message.Properties["custom4"], "custom4"); Assert.AreEqual(custom6, message.Properties["custom6"], "custom6");
// TODO
Assert.AreEqual(custom5, message.Properties["custom5"], "custom5"); Assert.AreEqual(custom1, message.Properties.GetBool("custom1"), "custom1");
Assert.AreEqual(custom6, message.Properties["custom6"], "custom6"); Assert.AreEqual(custom2, message.Properties.GetByte("custom2"), "custom2");
Assert.AreEqual(custom3, message.Properties.GetShort("custom3"), "custom3");
Assert.AreEqual(custom1, message.Properties.GetBool("custom1"), "custom1"); Assert.AreEqual(custom4, message.Properties.GetInt("custom4"), "custom4");
Assert.AreEqual(custom2, message.Properties.GetByte("custom2"), "custom2"); Assert.AreEqual(custom5, message.Properties.GetLong("custom5"), "custom5");
Assert.AreEqual(custom3, message.Properties.GetShort("custom3"), "custom3"); Assert.AreEqual(custom6, message.Properties.GetChar("custom6"), "custom6");
Assert.AreEqual(custom4, message.Properties.GetInt("custom4"), "custom4");
Assert.AreEqual(custom5, message.Properties.GetLong("custom5"), "custom5"); // lets now look at some standard JMS headers
Assert.AreEqual(custom6, message.Properties.GetChar("custom6"), "custom6"); Console.WriteLine("JMSExpiration: " + message.JMSExpiration);
Console.WriteLine("JMSMessageId: " + message.JMSMessageId);
// lets now look at some standard JMS headers Console.WriteLine("JMSRedelivered: " + message.JMSRedelivered);
Console.WriteLine("JMSExpiration: " + message.JMSExpiration); Console.WriteLine("JMSTimestamp: " + message.JMSTimestamp);
Console.WriteLine("JMSMessageId: " + message.JMSMessageId); Console.WriteLine("JMSXDeliveryCount: " + message.JMSXDeliveryCount);
Console.WriteLine("JMSRedelivered: " + message.JMSRedelivered); Console.WriteLine("JMSXProducerTXID: " + message.JMSXProducerTXID);
Console.WriteLine("JMSTimestamp: " + message.JMSTimestamp); }
Console.WriteLine("JMSXDeliveryCount: " + message.JMSXDeliveryCount); }
Console.WriteLine("JMSXProducerTXID: " + message.JMSXProducerTXID); }
}
}
}

View File

@ -1,95 +1,92 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
using System; using System;
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client; namespace ActiveMQ
using OpenWire.Client.Core; {
[ TestFixture ]
namespace OpenWire.Client public class MapMessageTest : TestSupport
{ {
[ TestFixture ] bool a = true;
public class MapMessageTest : TestSupport byte b = 123;
{ char c = 'c';
bool a = true; short d = 0x1234;
byte b = 123; int e = 0x12345678;
char c = 'c'; long f = 0x1234567812345678;
short d = 0x1234; string g = "Hello World!";
int e = 0x12345678;
long f = 0x1234567812345678; [ Test ]
string g = "Hello World!"; public override void SendAndSyncReceive()
{
[ Test ] base.SendAndSyncReceive();
public override void SendAndSyncReceive() }
{
base.SendAndSyncReceive(); protected override IMessage CreateMessage(ISession session)
} {
IMapMessage message = session.CreateMapMessage();
protected override IMessage CreateMessage(ISession session)
{ message.Body["a"] = a;
IMapMessage message = session.CreateMapMessage(); message.Body["b"] = b;
message.Body["c"] = c;
message.Body["a"] = a; message.Body["d"] = d;
message.Body["b"] = b; message.Body["e"] = e;
message.Body["c"] = c; message.Body["f"] = f;
message.Body["d"] = d; message.Body["g"] = g;
message.Body["e"] = e;
message.Body["f"] = f; return message;
message.Body["g"] = g; }
return message; protected override void AssertValidMessage(IMessage message)
} {
Assert.IsTrue(message is IMapMessage, "Did not receive a MapMessage!");
protected override void AssertValidMessage(IMessage message) IMapMessage mapMessage = (IMapMessage) message;
{
Assert.IsTrue(message is IMapMessage, "Did not receive a MapMessage!"); Console.WriteLine("Received MapMessage: " + message);
IMapMessage mapMessage = (IMapMessage) message; Console.WriteLine("Received Count: " + mapMessage.Body.Count);
Console.WriteLine("Received MapMessage: " + message); Assert.AreEqual(ToHex(f), ToHex(mapMessage.Body.GetLong("f")), "map entry: f as hex");
Console.WriteLine("Received Count: " + mapMessage.Body.Count);
// use generic API to access entries
Assert.AreEqual(ToHex(f), ToHex(mapMessage.Body.GetLong("f")), "map entry: f as hex"); Assert.AreEqual(a, mapMessage.Body["a"], "generic map entry: a");
Assert.AreEqual(b, mapMessage.Body["b"], "generic map entry: b");
// use generic API to access entries Assert.AreEqual(c, mapMessage.Body["c"], "generic map entry: c");
Assert.AreEqual(a, mapMessage.Body["a"], "generic map entry: a"); Assert.AreEqual(d, mapMessage.Body["d"], "generic map entry: d");
Assert.AreEqual(b, mapMessage.Body["b"], "generic map entry: b"); Assert.AreEqual(e, mapMessage.Body["e"], "generic map entry: e");
Assert.AreEqual(c, mapMessage.Body["c"], "generic map entry: c"); Assert.AreEqual(f, mapMessage.Body["f"], "generic map entry: f");
Assert.AreEqual(d, mapMessage.Body["d"], "generic map entry: d"); Assert.AreEqual(g, mapMessage.Body["g"], "generic map entry: g");
Assert.AreEqual(e, mapMessage.Body["e"], "generic map entry: e");
Assert.AreEqual(f, mapMessage.Body["f"], "generic map entry: f"); // use type safe APIs
Assert.AreEqual(g, mapMessage.Body["g"], "generic map entry: g"); Assert.AreEqual(a, mapMessage.Body.GetBool("a"), "map entry: a");
Assert.AreEqual(b, mapMessage.Body.GetByte("b"), "map entry: b");
// use type safe APIs Assert.AreEqual(c, mapMessage.Body.GetChar("c"), "map entry: c");
Assert.AreEqual(a, mapMessage.Body.GetBool("a"), "map entry: a"); Assert.AreEqual(d, mapMessage.Body.GetShort("d"), "map entry: d");
Assert.AreEqual(b, mapMessage.Body.GetByte("b"), "map entry: b"); Assert.AreEqual(e, mapMessage.Body.GetInt("e"), "map entry: e");
Assert.AreEqual(c, mapMessage.Body.GetChar("c"), "map entry: c"); Assert.AreEqual(f, mapMessage.Body.GetLong("f"), "map entry: f");
Assert.AreEqual(d, mapMessage.Body.GetShort("d"), "map entry: d"); Assert.AreEqual(g, mapMessage.Body.GetString("g"), "map entry: g");
Assert.AreEqual(e, mapMessage.Body.GetInt("e"), "map entry: e");
Assert.AreEqual(f, mapMessage.Body.GetLong("f"), "map entry: f");
Assert.AreEqual(g, mapMessage.Body.GetString("g"), "map entry: g"); }
protected string ToHex(long value)
} {
return String.Format("{0:x}", value);
protected string ToHex(long value) }
{ }
return String.Format("{0:x}", value); }
}
}
}

View File

@ -19,10 +19,7 @@ using System.IO;
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client; namespace ActiveMQ.OpenWire
using OpenWire.Client.Core;
namespace OpenWire.Client.Core
{ {
[TestFixture] [TestFixture]
public class BooleanStreamTest : TestSupport public class BooleanStreamTest : TestSupport

View File

@ -1,80 +1,79 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
using System; using System;
using System.IO; using System.IO;
using OpenWire.Client; using ActiveMQ.OpenWire;
using OpenWire.Client.Core; using ActiveMQ.OpenWire.Commands;
using OpenWire.Client.Commands;
namespace ActiveMQ
namespace openwire_dotnet {
{ public class TestMain
public class TestMain {
{ public static void Main(string[] args)
public static void Main(string[] args) {
{ try
try {
{ Console.WriteLine("About to connect to ActiveMQ");
Console.WriteLine("About to connect to ActiveMQ");
// START SNIPPET: demo
// START SNIPPET: demo IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
IConnectionFactory factory = new ConnectionFactory("localhost", 61616); using (IConnection connection = factory.CreateConnection())
using (IConnection connection = factory.CreateConnection()) {
{ Console.WriteLine("Created a connection!");
Console.WriteLine("Created a connection!");
ISession session = connection.CreateSession();
ISession session = connection.CreateSession();
IDestination destination = session.GetQueue("FOO.BAR");
IDestination destination = session.GetQueue("FOO.BAR"); Console.WriteLine("Using destination: " + destination);
Console.WriteLine("Using destination: " + destination);
// lets create a consumer and producer
// lets create a consumer and producer IMessageConsumer consumer = session.CreateConsumer(destination);
IMessageConsumer consumer = session.CreateConsumer(destination);
IMessageProducer producer = session.CreateProducer(destination);
IMessageProducer producer = session.CreateProducer(destination); producer.Persistent = true;
producer.Persistent = true;
// lets send a message
// lets send a message ITextMessage request = session.CreateTextMessage("Hello World!");
ITextMessage request = session.CreateTextMessage("Hello World!"); request.JMSCorrelationID = "abc";
request.JMSCorrelationID = "abc"; request.JMSXGroupID = "cheese";
request.JMSXGroupID = "cheese"; request.Properties["myHeader"] = "James";
request.Properties["myHeader"] = "James";
producer.Send(request);
producer.Send(request);
// lets consume a message
// lets consume a message ActiveMQTextMessage message = (ActiveMQTextMessage) consumer.Receive();
ActiveMQTextMessage message = (ActiveMQTextMessage) consumer.Receive(); if (message == null)
if (message == null) {
{ Console.WriteLine("No message received!");
Console.WriteLine("No message received!"); }
} else
else {
{ Console.WriteLine("Received message with ID: " + message.JMSMessageId);
Console.WriteLine("Received message with ID: " + message.JMSMessageId); Console.WriteLine("Received message with text: " + message.Text);
Console.WriteLine("Received message with text: " + message.Text); }
} }
} // END SNIPPET: demo
// END SNIPPET: demo }
} catch (Exception e)
catch (Exception e) {
{ Console.WriteLine("Caught: " + e);
Console.WriteLine("Caught: " + e); Console.WriteLine("Stack: " + e.StackTrace);
Console.WriteLine("Stack: " + e.StackTrace); }
} }
} }
} }
}

View File

@ -19,11 +19,7 @@ using System.IO;
using NUnit.Framework; using NUnit.Framework;
using OpenWire.Client; namespace ActiveMQ
using OpenWire.Client.Core;
namespace OpenWire.Client
{ {
/// <summary> /// <summary>

View File

@ -1,290 +1,287 @@
/* /*
* Copyright 2006 The Apache Software Foundation or its licensors, as * Copyright 2006 The Apache Software Foundation or its licensors, as
* applicable. * applicable.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
using System; using System;
using System.IO; using System.IO;
using NUnit.Framework; using NUnit.Framework;
using System.Collections;
using OpenWire.Client;
using OpenWire.Client.Core; namespace ActiveMQ
using System.Collections; {
[TestFixture]
namespace OpenWire.Client public class TransactionTest : TestSupport
{ {
[TestFixture] private static int destinationCounter;
public class TransactionTest : TestSupport
{ IDestination destination;
private static int destinationCounter; IConnection connection;
ISession session;
IDestination destination; IMessageProducer producer;
IConnection connection; IMessageConsumer consumer;
ISession session;
IMessageProducer producer; [SetUp]
IMessageConsumer consumer; public void SetUp()
{
[SetUp] Connect();
public void SetUp()
{ // lets consume any outstanding messages from previous test runs
Connect(); while (consumer.Receive(1000) != null)
{
// lets consume any outstanding messages from previous test runs }
while (consumer.Receive(1000) != null) session.Commit();
{ }
}
session.Commit();
}
[TearDown]
public void TearDown()
{
[TearDown] Disconnect();
public void TearDown() }
{
Disconnect(); [Test]
} public void TestSendRollback()
{
[Test] IMessage[] outbound = new IMessage[]{
public void TestSendRollback() session.CreateTextMessage("First Message"),
{ session.CreateTextMessage("Second Message")
IMessage[] outbound = new IMessage[]{ };
session.CreateTextMessage("First Message"),
session.CreateTextMessage("Second Message") //sends a message
}; producer.Send(outbound[0]);
session.Commit();
//sends a message
producer.Send(outbound[0]); //sends a message that gets rollbacked
session.Commit(); producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
session.Rollback();
//sends a message that gets rollbacked
producer.Send(session.CreateTextMessage("I'm going to get rolled back.")); //sends a message
session.Rollback(); producer.Send(outbound[1]);
session.Commit();
//sends a message
producer.Send(outbound[1]); //receives the first message
session.Commit(); ArrayList messages = new ArrayList();
Console.WriteLine("About to consume message 1");
//receives the first message IMessage message = consumer.Receive(1000);
ArrayList messages = new ArrayList(); messages.Add(message);
Console.WriteLine("About to consume message 1"); Console.WriteLine("Received: " + message);
IMessage message = consumer.Receive(1000);
messages.Add(message); //receives the second message
Console.WriteLine("Received: " + message); Console.WriteLine("About to consume message 2");
message = consumer.Receive(4000);
//receives the second message messages.Add(message);
Console.WriteLine("About to consume message 2"); Console.WriteLine("Received: " + message);
message = consumer.Receive(4000);
messages.Add(message); //validates that the rollbacked was not consumed
Console.WriteLine("Received: " + message); session.Commit();
IMessage[] inbound = new IMessage[messages.Count];
//validates that the rollbacked was not consumed messages.CopyTo(inbound);
session.Commit(); AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
IMessage[] inbound = new IMessage[messages.Count]; }
messages.CopyTo(inbound);
AssertTextMessagesEqual("Rollback did not work.", outbound, inbound); [Test]
} public void TestSendSessionClose()
{
[Test] IMessage[] outbound = new IMessage[]{
public void TestSendSessionClose() session.CreateTextMessage("First Message"),
{ session.CreateTextMessage("Second Message")
IMessage[] outbound = new IMessage[]{ };
session.CreateTextMessage("First Message"),
session.CreateTextMessage("Second Message") //sends a message
}; producer.Send(outbound[0]);
session.Commit();
//sends a message
producer.Send(outbound[0]); //sends a message that gets rollbacked
session.Commit(); producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
consumer.Dispose();
//sends a message that gets rollbacked session.Dispose();
producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
consumer.Dispose(); Reconnect();
session.Dispose();
//sends a message
Reconnect(); producer.Send(outbound[1]);
session.Commit();
//sends a message
producer.Send(outbound[1]); //receives the first message
session.Commit(); ArrayList messages = new ArrayList();
Console.WriteLine("About to consume message 1");
//receives the first message IMessage message = consumer.Receive(1000);
ArrayList messages = new ArrayList(); messages.Add(message);
Console.WriteLine("About to consume message 1"); Console.WriteLine("Received: " + message);
IMessage message = consumer.Receive(1000);
messages.Add(message); //receives the second message
Console.WriteLine("Received: " + message); Console.WriteLine("About to consume message 2");
message = consumer.Receive(4000);
//receives the second message messages.Add(message);
Console.WriteLine("About to consume message 2"); Console.WriteLine("Received: " + message);
message = consumer.Receive(4000);
messages.Add(message); //validates that the rollbacked was not consumed
Console.WriteLine("Received: " + message); session.Commit();
IMessage[] inbound = new IMessage[messages.Count];
//validates that the rollbacked was not consumed messages.CopyTo(inbound);
session.Commit(); AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
IMessage[] inbound = new IMessage[messages.Count]; }
messages.CopyTo(inbound);
AssertTextMessagesEqual("Rollback did not work.", outbound, inbound); [Test]
} public void TestReceiveRollback()
{
[Test] IMessage[] outbound = new IMessage[]{
public void TestReceiveRollback() session.CreateTextMessage("First Message"),
{ session.CreateTextMessage("Second Message")
IMessage[] outbound = new IMessage[]{ };
session.CreateTextMessage("First Message"),
session.CreateTextMessage("Second Message") //sent both messages
}; producer.Send(outbound[0]);
producer.Send(outbound[1]);
//sent both messages session.Commit();
producer.Send(outbound[0]);
producer.Send(outbound[1]); Console.WriteLine("Sent 0: " + outbound[0]);
session.Commit(); Console.WriteLine("Sent 1: " + outbound[1]);
Console.WriteLine("Sent 0: " + outbound[0]); ArrayList messages = new ArrayList();
Console.WriteLine("Sent 1: " + outbound[1]); IMessage message = consumer.Receive(1000);
messages.Add(message);
ArrayList messages = new ArrayList(); Assert.AreEqual(outbound[0], message);
IMessage message = consumer.Receive(1000); session.Commit();
messages.Add(message);
Assert.AreEqual(outbound[0], message); // rollback so we can get that last message again.
session.Commit(); message = consumer.Receive(1000);
Assert.IsNotNull(message);
// rollback so we can get that last message again. Assert.AreEqual(outbound[1], message);
message = consumer.Receive(1000); session.Rollback();
Assert.IsNotNull(message);
Assert.AreEqual(outbound[1], message); // Consume again.. the previous message should
session.Rollback(); // get redelivered.
message = consumer.Receive(5000);
// Consume again.. the previous message should Assert.IsNotNull(message, "Should have re-received the message again!");
// get redelivered. messages.Add(message);
message = consumer.Receive(5000); session.Commit();
Assert.IsNotNull(message, "Should have re-received the message again!");
messages.Add(message); IMessage[] inbound = new IMessage[messages.Count];
session.Commit(); messages.CopyTo(inbound);
AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
IMessage[] inbound = new IMessage[messages.Count]; }
messages.CopyTo(inbound);
AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
} [Test]
public void TestReceiveTwoThenRollback()
{
[Test] IMessage[] outbound = new IMessage[]{
public void TestReceiveTwoThenRollback() session.CreateTextMessage("First Message"),
{ session.CreateTextMessage("Second Message")
IMessage[] outbound = new IMessage[]{ };
session.CreateTextMessage("First Message"),
session.CreateTextMessage("Second Message") producer.Send(outbound[0]);
}; producer.Send(outbound[1]);
session.Commit();
producer.Send(outbound[0]);
producer.Send(outbound[1]); Console.WriteLine("Sent 0: " + outbound[0]);
session.Commit(); Console.WriteLine("Sent 1: " + outbound[1]);
Console.WriteLine("Sent 0: " + outbound[0]); ArrayList messages = new ArrayList();
Console.WriteLine("Sent 1: " + outbound[1]); IMessage message = consumer.Receive(1000);
AssertTextMessageEqual("first mesage received before rollback", outbound[0], message);
ArrayList messages = new ArrayList();
IMessage message = consumer.Receive(1000); message = consumer.Receive(1000);
AssertTextMessageEqual("first mesage received before rollback", outbound[0], message); Assert.IsNotNull(message);
AssertTextMessageEqual("second message received before rollback", outbound[1], message);
message = consumer.Receive(1000); session.Rollback();
Assert.IsNotNull(message);
AssertTextMessageEqual("second message received before rollback", outbound[1], message); // Consume again.. the previous message should
session.Rollback(); // get redelivered.
message = consumer.Receive(5000);
// Consume again.. the previous message should Assert.IsNotNull(message, "Should have re-received the first message again!");
// get redelivered. messages.Add(message);
message = consumer.Receive(5000); AssertTextMessageEqual("first message received after rollback", outbound[0], message);
Assert.IsNotNull(message, "Should have re-received the first message again!");
messages.Add(message); message = consumer.Receive(5000);
AssertTextMessageEqual("first message received after rollback", outbound[0], message); Assert.IsNotNull(message, "Should have re-received the second message again!");
messages.Add(message);
message = consumer.Receive(5000); AssertTextMessageEqual("second message received after rollback", outbound[1], message);
Assert.IsNotNull(message, "Should have re-received the second message again!");
messages.Add(message); Assert.IsNull(consumer.ReceiveNoWait());
AssertTextMessageEqual("second message received after rollback", outbound[1], message); session.Commit();
Assert.IsNull(consumer.ReceiveNoWait()); IMessage[] inbound = new IMessage[messages.Count];
session.Commit(); messages.CopyTo(inbound);
AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
IMessage[] inbound = new IMessage[messages.Count]; }
messages.CopyTo(inbound);
AssertTextMessagesEqual("Rollback did not work", outbound, inbound); protected override string CreateDestinationName()
} {
// TODO - how can we get the test name?
protected override string CreateDestinationName() return base.CreateDestinationName() + (++destinationCounter);
{ }
// TODO - how can we get the test name?
return base.CreateDestinationName() + (++destinationCounter); protected void AssertTextMessagesEqual(String message, IMessage[] expected, IMessage[] actual)
} {
Assert.AreEqual(expected.Length, actual.Length, "Incorrect number of messages received");
protected void AssertTextMessagesEqual(String message, IMessage[] expected, IMessage[] actual)
{ for (int i = 0; i < expected.Length; i++)
Assert.AreEqual(expected.Length, actual.Length, "Incorrect number of messages received"); {
AssertTextMessageEqual(message + ". Index: " + i, expected[i], actual[i]);
for (int i = 0; i < expected.Length; i++) }
{ }
AssertTextMessageEqual(message + ". Index: " + i, expected[i], actual[i]);
} protected void AssertTextMessageEqual(String message, IMessage expected, IMessage actual)
} {
Assert.IsTrue(expected is ITextMessage, "expected object not a text message");
protected void AssertTextMessageEqual(String message, IMessage expected, IMessage actual) Assert.IsTrue(actual is ITextMessage, "actual object not a text message");
{
Assert.IsTrue(expected is ITextMessage, "expected object not a text message"); String expectedText = ((ITextMessage) expected).Text;
Assert.IsTrue(actual is ITextMessage, "actual object not a text message"); String actualText = ((ITextMessage) actual).Text;
String expectedText = ((ITextMessage) expected).Text; Assert.AreEqual(expectedText, actualText, message);
String actualText = ((ITextMessage) actual).Text; }
Assert.AreEqual(expectedText, actualText, message); protected void Connect()
} {
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
protected void Connect()
{ connection = factory.CreateConnection();
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
session = connection.CreateSession(AcknowledgementMode.Transactional);
connection = factory.CreateConnection();
// reuse the same destination if we reconnect
session = connection.CreateSession(AcknowledgementMode.Transactional); if (destination == null)
{
// reuse the same destination if we reconnect destination = CreateDestination(session);
if (destination == null) }
{
destination = CreateDestination(session); consumer = session.CreateConsumer(destination);
}
producer = session.CreateProducer(destination);
consumer = session.CreateConsumer(destination); }
producer = session.CreateProducer(destination);
} protected void Disconnect()
{
if (connection != null)
protected void Disconnect() {
{ connection.Dispose();
if (connection != null) connection = null;
{ }
connection.Dispose(); }
connection = null;
} protected void Reconnect()
} {
Disconnect();
protected void Reconnect() Connect();
{ }
Disconnect();
Connect(); }
} }
}
}

View File

@ -34,25 +34,25 @@
<Reference Include="System.Xml"/> <Reference Include="System.Xml"/>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets"/> <Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets"/>
<ItemGroup>
<Compile Include="OpenWire.Client\AsyncConsumeTest.cs"/>
<Compile Include="OpenWire.Client\BadConsumeTest.cs"/>
<Compile Include="OpenWire.Client\BytesMessageTest.cs"/>
<Compile Include="OpenWire.Client\ClientTest.cs"/>
<Compile Include="OpenWire.Client\CommandTest.cs"/>
<Compile Include="OpenWire.Client\ConsumerTest.cs"/>
<Compile Include="OpenWire.Client\Core\BooleanStreamTest.cs"/>
<Compile Include="OpenWire.Client\EndianTest.cs"/>
<Compile Include="OpenWire.Client\JMSPropertyTest.cs"/>
<Compile Include="OpenWire.Client\MapMessageTest.cs"/>
<Compile Include="OpenWire.Client\TestMain.cs"/>
<Compile Include="OpenWire.Client\TestSupport.cs"/>
<Compile Include="OpenWire.Client\TransactionTest.cs"/>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="../src/src.csproj"> <ProjectReference Include="../src/src.csproj">
<Name>src</Name> <Name>src</Name>
<Project>{F7BA9EF7-ADF7-40EF-9A9E-206649DBB10C}</Project> <Project>{F7BA9EF7-ADF7-40EF-9A9E-206649DBB10C}</Project>
</ProjectReference> </ProjectReference>
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Include="ActiveMQ\AsyncConsumeTest.cs"/>
<Compile Include="ActiveMQ\BadConsumeTest.cs"/>
<Compile Include="ActiveMQ\BytesMessageTest.cs"/>
<Compile Include="ActiveMQ\ClientTest.cs"/>
<Compile Include="ActiveMQ\CommandTest.cs"/>
<Compile Include="ActiveMQ\ConsumerTest.cs"/>
<Compile Include="ActiveMQ\EndianTest.cs"/>
<Compile Include="ActiveMQ\JMSPropertyTest.cs"/>
<Compile Include="ActiveMQ\MapMessageTest.cs"/>
<Compile Include="ActiveMQ\OpenWire\BooleanStreamTest.cs"/>
<Compile Include="ActiveMQ\TestMain.cs"/>
<Compile Include="ActiveMQ\TestSupport.cs"/>
<Compile Include="ActiveMQ\TransactionTest.cs"/>
</ItemGroup>
</Project> </Project>