mirror of https://github.com/apache/activemq.git
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:
parent
fcbb2b22e8
commit
bb28820a8e
|
@ -148,8 +148,8 @@
|
|||
<exclude name="scvs.exe" />
|
||||
</fileset>
|
||||
</copy>
|
||||
<!-- build OpenWire.Client assembly -->
|
||||
<nant buildfile="src/OpenWire.Client/OpenWire.Client.build" target="build" />
|
||||
<!-- build ActiveMQ assembly -->
|
||||
<nant buildfile="src/ActiveMQ/OpenWire.Client.build" target="build" />
|
||||
<!-- build task assemblies -->
|
||||
<nant target="build">
|
||||
<buildfiles refid="tas.core"/>
|
||||
|
@ -165,8 +165,8 @@
|
|||
</target>
|
||||
|
||||
<target name="test" depends="build">
|
||||
<!-- build OpenWire.Client.Tests assembly -->
|
||||
<nant buildfile="tests/OpenWire.Client/OpenWire.Client.build" target="test" />
|
||||
<!-- build ActiveMQ Tests assembly -->
|
||||
<nant buildfile="tests/ActiveMQ/OpenWire.Client.build" target="test" />
|
||||
<!-- build tests for task assemblies -->
|
||||
<nant target="build">
|
||||
<buildfiles refid="tas.core.tests"/>
|
||||
|
|
|
@ -1,186 +1,186 @@
|
|||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F7BA9EF7-ADF7-40EF-9A9E-206649DBB10C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>src</RootNamespace>
|
||||
<AssemblyName>src</AssemblyName>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<StartupObject/>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System"/>
|
||||
<Reference Include="System.Data"/>
|
||||
<Reference Include="System.Xml"/>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets"/>
|
||||
<ItemGroup>
|
||||
<Compile Include="OpenWire.Client\BrokerException.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQBytesMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQDestination.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQMapMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQObjectMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQQueue.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQStreamMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQTempDestination.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQTempQueue.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQTempTopic.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQTextMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ActiveMQTopic.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\BaseCommand.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\BrokerId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\BrokerInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ConnectionError.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ConnectionId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ConnectionInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ConsumerId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ConsumerInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ControlCommand.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\DataArrayResponse.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\DataResponse.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\DestinationInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\DiscoveryEvent.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ExceptionResponse.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\FlushCommand.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\IntegerResponse.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\JournalQueueAck.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\JournalTopicAck.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\JournalTrace.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\JournalTransaction.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\KeepAliveInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\LocalTransactionId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\Message.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\MessageAck.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\MessageDispatch.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\MessageDispatchNotification.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\MessageId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ProducerId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ProducerInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\RemoveInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\RemoveSubscriptionInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\Response.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\SessionId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\SessionInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\ShutdownInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\SubscriptionInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\TransactionId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\TransactionInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\WireFormatInfo.cs"/>
|
||||
<Compile Include="OpenWire.Client\Commands\XATransactionId.cs"/>
|
||||
<Compile Include="OpenWire.Client\Connection.cs"/>
|
||||
<Compile Include="OpenWire.Client\ConnectionClosedException.cs"/>
|
||||
<Compile Include="OpenWire.Client\ConnectionFactory.cs"/>
|
||||
<Compile Include="OpenWire.Client\ConsumerClosedException.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\AbstractCommand.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\BaseDataStreamMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\BooleanStream.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\BrokerError.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\Command.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\DataStructure.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\DataStructureSupport.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\Dispatcher.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\FutureResponse.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\ISynchronization.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\ITransport.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\MarshallAware.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\MessagePropertyHelper.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\OpenWireFormat.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\PrimitiveMap.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\SocketTransport.cs"/>
|
||||
<Compile Include="OpenWire.Client\Core\TransactionContext.cs"/>
|
||||
<Compile Include="OpenWire.Client\DestinationFilter.cs"/>
|
||||
<Compile Include="OpenWire.Client\IBytesMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\IConnection.cs"/>
|
||||
<Compile Include="OpenWire.Client\IConnectionFactory.cs"/>
|
||||
<Compile Include="OpenWire.Client\IDestination.cs"/>
|
||||
<Compile Include="OpenWire.Client\IMapMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\IMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\IMessageConsumer.cs"/>
|
||||
<Compile Include="OpenWire.Client\IMessageProducer.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQBytesMessageMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQDestinationMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQMapMessageMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQMessageMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQObjectMessageMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQQueueMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQStreamMessageMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQTempDestinationMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQTempQueueMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQTempTopicMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQTextMessageMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ActiveMQTopicMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\BaseCommandMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\BrokerIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\BrokerInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ConnectionErrorMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ConnectionIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ConnectionInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ConsumerIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ConsumerInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ControlCommandMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\DataArrayResponseMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\DataResponseMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\DataStructureSupportMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\DestinationInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\DiscoveryEventMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ExceptionResponseMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\FlushCommandMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\IntegerResponseMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\JournalQueueAckMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\JournalTopicAckMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\JournalTraceMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\JournalTransactionMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\KeepAliveInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\LocalTransactionIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\MarshallerFactory.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\MessageAckMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\MessageDispatchMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\MessageDispatchNotificationMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\MessageIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\MessageMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ProducerIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ProducerInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\RemoveInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\RemoveSubscriptionInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ResponseMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\SessionIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\SessionInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\ShutdownInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\SubscriptionInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\TransactionIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\TransactionInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\WireFormatInfoMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IO\XATransactionIdMarshaller.cs"/>
|
||||
<Compile Include="OpenWire.Client\IPrimitiveMap.cs"/>
|
||||
<Compile Include="OpenWire.Client\IQueue.cs"/>
|
||||
<Compile Include="OpenWire.Client\ISession.cs"/>
|
||||
<Compile Include="OpenWire.Client\IStartable.cs"/>
|
||||
<Compile Include="OpenWire.Client\ITemporaryQueue.cs"/>
|
||||
<Compile Include="OpenWire.Client\ITemporaryTopic.cs"/>
|
||||
<Compile Include="OpenWire.Client\ITextMessage.cs"/>
|
||||
<Compile Include="OpenWire.Client\ITopic.cs"/>
|
||||
<Compile Include="OpenWire.Client\MessageConsumer.cs"/>
|
||||
<Compile Include="OpenWire.Client\MessageProducer.cs"/>
|
||||
<Compile Include="OpenWire.Client\OpenWireException.cs"/>
|
||||
<Compile Include="OpenWire.Client\Session.cs"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.30703</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{F7BA9EF7-ADF7-40EF-9A9E-206649DBB10C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>src</RootNamespace>
|
||||
<AssemblyName>src</AssemblyName>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<StartupObject/>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System"/>
|
||||
<Reference Include="System.Data"/>
|
||||
<Reference Include="System.Xml"/>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets"/>
|
||||
<ItemGroup>
|
||||
<Compile Include="ActiveMQ\BrokerException.cs"/>
|
||||
<Compile Include="ActiveMQ\Connection.cs"/>
|
||||
<Compile Include="ActiveMQ\ConnectionClosedException.cs"/>
|
||||
<Compile Include="ActiveMQ\ConnectionFactory.cs"/>
|
||||
<Compile Include="ActiveMQ\ConsumerClosedException.cs"/>
|
||||
<Compile Include="ActiveMQ\DestinationFilter.cs"/>
|
||||
<Compile Include="ActiveMQ\IBytesMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\IConnection.cs"/>
|
||||
<Compile Include="ActiveMQ\IConnectionFactory.cs"/>
|
||||
<Compile Include="ActiveMQ\IDestination.cs"/>
|
||||
<Compile Include="ActiveMQ\IMapMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\IMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\IMessageConsumer.cs"/>
|
||||
<Compile Include="ActiveMQ\IMessageProducer.cs"/>
|
||||
<Compile Include="ActiveMQ\IPrimitiveMap.cs"/>
|
||||
<Compile Include="ActiveMQ\IQueue.cs"/>
|
||||
<Compile Include="ActiveMQ\ISession.cs"/>
|
||||
<Compile Include="ActiveMQ\IStartable.cs"/>
|
||||
<Compile Include="ActiveMQ\ITemporaryQueue.cs"/>
|
||||
<Compile Include="ActiveMQ\ITemporaryTopic.cs"/>
|
||||
<Compile Include="ActiveMQ\ITextMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\ITopic.cs"/>
|
||||
<Compile Include="ActiveMQ\MessageConsumer.cs"/>
|
||||
<Compile Include="ActiveMQ\MessageProducer.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\AbstractCommand.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\BaseDataStreamMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\BooleanStream.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\BrokerError.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Command.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQBytesMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQDestination.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQMapMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQObjectMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQQueue.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQStreamMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTempDestination.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTempQueue.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTempTopic.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTextMessage.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ActiveMQTopic.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\BaseCommand.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\BrokerId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\BrokerInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ConnectionError.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ConnectionId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ConnectionInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ConsumerId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ConsumerInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ControlCommand.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\DataArrayResponse.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\DataResponse.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\DestinationInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\DiscoveryEvent.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ExceptionResponse.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\FlushCommand.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\IntegerResponse.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\JournalQueueAck.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\JournalTopicAck.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\JournalTrace.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\JournalTransaction.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\KeepAliveInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\LocalTransactionId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\Message.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\MessageAck.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\MessageDispatch.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\MessageDispatchNotification.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\MessageId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ProducerId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ProducerInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\RemoveInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\RemoveSubscriptionInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\Response.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\SessionId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\SessionInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\ShutdownInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\SubscriptionInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\TransactionId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\TransactionInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\WireFormatInfo.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Commands\XATransactionId.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\DataStructure.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\DataStructureSupport.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\Dispatcher.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\FutureResponse.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\ISynchronization.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\ITransport.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\MarshallAware.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\MessagePropertyHelper.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\OpenWireFormat.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\PrimitiveMap.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\SocketTransport.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\TransactionContext.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQBytesMessageMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQDestinationMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQMapMessageMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQMessageMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQObjectMessageMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQQueueMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQStreamMessageMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTempDestinationMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTempQueueMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTempTopicMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTextMessageMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ActiveMQTopicMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\BaseCommandMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\BrokerIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\BrokerInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ConnectionErrorMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ConnectionIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ConnectionInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ConsumerIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ConsumerInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ControlCommandMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\DataArrayResponseMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\DataResponseMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\DataStructureSupportMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\DestinationInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\DiscoveryEventMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ExceptionResponseMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\FlushCommandMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\IntegerResponseMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\JournalQueueAckMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\JournalTopicAckMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\JournalTraceMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\JournalTransactionMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\KeepAliveInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\LocalTransactionIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\MarshallerFactory.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\MessageAckMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\MessageDispatchMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\MessageDispatchNotificationMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\MessageIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\MessageMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ProducerIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ProducerInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\RemoveInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\RemoveSubscriptionInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ResponseMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\SessionIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\SessionInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\ShutdownInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\SubscriptionInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\TransactionIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\TransactionInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\WireFormatInfoMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWire\V1\XATransactionIdMarshaller.cs"/>
|
||||
<Compile Include="ActiveMQ\OpenWireException.cs"/>
|
||||
<Compile Include="ActiveMQ\Session.cs"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
|
|
@ -1,77 +1,91 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
namespace OpenWire.Client
|
||||
{
|
||||
[TestFixture]
|
||||
public class AsyncConsumeTest : TestSupport
|
||||
{
|
||||
protected Object semaphore = new Object();
|
||||
protected bool received;
|
||||
|
||||
[Test]
|
||||
public void TestAsynchronousConsume()
|
||||
{
|
||||
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
|
||||
Assert.IsTrue(factory != null, "no factory created");
|
||||
|
||||
using (IConnection connection = factory.CreateConnection())
|
||||
{
|
||||
Assert.IsTrue(connection != null, "no connection created");
|
||||
Console.WriteLine("Connected to ActiveMQ!");
|
||||
|
||||
ISession session = connection.CreateSession();
|
||||
IDestination destination = CreateDestination(session);
|
||||
Assert.IsTrue(destination != null, "No queue available!");
|
||||
|
||||
// lets create an async consumer
|
||||
// START SNIPPET: demo
|
||||
IMessageConsumer consumer = session.CreateConsumer(destination);
|
||||
consumer.Listener += new MessageListener(OnMessage);
|
||||
// END SNIPPET: demo
|
||||
|
||||
|
||||
// now lets send a message
|
||||
session = connection.CreateSession();
|
||||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
IMessage request = CreateMessage(session);
|
||||
request.JMSCorrelationID = "abc";
|
||||
request.JMSType = "Test";
|
||||
producer.Send(request);
|
||||
|
||||
|
||||
WaitForMessageToArrive();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void OnMessage(IMessage message)
|
||||
{
|
||||
Console.WriteLine("Received message: " + message);
|
||||
lock (semaphore)
|
||||
{
|
||||
received = true;
|
||||
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!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[TestFixture]
|
||||
public class AsyncConsumeTest : TestSupport
|
||||
{
|
||||
protected Object semaphore = new Object();
|
||||
protected bool received;
|
||||
|
||||
[Test]
|
||||
public void TestAsynchronousConsume()
|
||||
{
|
||||
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
|
||||
Assert.IsTrue(factory != null, "no factory created");
|
||||
|
||||
using (IConnection connection = factory.CreateConnection())
|
||||
{
|
||||
Assert.IsTrue(connection != null, "no connection created");
|
||||
Console.WriteLine("Connected to ActiveMQ!");
|
||||
|
||||
ISession session = connection.CreateSession();
|
||||
IDestination destination = CreateDestination(session);
|
||||
Assert.IsTrue(destination != null, "No queue available!");
|
||||
|
||||
// lets create an async consumer
|
||||
// START SNIPPET: demo
|
||||
IMessageConsumer consumer = session.CreateConsumer(destination);
|
||||
consumer.Listener += new MessageListener(OnMessage);
|
||||
// END SNIPPET: demo
|
||||
|
||||
|
||||
// now lets send a message
|
||||
session = connection.CreateSession();
|
||||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
IMessage request = CreateMessage(session);
|
||||
request.JMSCorrelationID = "abc";
|
||||
request.JMSType = "Test";
|
||||
producer.Send(request);
|
||||
|
||||
|
||||
WaitForMessageToArrive();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void OnMessage(IMessage message)
|
||||
{
|
||||
Console.WriteLine("Received message: " + message);
|
||||
lock (semaphore)
|
||||
{
|
||||
received = true;
|
||||
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!");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,33 +1,49 @@
|
|||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace OpenWire.Client
|
||||
{
|
||||
[TestFixture]
|
||||
public class BadConsumeTest : TestSupport
|
||||
{
|
||||
[Test]
|
||||
public void TestBadConsumeOperationToTestExceptions()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[TestFixture]
|
||||
public class BadConsumeTest : TestSupport
|
||||
{
|
||||
[Test]
|
||||
public void TestBadConsumeOperationToTestExceptions()
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,58 +1,55 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
|
||||
namespace OpenWire.Client
|
||||
{
|
||||
[ TestFixture ]
|
||||
public class BytesMessageTest : TestSupport
|
||||
{
|
||||
byte[] expected = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
|
||||
[ Test ]
|
||||
public override void SendAndSyncReceive()
|
||||
{
|
||||
base.SendAndSyncReceive();
|
||||
}
|
||||
|
||||
protected override IMessage CreateMessage(ISession session)
|
||||
{
|
||||
IBytesMessage request = session.CreateBytesMessage(expected);
|
||||
return request;
|
||||
}
|
||||
|
||||
protected override void AssertValidMessage(IMessage message)
|
||||
{
|
||||
Assert.IsTrue(message is IBytesMessage, "Did not receive a IBytesMessage: " + message);
|
||||
|
||||
Console.WriteLine("Received IBytesMessage: " + message);
|
||||
|
||||
IBytesMessage bytesMessage = (IBytesMessage) message;
|
||||
byte[] actual = bytesMessage.Content;
|
||||
Console.WriteLine("Received message with content: " + actual);
|
||||
Assert.AreEqual(expected, actual, "the message content");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[ TestFixture ]
|
||||
public class BytesMessageTest : TestSupport
|
||||
{
|
||||
byte[] expected = {1, 2, 3, 4, 5, 6, 7, 8};
|
||||
|
||||
[ Test ]
|
||||
public override void SendAndSyncReceive()
|
||||
{
|
||||
base.SendAndSyncReceive();
|
||||
}
|
||||
|
||||
protected override IMessage CreateMessage(ISession session)
|
||||
{
|
||||
IBytesMessage request = session.CreateBytesMessage(expected);
|
||||
return request;
|
||||
}
|
||||
|
||||
protected override void AssertValidMessage(IMessage message)
|
||||
{
|
||||
Assert.IsTrue(message is IBytesMessage, "Did not receive a IBytesMessage: " + message);
|
||||
|
||||
Console.WriteLine("Received IBytesMessage: " + message);
|
||||
|
||||
IBytesMessage bytesMessage = (IBytesMessage) message;
|
||||
byte[] actual = bytesMessage.Content;
|
||||
Console.WriteLine("Received message with content: " + actual);
|
||||
Assert.AreEqual(expected, actual, "the message content");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,10 +19,7 @@ using System.IO;
|
|||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
|
||||
namespace OpenWire.Client
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[ TestFixture ]
|
||||
public class ClientTest : TestSupport
|
||||
|
|
|
@ -1,61 +1,63 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using NUnit.Framework;
|
||||
using OpenWire.Client.Commands;
|
||||
using System.Collections;
|
||||
|
||||
namespace OpenWire.Client
|
||||
{
|
||||
[TestFixture]
|
||||
public class CommandTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void TestCommand()
|
||||
{
|
||||
ConsumerId value1 = new ConsumerId();
|
||||
value1.ConnectionId = "abc";
|
||||
value1.SessionId = 123;
|
||||
value1.Value = 456;
|
||||
|
||||
ConsumerId value2 = new ConsumerId();
|
||||
value2.ConnectionId = "abc";
|
||||
value2.SessionId = 123;
|
||||
value2.Value = 456;
|
||||
|
||||
ConsumerId value3 = new ConsumerId();
|
||||
value3.ConnectionId = "abc";
|
||||
value3.SessionId = 123;
|
||||
value3.Value = 457;
|
||||
|
||||
Assert.AreEqual(value1, value2, "value1 and value2 should be equal");
|
||||
Assert.AreEqual(value1.GetHashCode(), value2.GetHashCode(), "value1 and value2 hash codes should be equal");
|
||||
|
||||
Assert.IsTrue(!value1.Equals(value3), "value1 and value3 should not be equal");
|
||||
Assert.IsTrue(!value3.Equals(value2), "value3 and value2 should not be equal");
|
||||
|
||||
// now lets test an IDictionary
|
||||
IDictionary dictionary = new Hashtable();
|
||||
dictionary[value1] = value3;
|
||||
|
||||
// now lets lookup with a copy
|
||||
object actual = dictionary[value2];
|
||||
|
||||
Assert.AreEqual(value3, actual, "Should have found item in Map using value2 as a key");
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
|
||||
using ActiveMQ.OpenWire;
|
||||
using ActiveMQ.OpenWire.Commands;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[TestFixture]
|
||||
public class CommandTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void TestCommand()
|
||||
{
|
||||
ConsumerId value1 = new ConsumerId();
|
||||
value1.ConnectionId = "abc";
|
||||
value1.SessionId = 123;
|
||||
value1.Value = 456;
|
||||
|
||||
ConsumerId value2 = new ConsumerId();
|
||||
value2.ConnectionId = "abc";
|
||||
value2.SessionId = 123;
|
||||
value2.Value = 456;
|
||||
|
||||
ConsumerId value3 = new ConsumerId();
|
||||
value3.ConnectionId = "abc";
|
||||
value3.SessionId = 123;
|
||||
value3.Value = 457;
|
||||
|
||||
Assert.AreEqual(value1, value2, "value1 and value2 should be equal");
|
||||
Assert.AreEqual(value1.GetHashCode(), value2.GetHashCode(), "value1 and value2 hash codes should be equal");
|
||||
|
||||
Assert.IsTrue(!value1.Equals(value3), "value1 and value3 should not be equal");
|
||||
Assert.IsTrue(!value3.Equals(value2), "value3 and value2 should not be equal");
|
||||
|
||||
// now lets test an IDictionary
|
||||
IDictionary dictionary = new Hashtable();
|
||||
dictionary[value1] = value3;
|
||||
|
||||
// now lets lookup with a copy
|
||||
object actual = dictionary[value2];
|
||||
|
||||
Assert.AreEqual(value3, actual, "Should have found item in Map using value2 as a key");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,92 +1,89 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
|
||||
namespace OpenWire.Client
|
||||
{
|
||||
[TestFixture]
|
||||
public class ConsumerTest : TestSupport
|
||||
{
|
||||
IConnectionFactory factory;
|
||||
IConnection connection;
|
||||
IDestination destination;
|
||||
|
||||
[SetUp]
|
||||
protected void SetUp()
|
||||
{
|
||||
factory = new ConnectionFactory("localhost", 61616);
|
||||
connection = factory.CreateConnection();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
protected void TearDown()
|
||||
{
|
||||
connection.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Not fully implemented yet.")]
|
||||
public void testDurableConsumerSelectorChange()
|
||||
{
|
||||
|
||||
// Receive a message with the JMS API
|
||||
connection.ClientId="test";
|
||||
connection.Start();
|
||||
|
||||
ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
|
||||
destination = session.GetTopic("foo");
|
||||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
producer.Persistent = true;
|
||||
IMessageConsumer consumer = session.CreateDurableConsumer((ITopic)destination, "test", "color='red'", false);
|
||||
|
||||
// Send the messages
|
||||
ITextMessage message = session.CreateTextMessage("1st");
|
||||
//message.SetStringProperty("color", "red");
|
||||
producer.Send(message);
|
||||
|
||||
IMessage m = consumer.Receive(1000);
|
||||
Assert.IsNotNull(m);
|
||||
Assert.AreEqual("1st", ((ITextMessage)m).Text );
|
||||
|
||||
// Change the subscription.
|
||||
consumer.Dispose();
|
||||
consumer = session.CreateDurableConsumer((ITopic)destination, "test", "color='blue'", false);
|
||||
|
||||
message = session.CreateTextMessage("2nd");
|
||||
// message.setStringProperty("color", "red");
|
||||
producer.Send(message);
|
||||
message = session.CreateTextMessage("3rd");
|
||||
// message.setStringProperty("color", "blue");
|
||||
producer.Send(message);
|
||||
|
||||
// Selector should skip the 2nd message.
|
||||
m = consumer.Receive(1000);
|
||||
Assert.IsNotNull(m);
|
||||
Assert.AreEqual("3rd", ((ITextMessage)m).Text);
|
||||
|
||||
Assert.IsNull(consumer.ReceiveNoWait());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[TestFixture]
|
||||
public class ConsumerTest : TestSupport
|
||||
{
|
||||
IConnectionFactory factory;
|
||||
IConnection connection;
|
||||
IDestination destination;
|
||||
|
||||
[SetUp]
|
||||
protected void SetUp()
|
||||
{
|
||||
factory = new ConnectionFactory("localhost", 61616);
|
||||
connection = factory.CreateConnection();
|
||||
}
|
||||
|
||||
[TearDown]
|
||||
protected void TearDown()
|
||||
{
|
||||
connection.Dispose();
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Ignore("Not fully implemented yet.")]
|
||||
public void testDurableConsumerSelectorChange()
|
||||
{
|
||||
|
||||
// Receive a message with the JMS API
|
||||
connection.ClientId="test";
|
||||
connection.Start();
|
||||
|
||||
ISession session = connection.CreateSession(AcknowledgementMode.AutoAcknowledge);
|
||||
destination = session.GetTopic("foo");
|
||||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
producer.Persistent = true;
|
||||
IMessageConsumer consumer = session.CreateDurableConsumer((ITopic)destination, "test", "color='red'", false);
|
||||
|
||||
// Send the messages
|
||||
ITextMessage message = session.CreateTextMessage("1st");
|
||||
//message.SetStringProperty("color", "red");
|
||||
producer.Send(message);
|
||||
|
||||
IMessage m = consumer.Receive(1000);
|
||||
Assert.IsNotNull(m);
|
||||
Assert.AreEqual("1st", ((ITextMessage)m).Text );
|
||||
|
||||
// Change the subscription.
|
||||
consumer.Dispose();
|
||||
consumer = session.CreateDurableConsumer((ITopic)destination, "test", "color='blue'", false);
|
||||
|
||||
message = session.CreateTextMessage("2nd");
|
||||
// message.setStringProperty("color", "red");
|
||||
producer.Send(message);
|
||||
message = session.CreateTextMessage("3rd");
|
||||
// message.setStringProperty("color", "blue");
|
||||
producer.Send(message);
|
||||
|
||||
// Selector should skip the 2nd message.
|
||||
m = consumer.Receive(1000);
|
||||
Assert.IsNotNull(m);
|
||||
Assert.AreEqual("3rd", ((ITextMessage)m).Text);
|
||||
|
||||
Assert.IsNull(consumer.ReceiveNoWait());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,76 +1,78 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using NUnit.Framework;
|
||||
using OpenWire.Client.Core;
|
||||
using System;
|
||||
|
||||
namespace openwire_dotnet
|
||||
{
|
||||
[TestFixture]
|
||||
public class EndianTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void TestLongEndian()
|
||||
{
|
||||
long value = 0x0102030405060708L;
|
||||
|
||||
long newValue = BaseDataStreamMarshaller.SwitchEndian(value);
|
||||
|
||||
Console.WriteLine("New value: " + newValue);
|
||||
|
||||
Assert.AreEqual(0x0807060504030201L, newValue);
|
||||
|
||||
long actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
|
||||
|
||||
Assert.AreEqual(value, actual);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIntEndian()
|
||||
{
|
||||
int value = 0x12345678;
|
||||
|
||||
int newValue = BaseDataStreamMarshaller.SwitchEndian(value);
|
||||
|
||||
Console.WriteLine("New value: " + newValue);
|
||||
|
||||
Assert.AreEqual(0x78563412, newValue);
|
||||
|
||||
int actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
|
||||
|
||||
Assert.AreEqual(value, actual);
|
||||
}
|
||||
[Test]
|
||||
public void TestShortEndian()
|
||||
{
|
||||
short value = 0x1234;
|
||||
|
||||
short newValue = BaseDataStreamMarshaller.SwitchEndian(value);
|
||||
|
||||
Console.WriteLine("New value: " + newValue);
|
||||
|
||||
Assert.AreEqual(0x3412, newValue);
|
||||
|
||||
short actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
|
||||
|
||||
Assert.AreEqual(value, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
|
||||
using ActiveMQ.OpenWire;
|
||||
using ActiveMQ.OpenWire.Commands;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[TestFixture]
|
||||
public class EndianTest
|
||||
{
|
||||
|
||||
[Test]
|
||||
public void TestLongEndian()
|
||||
{
|
||||
long value = 0x0102030405060708L;
|
||||
|
||||
long newValue = BaseDataStreamMarshaller.SwitchEndian(value);
|
||||
|
||||
Console.WriteLine("New value: " + newValue);
|
||||
|
||||
Assert.AreEqual(0x0807060504030201L, newValue);
|
||||
|
||||
long actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
|
||||
|
||||
Assert.AreEqual(value, actual);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestIntEndian()
|
||||
{
|
||||
int value = 0x12345678;
|
||||
|
||||
int newValue = BaseDataStreamMarshaller.SwitchEndian(value);
|
||||
|
||||
Console.WriteLine("New value: " + newValue);
|
||||
|
||||
Assert.AreEqual(0x78563412, newValue);
|
||||
|
||||
int actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
|
||||
|
||||
Assert.AreEqual(value, actual);
|
||||
}
|
||||
[Test]
|
||||
public void TestShortEndian()
|
||||
{
|
||||
short value = 0x1234;
|
||||
|
||||
short newValue = BaseDataStreamMarshaller.SwitchEndian(value);
|
||||
|
||||
Console.WriteLine("New value: " + newValue);
|
||||
|
||||
Assert.AreEqual(0x3412, newValue);
|
||||
|
||||
short actual = BaseDataStreamMarshaller.SwitchEndian(newValue);
|
||||
|
||||
Assert.AreEqual(value, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,127 +1,124 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
|
||||
namespace OpenWire.Client
|
||||
{
|
||||
[ TestFixture ]
|
||||
public class JMSPropertyTest : TestSupport
|
||||
{
|
||||
// standard JMS properties
|
||||
string expectedText = "Hey this works!";
|
||||
string correlationID = "abc";
|
||||
ITemporaryQueue replyTo;
|
||||
bool persistent = true;
|
||||
byte priority = 5;
|
||||
String type = "FooType";
|
||||
String groupID = "MyGroup";
|
||||
int groupSeq = 1;
|
||||
|
||||
// custom properties
|
||||
string customText = "Cheese";
|
||||
bool custom1 = true;
|
||||
byte custom2 = 12;
|
||||
short custom3 = 0x1234;
|
||||
int custom4 = 0x12345678;
|
||||
long custom5 = 0x1234567812345678;
|
||||
char custom6 = 'J';
|
||||
|
||||
[ Test ]
|
||||
public override void SendAndSyncReceive()
|
||||
{
|
||||
base.SendAndSyncReceive();
|
||||
}
|
||||
|
||||
protected override IMessage CreateMessage(ISession session)
|
||||
{
|
||||
ITextMessage message = session.CreateTextMessage(expectedText);
|
||||
replyTo = session.CreateTemporaryQueue();
|
||||
|
||||
// lets set the headers
|
||||
message.JMSCorrelationID = correlationID;
|
||||
message.JMSReplyTo = replyTo;
|
||||
message.JMSPersistent = persistent;
|
||||
message.JMSPriority = priority;
|
||||
message.JMSType = type;
|
||||
message.JMSXGroupID = groupID;
|
||||
message.JMSXGroupSeq = groupSeq;
|
||||
|
||||
// lets set the custom headers
|
||||
message.Properties["customText"] = customText;
|
||||
message.Properties["custom1"] = custom1;
|
||||
message.Properties["custom2"] = custom2;
|
||||
message.Properties["custom3"] = custom3;
|
||||
message.Properties["custom4"] = custom4;
|
||||
message.Properties["custom5"] = custom5;
|
||||
message.Properties["custom6"] = custom6;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
protected override void AssertValidMessage(IMessage message)
|
||||
{
|
||||
Assert.IsTrue(message is ITextMessage, "Did not receive a ITextMessage!");
|
||||
|
||||
Console.WriteLine("Received Message: " + message);
|
||||
|
||||
ITextMessage textMessage = (ITextMessage) message;
|
||||
String text = textMessage.Text;
|
||||
Assert.AreEqual(expectedText, text, "the message text");
|
||||
|
||||
// compare standard JMS headers
|
||||
Assert.AreEqual(correlationID, message.JMSCorrelationID, "JMSCorrelationID");
|
||||
Assert.AreEqual(replyTo, message.JMSReplyTo, "JMSReplyTo");
|
||||
Assert.AreEqual(persistent, message.JMSPersistent, "JMSPersistent");
|
||||
Assert.AreEqual(priority, message.JMSPriority, "JMSPriority");
|
||||
Assert.AreEqual(type, message.JMSType, "JMSType");
|
||||
Assert.AreEqual(groupID, message.JMSXGroupID, "JMSXGroupID");
|
||||
Assert.AreEqual(groupSeq, message.JMSXGroupSeq, "JMSXGroupSeq");
|
||||
|
||||
// compare custom headers
|
||||
Assert.AreEqual(customText, message.Properties["customText"], "customText");
|
||||
Assert.AreEqual(custom1, message.Properties["custom1"], "custom1");
|
||||
Assert.AreEqual(custom2, message.Properties["custom2"], "custom2");
|
||||
Assert.AreEqual(custom3, message.Properties["custom3"], "custom3");
|
||||
Assert.AreEqual(custom4, message.Properties["custom4"], "custom4");
|
||||
// TODO
|
||||
Assert.AreEqual(custom5, message.Properties["custom5"], "custom5");
|
||||
Assert.AreEqual(custom6, message.Properties["custom6"], "custom6");
|
||||
|
||||
Assert.AreEqual(custom1, message.Properties.GetBool("custom1"), "custom1");
|
||||
Assert.AreEqual(custom2, message.Properties.GetByte("custom2"), "custom2");
|
||||
Assert.AreEqual(custom3, message.Properties.GetShort("custom3"), "custom3");
|
||||
Assert.AreEqual(custom4, message.Properties.GetInt("custom4"), "custom4");
|
||||
Assert.AreEqual(custom5, message.Properties.GetLong("custom5"), "custom5");
|
||||
Assert.AreEqual(custom6, message.Properties.GetChar("custom6"), "custom6");
|
||||
|
||||
// lets now look at some standard JMS headers
|
||||
Console.WriteLine("JMSExpiration: " + message.JMSExpiration);
|
||||
Console.WriteLine("JMSMessageId: " + message.JMSMessageId);
|
||||
Console.WriteLine("JMSRedelivered: " + message.JMSRedelivered);
|
||||
Console.WriteLine("JMSTimestamp: " + message.JMSTimestamp);
|
||||
Console.WriteLine("JMSXDeliveryCount: " + message.JMSXDeliveryCount);
|
||||
Console.WriteLine("JMSXProducerTXID: " + message.JMSXProducerTXID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[ TestFixture ]
|
||||
public class JMSPropertyTest : TestSupport
|
||||
{
|
||||
// standard JMS properties
|
||||
string expectedText = "Hey this works!";
|
||||
string correlationID = "abc";
|
||||
ITemporaryQueue replyTo;
|
||||
bool persistent = true;
|
||||
byte priority = 5;
|
||||
String type = "FooType";
|
||||
String groupID = "MyGroup";
|
||||
int groupSeq = 1;
|
||||
|
||||
// custom properties
|
||||
string customText = "Cheese";
|
||||
bool custom1 = true;
|
||||
byte custom2 = 12;
|
||||
short custom3 = 0x1234;
|
||||
int custom4 = 0x12345678;
|
||||
long custom5 = 0x1234567812345678;
|
||||
char custom6 = 'J';
|
||||
|
||||
[ Test ]
|
||||
public override void SendAndSyncReceive()
|
||||
{
|
||||
base.SendAndSyncReceive();
|
||||
}
|
||||
|
||||
protected override IMessage CreateMessage(ISession session)
|
||||
{
|
||||
ITextMessage message = session.CreateTextMessage(expectedText);
|
||||
replyTo = session.CreateTemporaryQueue();
|
||||
|
||||
// lets set the headers
|
||||
message.JMSCorrelationID = correlationID;
|
||||
message.JMSReplyTo = replyTo;
|
||||
message.JMSPersistent = persistent;
|
||||
message.JMSPriority = priority;
|
||||
message.JMSType = type;
|
||||
message.JMSXGroupID = groupID;
|
||||
message.JMSXGroupSeq = groupSeq;
|
||||
|
||||
// lets set the custom headers
|
||||
message.Properties["customText"] = customText;
|
||||
message.Properties["custom1"] = custom1;
|
||||
message.Properties["custom2"] = custom2;
|
||||
message.Properties["custom3"] = custom3;
|
||||
message.Properties["custom4"] = custom4;
|
||||
message.Properties["custom5"] = custom5;
|
||||
message.Properties["custom6"] = custom6;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
protected override void AssertValidMessage(IMessage message)
|
||||
{
|
||||
Assert.IsTrue(message is ITextMessage, "Did not receive a ITextMessage!");
|
||||
|
||||
Console.WriteLine("Received Message: " + message);
|
||||
|
||||
ITextMessage textMessage = (ITextMessage) message;
|
||||
String text = textMessage.Text;
|
||||
Assert.AreEqual(expectedText, text, "the message text");
|
||||
|
||||
// compare standard JMS headers
|
||||
Assert.AreEqual(correlationID, message.JMSCorrelationID, "JMSCorrelationID");
|
||||
Assert.AreEqual(replyTo, message.JMSReplyTo, "JMSReplyTo");
|
||||
Assert.AreEqual(persistent, message.JMSPersistent, "JMSPersistent");
|
||||
Assert.AreEqual(priority, message.JMSPriority, "JMSPriority");
|
||||
Assert.AreEqual(type, message.JMSType, "JMSType");
|
||||
Assert.AreEqual(groupID, message.JMSXGroupID, "JMSXGroupID");
|
||||
Assert.AreEqual(groupSeq, message.JMSXGroupSeq, "JMSXGroupSeq");
|
||||
|
||||
// compare custom headers
|
||||
Assert.AreEqual(customText, message.Properties["customText"], "customText");
|
||||
Assert.AreEqual(custom1, message.Properties["custom1"], "custom1");
|
||||
Assert.AreEqual(custom2, message.Properties["custom2"], "custom2");
|
||||
Assert.AreEqual(custom3, message.Properties["custom3"], "custom3");
|
||||
Assert.AreEqual(custom4, message.Properties["custom4"], "custom4");
|
||||
// TODO
|
||||
Assert.AreEqual(custom5, message.Properties["custom5"], "custom5");
|
||||
Assert.AreEqual(custom6, message.Properties["custom6"], "custom6");
|
||||
|
||||
Assert.AreEqual(custom1, message.Properties.GetBool("custom1"), "custom1");
|
||||
Assert.AreEqual(custom2, message.Properties.GetByte("custom2"), "custom2");
|
||||
Assert.AreEqual(custom3, message.Properties.GetShort("custom3"), "custom3");
|
||||
Assert.AreEqual(custom4, message.Properties.GetInt("custom4"), "custom4");
|
||||
Assert.AreEqual(custom5, message.Properties.GetLong("custom5"), "custom5");
|
||||
Assert.AreEqual(custom6, message.Properties.GetChar("custom6"), "custom6");
|
||||
|
||||
// lets now look at some standard JMS headers
|
||||
Console.WriteLine("JMSExpiration: " + message.JMSExpiration);
|
||||
Console.WriteLine("JMSMessageId: " + message.JMSMessageId);
|
||||
Console.WriteLine("JMSRedelivered: " + message.JMSRedelivered);
|
||||
Console.WriteLine("JMSTimestamp: " + message.JMSTimestamp);
|
||||
Console.WriteLine("JMSXDeliveryCount: " + message.JMSXDeliveryCount);
|
||||
Console.WriteLine("JMSXProducerTXID: " + message.JMSXProducerTXID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,95 +1,92 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
|
||||
namespace OpenWire.Client
|
||||
{
|
||||
[ TestFixture ]
|
||||
public class MapMessageTest : TestSupport
|
||||
{
|
||||
bool a = true;
|
||||
byte b = 123;
|
||||
char c = 'c';
|
||||
short d = 0x1234;
|
||||
int e = 0x12345678;
|
||||
long f = 0x1234567812345678;
|
||||
string g = "Hello World!";
|
||||
|
||||
[ Test ]
|
||||
public override void SendAndSyncReceive()
|
||||
{
|
||||
base.SendAndSyncReceive();
|
||||
}
|
||||
|
||||
protected override IMessage CreateMessage(ISession session)
|
||||
{
|
||||
IMapMessage message = session.CreateMapMessage();
|
||||
|
||||
message.Body["a"] = a;
|
||||
message.Body["b"] = b;
|
||||
message.Body["c"] = c;
|
||||
message.Body["d"] = d;
|
||||
message.Body["e"] = e;
|
||||
message.Body["f"] = f;
|
||||
message.Body["g"] = g;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
protected override void AssertValidMessage(IMessage message)
|
||||
{
|
||||
Assert.IsTrue(message is IMapMessage, "Did not receive a MapMessage!");
|
||||
IMapMessage mapMessage = (IMapMessage) message;
|
||||
|
||||
Console.WriteLine("Received MapMessage: " + message);
|
||||
Console.WriteLine("Received Count: " + mapMessage.Body.Count);
|
||||
|
||||
Assert.AreEqual(ToHex(f), ToHex(mapMessage.Body.GetLong("f")), "map entry: f as hex");
|
||||
|
||||
// use generic API to access entries
|
||||
Assert.AreEqual(a, mapMessage.Body["a"], "generic map entry: a");
|
||||
Assert.AreEqual(b, mapMessage.Body["b"], "generic map entry: b");
|
||||
Assert.AreEqual(c, mapMessage.Body["c"], "generic map entry: c");
|
||||
Assert.AreEqual(d, mapMessage.Body["d"], "generic map entry: d");
|
||||
Assert.AreEqual(e, mapMessage.Body["e"], "generic map entry: e");
|
||||
Assert.AreEqual(f, mapMessage.Body["f"], "generic map entry: f");
|
||||
Assert.AreEqual(g, mapMessage.Body["g"], "generic map entry: g");
|
||||
|
||||
// use type safe APIs
|
||||
Assert.AreEqual(a, mapMessage.Body.GetBool("a"), "map entry: a");
|
||||
Assert.AreEqual(b, mapMessage.Body.GetByte("b"), "map entry: b");
|
||||
Assert.AreEqual(c, mapMessage.Body.GetChar("c"), "map entry: c");
|
||||
Assert.AreEqual(d, mapMessage.Body.GetShort("d"), "map entry: d");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[ TestFixture ]
|
||||
public class MapMessageTest : TestSupport
|
||||
{
|
||||
bool a = true;
|
||||
byte b = 123;
|
||||
char c = 'c';
|
||||
short d = 0x1234;
|
||||
int e = 0x12345678;
|
||||
long f = 0x1234567812345678;
|
||||
string g = "Hello World!";
|
||||
|
||||
[ Test ]
|
||||
public override void SendAndSyncReceive()
|
||||
{
|
||||
base.SendAndSyncReceive();
|
||||
}
|
||||
|
||||
protected override IMessage CreateMessage(ISession session)
|
||||
{
|
||||
IMapMessage message = session.CreateMapMessage();
|
||||
|
||||
message.Body["a"] = a;
|
||||
message.Body["b"] = b;
|
||||
message.Body["c"] = c;
|
||||
message.Body["d"] = d;
|
||||
message.Body["e"] = e;
|
||||
message.Body["f"] = f;
|
||||
message.Body["g"] = g;
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
protected override void AssertValidMessage(IMessage message)
|
||||
{
|
||||
Assert.IsTrue(message is IMapMessage, "Did not receive a MapMessage!");
|
||||
IMapMessage mapMessage = (IMapMessage) message;
|
||||
|
||||
Console.WriteLine("Received MapMessage: " + message);
|
||||
Console.WriteLine("Received Count: " + mapMessage.Body.Count);
|
||||
|
||||
Assert.AreEqual(ToHex(f), ToHex(mapMessage.Body.GetLong("f")), "map entry: f as hex");
|
||||
|
||||
// use generic API to access entries
|
||||
Assert.AreEqual(a, mapMessage.Body["a"], "generic map entry: a");
|
||||
Assert.AreEqual(b, mapMessage.Body["b"], "generic map entry: b");
|
||||
Assert.AreEqual(c, mapMessage.Body["c"], "generic map entry: c");
|
||||
Assert.AreEqual(d, mapMessage.Body["d"], "generic map entry: d");
|
||||
Assert.AreEqual(e, mapMessage.Body["e"], "generic map entry: e");
|
||||
Assert.AreEqual(f, mapMessage.Body["f"], "generic map entry: f");
|
||||
Assert.AreEqual(g, mapMessage.Body["g"], "generic map entry: g");
|
||||
|
||||
// use type safe APIs
|
||||
Assert.AreEqual(a, mapMessage.Body.GetBool("a"), "map entry: a");
|
||||
Assert.AreEqual(b, mapMessage.Body.GetByte("b"), "map entry: b");
|
||||
Assert.AreEqual(c, mapMessage.Body.GetChar("c"), "map entry: c");
|
||||
Assert.AreEqual(d, mapMessage.Body.GetShort("d"), "map entry: d");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,10 +19,7 @@ using System.IO;
|
|||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
|
||||
namespace OpenWire.Client.Core
|
||||
namespace ActiveMQ.OpenWire
|
||||
{
|
||||
[TestFixture]
|
||||
public class BooleanStreamTest : TestSupport
|
||||
|
|
|
@ -1,80 +1,79 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
using OpenWire.Client.Commands;
|
||||
|
||||
namespace openwire_dotnet
|
||||
{
|
||||
public class TestMain
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine("About to connect to ActiveMQ");
|
||||
|
||||
// START SNIPPET: demo
|
||||
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
|
||||
using (IConnection connection = factory.CreateConnection())
|
||||
{
|
||||
Console.WriteLine("Created a connection!");
|
||||
|
||||
ISession session = connection.CreateSession();
|
||||
|
||||
IDestination destination = session.GetQueue("FOO.BAR");
|
||||
Console.WriteLine("Using destination: " + destination);
|
||||
|
||||
// lets create a consumer and producer
|
||||
IMessageConsumer consumer = session.CreateConsumer(destination);
|
||||
|
||||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
producer.Persistent = true;
|
||||
|
||||
// lets send a message
|
||||
ITextMessage request = session.CreateTextMessage("Hello World!");
|
||||
request.JMSCorrelationID = "abc";
|
||||
request.JMSXGroupID = "cheese";
|
||||
request.Properties["myHeader"] = "James";
|
||||
|
||||
producer.Send(request);
|
||||
|
||||
// lets consume a message
|
||||
ActiveMQTextMessage message = (ActiveMQTextMessage) consumer.Receive();
|
||||
if (message == null)
|
||||
{
|
||||
Console.WriteLine("No message received!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Received message with ID: " + message.JMSMessageId);
|
||||
Console.WriteLine("Received message with text: " + message.Text);
|
||||
}
|
||||
}
|
||||
// END SNIPPET: demo
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Caught: " + e);
|
||||
Console.WriteLine("Stack: " + e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using ActiveMQ.OpenWire;
|
||||
using ActiveMQ.OpenWire.Commands;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
public class TestMain
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine("About to connect to ActiveMQ");
|
||||
|
||||
// START SNIPPET: demo
|
||||
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
|
||||
using (IConnection connection = factory.CreateConnection())
|
||||
{
|
||||
Console.WriteLine("Created a connection!");
|
||||
|
||||
ISession session = connection.CreateSession();
|
||||
|
||||
IDestination destination = session.GetQueue("FOO.BAR");
|
||||
Console.WriteLine("Using destination: " + destination);
|
||||
|
||||
// lets create a consumer and producer
|
||||
IMessageConsumer consumer = session.CreateConsumer(destination);
|
||||
|
||||
IMessageProducer producer = session.CreateProducer(destination);
|
||||
producer.Persistent = true;
|
||||
|
||||
// lets send a message
|
||||
ITextMessage request = session.CreateTextMessage("Hello World!");
|
||||
request.JMSCorrelationID = "abc";
|
||||
request.JMSXGroupID = "cheese";
|
||||
request.Properties["myHeader"] = "James";
|
||||
|
||||
producer.Send(request);
|
||||
|
||||
// lets consume a message
|
||||
ActiveMQTextMessage message = (ActiveMQTextMessage) consumer.Receive();
|
||||
if (message == null)
|
||||
{
|
||||
Console.WriteLine("No message received!");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Received message with ID: " + message.JMSMessageId);
|
||||
Console.WriteLine("Received message with text: " + message.Text);
|
||||
}
|
||||
}
|
||||
// END SNIPPET: demo
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Caught: " + e);
|
||||
Console.WriteLine("Stack: " + e.StackTrace);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,11 +19,7 @@ using System.IO;
|
|||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
|
||||
|
||||
namespace OpenWire.Client
|
||||
namespace ActiveMQ
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -1,290 +1,287 @@
|
|||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
|
||||
using OpenWire.Client;
|
||||
using OpenWire.Client.Core;
|
||||
using System.Collections;
|
||||
|
||||
namespace OpenWire.Client
|
||||
{
|
||||
[TestFixture]
|
||||
public class TransactionTest : TestSupport
|
||||
{
|
||||
private static int destinationCounter;
|
||||
|
||||
IDestination destination;
|
||||
IConnection connection;
|
||||
ISession session;
|
||||
IMessageProducer producer;
|
||||
IMessageConsumer consumer;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Connect();
|
||||
|
||||
// lets consume any outstanding messages from previous test runs
|
||||
while (consumer.Receive(1000) != null)
|
||||
{
|
||||
}
|
||||
session.Commit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSendRollback()
|
||||
{
|
||||
IMessage[] outbound = new IMessage[]{
|
||||
session.CreateTextMessage("First Message"),
|
||||
session.CreateTextMessage("Second Message")
|
||||
};
|
||||
|
||||
//sends a message
|
||||
producer.Send(outbound[0]);
|
||||
session.Commit();
|
||||
|
||||
//sends a message that gets rollbacked
|
||||
producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
|
||||
session.Rollback();
|
||||
|
||||
//sends a message
|
||||
producer.Send(outbound[1]);
|
||||
session.Commit();
|
||||
|
||||
//receives the first message
|
||||
ArrayList messages = new ArrayList();
|
||||
Console.WriteLine("About to consume message 1");
|
||||
IMessage message = consumer.Receive(1000);
|
||||
messages.Add(message);
|
||||
Console.WriteLine("Received: " + message);
|
||||
|
||||
//receives the second message
|
||||
Console.WriteLine("About to consume message 2");
|
||||
message = consumer.Receive(4000);
|
||||
messages.Add(message);
|
||||
Console.WriteLine("Received: " + message);
|
||||
|
||||
//validates that the rollbacked was not consumed
|
||||
session.Commit();
|
||||
IMessage[] inbound = new IMessage[messages.Count];
|
||||
messages.CopyTo(inbound);
|
||||
AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSendSessionClose()
|
||||
{
|
||||
IMessage[] outbound = new IMessage[]{
|
||||
session.CreateTextMessage("First Message"),
|
||||
session.CreateTextMessage("Second Message")
|
||||
};
|
||||
|
||||
//sends a message
|
||||
producer.Send(outbound[0]);
|
||||
session.Commit();
|
||||
|
||||
//sends a message that gets rollbacked
|
||||
producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
|
||||
consumer.Dispose();
|
||||
session.Dispose();
|
||||
|
||||
Reconnect();
|
||||
|
||||
//sends a message
|
||||
producer.Send(outbound[1]);
|
||||
session.Commit();
|
||||
|
||||
//receives the first message
|
||||
ArrayList messages = new ArrayList();
|
||||
Console.WriteLine("About to consume message 1");
|
||||
IMessage message = consumer.Receive(1000);
|
||||
messages.Add(message);
|
||||
Console.WriteLine("Received: " + message);
|
||||
|
||||
//receives the second message
|
||||
Console.WriteLine("About to consume message 2");
|
||||
message = consumer.Receive(4000);
|
||||
messages.Add(message);
|
||||
Console.WriteLine("Received: " + message);
|
||||
|
||||
//validates that the rollbacked was not consumed
|
||||
session.Commit();
|
||||
IMessage[] inbound = new IMessage[messages.Count];
|
||||
messages.CopyTo(inbound);
|
||||
AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReceiveRollback()
|
||||
{
|
||||
IMessage[] outbound = new IMessage[]{
|
||||
session.CreateTextMessage("First Message"),
|
||||
session.CreateTextMessage("Second Message")
|
||||
};
|
||||
|
||||
//sent both messages
|
||||
producer.Send(outbound[0]);
|
||||
producer.Send(outbound[1]);
|
||||
session.Commit();
|
||||
|
||||
Console.WriteLine("Sent 0: " + outbound[0]);
|
||||
Console.WriteLine("Sent 1: " + outbound[1]);
|
||||
|
||||
ArrayList messages = new ArrayList();
|
||||
IMessage message = consumer.Receive(1000);
|
||||
messages.Add(message);
|
||||
Assert.AreEqual(outbound[0], message);
|
||||
session.Commit();
|
||||
|
||||
// rollback so we can get that last message again.
|
||||
message = consumer.Receive(1000);
|
||||
Assert.IsNotNull(message);
|
||||
Assert.AreEqual(outbound[1], message);
|
||||
session.Rollback();
|
||||
|
||||
// Consume again.. the previous message should
|
||||
// get redelivered.
|
||||
message = consumer.Receive(5000);
|
||||
Assert.IsNotNull(message, "Should have re-received the message again!");
|
||||
messages.Add(message);
|
||||
session.Commit();
|
||||
|
||||
IMessage[] inbound = new IMessage[messages.Count];
|
||||
messages.CopyTo(inbound);
|
||||
AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestReceiveTwoThenRollback()
|
||||
{
|
||||
IMessage[] outbound = new IMessage[]{
|
||||
session.CreateTextMessage("First Message"),
|
||||
session.CreateTextMessage("Second Message")
|
||||
};
|
||||
|
||||
producer.Send(outbound[0]);
|
||||
producer.Send(outbound[1]);
|
||||
session.Commit();
|
||||
|
||||
Console.WriteLine("Sent 0: " + outbound[0]);
|
||||
Console.WriteLine("Sent 1: " + outbound[1]);
|
||||
|
||||
ArrayList messages = new ArrayList();
|
||||
IMessage message = consumer.Receive(1000);
|
||||
AssertTextMessageEqual("first mesage received before rollback", outbound[0], message);
|
||||
|
||||
message = consumer.Receive(1000);
|
||||
Assert.IsNotNull(message);
|
||||
AssertTextMessageEqual("second message received before rollback", outbound[1], message);
|
||||
session.Rollback();
|
||||
|
||||
// Consume again.. the previous message should
|
||||
// get redelivered.
|
||||
message = consumer.Receive(5000);
|
||||
Assert.IsNotNull(message, "Should have re-received the first message again!");
|
||||
messages.Add(message);
|
||||
AssertTextMessageEqual("first message received after rollback", outbound[0], message);
|
||||
|
||||
message = consumer.Receive(5000);
|
||||
Assert.IsNotNull(message, "Should have re-received the second message again!");
|
||||
messages.Add(message);
|
||||
AssertTextMessageEqual("second message received after rollback", outbound[1], message);
|
||||
|
||||
Assert.IsNull(consumer.ReceiveNoWait());
|
||||
session.Commit();
|
||||
|
||||
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?
|
||||
return base.CreateDestinationName() + (++destinationCounter);
|
||||
}
|
||||
|
||||
protected void AssertTextMessagesEqual(String message, IMessage[] expected, IMessage[] actual)
|
||||
{
|
||||
Assert.AreEqual(expected.Length, actual.Length, "Incorrect number of messages received");
|
||||
|
||||
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");
|
||||
Assert.IsTrue(actual is ITextMessage, "actual object not a text message");
|
||||
|
||||
String expectedText = ((ITextMessage) expected).Text;
|
||||
String actualText = ((ITextMessage) actual).Text;
|
||||
|
||||
Assert.AreEqual(expectedText, actualText, message);
|
||||
}
|
||||
|
||||
protected void Connect()
|
||||
{
|
||||
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
|
||||
|
||||
connection = factory.CreateConnection();
|
||||
|
||||
session = connection.CreateSession(AcknowledgementMode.Transactional);
|
||||
|
||||
// reuse the same destination if we reconnect
|
||||
if (destination == null)
|
||||
{
|
||||
destination = CreateDestination(session);
|
||||
}
|
||||
|
||||
consumer = session.CreateConsumer(destination);
|
||||
|
||||
producer = session.CreateProducer(destination);
|
||||
}
|
||||
|
||||
|
||||
protected void Disconnect()
|
||||
{
|
||||
if (connection != null)
|
||||
{
|
||||
connection.Dispose();
|
||||
connection = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Reconnect()
|
||||
{
|
||||
Disconnect();
|
||||
Connect();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright 2006 The Apache Software Foundation or its licensors, as
|
||||
* applicable.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using NUnit.Framework;
|
||||
using System.Collections;
|
||||
|
||||
namespace ActiveMQ
|
||||
{
|
||||
[TestFixture]
|
||||
public class TransactionTest : TestSupport
|
||||
{
|
||||
private static int destinationCounter;
|
||||
|
||||
IDestination destination;
|
||||
IConnection connection;
|
||||
ISession session;
|
||||
IMessageProducer producer;
|
||||
IMessageConsumer consumer;
|
||||
|
||||
[SetUp]
|
||||
public void SetUp()
|
||||
{
|
||||
Connect();
|
||||
|
||||
// lets consume any outstanding messages from previous test runs
|
||||
while (consumer.Receive(1000) != null)
|
||||
{
|
||||
}
|
||||
session.Commit();
|
||||
}
|
||||
|
||||
|
||||
|
||||
[TearDown]
|
||||
public void TearDown()
|
||||
{
|
||||
Disconnect();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSendRollback()
|
||||
{
|
||||
IMessage[] outbound = new IMessage[]{
|
||||
session.CreateTextMessage("First Message"),
|
||||
session.CreateTextMessage("Second Message")
|
||||
};
|
||||
|
||||
//sends a message
|
||||
producer.Send(outbound[0]);
|
||||
session.Commit();
|
||||
|
||||
//sends a message that gets rollbacked
|
||||
producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
|
||||
session.Rollback();
|
||||
|
||||
//sends a message
|
||||
producer.Send(outbound[1]);
|
||||
session.Commit();
|
||||
|
||||
//receives the first message
|
||||
ArrayList messages = new ArrayList();
|
||||
Console.WriteLine("About to consume message 1");
|
||||
IMessage message = consumer.Receive(1000);
|
||||
messages.Add(message);
|
||||
Console.WriteLine("Received: " + message);
|
||||
|
||||
//receives the second message
|
||||
Console.WriteLine("About to consume message 2");
|
||||
message = consumer.Receive(4000);
|
||||
messages.Add(message);
|
||||
Console.WriteLine("Received: " + message);
|
||||
|
||||
//validates that the rollbacked was not consumed
|
||||
session.Commit();
|
||||
IMessage[] inbound = new IMessage[messages.Count];
|
||||
messages.CopyTo(inbound);
|
||||
AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestSendSessionClose()
|
||||
{
|
||||
IMessage[] outbound = new IMessage[]{
|
||||
session.CreateTextMessage("First Message"),
|
||||
session.CreateTextMessage("Second Message")
|
||||
};
|
||||
|
||||
//sends a message
|
||||
producer.Send(outbound[0]);
|
||||
session.Commit();
|
||||
|
||||
//sends a message that gets rollbacked
|
||||
producer.Send(session.CreateTextMessage("I'm going to get rolled back."));
|
||||
consumer.Dispose();
|
||||
session.Dispose();
|
||||
|
||||
Reconnect();
|
||||
|
||||
//sends a message
|
||||
producer.Send(outbound[1]);
|
||||
session.Commit();
|
||||
|
||||
//receives the first message
|
||||
ArrayList messages = new ArrayList();
|
||||
Console.WriteLine("About to consume message 1");
|
||||
IMessage message = consumer.Receive(1000);
|
||||
messages.Add(message);
|
||||
Console.WriteLine("Received: " + message);
|
||||
|
||||
//receives the second message
|
||||
Console.WriteLine("About to consume message 2");
|
||||
message = consumer.Receive(4000);
|
||||
messages.Add(message);
|
||||
Console.WriteLine("Received: " + message);
|
||||
|
||||
//validates that the rollbacked was not consumed
|
||||
session.Commit();
|
||||
IMessage[] inbound = new IMessage[messages.Count];
|
||||
messages.CopyTo(inbound);
|
||||
AssertTextMessagesEqual("Rollback did not work.", outbound, inbound);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestReceiveRollback()
|
||||
{
|
||||
IMessage[] outbound = new IMessage[]{
|
||||
session.CreateTextMessage("First Message"),
|
||||
session.CreateTextMessage("Second Message")
|
||||
};
|
||||
|
||||
//sent both messages
|
||||
producer.Send(outbound[0]);
|
||||
producer.Send(outbound[1]);
|
||||
session.Commit();
|
||||
|
||||
Console.WriteLine("Sent 0: " + outbound[0]);
|
||||
Console.WriteLine("Sent 1: " + outbound[1]);
|
||||
|
||||
ArrayList messages = new ArrayList();
|
||||
IMessage message = consumer.Receive(1000);
|
||||
messages.Add(message);
|
||||
Assert.AreEqual(outbound[0], message);
|
||||
session.Commit();
|
||||
|
||||
// rollback so we can get that last message again.
|
||||
message = consumer.Receive(1000);
|
||||
Assert.IsNotNull(message);
|
||||
Assert.AreEqual(outbound[1], message);
|
||||
session.Rollback();
|
||||
|
||||
// Consume again.. the previous message should
|
||||
// get redelivered.
|
||||
message = consumer.Receive(5000);
|
||||
Assert.IsNotNull(message, "Should have re-received the message again!");
|
||||
messages.Add(message);
|
||||
session.Commit();
|
||||
|
||||
IMessage[] inbound = new IMessage[messages.Count];
|
||||
messages.CopyTo(inbound);
|
||||
AssertTextMessagesEqual("Rollback did not work", outbound, inbound);
|
||||
}
|
||||
|
||||
|
||||
[Test]
|
||||
public void TestReceiveTwoThenRollback()
|
||||
{
|
||||
IMessage[] outbound = new IMessage[]{
|
||||
session.CreateTextMessage("First Message"),
|
||||
session.CreateTextMessage("Second Message")
|
||||
};
|
||||
|
||||
producer.Send(outbound[0]);
|
||||
producer.Send(outbound[1]);
|
||||
session.Commit();
|
||||
|
||||
Console.WriteLine("Sent 0: " + outbound[0]);
|
||||
Console.WriteLine("Sent 1: " + outbound[1]);
|
||||
|
||||
ArrayList messages = new ArrayList();
|
||||
IMessage message = consumer.Receive(1000);
|
||||
AssertTextMessageEqual("first mesage received before rollback", outbound[0], message);
|
||||
|
||||
message = consumer.Receive(1000);
|
||||
Assert.IsNotNull(message);
|
||||
AssertTextMessageEqual("second message received before rollback", outbound[1], message);
|
||||
session.Rollback();
|
||||
|
||||
// Consume again.. the previous message should
|
||||
// get redelivered.
|
||||
message = consumer.Receive(5000);
|
||||
Assert.IsNotNull(message, "Should have re-received the first message again!");
|
||||
messages.Add(message);
|
||||
AssertTextMessageEqual("first message received after rollback", outbound[0], message);
|
||||
|
||||
message = consumer.Receive(5000);
|
||||
Assert.IsNotNull(message, "Should have re-received the second message again!");
|
||||
messages.Add(message);
|
||||
AssertTextMessageEqual("second message received after rollback", outbound[1], message);
|
||||
|
||||
Assert.IsNull(consumer.ReceiveNoWait());
|
||||
session.Commit();
|
||||
|
||||
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?
|
||||
return base.CreateDestinationName() + (++destinationCounter);
|
||||
}
|
||||
|
||||
protected void AssertTextMessagesEqual(String message, IMessage[] expected, IMessage[] actual)
|
||||
{
|
||||
Assert.AreEqual(expected.Length, actual.Length, "Incorrect number of messages received");
|
||||
|
||||
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");
|
||||
Assert.IsTrue(actual is ITextMessage, "actual object not a text message");
|
||||
|
||||
String expectedText = ((ITextMessage) expected).Text;
|
||||
String actualText = ((ITextMessage) actual).Text;
|
||||
|
||||
Assert.AreEqual(expectedText, actualText, message);
|
||||
}
|
||||
|
||||
protected void Connect()
|
||||
{
|
||||
IConnectionFactory factory = new ConnectionFactory("localhost", 61616);
|
||||
|
||||
connection = factory.CreateConnection();
|
||||
|
||||
session = connection.CreateSession(AcknowledgementMode.Transactional);
|
||||
|
||||
// reuse the same destination if we reconnect
|
||||
if (destination == null)
|
||||
{
|
||||
destination = CreateDestination(session);
|
||||
}
|
||||
|
||||
consumer = session.CreateConsumer(destination);
|
||||
|
||||
producer = session.CreateProducer(destination);
|
||||
}
|
||||
|
||||
|
||||
protected void Disconnect()
|
||||
{
|
||||
if (connection != null)
|
||||
{
|
||||
connection.Dispose();
|
||||
connection = null;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Reconnect()
|
||||
{
|
||||
Disconnect();
|
||||
Connect();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,25 +34,25 @@
|
|||
<Reference Include="System.Xml"/>
|
||||
</ItemGroup>
|
||||
<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>
|
||||
<ProjectReference Include="../src/src.csproj">
|
||||
<Name>src</Name>
|
||||
<Project>{F7BA9EF7-ADF7-40EF-9A9E-206649DBB10C}</Project>
|
||||
</ProjectReference>
|
||||
</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>
|
||||
|
|
Loading…
Reference in New Issue